/* ==========================================================================
   1% Investment Club — Design System
   Premium fintech aesthetic: gold + black, Poppins/Inter/JetBrains Mono
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Palette */
    --gold-primary: #D4AF37;
    --gold-light: #F0E6C0;
    --gold-muted: #8B7D3C;
    --black-deep: #0D0D0D;
    --black-soft: #1A1A1A;
    --charcoal: #2C2C2C;
    --charcoal-light: #3A3A3A;
    --off-white: #F5F1EB;
    --white: #FFFFFF;
    --success: #1B5E20;
    --success-light: #4CAF50;
    --warning: #E65100;
    --danger: #B71C1C;
    --danger-light: #EF5350;
    --info: #1565C0;

    /* Typography */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 76px;
    --topbar-height: 72px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.35);
    --transition: 180ms ease;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--off-white);
    color: var(--black-deep);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    color: var(--black-deep);
}

h1 { font-size: 1.85rem; font-weight: 700; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

a {
    color: var(--gold-muted);
    text-decoration: none;
}

a:hover {
    color: var(--gold-primary);
}

ul { list-style: none; }

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

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

.mono, .currency, .number {
    font-family: var(--font-mono);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   3. App shell — sidebar / topbar / content
   -------------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--black-deep);
    color: var(--off-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: width var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--charcoal);
}

.sidebar-brand__logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--black-deep);
    font-family: var(--font-heading);
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-brand__name {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--gold-primary);
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.sidebar-nav__group-title {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-muted);
    padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-nav__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--off-white);
    border-left: 3px solid transparent;
    margin-bottom: 0.15rem;
    font-size: 0.92rem;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.sidebar-nav__link svg,
.sidebar-nav__link .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
}

.sidebar-nav__link:hover {
    background: rgba(212, 175, 55, 0.08);
    color: var(--gold-light);
}

.sidebar-nav__link.active {
    background: rgba(212, 175, 55, 0.12);
    border-left-color: var(--gold-primary);
    color: var(--gold-primary);
    font-weight: 500;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--charcoal);
    font-size: 0.75rem;
    color: var(--gold-muted);
}

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* Manual desktop/tablet collapse, toggled via the sidebar-toggle button and
   persisted in localStorage (see app.js). Independent of the responsive
   auto-collapse below, and of .sidebar.is-open (mobile slide-over) — scoped
   to min-width so a collapsed desktop preference never leaks into the
   mobile full-overlay layout. */
@media (min-width: 769px) {
    html.sidebar-collapsed .sidebar {
        width: var(--sidebar-width-collapsed);
    }

    html.sidebar-collapsed .sidebar-brand__name,
    html.sidebar-collapsed .sidebar-nav__group-title,
    html.sidebar-collapsed .sidebar-nav__link span,
    html.sidebar-collapsed .sidebar-footer {
        display: none;
    }

    html.sidebar-collapsed .sidebar-nav__link {
        justify-content: center;
    }

    html.sidebar-collapsed .main {
        margin-left: var(--sidebar-width-collapsed);
    }
}

.topbar {
    height: var(--topbar-height);
    background: var(--off-white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--gold-muted);
}

.breadcrumbs a { color: var(--charcoal); }
.breadcrumbs .current { color: var(--black-deep); font-weight: 500; }

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--black-deep);
    transition: background var(--transition);
}

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

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.topbar-user__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gold-light);
    color: var(--gold-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
}

.topbar-user__name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--black-deep);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: var(--gold-primary);
    color: var(--black-deep);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 500;
}

.content {
    flex: 1;
    padding: 1.75rem;
}

.footer {
    padding: 1.25rem 1.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--gold-muted);
}

/* --------------------------------------------------------------------------
   4. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}

.card-header h3 { margin: 0; }

.card-subtitle {
    color: var(--gold-muted);
    font-size: 0.85rem;
}

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

.kpi-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border-top: 3px solid var(--gold-primary);
    padding: 1.25rem 1.4rem;
}

.kpi-card__label {
    font-size: 0.8rem;
    color: var(--gold-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.kpi-card__value {
    font-family: var(--font-mono);
    font-size: 1.65rem;
    font-weight: 600;
    color: var(--black-deep);
}

.kpi-card__trend {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.kpi-card__trend.up { color: var(--success); }
.kpi-card__trend.down { color: var(--danger); }

.stat-card {
    background: var(--black-soft);
    color: var(--off-white);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
}

.stat-card__label {
    color: var(--gold-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card__value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

/* --------------------------------------------------------------------------
   5. Tables
   -------------------------------------------------------------------------- */
