:root {
    --bg: #08111f;
    --bg-elevated: rgba(12, 21, 38, 0.88);
    --bg-panel: rgba(14, 25, 45, 0.82);
    --bg-panel-strong: #0f1b31;
    --bg-soft: rgba(115, 150, 220, 0.08);
    --bg-hover: rgba(104, 146, 255, 0.12);
    --text: #eef4ff;
    --text-soft: #aebdda;
    --text-muted: #7f92b3;
    --border: rgba(166, 191, 235, 0.14);
    --border-strong: rgba(140, 171, 229, 0.24);
    --accent: #76a7ff;
    --accent-strong: #9dc6ff;
    --accent-glow: rgba(118, 167, 255, 0.32);
    --success: #45d08b;
    --warning: #ffb44d;
    --danger: #ff6b81;
    --teal: #55d6cf;
    --purple: #c89bff;
    --shadow: 0 18px 45px rgba(2, 6, 23, 0.42);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --sidebar-width: 284px;
    --content-max: 1520px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(118, 167, 255, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(85, 214, 207, 0.14), transparent 24%),
        linear-gradient(180deg, #09101d 0%, #060c16 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at center, black 28%, transparent 88%);
    opacity: 0.24;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    color: #cbe0ff;
}

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

::selection {
    background: rgba(118, 167, 255, 0.25);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(153, 179, 225, 0.18);
    border-radius: 999px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 18px auto 18px 18px;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    background: rgba(9, 18, 34, 0.84);
    border: 1px solid var(--border);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 30;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    padding: 1.35rem 1.35rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(118, 167, 255, 0.24), rgba(85, 214, 207, 0.2));
    border: 1px solid rgba(157, 198, 255, 0.18);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong {
    display: block;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.sidebar-brand span {
    display: block;
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.85rem;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.35rem;
    padding: 0.9rem 0.95rem;
    border-radius: 16px;
    color: var(--text-soft);
    border: 1px solid transparent;
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.sidebar-nav a:hover {
    transform: translateX(2px);
    background: rgba(118, 167, 255, 0.09);
    border-color: rgba(118, 167, 255, 0.14);
    color: var(--text);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(118, 167, 255, 0.18), rgba(85, 214, 207, 0.08));
    border-color: rgba(118, 167, 255, 0.24);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-icon {
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1.1rem 1.15rem 1.25rem;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 0.9rem;
}

.sidebar-footer-note {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.sidebar-footer a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: rgba(255, 107, 129, 0.08);
    border: 1px solid rgba(255, 107, 129, 0.18);
    color: #ffc9d1;
    font-weight: 600;
}

.sidebar-footer a:hover {
    background: rgba(255, 107, 129, 0.14);
}

.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 40;
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(7, 14, 28, 0.86);
    color: var(--text);
    backdrop-filter: blur(16px);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(2, 8, 20, 0.55);
    backdrop-filter: blur(4px);
    z-index: 20;
}

.sidebar-overlay.active {
    display: block;
}

.main-content {
    flex: 1;
    margin-left: calc(var(--sidebar-width) + 36px);
    padding: 1.35rem 1.5rem 1.75rem;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--content-max);
    margin: 0 auto 1.35rem;
    padding: 1.1rem 1.35rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: rgba(8, 16, 30, 0.82);
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 32px rgba(2, 6, 23, 0.24);
}

.topbar-copy {
    min-width: 0;
}

.eyebrow {
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.38rem;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.page-content {
    max-width: var(--content-max);
    margin: 0 auto;
}

.disclaimer-footer {
    max-width: var(--content-max);
    margin: 1.4rem auto 0;
    padding: 0.85rem 0.25rem 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-align: center;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.kpi-card,
.card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(15, 27, 49, 0.92), rgba(10, 19, 34, 0.92));
    box-shadow: var(--shadow);
}

.kpi-card::before,
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 36%);
    opacity: 0.8;
}

.kpi-card {
    padding: 1.25rem 1.3rem;
}

.kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.13em;
    margin-bottom: 0.75rem;
}

