:root {
    --bg: #08131f;
    --bg-soft: #102235;
    --panel: rgba(8, 18, 31, 0.86);
    --panel-strong: rgba(16, 34, 53, 0.96);
    --line: rgba(255, 255, 255, 0.08);
    --text: #eef5fb;
    --muted: #9db1c3;
    --gold: #d4af37;
    --gold-deep: #a78623;
    --teal: #4dc3c8;
    --red: #ef6a6a;
    --amber: #f3b664;
    --green: #6cc58b;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
    --radius: 18px;
    --radius-lg: 28px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(77, 195, 200, 0.18), transparent 24%),
        radial-gradient(circle at bottom left, rgba(212, 175, 55, 0.18), transparent 20%),
        linear-gradient(160deg, #07121d 0%, #0a1928 42%, #122336 100%);
}

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

img {
    max-width: 100%;
    display: block;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: "Space Grotesk", Inter, sans-serif;
    letter-spacing: -0.03em;
}

p {
    margin: 0;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
}

.dashboard-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    padding: 28px 22px;
    border-right: 1px solid var(--line);
    background: rgba(7, 17, 28, 0.78);
    backdrop-filter: blur(18px);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

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

.brand-lockup strong {
    display: block;
    font-size: 1rem;
}

.brand-lockup span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.dashboard-nav {
    display: grid;
    gap: 8px;
}

.dashboard-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.dashboard-nav-link:hover,
.dashboard-nav-link.is-active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(212, 175, 55, 0.28);
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    min-height: 34px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.74rem;
    font-weight: 800;
}

.sidebar-card,
.panel,
.summary-card,
.hero-strip,
.subpanel,
.login-card,
.kpi-card,
.admin-form-panel,
.flash,
.chart-frame,
.page-controls {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.sidebar-card {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.92rem;
}

.sidebar-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
}

.dashboard-main {
    min-width: 0;
    padding: 28px;
}

.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 18px;
}

.dashboard-topbar h1 {
    font-size: clamp(2rem, 3vw, 2.8rem);
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--gold);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

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

.global-search input,
.page-controls input,
.page-controls select,
.stacked-form input,
.stacked-form select,
.stacked-form textarea,
.filter-row input,
.filter-row select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font: inherit;
}

.global-search input {
    width: 280px;
}

.notification-pill,
.user-pill,
.ghost-button,
.secondary-button,
.primary-button,
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-weight: 600;
}

.notification-pill span {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    min-height: 26px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.18);
    color: var(--gold);
}

.user-pill {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 14px;
    min-height: auto;
}

.user-pill span {
    color: var(--muted);
    font-size: 0.82rem;
}

.primary-button {
    justify-content: center;
    background: linear-gradient(180deg, var(--gold), var(--gold-deep));
    color: #2b2104;
    border-color: transparent;
    cursor: pointer;
}

.secondary-button,
.ghost-button {
    cursor: pointer;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.flash-warning {
    border-color: rgba(243, 182, 100, 0.4);
    color: #ffd7a6;
}

.flash-success {
    border-color: rgba(108, 197, 139, 0.4);
    color: #d5f5de;
}

.flash-danger {
    border-color: rgba(239, 106, 106, 0.4);
    color: #ffd2d2;
}

.page-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.control-group {
    min-width: 160px;
}

.control-group label,
.stacked-form label,
.filter-row label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.dashboard-content {
    display: grid;
    gap: 20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.kpi-card {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: var(--radius);
}

.kpi-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.kpi-card strong {
    font-size: 1.38rem;
}

.dashboard-grid {
    display: grid;
    gap: 20px;
}

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

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

.panel,
.summary-card,
.hero-strip,
.subpanel,
.admin-form-panel {
    padding: 20px;
    border-radius: var(--radius-lg);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-header a {
    color: var(--gold);
    font-weight: 600;
}

.subheading {
    margin: 16px 0 12px;
    font-size: 1rem;
}

.summary-card {
    display: grid;
    gap: 14px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.3);
}

.summary-lines,
.hero-metrics,
.two-col-list,
.mini-metrics {
    display: grid;
    gap: 12px;
}

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

.hero-strip {
    display: grid;
    gap: 18px;
}

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

.hero-metrics div,
.mini-metric {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.hero-metrics span,
.mini-metric span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.88rem;
}

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

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

.named-list {
    display: grid;
    gap: 10px;
}

.named-list-row,
.matrix-row,
.heatmap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.named-list-row:first-of-type,
.matrix-row:first-of-type,
.heatmap-row:first-of-type {
    border-top: 0;
}

.named-list-row span,
.muted {
    color: var(--muted);
}

.chart-frame {
    position: relative;
    width: 100%;
    border-radius: 18px;
    padding: 10px;
}

.chart-frame canvas {
    width: 100%;
    height: 100%;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.status-step,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
}

.status-step.is-active,
.tone-success {
    background: rgba(108, 197, 139, 0.16);
    color: #c8f0d6;
}

.tone-warning {
    background: rgba(243, 182, 100, 0.18);
    color: #ffdcb4;
}

.tone-danger {
    background: rgba(239, 106, 106, 0.16);
    color: #ffd3d3;
}

.tone-neutral {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table-link {
    color: var(--gold);
    font-weight: 700;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 240px;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    color: var(--muted);
}

.empty-state.compact {
    min-height: 120px;
}

.tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 16px;
}

.tab-link {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-weight: 700;
}

.tab-link.is-active {
    background: rgba(212, 175, 55, 0.16);
    color: var(--gold);
}

.filter-row,
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}

.filter-row > * {
    flex: 1 1 180px;
}

.heatbar {
    position: relative;
    flex: 1;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.heatbar span {
    position: absolute;
    inset: 0 auto 0 0;
    background: linear-gradient(90deg, var(--teal), var(--gold));
}

.matrix {
    display: grid;
    gap: 10px;
}

.matrix-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.admin-forms {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.admin-form-panel summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.admin-form-panel summary::-webkit-details-marker {
    display: none;
}

.admin-form-panel[open] summary {
    margin-bottom: 16px;
}

.stacked-form {
    display: grid;
    gap: 14px;
}

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

.stacked-form .full-width {
    grid-column: 1 / -1;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-field input {
    width: auto;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-card {
    width: min(520px, 100%);
    padding: 28px;
    border-radius: 30px;
}

@media (max-width: 1180px) {
    .dashboard-shell,
    .dashboard-grid-3,
    .dashboard-grid-2,
    .hero-metrics {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: relative;
        min-height: auto;
    }

    .summary-lines,
    .two-col-list,
    .mini-metrics,
    .stacked-form.two-up {
        grid-template-columns: 1fr;
    }
}

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

    .dashboard-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .dashboard-main {
        padding: 20px;
    }

    .dashboard-topbar,
    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .global-search input {
        width: 100%;
    }
}
