.site-logo-swap { display: flex; justify-content: center; }
.site-logo-swap .site-logo-dark { display: none; }
[data-theme="dark"] .site-logo-swap .site-logo-light { display: none; }
[data-theme="dark"] .site-logo-swap .site-logo-dark { display: block; }
.site-logo-swap img { max-height: 40px; width: auto; display: block; }
.site-logo-swap.lg img { max-height: 52px; }
.site-logo-swap .brand-mark { font-size: 26px; }






/* ==========================================================================
   Blue Realm — Private Client Theme (Light / Dark, switchable)
   ==========================================================================
   No color-mix() anywhere in this file. Every value below is a plain,
   universally-supported color — either a fixed hex/rgba, or a custom
   property that app.js computes from --accent in plain JS and writes in
   as an inline style (see applyAccentDerived() in app.js). This avoids
   depending on a CSS feature that isn't reliably supported everywhere.

   LIGHT / DARK — switched with a `data-theme="dark"` attribute on <html>,
   set by the mode toggle (sidebar + Appearance page) and persisted in
   localStorage.
   ========================================================================== */
:root {
    --accent: #F43E01;   /* <- buttons + key highlights. Always pair with white text. */
    --on-accent: #FFFFFF;

    /* ---- Light mode (default) — all static values ---- */
    --bg: #F3F3EE;
    --bg-lift: #E9E9E2;
    --surface: #FCFCFA;
    --surface-raised: #FFFFFF;
    --line: #DEDDD3;
    --line-soft: #E7E6DE;
    --line-bright: #CBC9BC;
    --ink-wash: rgba(28,27,24,0.05);
    --ink-wash-soft: rgba(28,27,24,0.025);
    --surface-translucent: rgba(243,243,238,0.92);
    --toggle-track-on: rgba(28,27,24,0.85);

    --ink: #1c1b18;
    --ink-muted: #6e6c62;
    --ink-faint: #9d9a8e;

    --shadow-sm: 0 1px 2px rgba(28,27,24,0.06);
    --shadow-md: 0 10px 24px -10px rgba(28,27,24,0.16), 0 2px 8px -2px rgba(28,27,24,0.08);
    --shadow-lg: 0 24px 48px -18px rgba(28,27,24,0.20), 0 6px 16px -6px rgba(28,27,24,0.10);

    /* Accent-derived — safe static fallbacks matching the default accent.
       app.js overwrites all of these the instant it runs, for whatever
       accent the person actually picks. */
    --brass: #D63500;
    --brass-bright: var(--accent);
    --brass-dim: #942600;
    --accent-wash: rgba(244,62,1,0.10);
    --accent-text: #DC3701;
    --accent-a08: rgba(244,62,1,0.08);
    --accent-a14: rgba(244,62,1,0.14);
    --accent-a18: rgba(244,62,1,0.18);
    --accent-a22: rgba(244,62,1,0.22);
    --accent-a30: rgba(244,62,1,0.30);
    --accent-a35: rgba(244,62,1,0.35);
    --accent-a40: rgba(244,62,1,0.40);
    --accent-glow: rgba(244,62,1,0.05);
    --shadow-brass: 0 0 0 1px var(--accent-a35), 0 10px 24px -10px var(--accent-a40);

    --sage: #1f7a4d;
    --sage-bright: #2f9963;
    --sage-wash: rgba(31,122,77,0.14);
    --rust: #b3261e;
    --rust-bright: #c94a3f;
    --rust-wash: rgba(179,38,30,0.12);
    --rust-wash-soft: rgba(179,38,30,0.08);

    --serif: 'Fraunces', Georgia, serif;
    --sans: 'Inter', -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', 'Courier New', monospace;

    --radius: 10px;
    --radius-lg: 16px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-snap: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Dark mode overrides — all static values ---- */
[data-theme="dark"] {
    --bg: #101413;
    --bg-lift: #0c0f0e;
    --surface: #1B201D;
    --surface-raised: #171C19;
    --line: #2A312D;
    --line-soft: #1E2320;
    --line-bright: #3B443E;
    --ink-wash: rgba(255,255,255,0.06);
    --ink-wash-soft: rgba(255,255,255,0.03);
    --surface-translucent: rgba(16,20,19,0.92);
    --toggle-track-on: rgba(255,255,255,0.85);

    --ink: #FFFFFF;
    --ink-muted: #93998e;
    --ink-faint: #5f645d;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
    --shadow-md: 0 8px 24px -8px rgba(0,0,0,0.55), 0 2px 8px -2px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 48px -16px rgba(0,0,0,0.65), 0 4px 16px -4px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-tap-highlight-color: transparent; }

body {
    background:
        radial-gradient(ellipse 1100px 550px at 15% -8%, var(--accent-glow), transparent 60%),
        var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1, "cv01" 1;
}

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

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brass-dim); }

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

