:root {
    --navy-950: #071527;
    --navy-900: #0b1f36;
    --navy-800: #102a46;
    --navy-700: #163a5f;
    --blue-600: #2563eb;
    --gold-500: #c79a3b;
    --gold-600: #a9781e;
    --slate-900: #0f172a;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --green: #15803d;
    --green-bg: #dcfce7;
    --yellow: #a16207;
    --yellow-bg: #fef9c3;
    --orange: #c2410c;
    --orange-bg: #ffedd5;
    --red: #b91c1c;
    --red-bg: #fee2e2;
    --purple: #6d28d9;
    --purple-bg: #ede9fe;
    --blue-bg: #dbeafe;
    --grey-bg: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 16px 36px rgba(15, 23, 42, 0.10);
}

:root[data-theme="dark"] {
    --navy-950: #030712;
    --navy-900: #07111f;
    --navy-800: #0f2238;
    --navy-700: #214466;
    --slate-900: #f8fafc;
    --slate-700: #dbe4ef;
    --slate-600: #b9c7d7;
    --slate-500: #91a3b8;
    --slate-300: #334155;
    --slate-200: #263548;
    --slate-100: #172235;
    --slate-50: #101a2a;
    --white: #0f172a;
    --green-bg: rgba(21, 128, 61, 0.18);
    --yellow-bg: rgba(161, 98, 7, 0.18);
    --orange-bg: rgba(194, 65, 12, 0.18);
    --red-bg: rgba(185, 28, 28, 0.18);
    --purple-bg: rgba(109, 40, 217, 0.18);
    --blue-bg: rgba(37, 99, 235, 0.18);
    --grey-bg: #293548;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 18px 46px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    overflow: hidden;
    margin: 0;
    background: #eef2f7;
    color: var(--slate-900);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] body {
    background: #0a1220;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    height: 100vh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
    height: 100vh;
    background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
    color: #d8e3ef;
    position: sticky;
    top: 0;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block {
    min-height: 92px;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(199, 154, 59, 0.14);
    border: 1px solid rgba(199, 154, 59, 0.42);
    color: #f4d18b;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-title {
    font-size: 13px;
    line-height: 1.25;
    font-weight: 800;
    color: #ffffff;
}

.brand-subtitle {
    margin-top: 4px;
    font-size: 11px;
    color: #9fb3c8;
}

.sidebar-nav {
    height: calc(100vh - 84px - 76px);
    overflow-y: auto;
    padding: 16px 12px 24px;
}

.sidebar-footer {
    height: 76px;
    padding: 14px 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(3, 7, 18, 0.24);
}

.sidebar-logout {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 8px;
    color: #fee2e2;
    background: rgba(185, 28, 28, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.24);
    font-size: 13px;
    font-weight: 850;
}

.sidebar-logout:hover {
    color: #ffffff;
    background: rgba(185, 28, 28, 0.28);
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.26);
}

.nav-group {
    margin-bottom: 18px;
}

.nav-group-title {
    padding: 0 10px 8px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7e96af;
    font-weight: 800;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #c7d5e4;
    font-size: 13px;
    font-weight: 600;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(199, 154, 59, 0.18);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--gold-500);
}

.nav-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.nav-icon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
    color: #b8c9da;
    font-size: 11px;
    flex: 0 0 auto;
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-count {
    min-width: 22px;
    height: 20px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    font-size: 10px;
    color: #f6e4b7;
    background: rgba(199, 154, 59, 0.18);
}

.main-shell {
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.top-header {
    flex: 0 0 auto;
    min-height: 82px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 24px;
    z-index: 20;
}

.mobile-menu-button {
    display: none;
}

.page-kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: var(--gold-600);
}

.page-title {
    margin: 2px 0 0;
    font-size: 24px;
    line-height: 1.18;
    letter-spacing: 0;
}

.page-description {
    margin: 5px 0 0;
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.4;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-search {
    width: min(320px, 24vw);
    min-width: 210px;
}

.content-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    display: grid;
    gap: 22px;
}

