:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --bg-base: #09090b;
    --bg-elevated: #111113;
    --bg-surface: #18181b;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(16, 185, 129, 0.12);

    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent: #10b981;
    --accent-hover: #059669;
    --accent-muted: rgba(16, 185, 129, 0.15);

    --danger: #f87171;
    --warning: #fbbf24;
    --info: #38bdf8;
    --success: #34d399;

    --sidebar-width: 15.5rem;
    --topbar-height: 3.75rem;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --topbar-bg: rgba(9, 9, 11, 0.85);
    --grain-opacity: 0.035;

    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.tabular-nums,
.amount,
.data-table td:nth-child(5),
.stat-card__value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ── Layout ── */

.app-layout {
    display: flex;
    min-height: 100dvh;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100dvh;
    z-index: 110;
    transform: none;
    transition: transform var(--transition);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar__logo {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background: var(--accent-muted);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar__title {
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sidebar__subtitle {
    font-size: 0.6875rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar__nav {
    flex: 1;
    padding: 0.5rem 0.75rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.25rem;
}

.nav-section__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin-bottom: 0.375rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5625rem 0.625rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-link svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link:hover svg { opacity: 1; }

.nav-link.is-active {
    background: var(--bg-active);
    color: var(--accent);
}

.nav-link.is-active svg {
    opacity: 1;
    color: var(--accent);
}

.sidebar__footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.user-chip__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.user-chip__name {
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
}

.user-chip__email {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.theme-icon { display: none; }

[data-theme="dark"] .theme-icon--light { display: block; }
[data-theme="light"] .theme-icon--dark { display: block; }

.sidebar-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar-toggle:hover { background: var(--bg-hover); }

.app-content {
    flex: 1;
    padding: 1.75rem;
    max-width: 90rem;
}

/* ── Guest / Login ── */

.guest-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 2rem 1rem;
}

.guest-shell {
    width: 100%;
    max-width: 26rem;
    position: relative;
    z-index: 1;
}

.guest-topbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.auth-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.auth-card__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.auth-card__title {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 0.25rem;
    text-wrap: balance;
}

.auth-card__desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.auth-hint {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.auth-hint code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg-surface);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

/* ── Page header ── */

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header__title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 0 0 0.375rem;
    text-wrap: balance;
}

.page-header__desc {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    max-width: 42rem;
}

.page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* ── Surfaces ── */

.surface {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.surface--flush { padding: 0; overflow: hidden; }

.surface__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.surface__title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.surface__body { padding: 1.25rem; }

.surface + .surface { margin-top: 1.25rem; }

/* Legacy alias */
.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

/* ── Stats ── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.125rem 1.25rem;
    transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-strong); }

.stat-card__label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 0.375rem;
}

.stat-card__value {
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--text-primary);
}

.stat-card--accent .stat-card__value { color: var(--accent); }

/* ── Dropzone ── */

.dropzone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--bg-surface);
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dragging {
    border-color: var(--accent);
    background: var(--accent-muted);
}

.dropzone__icon {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 1rem;
    color: var(--text-muted);
}

.dropzone.dragging .dropzone__icon { color: var(--accent); }

.dropzone__title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin: 0 0 0.25rem;
}

.dropzone__hint {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: 0 0 1.25rem;
}

/* ── Data table ── */

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover { background: var(--bg-hover); }

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

.data-table .cell-muted { color: var(--text-secondary); font-size: 0.8125rem; }

.data-table .cell-actions { text-align: right; white-space: nowrap; }

.empty-state {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Status badges ── */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}

.status-badge--neutral { background: rgba(161, 161, 170, 0.15); color: #d4d4d8; }
.status-badge--info { background: rgba(56, 189, 248, 0.15); color: var(--info); }
.status-badge--warning { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.status-badge--success { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.status-badge--danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.status-badge--accent { background: var(--accent-muted); color: var(--accent); }

/* ── Meta grid ── */

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 1.25rem;
}

.meta-item__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.meta-item__value {
    font-size: 0.9375rem;
    font-weight: 500;
}

.meta-item__value code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    word-break: break-all;
}

/* ── List items ── */

.list-item {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.list-item:last-child { border-bottom: none; }

.list-item__title {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.list-item__meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ── Code blocks ── */

.code-block {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 20rem;
    overflow: auto;
    margin: 0;
    color: var(--text-secondary);
}

/* ── Role cards ── */

.role-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    height: 100%;
}

.role-card__title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 1rem;
    text-transform: capitalize;
}

.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 28rem;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.25rem;
}

.role-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.role-card__slug {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-base);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.role-card__desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.role-card__for {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.role-card__for-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.permission-check {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.permission-check:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.permission-check--active {
    background: var(--bg-active);
    border-color: rgba(16, 185, 129, 0.35);
}

.permission-check .form-check-input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.permission-check__content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.permission-check__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.permission-check__desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.permission-check__unlocks {
    font-size: 0.6875rem;
    color: var(--accent);
    line-height: 1.35;
}

.permission-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.permission-legend__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.permission-legend__dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: transparent;
}

.permission-legend__dot--active {
    background: var(--accent);
    border-color: var(--accent);
}

.permission-ref-list {
    display: flex;
    flex-direction: column;
}

.permission-ref-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.permission-ref-item:last-child {
    border-bottom: none;
}

.permission-ref-item__name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.permission-ref-item__code {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.permission-ref-item__desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0 0 0.25rem;
    line-height: 1.5;
}

.permission-ref-item__unlocks {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.permission-ref-item__unlocks-label {
    font-weight: 600;
    color: var(--accent);
}

/* ── Bootstrap overrides ── */

[data-bs-theme="dark"] {
    --bs-body-bg: var(--bg-base);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border-subtle);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 16, 185, 129;
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-color: var(--text-muted);
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-focus-shadow-rgb: 16, 185, 129;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: transform var(--transition), background var(--transition);
}

.btn-primary:active { transform: scale(0.98); }

.btn-outline-light,
.btn-outline-secondary {
    --bs-btn-color: var(--text-secondary);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--bg-hover);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

.btn-outline-success {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: rgba(16, 185, 129, 0.4);
    --bs-btn-hover-bg: var(--accent-muted);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-hover-color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.btn-success {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.btn-sm { font-size: 0.8125rem; }

.form-control,
.form-select {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-surface);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-control::file-selector-button {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-muted);
    border-color: var(--accent);
}

.alert {
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--success);
}

.alert-danger {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.25);
    color: var(--danger);
}

.badge { font-weight: 600; letter-spacing: 0.02em; }

.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

.pagination {
    --bs-pagination-bg: var(--bg-elevated);
    --bs-pagination-border-color: var(--border-subtle);
    --bs-pagination-color: var(--text-secondary);
    --bs-pagination-hover-bg: var(--bg-hover);
    --bs-pagination-hover-color: var(--text-primary);
    --bs-pagination-active-bg: var(--accent);
    --bs-pagination-active-border-color: var(--accent);
    font-size: 0.875rem;
}

.amount--negative { color: var(--danger); }
.amount--positive { color: var(--success); }

.score-badge {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.signals-code {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    word-break: break-all;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 105;
    pointer-events: none;
}

.sidebar-overlay.is-visible {
    display: block;
    pointer-events: auto;
}

/* ── Responsive ── */

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
    }

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

    .app-main { margin-left: 0; }

    .sidebar-toggle { display: flex; align-items: center; }

    .app-content { padding: 1.25rem; }
}

@media (min-width: 992px) {
    .sidebar-overlay {
        display: none !important;
        pointer-events: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    html { scroll-behavior: auto; }
}

/* ── Charts ── */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.chart-card { min-height: 0; }

.chart-wrap {
    position: relative;
    height: 14rem;
}

.chart-wrap--donut {
    height: 12rem;
}

@media (max-width: 767.98px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Light theme ── */

[data-theme="light"] {
    --bg-base: #f4f4f5;
    --bg-elevated: #ffffff;
    --bg-surface: #fafafa;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(16, 185, 129, 0.1);

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #71717a;

    --accent: #059669;
    --accent-hover: #047857;
    --accent-muted: rgba(5, 150, 105, 0.12);

    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --success: #059669;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --topbar-bg: rgba(255, 255, 255, 0.88);
    --grain-opacity: 0.02;
}

[data-theme="light"] .status-badge--neutral { background: rgba(113, 113, 122, 0.12); color: #52525b; }
[data-theme="light"] .score-badge { background: rgba(217, 119, 6, 0.12); color: #b45309; }

[data-theme="light"] [data-bs-theme="light"] {
    --bs-body-bg: var(--bg-base);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border-subtle);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 5, 150, 105;
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-color: var(--text-muted);
}

[data-theme="light"] .btn-outline-light {
    --bs-btn-color: var(--text-secondary);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--bg-hover);
    --bs-btn-hover-color: var(--text-primary);
}

[data-theme="light"] .sidebar-overlay.is-visible {
    background: rgba(0, 0, 0, 0.35);
}