:focus-visible {
    outline: 1.5px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }

.eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

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

@keyframes settleIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-head { animation: settleIn 0.5s var(--ease) both; }
.main > *:not(.page-head) { animation: settleIn 0.5s var(--ease) both; animation-delay: 0.06s; }
.main > *:not(.page-head) ~ *:not(.page-head) { animation-delay: 0.1s; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface-raised);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 50;
    transition: transform 0.35s var(--ease);
}

.brand { padding: 28px 24px 22px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.brand-mark em { font-style: normal; color: var(--accent); }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }

.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-group-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); padding: 16px 12px 8px; }
.nav-item {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px;
    color: var(--ink-muted); font-size: 13.5px;
    transition: background 0.18s var(--ease-snap), color 0.18s var(--ease-snap);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; transition: opacity 0.18s ease; }
.nav-item:hover { background: var(--ink-wash); color: var(--ink); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--accent-wash); color: var(--accent-text); }
.nav-item.active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 2px; height: 60%; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-item.cta { background: var(--accent); color: var(--on-accent); font-weight: 600; margin-top: 8px; }
.nav-item.cta:hover { background: var(--brass-dim); color: var(--on-accent); }

.sidebar-foot { padding: 16px; border-top: 1px solid var(--line-soft); }
.sidebar-balance {
    display: flex; flex-direction: column;
    padding: 10px 12px; margin-bottom: 10px; border-radius: 8px;
    background: var(--accent-wash);
    border: 1px solid var(--accent-a22);
    transition: border-color 0.18s ease, background 0.18s ease;
}
.sidebar-balance:hover { border-color: var(--accent-a40); background: var(--accent-a14); }
.sidebar-balance-amount { font-family: var(--serif); font-size: 17px; color: var(--accent-text); font-feature-settings: "tnum" 1; margin-top: 2px; }

