:root {
    color-scheme: light;
    --ink: #172744;
    --muted: #4e617e;
    --line: #dce5f1;
    --canvas: #f3f6fb;
    --surface: #fff;
    --blue: #1c56cc;
    --blue-dark: #1647ac;
    --blue-light: #eaf1ff;
    --nav: #111d35;
    --nav-ink: #c8d6ec;
    --nav-muted: #a8bdd8;
    --success: #11644e;
    --danger: #a32a34;
    --warning: #7c4e05;
    --radius: 15px;
    --shadow: 0 3px 10px #233f6410;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--canvas);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.5;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.17; text-wrap: balance; }
h1 { font-size: clamp(1.85rem, 4vw, 2.65rem); letter-spacing: -.045em; }
h2 { font-size: 1.23rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
p + p { margin-top: .65rem; }
a { color: var(--blue-dark); text-underline-offset: .17em; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
summary { color: var(--blue-dark); font-weight: 650; }
summary + * { margin-top: .85rem; }
:focus-visible { outline: 3px solid #4f86f0; outline-offset: 3px; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 10; transform: translateY(-180%); background: var(--surface); padding: .75rem 1rem; border-radius: 8px; font-weight: 700; }
.skip-link:focus { transform: translateY(0); }
.icon { flex: 0 0 auto; vertical-align: middle; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar {
    display: flex; flex-direction: column; min-width: 0; position: sticky; top: 0;
    height: 100vh; height: 100dvh; padding: 1.7rem 1rem 1rem; background: var(--nav); color: #fff;
    overflow-y: auto;
}
.brand { display: flex; gap: .72rem; align-items: center; color: inherit; text-decoration: none; padding: .15rem .35rem; }
.brand-mark { display: block; flex-shrink: 0; }
.brand > span { font-size: 1.14rem; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; }
.brand strong { font-weight: 760; }
.brand small { display: block; color: var(--nav-muted); font-size: .61rem; letter-spacing: .09em; margin-top: .28rem; white-space: nowrap; }
.desktop-navigation { margin-top: 2.25rem; }
.mobile-navigation { display: none; }
.main-nav, .nav-group { display: grid; gap: .28rem; }
.main-nav { gap: 1.55rem; }
.nav-label { color: var(--nav-muted); text-transform: uppercase; letter-spacing: .1em; font-size: .67rem; font-weight: 700; padding: 0 .68rem .25rem; }
.main-nav a {
    color: var(--nav-ink); display: flex; align-items: center; gap: .7rem; min-height: 43px;
    padding: .57rem .68rem; border-radius: 8px; text-decoration: none; font-size: .91rem; font-weight: 600;
}
.main-nav a:hover { background: #21334f; color: #fff; }
.main-nav a.active { background: #244373; color: #fff; box-shadow: inset 3px 0 #78aaff; }
.main-nav a.active .icon { color: #b0ceff; }
.sidebar-account { display: flex; align-items: center; gap: .62rem; border-top: 1px solid #344259; margin-top: auto; padding: .95rem .1rem 0; min-width: 0; }
.desktop-navigation + .mobile-navigation + .sidebar-account { margin-top: auto; }
.sidebar-account form { margin-left: auto; }
.avatar { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 50%; background: #284875; color: #e9f1ff; font-size: .88rem; font-weight: 750; }
.sidebar-identity { min-width: 0; display: grid; gap: .05rem; }
.sidebar-identity strong, .sidebar-identity small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-identity strong { font-size: .82rem; }
.sidebar-identity small { color: var(--nav-muted); font-size: .7rem; }
.icon-button { display: inline-grid; place-items: center; width: 37px; height: 37px; border: 0; border-radius: 7px; background: transparent; color: var(--nav-ink); }
.icon-button:hover { background: #233756; color: #fff; }
.workspace { min-width: 0; }
.topbar {
    min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .65rem clamp(1.1rem, 3.5vw, 2.4rem); border-bottom: 1px solid var(--line); background: var(--surface);
}
.topbar-workspace { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; font-size: .92rem; font-weight: 700; }
.topbar-workspace .icon { color: var(--blue); }
.topbar-workspace span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-link { display: inline-flex; align-items: center; gap: .18rem; text-decoration: none; font-size: .83rem; font-weight: 650; }
.topbar-link .icon { width: 15px; }
.content { max-width: 1470px; margin-inline: auto; padding: clamp(1.15rem, 3.2vw, 2.4rem); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.15rem; margin: 0 0 1.45rem; }
.eyebrow { margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .115em; font-size: .69rem; font-weight: 800; color: var(--blue-dark); }
.page-intro { margin-top: .55rem; color: var(--muted); max-width: 68ch; }
.card, .metric {
    min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(1rem, 2.2vw, 1.45rem); box-shadow: var(--shadow);
}
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .9rem; margin-bottom: .9rem; }
.card-header p { color: var(--muted); font-size: .91rem; margin-top: .35rem; }
.card > h2:first-child { margin-bottom: .8rem; }
.card > * + .form-grid, .card > * + form, .card > * + details, .card > * + .actions { margin-top: 1rem; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; align-items: start; }
.section-grid.wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 1rem; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-label { display: block; font-size: .86rem; color: var(--muted); font-weight: 650; }
.metric-value { display: block; color: var(--ink); font-size: clamp(1.3rem, 3vw, 1.85rem); letter-spacing: -.04em; font-weight: 750; font-variant-numeric: tabular-nums; }
.metric-icon { display: inline-grid; width: 34px; height: 34px; place-items: center; background: var(--blue-light); color: var(--blue-dark); border-radius: 9px; margin-bottom: .55rem; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.empty { padding: .8rem 1rem; color: var(--muted); border: 1px dashed #bfd0e7; border-radius: 9px; }
.notice, .feedback { display: flex; align-items: flex-start; gap: .52rem; border: 1px solid #c7d9fb; border-radius: 9px; padding: .7rem .85rem; color: #214d8f; background: #eef4ff; overflow-wrap: anywhere; }
.feedback { margin-bottom: 1rem; }
.feedback .icon { margin-top: .15rem; }
.feedback-error { background: #fff0f1; color: #902533; border-color: #f0b9bf; }
.feedback-success { background: #eaf8f2; color: #135d48; border-color: #b5dfcf; }
.badge { display: inline-flex; align-items: center; align-self: center; gap: .26rem; width: fit-content; color: #294975; background: #eaf1fb; border-radius: 99px; padding: .18rem .55rem; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.badge.success { background: #e6f5ef; color: var(--success); }
.badge.warning { background: #fff2d5; color: var(--warning); }
.badge.danger { background: #fbe6e9; color: var(--danger); }
.badge.neutral { background: #edf0f5; color: #465c78; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem 1rem; }
.weekday-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: .28rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, label.field { font-weight: 650; color: var(--ink); font-size: .88rem; }
.field small, .hint { color: var(--muted); font-size: .8rem; line-height: 1.4; }
input:not([type=hidden], [type=checkbox], [type=radio]), select, textarea {
    min-height: 42px; max-width: 100%; width: 100%; padding: .45rem .62rem; color: var(--ink);
    border: 1px solid #abbdd6; border-radius: 7px; background: var(--surface);
}
input[type=checkbox], input[type=radio] { accent-color: var(--blue); width: 1rem; height: 1rem; margin: 0; }
.checkbox-label { display: flex; gap: .5rem; align-items: center; min-height: 40px; width: fit-content; }
textarea { min-height: 90px; resize: vertical; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: .65rem .8rem .8rem; }
legend { color: var(--ink); font-weight: 700; padding: 0 .32rem; font-size: .9rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.actions > form { margin: 0; }
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 41px; max-width: 100%;
    padding: .46rem .84rem; border: 1px solid #acc1e1; background: var(--surface); color: var(--blue-dark);
    border-radius: 8px; text-decoration: none; font-weight: 700; font-size: .87rem; text-align: center;
}
.button .icon { width: 17px; height: 17px; }
.button:hover { background: #edf3ff; border-color: #8faee4; }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button.danger { background: #fff5f6; color: var(--danger); border-color: #e6b8be; }
.button.danger:hover { background: #fbe4e7; }
.button.small { min-height: 33px; padding: .27rem .62rem; font-size: .8rem; }
button:disabled { opacity: .58; cursor: default; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.data-table { border-collapse: collapse; width: 100%; text-align: left; font-size: .88rem; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: .66rem .65rem; vertical-align: top; }
.data-table th { color: #415774; font-size: .76rem; font-weight: 750; background: #f4f7fc; }
.data-table td:first-child, .data-table th:first-child { padding-left: .55rem; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-hero {
    position: relative; isolation: isolate; overflow: hidden; display: flex; justify-content: space-between;
    gap: 1.4rem; align-items: flex-end; border-radius: 18px; min-height: 186px; margin-bottom: 1.15rem;
    color: #fff; padding: clamp(1.15rem, 3.2vw, 2.1rem);
    background: linear-gradient(105deg, #162d55, #214a90 100%); box-shadow: var(--shadow);
}
.dashboard-hero::before {
    content: ""; position: absolute; z-index: -1; right: -24px; top: -120px; width: 385px; height: 385px;
    border-radius: 50%; border: 1px solid #a3c3ff34;
    box-shadow: inset 0 0 0 29px #8fb5ff15, inset 0 0 0 58px #8fb5ff10, inset 0 0 0 87px #8fb5ff0c, inset 0 0 0 116px #8fb5ff0d;
}
.dashboard-hero .eyebrow { color: #d3e3ff; }
.dashboard-hero .page-intro { color: #e1ebfe; }
.dashboard-hero .button { color: #19448e; white-space: nowrap; }
.dashboard-hero .button.primary { background: #fff; border-color: #fff; }
.dashboard-hero .button.primary:hover { background: #eaf1ff; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li + li { border-top: 1px solid var(--line); }
.link-list a { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; text-decoration: none; }
.link-list a:hover strong { text-decoration: underline; }
.link-list a > span { flex: 1; display: grid; }
.link-list .muted { font-size: .82rem; }
.link-list .icon { color: var(--blue-dark); }
.dashboard-status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; margin-bottom: .8rem; }
.person-row { padding: .85rem 0; }
.person-row + .person-row { border-top: 1px solid var(--line); }
.person-row > summary { list-style-position: outside; margin-left: .95rem; }
.person-row summary span { margin-right: .55rem; }
.person-row summary small { color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.inline-list { display: grid; gap: .6rem; list-style: none; padding: 0; margin: 0; }
.inline-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem; border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
.inline-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.notice + .inline-list { margin-top: .8rem; }
.secret-code { display: block; width: 100%; border: 1px solid #a6bedf; padding: .55rem .7rem; border-radius: 6px; background: #fff; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
details .secret-code { margin-block: .55rem; }
.guest-shell {
    min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.35rem;
    background: radial-gradient(circle at 15% 12%, #234c94 0, transparent 40%), linear-gradient(125deg, #12203c, #142b54);
}
.guest-content { width: min(100%, 520px); }
.auth-brand { color: #fff; width: fit-content; margin: 0 0 1.1rem .05rem; }
.auth-card { padding: clamp(1.2rem, 5vw, 2rem); box-shadow: 0 20px 55px #08152a55; }
.auth-card .form-grid { margin-top: 1.1rem; }
.auth-card h1 { font-size: clamp(1.65rem, 5vw, 2.2rem); }
.auth-card .button { min-height: 44px; }
.auth-card .feedback { margin-top: 1rem; margin-bottom: 0; }
.auth-note { color: #d8e6ff; font-size: .82rem; text-align: center; margin-top: 1rem; }
@media (max-width: 1000px) {
    .app-shell { grid-template-columns: 204px minmax(0, 1fr); }
    .sidebar { padding-inline: .75rem; }
    .section-grid.wide { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar {
        display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .5rem;
        position: relative; height: auto; padding: .7rem .85rem; overflow: visible;
    }
    .brand { gap: .5rem; padding-inline: 0; }
    .brand .brand-mark { width: 34px; height: 34px; }
    .brand > span { font-size: 1rem; }
    .brand small { font-size: .53rem; }
    .desktop-navigation { display: none; }
    .mobile-navigation { display: block; }
    .mobile-navigation summary { display: inline-flex; gap: .34rem; align-items: center; color: #fff; background: #243c66; padding: .48rem .58rem; border-radius: 7px; font-size: .83rem; }
    .mobile-navigation summary::marker, .mobile-navigation summary::-webkit-details-marker { display: none; }
    .mobile-navigation .main-nav {
        position: absolute; left: .85rem; right: .85rem; top: calc(100% + 3px); z-index: 5;
        margin-top: 0; padding: .8rem; border-radius: 10px; background: var(--nav); box-shadow: 0 12px 24px #15213a44;
    }
    .sidebar-account { padding: 0; border: 0; }
    .sidebar-account .avatar, .sidebar-identity { display: none; }
    .topbar { min-height: 49px; }
    .content { padding: 1rem; }
}
@media (max-width: 590px) {
    .page-header, .dashboard-hero { flex-direction: column; align-items: flex-start; }
    .section-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .weekday-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-hero { min-height: unset; }
}
