/* ───────────────────────────────────────────────────────────────────────────
   OTP Manager — design system
   Dark, refined SaaS dashboard aesthetic. Inter font, hairline borders,
   soft accent glow, generous spacing.
─────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* surfaces */
    --bg:           #0a0c10;
    --bg-elevated:  #11141b;
    --card:         #141821;
    --card-hover:   #1a1f2b;
    --card-active:  #1d2330;

    /* borders */
    --border:        #1f2733;
    --border-strong: #2a3344;

    /* text */
    --text:         #e8ecf2;
    --text-muted:   #8892a8;
    --text-subtle:  #5a6478;
    --text-faint:   #3d4555;

    /* accents */
    --accent:       #5b8def;
    --accent-hover: #7aa1f5;
    --accent-soft:  rgba(91, 141, 239, 0.10);
    --accent-glow:  rgba(91, 141, 239, 0.18);

    --success:      #4ade80;
    --success-soft: rgba(74, 222, 128, 0.10);
    --warning:      #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.10);
    --danger:       #f87171;
    --danger-soft:  rgba(248, 113, 113, 0.10);

    /* shadow scale (layered for depth) */
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md:    0 4px 12px rgba(0, 0, 0, 0.40), 0 1px 2px rgba(0,0,0,0.20);
    --shadow-lg:    0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0,0,0,0.30);

    /* radii */
    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;

    /* transitions */
    --t-fast:       120ms ease;
    --t-base:       180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── base ── */
* { box-sizing: border-box; }
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01', 'ss03';  /* Inter alt characters: cleaner @, 6/9, lowercase a */
    letter-spacing: -0.01em;
    background: var(--bg);
    color: var(--text);
    margin: 0;
}
.font-mono, code, pre { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; }
h1, h2, h3, h4 { letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
/* Links — match the rest of the UI instead of the browser default blue+underline.
   Templates opt back into color/underline per-link as needed. */
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* Kill the white/yellow autofill background Chrome paints over saved credentials.
   The 1000px inset shadow effectively repaints the input with our dark bg. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    caret-color: var(--text);
    transition: background-color 5000s ease-in-out 0s;
}
/* The auth card lives on var(--card), not var(--bg) — match that surface. */
.v2-auth-card input:-webkit-autofill,
.v2-auth-card input:-webkit-autofill:hover,
.v2-auth-card input:-webkit-autofill:focus,
.v2-auth-card input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg) inset !important;
}