.account-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(160deg, var(--accent), var(--brass-dim));
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.35), inset 0 -2px 3px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    color: var(--on-accent); font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.account-email { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { font-size: 10.5px; color: var(--ink-faint); font-family: var(--mono); }
.logout-btn {
    display: flex; align-items: center; gap: 8px;
    width: 100%; margin-top: 6px; padding: 8px 8px;
    font-size: 12.5px; color: var(--ink-faint); border-radius: 8px;
    transition: color 0.18s ease, background 0.18s ease;
}
 .logout-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.logout-btn:hover { color: var(--rust-bright); background: var(--rust-wash-soft); }

.topbar {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; height: 60px;
    background: var(--surface-translucent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    align-items: center; justify-content: space-between;
    padding: 0 16px; z-index: 45;
}
.menu-btn { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; color: var(--ink); border-radius: 8px; transition: background 0.18s ease; }
.menu-btn:hover { background: var(--ink-wash); }
.topbar-balance { font-family: var(--mono); font-size: 13px; color: var(--accent-text); font-feature-settings: "tnum" 1; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(20,18,14,0.45); backdrop-filter: blur(2px); z-index: 39; }
.overlay.show { display: block; }

.main { margin-left: 240px; flex: 1; min-width: 0; padding: 40px 48px 80px; position: relative; z-index: 2; }
.page-head { margin-bottom: 32px; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: 8px; }
.page-head .eyebrow::before { content: ''; width: 14px; height: 1px; background: var(--accent); }
.page-head h1 { font-size: 30px; color: var(--ink); margin: 8px 0 6px; }
.page-head p { color: var(--ink-muted); font-size: 14px; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar { display: flex; }
    .main { margin-left: 0; padding: 84px 20px 60px; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s var(--ease-snap), box-shadow 0.2s var(--ease-snap), transform 0.2s var(--ease-snap);
}
a.card:hover, .card.interactive:hover { border-color: var(--line-bright); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.wallet-hero { background: linear-gradient(155deg, var(--surface-raised), var(--surface) 65%); overflow: hidden; }
.wallet-hero > * { position: relative; z-index: 1; }
.engrave { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--accent); opacity: 0.3; pointer-events: none; z-index: 0; }
.engrave path { fill: none; stroke: currentColor; stroke-width: 0.6; }

.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.ledger-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.ledger-head a, .ledger-head button { transition: color 0.18s ease; }
.ledger-head a:hover, .ledger-head button:hover { color: var(--accent-text); }
.ledger-row { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line-soft); gap: 12px; transition: background 0.18s ease; }
.ledger-row:hover { background: var(--ink-wash-soft); }
.ledger-row:last-child { border-bottom: none; }
.ledger-row .desc { font-size: 13.5px; color: var(--ink); }
.ledger-row .meta { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.ledger-row .amount { font-family: var(--mono); font-size: 14px; text-align: right; font-feature-settings: "tnum" 1; }
.amount.pos { color: var(--sage-bright); }
.amount.neg { color: var(--ink); }

.ledger-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ledger-icon svg { width: 16px; height: 16px; }
.ledger-icon.i-call { background: var(--accent-wash); color: var(--accent-text); }
.ledger-icon.i-fund { background: var(--sage-wash); color: var(--sage-bright); }
.ledger-icon.i-refer { background: var(--accent-wash); color: var(--accent-text); }
.ledger-row-main { display: flex; align-items: center; gap: 14px; }

.balance-display { font-family: var(--serif); font-weight: 500; font-size: 54px; letter-spacing: -0.02em; line-height: 1; color: var(--ink); font-feature-settings: "tnum" 1; }
.balance-display .cents { font-size: 27px; color: var(--ink-faint); }

.credit-chip {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: var(--accent); color: var(--on-accent);
    padding: 6px 12px; border-radius: 20px;
    font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
    box-shadow: var(--shadow-sm);
}
.credit-chip .credit-amount { font-family: var(--serif); font-size: 14px; font-weight: 600; }

.gauge-track { height: 6px; border-radius: 4px; background: var(--line-soft); overflow: hidden; position: relative; }
.gauge-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brass-dim), var(--accent)); transition: width 0.6s var(--ease); }

.sparkline { display: block; opacity: 0.95; }
.sparkline .spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sparkline .spark-fill { fill: url(#sparkFade); opacity: 0.4; }
.sparkline .spark-dot { fill: var(--accent); }

.delta-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; color: var(--sage-bright); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 22px; border-radius: 8px;
    font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em;
    border: 1px solid transparent; cursor: pointer;
    transition: background 0.18s var(--ease-snap), border-color 0.18s var(--ease-snap),
                box-shadow 0.18s var(--ease-snap), transform 0.12s var(--ease-snap), color 0.18s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, var(--shadow-sm); }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, var(--shadow-brass); filter: brightness(1.04); }
.btn-secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--brass-dim); background: var(--accent-wash); }
.btn-ghost { background: transparent; color: var(--ink-muted); padding: 10px 14px; }
.btn-ghost:hover { color: var(--accent-text); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px 4px 8px; border-radius: 20px; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-sage { background: var(--sage-wash); color: var(--sage-bright); }
.badge-brass { background: var(--accent-wash); color: var(--accent-text); }
.badge-rust { background: var(--rust-wash); color: var(--rust-bright); }
.badge-muted { background: var(--ink-wash); color: var(--ink-muted); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; transition: border-color 0.2s ease; }
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: 0; transition: opacity 0.25s ease; }
.stat-card:hover { border-color: var(--line-bright); }
.stat-card:hover::after { opacity: 0.8; }
.stat-card .stat-value { font-family: var(--serif); font-size: 28px; color: var(--ink); margin: 6px 0 4px; font-feature-settings: "tnum" 1; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-muted); }