.section {
    display: grid;
    gap: 14px;
}

.section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.section-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.section-note {
    margin: 4px 0 0;
    color: var(--slate-600);
    font-size: 13px;
}

.panel {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.panel-body {
    padding: 18px;
}

.panel-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.grid {
    display: grid;
    gap: 14px;
}

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

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.metric-card {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--slate-200);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    min-height: 124px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.metric-label {
    margin: 0;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.metric-value {
    margin: 10px 0 0;
    font-size: 30px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: 0;
}

.metric-foot {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--slate-500);
    font-size: 12px;
}

.trend-up {
    color: var(--green);
    font-weight: 800;
}

.trend-down {
    color: var(--red);
    font-weight: 800;
}

.icon-box {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--navy-900);
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    font-weight: 900;
}

.icon-box.gold {
    background: rgba(199, 154, 59, 0.15);
    border-color: rgba(199, 154, 59, 0.35);
    color: var(--gold-600);
}

.icon-box.green {
    background: var(--green-bg);
    border-color: #bbf7d0;
    color: var(--green);
}

.icon-box.red {
    background: var(--red-bg);
    border-color: #fecaca;
    color: var(--red);
}

.icon-box.purple {
    background: var(--purple-bg);
    border-color: #ddd6fe;
    color: var(--purple);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--slate-300);
    background: var(--white);
    color: var(--slate-900);
    border-radius: 8px;
    padding: 9px 11px;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--navy-700);
    box-shadow: 0 0 0 3px rgba(22, 58, 95, 0.12);
}

.field {
    display: grid;
    gap: 7px;
}

.field-label {
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 800;
}

.field-help {
    color: var(--slate-500);
    font-size: 12px;
}

.field-error {
    color: var(--red);
    font-size: 12px;
    font-weight: 700;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1.5fr repeat(5, minmax(130px, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    padding: 9px 13px;
    border: 1px solid transparent;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    color: var(--white);
    background: var(--navy-800);
    border-color: var(--navy-800);
}

.btn-primary:hover {
    background: var(--navy-700);
}

.btn-gold {
    color: #211802;
    background: var(--gold-500);
    border-color: var(--gold-500);
}

.btn-secondary {
    color: var(--slate-800);
    background: var(--white);
    border-color: var(--slate-300);
}

.btn-ghost {
    color: var(--slate-700);
    background: transparent;
    border-color: transparent;
}

.btn-danger {
    color: var(--red);
    background: var(--red-bg);
    border-color: #fecaca;
}

.btn-purple {
    color: var(--purple);
    background: var(--purple-bg);
    border-color: #ddd6fe;
}

.btn-icon {
    width: 40px;
    padding: 0;
}

.btn-sm {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
}

.badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1;
    font-weight: 850;
    white-space: nowrap;
}

.badge-green {
    color: var(--green);
    background: var(--green-bg);
}

.badge-yellow {
    color: var(--yellow);
    background: var(--yellow-bg);
}

.badge-orange {
    color: var(--orange);
    background: var(--orange-bg);
}

.badge-red {
    color: var(--red);
    background: var(--red-bg);
}

.badge-grey {
    color: #374151;
    background: var(--grey-bg);
}

.badge-blue {
    color: #1d4ed8;
    background: var(--blue-bg);
}

.badge-purple {
    color: var(--purple);
    background: var(--purple-bg);
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    color: var(--slate-600);
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--slate-200);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table strong {
    display: block;
    color: var(--slate-900);
}

.table-muted {
    color: var(--slate-500);
    font-size: 12px;
    margin-top: 3px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.progress {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--slate-200);
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--navy-700);
}

.progress.green span {
    background: var(--green);
}

.progress.orange span {
    background: var(--orange);
}

.progress.red span {
    background: var(--red);
}

.chart-card {
    position: relative;
    min-height: 310px;
}

.chart-title {
    margin: 0;
    font-size: 14px;
    font-weight: 850;
}