/* ── sidebar nav ── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--t-fast), color var(--t-fast);
    text-decoration: none;
    position: relative;
}
.nav-link:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ── refined cards ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--t-fast), background var(--t-fast);
}
.card-hover:hover { background: var(--card-hover); border-color: var(--border-strong); }

/* ── toasts ── */
.toast-enter { animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.toast-exit  { animation: toastOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes toastIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

/* ── scrollbars ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4458; background-clip: content-box; }

/* thin variant for inner panels */
.scroll-thin::-webkit-scrollbar { width: 5px; height: 5px; }
.scroll-thin::-webkit-scrollbar-thumb { background: var(--border); }

/* ── form controls ── */
select option { background: var(--card); color: var(--text); }
input, textarea, select {
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

/* ── buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04) inset;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost  { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.btn-soft   { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: var(--accent-glow); }

.btn-success-soft { background: var(--success-soft); color: var(--success); }
.btn-success-soft:hover { background: rgba(74, 222, 128, 0.18); }

.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: rgba(248, 113, 113, 0.18); }

/* ── pills / badges ── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-danger  { background: var(--danger-soft);  color: var(--danger); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-accent  { background: var(--accent-soft);  color: var(--accent); }
.pill-muted   { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ── fade-in helper ── */
.fade-in { animation: fadeIn 0.22s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── pulse for live indicators ── */
.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 var(--success);
    animation: pulseRing 2s infinite;
}
@keyframes pulseRing {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ── kbd / code chips ── */
kbd, .kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    padding: 0.0625rem 0.375rem;
    background: var(--card-active);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   v2 — mobile-first dashboard system
   Added 2026-06-11. Existing classes above kept for back-compat during rollout.
═══════════════════════════════════════════════════════════════════════════ */

/* Safe-area aware paddings so floating bars clear iOS notch/home-indicator */
:root {
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --bottom-nav-h: 68px;
    --topbar-h: 56px;
    --bar-inset: 10px;   /* margin around floating bars on mobile */
    --bar-max-w: 820px;  /* desktop cap so bars don't stretch ugly on wide monitors */
}

/* ── Layout helpers ── */
.v2-app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.v2-main {
    flex: 1;
    padding: 16px;
    /* Top padding clears the fixed topbar. JS in base.html overrides this with
       the topbar's actual measured height when a subheader is present. The
       fallback here covers the topbar-only case (no subheader). */
    padding-top: calc(var(--topbar-h) + 16px);
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .v2-main {
        padding: 24px;
        padding-top: calc(var(--topbar-h) + 24px);
        padding-bottom: calc(var(--bottom-nav-h) + 24px);
    }
}

/* ── Top app bar (floating rounded pill, matches bottom-nav)
   Flex column: a compact .v2-topbar-row up top + an optional .v2-subheader
   filled by each page. JS measures total height and sets .v2-main padding. ── */
.v2-topbar {
    position: fixed;
    top: calc(var(--safe-top) + var(--bar-inset));
    left: var(--bar-inset);
    right: var(--bar-inset);
    max-width: var(--bar-max-w);
    margin: 0 auto;
    z-index: 30;
    display: flex; flex-direction: column;
    /* Glass: deeper saturation + slight gradient gives a more premium feel */
    background:
        linear-gradient(180deg, rgba(22, 26, 36, 0.92), rgba(15, 18, 26, 0.88)),
        rgba(15, 18, 26, 0.85);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    /* Layered shadow: tight ambient + soft drop + inner highlight */
    box-shadow:
        0 1px 2px rgba(0,0,0,0.6),
        0 18px 44px -18px rgba(0,0,0,0.85),
        inset 0 1px 0 rgba(255,255,255,0.06);
    overflow: hidden;
}
.v2-topbar-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    min-height: var(--topbar-h);
}
.v2-subheader {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 8px 14px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.v2-subheader-title { flex: 1; min-width: 0; padding-top: 2px; }
.v2-subheader-title h2 {
    font-size: 22px; font-weight: 700; color: var(--text);
    letter-spacing: -0.028em; line-height: 1.1;
}
.v2-subheader-title p {
    font-size: 12px; color: var(--text-subtle); margin-top: 4px;
    line-height: 1.4;
}
/* Subheader can host the search bar with zero extra top margin */
.v2-subheader .v2-search { margin: 0; width: 100%; }
/* Subheader column variant — stacks rows vertically (e.g. title-row + search) */
.v2-subheader-col {
    flex-direction: column; align-items: stretch; gap: 10px;
}
.v2-topbar-title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.v2-topbar-sub   { font-size: 11px; color: var(--text-subtle); }

/* ── Stat tile (the core dashboard primitive) ── */
.v2-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 6px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.v2-stat:hover { border-color: var(--border-strong); }
.v2-stat-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.v2-stat-value { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.v2-stat-meta  { font-size: 11px; color: var(--text-muted); }
.v2-stat-icon  {
    position: absolute; right: 12px; top: 12px;
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Hero variant for the primary OTP card */
.v2-stat-hero {
    background: linear-gradient(180deg, rgba(74,222,128,0.10), rgba(74,222,128,0.02) 60%), var(--card);
    border-color: rgba(74,222,128,0.25);
}
.v2-stat-hero .v2-stat-value { color: var(--success); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.06em; }
.v2-stat-hero .v2-stat-label { color: var(--success); }

/* 2/3/4-up responsive grid */
.v2-grid { display: grid; gap: 10px; }
.v2-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v2-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .v2-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.v2-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .v2-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── Section header ── */
.v2-section-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 6px 10px;
    margin-top: 16px;
}
.v2-section-title {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    letter-spacing: 0.08em; text-transform: uppercase;
}
.v2-section-aside { font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

/* ── List card (email/account rows) ── */
.v2-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.v2-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--t-fast);
    min-height: 64px;
    -webkit-tap-highlight-color: transparent;
}
.v2-row:last-child { border-bottom: none; }
.v2-row:hover, .v2-row:active { background: var(--card-hover); }
.v2-row-avatar {
    width: 40px; height: 40px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.15);
}
.v2-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.v2-row-top  { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v2-row-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-row-time { font-size: 10px; color: var(--text-subtle); white-space: nowrap; flex-shrink: 0; }
.v2-row-subject { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-row-otp {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px; font-weight: 700;
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid rgba(74,222,128,0.25);
    padding: 1px 7px; border-radius: 999px;
    letter-spacing: 0.05em;
}

/* Empty state */
.v2-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 20px; text-align: center; gap: 8px;
}
.v2-empty-icon {
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--card-active); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-faint); margin-bottom: 4px;
}
.v2-empty-title { font-size: 14px; font-weight: 600; color: var(--text); }
.v2-empty-text  { font-size: 12px; color: var(--text-subtle); max-width: 280px; }

/* ── Search input ── */
.v2-search {
    position: relative;
    margin: 12px 0;
}
.v2-search input {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 11px 14px 11px 38px;
    color: var(--text);
    font-size: 14px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    -webkit-appearance: none;
    appearance: none;
}
.v2-search input::placeholder { color: var(--text-subtle); }
.v2-search input:hover { border-color: var(--border-strong); }
.v2-search input:focus {
    border-color: var(--accent);
    background: var(--card-hover);
    box-shadow: 0 0 0 4px var(--accent-glow);
    outline: none;
}
.v2-search svg {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--text-subtle);
    pointer-events: none;
}

/* ── Bottom nav bar (floating rounded pill, horizontal icon+text buttons) ── */
.v2-bottom-nav {
    position: fixed;
    left: var(--bar-inset);
    right: var(--bar-inset);
    bottom: calc(var(--safe-bottom) + var(--bar-inset));
    max-width: var(--bar-max-w);
    margin: 0 auto;
    z-index: 40;
    display: flex; align-items: stretch; gap: 4px;
    padding: 6px;
    background:
        linear-gradient(180deg, rgba(22, 26, 36, 0.92), rgba(15, 18, 26, 0.88)),
        rgba(15, 18, 26, 0.85);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.6),
        0 -18px 44px -18px rgba(0,0,0,0.5),
        0 18px 44px -18px rgba(0,0,0,0.85),
        inset 0 1px 0 rgba(255,255,255,0.06);
}
.v2-bottom-nav-item {
    flex: 1;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 11px 12px;
    border-radius: 14px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-subtle);
    font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
    text-decoration: none;
    cursor: pointer;
    min-height: 46px;
    white-space: nowrap;
    transition:
        background var(--t-fast),
        color var(--t-fast),
        border-color var(--t-fast),
        box-shadow var(--t-fast),
        transform var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}