input, textarea, select {
    width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 14px; color: var(--ink); font-family: var(--sans); font-size: 13.5px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input[type="color"] { padding: 4px; height: 44px; cursor: pointer; }
label { display: block; font-size: 12px; color: var(--ink-muted); margin-bottom: 7px; }

.divider { height: 1px; background: linear-gradient(90deg, var(--line-soft), var(--line), var(--line-soft)); margin: 24px 0; }
.hairline-list > * + * { border-top: 1px solid var(--line-soft); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20,18,14,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; max-width: 420px; width: 100%; box-shadow: var(--shadow-lg); animation: modalIn 0.3s var(--ease) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.hidden { display: none !important; }

.method-card { transition: border-color 0.18s var(--ease-snap), background 0.18s var(--ease-snap); }
.method-card.is-selected, [data-amount].is-selected { border-color: var(--accent) !important; background: var(--accent-wash); box-shadow: 0 0 0 1px var(--accent-a30); }

.copy-field { display: flex; align-items: center; gap: 10px; background: var(--bg-lift); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; transition: border-color 0.18s ease; }
.copy-field:hover { border-color: var(--line-bright); }
.copy-field code { flex: 1; font-family: var(--mono); font-size: 12.5px; color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================== APPEARANCE PAGE ============================== */
.swatch-row { display: flex; align-items: center; gap: 14px; }
.swatch-preview { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; box-shadow: var(--shadow-sm); }
.color-field { display: flex; align-items: center; gap: 12px; }
.color-field input[type="color"] { width: 56px; flex-shrink: 0; }
.color-field input[type="text"] { font-family: var(--mono); text-transform: uppercase; }
.preset-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.preset-swatch {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
    cursor: pointer; transition: transform 0.15s var(--ease-snap), box-shadow 0.15s ease;
}
.preset-swatch:hover { transform: scale(1.1); }
.preset-swatch.is-active { box-shadow: 0 0 0 2px var(--accent); }

/* ============================== MODE TOGGLE ============================== */
.mode-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.mode-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.mode-toggle-track {
    position: relative;
    width: 52px; height: 28px; border-radius: 999px;
    background: var(--line-soft);
    border: 1px solid var(--line);
    transition: background 0.25s var(--ease-snap), border-color 0.25s var(--ease-snap);
    flex-shrink: 0;
}
.mode-toggle input:checked ~ .mode-toggle-track { background: var(--toggle-track-on); border-color: transparent; }
.mode-toggle-thumb {
    position: absolute; top: 2px; left: 2px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--ink-muted);
    transition: transform 0.28s var(--ease), color 0.2s ease;
}
.mode-toggle-thumb svg { width: 13px; height: 13px; }
.mode-toggle-thumb .icon-moon { display: none; }
.mode-toggle input:checked ~ .mode-toggle-track .mode-toggle-thumb { transform: translateX(24px); color: var(--accent); }
.mode-toggle input:checked ~ .mode-toggle-track .icon-sun { display: none; }
.mode-toggle input:checked ~ .mode-toggle-track .icon-moon { display: block; }
.mode-toggle-label { font-size: 13px; color: var(--ink); }

.mode-toggle.compact { gap: 8px; }
.mode-toggle.compact .mode-toggle-track { width: 40px; height: 22px; }
.mode-toggle.compact .mode-toggle-thumb { width: 16px; height: 16px; }
.mode-toggle.compact .mode-toggle-thumb svg { width: 10px; height: 10px; }
.mode-toggle.compact input:checked ~ .mode-toggle-track .mode-toggle-thumb { transform: translateX(18px); }
.mode-toggle.compact .mode-toggle-label { font-size: 12px; color: var(--ink-muted); }

.sidebar-mode-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; margin-bottom: 4px;
    border-radius: 8px;
}

/* ============================== AUTH PAGES ============================== */
.site-logo-swap { display: flex; justify-content: center; }
.site-logo-swap .site-logo-dark { display: none; }
[data-theme="dark"] .site-logo-swap .site-logo-light { display: none; }
[data-theme="dark"] .site-logo-swap .site-logo-dark { display: block; }
.site-logo-swap img { max-height: 40px; width: auto; display: block; }
.site-logo-swap.lg img { max-height: 52px; }
.site-logo-swap.sm img { max-height: 32px; }
.site-logo-swap .brand-mark { font-size: 26px; }
.site-logo-swap.sm .brand-mark { font-size: 16px; }
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; position: relative; z-index: 2;
}
.auth-topcorner { position: fixed; top: 20px; right: 20px; z-index: 3; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .brand-mark { font-size: 26px; }
.auth-brand .brand-sub { margin-top: 6px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-faint); font-size: 11.5px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--ink-muted); }
.auth-foot a { color: var(--accent-text); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }
.field-row { margin-bottom: 16px; }
.field-check { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; color: var(--ink-muted); }
.field-check input { width: auto; margin-top: 2px; }