.chart-subtitle {
    margin: 4px 0 0;
    color: var(--slate-500);
    font-size: 12px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.status-tile {
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    padding: 12px;
    background: var(--slate-50);
}

.status-tile strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
}

.bar-list {
    display: grid;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) 46px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--slate-600);
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: var(--slate-100);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--navy-700), var(--gold-500));
}

.line-chart {
    min-height: 210px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    align-items: end;
    gap: 12px;
    padding: 18px 4px 4px;
}

.line-point {
    display: grid;
    gap: 8px;
    align-items: end;
    text-align: center;
    color: var(--slate-500);
    font-size: 11px;
}

.line-bar {
    min-height: 20px;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, #2f6fa3, var(--navy-800));
}

.heatmap {
    display: grid;
    grid-template-columns: 100px repeat(5, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}

.heat-cell,
.heat-head,
.heat-label {
    min-height: 36px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
}

.heat-head {
    color: var(--slate-600);
    background: var(--slate-100);
}

.heat-label {
    color: var(--slate-700);
    background: var(--white);
    border: 1px solid var(--slate-200);
}

.heat-low {
    background: var(--green-bg);
    color: var(--green);
}

.heat-medium {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.heat-high {
    background: var(--orange-bg);
    color: var(--orange);
}

.heat-critical {
    background: var(--red-bg);
    color: var(--red);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-section-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 850;
    color: var(--navy-900);
}

.option-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--slate-700);
    font-size: 13px;
}

.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--slate-100);
    border-radius: 8px;
}

.tab {
    min-height: 32px;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 850;
    color: var(--slate-600);
}

.tab.active {
    background: var(--white);
    color: var(--navy-900);
    box-shadow: var(--shadow-sm);
}

.login-preview {
    min-height: 380px;
    background:
        linear-gradient(135deg, rgba(7, 21, 39, 0.95), rgba(16, 42, 70, 0.92)),
        radial-gradient(circle at top right, rgba(199, 154, 59, 0.32), transparent 34%);
    border-radius: 8px;
    padding: 22px;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.login-card h3 {
    margin: 0 0 4px;
    font-size: 20px;
}

.login-card p {
    margin: 0 0 18px;
    color: var(--slate-600);
    font-size: 13px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
}

.alert-blue {
    color: #1e40af;
    background: var(--blue-bg);
    border: 1px solid #bfdbfe;
}

.alert-red {
    color: var(--red);
    background: var(--red-bg);
    border: 1px solid #fecaca;
}

.modal-preview {
    border: 1px dashed var(--slate-300);
    border-radius: 8px;
    padding: 22px;
    background: linear-gradient(180deg, var(--slate-50), #ffffff);
}

.modal-box {
    max-width: 520px;
    margin: 0 auto;
    border-radius: 8px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-md);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border-top: 1px solid var(--slate-200);
}

.empty-state {
    padding: 34px 18px;
    text-align: center;
    color: var(--slate-500);
}

.empty-state strong {
    display: block;
    color: var(--slate-800);
    margin-bottom: 6px;
}

.template-note {
    border-left: 4px solid var(--gold-500);
    background: #fff8e6;
    color: #5c4212;
    padding: 13px 15px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 1220px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .filter-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(292px, 86vw);
        z-index: 40;
        transform: translateX(-102%);
        transition: transform 180ms ease;
    }

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

    .mobile-menu-button {
        display: inline-flex;
    }

    .top-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .header-search {
        width: 100%;
    }

    .form-grid,
    .grid-2,
    .grid-4,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 16px;
    }
}

@media print {
    .sidebar,
    .top-header {
        display: none;
    }

    .app-shell {
        display: block;
    }

    .content-area {
        padding: 0;
    }
}

/* Refined prototype shell */
.svg-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.svg-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    grid-template-columns: 292px minmax(0, 1fr);
    transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar {
    width: 292px;
    transition: transform 180ms ease;
    z-index: 30;
}

.brand-block {
    min-height: 84px;
    padding: 18px 18px 14px;
    gap: 12px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 4px;
    flex: 0 0 auto;
}