.v2-bottom-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.v2-bottom-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.v2-bottom-nav-item:active { transform: scale(0.97); }

/* Active / primary: blue gradient with glowing border — matches the mockup */
.v2-bottom-nav-item.active,
.v2-bottom-nav-item.primary {
    background: linear-gradient(180deg, rgba(91,141,239,0.32), rgba(91,141,239,0.10));
    border-color: rgba(91,141,239,0.65);
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.14),
        inset 0 0 0 1px rgba(91,141,239,0.22),
        0 10px 24px -8px rgba(91,141,239,0.55),
        0 0 22px -10px rgba(91,141,239,0.6);
}
.v2-bottom-nav-item:disabled { opacity: 0.45; cursor: not-allowed; }
.v2-spin { animation: v2-spin 0.9s linear infinite; }
@keyframes v2-spin { to { transform: rotate(360deg); } }

/* On very narrow screens, hide the labels — icons remain visible */
@media (max-width: 360px) {
    .v2-bottom-nav-item span:not(.v2-keep) { display: none; }
}

/* ── Desktop (admin only): solid full-width bars instead of floating pills.
   Scoped to .admin-app so the customer portal keeps its floating design at all
   widths. Mobile/tablet (< 1024px) keep the floating pills too. Only the bar
   chrome changes — the account list, all behavior, and the JS padding-sync
   (which measures the bars live) are unaffected. Bar inner content is centered
   to the same 760px column as .v2-main so it aligns with the list. ── */