.table-wrapper {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.table-wrapper__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.data-table {
    width: 100%;
    font-size: 0.9rem;
}

.data-table thead th {
    background: var(--gold-primary);
    color: var(--black-deep);
    text-align: left;
    padding: 0.85rem 1.1rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table tbody tr {
    background: var(--white);
    border-bottom: 1px solid var(--off-white);
    transition: background var(--transition);
}

.data-table tbody tr:nth-child(even) {
    background: #FAF8F4;
}

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

.data-table td {
    padding: 0.85rem 1.1rem;
    color: var(--charcoal);
}

.data-table td.numeric {
    text-align: right;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--off-white);
    font-size: 0.85rem;
    color: var(--gold-muted);
}

.pagination {
    display: flex;
    gap: 0.35rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--charcoal);
}

.pagination a:hover {
    background: var(--gold-light);
}

.pagination .active {
    background: var(--gold-primary);
    color: var(--black-deep);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

.btn-primary {
    background: var(--gold-primary);
    color: var(--black-deep);
}

.btn-primary:hover {
    background: #c29f2e;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
}

.btn-secondary {
    background: var(--black-deep);
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

.btn-secondary:hover {
    background: var(--black-soft);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #941616;
}

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

.btn-ghost:hover {
    background: var(--off-white);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* --------------------------------------------------------------------------
   7. Forms
   -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 0.4rem;
}

.form-label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--charcoal-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
    background: var(--white);
    color: var(--black-deep);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control:disabled {
    background: var(--off-white);
    color: var(--gold-muted);
    cursor: not-allowed;
    opacity: 1;
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.form-hint {
    color: var(--gold-muted);
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.file-upload-zone {
    border: 2px dashed var(--charcoal-light);
    border-radius: var(--radius);
    padding: 1.75rem;
    text-align: center;
    color: var(--gold-muted);
    background: var(--off-white);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: var(--gold-primary);
    background: var(--gold-light);
}

.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   8. Badges / pills
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-success { background: #E8F5E9; color: var(--success); border-color: var(--success-light); }
.badge-warning { background: #FFF3E0; color: var(--warning); border-color: var(--warning); }
.badge-danger  { background: #FFEBEE; color: var(--danger); border-color: var(--danger-light); }
.badge-info    { background: #E3F2FD; color: var(--info); border-color: var(--info); }
.badge-grey    { background: #EEEEEE; color: var(--charcoal); border-color: var(--charcoal-light); }
.badge-gold    { background: var(--gold-light); color: var(--gold-muted); border-color: var(--gold-primary); }
.badge-late    { background: #4A0E0E; color: #FFFFFF; border-color: #2C0808; }

/* --------------------------------------------------------------------------
   9. Alerts
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
}

.alert-info {
    background: var(--gold-light);
    border-left-color: var(--gold-primary);
    color: var(--gold-muted);
}

.alert-success {
    background: #E8F5E9;
    border-left-color: var(--success);
    color: var(--success);
}

.alert-warning {
    background: #FFF3E0;
    border-left-color: var(--warning);
    color: var(--warning);
}

.alert-danger {
    background: #FFEBEE;
    border-left-color: var(--danger);
    color: var(--danger);
}

.alert-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.alert-dismiss:hover { opacity: 1; }

.flash-stack {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1000;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   10. Charts
   -------------------------------------------------------------------------- */
.chart-container {
    background: var(--black-soft);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
}

.chart-container.on-light {
    background: var(--white);
    box-shadow: var(--shadow-card);
}

.chart-container__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--off-white);
}

.chart-container.on-light .chart-container__header {
    color: var(--black-deep);
}

.chart-container__title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
}

.chart-canvas-wrap {
    position: relative;
    height: 280px;
}

/* --------------------------------------------------------------------------
   11. Modals
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 13, 13, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-backdrop.is-open { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--off-white);
}

.modal-header h3 { margin: 0; }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gold-muted);
}

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--off-white);
}

/* --------------------------------------------------------------------------
   12. Timeline / activity feed
   -------------------------------------------------------------------------- */
.timeline {
    position: relative;
    padding-left: 1.75rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--off-white);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gold-primary);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--gold-primary);
}

.timeline-item__meta {
    font-size: 0.78rem;
    color: var(--gold-muted);
    margin-bottom: 0.2rem;
}

.timeline-item__text {
    font-size: 0.9rem;
    color: var(--charcoal);
}

.timeline-item--rejected::before {
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--danger);
}

.timeline-item--current::before {
    background: var(--warning);
    box-shadow: 0 0 0 2px var(--warning);
}

.timeline-item--future {
    opacity: 0.4;
}

.timeline-item--future::before {
    background: var(--charcoal-light);
    box-shadow: 0 0 0 2px var(--charcoal-light);
}

/* --------------------------------------------------------------------------
   12b. Compact stepper (approval chain, inline in table rows)
   -------------------------------------------------------------------------- */
.stepper {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.stepper-step {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--charcoal-light);
    flex-shrink: 0;
}

.stepper-step.done {
    background: var(--gold-primary);
}

.stepper-step.current {
    background: var(--warning);
}

.stepper-step.rejected {
    background: var(--danger);
}

.stepper-connector {
    width: 14px;
    height: 2px;
    background: var(--charcoal-light);
    flex-shrink: 0;
}

.stepper-connector.done {
    background: var(--gold-primary);
}

.type-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 2px solid var(--charcoal-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.type-option input {
    accent-color: var(--gold-primary);
}

.type-option--inflow:has(input:checked) {
    border-color: var(--success-light);
    background: rgba(76, 175, 80, 0.1);
}

.type-option--outflow:has(input:checked) {
    border-color: var(--danger-light);
    background: rgba(239, 83, 80, 0.1);
}

/* --------------------------------------------------------------------------
   16b. Member dashboard: sparklines, quick actions, hero KPI extras
   -------------------------------------------------------------------------- */
.sparkline-wrap {
    height: 40px;
    margin-top: 0.5rem;
}

.kpi-card__meta {
    font-size: 0.78rem;
    color: var(--gold-muted);
    margin-top: 0.4rem;
}

.doughnut-wrap {
    position: relative;
    height: 220px;
    max-width: 220px;
    margin: 0 auto;
}

.gauge-wrap {
    position: relative;
    height: 160px;
    max-width: 160px;
    margin: 0 auto;
}

.metric-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.metric-tile {
    background: var(--off-white);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    border-left: 3px solid var(--gold-primary);
}

.metric-tile__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gold-muted);
}

.metric-tile__value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--black-deep);
}

