:root {
    color-scheme: dark;
    --navy: #0b1323;
    --deep-navy: #060d19;
    --navy-surface: #111a2e;
    --navy-raised: #17233a;
    --blue: #1e6bff;
    --blue-bright: #3b82f6;
    --blue-soft: #65a4ff;
    --silver: #f5f7fa;
    --steel: #8b96a8;
    --charcoal: #111827;
    --line: rgba(139, 150, 168, .22);
    --line-strong: rgba(101, 164, 255, .42);
    --glow: rgba(30, 107, 255, .22);
    --success: #22c55e;
    --warning: #fbbf24;
    --error: #ef4444;
    --info: #3b82f6;
    --ink: #eef3fb;
    --muted: #8b96a8;
    --green: var(--blue);
    --bg: var(--deep-navy);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--deep-navy); }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 68% 8%, rgba(30, 107, 255, .11), transparent 28rem),
        linear-gradient(145deg, #070e1a 0%, #0b1425 55%, #07101e 100%);
    font-size: 14px;
}

button, input, select { font: inherit; }
button, a, input, select { outline-offset: 4px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
a { color: var(--blue-soft); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: 34px; letter-spacing: -1.2px; }
h2 { font-size: 19px; letter-spacing: -.45px; }

.eyebrow {
    margin-bottom: 12px;
    color: var(--blue-soft);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 2px;
}

.muted { color: var(--muted); line-height: 1.6; }

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-full img {
    display: block;
    width: 199px;
    max-width: 100%;
    height: auto;
}

.login-screen {
    display: grid;
    grid-template-columns: minmax(450px, 1.18fr) minmax(420px, .82fr);
    min-height: 100vh;
    background: var(--deep-navy);
}

.login-story {
    position: relative;
    isolation: isolate;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 46px clamp(42px, 7vw, 110px);
    border-right: 1px solid var(--line);
    background:
        linear-gradient(rgba(7, 15, 29, .82), rgba(7, 15, 29, .94)),
        radial-gradient(circle at 55% 46%, rgba(30, 107, 255, .35), transparent 29rem);
}

.login-story::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, .035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, transparent 4%, black 45%, transparent 96%);
    content: "";
}

.login-story::after {
    position: absolute;
    z-index: -1;
    top: 28%;
    left: 19%;
    width: 580px;
    height: 580px;
    border: 1px solid rgba(59, 130, 246, .11);
    border-radius: 50%;
    box-shadow: 0 0 90px rgba(30, 107, 255, .08), inset 0 0 70px rgba(30, 107, 255, .06);
    content: "";
}

.login-message { max-width: 640px; padding: 70px 0 56px; }

.login-message h1 {
    font-size: clamp(46px, 5.5vw, 82px);
    line-height: 1.02;
    letter-spacing: -3.5px;
    text-shadow: 0 12px 34px #000a;
}

.login-message h1 span {
    color: var(--blue);
    text-shadow: 0 0 28px rgba(30, 107, 255, .35);
}

.login-message > p:not(.eyebrow) {
    max-width: 570px;
    color: #adb8c9;
    font-size: 17px;
    line-height: 1.85;
}

.login-story > small {
    color: #6f7e94;
    font-size: 10px;
    letter-spacing: 2.2px;
}

.login-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 42px;
}

.login-features > div {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(17, 26, 46, .68);
}

.login-features strong {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--blue-soft);
}

.login-features span {
    color: var(--silver);
    font-size: 10px;
    font-weight: 720;
    letter-spacing: 1.2px;
}

.login-features small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 450;
    letter-spacing: 0;
}

.login-side {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 48px;
    background:
        radial-gradient(circle at 50% 35%, rgba(30, 107, 255, .12), transparent 25rem),
        #08111f;
}

.login-card {
    width: min(100%, 410px);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(23, 35, 58, .9), rgba(12, 21, 38, .96));
    box-shadow: 0 28px 80px #0008, 0 0 0 1px rgba(30, 107, 255, .05), 0 0 45px rgba(30, 107, 255, .08);
}

