:root {
    --app-bg-1: #eef6ff;
    --app-bg-2: #f7fbff;
    --app-bg-3: #f9fafc;
    --surface: #ffffff;
    --surface-muted: #f8fafd;
    --border-soft: #d8e2ed;
    --text-main: #1f2d3d;
    --text-muted: #5c6b7a;
    --sidebar-bg: #0b1f32;
    --sidebar-hover: #1f4365;
    --sidebar-active: #2a5d88;
    --primary-shadow: 0 6px 18px rgba(15, 31, 49, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    background: radial-gradient(1200px 700px at top left, var(--app-bg-1), var(--app-bg-2) 50%, var(--app-bg-3) 100%);
    color: var(--text-main);
    margin: 0;
    font-family: "Segoe UI", "Noto Sans", "Helvetica Neue", sans-serif;
}

.card {
    border: 1px solid var(--border-soft);
    border-radius: 0.7rem;
    box-shadow: var(--primary-shadow);
    background: var(--surface);
}

.card-header {
    border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(180deg, #fbfdff, #f5f9fe);
    font-weight: 600;
}

.table {
    margin-bottom: 0;
}

.table th {
    font-size: 0.83rem;
    letter-spacing: 0.01em;
    color: #35475b;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.form-label {
    font-weight: 600;
    font-size: 0.86rem;
    color: #33465a;
}

.form-control,
.form-select {
    border-color: #cfdbea;
}

.form-control:focus,
.form-select:focus {
    border-color: #73a7dd;
    box-shadow: 0 0 0 0.2rem rgba(54, 128, 207, 0.14);
}

.btn {
    border-radius: 0.5rem;
}

.app-layout {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    position: relative;
}

.sidebar {
    background: var(--sidebar-bg);
    color: #d9e7f5;
    padding: 1rem;
    border-right: 1px solid #274868;
    position: sticky;
    top: 0;
    width: 292px;
    flex: 0 0 292px;
    height: 100vh;
    overflow-y: auto;
    z-index: 30;
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #ffffff;
}

.sidebar-userbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #274868;
    border-radius: 0.45rem;
    padding: 0.4rem 0.55rem;
    background: #0f2b44;
}

.sidebar-userbar .btn-link {
    color: #d9e7f5;
    text-decoration: none;
}

.sidebar-userbar .btn-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.sidebar .nav-link {
    color: #d9e7f5;
    border-radius: 0.48rem;
    padding: 0.45rem 0.65rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: #ffffff;
}

.content {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.content-shell {
    max-width: 1500px;
    margin: 0 auto;
}

.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
}

.hamburger-btn {
    width: 38px;
    height: 32px;
    border: 1px solid #a9b6c3;
    border-radius: 0.35rem;
    background: #ffffff;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 8px;
}

.hamburger-btn span {
    display: block;
    height: 2px;
    background: #1f2d3d;
    border-radius: 999px;
}

.sidebar-overlay {
    display: none;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1rem;
}

pre.code-box {
    white-space: pre-wrap;
    background: #0f172a;
    color: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
}

.ocr-uncertain {
    border-left: 4px solid #dc3545;
    padding-left: 0.75rem;
}

.task-calendar {
    width: 100%;
}

.task-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    font-size: 0.86rem;
    color: #41556a;
    font-weight: 600;
}

.task-cal-weekdays > div {
    padding: 0.2rem 0.3rem;
}

.task-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}

.task-cal-cell {
    min-height: 120px;
    border: 1px solid #dbe3ea;
    border-radius: 0.45rem;
    background: #ffffff;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
}

.task-cal-empty {
    background: transparent;
    border-style: dashed;
}

.task-cal-day {
    font-weight: 700;
    color: #223447;
    margin-bottom: 0.3rem;
}

.task-cal-items {
    display: grid;
    gap: 0.25rem;
}

.task-cal-item {
    display: block;
    border-radius: 0.35rem;
    padding: 0.2rem 0.3rem;
    text-decoration: none;
    color: #0b1f32;
    font-size: 0.78rem;
    line-height: 1.2;
    border: 1px solid #dbe3ea;
    background: #f8fafc;
}

.task-cal-item.priority-high {
    border-color: #f2b0b0;
    background: #fff3f3;
}

.task-cal-item.priority-med {
    border-color: #f3d8a6;
    background: #fff8ea;
}

.task-cal-item.priority-low {
    border-color: #b9dfc8;
    background: #eefbf2;
}

.task-cal-item:hover {
    background: #eef5ff;
    border-color: #99b9de;
}

@media (max-width: 992px) {
    .app-layout {
        display: block;
    }

    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(88vw, 320px);
        flex: none;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        height: 100vh;
        overflow-y: auto;
    }

    .app-layout.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-layout.sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 20;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .task-cal-weekdays,
    .task-cal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .task-cal-cell {
        min-height: 90px;
    }

    .content {
        width: auto;
        min-width: auto;
    }

    .content-shell {
        max-width: 100%;
    }

    .table {
        font-size: 0.92rem;
    }
}