.kpi-value {
    font-size: clamp(1.55rem, 2.2vw, 2.25rem);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.kpi-sub {
    margin-top: 0.6rem;
    color: var(--text-soft);
    font-size: 0.84rem;
    line-height: 1.45;
}

.positive {
    color: var(--success) !important;
}

.negative {
    color: var(--danger) !important;
}

.card {
    padding: 1.35rem;
    margin-bottom: 1.15rem;
}

.card-title {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.table-wrap {
    position: relative;
    z-index: 1;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(5, 11, 21, 0.38);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.9rem 1rem;
    background: rgba(12, 21, 38, 0.95);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    text-align: left;
}

tbody td {
    padding: 0.92rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-soft);
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(118, 167, 255, 0.06);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.badge-green {
    background: rgba(69, 208, 139, 0.12);
    border-color: rgba(69, 208, 139, 0.18);
    color: #87e4b2;
}

.badge-yellow {
    background: rgba(255, 180, 77, 0.13);
    border-color: rgba(255, 180, 77, 0.2);
    color: #ffd59b;
}

.badge-red {
    background: rgba(255, 107, 129, 0.12);
    border-color: rgba(255, 107, 129, 0.18);
    color: #ffb8c2;
}

.badge-blue {
    background: rgba(118, 167, 255, 0.14);
    border-color: rgba(118, 167, 255, 0.18);
    color: #cbe0ff;
}

.badge-gray {
    background: rgba(176, 189, 218, 0.1);
    border-color: rgba(176, 189, 218, 0.14);
    color: #d2dbef;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(118, 167, 255, 0.1);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.btn:hover {
    transform: translateY(-1px);
    background: rgba(118, 167, 255, 0.15);
    border-color: rgba(118, 167, 255, 0.28);
    box-shadow: 0 10px 28px rgba(118, 167, 255, 0.18);
}

.btn-primary {
    background: linear-gradient(135deg, rgba(69, 208, 139, 0.95), rgba(55, 164, 107, 0.95));
    border-color: rgba(69, 208, 139, 0.5);
    color: #f7fff9;
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(78, 217, 147, 1), rgba(59, 179, 116, 1));
}

.btn.htmx-request,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chart-container {
    position: relative;
    min-height: 320px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    margin: 1rem 0 0.5rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 2.55rem;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(12, 21, 38, 0.75);
    color: var(--text-soft);
    text-align: center;
}

.pagination a:hover {
    background: rgba(118, 167, 255, 0.14);
    color: var(--text);
}

.pagination .active {
    background: linear-gradient(135deg, rgba(118, 167, 255, 0.22), rgba(85, 214, 207, 0.14));
    border-color: rgba(118, 167, 255, 0.26);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.45;
    pointer-events: none;
}

.toolbar-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar-meta {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.form-select,
.report-field input,
.report-field select {
    min-height: 44px;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(6, 12, 24, 0.8);
    color: var(--text);
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.form-select:focus,
.report-field input:focus,
.report-field select:focus {
    border-color: rgba(118, 167, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(118, 167, 255, 0.15);
    background: rgba(7, 14, 28, 0.95);
}

.report-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.report-form {
    display: flex;
    align-items: flex-end;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.report-field {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    min-width: 150px;
}

.report-field label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.report-actions {
    display: flex;
    align-items: center;
}

.report-meta {
    color: var(--text-soft);
    font-size: 0.84rem;
    line-height: 1.55;
}

.report-filter-chips,
.report-highlight-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.report-filter-chip,
.report-highlight {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(118, 167, 255, 0.08);
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1;
}

.report-filter-chip.muted {
    background: rgba(174, 189, 218, 0.08);
    color: var(--text-soft);
}

.report-highlight.positive {
    border-color: rgba(69, 208, 139, 0.18);
    background: rgba(69, 208, 139, 0.08);
}

.report-highlight.negative {
    border-color: rgba(255, 107, 129, 0.18);
    background: rgba(255, 107, 129, 0.08);
}

.report-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.report-panel {
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(6, 12, 24, 0.56);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    padding: 1rem;
}

.report-panel-wide {
    margin-bottom: 1rem;
}

.report-panel-title {
    margin-bottom: 0.8rem;
    font-size: 0.96rem;
    font-weight: 700;
}

.report-empty-state,
.empty-state {
    padding: 1.15rem;
    border-radius: 18px;
    border: 1px dashed rgba(174, 189, 218, 0.2);
    background: rgba(6, 12, 24, 0.48);
    color: var(--text-soft);
    line-height: 1.6;
}

.heatmap-cell {
    border-radius: 12px;
    min-width: 60px;
}

.metric-disclaimer {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(6, 12, 24, 0.52);
    color: var(--text-soft);
    font-size: 0.82rem;
    line-height: 1.6;
}

.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-container {
    width: min(100%, 1080px);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 420px);
    gap: 1.25rem;
    align-items: stretch;
}

.login-panel,
.login-card {
    border-radius: 28px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(15, 27, 49, 0.94), rgba(8, 16, 31, 0.94));
    box-shadow: var(--shadow);
}

.login-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: flex-start;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(118, 167, 255, 0.1);
    border: 1px solid rgba(118, 167, 255, 0.16);
    color: var(--accent-strong);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.login-panel h1 {
    margin: 1.25rem 0 0.85rem;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
}

.login-panel p {
    color: var(--text-soft);
    max-width: 34rem;
    line-height: 1.7;
}

.login-highlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.login-highlight {
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
}

.login-highlight strong {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.88rem;
}

.login-highlight span {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.login-card {
    padding: 1.9rem;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.4rem;
}

.login-brand-copy h2 {
    margin: 0;
    font-size: 1.2rem;
}

.login-brand-copy p {
    margin: 0.3rem 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(6, 12, 24, 0.82);
    color: var(--text);
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.form-group input:focus {
    border-color: rgba(118, 167, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(118, 167, 255, 0.15);
}

.error-message {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 107, 129, 0.24);
    background: rgba(255, 107, 129, 0.08);
    color: #ffc5cd;
}

.login-btn {
    width: 100%;
}

.login-footer {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.55;
}

@media (max-width: 1180px) {
    .login-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        inset: 0 auto 0 0;
        border-radius: 0 24px 24px 0;
        transform: translateX(-102%);
        transition: transform 180ms ease;
    }

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

    .sidebar-toggle {
        display: grid;
        place-items: center;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem 1rem 1.5rem;
    }

    .topbar {
        margin-top: 3.2rem;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .topbar {
        padding: 1rem 1.05rem;
        border-radius: 20px;
    }

    .card,
    .kpi-card {
        border-radius: 20px;
    }

    .card {
        padding: 1rem;
    }

    .section-grid,
    .report-chart-grid,
    .kpi-grid,
    .login-highlights {
        grid-template-columns: 1fr;
    }

    .report-form,
    .toolbar-card,
    .toolbar-group {
        width: 100%;
    }

    .report-field,
    .report-actions,
    .form-select {
        min-width: 100%;
        width: 100%;
    }
}

/* UI polish additions */
.topbar-description {
    margin: 0.55rem 0 0;
    max-width: 52rem;
    color: var(--text-soft);
    line-height: 1.6;
}

a.topbar-pill {
    color: var(--text-soft);
}

a.topbar-pill:hover {
    color: #ffffff;
}

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

.topbar-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.45rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(12, 21, 38, 0.82);
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.topbar-pill-accent {
    background: rgba(118, 167, 255, 0.15);
    border-color: rgba(118, 167, 255, 0.28);
    color: #dbe9ff;
}

.stack-lg {
    display: grid;
    gap: 1rem;
}

.card-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.card-header-copy {
    min-width: 0;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.card-header .card-title {
    margin-bottom: 0.4rem;
}

.card-subtitle {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.62;
}

.kpi-grid.compact {
    margin-bottom: 0;
}

.kpi-value-small {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
}

.filter-card {
    padding: 1rem 1.2rem;
}

.filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-count {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.filter-count strong {
    color: var(--text);
}

.table-align-right {
    text-align: right !important;
}

.table-align-center {
    text-align: center !important;
}

.table-cell-strong {
    font-weight: 700;
    color: var(--text);
}

.table-cell-muted {
    color: var(--text-muted);
}

.table-cell-accent {
    color: var(--accent-strong);
}

.table-index {
    color: var(--text-muted);
}

.table-value-stack {
    display: grid;
    gap: 0.22rem;
}

.table-value-stack strong {
    color: var(--text);
    font-size: 0.92rem;
}

.table-value-stack span {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.text-success {
    color: #87e4b2 !important;
}

.text-info {
    color: #cbe0ff !important;
}

.text-warning {
    color: #ffd59b !important;
}

.text-danger {
    color: #ffb8c2 !important;
}

.text-teal {
    color: #99f0ea !important;
}

.text-capitalize {
    text-transform: capitalize;
}

.muted-dash {
    color: var(--text-muted);
}

.row-emphasis td {
    border-top: 1px solid rgba(157, 198, 255, 0.16);
    background: rgba(118, 167, 255, 0.05);
    font-weight: 700;
}

.row-link {
    cursor: pointer;
}

.row-link:hover td:first-child::before {
    background: rgba(118, 167, 255, 0.82);
}

.row-link td:first-child {
    position: relative;
}

.row-link td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14%;
    bottom: 14%;
    width: 3px;
    border-radius: 999px;
    background: transparent;
    transition: background 140ms ease;
}

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

.table-link:hover {
    color: #ffffff;
}

.table-empty {
    padding: 1.7rem 1rem !important;
    text-align: center !important;
    color: var(--text-muted);
}

.positive-state {
    color: #9ff1bb !important;
}

.pagination-ellipsis {
    padding: 0.7rem 0.5rem;
    color: var(--text-muted);
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 0.95rem;
    padding: 0 0.2rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.legend-bar {
    flex: 0 0 220px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(90deg, #ff6b81 0%, #ffb44d 50%, #45d08b 100%);
}

.cohort-label {
    white-space: nowrap;
    font-weight: 700;
    color: var(--text);
}

.detail-table tbody td:first-child {
    width: 42%;
    font-weight: 700;
    color: var(--text-soft);
}

.detail-table tbody td:last-child {
    text-align: right;
    color: var(--text);
}

.chart-card .chart-container {
    min-height: 360px;
}

.btn-sync.btn-synced {
    background: linear-gradient(135deg, rgba(69, 208, 139, 1), rgba(85, 214, 207, 0.95));
    border-color: rgba(85, 214, 207, 0.38);
    color: #ffffff;
}

.empty-state.compact {
    padding: 0.95rem 1rem;
}

@media (max-width: 1024px) {
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .card-header,
    .card-header-actions,
    .filter-toolbar,
    .filter-form {
        width: 100%;
    }

    .legend-bar {
        flex: 1 1 100%;
    }

    .detail-table tbody td:last-child {
        text-align: left;
    }
}