.brand-block .brand-title {
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: 0;
}

.nav-icon {
    background: rgba(255, 255, 255, 0.055);
}

.nav-item.active .nav-icon {
    color: #f6d686;
    background: rgba(199, 154, 59, 0.16);
}

.top-header {
    min-height: 72px;
    flex-direction: row;
    align-items: center;
    padding: 14px 24px;
}

.header-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    flex: 0 0 auto;
}

.page-title {
    font-size: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-counters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.header-counters span {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--slate-200);
    background: var(--slate-50);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 750;
}

.header-counters strong {
    color: var(--navy-900);
}

.header-timer {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: linear-gradient(180deg, #ffffff, #eff6ff);
    border-radius: 999px;
    padding: 7px 12px;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.header-timer strong {
    min-width: 34px;
    color: var(--navy-900);
    font-variant-numeric: tabular-nums;
}

.timer-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.14);
}

.user-menu {
    position: relative;
}

.user-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--slate-200);
    background: var(--white);
    border-radius: 999px;
    padding: 4px 12px 4px 5px;
    color: var(--slate-800);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.theme-toggle {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--slate-200);
    background: var(--white);
    border-radius: 999px;
    padding: 7px 12px;
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    border-color: var(--navy-700);
    color: var(--navy-900);
}

.user-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--navy-900);
    background: var(--slate-100);
}

.user-name {
    font-size: 13px;
    font-weight: 850;
}

.user-dropdown {
    min-width: 190px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 50;
    display: none;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.user-dropdown.open {
    display: grid;
}

.user-dropdown-profile {
    padding: 10px 10px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--slate-200);
}

.user-dropdown-profile strong,
.user-dropdown-profile span {
    display: block;
}

.user-dropdown-profile strong {
    font-size: 13px;
    line-height: 1.2;
}

.user-dropdown-profile span {
    margin-top: 3px;
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
}

.user-dropdown a {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--slate-700);
    font-size: 13px;
    font-weight: 800;
}

.user-dropdown a:hover {
    background: var(--slate-100);
    color: var(--navy-900);
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 146px;
    border-color: rgba(148, 163, 184, 0.4);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)),
        radial-gradient(circle at top right, rgba(199, 154, 59, 0.13), transparent 32%);
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--navy-700);
}

.metric-card.metric-green::before {
    background: var(--green);
}

.metric-card.metric-red::before {
    background: var(--red);
}

.metric-card.metric-purple::before {
    background: var(--purple);
}

.metric-card.metric-gold::before {
    background: var(--gold-500);
}

.metric-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    right: -42px;
    top: -48px;
    border-radius: 999px;
    background: rgba(199, 154, 59, 0.10);
}

.metric-value {
    font-size: 34px;
}

.metric-progress {
    height: 7px;
    border-radius: 999px;
    background: var(--slate-100);
    overflow: hidden;
    margin-top: 14px;
}

.metric-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--navy-700), var(--gold-500));
}

.metric-card.metric-green .metric-progress span {
    background: linear-gradient(90deg, var(--green), #22c55e);
}

.metric-card.metric-red .metric-progress span {
    background: linear-gradient(90deg, var(--red), #f97316);
}

.metric-card.metric-purple .metric-progress span {
    background: linear-gradient(90deg, var(--purple), #8b5cf6);
}

.icon-box .svg-icon,
.icon-actions .svg-icon {
    width: 17px;
    height: 17px;
}

.chart-host {
    min-height: 320px;
}

.component-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: inline-flex;
    gap: 6px;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.metric-card:hover .component-actions,
.chart-card:hover .component-actions,
.component-actions:focus-within {
    opacity: 1;
    transform: translateY(0);
}

.component-action {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--slate-600);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.component-action:hover {
    color: var(--navy-900);
    border-color: var(--navy-700);
    background: var(--white);
}

.component-action .svg-icon {
    width: 16px;
    height: 16px;
}

body.modal-open {
    overflow: hidden;
}

.component-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(3, 10, 22, 0.64);
    backdrop-filter: blur(6px);
}

.component-modal-dialog {
    width: min(1120px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.30);
    overflow: hidden;
}

.component-modal-header {
    flex: 0 0 auto;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--slate-200);
    color: var(--navy-900);
}

.component-modal-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--slate-600);
    cursor: pointer;
}