@media (min-width: 1024px) {
    .admin-app .v2-topbar {
        top: 0; left: 0; right: 0;
        max-width: none; margin: 0;
        border: none;
        border-bottom: 1px solid var(--border-strong);
        border-radius: 0;
        background: var(--bg-elevated);
        backdrop-filter: none; -webkit-backdrop-filter: none;
        box-shadow: 0 1px 0 rgba(0,0,0,0.5), 0 10px 28px -20px rgba(0,0,0,0.85);
        padding: 0 max(0px, calc((100% - 760px) / 2));
    }
    .admin-app .v2-bottom-nav {
        bottom: 0; left: 0; right: 0;
        max-width: none; margin: 0;
        border: none;
        border-top: 1px solid var(--border-strong);
        border-radius: 0;
        background: var(--bg-elevated);
        backdrop-filter: none; -webkit-backdrop-filter: none;
        box-shadow: 0 -1px 0 rgba(0,0,0,0.5), 0 -10px 28px -20px rgba(0,0,0,0.85);
        padding: 8px max(8px, calc((100% - 760px) / 2));
    }
}

/* ── Big copy button (OTP) ── */
.v2-copy-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.30);
    color: var(--success);
    font-size: 11px; font-weight: 600;
    border-radius: 8px;
    cursor: pointer; user-select: none;
    transition: background var(--t-fast), transform var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}
.v2-copy-btn:hover { background: rgba(74,222,128,0.18); }
.v2-copy-btn:active { transform: scale(0.96); }

/* ── Auth card (login pages) ── */
.v2-auth-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px 16px;
    padding-bottom: calc(20px + var(--safe-bottom));
}
.v2-auth-card {
    width: 100%; max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px 22px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7), 0 2px 6px rgba(0,0,0,0.4);
}
.v2-auth-brand-icon {
    width: 48px; height: 48px; border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #6ee7b7);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 8px 24px -8px rgba(91,141,239,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
    margin: 0 auto 14px;
}
.v2-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.v2-input:hover { border-color: var(--border-strong); }
.v2-input:focus {
    border-color: var(--accent);
    background: var(--card);
    box-shadow: 0 0 0 4px var(--accent-glow);
    outline: none;
}
.v2-input::placeholder { color: var(--text-faint); }
.v2-input-mono { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em; }
.v2-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.v2-btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(180deg, var(--accent), #4a7be0);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
    box-shadow: 0 4px 12px -4px rgba(91,141,239,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    line-height: 1;
    white-space: nowrap;
}
.v2-btn-primary svg { flex-shrink: 0; }
.v2-btn-primary:hover { box-shadow: 0 6px 16px -4px rgba(91,141,239,0.6), inset 0 1px 0 rgba(255,255,255,0.2); }
.v2-btn-primary:active { transform: scale(0.98); }
.v2-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Inline alert */
.v2-alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    border: 1px solid;
    display: flex; align-items: flex-start; gap: 8px;
}
.v2-alert-danger { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); color: #fca5a5; }

/* ── Row actions (square rounded icon buttons, used in account rows) ── */
.v2-row-action {
    width: 38px; height: 38px;
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--card-active);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
    -webkit-tap-highlight-color: transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.v2-row-action:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--card-hover);
}
.v2-row-action:active { transform: scale(0.95); }
.v2-row-action.danger {
    color: var(--danger);
    background: rgba(248,113,113,0.08);
    border-color: rgba(248,113,113,0.22);
}
.v2-row-action.danger:hover { background: rgba(248,113,113,0.16); border-color: rgba(248,113,113,0.35); color: var(--danger); }

/* ── Color-tied Quick-link button (row-specific accent via inline style)
   Inline style sets --ql-bg / --ql-fg / --ql-border based on the avatar hash ── */