.heatmap-wrapper {
    overflow-x: auto;
}

.heatmap {
    border-collapse: collapse;
    font-size: 0.78rem;
    min-width: 100%;
}

.heatmap th, .heatmap td {
    padding: 0.35rem 0.5rem;
    text-align: center;
    white-space: nowrap;
}

.heatmap th {
    color: var(--gold-muted);
    font-weight: 600;
}

.heatmap td.heatmap-name {
    text-align: left;
    font-weight: 500;
    color: var(--black-deep);
}

.heatmap-cell {
    width: 26px;
    height: 18px;
    border-radius: 4px;
    display: inline-block;
}

.heatmap-cell--on_time { background: var(--success-light); }
.heatmap-cell--late { background: var(--warning); }
.heatmap-cell--unpaid { background: var(--danger-light); }
.heatmap-cell--na { background: var(--charcoal-light); opacity: 0.4; }

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--off-white);
}

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

.leaderboard-score {
    font-family: var(--font-mono);
    font-weight: 700;
}

.obligations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.obligations-list li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--off-white);
}

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

.obligations-list .obligation-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--gold-muted);
    min-width: 90px;
}

.trend-arrow.up { color: var(--success); }
.trend-arrow.down { color: var(--danger); }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.5rem 1.25rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.quick-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.quick-action__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gold-light);
    color: var(--gold-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action__label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--black-deep);
}

/* --------------------------------------------------------------------------
   13. Progress bars
   -------------------------------------------------------------------------- */
.progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--off-white);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--gold-primary);
    transition: width 400ms ease;
}

.progress-bar.success { background: var(--success-light); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger-light); }

/* --------------------------------------------------------------------------
   14. Empty state
   -------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gold-muted);
}

.empty-state svg,
.empty-state .icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    stroke: var(--gold-muted);
}

.empty-state__title {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 0.3rem;
}

/* --------------------------------------------------------------------------
   14b. Member avatars, card grid, view toggle, tabs, collapsible sections
   -------------------------------------------------------------------------- */