/* ============================== CALL SESSION ============================== */
.call-shell { min-height: 100vh; display: flex; flex-direction: column; background: #0b0d0c; color: #f1efe9; }
.call-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; flex-wrap: wrap; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.call-topbar-left { display: flex; align-items: center; gap: 12px; }
.call-exit { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #cfcdc6; transition: background 0.18s ease; }
.call-exit:hover { background: rgba(255,255,255,0.08); }
.call-meta { display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: 12.5px; color: #cfcdc6; }
.call-timer { font-feature-settings: "tnum" 1; }
.call-cost { color: var(--accent); font-weight: 600; }

.call-stage {
    flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 40%, #14100a 0%, #0b0d0c 70%);
    min-height: 0;
}
.call-stage-placeholder { text-align: center; color: #8b8a84; }
.call-stage-placeholder .spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,0.15); border-top-color: var(--accent);
    margin: 0 auto 14px; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#remoteVideo { width: 100%; height: 100%; object-fit: cover; }

.call-pip {
    position: absolute; bottom: 20px; right: 20px;
    width: 130px; height: 174px; border-radius: 12px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15); box-shadow: var(--shadow-lg);
    background: #14100a;
}
.call-pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call-pip.cam-off { display: flex; align-items: center; justify-content: center; }
.call-pip.cam-off video { display: none; }
.call-pip-off-icon { color: #6b6a64; }

.call-controls {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    padding: 22px; border-top: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}
.call-ctrl-btn {
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.08); color: #f1efe9;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer; transition: background 0.18s ease, transform 0.12s ease;
}
.call-ctrl-btn:hover { background: rgba(255,255,255,0.14); }
.call-ctrl-btn:active { transform: scale(0.94); }
.call-ctrl-btn.is-off { background: rgba(255,255,255,0.9); color: #14100a; }
.call-ctrl-btn.end-call { width: 60px; background: var(--rust); border-color: transparent; }
.call-ctrl-btn.end-call:hover { background: var(--rust-bright); }
.call-ctrl-label { font-size: 10.5px; color: #8b8a84; text-align: center; margin-top: 6px; font-family: var(--mono); }
.call-ctrl { display: flex; flex-direction: column; align-items: center; }

.balance-track { width: 140px; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.balance-track-fill { height: 100%; background: var(--accent); transition: width 0.3s linear; }

.session-end-card { max-width: 380px; width: 100%; text-align: center; }

/* ============================== SESSION LOBBY ============================== */
.session-topcard {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; flex-wrap: nowrap; overflow-x: auto;
}
.session-topcard-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; white-space: nowrap; }
.session-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; box-shadow: 0 0 0 4px var(--accent-a18); }
.session-topcard-stats { display: flex; align-items: stretch; flex-shrink: 0; }
.session-stat { text-align: right; padding: 0 20px; white-space: nowrap; }
.session-stat + .session-stat { border-left: 1px solid var(--line-soft); }
.session-stat-value { font-family: var(--serif); font-size: 18px; color: var(--ink); margin-top: 3px; font-feature-settings: "tnum" 1; }
.session-stat-value.accent { color: var(--accent-text); }
.session-stat-value.positive { color: var(--sage-bright); }
@media (max-width: 640px) {
    .session-topcard { padding: 20px 18px; }
    .session-stat { padding: 0 14px; }
}

.video-tile {
    position: relative; aspect-ratio: 4 / 3; min-width: 0; min-height: 0;
    max-height: 340px; border-radius: var(--radius-lg);
    background: #0e100f; border: 1px solid var(--line); overflow: hidden;
}
.video-tile-label {
    position: absolute; top: 12px; left: 14px; z-index: 2;
    font-size: 12px; color: rgba(255,255,255,0.8); font-family: var(--mono);
}
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.video-tile#localTile video { transform: scaleX(-1); }
.video-tile-placeholder {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; color: #6b6a64; font-size: 13px; text-align: center; padding: 20px;
}
.video-tile-placeholder svg { opacity: 0.6; }
.mic-meter { position: absolute; left: 14px; right: 14px; bottom: 12px; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.12); z-index: 2; }
.mic-meter-fill { height: 100%; border-radius: 3px; background: var(--sage-bright); width: 4%; transition: width 0.08s linear; }
.pause-overlay {
    position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
    background: rgba(10,10,9,0.55); backdrop-filter: blur(2px);
    color: #fff; font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
}

.capture-card { border-color: var(--accent-a30); }
.capture-box {
    position: relative; aspect-ratio: 16/10; max-height: 360px;
    border-radius: var(--radius); background: #0e100f;
    border: 1px dashed var(--accent-a40);
    overflow: hidden; margin-top: 14px;
}
.capture-badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
.avatar-disclosure-label {
    position: absolute; bottom: 10px; left: 10px; z-index: 2;
    background: rgba(10,10,9,0.72); color: #fff;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
    padding: 5px 10px; border-radius: 5px; display: flex; align-items: center; gap: 6px;
}
.avatar-disclosure-label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.avatar-upload-box { position: relative; border-radius: var(--radius-lg); }
.avatar-upload-empty {
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px;
    border: 1.5px dashed var(--line-bright); border-radius: var(--radius-lg);
    padding: 36px 16px; cursor: pointer; text-align: center;
    color: var(--ink-muted); font-size: 13px; transition: border-color 0.18s ease, background 0.18s ease;
}
.avatar-upload-empty:hover { border-color: var(--accent); background: var(--accent-wash); }
.avatar-upload-empty svg { opacity: 0.6; }
.avatar-upload-hint { font-size: 11px; color: var(--ink-faint); }
.avatar-upload-preview { position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.avatar-upload-preview img { width: 100%; height: 220px; object-fit: cover; display: block; }
.avatar-upload-change {
    position: absolute; bottom: 12px; right: 12px;
    background: rgba(10,10,9,0.72); color: #fff;
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
    padding: 7px 13px; border-radius: 20px; cursor: pointer;
    transition: background 0.18s ease;
}
.avatar-upload-change:hover { background: rgba(10,10,9,0.88); }

.readonly-note {
    resize: none; background: var(--bg-lift); color: var(--ink-muted);
    font-family: var(--mono); font-size: 12px; line-height: 1.6; cursor: default;
}
.readonly-note:focus { box-shadow: none; border-color: var(--line); }
/* Sidebar unread badges (Messages, Referral) */
.nav-count {
    margin-left: auto;
    background: var(--rust);
    color: #fff;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Long message bodies must wrap, not overflow their card */
.message-body-text {
    white-space: pre-line;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Real fix for text overflowing its container: flex children default to
   min-width:auto, which lets long text push past its box even with
   word-break set on the text itself. min-width:0 lets them actually shrink
   and wrap properly. Applied to every flex row that can hold long text. */
.ledger-row, .ledger-row-main, .activity-row, .cell-user {
    min-width: 0;
}
.ledger-row-main > div:last-child,
.activity-row > div:last-child {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}
.desc, .meta, .activity-text {
    overflow-wrap: break-word;
    word-break: break-word;
}