.login-card h2 { margin-bottom: 10px; font-size: 29px; }
.login-card form > .muted { margin-bottom: 30px; }
.login-card label { margin-bottom: 18px; }

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 30px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #070f1c;
}

.auth-tabs button {
    padding: 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-weight: 650;
}

.auth-tabs button.active {
    background: linear-gradient(135deg, #1e6bff, #1858cf);
    color: white;
    box-shadow: 0 6px 20px rgba(30, 107, 255, .28);
}

label {
    display: block;
    color: #aeb9ca;
    font-size: 11px;
    font-weight: 620;
}

input, select, textarea {
    display: block;
    width: 100%;
    min-height: 43px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: 0;
    background: rgba(6, 13, 25, .72);
    color: var(--ink);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

textarea {
    min-height: 92px;
    resize: vertical;
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    background: #0b1527;
    box-shadow: 0 0 0 3px rgba(30, 107, 255, .15);
}

input::placeholder { color: #5f6c80; }

.primary, .secondary {
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--navy-surface);
    color: var(--ink);
    font-weight: 650;
}

.primary {
    border-color: #367df4;
    background: linear-gradient(135deg, #287bff, #1259d8);
    color: white;
    box-shadow: 0 8px 24px rgba(30, 107, 255, .2);
}

.primary:hover { background: linear-gradient(135deg, #3b88ff, #1d67e6); }
.secondary:hover { border-color: var(--line-strong); background: var(--navy-raised); }

.login-card .primary {
    display: flex;
    width: 100%;
    justify-content: space-between;
    padding: 14px;
}

.login-foot {
    margin: 22px 0 0;
    color: #6f7e94;
    font-size: 11px;
    line-height: 1.7;
}

.error { min-height: 18px; color: #ff6b6b; }

.portal {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    padding: 30px 20px;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(17, 26, 46, .97), rgba(7, 15, 28, .99)),
        var(--navy);
    box-shadow: 18px 0 55px #0003;
}

.sidebar .brand { margin: 0 10px 46px; }
.sidebar .brand img { width: 176px; }

.nav-caption {
    margin: 0 13px 13px;
    color: #58667b;
    font-size: 9px;
    letter-spacing: 1.7px;
}

.sidebar nav { display: grid; gap: 6px; }

.sidebar nav button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #68778c;
    text-align: left;
}

.sidebar nav button span { color: #9aa6b7; font-weight: 560; }

.sidebar nav button:hover {
    border-color: var(--line);
    background: rgba(30, 107, 255, .06);
}

.sidebar nav button.active {
    border-color: rgba(59, 130, 246, .25);
    background: linear-gradient(90deg, rgba(30, 107, 255, .2), rgba(30, 107, 255, .05));
    color: var(--blue-soft);
    box-shadow: inset 3px 0 var(--blue);
}

.sidebar nav button.active span { color: #dbe8ff; }

.sidebar-bottom {
    margin-top: auto;
    padding: 22px 12px 0;
    border-top: 1px solid var(--line);
}

.sidebar-bottom p { margin-bottom: 5px; color: #c4cedc; font-size: 11px; }
.sidebar-bottom small { color: #647287; font-size: 9px; }
.sidebar-bottom button {
    display: block;
    margin-top: 22px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
}

.main-shell { min-width: 0; }

.topbar {
    display: flex;
    height: 73px;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 17, 31, .78);
    color: #7f8ca0;
    font-size: 11px;
    backdrop-filter: blur(18px);
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, .7);
}

main {
    max-width: 1480px;
    margin: auto;
    padding: 34px 38px;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.page-heading p:last-child { margin-bottom: 0; }
.page-actions { display: flex; gap: 10px; }

.device-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 26px;
    padding: 17px 22px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(23, 35, 58, .88), rgba(13, 23, 40, .9));
}

.device-panel > div { min-width: 240px; max-width: 520px; flex: 1; }
.device-panel select { min-height: 25px; margin-top: 6px; padding: 3px 0; border: 0; background: transparent; font-weight: 650; }
.device-panel label { color: var(--muted); font-size: 9px; letter-spacing: 1px; }
.device-panel p { margin: 0; font-size: 10px; }

.notice:empty { display: none; }
.notice {
    padding: 15px;
    border: 1px solid rgba(251, 191, 36, .2);
    border-radius: 8px;
    background: rgba(251, 191, 36, .08);
    color: #f6cd63;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 17px;
    margin-bottom: 24px;
}

.stat, .panel {
    border: 1px solid var(--line);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(23, 35, 58, .92), rgba(12, 21, 38, .94));
    box-shadow: 0 18px 45px #0002;
}

.stat { position: relative; overflow: hidden; padding: 23px; }
.stat::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    opacity: .55;
    content: "";
}

.stat p { margin-bottom: 16px; color: #8f9caf; font-size: 11px; }
.stat strong { font-size: 32px; font-weight: 620; letter-spacing: -1px; }
.stat small { display: block; margin-top: 10px; color: #6f7e93; font-size: 9px; }
.stat:first-child { border-color: rgba(59, 130, 246, .38); background: linear-gradient(145deg, rgba(30, 107, 255, .17), rgba(12, 21, 38, .96)); }
.stat:first-child strong { color: #74abff; }

.overview-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.panel { overflow: hidden; }
.overview-grid .panel { padding: 25px; }

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 23px 24px;
}

.overview-grid .panel-heading { margin-bottom: 22px; padding: 0; }
.panel-heading h2 { margin-bottom: 0; }
.panel-heading .eyebrow { margin-bottom: 7px; }
.subtle-label { color: var(--muted); font-size: 9px; }

.ata-row {
    display: grid;
    grid-template-columns: 68px 1fr 55px;
    align-items: center;
    gap: 14px;
    margin: 16px 0;
    color: #bac5d4;
    font-size: 11px;
}

.ata-track { height: 8px; overflow: hidden; border-radius: 5px; background: #070f1d; }
.ata-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #1e6bff, #55a0ff); box-shadow: 0 0 12px rgba(30, 107, 255, .5); }
.ata-hours { color: #8ca0ba; text-align: right; }

.profile-name { margin-top: 25px; color: var(--silver); font-size: 21px; font-weight: 650; }
.profile-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 25px 0 0; }
.profile-meta dt { margin-bottom: 8px; color: var(--muted); font-size: 9px; }
.profile-meta dd { margin: 0; color: #cad3df; font-size: 12px; }

.text-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--blue-soft);
    font-size: 11px;
    font-weight: 650;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: left; }
th {
    padding: 13px 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(6, 13, 25, .62);
    color: #748298;
    font-size: 9px;
    font-weight: 560;
    white-space: nowrap;
    letter-spacing: .4px;
}
td { max-width: 360px; padding: 17px 20px; border-bottom: 1px solid rgba(139, 150, 168, .1); color: #b9c4d2; line-height: 1.6; }
tbody tr:hover { background: rgba(30, 107, 255, .04); }
td .cell-secondary { display: block; color: #68778b; font-size: 9px; }
td .record-link { padding: 0; border: 0; background: none; color: var(--blue-soft); font-weight: 650; text-align: left; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(139, 150, 168, .1);
    color: #9aa8ba;
    font-size: 9px;
    white-space: nowrap;
}
.badge.valid { border-color: rgba(34, 197, 94, .2); background: rgba(34, 197, 94, .11); color: #65db8e; }
.badge.pending { border-color: rgba(251, 191, 36, .2); background: rgba(251, 191, 36, .1); color: #f6cc61; }
.badge.rejected { border-color: rgba(239, 68, 68, .2); background: rgba(239, 68, 68, .1); color: #ff7777; }

.filters { display: flex; align-items: end; gap: 13px; margin-bottom: 23px; flex-wrap: wrap; }
.filters label { min-width: 130px; flex: 1; color: var(--muted); font-size: 9px; }
.filters .search-field { min-width: 230px; flex: 2; }
.filters button { height: 43px; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; color: var(--muted); font-size: 11px; }
.empty { padding: 35px; color: var(--muted); line-height: 1.8; text-align: center; }

footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: #59677b;
    font-size: 9px;
    line-height: 1.8;
    letter-spacing: .35px;
}

dialog {
    width: min(800px, 94vw);
    max-height: 88vh;
    padding: 28px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: linear-gradient(145deg, #17233a, #0b1425);
    color: var(--ink);
    box-shadow: 0 30px 100px #000c, 0 0 40px rgba(30, 107, 255, .12);
}
dialog::backdrop { background: rgba(2, 7, 14, .82); backdrop-filter: blur(6px); }

.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; }
.editor-dialog { width: min(860px, 94vw); }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.editor-grid .wide { grid-column: 1 / -1; }
.editor-grid label { color: #aeb9ca; }
.record-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.record-edit {
    padding: 0;
    border: 0;
    background: none;
    color: #a8b5c7;
    font-size: 10px;
    font-weight: 650;
}
.record-edit:hover { color: var(--blue-soft); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 28px; }
.detail-grid dt { margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; color: #c7d0dd; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.related-record { padding: 17px 0; border-top: 1px solid var(--line); }
.related-record .detail-grid { margin-bottom: 0; }
#detail-content h3 { margin-top: 28px; font-size: 15px; }
.table-note { margin: 16px 0; padding: 0 20px; color: var(--muted); font-size: 10px; line-height: 1.7; }

@media (max-width: 1100px) {
    .login-screen { grid-template-columns: 1fr 430px; }
    .login-story { padding: 38px; }
    .login-message h1 { font-size: 55px; }
    .login-features { grid-template-columns: 1fr; }
    .portal { grid-template-columns: 215px 1fr; }
    .sidebar { padding: 24px 10px; }
    .sidebar .brand img { width: 170px; }
    main { padding: 28px 24px; }
    .topbar { padding: 0 24px; }
    .overview-grid { grid-template-columns: 1fr; }
    .stats { gap: 10px; }
    .stat { padding: 18px; }
    .page-heading h1 { font-size: 27px; }
}

@media (max-width: 760px) {
    .login-screen { display: block; }
    .login-story { min-height: auto; padding: 25px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
    .login-story .brand img { width: 170px; }
    .login-message { padding: 44px 0 18px; }
    .login-message h1 { font-size: 43px; letter-spacing: -2px; }
    .login-message > p:not(.eyebrow) { font-size: 14px; }
    .login-features, .login-story > small { display: none; }
    .login-side { min-height: auto; padding: 28px 18px 48px; }
    .login-card { padding: 22px; }
    .portal { display: block; }
    .sidebar { position: relative; height: auto; padding: 18px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar .brand { margin: 0 0 18px; }
    .sidebar .brand img { width: 155px; }
    .nav-caption { display: none; }
    .sidebar nav { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 4px; }
    .sidebar nav button { padding: 10px; font-size: 11px; white-space: nowrap; }
    .sidebar-bottom { position: absolute; top: 20px; right: 20px; padding: 0; border: 0; }
    .sidebar-bottom p, .sidebar-bottom small { display: none; }
    .sidebar-bottom button { margin: 9px 0 0; font-size: 10px; }
    .topbar { height: 48px; padding: 0 18px; font-size: 9px; }
    main { padding: 23px 16px; }
    .page-heading { align-items: start; }
    .page-heading h1 { font-size: 24px; }
    .page-heading .secondary { padding: 9px; font-size: 9px; }
    .page-heading .eyebrow { font-size: 8px; }
    .page-actions { flex-direction: column; }
    .device-panel { display: block; padding: 15px; }
    .device-panel > div { min-width: 0; }
    .device-panel p { margin-top: 9px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat strong { font-size: 27px; }
    .overview-grid { gap: 16px; }
    .overview-grid .panel { padding: 20px; }
    .panel-heading { padding: 20px 16px; }
    .panel-heading h2 { font-size: 16px; }
    .subtle-label { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .editor-grid { grid-template-columns: 1fr; }
    .editor-grid .wide { grid-column: auto; }
    .filters { gap: 10px; }
    .filters label { min-width: 110px; }
    .pagination { padding: 15px 12px; }
    .pagination .secondary { font-size: 9px; }
    td, th { padding-right: 15px; padding-left: 15px; }
    dialog { padding: 20px; }
}
