/* ChurchBase — Application UI */

/* ── Ask Ezra floating widget ─────────────────────────────────── */

/* FAB button */
.ezra-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 12px 14px;
    border-radius: 50px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(99,102,241,.45);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
}
.ezra-fab svg { width: 18px; height: 18px; flex-shrink: 0; }
.ezra-fab:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 28px rgba(99,102,241,.55); }
.ezra-fab:active { transform: translateY(0) scale(0.98); }

/* Topbar Ezra button */
.ezra-topbar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 6px;
    background: #fff; color: #475569; font-size: 0.78rem; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ezra-topbar-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ezra-topbar-btn:hover,
.ezra-topbar-btn-active { border-color: #6366f1; color: #6366f1; background: #ede9fe; }

/* Chat card */
.ezra-card {
    position: fixed;
    top: 54px;
    right: 16px;
    z-index: 1000;
    width: 360px;
    max-height: 520px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.16);
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}
.ezra-card.ezra-card-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Card header */
.ezra-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    flex-shrink: 0;
}
.ezra-card-title-row { display: flex; align-items: center; gap: 10px; }
.ezra-card-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.ezra-card-name { font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.ezra-card-sub  { font-size: 0.72rem; opacity: 0.82; }
.ezra-card-close {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.ezra-card-close svg { width: 14px; height: 14px; }
.ezra-card-close:hover { background: rgba(255,255,255,.28); }

/* Messages area */
.ezra-card-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
.ezra-card-welcome {
    text-align: center;
    padding: 12px 8px;
    font-size: 0.82rem;
    color: var(--text-muted, #6b7280);
}

/* Message rows */
.ezra-cm { display: flex; flex-direction: column; max-width: 88%; }
.ezra-cm-user { align-self: flex-end; align-items: flex-end; }
.ezra-cm-bot  { align-self: flex-start; align-items: flex-start; }
.ezra-cm-bubble {
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.ezra-cm-user .ezra-cm-bubble {
    background: #6366f1;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ezra-cm-bot .ezra-cm-bubble {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text, #111);
    border-bottom-left-radius: 4px;
}
.ezra-cm-typing .ezra-cm-bubble::after {
    content: '▋';
    animation: ezraBlink 0.8s step-start infinite;
}
@keyframes ezraBlink { 50% { opacity: 0; } }
.ezra-cm-status {
    font-size: 0.72rem;
    color: var(--text-muted, #6b7280);
    margin-top: 3px;
    padding-left: 2px;
}

/* Footer input */
.ezra-card-footer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
}
.ezra-card-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--input-bg, #fff);
    color: var(--text, #111);
    min-height: 36px;
    max-height: 100px;
    overflow-y: auto;
    outline: none;
    line-height: 1.4;
    transition: border-color 0.15s;
}
.ezra-card-input:focus { border-color: var(--primary); }
.ezra-card-send {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: #6366f1;
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.ezra-card-send:disabled { opacity: 0.35; cursor: default; }
.ezra-card-send svg { width: 15px; height: 15px; }

/* Ezra mode toggle — floating card */
.ezra-mode-toggle {
    display: flex;
    background: rgba(255,255,255,.15);
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}
.ezra-mode-btn {
    padding: 3px 10px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,.75);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.ezra-mode-btn.active {
    background: rgba(255,255,255,.9);
    color: #6366f1;
}
.ezra-mode-btn:not(.active):hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}

/* Ezra mode toggle — full page */
.ezra-page-mode-row {
    display: inline-flex;
    background: var(--border, #e5e7eb);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    margin-top: 10px;
}
.ezra-page-mode-btn {
    padding: 5px 16px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: var(--text-muted, #6b7280);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.ezra-page-mode-btn.active {
    background: var(--primary, #6366f1);
    color: #fff;
}
.ezra-page-mode-btn:not(.active):hover {
    color: var(--text, #111);
}

/* Ezra dark-mode overrides */
[data-theme="dark"] .ezra-card {
    box-shadow: 0 16px 48px rgba(0,0,0,.45);
}
[data-theme="dark"] .ezra-card-input::placeholder {
    color: #475569;
}
[data-theme="dark"] .ezra-card-input:focus {
    border-color: var(--primary);
}

/* Mobile */
@media (max-width: 480px) {
    .ezra-fab-label { display: none; }
    .ezra-fab { padding: 14px; border-radius: 50%; }
    .ezra-card { width: calc(100vw - 32px); right: 16px; bottom: 82px; }
}

/* ── AIR DATEPICKER 3 — calendar widget overrides ─────────────── */

/* Visible display input that shows the friendly formatted date.
   Uses input[type="text"].date-display-input (specificity 0-2-1) to beat the
   general input[type="text"] rule (0-1-1) that resets background via shorthand. */
input[type="text"].date-display-input {
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
    padding-right: 30px;
    cursor: pointer !important;
}
input[type="text"].date-display-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    outline: none;
}
[data-theme="dark"] input[type="text"].date-display-input {
    background: #162032 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
}

/* Calendar container */
.air-datepicker {
    --adp-accent-color: #6366f1;
    --adp-background-color-hover: #eef2ff;
    --adp-background-color-active: #e0e7ff;
    --adp-color-current-date: #6366f1;
    --adp-day-name-color: #64748b;
    --adp-border-radius: 8px;
    --adp-border-radius-inner: 6px;
    --adp-border-color: #e2e8f0;
    --adp-border-color-inner: #f1f5f9;
    --adp-color: #334155;
    --adp-color-secondary: #64748b;
    --adp-color-other-month: #94a3b8;
    font-family: inherit;
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Purple navigation header — pulled flush to container edges */
.air-datepicker--navigation {
    background: #6366f1;
    margin: calc(-1 * var(--adp-padding, 4px));
    margin-bottom: 0;
    padding: var(--adp-padding, 4px);
    border-radius: calc(var(--adp-border-radius, 8px) - 1px) calc(var(--adp-border-radius, 8px) - 1px) 0 0;
}
.air-datepicker-nav--title,
.air-datepicker-nav--title i { color: white; font-style: normal; }
.air-datepicker-nav--title:hover { background: rgba(255,255,255,0.15); color: white; }
.air-datepicker-nav--action path { stroke: white; }
.air-datepicker-nav--action:hover { background: rgba(255,255,255,0.15); }

/* Today highlight */
.air-datepicker-cell.-day-.-current- { color: #6366f1; font-weight: 700; }
.air-datepicker-cell.-day-.-current-.-selected- { color: white; }

/* Dark mode */
[data-theme="dark"] .air-datepicker {
    --adp-background-color: #1e293b;
    --adp-background-color-hover: #263548;
    --adp-background-color-active: #2d3f55;
    --adp-border-color: #334155;
    --adp-border-color-inner: #2a3a4f;
    --adp-color: #e2e8f0;
    --adp-color-secondary: #64748b;
    --adp-color-other-month: #475569;
    --adp-day-name-color: #475569;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
[data-theme="dark"] .air-datepicker--navigation { background: #312e81; }
[data-theme="dark"] .air-datepicker-cell.-day-.-current- { color: #a5b4fc; }
[data-theme="dark"] .air-datepicker-cell.-day-.-current-.-selected- { color: white; }
[data-theme="dark"] .air-datepicker-cell.-selected- { background: #6366f1; color: white; }

/* ── DESIGN TOKENS (CSS custom properties) ────────────────── */
:root {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --hover: #eff2f7;
    --hover-bg: #eff2f7;
    --surface-alt: #f1f5f9;
    --input-bg: #ffffff;
    --primary: #6366f1;
    --primary-light: #e0e7ff;
}
[data-theme="dark"] {
    --bg: #111827;
    --card-bg: #1e293b;
    --border: #2d3f56;
    --text: #f1f5f9;
    --text-muted: #a0b4c8;
    --hover: #1e3050;
    --hover-bg: #1e3050;
    --surface-alt: #1a2740;
    --input-bg: #0d1526;
    --primary: #818cf8;
    --primary-light: #312e81;
}

/* minimal browser reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
h1,h2,h3,h4,h5,h6,p,ul,ol,li,figure,figcaption,blockquote,dl,dd { margin: 0; padding: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
table { border-collapse: collapse; }
input, button, textarea, select { font: inherit; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── APP SHELL ─────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────  */
.sidebar {
    width: 220px;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    transition: width 0.22s ease;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 16px 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sidebar-brand-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 10px 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #cbd5e1; }
.nav-item.active { background: #1e293b; color: #f1f5f9; }
.nav-item.active .nav-icon { color: #818cf8; }

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-icon-sprite { display: none; }

.nav-divider { height: 1px; background: rgba(255,255,255,0.05); margin: 8px 0; }

.nav-group-label {
    font-size: 0.58rem; font-weight: 700; color: #334155;
    text-transform: uppercase; letter-spacing: 0.1em;
    padding: 10px 12px 4px;
}

.nav-sub-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px 6px 18px;
    border-radius: 5px; color: #475569;
    font-size: 0.78rem; font-weight: 500;
    text-decoration: none; transition: background 0.1s, color 0.1s;
}
.nav-sub-item:hover { background: rgba(255,255,255,0.05); color: #94a3b8; }
.nav-sub-item.active { color: #e2e8f0; }

.nav-sub-icon {
    width: 13px; height: 13px;
    color: #334155;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transition: color 0.1s, transform 0.1s;
}
.nav-sub-item:hover .nav-sub-icon { color: #64748b; transform: translateX(1px); }
.nav-sub-item.active .nav-sub-icon {
    color: #818cf8;
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px; }
.user-avatar {
    width: 30px; height: 30px;
    border-radius: 6px;
    background: #6366f1;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: white;
    flex-shrink: 0;
}
.user-name { font-size: 0.78rem; font-weight: 600; color: #e2e8f0; line-height: 1.2; }
.user-role { font-size: 0.65rem; color: #475569; }
.logout-btn {
    display: block; margin-top: 6px; padding: 6px 10px;
    border-radius: 5px; color: #475569; font-size: 0.75rem;
    text-decoration: none; text-align: center;
    transition: background 0.1s, color 0.1s;
}
.logout-btn:hover { background: rgba(239,68,68,0.12); color: #f87171; }

/* ── MAIN AREA ────────────────────────────────────── */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ── TOPBAR ──────────────────────────────────────── */
.topbar {
    height: 50px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center;
    padding: 0 22px;
    flex-shrink: 0;
}
.topbar-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    flex: 1;
}

/* ── CONTENT ─────────────────────────────────────── */
.content-area { flex: 1; overflow-y: auto; padding: 18px 22px; }

/* ── TOAST ───────────────────────────────────────── */
.toast-stack { position: fixed; top: 58px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 10px 14px; border-radius: 6px;
    font-size: 0.8rem; font-weight: 500;
    background: white; border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    display: flex; align-items: center; gap: 8px;
    min-width: 260px;
}
.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid #f87171; }
.toast-warning { border-left: 3px solid #f59e0b; background: #fffbeb; color: #78350f; }
.toast-info    { border-left: 3px solid #6366f1; }

/* ── TOOLBAR (page-level) ────────────────────────── */
.toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar-title { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.toolbar-spacer { flex: 1; }

.export-dropdown {
    position: relative;
    flex-shrink: 0;
}
.export-dropdown summary { list-style: none; }
.export-dropdown summary::-webkit-details-marker { display: none; }
.export-dropdown-btn {
    user-select: none;
}
.export-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
}
.export-dropdown[open] .export-chevron { transform: rotate(180deg); }
.export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    min-width: 150px;
    padding: 5px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}
.export-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}
.export-menu-item:hover {
    background: #eef2ff;
    color: #4f46e5;
}
.export-menu-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── STAT CARDS ──────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.stat-card {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 16px 18px;
}
.stat-label {
    font-size: 0.68rem; font-weight: 700;
    color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: #0f172a; line-height: 1.1; }
.stat-meta { font-size: 0.7rem; color: #94a3b8; margin-top: 4px; }
.stat-sub { font-size: 0.7rem; color: #94a3b8; margin-top: 4px; }

/* ── CARD ────────────────────────────────────────── */
.card {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
}
.card-title {
    font-size: 0.82rem; font-weight: 700; color: #0f172a;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}
.card-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #f8fafc;
    font-size: 0.8rem;
}
.card-row:last-child { border-bottom: none; }
a.card-row:hover { background: var(--hover-bg); border-radius: 6px; }
.card-row-label { color: #64748b; }
.card-row-value { font-weight: 600; color: #1e293b; }

/* ── FILTER BAR ──────────────────────────────────── */
.filter-bar {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 10px 14px; background: white;
    border: 1px solid #e2e8f0; border-radius: 8px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.filter-bar > form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-input {
    flex: 1; min-width: 180px; padding: 5px 10px;
    border: 1px solid #e2e8f0; border-radius: 5px;
    font-size: 0.8rem; color: #0f172a; background: #f8fafc;
    outline: none; transition: border-color 0.15s;
}
.filter-input:focus { border-color: #6366f1; background: white; }
.filter-select {
    padding: 5px 10px; border: 1px solid #e2e8f0;
    border-radius: 5px; font-size: 0.8rem; color: #475569;
    background: #f8fafc; outline: none; cursor: pointer;
}
.filter-select:focus { border-color: #6366f1; }

/* ── LAYOUT HELPERS ──────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }

/* ── DATA TABLE ──────────────────────────────────── */
.data-table-wrap {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table thead tr { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.data-table th {
    padding: 8px 12px; text-align: left;
    font-size: 0.67rem; font-weight: 700;
    color: #64748b; text-transform: uppercase;
    letter-spacing: 0.06em; white-space: nowrap;
}
.data-table td {
    padding: 8px 12px; font-size: 0.8rem;
    color: #334155; border-bottom: 1px solid #f1f5f9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table th.chk-col, .data-table td.chk-col {
    width: 12px; padding: 10px 7px; text-align: center;
    overflow: visible; text-overflow: clip;
}
.data-table .chk-col input[type="checkbox"] { margin: 0; vertical-align: middle; }
.data-table tbody tr:hover td { background: #fafbff; }
.day-book-day-hdr td { background: var(--surface-alt) !important; border-bottom: 1px solid var(--border) !important; }
.td-primary { font-weight: 600; color: #0f172a; }
.td-muted { color: #94a3b8; }
.td-wrap { white-space: normal !important; text-overflow: clip !important; }
.table-empty { text-align: center; padding: 40px; color: #94a3b8; font-size: 0.8rem; }
.table-header-bar {
    padding: 12px 16px; border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
}
.table-header-title { font-size: 0.82rem; font-weight: 700; color: #0f172a; display:inline-flex; align-items:center; white-space:nowrap; }
.td-amount { font-weight: 700; color: #16a34a; font-size: 0.82rem; }
.table-section-header {
    padding: 10px 14px; border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.78rem; font-weight: 700; color: #0f172a;
}
.action-link {
    font-size: 0.75rem; font-weight: 600; color: #6366f1;
    text-decoration: none; padding: 2px 6px; border-radius: 4px;
    transition: background 0.1s;
}
.action-link:hover { background: #eef2ff; }
.action-link-danger { color: #f87171 !important; }
.action-link-danger:hover { background: #fef2f2 !important; }

/* Button-style table actions */
.tbl-btn {
    display: inline-block; font-size: 0.72rem; font-weight: 600;
    padding: 3px 10px; border-radius: 5px; text-decoration: none;
    border: 1px solid #e2e8f0; color: #475569; background: var(--surface,#fff);
    cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
    margin-right: 4px;
}
.tbl-btn:hover { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }
.tbl-btn-green { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.tbl-btn-green:hover { background: #dcfce7; border-color: #86efac; }
.tbl-btn-danger { color: #f87171; border-color: #fecaca; background: #fff5f5; }
.tbl-btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }

/* ── STATUS BADGES ───────────────────────────────── */
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; }
.status-active   { background: #dcfce7; color: #15803d; }
.status-inactive { background: #f1f5f9; color: #64748b; }
.status-warning  { background: #fef9c3; color: #a16207; }
.status-info     { background: #dbeafe; color: #2563eb; }

/* ── FORM HINTS ──────────────────────────────────── */
.form-hint { font-size: 0.78rem; color: #94a3b8; margin-top: 4px; }

/* ── PAGINATION ──────────────────────────────────── */
.pagination {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px; background: #f8fafc; border-top: 1px solid #e2e8f0;
    font-size: 0.75rem;
}
.page-info { color: #64748b; flex: 1; text-align: center; }
.pager {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #f8fafc; border-top: 1px solid #e2e8f0;
    font-size: 0.75rem; color: #64748b;
}
.pager-pages { display: flex; align-items: center; gap: 4px; }
.page-btn {
    padding: 3px 9px; border: 1px solid #e2e8f0; border-radius: 4px;
    background: white; color: #475569; font-size: 0.75rem; text-decoration: none;
    transition: all 0.1s;
}
.page-btn:hover { background: #6366f1; color: white; border-color: #6366f1; }
.page-current { padding: 3px 9px; font-weight: 600; color: #0f172a; }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 6px;
    font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: all 0.12s;
    border: 1px solid transparent; text-decoration: none;
    white-space: nowrap; line-height: 1.4;
}
.btn-primary { background: #6366f1; color: white; border-color: #6366f1; }
.btn-primary:hover { background: #4f46e5; border-color: #4f46e5; color: white; }
.btn-secondary { background: white; color: #475569; border-color: #d1d5db; }
.btn-secondary:hover { background: #f8fafc; border-color: #94a3b8; color: #1e293b; }
.btn-danger { background: #f87171; color: white; border-color: #f87171; }
.btn-danger:hover { background: #f87171; color: white; }
.btn-sm { padding: 4px 10px; font-size: 0.73rem; }
.btn-ghost { background: transparent; color: #6366f1; border-color: transparent; padding: 4px 8px; }
.btn-ghost:hover { background: #eef2ff; }
.btn[disabled], button[disabled].btn { cursor: not-allowed; opacity: 0.7; pointer-events: none; }
.btn-spinner {
    display: inline-block; width: 12px; height: 12px; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
    border-radius: 50%; animation: cb-btn-spin 0.6s linear infinite;
}
.btn-secondary .btn-spinner, .btn-outline .btn-spinner, .btn-ghost .btn-spinner {
    border-color: rgba(0,0,0,0.15); border-top-color: currentColor;
}
@keyframes cb-btn-spin { to { transform: rotate(360deg); } }

/* ── BADGES ──────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 7px; border-radius: 4px;
    font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.02em; white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #f87171; }
.badge-warning { background: #fef9c3; color: #92400e; }
.badge-info    { background: #e0e7ff; color: #4338ca; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ── FORMS ───────────────────────────────────────── */
.form-wrap { /* no max-width — uses full content area */ }

/* Two-panel form layout: main form + sidebar */
.form-page-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 18px;
    align-items: start;
}
.form-info-card {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 10px; overflow: hidden;
}
.form-info-sidebar {
    position: sticky; top: 8px; align-self: flex-start;
}
.form-info-header {
    padding: 12px 18px; border-bottom: 1px solid #f1f5f9;
    font-size: 0.75rem; font-weight: 700; color: #0f172a;
    background: #f8fafc; text-transform: uppercase; letter-spacing: 0.06em;
}
.form-info-body { padding: 10px 18px; }

/* Scrollable column list inside the Required Columns card */
.import-col-list {
    max-height: 232px;   /* ~8 rows at ~29px each */
    overflow-y: auto;
    padding: 0 18px;
}
.import-col-list .import-col-row:last-child { border-bottom: none; }
.form-info-tip {
    padding: 8px 0; border-bottom: 1px solid #f8fafc;
    font-size: 0.78rem; color: #475569; line-height: 1.5;
    display: flex; gap: 8px; align-items: flex-start;
}
.form-info-tip:last-child { border-bottom: none; }
.form-info-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #6366f1; flex-shrink: 0; margin-top: 6px;
}
.form-section { margin-bottom: 24px; }
.form-section-title {
    font-size: 0.7rem; font-weight: 700;
    color: #94a3b8; text-transform: uppercase;
    letter-spacing: 0.08em; margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
}
.form-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.form-group { margin-bottom: 12px; }
.form-label {
    display: block; font-size: 0.75rem; font-weight: 600;
    color: #374151; margin-bottom: 4px;
}
.form-label-muted { font-weight: 400; color: #94a3b8; }
.form-input, input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="tel"], input[type="number"], select, textarea {
    display: block; width: 100%; padding: 6px 10px;
    border: 1px solid #d1d5db; border-radius: 5px;
    font-size: 0.8rem; color: #0f172a; background: white;
    outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="date"]:focus, input[type="tel"]:focus, input[type="number"]:focus,
select:focus, textarea:focus, .form-input:focus {
    border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-error { font-size: 0.72rem; color: #f87171; margin-top: 3px; }
.form-error-box {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 6px; padding: 10px 12px;
    font-size: 0.78rem; color: #f87171; margin-bottom: 14px;
}
.form-actions { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid #f1f5f9; }

/* checkbox fix */
input[type="checkbox"] { width: auto; display: inline; }

/* ── DETAIL VIEW ─────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 1fr 260px; gap: 14px; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.detail-field {
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.detail-field:nth-last-child(-n+2) { border-bottom: none; }
.detail-label {
    font-size: 0.67rem; font-weight: 700;
    color: #94a3b8; text-transform: uppercase;
    letter-spacing: 0.06em; margin-bottom: 3px;
}
.detail-value { font-size: 0.82rem; color: #1e293b; font-weight: 500; }

/* ── TABS ────────────────────────────────────────── */
.tab-bar {
    display: flex; gap: 2px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 14px;
}
.tab-btn {
    padding: 7px 14px; font-size: 0.78rem; font-weight: 600;
    color: #64748b; border: none; background: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color 0.1s; text-decoration: none;
}
.tab-btn:hover { color: #6366f1; }
.tab-btn.active { color: #6366f1; border-bottom-color: #6366f1; }

/* ── WARN BOX ────────────────────────────────────── */
.warn-box {
    background: #fffbeb; border-left: 3px solid #f59e0b;
    border-radius: 6px; padding: 14px 16px;
}
.warn-box-title { font-size: 0.78rem; font-weight: 700; color: #92400e; margin-bottom: 8px; }

/* ── ACCOUNT CARD ────────────────────────────────── */
.account-card {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 16px 18px;
}
.account-card-name { font-size: 0.85rem; font-weight: 700; color: #0f172a; }
.account-card-type { font-size: 0.7rem; color: #94a3b8; margin-top: 1px; }
.account-card-balance { font-size: 1.35rem; font-weight: 700; color: #16a34a; margin-top: 10px; }

/* ── TOOLBAR SEARCH ──────────────────────────────── */
.toolbar-search-form { display: flex; align-items: center; }
.toolbar-search {
    display: flex; align-items: center; gap: 6px;
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 7px;
    padding: 0 10px; transition: border-color 0.15s, background 0.15s;
    width: 220px;
}
.toolbar-search:focus-within {
    background: white; border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.search-icon { width: 14px; height: 14px; color: #94a3b8; flex-shrink: 0; }
.search-input {
    flex: 1; border: none; background: transparent;
    padding: 6px 0; font-size: 0.8rem; color: #0f172a;
    outline: none; width: 100%;
}
.search-input::placeholder { color: #94a3b8; }
.search-clear {
    color: #94a3b8; font-size: 0.75rem; text-decoration: none;
    padding: 2px 0; transition: color 0.1s; line-height: 1;
}
.search-clear:hover { color: #475569; }

/* ── STATUS PILLS ────────────────────────────────── */
.status-pills {
    display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}
.status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; text-decoration: none;
    background: white; border: 1px solid #e2e8f0; color: #64748b;
    transition: all 0.12s; white-space: nowrap;
}
.status-pill:hover { border-color: #94a3b8; color: #334155; }
.status-pill.active { background: #1e293b; border-color: #1e293b; color: white; }
.status-pill.active-green { background: #16a34a; border-color: #16a34a; color: white; }
.status-pill.active-yellow { background: #ca8a04; border-color: #ca8a04; color: white; }
.status-pill.active-red { background: #f87171; border-color: #f87171; color: white; }
.status-pill.active-gray { background: #475569; border-color: #475569; color: white; }
.pill-count {
    background: rgba(255,255,255,0.2); border-radius: 8px;
    padding: 0 5px; font-size: 0.65rem; font-weight: 700; min-width: 16px;
    text-align: center; line-height: 1.6;
}
.status-pill:not(.active) .pill-count {
    background: #f1f5f9; color: #64748b;
}

/* ── MEMBER LIST ─────────────────────────────────── */
.members-table tbody tr.member-row { cursor: pointer; }
.members-table tbody tr.member-row:hover td { background: #f5f7ff; }
.member-cell { display: flex; align-items: center; gap: 10px; }
.member-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white; font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-avatar-sm { width: 28px; height: 28px; font-size: 0.68rem; }
.member-avatar-lg {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white; font-size: 1.5rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.member-name { font-size: 0.82rem; font-weight: 600; color: #0f172a; }
.member-meta { font-size: 0.72rem; color: #94a3b8; margin-top: 1px; }
.contact-cell { display: flex; flex-direction: column; gap: 2px; }
.contact-line { font-size: 0.78rem; color: #475569; }
.contact-email { color: #94a3b8; font-size: 0.72rem; }
.row-actions { white-space: nowrap; text-align: right; }
.record-count {
    display: inline-flex; align-items: center; justify-content: center;
    background: #e0e7ff; color: #4338ca;
    font-size: 0.68rem; font-weight: 700; border-radius: 10px;
    padding: 1px 7px; margin-left: 7px; letter-spacing: 0.02em;
}

/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state { padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon { font-size: 2rem; margin-bottom: 6px; }
.empty-title { font-size: 0.88rem; font-weight: 600; color: #475569; }
.empty-sub { font-size: 0.78rem; color: #94a3b8; }

/* ── PROFILE HEADER ───────────────────────────────── */
.profile-header {
    background: white; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 22px 24px; display: flex; align-items: flex-start;
    gap: 20px; margin-bottom: 16px; flex-wrap: wrap;
}
.profile-avatar-wrap { flex-shrink: 0; }
.profile-avatar-img {
    width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
    border: 2px solid #e2e8f0;
}
.profile-header-info { flex: 1; min-width: 200px; }
.profile-name { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin-bottom: 3px; }
.profile-meta { font-size: 0.78rem; color: #64748b; margin-bottom: 8px; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.profile-contact-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.contact-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px;
    background: #f1f5f9; color: #475569;
    font-size: 0.75rem; font-weight: 500; text-decoration: none;
    border: 1px solid #e2e8f0; transition: all 0.12s;
}
.contact-chip:hover { background: #eef2ff; border-color: #c7d2fe; color: #6366f1; }
.contact-chip svg { flex-shrink: 0; }
.profile-header-stat {
    display: flex; flex-direction: column; gap: 10px;
    border-left: 1px solid #f1f5f9; padding-left: 20px; flex-shrink: 0;
}
.profile-stat-item { text-align: right; }
.profile-stat-label { font-size: 0.65rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; }
.profile-stat-value { font-size: 0.95rem; font-weight: 700; color: #0f172a; }

/* ── FINANCE ─────────────────────────────────────── */
.fin-income  { color: #16a34a !important; }
.fin-expense { color: #f87171 !important; }
.td-net-pos  { color: #16a34a; }
.td-net-neg  { color: #f87171; }

.fin-summary-bar {
    display: flex; align-items: stretch; gap: 0;
    background: white; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 0; margin-bottom: 18px; overflow: hidden;
}
.fin-summary-item {
    flex: 1; padding: 16px 20px;
}
.fin-summary-divider { width: 1px; background: #f1f5f9; flex-shrink: 0; }
.fin-summary-label { font-size: 0.65rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.fin-summary-value { font-size: 1.1rem; font-weight: 700; color: #0f172a; }

.account-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.account-card-link { text-decoration: none; color: inherit; cursor: pointer; display: block; }
.account-card-v2 {
    background: white; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 18px 20px; transition: box-shadow 0.15s, border-color 0.15s;
    height: 100%;
}
.account-card-v2:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: #c7d2fe; }
.account-card-inactive { opacity: 0.6; }
.account-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.account-card-name { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.account-card-type-tag { font-size: 0.68rem; color: #94a3b8; margin-top: 2px; }
.account-balance-label { font-size: 0.65rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; }
.account-balance-amount { font-size: 1.4rem; font-weight: 700; color: #0f172a; margin-top: 3px; }
.account-balance-row { margin-bottom: 14px; }
.account-card-footer { border-top: 1px solid #f1f5f9; padding-top: 10px; }
.account-card-footer-link { font-size: 0.73rem; font-weight: 600; color: #6366f1; }

.fin-list-header {
    display: flex; align-items: center; justify-content: space-between;
    background: white; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 10px 16px; margin-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.fin-list-total { display: flex; align-items: baseline; gap: 8px; }
.fin-list-total-label { font-size: 0.72rem; font-weight: 600; color: #94a3b8; }
.fin-list-total-value { font-size: 1.1rem; font-weight: 700; }

.ledger-type-tag {
    display: inline-flex; padding: 2px 8px; border-radius: 4px;
    font-size: 0.68rem; font-weight: 700; white-space: nowrap;
}
.ledger-type-receipt { background: #dcfce7; color: #15803d; }
.ledger-type-payment { background: #fee2e2; color: #f87171; }
.ledger-table td { vertical-align: middle; }

.receipt-form-card, .payment-form-card {
    background: white; border: 1px solid #e2e8f0; border-radius: 10px;
    overflow: hidden;
}
.receipt-form-header {
    background: linear-gradient(135deg, #eef2ff, #f0fdf4);
    border-bottom: 1px solid #e2e8f0; padding: 18px 24px;
}
.payment-form-header {
    background: linear-gradient(135deg, #fff1f2, #fff7ed);
    border-bottom: 1px solid #e2e8f0; padding: 18px 24px;
}
.receipt-form-header-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.receipt-form-header-sub { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.receipt-form-body { padding: 20px 24px; }

.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) {
    .two-col-grid { grid-template-columns: 1fr; }
    .tb-summary-row { grid-template-columns: 1fr; }
    .ie-summary-row { grid-template-columns: 1fr; }
    .ie-tables-grid { grid-template-columns: 1fr; }
}

.table-section-header {
    padding: 10px 14px; font-size: 0.72rem; font-weight: 700;
    color: #64748b; text-transform: uppercase; letter-spacing: 0.07em;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}

/* ── REPORTS PAGE ─────────────────────────────────── */
.rpt-topbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 6px;
}
.rpt-custom-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rpt-period-label { font-size: 0.75rem; color: #64748b; margin-bottom: 12px; }

.rpt-tabs {
    display: flex; gap: 0; border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px; flex-wrap: wrap;
}
.rpt-tab {
    padding: 9px 16px; font-size: 0.8rem; font-weight: 600; color: #64748b;
    text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.rpt-tab:hover { color: #6366f1; }
.rpt-tab-active { color: #6366f1; border-bottom-color: #6366f1; }

.rpt-bar {
    height: 8px; border-radius: 4px; min-width: 2px;
    transition: width 0.3s ease;
}
.rpt-bar-income  { background: #bbf7d0; }
.rpt-bar-expense { background: #fecaca; }

.rpt-highlight-row { display: flex; gap: 12px; flex-wrap: wrap; }
.rpt-highlight-row .rpt-highlight-card { flex: 1; min-width: 160px; }
.rpt-page-title {
    font-size: 1.05rem; font-weight: 800; color: #0f172a;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.rpt-highlight-card {
    border-radius: 8px; padding: 16px 20px; border: 1px solid;
}
.rpt-card-green { border-color: #bbf7d0; }
.rpt-card-green .rpt-hl-label { color: #16a34a; }
.rpt-card-green .rpt-hl-value { color: #15803d; }
.rpt-card-blue  { border-color: #bfdbfe; }
.rpt-card-blue .rpt-hl-label  { color: #3b82f6; }
.rpt-card-blue .rpt-hl-value  { color: #3b82f6; }
.rpt-hl-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.rpt-hl-value { font-size: 1.5rem; font-weight: 800; }

.rpt-year-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.rpt-year-label { font-size: 0.75rem; font-weight: 700; color: #64748b; }

/* ── REPORT CONTROL BAR ───────────────────────────── */
.rpt-control-bar {
    background: var(--surface-alt, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 6px 16px rgba(15, 23, 42, 0.05);
}
.rpt-control-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.rpt-control-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
}
.rpt-control-period {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    margin-top: 3px;
}
.rpt-control-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border, #e2e8f0);
    padding-top: 10px;
}
.rpt-date-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.rpt-date-input {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
    color: var(--text-primary, #0f172a);
    font-size: 0.75rem;
    font-family: inherit;
    outline: none;
    width: 130px;
    transition: border-color 0.13s;
}
/* Beat the global `input[type="text"] { width:100% }` reset (0-1-1) which
   otherwise makes AirDatepicker's enhanced display input flex-grow and
   push later controls in the same row onto a second line. */
input[type="text"].rpt-date-input,
input[type="date"].rpt-date-input {
    display: inline-block;
    width: 130px !important;
    flex: none;
}
.rpt-date-input:focus { border-color: #6366f1; }
.rpt-date-sep {
    font-size: 0.82rem;
    color: var(--text-muted, #94a3b8);
    flex-shrink: 0;
}
.rpt-sep {
    color: var(--border, #e2e8f0);
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* ── FINANCIAL STATEMENT DOCUMENT ────────────────── */
.stmt-doc { background:#fff; border:1px solid #e2e8f0; border-radius:14px; overflow:hidden; box-shadow:0 1px 2px rgba(15,23,42,.04), 0 12px 28px rgba(15,23,42,.07); }
.stmt-doc.fmt-standard { position:relative; }
.stmt-doc.fmt-standard::before { content:''; position:absolute; top:0; left:0; right:0; height:4px; background:linear-gradient(90deg,#6366f1,#8b5cf6,#22c55e); }

.stmt-two-col { display:grid; grid-template-columns:1fr 1fr; }
.stmt-col { padding:22px 28px; transition:background .15s; }
.stmt-col+.stmt-col { border-left:1px solid #e2e8f0; }
.stmt-doc.fmt-standard .stmt-col-income  { background:linear-gradient(180deg, rgba(34,197,94,.045), transparent 140px); }
.stmt-doc.fmt-standard .stmt-col-expense { background:linear-gradient(180deg, rgba(248,113,113,.05), transparent 140px); }
.stmt-col-title { font-size:0.68rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; margin-bottom:14px; padding-bottom:8px; border-bottom:2px solid; display:flex; align-items:center; gap:7px; }
.stmt-col-income .stmt-col-title  { color:#16a34a; border-color:#86efac; }
.stmt-col-expense .stmt-col-title { color:#f87171; border-color:#fca5a5; }

.stmt-line { display:flex; justify-content:space-between; align-items:baseline; padding:6px 4px; border-radius:6px; border-bottom:1px dotted #f1f5f9; gap:16px; transition:background .1s; }
.stmt-line:hover { background:rgba(100,116,139,.05); }
.stmt-line:last-of-type { border-bottom:none; }
.stmt-line-name { font-size:0.83rem; color:#374151; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stmt-line-amt  { font-size:0.83rem; font-variant-numeric:tabular-nums; font-weight:500; white-space:nowrap; flex-shrink:0; }
.stmt-col-income  .stmt-line-amt { color:#15803d; }
.stmt-col-expense .stmt-line-amt { color:#f87171; }
.stmt-subtotal { display:flex; justify-content:space-between; padding:11px 12px; margin-top:12px; border-top:2px solid; border-radius:9px; font-weight:800; font-size:0.88rem; gap:16px; }
.stmt-col-income  .stmt-subtotal { border-color:#86efac; color:#15803d; }
.stmt-col-expense .stmt-subtotal { border-color:#fca5a5; color:#f87171; }
.stmt-doc.fmt-standard .stmt-col-income  .stmt-subtotal { background:rgba(34,197,94,.09); border-top-color:transparent; }
.stmt-doc.fmt-standard .stmt-col-expense .stmt-subtotal { background:rgba(248,113,113,.09); border-top-color:transparent; }
.stmt-group-hdr { font-size:0.67rem; font-weight:800; text-transform:uppercase; letter-spacing:.09em; color:#64748b; padding:10px 0 3px; border-bottom:1px solid #e2e8f0; margin-bottom:1px; }
.stmt-line-sub .stmt-line-name { padding-left:10px; }
.stmt-group-sub { display:flex; justify-content:space-between; font-size:0.79rem; font-weight:700; color:#64748b; padding:3px 0 8px; border-top:1px dotted #cbd5e1; margin-top:1px; gap:16px; }

.stmt-recon { padding:22px 28px; background:#f8fafc; border-top:1px solid #e2e8f0; }
.stmt-recon-title { font-size:0.68rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:#64748b; margin-bottom:14px; display:flex; align-items:center; gap:6px; }
.stmt-recon-title::before { content:''; width:6px; height:6px; border-radius:50%; background:#6366f1; flex-shrink:0; }
.stmt-recon-body { max-width:560px; }
.stmt-recon-row { display:flex; justify-content:space-between; align-items:baseline; padding:6px 4px; border-radius:6px; font-size:0.86rem; color:#374151; border-bottom:1px dotted #e2e8f0; gap:24px; transition:background .1s; }
.stmt-recon-row:hover { background:rgba(100,116,139,.05); }
.stmt-recon-row.indent { padding-left:22px; }
.stmt-recon-row.subtotal { border-bottom:1px solid #94a3b8; font-weight:600; padding-top:10px; }
.stmt-recon-row.closing {
    border:none; padding:14px 18px; margin-top:10px; border-radius:10px;
    font-weight:800; font-size:1rem; color:#0f172a;
    background:linear-gradient(135deg, rgba(99,102,241,.10), rgba(34,197,94,.10));
    box-shadow:inset 0 0 0 1px rgba(15,23,42,.06);
}
.stmt-recon-row.closing .stmt-amt { font-size:1.15rem; }
.stmt-amt { font-variant-numeric:tabular-nums; white-space:nowrap; flex-shrink:0; }
.stmt-amt-positive { color:#15803d; }
.stmt-amt-negative { color:#f87171; }

.stmt-accounts { padding:20px 28px; border-top:1px solid #e2e8f0; }
.stmt-accounts-title { font-size:0.68rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:#64748b; margin-bottom:12px; }
.stmt-acc-row { display:flex; justify-content:space-between; align-items:baseline; padding:6px 4px; border-radius:6px; font-size:0.84rem; border-bottom:1px dotted #f1f5f9; gap:16px; transition:background .1s; }
.stmt-acc-row:hover { background:rgba(100,116,139,.05); }
.stmt-acc-row:last-of-type { border-bottom:none; }
.stmt-acc-total { display:flex; justify-content:space-between; align-items:baseline; padding:10px 4px 4px; margin-top:8px; border-top:2px solid #0f172a; font-weight:800; font-size:0.9rem; gap:16px; }

.stmt-signatures { padding:24px 28px; border-top:1px solid #e2e8f0; display:grid; grid-template-columns:1fr 1fr 1fr; gap:28px; }
.stmt-sig-line { border-bottom:1px solid #94a3b8; height:38px; margin-bottom:7px; }
.stmt-sig-label { font-size:0.72rem; color:#64748b; font-weight:600; }
.stmt-certification { padding:14px 28px; background:#fffbeb; border-top:1px solid #fde68a; font-size:0.78rem; color:#78350f; text-align:center; font-style:italic; }

/* dark mode */
html[data-theme="dark"] .stmt-doc { background:#1e293b; border-color:#334155; }
html[data-theme="dark"] .stmt-col+.stmt-col { border-color:#334155; }
html[data-theme="dark"] .stmt-line { border-color:#1e293b; }
html[data-theme="dark"] .stmt-line-name { color:#b0c3d5; }
html[data-theme="dark"] .stmt-group-hdr { color:#7a9aba; border-color:#334155; }
html[data-theme="dark"] .stmt-group-sub { color:#7a9aba; border-color:#334155; }
html[data-theme="dark"] .stmt-recon { background:#0f172a; border-color:#334155; }
html[data-theme="dark"] .stmt-recon-row { color:#c0d0e0; border-color:#1e293b; }
html[data-theme="dark"] .stmt-recon-row.closing { color:#f1f5f9; border-color:#f1f5f9; }
html[data-theme="dark"] .stmt-accounts { border-color:#334155; }
html[data-theme="dark"] .stmt-acc-row { border-color:#1e293b; }
html[data-theme="dark"] .stmt-acc-total { border-color:#94a3b8; }
html[data-theme="dark"] .stmt-signatures { border-color:#334155; }
html[data-theme="dark"] .stmt-sig-label { color:#64748b; }
html[data-theme="dark"] .stmt-certification { background:#2d1c07; border-color:#92400e; color:#fcd34d; }

/* ── Statement config bar ─────────────────────────────────────────────────── */

.stmt-cfg-label { font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); white-space:nowrap; }
.stmt-cfg-toggle { display:flex; align-items:center; gap:5px; cursor:pointer; color:var(--text); padding:4px 9px; border-radius:7px; border:1px solid transparent; font-size:0.77rem; user-select:none; transition:background .12s; }
.stmt-cfg-toggle:hover { background:var(--surface-alt,#f8fafc); }
.stmt-cfg-toggle input[type=checkbox] { cursor:pointer; accent-color:var(--primary); }

/* ── Statement toggle hide rules (data attrs on .stmt-doc) ─────────────────── */
.stmt-doc[data-hide-grphdr] .stmt-group-hdr { display:none !important; }
.stmt-doc[data-hide-grphdr] .stmt-line-sub .stmt-line-name { padding-left:0 !important; }
.stmt-doc[data-hide-grpsub] .stmt-group-sub { display:none !important; }
.stmt-doc[data-hide-recondetail] .stmt-recon-row.indent { display:none !important; }
.stmt-doc[data-hide-acctbreakdown] .stmt-accounts { display:none !important; }
.stmt-doc[data-hide-cert] .stmt-certification { display:none !important; }
.stmt-doc[data-hide-sigs] .stmt-signatures { display:none !important; }

/* ── Format: Clean Accounting ─────────────────────────────────────────────── */
.stmt-doc.fmt-clean .stmt-col-income .stmt-col-title  { color:#1e293b; border-color:#1e293b; }
.stmt-doc.fmt-clean .stmt-col-expense .stmt-col-title { color:#1e293b; border-color:#1e293b; }
.stmt-doc.fmt-clean .stmt-col-income  .stmt-line-amt  { color:#1e293b; }
.stmt-doc.fmt-clean .stmt-col-expense .stmt-line-amt  { color:#1e293b; }
.stmt-doc.fmt-clean .stmt-col-income  .stmt-subtotal  { border-color:#1e293b; color:#1e293b; }
.stmt-doc.fmt-clean .stmt-col-expense .stmt-subtotal  { border-color:#1e293b; color:#1e293b; }
.stmt-doc.fmt-clean .stmt-col+.stmt-col               { border-color:#1e293b; }
.stmt-doc.fmt-clean .stmt-two-col { border:2px solid #1e293b; border-radius:0; }
.stmt-doc.fmt-clean .stmt-recon   { background:transparent; border-top:2px solid #1e293b; }
.stmt-doc.fmt-clean .stmt-amt-positive { color:#1e293b; }
.stmt-doc.fmt-clean .stmt-amt-negative { color:#1e293b; }
.stmt-doc.fmt-clean .stmt-recon-row.closing { border-color:#1e293b; }
.stmt-doc.fmt-clean .stmt-accounts { border-top:2px solid #1e293b; }
.stmt-doc.fmt-clean .stmt-certification { background:#f8fafc; border-color:#cbd5e1; color:#374151; font-style:normal; }
.stmt-doc.fmt-clean .stmt-group-hdr { color:#374151; border-color:#374151; }
.stmt-doc.fmt-clean .stmt-group-sub { color:#374151; }

/* ── Format: Ledger (lean, dense, classic Receipts & Payments account) ────── */
.stmt-doc.fmt-ledger { border-radius:4px; box-shadow:none; border:1.5px solid #0f172a; font-size:0.8rem; }
.stmt-doc.fmt-ledger .stmt-two-col { border:1.5px solid #0f172a; border-radius:0; }
.stmt-doc.fmt-ledger .stmt-col { padding:10px 16px; }
.stmt-doc.fmt-ledger .stmt-col-income, .stmt-doc.fmt-ledger .stmt-col-expense { background:none; }
.stmt-doc.fmt-ledger .stmt-col+.stmt-col { border-color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-col-title { font-size:0.66rem; margin-bottom:6px; padding-bottom:4px; color:#0f172a; border-color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-line { font-size:0.78rem; padding:3px 2px; border-radius:0; border-bottom:1px dotted #94a3b8; }
.stmt-doc.fmt-ledger .stmt-line:hover { background:none; }
.stmt-doc.fmt-ledger .stmt-col-income .stmt-line-amt,
.stmt-doc.fmt-ledger .stmt-col-expense .stmt-line-amt { color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-group-hdr { color:#0f172a; border-color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-group-sub { color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-subtotal { font-size:0.8rem; padding:6px 2px; margin-top:4px; border-radius:0; background:none; }
.stmt-doc.fmt-ledger .stmt-col-income .stmt-subtotal,
.stmt-doc.fmt-ledger .stmt-col-expense .stmt-subtotal { border-color:#0f172a; color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-recon { background:none; border-top:1.5px solid #0f172a; padding:14px 16px; }
.stmt-doc.fmt-ledger .stmt-recon-title::before { display:none; }
.stmt-doc.fmt-ledger .stmt-recon-body { display:table; width:100%; max-width:none; border-collapse:collapse; }
.stmt-doc.fmt-ledger .stmt-recon-row { display:table-row; font-size:0.8rem; border-radius:0; }
.stmt-doc.fmt-ledger .stmt-recon-row:hover { background:none; }
.stmt-doc.fmt-ledger .stmt-recon-row > span { display:table-cell; padding:4px 8px; border-bottom:1px dotted #cbd5e1; }
.stmt-doc.fmt-ledger .stmt-recon-row > span:first-child { text-align:left; }
.stmt-doc.fmt-ledger .stmt-recon-row > span.stmt-amt { text-align:right; white-space:nowrap; }
.stmt-doc.fmt-ledger .stmt-recon-row.indent > span:first-child { padding-left:26px; }
.stmt-doc.fmt-ledger .stmt-amt-positive, .stmt-doc.fmt-ledger .stmt-amt-negative { color:#0f172a; }
.stmt-doc.fmt-ledger .stmt-recon-row.subtotal > span { border-bottom:1.5px solid #0f172a; }
.stmt-doc.fmt-ledger .stmt-recon-row.closing { background:none; box-shadow:none; border-radius:0; }
.stmt-doc.fmt-ledger .stmt-recon-row.closing > span { border-top:2px solid #0f172a; border-bottom:2px solid #0f172a; padding-top:8px; padding-bottom:8px; }
.stmt-doc.fmt-ledger .stmt-accounts { border-top:1.5px solid #0f172a; }
.stmt-doc.fmt-ledger .data-table th { background:#f1f5f9; color:#0f172a; }
.stmt-doc.fmt-ledger .data-table tbody tr:hover { background:none; }
.stmt-doc.fmt-ledger .stmt-certification { background:#f8fafc; border-color:#cbd5e1; color:#374151; font-style:normal; }

/* ── Format: Church Rally ─────────────────────────────────────────────────── */
.stmt-doc.fmt-rally .stmt-col-income  { background:#f0fdf4; }
.stmt-doc.fmt-rally .stmt-col-expense { background:#fff5f5; }
.stmt-doc.fmt-rally .stmt-col-income .stmt-col-title  { font-size:0.8rem; color:#15803d; border-color:#16a34a; }
.stmt-doc.fmt-rally .stmt-col-expense .stmt-col-title { font-size:0.8rem; color:#dc2626; border-color:#ef4444; }
.stmt-doc.fmt-rally .stmt-line-name   { font-size:0.86rem; }
.stmt-doc.fmt-rally .stmt-subtotal    { font-size:0.96rem; padding:12px 0 4px; }
.stmt-doc.fmt-rally .stmt-recon       { background:linear-gradient(135deg,#eff6ff,#f0fdf4); }
.stmt-doc.fmt-rally .stmt-recon-row.closing { font-size:1.1rem; border-width:3px; }
.stmt-doc.fmt-rally .stmt-accounts-title { color:#4f46e5; }
.stmt-doc.fmt-rally .stmt-certification  { background:#fdf4ff; border-color:#d8b4fe; color:#581c87; }

/* Legacy compat */
.report-period-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.report-period-pills { display: flex; gap: 6px; }
.report-period-label { font-size: 0.75rem; color: #64748b; margin-bottom: 14px; }
.report-table tfoot tr { background: #f8fafc; }
.report-total-row td { padding: 10px 14px; border-top: 2px solid #e2e8f0; }

/* ── LOGIN PAGE ──────────────────────────────────── */
.auth-page {
    min-height: 100vh; background: #0f172a;
    display: flex; align-items: center; justify-content: center;
}
.auth-card {
    background: white; border-radius: 10px;
    padding: 36px 32px; width: 100%; max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-logo { font-size: 1.15rem; font-weight: 800; color: #0f172a; }
.auth-subtitle { font-size: 0.78rem; color: #64748b; margin: 4px 0 24px; }
.auth-error {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 6px; padding: 9px 12px;
    font-size: 0.78rem; color: #f87171; margin-bottom: 14px;
}
.auth-label { display: block; font-size: 0.75rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.auth-input {
    display: block; width: 100%; padding: 8px 10px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.85rem; margin-bottom: 12px; outline: none;
    transition: border-color 0.15s; font-family: inherit;
}
.auth-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.auth-password-group {
    position: relative;
    margin-bottom: 12px;
}
.auth-input-with-toggle {
    margin-bottom: 0;
    padding-right: 42px;
}
.auth-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-password-toggle:hover {
    color: #4f46e5;
}
.auth-password-icon {
    width: 18px;
    height: 18px;
}
.auth-btn {
    display: block; width: 100%; padding: 9px;
    background: #6366f1; color: white; border: none;
    border-radius: 6px; font-size: 0.85rem; font-weight: 700;
    cursor: pointer; transition: background 0.15s; margin-top: 4px;
}
.auth-btn:hover { background: #4f46e5; }

/* ── THEME TOGGLE BUTTON ─────────────────────────── */
.theme-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 6px;
    background: white; color: #64748b; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; transition: border-color 0.15s, color 0.15s;
    margin-right: 6px;
}
.theme-btn:hover { border-color: #6366f1; color: #6366f1; }
.theme-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── DARK THEME ──────────────────────────────────── */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { background: #111827; color: #e2e8f0; }

/* Sidebar */
html[data-theme="dark"] .sidebar { background: #0c1628; border-right-color: #1e293b; }
html[data-theme="dark"] .sidebar-brand-name { color: #f1f5f9; }
html[data-theme="dark"] .nav-group-label { color: #4a607a; }
html[data-theme="dark"] .nav-divider { background: #1e293b; }
html[data-theme="dark"] .nav-item { color: #94a3b8; }
html[data-theme="dark"] .nav-item:hover { background: #1e293b; color: #e2e8f0; }
html[data-theme="dark"] .nav-item.active { background: rgba(99,102,241,0.18); color: #a5b4fc; }
html[data-theme="dark"] .nav-sub-item { color: #7a8fa6; }
html[data-theme="dark"] .nav-sub-item:hover { color: #e2e8f0; }
html[data-theme="dark"] .nav-sub-item.active { color: #a5b4fc; }
html[data-theme="dark"] .nav-sub-icon { color: #3d5470; }
html[data-theme="dark"] .nav-sub-item:hover .nav-sub-icon { color: #64748b; }
html[data-theme="dark"] .nav-sub-item.active .nav-sub-icon { color: #818cf8; }
html[data-theme="dark"] .user-card .user-name { color: #e2e8f0; }
html[data-theme="dark"] .user-role { color: #5e7492; }
html[data-theme="dark"] .user-avatar { background: #312e81; color: #a5b4fc; }
html[data-theme="dark"] .logout-btn { color: #7a8fa6; border-color: #1e293b; }
html[data-theme="dark"] .logout-btn:hover { background: #1e293b; color: #e2e8f0; }

/* Topbar */
html[data-theme="dark"] .topbar { background: #1e293b; border-bottom-color: #334155; }
html[data-theme="dark"] .topbar-title { color: #f1f5f9; }
html[data-theme="dark"] .theme-btn { background: #263548; border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .theme-btn:hover { border-color: #818cf8; color: #a5b4fc; }
html[data-theme="dark"] .print-btn { background: #263548; border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .print-btn:hover { border-color: #818cf8; color: #a5b4fc; }
html[data-theme="dark"] .ezra-topbar-btn { background: #263548; border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .ezra-topbar-btn:hover,
html[data-theme="dark"] .ezra-topbar-btn-active { border-color: #818cf8; color: #a5b4fc; background: #1e1b4b; }

/* Main area & content */
html[data-theme="dark"] .main-area { background: #111827; }
html[data-theme="dark"] .content-area { background: #111827; }

/* Toolbar */
html[data-theme="dark"] .toolbar { border-bottom-color: #1e293b; }
html[data-theme="dark"] .toolbar-title { color: #f1f5f9; }
html[data-theme="dark"] .export-menu { background: #1e293b; border-color: #334155; box-shadow: 0 12px 28px rgba(0,0,0,0.45); }
html[data-theme="dark"] .export-menu-item { color: #94a3b8; }
html[data-theme="dark"] .export-menu-item:hover { background: #312e81; color: #c7d2fe; }
html[data-theme="dark"] .record-count { background: #1e3050; color: #7a8fa6; }

/* Search */
html[data-theme="dark"] .toolbar-search { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .search-input { background: transparent; color: #e2e8f0; }
html[data-theme="dark"] .search-input::placeholder { color: #4a607a; }
html[data-theme="dark"] .search-icon { stroke: #5e7492; }
html[data-theme="dark"] .search-clear { color: #5e7492; }

/* Status pills */
html[data-theme="dark"] .status-pills { background: transparent; }
html[data-theme="dark"] .status-pill { background: #1e293b; border-color: #2d3f56; color: #7a8fa6; }
html[data-theme="dark"] .status-pill:hover { color: #e2e8f0; border-color: #475569; }
html[data-theme="dark"] .status-pill.active { background: #312e81; border-color: #4338ca; color: #a5b4fc; }
html[data-theme="dark"] .status-pill.active.active-green  { background: #052e16; border-color: #166534; color: #86efac; }
html[data-theme="dark"] .status-pill.active.active-red    { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .status-pill.active.active-yellow { background: #422006; border-color: #713f12; color: #fde68a; }
html[data-theme="dark"] .status-pill.active.active-gray   { background: #263548; border-color: #334155; color: #94a3b8; }

/* Buttons */
html[data-theme="dark"] .btn-secondary { background: #263548; border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .btn-secondary:hover { background: #334155; color: #e2e8f0; }
html[data-theme="dark"] .btn-ghost { color: #64748b; }
html[data-theme="dark"] .btn-ghost:hover { background: #1e293b; color: #e2e8f0; }

/* Data tables */
html[data-theme="dark"] .data-table-wrap { background: #1e293b; border-color: #334155; box-shadow: none; }
html[data-theme="dark"] .data-table th { background: #19263a; color: #7a9aba; border-bottom-color: #2d3f56; }
html[data-theme="dark"] .data-table td { border-bottom-color: #1e3050; color: #dde6f0; }
html[data-theme="dark"] .data-table tr:hover td { background: #1e3050 !important; }
html[data-theme="dark"] .td-primary { color: #f1f5f9 !important; }
html[data-theme="dark"] .td-muted { color: #b8ccde !important; }
html[data-theme="dark"] .member-name { color: #f1f5f9; }
html[data-theme="dark"] .member-meta { color: #94a3b8; }
html[data-theme="dark"] .table-empty { color: #64788c; }
html[data-theme="dark"] .table-section-header { background: #19263a; border-bottom-color: #2d3f56; color: #7a9aba; }
html[data-theme="dark"] .pager { background: #1e293b; border-top-color: #2d3f56; color: #94a3b8; }
html[data-theme="dark"] .page-btn { background: #1e3050; border-color: #2d3f56; color: #b0c3d5; }
html[data-theme="dark"] .page-current { color: #a5b4fc; }

/* Filters */
html[data-theme="dark"] .filter-input,
html[data-theme="dark"] .filter-select { background: #162032; border-color: #334155; color: #e2e8f0; }

/* Form fields (Django-generated) */
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #162032; border-color: #334155; color: #e2e8f0;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #334155; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
    outline: none;
}

/* Form cards */
html[data-theme="dark"] .form-wrap { background: transparent; }
html[data-theme="dark"] .card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .form-info-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .form-info-header { background: #162032; color: #94a3b8; border-bottom-color: #263548; }
html[data-theme="dark"] .form-info-tip { color: #64748b; border-bottom-color: #263548; }
html[data-theme="dark"] .form-info-tip strong { color: #a5b4fc; }
html[data-theme="dark"] .form-section-title { color: #475569; border-bottom-color: #1e293b; }
html[data-theme="dark"] .form-label { color: #64748b; }
html[data-theme="dark"] .form-label-muted { color: #334155; }
html[data-theme="dark"] .form-hint { color: #334155; }
html[data-theme="dark"] .status-active   { background: #14532d; color: #86efac; }
html[data-theme="dark"] .status-inactive { background: #1e293b; color: #475569; }
html[data-theme="dark"] .status-warning  { background: #422006; color: #fde68a; }
html[data-theme="dark"] .status-info     { background: #1e3a5f; color: #93c5fd; }
html[data-theme="dark"] .form-error { color: #fca5a5; }
html[data-theme="dark"] .form-error-box { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .form-actions { border-top-color: #1e293b; }

/* Finance */
html[data-theme="dark"] .fin-summary-bar { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .fin-summary-label { color: #475569; }
html[data-theme="dark"] .fin-summary-value { color: #f1f5f9; }
html[data-theme="dark"] .fin-summary-divider { background: #334155; }
html[data-theme="dark"] .fin-list-header { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .fin-list-total-label { color: #475569; }

html[data-theme="dark"] .account-card-v2 { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .account-card-v2:hover { border-color: #818cf8; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
html[data-theme="dark"] .account-card-name { color: #e2e8f0; }
html[data-theme="dark"] .account-card-type-tag { color: #475569; }
html[data-theme="dark"] .account-balance-label { color: #475569; }
html[data-theme="dark"] .account-balance-amount { color: #f1f5f9; }
html[data-theme="dark"] .account-card-footer { border-top-color: #263548; }
html[data-theme="dark"] .account-card-footer-link { color: #818cf8; }
html[data-theme="dark"] .account-card-inactive { opacity: 0.4; }

html[data-theme="dark"] .ledger-type-receipt { background: #052e16; color: #86efac; }
html[data-theme="dark"] .ledger-type-payment { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .receipt-form-header { background: linear-gradient(135deg,#0c1f0c,#0d1a20); border-color: #1e3a2e; }
html[data-theme="dark"] .payment-form-header { background: linear-gradient(135deg,#2d0a0a,#2d1a0a); border-color: #4a1a1a; }
html[data-theme="dark"] .receipt-form-card,
html[data-theme="dark"] .payment-form-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .receipt-form-header-title,
html[data-theme="dark"] .receipt-form-header-sub { color: #e2e8f0; }

/* Registers */
html[data-theme="dark"] .reg-list-accent { border-color: #1e293b !important; }
html[data-theme="dark"] .reg-accent-baptism  { background: #0a1826; }
html[data-theme="dark"] .reg-accent-marriage { background: #200d14; }
html[data-theme="dark"] .reg-accent-birth    { background: #1c1506; }
html[data-theme="dark"] .reg-accent-death    { background: #111827; }
html[data-theme="dark"] .reg-accent-transfer { background: #120c2d; }
html[data-theme="dark"] .reg-primary { color: #e2e8f0 !important; }
html[data-theme="dark"] .reg-secondary { color: #475569 !important; }
html[data-theme="dark"] .reg-row:hover td { background: #263548 !important; }
html[data-theme="dark"] .reg-form-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .reg-form-header-baptism  { background: linear-gradient(135deg,#0a1826,#0c1f2e); border-color: #1a3a50; }
html[data-theme="dark"] .reg-form-header-marriage { background: linear-gradient(135deg,#200d14,#2d1219); border-color: #3a1a28; }
html[data-theme="dark"] .reg-form-header-birth    { background: linear-gradient(135deg,#1c1506,#2d2106); border-color: #3a2e0a; }
html[data-theme="dark"] .reg-form-header-death    { background: linear-gradient(135deg,#111827,#162032); border-color: #1e293b; }
html[data-theme="dark"] .reg-form-header-transfer { background: linear-gradient(135deg,#120c2d,#1a1040); border-color: #2a1a50; }
html[data-theme="dark"] .reg-form-title { color: #f1f5f9; }
html[data-theme="dark"] .reg-form-sub { color: #475569; }
html[data-theme="dark"] .transfer-dir-in  { background: #052e16; color: #86efac; }
html[data-theme="dark"] .transfer-dir-out { background: #431407; color: #fdba74; }

/* Member profile */
html[data-theme="dark"] .profile-header { background: linear-gradient(135deg,#1e293b,#162032); border-color: #334155; }
html[data-theme="dark"] .profile-name { color: #f1f5f9; }
html[data-theme="dark"] .profile-meta { color: #475569; }
html[data-theme="dark"] .profile-stat-label { color: #475569; }
html[data-theme="dark"] .profile-stat-value { color: #e2e8f0; }
html[data-theme="dark"] .profile-header-stat { border-left-color: #334155; }
html[data-theme="dark"] .contact-chip { background: #263548; border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .contact-chip:hover { background: #334155; }
html[data-theme="dark"] .member-avatar { background: #312e81; color: #a5b4fc; }

/* Empty state */
html[data-theme="dark"] .empty-title { color: #475569; }
html[data-theme="dark"] .empty-sub { color: #334155; }

/* Reports */
html[data-theme="dark"] .rpt-tabs { border-bottom-color: #1e293b; }
html[data-theme="dark"] .rpt-tab { color: #475569; }
html[data-theme="dark"] .rpt-tab:hover { color: #e2e8f0; }
html[data-theme="dark"] .rpt-tab-active { color: #a5b4fc; border-bottom-color: #6366f1; }
html[data-theme="dark"] .rpt-page-title { color: #f1f5f9; border-bottom-color: #1e293b; }
html[data-theme="dark"] .rpt-period-label { color: #475569; }
html[data-theme="dark"] .rpt-highlight-card { border-color: #334155 !important; }
html[data-theme="dark"] .rpt-card-green { background: #052e16 !important; }
html[data-theme="dark"] .rpt-card-green .rpt-hl-label { color: #86efac; }
html[data-theme="dark"] .rpt-card-green .rpt-hl-value { color: #4ade80; }
html[data-theme="dark"] .rpt-card-blue  { background: #0c1a40 !important; }
html[data-theme="dark"] .rpt-card-blue .rpt-hl-label  { color: #93c5fd; }
html[data-theme="dark"] .rpt-card-blue .rpt-hl-value  { color: #60a5fa; }
html[data-theme="dark"] .rpt-bar-income  { background: #166534; }
html[data-theme="dark"] .rpt-bar-expense { background: #7f1d1d; }
html[data-theme="dark"] .rpt-year-label { color: #475569; }
html[data-theme="dark"] .rpt-custom-range .filter-input { background: #162032; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .rpt-control-bar { background: #111827; border-color: #1e293b; }
html[data-theme="dark"] .rpt-control-title { color: #f1f5f9; }
html[data-theme="dark"] .rpt-control-period { color: #475569; }
html[data-theme="dark"] .rpt-control-bottom { border-top-color: #1e293b; }
html[data-theme="dark"] .rpt-date-input { background: #162032; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .rpt-date-sep { color: #475569; }

/* Autocomplete */
html[data-theme="dark"] .member-ac-input { background: #162032; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .member-ac-dropdown { background: #1e293b; border-color: #334155; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
html[data-theme="dark"] .member-ac-item { color: #94a3b8; }
html[data-theme="dark"] .member-ac-item:hover,
html[data-theme="dark"] .member-ac-item.active { background: #263548; color: #e2e8f0; }
html[data-theme="dark"] .member-ac-empty { color: #334155; }

/* Confirm delete */
html[data-theme="dark"] .confirm-delete-card { background: #1e293b; border-color: #334155; }

/* Toasts */
html[data-theme="dark"] .toast { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .toast-error { background: #450a0a; border-color: #7f1d1d; }
html[data-theme="dark"] .toast-success { background: #052e16; border-color: #166534; }
html[data-theme="dark"] .toast-warning { background: #422006; border-color: #92400e; color: #fef3c7; }

/* Print: keep light for print regardless of theme */
@media print {
    html[data-theme="dark"] body,
    html[data-theme="dark"] .main-area,
    html[data-theme="dark"] .content-area { background: white !important; color: black !important; }
    html[data-theme="dark"] .data-table-wrap { background: white !important; border-color: #e2e8f0 !important; }
    html[data-theme="dark"] .data-table th { background: #f1f5f9 !important; color: #475569 !important; }
    html[data-theme="dark"] .data-table td { color: #0f172a !important; }
    html[data-theme="dark"] .td-primary { color: #0f172a !important; }
    html[data-theme="dark"] .td-muted { color: #64748b !important; }
}

/* ── PRINT BUTTON ────────────────────────────────── */
.print-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 6px;
    background: white; color: #64748b; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: border-color 0.15s, color 0.15s;
}
.print-btn:hover { border-color: #6366f1; color: #6366f1; }
.print-btn svg { width: 14px; height: 14px; }

/* ── PRINT HEADER (screen: hidden, print: shown) ─── */
.print-header {
    display: none;
    align-items: flex-start; justify-content: space-between;
    padding-bottom: 14px; margin-bottom: 20px;
    border-bottom: 2px solid #0f172a;
}
.print-header-brand { font-size: 1.3rem; font-weight: 800; color: #0f172a; letter-spacing: -0.02em; }
.print-header-sub   { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.print-header-meta  { text-align: right; font-size: 0.75rem; color: #64748b; }

/* ── @MEDIA PRINT ────────────────────────────────── */
@media print {
    /* Layout */
    .sidebar, .topbar, .print-btn, .ezra-topbar-btn, .ezra-card,
    .toolbar .btn, .toolbar .toolbar-spacer,
    .status-pills, .pager, .row-actions,
    .fin-list-header form, .report-period-pills,
    .report-period-bar form, .form-actions,
    .toolbar-search-form, .filter-bar,
    .rpt-topbar .print-btn, .rpt-custom-range,
    .rpt-tabs, .rpt-year-bar,
    .toast-stack, .auth-page,
    .rpt-control-bottom, .rpt-control-top button { display: none !important; }
    .rpt-topbar { display: block !important; }
    .rpt-period-label { display: block !important; font-weight: 600; margin-bottom: 10px; }
    .rpt-control-bar { border: none; padding: 0; margin-bottom: 12px; background: transparent; }
    .rpt-control-title { font-size: 1.1rem; }
    .rpt-control-period { font-size: 0.8rem; }

    .app-shell  { display: block !important; }
    .main-area  { margin-left: 0 !important; width: 100% !important; min-height: unset !important; }
    .content-area { padding: 16px 24px !important; }
    .topbar { display: none !important; }

    .print-header { display: flex !important; }

    body { background: white !important; font-size: 10.5pt; color: #000; }

    /* Toolbar becomes a section title */
    .toolbar {
        padding: 0 0 10px !important; border: none !important;
        border-bottom: 1px solid #cbd5e1 !important; margin-bottom: 14px !important;
    }
    .toolbar-title { font-size: 1rem; font-weight: 700; color: #0f172a; }

    /* Tables */
    .data-table-wrap { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
    .data-table th   { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .data-table tr:hover td { background: transparent !important; }
    .reg-row:hover td { background: transparent !important; }

    /* Cards */
    .account-card-v2 { box-shadow: none !important; }

    /* Financial colours */
    .fin-income, .td-net-pos { color: #16a34a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fin-expense, .td-net-neg { color: #f87171 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fin-summary-bar { border: 1px solid #e2e8f0 !important; }

    /* Page breaks */
    .two-col-grid > div, .account-card-v2, .reg-form-card { page-break-inside: avoid; }
    .data-table-wrap { page-break-inside: auto; }

    /* Links */
    a { color: inherit !important; text-decoration: none !important; }
}

.btn-danger {
    background: #f87171; color: white; border: none;
    padding: 8px 16px; border-radius: 6px; font-size: 0.82rem;
    font-weight: 600; cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; transition: background 0.15s;
}
.btn-danger:hover { background: #f87171; color: white; }

/* ── REGISTERS ───────────────────────────────────── */
.reg-list-accent {
    padding: 10px 16px; border-bottom: 1px solid;
    font-size: 0.75rem; color: #64748b;
    display: flex; align-items: center; gap: 8px;
}
.reg-accent-baptism  { background: #f0f9ff; border-color: #bae6fd; }
.reg-accent-marriage { background: #fff1f2; border-color: #fecdd3; }
.reg-accent-birth    { background: #fffbeb; border-color: #fde68a; }
.reg-accent-death    { background: #f8fafc; border-color: #e2e8f0; }
.reg-accent-transfer { background: #f5f3ff; border-color: #ddd6fe; }
.reg-accent-icon { font-size: 0.85rem; opacity: 0.7; }

.reg-indicator {
    width: 32px; height: 32px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 0.85rem;
}
.reg-ind-baptism      { background: #e0f2fe; color: #0284c7; }
.reg-ind-marriage     { background: #ffe4e6; color: #be185d; }
.reg-ind-birth        { background: #fef3c7; color: #d97706; }
.reg-ind-death        { background: #f1f5f9; color: #475569; }
.reg-ind-transfer-in  { background: #dcfce7; color: #16a34a; }
.reg-ind-transfer-out { background: #fff7ed; color: #ea580c; }

.reg-row { cursor: pointer; }
.reg-row:hover td { background: #fafbff; }
.reg-primary   { font-weight: 600; color: #0f172a; font-size: 0.82rem; }
.reg-secondary { font-size: 0.72rem; color: #94a3b8; margin-top: 1px; }
.reg-table td  { vertical-align: middle; }

.reg-form-card {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 10px; overflow: hidden;
}
.reg-form-header { padding: 18px 24px; border-bottom: 1px solid; }
.reg-form-header-baptism  { background: linear-gradient(135deg,#e0f2fe,#f0f9ff); border-color: #bae6fd; }
.reg-form-header-marriage { background: linear-gradient(135deg,#ffe4e6,#fff1f2); border-color: #fecdd3; }
.reg-form-header-birth    { background: linear-gradient(135deg,#fef3c7,#fffbeb); border-color: #fde68a; }
.reg-form-header-death    { background: linear-gradient(135deg,#f1f5f9,#e2e8f0); border-color: #cbd5e1; }
.reg-form-header-transfer { background: linear-gradient(135deg,#ede9fe,#f5f3ff); border-color: #ddd6fe; }
.reg-form-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.reg-form-sub   { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.reg-form-body  { padding: 20px 24px; }

/* ── MEMBER AUTOCOMPLETE ─────────────────────────── */
.member-ac-wrap { position: relative; }
.member-ac-input {
    display: block; width: 100%; padding: 7px 10px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.85rem; font-family: inherit; outline: none;
    background: white; transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.member-ac-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.member-ac-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: white; border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 200; max-height: 240px; overflow-y: auto;
}
.member-ac-item {
    padding: 8px 12px; font-size: 0.82rem; color: #374151;
    cursor: pointer; transition: background 0.1s;
}
.member-ac-item:hover, .member-ac-item.active { background: #f0f4ff; }
.member-ac-item strong { color: #4f46e5; font-weight: 700; }
.member-ac-empty {
    padding: 10px 12px; font-size: 0.8rem; color: #94a3b8;
    font-style: italic;
}

.transfer-dir-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700;
}
.transfer-dir-in  { background: #dcfce7; color: #15803d; }
.transfer-dir-out { background: #fff7ed; color: #c2410c; }

/* ── Sidebar logo / FY badge ─────────────────────────────────────────────── */
.sidebar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-bottom: 0px;
    border-radius: 4px;
    flex-shrink: 0;
}
.sidebar-brand-sub {
    font-size: 0.65rem;
    color: #475569;
    margin-top: 1px;
    line-height: 1.3;
    word-break: break-word;
}
.sidebar-fy-badge {
    margin: 0 10px 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    background: #1e293b;
    color: #94a3b8;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-fy-locked {
    background: rgba(220,38,38,.15);
    color: #fca5a5;
}

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-page { display: flex; flex-direction: column; gap: 0; }

.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.settings-tab {
    display: flex; align-items: center; gap: 7px;
    padding: 10px 20px;
    font-size: 0.83rem; font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    transition: color .15s, border-color .15s;
}
.settings-tab svg { width: 15px; height: 15px; }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; }

.settings-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.settings-panel-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}
.settings-panel-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.settings-panel-sub   { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.settings-org-card {
    display: flex; gap: 20px; align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.settings-org-logo-wrap { flex-shrink: 0; }
.settings-org-logo { height: 64px; border-radius: 8px; border: 1px solid var(--border); }
.settings-org-logo-placeholder {
    width: 64px; height: 64px;
    border-radius: 8px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white; font-size: 1.2rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.settings-org-info { flex: 1; min-width: 0; }
.settings-org-name   { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.settings-org-tagline { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.settings-meta-row {
    display: flex; gap: 10px;
    font-size: 0.82rem; margin-top: 5px;
    color: var(--text);
}
.settings-meta-label { color: var(--text-muted); min-width: 90px; flex-shrink: 0; }

.settings-meta-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
}
.settings-meta-box {
    background: var(--card-bg);
    padding: 14px 20px;
}
.settings-meta-box-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 4px; }
.settings-meta-box-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* ── Financial Year table ────────────────────────────────────────────────── */
.fy-table-wrap { padding: 0 0 0 0; }
.fy-name  { font-weight: 700; color: var(--text); }
.fy-notes { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.fy-locked-row { background: rgba(220,38,38,.03); }

.badge-locked  { display:inline-flex;align-items:center;gap:3px;background:#fef2f2;color:#f87171;border:1px solid #fecaca;border-radius:12px;padding:2px 8px;font-size:0.7rem;font-weight:700; }
.badge-open    { background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0;border-radius:12px;padding:2px 8px;font-size:0.7rem;font-weight:700; display:inline-block; }
.badge-current { background:#eff6ff;color:#2563eb;border:1px solid #bfdbfe;border-radius:12px;padding:2px 8px;font-size:0.7rem;font-weight:700; display:inline-block; }

.btn-link-sm {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 0.78rem; color: #4f46e5; font-weight: 600; text-decoration: underline;
}
.btn-link-sm:hover { color: #3730a3; }

.btn-sm {
    padding: 4px 10px; border-radius: 5px;
    font-size: 0.75rem; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
    text-decoration: none; transition: background .1s;
}
.btn-sm.btn-outline {
    border-color: var(--border);
    background: transparent;
    color: var(--text);
}
.btn-sm.btn-outline:hover { background: var(--hover); }
.btn-sm.btn-warning  { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn-sm.btn-warning:hover  { background: #fde68a; }
.btn-sm.btn-danger   { background: #fef2f2; color: #f87171; border-color: #fecaca; }
.btn-sm.btn-danger:hover   { background: #fecaca; }

.action-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Settings form helpers ───────────────────────────────────────────────── */
.form-section-title {
    font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .12em; color: var(--text-muted);
    border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 16px;
}
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-check-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.87rem; font-weight: 500; color: var(--text); cursor: pointer;
}
.form-check-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* ── Alert block ─────────────────────────────────────────────────────────── */
.alert-warning {
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px;
    padding: 10px 14px; font-size: 0.82rem; color: #92400e;
}

/* ─────────────── DARK MODE ─────────────────────────────────────────────── */
[data-theme="dark"] .sidebar-fy-badge    { background: #1e293b; color: #64748b; }
[data-theme="dark"] .sidebar-fy-locked   { background: rgba(239,68,68,.15); color: #fca5a5; }
[data-theme="dark"] .badge-locked  { background: rgba(185,28,28,.2); color: #fca5a5; border-color: rgba(239,68,68,.3); }
[data-theme="dark"] .badge-open    { background: rgba(22,163,74,.15); color: #86efac; border-color: rgba(34,197,94,.3); }
[data-theme="dark"] .badge-current { background: rgba(29,78,216,.2); color: #93c5fd; border-color: rgba(59,130,246,.3); }
[data-theme="dark"] .settings-panel { border-color: var(--border); background: var(--card-bg); }
[data-theme="dark"] .settings-org-logo { border-color: var(--border); }
[data-theme="dark"] .settings-meta-grid { background: var(--border); }
[data-theme="dark"] .settings-meta-box  { background: var(--card-bg); }
[data-theme="dark"] .fy-locked-row { background: rgba(239,68,68,.05); }
[data-theme="dark"] .btn-sm.btn-warning { background: rgba(146,64,14,.2); color: #fcd34d; border-color: rgba(252,211,77,.3); }
[data-theme="dark"] .btn-sm.btn-danger  { background: rgba(185,28,28,.2); color: #fca5a5; border-color: rgba(239,68,68,.3); }
[data-theme="dark"] .btn-sm.btn-outline { color: var(--text); border-color: var(--border); }
[data-theme="dark"] .alert-warning { background: rgba(146,64,14,.15); border-color: rgba(252,211,77,.3); color: #fcd34d; }

/* ══════════════════════════════════════════════════════════════
   COMPREHENSIVE DARK MODE COMPLETIONS
   ══════════════════════════════════════════════════════════════ */

/* ── TRIAL BALANCE ───────────────────────────────────────────── */
.tb-summary-row {
    display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 18px;
}
.tb-summary-card {
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 18px;
}
.tb-card-ok  { border-color: #bbf7d0; }
.tb-card-err { border-color: #fecaca; }
.tb-summary-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px; }
.tb-summary-value { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.tb-val-debit  { color: #3730a3; }
.tb-val-credit { color: #D97706; }
.tb-rp-row { background: var(--surface-alt); }
.tb-rp-badge {
    display: inline-block; margin-left: 8px; padding: 1px 7px;
    background: #e0e7ff; color: #3730a3; border-radius: 10px;
    font-size: 0.68rem; font-weight: 700; font-style: normal; vertical-align: middle;
}
.tb-totals-row { background: var(--surface-alt); border-top: 2px solid var(--border); font-weight: 800; }
.tb-total-cell {
    text-align: right; font-size: 0.92rem; font-weight: 800;
    border-bottom: 3px double var(--border); white-space: nowrap;
}
.tb-footnote { margin-top: 12px; font-size: 0.74rem; color: var(--text-muted); }
.tb-imbalance-alert {
    display: flex; align-items: flex-start; gap: 10px;
    margin-top: 16px; padding: 12px 16px;
    border: 1px solid #fecaca; border-radius: 8px;
    font-size: 0.83rem; color: #f87171;
}

/* ── INCOME & EXPENDITURE ────────────────────────────────────── */
.ie-summary-row {
    display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 18px;
}
.ie-summary-card {
    border-radius: 10px; padding: 16px 20px;
    border: 1px solid var(--border); background: var(--surface-alt);
}
.ie-card-income  { border-color: #bbf7d0; }
.ie-card-expense { border-color: #fecaca; }
.ie-card-surplus { border-color: #bbf7d0; }
.ie-card-deficit { border-color: #fecaca; }
.ie-summary-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px; }
.ie-summary-value { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.ie-val-income  { color: #15803d; }
.ie-val-expense { color: #f87171; }
.ie-summary-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.ie-tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.ie-tfoot-row { background: var(--surface-alt); font-weight: 700; }
.ie-total-cell { text-align: right; font-size: 0.9rem; font-weight: 800; border-bottom: 3px double var(--border); white-space: nowrap; }
.ie-total-income { color: #15803d; }
.ie-total-expense { color: #f87171; }
.ie-net-card {
    border-radius: 10px; padding: 20px 28px;
    display: flex; flex-direction: column; align-items: flex-end;
    border: 1px solid var(--border); background: var(--surface-alt);
}
.ie-net-surplus { border-color: #bbf7d0; }
.ie-net-deficit { border-color: #fecaca; }
.ie-net-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.ie-net-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.ie-net-value {
    font-size: 2.2rem; font-weight: 900; margin-top: 8px;
    border-bottom: 3px double currentColor; padding-bottom: 4px;
}
.ie-net-surplus .ie-net-value { color: #16a34a; }
.ie-net-deficit .ie-net-value { color: #f87171; }

/* ── Report lock notice ──────────────────────────────────────── */
.rpt-lock-notice {
    background: #fffbeb; border: 1px solid #fde68a;
    border-radius: 6px; padding: 8px 14px;
    font-size: 0.8rem; color: #92400e; margin-bottom: 14px;
}

/* ── Report highlight card variants ─────────────────────────── */
.rpt-card-indigo { border-color: #c7d2fe !important; }
.rpt-card-indigo .rpt-hl-label { color: #4338ca; }
.rpt-card-indigo .rpt-hl-value { color: #3730a3; }
.rpt-card-danger { border-color: #fecaca !important; }
.rpt-card-danger .rpt-hl-label { color: #f87171; }
.rpt-card-danger .rpt-hl-value { color: #f87171; }

/* ── Table tfoot row variants ────────────────────────────────── */
.tfoot-neutral { background: #f8fafc; }
.tfoot-opening { background: #eef2ff; }
.tfoot-closing { background: #f0fdf4; border-top: 2px solid #bbf7d0; }

/* ── Table income / expense cell helpers ─────────────────────── */
.td-income  { text-align: right; color: #16a34a; font-weight: 600; }
.td-expense { text-align: right; color: #f87171; font-weight: 600; }

/* ── Finance opening balance label colour ────────────────────── */
.fin-opening { color: #6366f1 !important; }

/* ── Report highlight card — neutral (gray) ─────────────────── */
.rpt-card-gray { border-color: #e2e8f0 !important; }
.rpt-card-gray .rpt-hl-label { color: #64748b; }
.rpt-card-gray .rpt-hl-value { color: #1e293b; }

/* ── Table tfoot — danger (red-tint) ────────────────────────── */
.tfoot-danger { background: #fff8f8; }

/* ──────────────── DARK MODE ADDITIONS ──────────────────────── */

/* Stat cards (dashboard) */
html[data-theme="dark"] .stat-card  { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .stat-label { color: #475569; }
html[data-theme="dark"] .stat-value { color: #f1f5f9; }
html[data-theme="dark"] .stat-meta,
html[data-theme="dark"] .stat-sub   { color: #475569; }

/* Tabs */
html[data-theme="dark"] .tab-bar            { border-bottom-color: #334155; }
html[data-theme="dark"] .tab-btn            { color: #64748b; }
html[data-theme="dark"] .tab-btn:hover      { color: #e2e8f0; }
html[data-theme="dark"] .tab-btn.active     { color: #818cf8; border-bottom-color: #6366f1; }

/* Card detail rows */
html[data-theme="dark"] .card-title         { color: #f1f5f9; border-bottom-color: #263548; }
html[data-theme="dark"] .card-row           { border-bottom-color: #263548; }
html[data-theme="dark"] .card-row-label     { color: #94a3b8; }
html[data-theme="dark"] .card-row-value     { color: #e2e8f0; }
html[data-theme="dark"] a.card-row:hover   { background: #1a2740; }
html[data-theme="dark"] a.card-row:hover .card-row-label { color: #cbd5e1; }

/* Detail view */
html[data-theme="dark"] .detail-field       { border-bottom-color: #1e293b; }
html[data-theme="dark"] .detail-label       { color: #475569; }
html[data-theme="dark"] .detail-value       { color: #e2e8f0; }

/* Warn box */
html[data-theme="dark"] .warn-box           { background: rgba(146,64,14,.15); border-left-color: #d97706; }
html[data-theme="dark"] .warn-box-title     { color: #fcd34d; }

/* Badges */
html[data-theme="dark"] .badge-success { background: #052e16; color: #86efac; }
html[data-theme="dark"] .badge-danger  { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .badge-warning { background: #422006; color: #fde68a; }
html[data-theme="dark"] .badge-info    { background: #1e1b4b; color: #a5b4fc; }
html[data-theme="dark"] .badge-gray    { background: #263548; color: #64748b; }

/* Table header bar */
html[data-theme="dark"] .table-header-bar   { border-bottom-color: #334155; }
html[data-theme="dark"] .table-header-title { color: #e2e8f0; }

/* Import accepted-override rows */
.imp-accepted td { background: #f5f3ff !important; }
html[data-theme="dark"] .imp-accepted td { background: #1e1a30 !important; }
html[data-theme="dark"] .imp-accepted:hover td { background: #2a2440 !important; }

/* Import conflict rows */
.import-conflict-row td { background: #fffbeb !important; }
html[data-theme="dark"] .import-conflict-row td { background: #2a1a00 !important; }
html[data-theme="dark"] .import-conflict-row:hover td { background: #3a2600 !important; }

/* Import duplicate rows (exact duplicate — will be skipped) */
.import-dup-row td { background: #fef2f2 !important; }
html[data-theme="dark"] .import-dup-row td { background: #1c0000 !important; }
html[data-theme="dark"] .import-dup-row:hover td { background: #290000 !important; }

/* Import error rows */
.import-error-row td { background: #fef2f2 !important; }
html[data-theme="dark"] .import-error-row td { background: #1c0000 !important; }
html[data-theme="dark"] .import-error-row:hover td { background: #290000 !important; }

/* Conflict result card */
.import-conflict-card { border-left: 4px solid #f59e0b; }
html[data-theme="dark"] .import-conflict-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .import-conflict-card .card-title { color: #fbbf24; }
html[data-theme="dark"] .import-conflict-card p { color: #94a3b8; }

/* Import — data cleaning banner */
html[data-theme="dark"] .import-cleaning-banner {
    background: #052e16 !important;
    border-color: #166534 !important;
}
html[data-theme="dark"] .import-cleaning-banner strong,
html[data-theme="dark"] .import-cleaning-banner summary {
    color: #4ade80 !important;
}
html[data-theme="dark"] .import-cleaning-banner span { color: #86efac !important; }
html[data-theme="dark"] .import-cleaning-banner th { color: #4ade80 !important; }
html[data-theme="dark"] .import-cleaning-banner td { color: #d1fae5 !important; }
html[data-theme="dark"] .import-cleaning-banner tr { border-color: #14532d !important; }

/* ── Import preview: dark-mode-aware badges, buttons & badges ── */

/* Status cell: amber conflict badge */
.imp-badge-conflict  { background:#fef3c7;color:#92400e;border:1px solid #fcd34d; }
/* Status cell: scored / suggested-ledger amber badge */
.imp-badge-scored    { background:#fef3c7;color:#92400e;border:1px solid #fcd34d; }
/* Status cell: purple override badge (accepted override) */
.imp-badge-override  { background:#ede9fe;color:#5b21b6;border:1px solid #c4b5fd; }
/* Status cell: gray skipped badge */
.imp-badge-skipped   { background:#f1f5f9;color:#64748b;border:1px solid #cbd5e1; }
/* Status cell: red no-ledger badge */
.imp-badge-no-ledger { background:#fef2f2;color:#991b1b;border:1px solid #fecaca; }

html[data-theme="dark"] .imp-badge-conflict  { background:#422006;color:#fde68a;border-color:#713f12; }
html[data-theme="dark"] .imp-badge-scored    { background:#422006;color:#fde68a;border-color:#713f12; }
html[data-theme="dark"] .imp-badge-override  { background:#1e1a30;color:#c4b5fd;border-color:#6d28d9; }
html[data-theme="dark"] .imp-badge-skipped   { background:#1e293b;color:#7a8fa6;border-color:#334155; }
html[data-theme="dark"] .imp-badge-no-ledger { background:#450a0a;color:#fca5a5;border-color:#7f1d1d; }

/* Action buttons in status cell */
.imp-btn-accept, .imp-btn-skip, .imp-btn-restore {
    padding:1px 6px;font-size:0.62rem;border-radius:3px;cursor:pointer;vertical-align:middle;
}
.imp-btn-accept  { border:1px solid #c4b5fd;background:#ede9fe;color:#5b21b6; }
.imp-btn-skip    { border:1px solid #94a3b8;background:#f8fafc;color:#475569; }
.imp-btn-restore { border:1px solid #94a3b8;background:#f8fafc;color:#475569; }

html[data-theme="dark"] .imp-btn-accept  { border-color:#6d28d9;background:#1e1a30;color:#c4b5fd; }
html[data-theme="dark"] .imp-btn-skip    { border-color:#334155;background:#263548;color:#94a3b8; }
html[data-theme="dark"] .imp-btn-restore { border-color:#334155;background:#263548;color:#94a3b8; }

/* Count badges inside filter pills */
.imp-pill-valid-badge    { background:#dcfce7;color:#166534;border-radius:10px;padding:0 5px;font-size:0.68rem;font-weight:700; }
.imp-pill-conflict-badge { background:#fef3c7;color:#92400e;border-radius:10px;padding:0 5px;font-size:0.68rem;font-weight:700; }
.imp-pill-dup-badge      { background:#fee2e2;color:#991b1b;border-radius:10px;padding:0 5px;font-size:0.68rem;font-weight:700; }
.imp-pill-error-badge    { background:#fee2e2;color:#991b1b;border-radius:10px;padding:0 5px;font-size:0.68rem;font-weight:700; }

html[data-theme="dark"] .imp-pill-valid-badge    { background:#052e16;color:#86efac; }
html[data-theme="dark"] .imp-pill-conflict-badge { background:#422006;color:#fde68a; }
html[data-theme="dark"] .imp-pill-dup-badge      { background:#450a0a;color:#fca5a5; }
html[data-theme="dark"] .imp-pill-error-badge    { background:#450a0a;color:#fca5a5; }

/* Flash messages */
.imp-msg { padding:10px 16px;border-radius:8px;margin-bottom:6px;font-size:0.85rem; }
.imp-msg-error   { background:#fef2f2;border:1px solid #fecaca;color:#991b1b; }
.imp-msg-warning { background:#fffbeb;border:1px solid #fcd34d;color:#78350f; }
.imp-msg-success { background:#f0fdf4;border:1px solid #bbf7d0;color:#166534; }

html[data-theme="dark"] .imp-msg-error   { background:#450a0a;border-color:#7f1d1d;color:#fca5a5; }
html[data-theme="dark"] .imp-msg-warning { background:#422006;border-color:#713f12;color:#fde68a; }
html[data-theme="dark"] .imp-msg-success { background:#052e16;border-color:#166534;color:#86efac; }

/* Amount cell */
.imp-amount-income  { color:#16a34a; }
.imp-amount-expense { color:#dc2626; }
html[data-theme="dark"] .imp-amount-income  { color:#86efac; }
html[data-theme="dark"] .imp-amount-expense { color:#f87171; }

/* Conflict resolution — family option buttons */
.conflict-family-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1.5px solid #d97706;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.825rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.conflict-family-btn:hover {
    background: #fef3c7;
    border-color: #b45309;
}
.conflict-family-count {
    background: #d97706;
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.75rem;
    font-weight: 600;
}
.conflict-family-missing {
    opacity: 0.45;
    cursor: not-allowed;
}
html[data-theme="dark"] .conflict-family-btn {
    background: #1c1200;
    border-color: #b45309;
    color: #fbbf24;
}
html[data-theme="dark"] .conflict-family-btn:hover {
    background: #2a1e00;
    border-color: #d97706;
}

/* Filter bar */
html[data-theme="dark"] .filter-bar         { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .filter-select      { background: #162032; border-color: #334155; color: #e2e8f0; }

/* Pagination */
html[data-theme="dark"] .pagination         { background: #1e293b; border-top-color: #334155; color: #64748b; }
html[data-theme="dark"] .page-info          { color: #475569; }

/* Action links */
html[data-theme="dark"] .action-link             { color: #818cf8; }
html[data-theme="dark"] .action-link:hover        { background: #1e293b; }
html[data-theme="dark"] .action-link-danger       { color: #fca5a5 !important; }
html[data-theme="dark"] .action-link-danger:hover { background: rgba(185,28,28,.2) !important; }

/* Button-style table actions — dark */
html[data-theme="dark"] .tbl-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
html[data-theme="dark"] .tbl-btn:hover { background: #263548; border-color: #475569; color: #e2e8f0; }
html[data-theme="dark"] .tbl-btn-green { color: #4ade80; border-color: #166534; background: #052e16; }
html[data-theme="dark"] .tbl-btn-green:hover { background: #14532d; }
html[data-theme="dark"] .tbl-btn-danger { color: #fca5a5; border-color: #7f1d1d; background: #1c0a0a; }
html[data-theme="dark"] .tbl-btn-danger:hover { background: #450a0a; }

/* Legacy account card */
html[data-theme="dark"] .account-card              { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .account-card-name         { color: #e2e8f0; }
html[data-theme="dark"] .account-card-type         { color: #475569; }
html[data-theme="dark"] .account-card-balance      { color: #4ade80; }

/* Report tfoot variants */
html[data-theme="dark"] .tfoot-neutral              { background: #162032; }
html[data-theme="dark"] .tfoot-neutral td           { color: #94a3b8; }
html[data-theme="dark"] .tfoot-opening              { background: #1a1f40; }
html[data-theme="dark"] .tfoot-opening td           { color: #a5b4fc; }
html[data-theme="dark"] .tfoot-closing              { background: #0c1f0c; border-top-color: #166534; }
html[data-theme="dark"] .tfoot-closing td           { color: #86efac; }

/* Trial Balance */
html[data-theme="dark"] .tb-summary-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .tb-card-ok  { border-color: #166534; }
html[data-theme="dark"] .tb-card-err { border-color: #7f1d1d; }
html[data-theme="dark"] .tb-val-debit  { color: #a5b4fc; }
html[data-theme="dark"] .tb-rp-row { background: #1e293b; }
html[data-theme="dark"] .tb-rp-badge { background: #312e81; color: #a5b4fc; }
html[data-theme="dark"] .tb-totals-row { background: #1e293b; }
html[data-theme="dark"] .tb-imbalance-alert { border-color: #7f1d1d; color: #fca5a5; }

/* Income & Expenditure */
html[data-theme="dark"] .ie-summary-card { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .ie-card-income, html[data-theme="dark"] .ie-card-surplus { border-color: #166534; }
html[data-theme="dark"] .ie-card-expense, html[data-theme="dark"] .ie-card-deficit { border-color: #7f1d1d; }
html[data-theme="dark"] .ie-val-income  { color: #4ade80; }
html[data-theme="dark"] .ie-val-expense { color: #f87171; }
html[data-theme="dark"] .ie-net-surplus { border-color: #166534; }
html[data-theme="dark"] .ie-net-deficit { border-color: #7f1d1d; }
html[data-theme="dark"] .ie-tfoot-row { background: #1e293b; }
html[data-theme="dark"] .ie-total-income  { color: #4ade80; }
html[data-theme="dark"] .ie-total-expense { color: #f87171; }
html[data-theme="dark"] .ie-net-surplus .ie-net-value { color: #4ade80; }
html[data-theme="dark"] .ie-net-deficit .ie-net-value { color: #f87171; }

/* Report lock notice */
html[data-theme="dark"] .rpt-lock-notice { background: rgba(146,64,14,.15); border-color: rgba(252,211,77,.3); color: #fcd34d; }

/* Report highlight card variants */
html[data-theme="dark"] .rpt-card-indigo            { border-color: #312e81 !important; }
html[data-theme="dark"] .rpt-card-indigo .rpt-hl-label { color: #a5b4fc; }
html[data-theme="dark"] .rpt-card-indigo .rpt-hl-value { color: #818cf8; }
html[data-theme="dark"] .rpt-card-danger            { border-color: #7f1d1d !important; }
html[data-theme="dark"] .rpt-card-danger .rpt-hl-label { color: #fca5a5; }
html[data-theme="dark"] .rpt-card-danger .rpt-hl-value { color: #f87171; }

/* Finance opening balance colour in dark */
html[data-theme="dark"] .fin-opening { color: #a5b4fc !important; }

/* Report highlight card — gray */
html[data-theme="dark"] .rpt-card-gray            { border-color: #334155 !important; }
html[data-theme="dark"] .rpt-card-gray .rpt-hl-label { color: #475569; }
html[data-theme="dark"] .rpt-card-gray .rpt-hl-value { color: #e2e8f0; }

/* Table tfoot — danger */
html[data-theme="dark"] .tfoot-danger              { background: #1f0a0a; }
html[data-theme="dark"] .tfoot-danger td           { color: #f87171; }

/* Table income/expense cells in dark */
html[data-theme="dark"] .td-income  { color: #4ade80; }
html[data-theme="dark"] .td-expense { color: #f87171; }

/* ── CHURCH SIGNUP PAGE ──────────────────────────── */
.signup-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
}
.signup-card {
    background: white; border-radius: 14px;
    padding: 36px 36px 28px;
    width: 100%; max-width: 520px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.signup-header { margin-bottom: 28px; }
.signup-logo {
    font-size: 1.1rem; font-weight: 800; color: #6366f1;
    letter-spacing: -0.02em; margin-bottom: 10px;
}
.signup-title { font-size: 1.4rem; font-weight: 800; color: #0f172a; line-height: 1.2; }
.signup-sub   { font-size: 0.82rem; color: #64748b; margin-top: 5px; }
.signup-section-label {
    font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .12em; color: #94a3b8;
    border-bottom: 1px solid #f1f5f9; padding-bottom: 6px; margin-bottom: 14px;
}
.signup-field { margin-bottom: 14px; }
.signup-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.signup-footer {
    text-align: center; margin-top: 20px;
    font-size: 0.8rem; color: #94a3b8;
}
.signup-notice {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 8px;
    font-size: 0.78rem;
    color: #713f12;
    line-height: 1.5;
    text-align: center;
}
.auth-link { color: #6366f1; font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

/* Subdomain input with suffix */
.subdomain-wrap {
    display: flex; align-items: center;
    border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.subdomain-wrap:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.subdomain-input {
    border: none !important; border-radius: 0 !important;
    box-shadow: none !important; margin-bottom: 0 !important;
    flex: 1;
}
.subdomain-suffix {
    padding: 0 10px; background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    font-size: 0.78rem; color: #94a3b8; white-space: nowrap;
    line-height: 36px;
}

/* Subdomain availability feedback */
.subdomain-feedback {
    font-size: 0.72rem; font-weight: 600;
    margin-top: 4px; min-height: 16px;
}
.subdomain-feedback.available { color: #16a34a; }
.subdomain-feedback.taken     { color: #f87171; }
.subdomain-feedback.checking  { color: #94a3b8; }

/* Input error state */
.input-error { border-color: #fca5a5 !important; }

/* ── TEAM PAGE ───────────────────────────────────── */
.team-avatar-row { display: flex; align-items: center; gap: 10px; }
.team-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white; font-size: 0.72rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; letter-spacing: .02em;
}
.empty-cell { padding: 16px 20px; color: var(--text-muted); font-size: 0.85rem; }

/* ── ACCOUNT EXPIRED PAGE ────────────────────────── */
.expired-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
}
.expired-card {
    background: white; border-radius: 14px;
    padding: 48px 36px 32px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    text-align: center;
}
.expired-icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: #fff7ed; border: 2px solid #fed7aa;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px; color: #ea580c;
}
.expired-icon svg { width: 28px; height: 28px; }
.expired-title  { font-size: 1.35rem; font-weight: 800; color: #0f172a; margin-bottom: 6px; }
.expired-church { font-size: 0.85rem; color: #6366f1; font-weight: 700; margin-bottom: 14px; }
.expired-body   { font-size: 0.85rem; color: #64748b; line-height: 1.6; margin-bottom: 28px; }
.expired-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.expired-btn-primary {
    display: block; padding: 10px 16px;
    background: #6366f1; color: white; border-radius: 7px;
    font-size: 0.85rem; font-weight: 700; text-decoration: none;
    transition: background .15s;
}
.expired-btn-primary:hover { background: #4f46e5; color: white; }
.expired-btn-secondary {
    display: block; padding: 9px 16px;
    background: #f8fafc; color: #475569; border-radius: 7px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem; font-weight: 600; text-decoration: none;
    transition: border-color .15s, color .15s;
}
.expired-btn-secondary:hover { border-color: #6366f1; color: #6366f1; }
.expired-footer { font-size: 0.78rem; color: #94a3b8; }

/* Brighter income/expense class colours in dark for better readability */
html[data-theme="dark"] .fin-income,
html[data-theme="dark"] .td-net-pos { color: #4ade80 !important; }
html[data-theme="dark"] .fin-expense,
html[data-theme="dark"] .td-net-neg { color: #f87171 !important; }

/* ── SIDEBAR TOGGLE BUTTON ───────────────────────── */
.sidebar-toggle-btn {
    background: transparent; border: none;
    color: #475569; cursor: pointer;
    padding: 4px 5px; border-radius: 4px; flex-shrink: 0;
    transition: color 0.1s, background 0.1s; line-height: 0;
}
.sidebar-toggle-btn:hover { color: #94a3b8; background: rgba(255,255,255,0.08); }
.sidebar-toggle-btn svg { width: 15px; height: 15px; display: block; }

/* ── SIDEBAR COLLAPSED STATE ─────────────────────── */
.app-shell.sidebar-collapsed .sidebar { width: 52px; }
.app-shell.sidebar-collapsed .sidebar-brand {
    padding: 12px 0; flex-direction: column; align-items: center; gap: 4px;
}
.app-shell.sidebar-collapsed .sidebar-brand-content { display: none; }
.app-shell.sidebar-collapsed .sidebar-fy-badge { display: none; }
.app-shell.sidebar-collapsed .nav-item {
    padding: 9px 0; justify-content: center; gap: 0;
}
.app-shell.sidebar-collapsed .nav-text { display: none; }
.app-shell.sidebar-collapsed .nav-group-label { display: none; }
.app-shell.sidebar-collapsed .nav-sub-item { display: none; }
.app-shell.sidebar-collapsed .nav-divider { display: none; }
.app-shell.sidebar-collapsed .sidebar-footer { padding: 8px 4px; }
.app-shell.sidebar-collapsed .user-card {
    flex-direction: column; padding: 4px 0; align-items: center;
}
.app-shell.sidebar-collapsed .user-info,
.app-shell.sidebar-collapsed .logout-btn { display: none; }

/* ── NAV GROUP COLLAPSE ──────────────────────────── */
.nav-group-label.nav-collapsible {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between;
    padding-right: 10px;
}
.nav-group-label.nav-collapsible:hover { color: #64748b; }
.nav-group-arrow {
    width: 11px; height: 11px; flex-shrink: 0;
    transition: transform 0.18s ease; color: #334155;
    display: block;
}
.nav-group-label.nav-group-collapsed .nav-group-arrow {
    transform: rotate(-90deg);
}
.app-shell.sidebar-collapsed .nav-group-arrow { display: none; }

/* ── MEMBER IMPORT PAGE ──────────────────────────── */
.import-drop-zone {
    position: relative; border: 2px dashed #c7d2fe;
    border-radius: 10px; background: #fafbff;
    text-align: center; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    overflow: hidden;
}
.import-drop-zone:hover,
.import-drop-zone.import-drop-hover { border-color: #6366f1; background: #eef2ff; }
.import-drop-zone.import-drop-zone-active { border-color: #6366f1; border-style: solid; background: #eef2ff; }
.import-file-input {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2;
    width: 100%; height: 100%;
}
.import-drop-label {
    display: flex; flex-direction: column; align-items: center;
    padding: 36px 24px; gap: 8px; cursor: pointer;
}
.import-drop-icon { width: 40px; height: 40px; color: #818cf8; margin-bottom: 4px; }
.import-drop-text { font-size: 0.88rem; color: #475569; }
.import-drop-hint { font-size: 0.75rem; color: #94a3b8; }

/* Result banner */
.import-result-banner {
    border-radius: 10px; padding: 18px 22px;
    display: flex; align-items: center; gap: 16px; margin-bottom: 4px;
}
.import-result-success { background: #f0fdf4; border: 1px solid #bbf7d0; }
.import-result-error   { background: #fff0f0; border: 1px solid #fecaca; }
.import-result-partial { background: #fffbeb; border: 1px solid #fde68a; }
.import-result-icon {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800;
}
.import-result-success .import-result-icon { background: #dcfce7; color: #15803d; }
.import-result-error   .import-result-icon { background: #fee2e2; color: #f87171; }
.import-result-partial .import-result-icon { background: #fef9c3; color: #92400e; }
.import-result-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.import-result-sub   { font-size: 0.82rem; color: #475569; margin-top: 2px; }
.import-result-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
.import-err-reason { font-size: 0.78rem; color: #f87171; }

/* Column reference sidebar */
.import-col-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid #f8fafc; font-size: 0.78rem;
}
.import-col-required .import-col-name { color: #0f172a; font-weight: 600; }
.import-col-name { color: #475569; font-family: monospace; font-size: 0.78rem; }
.import-col-badge { padding: 1px 6px; border-radius: 3px; font-size: 0.67rem; font-weight: 700; }
.import-badge-req { background: #fee2e2; color: #f87171; }
.import-badge-opt { background: #f1f5f9; color: #64748b; }
.import-more-btn {
    display: flex; align-items: center; gap: 5px;
    width: 100%; padding: 7px 18px;
    background: none; border: none; border-top: 1px solid #f1f5f9;
    color: #6366f1; font-size: 0.78rem; font-weight: 700;
    cursor: pointer; text-align: left;
    transition: color .15s;
}
.import-more-btn:hover { color: #4f46e5; }
.import-more-btn svg { width: 13px; height: 13px; transition: transform .2s; flex-shrink: 0; }
.import-val-row {
    display: flex; flex-direction: column;
    padding: 6px 0; border-bottom: 1px solid #f8fafc;
}
.import-val-label { font-size: 0.7rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; font-family: monospace; }
.import-val-vals  { font-size: 0.78rem; color: #475569; }

/* Dark mode */
html[data-theme="dark"] .import-drop-zone { background: #162032; border-color: #334155; }
html[data-theme="dark"] .import-drop-zone:hover,
html[data-theme="dark"] .import-drop-zone.import-drop-hover { background: #1e1b4b; border-color: #6366f1; }
html[data-theme="dark"] .import-drop-zone.import-drop-zone-active { background: #1e1b4b; border-color: #6366f1; }
html[data-theme="dark"] .import-drop-text { color: #94a3b8; }
html[data-theme="dark"] .import-drop-hint { color: #475569; }
html[data-theme="dark"] .import-drop-icon { color: #6366f1; }
html[data-theme="dark"] .import-result-success { background: #052e16; border-color: #166534; }
html[data-theme="dark"] .import-result-error   { background: #450a0a; border-color: #7f1d1d; }
html[data-theme="dark"] .import-result-partial { background: #422006; border-color: #713f12; }
html[data-theme="dark"] .import-result-title { color: #f1f5f9; }
html[data-theme="dark"] .import-result-sub   { color: #64748b; }
html[data-theme="dark"] .import-err-reason { color: #fca5a5; }
html[data-theme="dark"] .import-col-row { border-color: #263548; }
html[data-theme="dark"] .import-col-required .import-col-name { color: #e2e8f0; }
html[data-theme="dark"] .import-col-name { color: #64748b; }
html[data-theme="dark"] .import-badge-req { background: rgba(185,28,28,.25); color: #fca5a5; }
html[data-theme="dark"] .import-badge-opt { background: #263548; color: #64748b; }
html[data-theme="dark"] .import-col-list { scrollbar-color: #334155 #1e293b; }
html[data-theme="dark"] .import-more-btn { border-top-color: #263548; color: #818cf8; }
html[data-theme="dark"] .import-more-btn:hover { color: #a5b4fc; }
html[data-theme="dark"] .import-val-row { border-color: #263548; }
html[data-theme="dark"] .import-val-label { color: #475569; }
html[data-theme="dark"] .import-val-vals  { color: #94a3b8; }

/* Dark mode for new sidebar elements */
html[data-theme="dark"] .sidebar-toggle-btn { color: #334155; }
html[data-theme="dark"] .sidebar-toggle-btn:hover { color: #64748b; background: rgba(255,255,255,0.06); }
html[data-theme="dark"] .nav-group-arrow { color: #334155; }
html[data-theme="dark"] .nav-group-label.nav-collapsible:hover { color: #475569; }

/* ── HOUSEHOLD / FAMILY PAGES ────────────────────── */
.household-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 4px;
}
.household-card-link {
    text-decoration: none; color: inherit; display: block;
}
.household-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 18px 20px; transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
}
.household-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.08); border-color: #c7d2fe;
}
.household-card-top {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; margin-bottom: 14px;
}
.household-card-name {
    font-size: 0.97rem; font-weight: 700; color: #0f172a; line-height: 1.3;
}
.household-card-desc {
    font-size: 0.78rem; color: #64748b; margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}
.household-card-count {
    font-size: 0.75rem; font-weight: 600; color: #6366f1;
    background: #eef2ff; border-radius: 20px; padding: 2px 10px;
    white-space: nowrap; flex-shrink: 0;
}
.household-avatars {
    display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px;
}
.household-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #e0e7ff; color: #4f46e5;
    font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; overflow: hidden; flex-shrink: 0;
}
.household-avatar img { width: 100%; height: 100%; object-fit: cover; }
.household-avatar-head {
    background: #4f46e5; color: #fff; border-color: #c7d2fe;
}
.household-avatar-more {
    background: #f1f5f9; color: #64748b; font-size: 0.65rem; font-weight: 700;
}
.household-head-row {
    font-size: 0.78rem; color: #475569; border-top: 1px solid #f1f5f9;
    padding-top: 10px; margin-top: 2px;
}
.household-head-label { color: #94a3b8; margin-right: 4px; }
.household-head-name  { color: #0f172a; font-weight: 600; }
.household-detail-header {
    display: flex; align-items: flex-start; gap: 18px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 22px 24px; margin-bottom: 4px;
}
.household-detail-icon {
    width: 52px; height: 52px; border-radius: 12px;
    background: #eef2ff; color: #6366f1; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.household-detail-icon svg { width: 26px; height: 26px; }
.household-detail-name {
    font-size: 1.18rem; font-weight: 800; color: #0f172a; line-height: 1.2;
}
.household-detail-desc {
    font-size: 0.85rem; color: #64748b; margin-top: 4px;
}
.household-detail-meta {
    font-size: 0.8rem; color: #94a3b8; margin-top: 6px;
}
.household-detail-meta strong { color: #475569; }
.hh-head-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    background: #eef2ff; color: #4f46e5;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.member-avatar-head {
    border: 2px solid #6366f1 !important;
}
html[data-theme="dark"] .household-card {
    background: #162032; border-color: #1e293b;
}
html[data-theme="dark"] .household-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.35); border-color: #4f46e5;
}
html[data-theme="dark"] .household-card-name { color: #f1f5f9; }
html[data-theme="dark"] .household-card-desc { color: #64748b; }
html[data-theme="dark"] .household-card-count { background: #1e1b4b; color: #818cf8; }
html[data-theme="dark"] .household-avatar { background: #1e1b4b; color: #818cf8; border-color: #162032; }
html[data-theme="dark"] .household-avatar-head { background: #4f46e5; border-color: #312e81; }
html[data-theme="dark"] .household-avatar-more { background: #263548; color: #64748b; }
html[data-theme="dark"] .household-head-row { border-color: #1e293b; color: #64748b; }
html[data-theme="dark"] .household-head-name { color: #e2e8f0; }
html[data-theme="dark"] .household-detail-header { background: #162032; border-color: #1e293b; }
html[data-theme="dark"] .household-detail-icon { background: #1e1b4b; color: #818cf8; }
html[data-theme="dark"] .household-detail-name { color: #f1f5f9; }
html[data-theme="dark"] .household-detail-desc { color: #64748b; }
html[data-theme="dark"] .household-detail-meta { color: #475569; }
html[data-theme="dark"] .household-detail-meta strong { color: #94a3b8; }
html[data-theme="dark"] .hh-head-badge { background: #1e1b4b; color: #818cf8; }

/* Household list table extras */
.household-avatar-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: #eef2ff; color: #6366f1; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.household-avatar-icon svg { width: 17px; height: 17px; }
.hh-count-badge {
    font-size: 0.78rem; color: #475569;
    background: #f1f5f9; border-radius: 20px;
    padding: 2px 10px; display: inline-block;
}
html[data-theme="dark"] .household-avatar-icon { background: #1e1b4b; color: #818cf8; }
html[data-theme="dark"] .hh-count-badge { background: #1e293b; color: #94a3b8; }

/* ── FAMILIES LIST (rich card rows) ─────────────── */
.hh-list {
    display: flex; flex-direction: column; gap: 10px; margin-top: 4px;
}
.hh-row {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 16px 20px; cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.hh-row:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); border-color: #c7d2fe; }

.hh-row-icon {
    width: 44px; height: 44px; border-radius: 10px;
    background: #eef2ff; color: #6366f1; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.hh-row-icon svg { width: 22px; height: 22px; }

.hh-row-main { flex: 1; min-width: 0; }
.hh-row-name {
    font-size: 0.95rem; font-weight: 700; color: #0f172a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hh-row-desc {
    font-size: 0.78rem; color: #64748b; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hh-row-head {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.78rem; color: #92400e; font-weight: 600;
    background: #fffbeb; border: 1px solid #fde68a;
    border-radius: 20px; padding: 2px 8px; margin-top: 5px;
}
.hh-row-nohead {
    font-size: 0.75rem; color: #94a3b8; margin-top: 4px;
}

/* Avatar stack */
.hh-row-avatars {
    display: flex; flex-direction: row-reverse; margin-right: -4px;
}
.hh-mini-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: #6366f1; color: #fff;
    font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; overflow: hidden;
    margin-left: -8px; flex-shrink: 0;
}
.hh-mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hh-mini-avatar-head { background: #f59e0b; color: #fff; border-color: #fde68a; }
.hh-mini-more { background: #e2e8f0; color: #475569; font-size: 0.6rem; }

/* Right stat + actions */
.hh-row-right {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 6px; flex-shrink: 0;
}
.hh-row-count {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.78rem; color: #64748b; white-space: nowrap;
}
.hh-row-actions { display: flex; gap: 8px; }

/* Dark mode */
html[data-theme="dark"] .hh-row { background: #162032; border-color: #1e293b; }
html[data-theme="dark"] .hh-row:hover { border-color: #4f46e5; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
html[data-theme="dark"] .hh-row-icon { background: #1e1b4b; color: #818cf8; }
html[data-theme="dark"] .hh-row-name { color: #f1f5f9; }
html[data-theme="dark"] .hh-row-desc { color: #475569; }
html[data-theme="dark"] .hh-row-head { background: #1c1400; border-color: #78350f; color: #fbbf24; }
html[data-theme="dark"] .hh-row-nohead { color: #475569; }
html[data-theme="dark"] .hh-mini-avatar { background: #1e1b4b; color: #818cf8; border-color: #162032; }
html[data-theme="dark"] .hh-mini-avatar-head { background: #4f46e5; border-color: #312e81; }
html[data-theme="dark"] .hh-mini-more { background: #263548; color: #64748b; }
html[data-theme="dark"] .hh-row-count { color: #475569; }

/* Families table */
.hh-table-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: #6366f1; color: #fff; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.hh-table-icon svg { width: 16px; height: 16px; }
.hh-avatars-row {
    display: flex; align-items: center; gap: 2px;
}
.hh-member-count {
    font-size: 0.78rem; color: #64748b; margin-left: 6px;
}
html[data-theme="dark"] .hh-table-icon { background: #1e1b4b; color: #818cf8; }
html[data-theme="dark"] .hh-member-count { color: #94a3b8; }

/* ── VIEW TOGGLE (Members / Families) ───────────── */
.view-toggle {
    display: flex; border: 1px solid #e2e8f0; border-radius: 8px;
    overflow: hidden; flex-shrink: 0;
}
.view-toggle-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; font-size: 0.8rem; font-weight: 500;
    color: #64748b; text-decoration: none;
    background: #fff; border: none; transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid #e2e8f0; }
.view-toggle-btn:hover { background: #f8fafc; color: #334155; }
.view-toggle-btn.active { background: #6366f1; color: #fff; }
.view-toggle-btn.active:hover { background: #4f46e5; }

html[data-theme="dark"] .view-toggle { border-color: #334155; }
html[data-theme="dark"] .view-toggle-btn { background: #1e293b; color: #64748b; }
html[data-theme="dark"] .view-toggle-btn + .view-toggle-btn { border-color: #334155; }
html[data-theme="dark"] .view-toggle-btn:hover { background: #263548; color: #94a3b8; }
html[data-theme="dark"] .view-toggle-btn.active { background: #6366f1; color: #fff; }

/* ── Confirmation Modal ─────────────────────────────────────────── */
.cb-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; backdrop-filter: blur(2px);
    animation: cbFadeIn 0.15s ease;
}
@keyframes cbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.cb-modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%; max-width: 420px; margin: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: cbSlideIn 0.15s ease;
}
@keyframes cbSlideIn { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cb-modal-hd {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border-bottom: 1px solid #fecaca;
    padding: 16px 20px; display: flex; align-items: center; gap: 12px;
}
.cb-modal-icon-wrap {
    width: 36px; height: 36px; border-radius: 8px;
    background: #fee2e2; color: #f87171;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cb-modal-icon-wrap svg { width: 18px; height: 18px; }
.cb-modal-title { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.cb-modal-sub { font-size: 0.73rem; color: #64748b; margin-top: 1px; }
.cb-modal-body { padding: 20px; }
.cb-modal-body p { font-size: 0.85rem; color: #475569; margin: 0; line-height: 1.55; }
.cb-modal-ft { display: flex; gap: 10px; padding: 0 20px 20px; }

html[data-theme="dark"] .cb-modal-hd { background: linear-gradient(135deg, #2d1515, #2d1a1a); border-color: #7f1d1d; }
html[data-theme="dark"] .cb-modal-icon-wrap { background: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .cb-modal-title { color: #f1f5f9; }
html[data-theme="dark"] .cb-modal-body p { color: #94a3b8; }

/* allow .action-link on button elements */
button.action-link { background: none; border: none; cursor: pointer; font-size: inherit; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — TABLET & MOBILE
   Tablet : 641px – 1024px  → sidebar collapses to icons
   Mobile : ≤ 640px          → sidebar becomes a drawer
   ═══════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ──────────────── */
.topbar-hamburger {
    display: none;
    background: transparent; border: none; cursor: pointer;
    color: #64748b; padding: 6px; border-radius: 6px;
    margin-right: 10px; line-height: 0;
    transition: color 0.1s, background 0.1s;
}
.topbar-hamburger:hover { color: #0f172a; background: #f1f5f9; }
.topbar-hamburger svg { width: 20px; height: 20px; display: block; }
html[data-theme="dark"] .topbar-hamburger { color: #64748b; }
html[data-theme="dark"] .topbar-hamburger:hover { color: #f1f5f9; background: #1e293b; }

/* ── Sidebar overlay (mobile drawer backdrop) ──────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
}
.app-shell.mobile-nav-open .sidebar-overlay { display: block; }

/* ════════════════════════════════════════
   TABLET  641px – 1024px
   ════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 641px) {
    /* Stat grid 2-col on tablet */
    .stat-grid { grid-template-columns: repeat(2, 1fr); }

    /* Reduce content padding */
    .content-area { padding: 14px 16px; }

    /* Collapse 3/4-column form grids to 2 on tablet */
    .form-grid-3,
    .form-grid-4 { grid-template-columns: repeat(2, 1fr) !important; }

    /* Narrow the info sidebar panel on tablet */
    .form-page-layout { grid-template-columns: 1fr 220px; }
}

/* ════════════════════════════════════════
   MOBILE  ≤ 640px
   ════════════════════════════════════════ */
@media (max-width: 640px) {

    /* Show hamburger in topbar */
    .topbar-hamburger { display: flex; align-items: center; justify-content: center; }

    /* Hide the in-sidebar toggle on mobile */
    .sidebar-toggle-btn { display: none; }

    /* Sidebar becomes a fixed off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 200;
        width: 240px !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease, width 0s;
        box-shadow: none;
    }
    .app-shell.mobile-nav-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }

    /* Always show full sidebar content in drawer */
    .sidebar-brand { padding: 16px 14px 14px !important; flex-direction: row !important; align-items: center !important; gap: 12px !important; }
    .sidebar-brand-content { display: flex !important; }
    .sidebar-fy-badge      { display: flex !important; }
    .nav-item { padding: 10px 10px !important; justify-content: flex-start !important; gap: 9px !important; }
    .nav-text { display: inline !important; }
    .nav-group-label { display: flex !important; }
    .nav-sub-item  { display: flex !important; }
    .nav-divider   { display: block !important; }
    .sidebar-footer { padding: 12px 14px !important; }
    .user-card { flex-direction: row !important; padding: 6px !important; align-items: center !important; }
    .user-info { display: block !important; }
    .logout-btn { display: block !important; }
    .nav-group-arrow { display: block !important; }

    /* Main area takes full width */
    .main-area { width: 100%; }

    /* Topbar adjustments */
    .topbar { padding: 0 12px; gap: 0; }
    .topbar-title { font-size: 0.82rem; }
    .print-btn { display: none; }

    /* Content padding */
    .content-area { padding: 10px 12px; }

    /* Stat grid 2-col */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px 14px; }
    .stat-value { font-size: 1.6rem; }

    /* Toolbar wraps */
    .toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 0; }
    .toolbar-spacer { display: none; }

    /* Tables already scroll via base rule */
    .data-table th, .data-table td { padding: 6px 10px; font-size: 0.78rem; }

    /* Form layouts stack on mobile */
    .form-row { flex-direction: column; }
    .form-row > * { width: 100% !important; }
    .form-layout { grid-template-columns: 1fr !important; }
    .two-col { flex-direction: column; }
    .two-col > * { width: 100% !important; }

    /* Two-panel form layout: collapse to single column, hide info card */
    .form-page-layout { grid-template-columns: 1fr; }
    .form-page-layout > div:last-child { display: none; }

    /* All form grids collapse to single column */
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 { grid-template-columns: 1fr !important; }

    /* Tighter padding on form cards */
    .receipt-form-body,
    .reg-form-body { padding: 14px 16px; }
    .receipt-form-header,
    .payment-form-header,
    .reg-form-header { padding: 14px 16px; }
    .card { padding: 14px 16px; }

    /* Ensure select/input fill available width */
    .form-group select,
    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group input[type="email"],
    .form-group input[type="date"],
    .form-group textarea { width: 100%; box-sizing: border-box; }

    /* Profile header stacks on mobile */
    .profile-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .profile-header-stat { flex-direction: row; flex-wrap: wrap; gap: 10px; }
    .detail-layout { grid-template-columns: 1fr !important; }

    /* Pagination */
    .pagination { flex-wrap: wrap; justify-content: center; gap: 6px; }

    /* Ezra FAB — smaller on mobile */
    .ezra-fab { padding: 10px 14px 10px 12px; font-size: 0.8rem; }
    .ezra-card { right: 12px; left: 12px; width: auto; }

    /* Buttons */
    .btn { font-size: 0.78rem; padding: 6px 12px; }
    .btn-sm { font-size: 0.72rem; padding: 4px 10px; }

    /* Hide some topbar buttons to save space */
    #theme-label { display: none; }

    /* ── Register list tables → card layout ── */

    /* Override the 520px min-width for reg-tables only */
    .reg-table { min-width: 0 !important; }

    /* Hide column headers */
    .reg-table thead { display: none; }

    /* Table and tbody become block containers */
    .reg-table,
    .reg-table tbody { display: block; width: 100%; }

    /* Each reg-row becomes a horizontal flex card */
    .reg-table tbody tr.reg-row {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 11px 14px;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        background: transparent;
    }
    .reg-table tbody tr.reg-row:active { background: var(--hover-bg); }

    /* Hide ALL cells by default */
    .reg-table tbody td { display: none !important; padding: 0 !important; border: none !important; }

    /* Col 1: indicator icon — fixed width, no grow */
    .reg-table tbody td:nth-child(1) { display: flex !important; flex-shrink: 0; align-items: center; }

    /* Col 2: primary name — fills remaining space */
    .reg-table tbody td:nth-child(2) { display: block !important; flex: 1; min-width: 0; overflow: hidden; }

    /* Col 3: date / spouse / direction / parents — right-aligned muted label */
    .reg-table tbody td:nth-child(3) {
        display: block !important;
        flex-shrink: 0;
        font-size: 0.72rem;
        color: var(--text-muted);
        text-align: right;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Last col: Edit/Delete actions */
    .reg-table tbody td:last-child { display: flex !important; flex-shrink: 0; gap: 8px; align-items: center; }

    /* Empty-state row spans full width normally */
    .reg-table tbody tr:not(.reg-row) { display: table-row; }
    .reg-table tbody tr:not(.reg-row) td { display: table-cell !important; padding: 20px 16px !important; }

    /* Register index: two-col-grid stacks to single column */
    .two-col-grid { grid-template-columns: 1fr !important; }

    /* Register form max-width: full width on mobile */
    .reg-form-card { max-width: 100%; margin: 0; }

    /* Tighter reg-form header on mobile */
    .reg-form-header { padding: 12px 14px; }
    .reg-form-body { padding: 14px 14px; }

    /* Status pills wrap on mobile */
    .status-pills { flex-wrap: wrap; gap: 6px; }
}

/* Dark mode adjustments for overlay */
html[data-theme="dark"] .sidebar-overlay { background: rgba(0,0,0,0.6); }

/* ── Audit Trail ──────────────────────────────────────────────── */
.audit-info {
    border-top: 1px solid var(--border);
    margin-top: 20px;
    padding-top: 14px;
}
.audit-info-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}
.audit-entry {
    padding: 8px 10px;
    background: var(--hover-bg);
    border-radius: 6px;
    margin-bottom: 6px;
}
.audit-entry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.audit-action {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.audit-action-create { background: #dcfce7; color: #15803d; }
.audit-action-update { background: #dbeafe; color: #2563eb; }
.audit-action-delete { background: #fee2e2; color: #f87171; }
html[data-theme="dark"] .audit-action-create { background: #14532d; color: #86efac; }
html[data-theme="dark"] .audit-action-update { background: #1e3a8a; color: #93c5fd; }
html[data-theme="dark"] .audit-action-delete { background: #7f1d1d; color: #fca5a5; }
.audit-entry-user {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}
.audit-entry-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}
.audit-changes {
    list-style: none;
    margin: 6px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.audit-changes li {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}
.audit-changes.audit-changes-detail li { font-size: 0.82rem; margin-bottom: 4px; }
.audit-field { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.audit-old { color: #f87171; text-decoration: line-through; word-break: break-word; }
.audit-new { color: #16a34a; font-weight: 500; word-break: break-word; }
.audit-more-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.74rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    margin-top: 4px;
    padding: 4px 0;
    gap: 4px;
}
.audit-more-btn:hover { text-decoration: underline; }

/* Audit as a standalone sidebar card */
.audit-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.audit-card .audit-info { border-top: none; margin-top: 0; padding-top: 0; }