.component-modal-close:hover {
    color: var(--red);
    border-color: #fecaca;
    background: var(--red-bg);
}

.component-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 22px;
    background: #f3f6fa;
}

.component-modal-body .metric-card,
.component-modal-body .chart-card {
    max-width: none;
    margin: 0;
}

.component-modal-body .metric-card {
    min-height: 300px;
}

.component-modal-body .chart-card {
    min-height: 560px;
}

.component-modal-body .chart-host {
    min-height: 520px;
}

.component-modal-body .chart-svg {
    min-height: 500px;
}

:root[data-theme="dark"] .top-header,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .modal-box,
:root[data-theme="dark"] .component-modal-dialog {
    background: #0f172a;
    border-color: #263548;
    color: var(--slate-900);
}

:root[data-theme="dark"] .top-header {
    background: rgba(15, 23, 42, 0.94);
}

:root[data-theme="dark"] .metric-card {
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(12, 20, 34, 0.98)),
        radial-gradient(circle at top right, rgba(199, 154, 59, 0.12), transparent 34%);
}

:root[data-theme="dark"] .panel-header,
:root[data-theme="dark"] .pagination,
:root[data-theme="dark"] .table-toolbar,
:root[data-theme="dark"] .component-modal-header {
    background: #111c2e;
    border-color: #263548;
}

:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea {
    background: #0b1322;
    border-color: #334155;
    color: #f8fafc;
}

:root[data-theme="dark"] .input::placeholder,
:root[data-theme="dark"] .textarea::placeholder {
    color: #7f90a6;
}

:root[data-theme="dark"] .btn-secondary,
:root[data-theme="dark"] .component-action,
:root[data-theme="dark"] .component-modal-close,
:root[data-theme="dark"] .icon-actions button,
:root[data-theme="dark"] .user-button,
:root[data-theme="dark"] .theme-toggle {
    background: #121d30;
    border-color: #334155;
    color: #dbe4ef;
}

:root[data-theme="dark"] .btn-secondary:hover,
:root[data-theme="dark"] .component-action:hover,
:root[data-theme="dark"] .icon-actions button:hover,
:root[data-theme="dark"] .theme-toggle:hover {
    background: #17263d;
    border-color: #4b6685;
}

:root[data-theme="dark"] .table th,
:root[data-theme="dark"] .table-modern thead th,
:root[data-theme="dark"] .status-tile,
:root[data-theme="dark"] .heat-head,
:root[data-theme="dark"] .tab,
:root[data-theme="dark"] .header-counters span {
    background: #111c2e;
    color: #b9c7d7;
    border-color: #263548;
}

:root[data-theme="dark"] .table td,
:root[data-theme="dark"] .table th,
:root[data-theme="dark"] .table-modern td,
:root[data-theme="dark"] .table-modern th {
    border-color: #263548;
}

:root[data-theme="dark"] .table-modern tbody tr:hover {
    background: #111c2e;
}

:root[data-theme="dark"] .table strong,
:root[data-theme="dark"] .section-title,
:root[data-theme="dark"] .chart-title,
:root[data-theme="dark"] .form-section-title {
    color: #f8fafc;
}

