:root {
    /* Brand */
    --brand-700: #1F56D8;
    --brand-600: #2C6DF3;
    --brand-500: #4E86FF;
    --brand-50: #F3F7FF;

    /* Text & Surfaces */
    --bg: #F4F7FB;
    --surface: #FFFFFF;
    --surface-2: #FAFBFF;
    --surface-50: #f8fafc;
    --surface-100: #f1f5f9;
    --surface-200: #e2e8f0;
    --surface-300: #cbd5e1;
    --surface-400: #94a3b8;
    --surface-500: #64748b;
    --surface-600: #475569;
    --surface-700: #334155;
    --surface-800: #1f2937;
    --surface-900: #0f172a;
    --text: #0F172A;
    --muted: #667085;
    --muted-2: #98A2B3;
    --divider: #E5E7EB;
    --divider-strong: #cbd5e1;

    /* Status */
    --ok: #12B981;
    --warn: #F4B400;
    --danger: #EF4444;
    --info: #7C9EFF;
    --success: #16a34a;
    --warning: #f59e0b;

    /* Shape & elevation */
    --r-lg: 16px;
    --r-md: 12px;
    --r-sm: 8px;
    --r-pill: 999px;
    --sh-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 1px rgba(16, 24, 40, .04);
    --sh-md: 0 8px 24px rgba(16, 24, 40, .08);

    /* Spacing (4px base) */
    --s-1: 4px;
    --s-2: 8px;
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;
    --s-10: 40px;
    /* Typography (Plus Jakarta Sans) */
    --f-h1: 28px;
    --f-h2: 20px;
    --f-h3: 16px;
    --f-body: 14px;
    --f-cap: 12px;
    --fw-600: 600;
    --fw-700: 700;

    /* Layout metrics */
    --sidebar-w: 256px;
    --sidebar-w-collapsed: 80px;
    --topbar-h: 64px;
    --z-topbar: 40;
    --z-over: 50;
}

html,
body {
    background: var(--bg);
    color: var(--text);
    font: var(--f-body)/1.45 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.ds-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--f-body);
    color: var(--text);
}

.ds-field__label {
    font-size: var(--f-cap);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: var(--fw-600);
    color: var(--muted);
}

.ds-field__required {
    color: var(--danger, #ef4444);
    margin-left: 4px;
}

.ds-input {
    display: block;
    width: 100%;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--divider);
    background: var(--surface);
    padding: 0 12px;
    font: inherit;
    color: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ds-input:focus-visible {
    outline: 3px solid color-mix(in oklab, var(--brand-600) 45%, transparent);
    outline-offset: 2px;
}

.ds-field__description {
    font-size: var(--f-cap);
    color: var(--muted);
}

.ds-field--disabled .ds-input {
    background: color-mix(in srgb, var(--surface) 70%, var(--surface-2) 30%);
    color: var(--muted);
    cursor: not-allowed;
}

.ds-field--compact .ds-input {
    height: 36px;
    border-radius: 8px;
}

@media (max-width: 640px) {
    .ds-input {
        height: 44px;
    }
}

html.is-locked,
body.is-locked {
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: var(--fw-600);
    color: var(--text);
}

p {
    margin-block: 0;
}

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

.ds-stack {
    display: grid;
    gap: var(--s-4);
}

.ds-stack--sm {
    gap: var(--s-3);
}

.ds-stack--lg {
    gap: var(--s-6);
}

.ds-cluster {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.w-full {
    width: 100%;
    min-width: 280px;
}

.ds-section {
    margin-block: var(--s-4);
}

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

.fw-600 {
    font-weight: var(--fw-600);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--r-pill);
    font-size: var(--f-cap);
}

@media (max-width: 768px) {
    .ds-stack {
        gap: var(--s-3);
    }

    .ds-section {
        margin-block: var(--s-3);
    }
}

a:hover {
    color: var(--brand-600);
}

button {
    font-family: inherit;
}

.page,
.content,
main {
    background: var(--bg);
}

.content {
    padding: var(--s-6);
}

.btn-primary {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
}

.btn-primary:hover {
    background-color: var(--brand-700);
    border-color: var(--brand-700);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    border-radius: 10px;
    border: 1px solid var(--divider);
    background: transparent;
    color: var(--text);
    transition: background 0.18s ease, color 0.18s ease;
}

.icon-button:hover {
    background: var(--surface-2);
}

.icon-button:focus-visible {
    outline: 3px solid color-mix(in oklab, var(--brand-600) 45%, transparent);
    outline-offset: 2px;
}

.btn,
.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid var(--divider);
    background: var(--surface);
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
    background: var(--surface-2);
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-ghost:focus-visible {
    outline: 3px solid color-mix(in oklab, var(--brand-600) 45%, transparent);
    outline-offset: 2px;
}

.btn-primary {
    color: #fff;
}

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

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 16px;
    border-radius: var(--r-pill);
    border: 1px solid var(--divider);
    background: var(--surface);
    color: var(--muted);
    font-weight: 500;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
}

.pill--selected {
    background: var(--brand-50);
    color: var(--brand-700);
    border-color: color-mix(in srgb, var(--brand-600) 30%, transparent);
}

.pill:focus-visible {
    outline: 3px solid color-mix(in oklab, var(--brand-600) 45%, transparent);
    outline-offset: 2px;
}

.dashboard-chart {
    position: relative;
    width: 100%;
    min-height: 260px;
}

.dashboard-chart canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

#blazor-error-ui {
    position: fixed;
    inset-inline: 0;
    bottom: var(--s-6);
    display: none;
    margin-inline: auto;
    width: min(540px, calc(100% - 2 * var(--s-6)));
    padding: var(--s-4) var(--s-5);
    border-radius: var(--r-lg);
    background: color-mix(in srgb, var(--surface) 88%, white 12%);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
    border: 1px solid color-mix(in srgb, var(--danger, #f87171) 18%, transparent);
    color: var(--text);
    font-weight: var(--fw-500);
    z-index: calc(var(--z-topbar) + 20);
    display: none;
    gap: var(--s-3);
    align-items: center;
}

#blazor-error-ui a.reload {
    margin-left: auto;
    font-weight: var(--fw-600);
    color: var(--brand-600);
}

#blazor-error-ui .dismiss {
    margin-left: var(--s-3);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

#blazor-error-ui a.reload:hover,
#blazor-error-ui .dismiss:hover {
    color: var(--brand-700);
}

@media (max-width: 640px) {
    #blazor-error-ui {
        inset-inline: var(--s-3);
        width: auto;
        bottom: var(--s-4);
        flex-direction: column;
        text-align: center;
        gap: var(--s-2);
    }

    #blazor-error-ui a.reload {
        margin-left: 0;
    }

    #blazor-error-ui .dismiss {
        align-self: center;
    }
}