.v2-quick-link {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px 9px 12px;
    border-radius: 10px;
    background: var(--ql-bg, rgba(91,141,239,0.12));
    border: 1px solid var(--ql-border, rgba(91,141,239,0.30));
    color: var(--ql-fg, #7eaffb);
    font-size: 12px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    -webkit-tap-highlight-color: transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.v2-quick-link svg { flex-shrink: 0; }
.v2-quick-link:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 6px 18px -8px var(--ql-fg, #7eaffb);
}
.v2-quick-link:active { transform: translateY(0); }

/* ── Search + inline filter button ── */
.v2-search-group { display: flex; gap: 8px; width: 100%; }
.v2-search-group .v2-search { flex: 1; margin: 0; }
.v2-filter-btn {
    flex-shrink: 0;
    width: 44px; height: 44px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}
.v2-filter-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* Compact "Add" button used in subheaders — sits next to the page title.
   Cleaner than the v2-btn-primary block button for this context. */
.v2-add-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px 9px 11px;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--accent), #4a7be0);
    color: #fff;
    font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
    border: 1px solid rgba(91,141,239,0.5);
    cursor: pointer;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 6px 18px -8px rgba(91,141,239,0.6),
        0 1px 2px rgba(0,0,0,0.3);
    transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
    -webkit-tap-highlight-color: transparent;
    min-height: 38px;
}
.v2-add-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.v2-add-btn:hover {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.22),
        0 10px 24px -8px rgba(91,141,239,0.7),
        0 1px 2px rgba(0,0,0,0.3);
}
.v2-add-btn:active { transform: scale(0.97); }

/* Avatar palette helper class for inline style users */
.v2-pill-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px; font-weight: 600;
    background: var(--success-soft); color: var(--success);
    border: 1px solid rgba(74,222,128,0.25);
}
.v2-pill-status .v2-pill-dot {
    width: 5px; height: 5px; border-radius: 50%; background: var(--success);
    box-shadow: 0 0 8px rgba(74,222,128,0.6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Light / Day theme — opt-in via <html data-theme="light">.
   Dark stays the DEFAULT (no attribute). Purely additive: we re-point the
   color tokens and override the handful of hardcoded-dark surfaces (the
   floating bars, the body background, a few Tailwind static utilities) so
   nothing needs restructuring. Toggle button + icon swap live at the bottom.
═══════════════════════════════════════════════════════════════════════════ */
html[data-theme="light"] {
    /* surfaces — canvas is a soft cool grey so pure-white cards/bars lift off it */
    --bg:           #e7ebf3;
    --bg-elevated:  #ffffff;
    --card:         #ffffff;
    --card-hover:   #f3f6fc;
    --card-active:  #e9edf6;

    /* borders — visible enough to read as crisp edges, not hairline ghosts */
    --border:        #d5dce9;
    --border-strong: #bcc6d8;

    /* text — deep ink for crisp contrast, clear muted/subtle hierarchy */
    --text:         #121826;
    --text-muted:   #4f5a73;
    --text-subtle:  #737e96;
    --text-faint:   #97a1b6;

    /* accents — blue keeps its hue; greens/reds darkened for contrast on white */
    --accent-soft:  rgba(91, 141, 239, 0.12);
    --accent-glow:  rgba(91, 141, 239, 0.22);

    --success:      #15a349;
    --success-soft: rgba(21, 163, 73, 0.12);
    --warning:      #b7791f;
    --warning-soft: rgba(183, 121, 31, 0.14);
    --danger:       #dc4c4c;
    --danger-soft:  rgba(220, 76, 76, 0.10);

    /* shadows — cool, layered depth (the flat washed-out look came from these
       being too weak) */
    --shadow-sm:    0 1px 2px rgba(30, 45, 80, 0.08);
    --shadow-md:    0 4px 14px -4px rgba(30, 45, 80, 0.14), 0 1px 2px rgba(30, 45, 80, 0.06);
    --shadow-lg:    0 16px 48px -12px rgba(30, 45, 80, 0.22), 0 2px 8px rgba(30, 45, 80, 0.08);
}

/* Page background: every template hardcodes a dark body bg in its inline
   <style>; this higher-specificity rule flips both the bg and the default
   (Tailwind text-white) text color for light mode. A pair of soft brand
   radials give the canvas depth instead of a flat wash. */
html[data-theme="light"] body {
    background:
        radial-gradient(ellipse 70% 55% at 50% -10%, rgba(91,141,239,0.12), transparent 60%),
        radial-gradient(ellipse 55% 45% at 92% 6%, rgba(74,222,128,0.06), transparent 62%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
}
/* Elements explicitly classed text-white (Tailwind static #fff) → dark on light.
   Does NOT match hover:text-white, so white-on-dark hover pairs stay intact. */
html[data-theme="light"] .text-white { color: var(--text); }
/* A couple of Tailwind static-dark utilities that sit on light surfaces */
html[data-theme="light"] .border-border { border-color: var(--border); }
html[data-theme="light"] .bg-bg-elevated\/40 { background-color: rgba(233,237,246,0.7); }

/* Floating bars: their glass bg/border/shadow are hardcoded dark. Give them a
   crisp edge + real layered elevation so they read as premium floating pills
   (top gets a downward drop; bottom gets an upward lift). */
html[data-theme="light"] .v2-topbar {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,253,0.93)),
        rgba(255,255,255,0.9);
    border-color: rgba(120,135,165,0.32);
    box-shadow:
        0 1px 1px rgba(30,45,80,0.05),
        0 10px 30px -8px rgba(30,45,80,0.20),
        0 22px 50px -20px rgba(30,45,80,0.22),
        inset 0 1px 0 rgba(255,255,255,0.95);
}
html[data-theme="light"] .v2-bottom-nav {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.97), rgba(246,249,253,0.93)),
        rgba(255,255,255,0.9);
    border-color: rgba(120,135,165,0.32);
    box-shadow:
        0 1px 1px rgba(30,45,80,0.05),
        0 -8px 26px -10px rgba(30,45,80,0.16),
        0 14px 36px -14px rgba(30,45,80,0.20),
        inset 0 1px 0 rgba(255,255,255,0.95);
}
html[data-theme="light"] .v2-subheader { border-top-color: rgba(120,135,165,0.20); }