:root[data-theme="dark"] .header-timer {
    background: linear-gradient(180deg, #111c2e, #0b1322);
    border-color: #263548;
    color: #bfdbfe;
}

:root[data-theme="dark"] .header-timer strong {
    color: #f8fafc;
}

:root[data-theme="dark"] .user-avatar {
    background: #17263d;
    color: #f8fafc;
}

:root[data-theme="dark"] .user-dropdown {
    background: #0f172a;
    border-color: #263548;
}

:root[data-theme="dark"] .user-dropdown-profile {
    border-color: #263548;
}

:root[data-theme="dark"] .user-dropdown a:hover {
    background: #17263d;
}

:root[data-theme="dark"] .progress,
:root[data-theme="dark"] .metric-progress,
:root[data-theme="dark"] .bar-track {
    background: #263548;
}

:root[data-theme="dark"] .chart-grid {
    stroke: #263548;
}

:root[data-theme="dark"] .chart-axis {
    stroke: #607089;
}

:root[data-theme="dark"] .chart-title-svg,
:root[data-theme="dark"] .chart-label,
:root[data-theme="dark"] .chart-center-value {
    fill: #f8fafc;
}

:root[data-theme="dark"] .chart-axis-label,
:root[data-theme="dark"] .chart-legend {
    fill: #b9c7d7;
}

:root[data-theme="dark"] .component-modal {
    background: rgba(0, 0, 0, 0.72);
}

:root[data-theme="dark"] .component-modal-body,
:root[data-theme="dark"] .modal-preview {
    background: #0a1220;
}

:root[data-theme="dark"] .template-note {
    background: rgba(199, 154, 59, 0.12);
    color: #f3d99b;
}

:root[data-theme="dark"] .login-preview {
    background:
        linear-gradient(135deg, rgba(3, 7, 18, 0.98), rgba(15, 23, 42, 0.94)),
        radial-gradient(circle at top right, rgba(199, 154, 59, 0.24), transparent 34%);
}

.chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.chart-title-svg {
    fill: var(--slate-900);
    font-size: 15px;
    font-weight: 850;
}

.chart-axis,
.chart-grid {
    stroke: #dbe3ec;
    stroke-width: 1;
}

.chart-axis {
    stroke: #94a3b8;
}

.chart-axis-label,
.chart-legend {
    fill: var(--slate-600);
    font-size: 11px;
    font-weight: 700;
}

.chart-label {
    fill: var(--slate-800);
    font-size: 12px;
    font-weight: 850;
}

.chart-center-value {
    fill: var(--navy-900);
    font-size: 28px;
    font-weight: 900;
}

.table-modern {
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7f9fc;
    border-top: 1px solid var(--slate-200);
}

.table-modern tbody tr {
    transition: background 120ms ease;
}

.table-modern tbody tr:hover {
    background: #f8fafc;
}

.table-modern td,
.table-modern th {
    border-bottom: 1px solid #edf1f5;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-bottom: 1px solid var(--slate-200);
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.table-search-wrap {
    min-width: 0;
    flex: 1;
    position: relative;
}

.table-search-wrap .svg-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-500);
}

.table-search {
    padding-left: 40px;
    min-height: 44px;
}

.table-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 800;
}

.table-toolbar-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.table-per-page {
    width: 86px;
}

.table-progress-line {
    display: grid;
    gap: 6px;
    min-width: 120px;
}

.table-progress-line span {
    font-size: 12px;
    font-weight: 850;
    color: var(--slate-700);
}

.icon-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon-actions button {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--slate-600);
    cursor: pointer;
}

.icon-actions button:hover {
    color: var(--navy-900);
    border-color: var(--navy-700);
    background: #f8fafc;
}

.pager {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 920px) {
    body.sidebar-collapsed .app-shell,
    .app-shell {
        grid-template-columns: 1fr;
    }

    body.sidebar-collapsed .sidebar {
        transform: translateX(-102%);
    }

    body.sidebar-open .sidebar,
    body:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
    }

    .top-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-title-row,
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .header-counters {
        order: 2;
        width: 100%;
    }

    .table-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .table-toolbar-actions {
        justify-content: space-between;
    }
}

/* Static prototype sub-pages and login */
.page-backbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-backbar .btn .svg-icon {
    transform: rotate(90deg);
}