.member-avatar {
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold-primary);
    background: var(--gold-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    flex-shrink: 0;
}

.member-avatar--sm { width: 56px; height: 56px; font-size: 1.1rem; }
.member-avatar--lg { width: 96px; height: 96px; font-size: 2rem; border-width: 4px; }

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--charcoal-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.view-toggle a {
    padding: 0.45rem 0.9rem;
    background: var(--white);
    font-size: 0.85rem;
    color: var(--charcoal);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.view-toggle a.active {
    background: var(--gold-primary);
    color: var(--black-deep);
    font-weight: 600;
}

.member-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.member-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    text-align: center;
    transition: transform var(--transition);
}

.member-card:hover {
    transform: translateY(-3px);
}

.member-card__avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.member-card__name {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.member-card__title {
    color: var(--gold-muted);
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
}

.member-card__meta {
    font-size: 0.82rem;
    color: var(--charcoal);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--off-white);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tab-link {
    padding: 0.7rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gold-muted);
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    cursor: pointer;
}

.tab-link:hover {
    color: var(--gold-primary);
}

.tab-link.active {
    color: var(--black-deep);
    border-bottom-color: var(--gold-primary);
    font-weight: 600;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.profile-header {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.profile-header__stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.profile-stat {
    text-align: center;
}

.profile-stat__value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
}

.profile-stat__label {
    font-size: 0.75rem;
    color: var(--gold-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

details.collapsible {
    border: 1px solid var(--charcoal-light);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}

details.collapsible summary {
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    font-weight: 500;
    list-style: none;
}

details.collapsible summary::-webkit-details-marker {
    display: none;
}

details.collapsible summary::before {
    content: '+';
    margin-right: 0.5rem;
    color: var(--gold-primary);
    font-weight: 700;
}

details.collapsible[open] summary::before {
    content: '\2212';
}

details.collapsible .collapsible-body {
    padding: 0 1.1rem 1.1rem;
}

/* --------------------------------------------------------------------------
   15. Utility classes
   -------------------------------------------------------------------------- */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.text-gold    { color: var(--gold-primary); }
.text-muted   { color: var(--gold-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }

.d-flex { display: flex; }
.d-grid { display: grid; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; } .p-2 { padding: 1rem; } .p-3 { padding: 1.5rem; }

.w-full { width: 100%; }

/* --------------------------------------------------------------------------
   16. Auth layout
   -------------------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--black-deep);
    background-image: radial-gradient(circle at top right, rgba(212, 175, 55, 0.12), transparent 60%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--black-soft);
    border: 1px solid var(--gold-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-modal);
    padding: 2.25rem 2rem;
}

.auth-card__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.auth-card__title {
    text-align: center;
    color: var(--gold-primary);
    margin-bottom: 0.35rem;
}

.auth-card__subtitle {
    text-align: center;
    color: var(--off-white);
    opacity: 0.6;
    font-size: 0.85rem;
    margin-bottom: 1.75rem;
}

.auth-card .form-label {
    color: var(--off-white);
}

.auth-card .form-control {
    background: var(--charcoal);
    border-color: var(--charcoal-light);
    color: var(--off-white);
}

.auth-card .form-control:focus {
    border-color: var(--gold-primary);
}

.auth-card .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   17. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-width-collapsed);
    }

    .sidebar-brand__name,
    .sidebar-nav__group-title,
    .sidebar-nav__link span,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav__link {
        justify-content: center;
    }

    .main {
        margin-left: var(--sidebar-width-collapsed);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

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

    .sidebar-brand__name,
    .sidebar-nav__group-title,
    .sidebar-nav__link span {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .topbar-user__name {
        display: none;
    }

    .content {
        padding: 1.1rem;
    }

    .flash-stack {
        width: calc(100% - 2.5rem);
    }
}

/* --------------------------------------------------------------------------
   18. Print
   -------------------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .footer, .sidebar-toggle, .btn, .pagination-bar {
        display: none !important;
    }

    .main {
        margin-left: 0;
    }

    body {
        background: var(--white);
    }

    .card, .table-wrapper {
        box-shadow: none;
        border: 1px solid var(--charcoal-light);
    }
}