/* Bottom nav: darker inactive labels + a SOLID saturated blue active pill with
   white text (the old translucent-blue pill left white text unreadable). */
html[data-theme="light"] .v2-bottom-nav-item { color: var(--text-muted); }
html[data-theme="light"] .v2-bottom-nav-item:hover { color: var(--text); background: rgba(30,45,80,0.05); }
html[data-theme="light"] .v2-bottom-nav-item.active,
html[data-theme="light"] .v2-bottom-nav-item.primary {
    background: linear-gradient(180deg, #5b8def, #466fd6);
    border-color: rgba(70,111,214,0.85);
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.40),
        0 8px 18px -6px rgba(70,111,214,0.50),
        0 2px 6px rgba(70,111,214,0.35);
}

/* Cards / lists / stat tiles: lift them off the canvas with a soft shadow
   (the dark theme leaned on a dark drop-shadow that reads harsh on white). */
html[data-theme="light"] .v2-list {
    box-shadow: 0 1px 2px rgba(30,45,80,0.05), 0 8px 24px -12px rgba(30,45,80,0.14);
}
html[data-theme="light"] .v2-stat {
    box-shadow: 0 1px 2px rgba(30,45,80,0.04), 0 6px 18px -10px rgba(30,45,80,0.12);
}
html[data-theme="light"] .v2-stat-icon { background: rgba(30,45,80,0.05); }

/* Recessed search field so it separates from the white bar it sits inside */
html[data-theme="light"] .v2-search input { background: var(--bg); }
html[data-theme="light"] .v2-search input:focus { background: #fff; }

html[data-theme="light"] .v2-auth-card {
    box-shadow: 0 20px 55px -20px rgba(30,45,80,0.24), 0 3px 10px rgba(30,45,80,0.09);
}
html[data-theme="light"] .v2-alert-danger {
    color: #b91c1c; background: rgba(220,76,76,0.08); border-color: rgba(220,76,76,0.30);
}

/* ── Theme toggle button (sun in dark mode → tap for day; moon in light mode) ── */
.v2-theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.v2-theme-toggle:hover { background: var(--card-active); color: var(--text); }
.v2-theme-toggle svg { width: 18px; height: 18px; }
.v2-theme-toggle .theme-ico-moon { display: none; }
html[data-theme="light"] .v2-theme-toggle .theme-ico-sun  { display: none; }
html[data-theme="light"] .v2-theme-toggle .theme-ico-moon { display: block; }

/* Fixed variant for the login pages (no top bar to live in) */
.v2-theme-toggle--fixed {
    position: fixed;
    top: calc(var(--safe-top) + 14px);
    right: 14px;
    z-index: 45;
    background: var(--card);
    border-color: var(--border);
}
.v2-theme-toggle--fixed:hover { border-color: var(--border-strong); }