.field-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 1px solid var(--slate-200);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.detail-label {
    display: block;
    margin-bottom: 5px;
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-body {
    min-height: 100vh;
    overflow: auto;
    background:
        radial-gradient(circle at 15% 18%, rgba(199, 154, 59, 0.18), transparent 28%),
        linear-gradient(135deg, #071527 0%, #102a46 54%, #eef2f7 54%, #f8fafc 100%);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
    align-items: center;
    gap: 42px;
    padding: 48px;
}

.login-hero {
    color: #ffffff;
    max-width: 720px;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 42px;
}

.login-brand img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.login-brand strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
}

.login-eyebrow {
    color: #f4d18b;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-title {
    max-width: 680px;
    margin: 14px 0 18px;
    font-size: 44px;
    line-height: 1.08;
    letter-spacing: 0;
}

.login-copy {
    max-width: 600px;
    color: #bfd0e3;
    font-size: 16px;
    line-height: 1.7;
}

.login-proof {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 620px;
    margin-top: 34px;
}

.login-proof span {
    min-height: 78px;
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e8f1fb;
    font-size: 12px;
    font-weight: 800;
}

.login-panel {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(7, 21, 39, 0.24);
    padding: 30px;
}

.login-panel h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.15;
}

.login-panel p {
    margin: 8px 0 24px;
    color: var(--slate-600);
    font-size: 13px;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.remember-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--slate-700);
    font-weight: 700;
}

.forgot-link {
    color: var(--navy-700);
    font-weight: 850;
}

.login-submit {
    width: 100%;
    min-height: 46px;
    justify-content: center;
}

@media (max-width: 900px) {
    .login-body {
        background: linear-gradient(180deg, #071527 0%, #102a46 42%, #eef2f7 42%, #f8fafc 100%);
    }

    .login-shell {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .login-title {
        font-size: 34px;
    }

    .login-proof {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 920px) {
    body::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(7, 21, 39, 0.48);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    body.sidebar-open::before {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-collapsed .app-shell,
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar,
    body:not(.sidebar-open) .sidebar,
    body.sidebar-collapsed .sidebar,
    body:not(.sidebar-collapsed) .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(306px, 88vw);
        z-index: 90;
        transform: translateX(-104%);
        box-shadow: 22px 0 60px rgba(7, 21, 39, 0.34);
    }

    body.sidebar-open .sidebar,
    body.sidebar-open.sidebar-collapsed .sidebar {
        transform: translateX(0);
    }

    .top-header {
        min-height: 64px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .header-title-row {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
    }

    .page-title {
        font-size: clamp(15px, 4vw, 18px);
        max-width: 44vw;
    }

    .header-actions {
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-end;
        gap: 6px;
    }

    .header-timer {
        min-height: 36px;
        padding: 6px 8px;
        gap: 5px;
        font-size: 11px;
    }

    .header-timer span:not(.timer-dot) {
        display: none;
    }

    .header-timer strong {
        min-width: 28px;
    }

    .theme-toggle {
        width: 36px;
        min-height: 36px;
        justify-content: center;
        padding: 0;
    }

    .theme-toggle span {
        display: none;
    }

    .user-button {
        min-height: 38px;
        padding: 3px 7px 3px 3px;
        gap: 4px;
    }

    .user-name {
        display: none;
    }

    .user-dropdown {
        min-width: 220px;
        right: 0;
    }

    .content-area {
        padding: 14px;
        gap: 16px;
    }

    .section-header {
        align-items: flex-start;
    }

    .metric-card {
        min-height: 128px;
    }

    .metric-value {
        font-size: clamp(24px, 8vw, 34px);
    }

    .panel-body,
    .panel-header {
        padding: 14px;
    }

    .chart-card .panel-body {
        padding: 10px;
    }

    .table-wrap {
        overflow-x: auto;
    }

    .table {
        min-width: 760px;
    }
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-dashboard,
    .filter-bar,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        max-width: 36vw;
    }

    .header-actions {
        gap: 4px;
    }

    .header-timer {
        padding-inline: 7px;
    }

    .sidebar-toggle,
    .btn-icon {
        width: 36px;
        height: 36px;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
    }

    .actions,
    .form-actions {
        width: 100%;
        justify-content: stretch;
    }

    .actions .btn,
    .form-actions .btn {
        flex: 1;
    }
}
