:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #647084;
    --line: #d9e0ea;
    --accent: #176b87;
    --accent-2: #2f855a;
    --danger: #b42318;
    --warn: #b7791f;
    --sidebar: #182536;
    --sidebar-soft: #25364d;
}

* {
    box-sizing: border-box;
}

body.superadmin-console-page {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0;
}

.superadmin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 276px;
    padding: 20px 16px;
    overflow-y: auto;
    background: var(--sidebar);
    color: #f8fafc;
}

.superadmin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    margin-bottom: 22px;
}

.superadmin-brand span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--sidebar);
    font-weight: 800;
}

.superadmin-sidebar nav {
    display: grid;
    gap: 14px;
}

.sidebar-menu-group {
    display: grid;
    gap: 5px;
}

.sidebar-menu-group h2 {
    margin: 0 0 3px;
    padding: 0 10px;
    color: #9fb2c8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
}

.sidebar-menu-group.is-temporary {
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.12);
}

.superadmin-sidebar nav a {
    color: #d8e1ec;
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 14px;
}

.superadmin-sidebar nav a:hover,
.superadmin-sidebar nav a:focus {
    background: var(--sidebar-soft);
    color: #ffffff;
}

.sidebar-note {
    margin-top: 20px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: #d8e1ec;
}

.superadmin-main {
    margin-left: 276px;
    padding: 24px;
    display: grid;
    gap: 18px;
}

.superadmin-topbar,
.console-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(23, 32, 51, .05);
}

.superadmin-topbar {
    padding: 20px;
    display: grid;
    gap: 14px;
}

.superadmin-topbar h1,
.console-section h2 {
    margin: 0;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.mode-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-strip span,
.section-heading > span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    background: #f8fafc;
    font-size: 13px;
}

.mode-strip strong {
    color: var(--ink);
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

button,
.topbar-actions a {
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    padding: 8px 11px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:disabled {
    border-color: #b8c2d1;
    background: #d7dee8;
    color: #667085;
    cursor: not-allowed;
}

.topbar-actions a {
    border-color: var(--line);
    background: #ffffff;
    color: var(--ink);
}

.console-section {
    padding: 18px;
    scroll-margin-top: 16px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric-tile {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    display: grid;
    gap: 6px;
    background: #fbfcfe;
}

.metric-tile span,
table small {
    color: var(--muted);
    font-size: 12px;
}

.metric-tile strong {
    font-size: 22px;
}

.investor-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 14px;
}

.investor-summary-table table {
    min-width: 1320px;
}

.capacity-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.capacity-grid > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
    display: grid;
    gap: 4px;
}

.capacity-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.capacity-grid strong {
    font-size: 15px;
}

.compact-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    align-items: end;
}

.console-action-selector {
    display: flex;
    align-items: end;
    gap: 12px;
    margin: 12px 0 16px;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
}

.console-action-selector label {
    display: grid;
    gap: 5px;
    min-width: 240px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.console-action-selector select {
    width: 100%;
}

.is-action-muted form[hidden] + .table-wrap,
.is-action-muted .capacity-grid {
    opacity: 0.55;
}

.compact-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.compact-form .wide-field {
    grid-column: span 2;
}

.user-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: -2px 0 10px;
}

.inline-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.inline-checkbox input {
    width: 16px;
    min-height: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

.bulk-user-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bulk-user-actions span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

th:first-child,
td:first-child {
    width: 42px;
    text-align: center;
}

th input[type="checkbox"],
td input[type="checkbox"] {
    width: 16px;
    min-height: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 9px;
    color: var(--ink);
    background: #ffffff;
    font: inherit;
    min-height: 38px;
}

.inline-checkbox input,
th input[type="checkbox"],
td input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    min-height: 16px;
    height: 16px;
    padding: 0;
    border-radius: 4px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

th {
    background: #eef3f8;
    color: #344054;
    font-size: 12px;
    white-space: nowrap;
}

td strong,
td small {
    display: block;
}

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

.is-inactive-user {
    background: #fff8f7;
}

.user-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.user-status-badge.is-active {
    border: 1px solid #b7e4cc;
    background: #ecfdf3;
    color: #067647;
}

.user-status-badge.is-inactive {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: var(--danger);
}

.balance-amount {
    font-weight: 800;
    color: var(--ink);
}

.balance-amount.is-negative {
    color: var(--danger);
}

.small-action-button {
    padding: 6px 9px;
    font-size: 12px;
    white-space: nowrap;
}

.small-action-button.danger,
.qa-modal button[type="submit"] {
    border-color: var(--danger);
    background: var(--danger);
}

.qa-modal {
    width: min(440px, calc(100vw - 28px));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 24px 60px rgba(23, 32, 51, .22);
}

.qa-modal::backdrop {
    background: rgba(15, 23, 42, .44);
}

.qa-modal form {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.qa-modal h2,
.qa-modal p {
    margin: 0;
}

.modal-subtle {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.qa-modal label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-actions button[type="button"] {
    border-color: var(--line);
    background: #ffffff;
    color: var(--ink);
}

.toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    display: grid;
    gap: 8px;
    width: min(360px, calc(100vw - 36px));
}

.toast-message {
    border: 1px solid #b7e4cc;
    border-radius: 8px;
    background: #ecfdf3;
    color: #05603a;
    padding: 10px 12px;
    box-shadow: 0 12px 28px rgba(23, 32, 51, .14);
    font-size: 13px;
    font-weight: 800;
}

.toast-message.is-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.control-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.control-grid button:nth-child(5) {
    border-color: var(--danger);
    background: var(--danger);
}

.status-pre,
.log-entry pre {
    margin: 0;
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #101828;
    color: #e6edf6;
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
}

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

.log-entry {
    display: grid;
    gap: 8px;
}

.log-entry header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
}

.qa-checklist {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
}

@media (max-width: 980px) {
    .superadmin-sidebar {
        position: static;
        width: auto;
        max-height: none;
    }

    .superadmin-main {
        margin-left: 0;
        padding: 14px;
    }

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

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

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

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

@media (max-width: 620px) {
    .kpi-grid,
    .compact-form,
    .capacity-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        display: grid;
    }
}
