/* ════════════════════════════════════════════════════════════
   A NAM INVOICE — THEME SKIN (light + dark)

   Every rule below is scoped to  :root:not([data-theme='dark'])  so:
     · no attribute, or data-theme="light"  ->  light skin (the default,
       exactly what users see today)
     · data-theme="dark"                    ->  these rules switch off and
       each page's own dark design shows through

   The theme is set on <html> before first paint by partials/theme.php,
   so there is never a flash of the wrong theme.
   ════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════
   A NAM INVOICE — GLOBAL LIGHT THEME (eye-friendly)
   Palette: white background · light blue · orange · light green
   Loaded AFTER each page's own styles, it re-maps the shared design
   tokens and repaints the few hard-coded dark surfaces. The layout,
   spacing and components of every page stay exactly as designed.
   ════════════════════════════════════════════════════════════════ */

:root:not([data-theme='dark']) {
    /* ── App & Admin token remap ─────────────────────────────── */
    --navy:        #F3F8FC !important;   /* page background          */
    --navy-deep:   #FFFFFF !important;   /* deepest surface → white  */
    --navy-mid:    #FFFFFF !important;   /* cards / modals           */
    --navy-light:  #EAF3FA !important;   /* raised surface           */
    --accent:      #2D9CDB !important;   /* light blue               */
    --accent2:     #34B96F !important;   /* light green              */
    --accent-gold: #F5820D !important;   /* orange                   */
    --accent-purple:#7C6FD9 !important;
    --accent-red:  #C62828 !important;
    --glass-bg:    #FFFFFF !important;
    --glass-border:rgba(19,52,90,.12) !important;
    --glass-bright:rgba(19,52,90,.18) !important;
    --text-primary:#0B2545 !important;
    --text-muted:  #14406B !important;
    --text-faint:  #2E5A86 !important;
    --shadow:      0 6px 22px rgba(30,80,140,.10), 0 1px 4px rgba(30,80,140,.06) !important;
    --shadow-lg:   0 14px 40px rgba(30,80,140,.14) !important;

    /* ── Landing token remap ─────────────────────────────────── */
    --ink:      #F6FAFE !important;
    --ink-2:    #FFFFFF !important;
    --glass:    #FFFFFF !important;
    --glass-b:  rgba(19,52,90,.13) !important;
    --glass-b2: rgba(19,52,90,.09) !important;
    --cyan:     #2D9CDB !important;
    --cyan-d:   #1E7BB0 !important;
    --teal:     #34B96F !important;    /* light green */
    --teal-d:   #269D5B !important;
    --amber:    #F5820D !important;    /* orange */
    --amber-d:  #D96F06 !important;
    --text:     #0B2545 !important;
    --text-2:   #14406B !important;
    --text-3:   #2E5A86 !important;
    --glow-c:   0 4px 16px rgba(45,156,219,.22) !important;
    --glow-t:   0 4px 16px rgba(52,185,111,.24) !important;
    --glow-a:   0 4px 16px rgba(245,130,13,.22) !important;
}

/* ── Base ─────────────────────────────────────────────────────── */
:root:not([data-theme='dark']) body {
    background: #F3F8FC !important;
    color: #0B2545 !important;
}
/* soft pastel ambience instead of dark radial glows */
:root:not([data-theme='dark']) body::before {
    background:
        radial-gradient(ellipse 80% 55% at 15% 8%,  rgba(45,156,219,.09) 0%, transparent 60%),
        radial-gradient(ellipse 55% 45% at 88% 90%, rgba(52,185,111,.08) 0%, transparent 55%),
        radial-gradient(ellipse 40% 35% at 60% 45%, rgba(245,130,13,.05) 0%, transparent 55%) !important;
}
:root:not([data-theme='dark']) .bg-shape { opacity: .5 !important; }

:root:not([data-theme='dark']) ::selection { background: rgba(45,156,219,.22); }
:root:not([data-theme='dark']) *::-webkit-scrollbar { width: 8px; height: 8px; }
:root:not([data-theme='dark']) *::-webkit-scrollbar-track { background: transparent !important; }
:root:not([data-theme='dark']) *::-webkit-scrollbar-thumb { background: rgba(19,52,90,.18) !important; border-radius: 6px; }

/* ── Sidebar / overlay / bottom nav ───────────────────────────── */
:root:not([data-theme='dark']) .sidebar {
    background: #FFFFFF !important;
    border-right: 1px solid rgba(19,52,90,.10) !important;
    box-shadow: 8px 0 40px rgba(30,80,140,.12) !important;
}
:root:not([data-theme='dark']) .sidebar-overlay { background: rgba(22,50,77,.35) !important; backdrop-filter: blur(4px) !important; }
:root:not([data-theme='dark']) .sidebar::-webkit-scrollbar-thumb { background: rgba(19,52,90,.15) !important; }
:root:not([data-theme='dark']) .sidebar-nav a { color: #14406B !important; }
:root:not([data-theme='dark']) .sidebar-nav a:hover,
:root:not([data-theme='dark']) .sidebar-nav a.active {
    background: #EAF4FB !important;
    color: #0B2545 !important;
    border-color: rgba(45,156,219,.25) !important;
}
:root:not([data-theme='dark']) .sidebar-nav a i { font-size: 14px !important; }
:root:not([data-theme='dark']) .sidebar-header h2 { color: #14406B !important; }
:root:not([data-theme='dark']) .logo-wrap {
    background: linear-gradient(135deg, rgba(45,156,219,.14), rgba(52,185,111,.10)) !important;
    border-color: rgba(45,156,219,.30) !important;
    box-shadow: 0 4px 14px rgba(45,156,219,.15) !important;
}
:root:not([data-theme='dark']) .bottom-nav {
    background: #FFFFFF !important;
    border-top: 1px solid rgba(19,52,90,.10) !important;
    box-shadow: 0 -6px 24px rgba(30,80,140,.10) !important;
}
/* `.bn-item` covers the Menu tab, which is a <button>, not a link — without
   it that one tab stayed default black while the rest turned slate blue. */
:root:not([data-theme='dark']) .bottom-nav a,
:root:not([data-theme='dark']) .bottom-nav .bn-item { color: #2E5A86 !important; }
:root:not([data-theme='dark']) .bottom-nav a.active,
:root:not([data-theme='dark']) .bottom-nav a.on,
:root:not([data-theme='dark']) .bottom-nav .bn-item.active { color: #2D9CDB !important; }

/* ── Top bar / header / page titles ───────────────────────────── */
:root:not([data-theme='dark']) .top-bar,
:root:not([data-theme='dark']) .header {
    background: rgba(255,255,255,.92) !important;
    border-bottom: 1px solid rgba(19,52,90,.10) !important;
    box-shadow: 0 2px 10px rgba(30,80,140,.05) !important;
}
:root:not([data-theme='dark']) .page-title h1,
:root:not([data-theme='dark']) .greeting h1,
:root:not([data-theme='dark']) .greeting h2,
:root:not([data-theme='dark']) h1[class*="gradient"],
:root:not([data-theme='dark']) .grad-text {
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: #0B2545 !important;
    color: #0B2545 !important;
}
:root:not([data-theme='dark']) .greeting,
:root:not([data-theme='dark']) .greeting p { color: #14406B !important; }

/* ── Dropdowns / notifications / modals ───────────────────────── */
:root:not([data-theme='dark']) .notification-dropdown,
:root:not([data-theme='dark']) .modal-content,
:root:not([data-theme='dark']) .modal-box,
:root:not([data-theme='dark']) .dropdown-menu,
:root:not([data-theme='dark']) .user-dropdown {
    background: #FFFFFF !important;
    border: 1px solid rgba(19,52,90,.12) !important;
    box-shadow: 0 18px 48px rgba(30,80,140,.18) !important;
    color: #0B2545 !important;
}
:root:not([data-theme='dark']) .notification-item:hover { background: rgba(45,156,219,.07) !important; }
:root:not([data-theme='dark']) .notification-item.unread { background: rgba(52,185,111,.07) !important; }
:root:not([data-theme='dark']) .notification-title { color: #0B2545 !important; }
:root:not([data-theme='dark']) .notification-item.unread .notification-title { color: #0F2A44 !important; }
:root:not([data-theme='dark']) .modal-overlay,
:root:not([data-theme='dark']) .modal-backdrop { background: rgba(22,50,77,.40) !important; }
:root:not([data-theme='dark']) .notif-badge { border-color: #FFFFFF !important; }

/* ── Cards & panels (glass → clean white) ─────────────────────── */
:root:not([data-theme='dark']) .stat-card,
:root:not([data-theme='dark']) .welcome-card,
:root:not([data-theme='dark']) .card,
:root:not([data-theme='dark']) .glass-card,
:root:not([data-theme='dark']) .panel,
:root:not([data-theme='dark']) .table-card,
:root:not([data-theme='dark']) .chart-card,
:root:not([data-theme='dark']) .content-card,
:root:not([data-theme='dark']) .form-card,
:root:not([data-theme='dark']) .list-card,
:root:not([data-theme='dark']) .info-card,
:root:not([data-theme='dark']) .summary-card,
:root:not([data-theme='dark']) .pnl-card,
:root:not([data-theme='dark']) .filter-bar,
:root:not([data-theme='dark']) .inv-card,
:root:not([data-theme='dark']) .settings-card,
:root:not([data-theme='dark']) .section-card,
:root:not([data-theme='dark']) .box-card,
:root:not([data-theme='dark']) .data-card,
:root:not([data-theme='dark']) .quick-card,
:root:not([data-theme='dark']) .action-card {
    background: #FFFFFF !important;
    border: 1px solid rgba(19,52,90,.10) !important;
    box-shadow: 0 6px 22px rgba(30,80,140,.08) !important;
}
:root:not([data-theme='dark']) .stat-card:hover { box-shadow: 0 12px 30px rgba(30,80,140,.14) !important; }
:root:not([data-theme='dark']) .welcome-card {
    background: linear-gradient(140deg, rgba(45,156,219,.10) 0%, rgba(52,185,111,.06) 100%) !important;
    border: 1px solid rgba(45,156,219,.18) !important;
}

/* ── Tables ───────────────────────────────────────────────────── */
:root:not([data-theme='dark']) table { color: #0B2545 !important; }
:root:not([data-theme='dark']) th { color: #14406B !important; background: #F0F6FB !important; }
:root:not([data-theme='dark']) td { border-color: rgba(19,52,90,.08) !important; }
:root:not([data-theme='dark']) tr:hover td { background: rgba(45,156,219,.05) !important; }

/* ── Forms ────────────────────────────────────────────────────── */
:root:not([data-theme='dark']) input,
:root:not([data-theme='dark']) select,
:root:not([data-theme='dark']) textarea {
    background: #FFFFFF !important;
    color: #0B2545 !important;
    border-color: rgba(19,52,90,.18) !important;
}
:root:not([data-theme='dark']) input::placeholder,
:root:not([data-theme='dark']) textarea::placeholder { color: #6A89A5 !important; }
:root:not([data-theme='dark']) input:focus,
:root:not([data-theme='dark']) select:focus,
:root:not([data-theme='dark']) textarea:focus {
    border-color: #2D9CDB !important;
    box-shadow: 0 0 0 3px rgba(45,156,219,.15) !important;
}
:root:not([data-theme='dark']) select option,
:root:not([data-theme='dark']) .form-group select option,
:root:not([data-theme='dark']) .inline-form select option {
    background: #FFFFFF !important;
    color: #0B2545 !important;
}
:root:not([data-theme='dark']) label,
:root:not([data-theme='dark']) .form-label { color: #14406B !important; }

/* ── Buttons: keep accents, ensure readable text ──────────────── */
:root:not([data-theme='dark']) .btn-start,
:root:not([data-theme='dark']) .btn-hero-primary,
:root:not([data-theme='dark']) .dbtn-fill,
:root:not([data-theme='dark']) .pwa-btn {
    background: linear-gradient(135deg, #34B96F, #269D5B) !important;
    color: #FFFFFF !important;
}
:root:not([data-theme='dark']) .pop-badge { color: #FFFFFF !important; }
:root:not([data-theme='dark']) a.btn-login,
:root:not([data-theme='dark']) .btn-hero-sec,
:root:not([data-theme='dark']) .dbtn-out {
    color: #0B2545 !important;
    border-color: rgba(19,52,90,.22) !important;
    background: #FFFFFF !important;
}
/* the auth form submit button also uses .btn-login — keep it a solid primary */
:root:not([data-theme='dark']) button.btn-login,
:root:not([data-theme='dark']) .login-card button[type="submit"],
:root:not([data-theme='dark']) .auth-card button[type="submit"] {
    background: linear-gradient(135deg, #2D9CDB, #1E7BB0) !important;
    color: #FFFFFF !important;
    border: none !important;
    box-shadow: 0 6px 18px rgba(45,156,219,.30) !important;
}

/* ── Public site chrome ───────────────────────────────────────── */
:root:not([data-theme='dark']) .site-header { background: rgba(255,255,255,.88) !important; border-bottom: 1px solid rgba(19,52,90,.09) !important; }
:root:not([data-theme='dark']) .site-header.scrolled { background: rgba(255,255,255,.97) !important; box-shadow: 0 8px 28px rgba(30,80,140,.10) !important; }
:root:not([data-theme='dark']) .nav-desk a { color: #14406B !important; }
:root:not([data-theme='dark']) .nav-desk a.active,
:root:not([data-theme='dark']) .nav-desk a:hover { color: #2D9CDB !important; }
:root:not([data-theme='dark']) .drawer { background: #FFFFFF !important; border-left: 1px solid rgba(19,52,90,.10) !important; }
:root:not([data-theme='dark']) .drawer a { color: #14406B !important; }
:root:not([data-theme='dark']) .drawer-bg { background: rgba(22,50,77,.40) !important; }
:root:not([data-theme='dark']) .loader-wrap { background: #F6FAFE !important; }
:root:not([data-theme='dark']) .stats-bar {
    background: #FFFFFF !important;
    border-top: 1px solid rgba(19,52,90,.08) !important;
    border-bottom: 1px solid rgba(19,52,90,.08) !important;
}
:root:not([data-theme='dark']) .ph-shell {
    background: #FFFFFF !important;
    border-color: rgba(19,52,90,.14) !important;
    box-shadow: 0 20px 44px rgba(30,80,140,.16) !important;
}
:root:not([data-theme='dark']) .ph-screen { background: linear-gradient(160deg, rgba(45,156,219,.05), rgba(52,185,111,.03)) !important; }
:root:not([data-theme='dark']) .ph-screen text { fill: #0B2545 !important; }

/* footer (dark on public pages) */
:root:not([data-theme='dark']) .site-footer,
:root:not([data-theme='dark']) footer.footer,
:root:not([data-theme='dark']) .landing-footer {
    background: #EDF4FA !important;
    color: #14406B !important;
    border-top: 1px solid rgba(19,52,90,.09) !important;
}
:root:not([data-theme='dark']) .site-footer a,
:root:not([data-theme='dark']) footer.footer a { color: #14406B !important; }
:root:not([data-theme='dark']) .site-footer a:hover,
:root:not([data-theme='dark']) footer.footer a:hover { color: #2D9CDB !important; }

/* ── Charts / misc ────────────────────────────────────────────── */
:root:not([data-theme='dark']) .chip-lbl,
:root:not([data-theme='dark']) .stat-l,
:root:not([data-theme='dark']) .ph-ms-l { color: #2E5A86 !important; }
:root:not([data-theme='dark']) .stat-n,
:root:not([data-theme='dark']) .chip-val,
:root:not([data-theme='dark']) .ph-ms-v { color: #0B2545 !important; }
:root:not([data-theme='dark']) .empty-state,
:root:not([data-theme='dark']) .empty-notifications { color: #2E5A86 !important; }
:root:not([data-theme='dark']) hr,
:root:not([data-theme='dark']) .nav-divider,
:root:not([data-theme='dark']) .drawer-sep { background: rgba(19,52,90,.10) !important; }

/* subtle badges keep their tinted look on white */
:root:not([data-theme='dark']) .plan-badge { background: rgba(45,156,219,.10) !important; }
:root:not([data-theme='dark']) .time-badge { background: #F0F6FB !important; color: #2E5A86 !important; border-color: rgba(19,52,90,.10) !important; }

/* keep icons compact & crisp */
:root:not([data-theme='dark']) .stat-icon { font-size: 13px !important; }
:root:not([data-theme='dark']) .top-right .notif-btn i { color: #14406B !important; }

/* ── Auth pages (login / signup) ─────────────────────────────── */
:root:not([data-theme='dark']) .brand-content h2,
:root:not([data-theme='dark']) .auth-title,
:root:not([data-theme='dark']) .login-title {
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: #0B2545 !important;
    color: #0B2545 !important;
}
:root:not([data-theme='dark']) .support-login-btn a,
:root:not([data-theme='dark']) .back-to-top {
    background: #FFFFFF !important;
    color: #0B2545 !important;
    border: 1px solid rgba(19,52,90,.18) !important;
    box-shadow: 0 6px 20px rgba(30,80,140,.14) !important;
}
:root:not([data-theme='dark']) .login-card,
:root:not([data-theme='dark']) .auth-card,
:root:not([data-theme='dark']) .signup-card,
:root:not([data-theme='dark']) .form-side,
:root:not([data-theme='dark']) .auth-box {
    background: #FFFFFF !important;
    border-color: rgba(19,52,90,.12) !important;
}

/* Business Suite feature cards stack on small screens */
@media (max-width: 760px) {
    :root:not([data-theme='dark']) .feat-card[style*="grid-template-columns"] { display: block !important; }
    :root:not([data-theme='dark']) .feat-card > svg { max-width: 230px; margin: 16px auto 0; display: block; }
    :root:not([data-theme='dark']) .feat-list[style*="columns"] { columns: 1 !important; }
}

/* ── Header pinned to top, bottom nav pinned to the foot ────────── */
:root:not([data-theme='dark']) .top-bar { position: sticky !important; top: 0 !important; z-index: 500; }

/* This used to say `display:flex !important` with no media query, so the
   phone bar was also painted across the bottom of every desktop page —
   underneath a sidebar that already listed the same destinations. It
   belongs to the phone layout only; the dark skin has always scoped it
   that way. */
@media (max-width: 767px) {
    :root:not([data-theme='dark']) .bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0; left: 0; right: 0;
        z-index: 900;
    }
    /* keep content clear of the fixed bottom nav */
    :root:not([data-theme='dark']) .content-container,
    :root:not([data-theme='dark']) .main-content > .container,
    :root:not([data-theme='dark']) .admin-content {
        padding-bottom: 92px !important;
    }
}

/* ── STRONG TEXT PASS: dark blue words on white, red for warnings ── */
:root:not([data-theme='dark']) body,
:root:not([data-theme='dark']) p,
:root:not([data-theme='dark']) td,
:root:not([data-theme='dark']) li,
:root:not([data-theme='dark']) span,
:root:not([data-theme='dark']) div { text-shadow: none; }
:root:not([data-theme='dark']) .stat-sub,
:root:not([data-theme='dark']) .sec-sub,
:root:not([data-theme='dark']) .hero-sub,
:root:not([data-theme='dark']) .feat-card p,
:root:not([data-theme='dark']) .party-detail,
:root:not([data-theme='dark']) .notification-message,
:root:not([data-theme='dark']) .sub,
:root:not([data-theme='dark']) .hint,
:root:not([data-theme='dark']) .desc,
:root:not([data-theme='dark']) small {
    color: #14406B !important;
}
:root:not([data-theme='dark']) h1,
:root:not([data-theme='dark']) h2,
:root:not([data-theme='dark']) h3,
:root:not([data-theme='dark']) h4,
:root:not([data-theme='dark']) .stat-value,
:root:not([data-theme='dark']) .sec-title,
:root:not([data-theme='dark']) .feat-card h3 { color: #0B2545 !important; }
:root:not([data-theme='dark']) .plan-badge.warn,
:root:not([data-theme='dark']) .overdue,
:root:not([data-theme='dark']) .text-danger,
:root:not([data-theme='dark']) .status-overdue,
:root:not([data-theme='dark']) .badge.red,
:root:not([data-theme='dark']) .flash.err,
:root:not([data-theme='dark']) .error,
:root:not([data-theme='dark']) .alert-danger {
    color: #C62828 !important;
}
:root:not([data-theme='dark']) .trust-txt,
:root:not([data-theme='dark']) .country-pill,
:root:not([data-theme='dark']) .hero-eyebrow { color: #14406B !important; }

/* ── Document editors fit every screen (phone → desktop) ───────── */
:root:not([data-theme='dark']) .modal .modal-box,
:root:not([data-theme='dark']) .modal .modal-content {
    width: min(96vw, 920px) !important;
    max-width: 96vw !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
    :root:not([data-theme='dark']) .modal .modal-box,
:root:not([data-theme='dark']) .modal .modal-content {
        border-radius: 14px !important;
        padding: 14px !important;
    }
    :root:not([data-theme='dark']) .form-row { display: block !important; }
    :root:not([data-theme='dark']) .form-row .form-group { margin-bottom: 14px; }
    :root:not([data-theme='dark']) .doc-type-selector,
:root:not([data-theme='dark']) .client-toggle { flex-wrap: wrap; }
    :root:not([data-theme='dark']) .items-table-wrap,
:root:not([data-theme='dark']) .tbl-wrap { overflow-x: auto !important; }
}

/* ── Kill ALL faded gradient-clipped headings (white-on-white) ──── */
:root:not([data-theme='dark']) .top-center h1,
:root:not([data-theme='dark']) .page-title h1,
:root:not([data-theme='dark']) .greeting h1,
:root:not([data-theme='dark']) .greeting h2,
:root:not([data-theme='dark']) .top-bar h1,
:root:not([data-theme='dark']) header h1,
:root:not([data-theme='dark']) .brand-content h2,
:root:not([data-theme='dark']) .grad-text,
:root:not([data-theme='dark']) h1[class*="gradient"],
:root:not([data-theme='dark']) h2[class*="gradient"] {
    background: none !important;
    background-image: none !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: #0B2545 !important;
    color: #0B2545 !important;
}


/* ════════════════════════════════════════════════════════════════
   DARK SKIN — only for surfaces that were built light-first
   ----------------------------------------------------------------
   Most of the app was designed dark and simply reappears when the
   light skin above switches off. These few stylesheets (module.css,
   used by the Business Suite shell, Design and Notifications pages)
   have no dark design of their own, so their tokens are remapped here.
   ════════════════════════════════════════════════════════════════ */
:root[data-theme='dark']{
    --bg:#07152B; --surface:#0C1E3A; --raised:#122745;
    --blue:#2D9CDB; --blue-d:#1E7BB0;
    --green:#38D9A9; --green-d:#26B98A;
    --orange:#F5A623; --orange-d:#D98E06;
    --red:#f87171; --purple:#A78BFA;
    --line:rgba(255,255,255,.10); --line-soft:rgba(255,255,255,.06);
    --txt:#F0F4FF; --muted:rgba(200,215,240,.68); --faint:rgba(160,185,220,.45);
    --shadow:0 8px 32px rgba(0,0,0,.42),0 2px 8px rgba(0,0,0,.24);
    --shadow-lg:0 16px 48px rgba(0,0,0,.5);
}
:root[data-theme='dark'] body{ background:var(--bg); color:var(--txt); }
:root[data-theme='dark'] input,
:root[data-theme='dark'] select,
:root[data-theme='dark'] textarea{
    background:rgba(255,255,255,.05); color:var(--txt); border-color:var(--line);
}
:root[data-theme='dark'] input::placeholder,
:root[data-theme='dark'] textarea::placeholder{ color:var(--faint); }
:root[data-theme='dark'] select option{ background:#0C1E3A; color:#F0F4FF; }
:root[data-theme='dark'] th{ background:rgba(255,255,255,.04); color:var(--muted); }
:root[data-theme='dark'] td{ border-color:var(--line-soft); }
:root[data-theme='dark'] tr:hover td{ background:rgba(45,156,219,.08); }

/* Native widgets (scrollbars, date pickers, autofill) follow the theme
   instead of always rendering light. */
:root[data-theme='dark']{ color-scheme:dark; }
:root:not([data-theme='dark']){ color-scheme:light; }


/* ════════════════════════════════════════════════════════════════
   APPEARANCE PICKER  (Settings → Appearance, app + admin)
   Replaces the old floating toggle: appearance is a preference, and
   preferences belong in Settings. Each card previews the theme it sets.
   ════════════════════════════════════════════════════════════════ */
.theme-picker{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr));
    gap:14px;
    margin-top:6px;
}
.theme-option{
    position:relative; display:flex; align-items:center; gap:13px;
    padding:14px; cursor:pointer; border-radius:16px;
    background:var(--glass-bg,rgba(255,255,255,.05));
    border:2px solid var(--glass-border,rgba(255,255,255,.12));
    transition:border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.theme-option:hover{ transform:translateY(-2px); border-color:rgba(45,156,219,.45); }
.theme-option input{ position:absolute; opacity:0; pointer-events:none; }
.theme-option.selected{
    border-color:var(--accent,#2D9CDB);
    background:rgba(45,156,219,.08);
    box-shadow:0 6px 20px rgba(45,156,219,.18);
}
.theme-option:focus-within{ outline:2px solid var(--accent,#2D9CDB); outline-offset:3px; }

/* Miniature window that shows what the theme looks like */
.theme-preview{
    flex:0 0 58px; width:58px; height:44px; border-radius:9px; overflow:hidden;
    display:flex; flex-direction:column; border:1px solid rgba(0,0,0,.14);
}
.theme-preview .tp-bar{ height:11px; width:100%; }
.theme-preview .tp-body{ flex:1; padding:5px; display:flex; flex-direction:column; gap:4px; }
.theme-preview .tp-line{ height:4px; border-radius:2px; width:100%; }
.theme-preview .tp-line.short{ width:62%; }

.theme-preview-light .tp-bar { background:#e6eef7; }
.theme-preview-light .tp-body{ background:#ffffff; }
.theme-preview-light .tp-line{ background:#c3d4e6; }

.theme-preview-dark .tp-bar { background:#0a1a33; }
.theme-preview-dark .tp-body{ background:#07152B; }
.theme-preview-dark .tp-line{ background:#2c4667; }

.theme-preview-system{ background:linear-gradient(110deg,#ffffff 0 50%,#07152B 50% 100%); }
.theme-preview-system .tp-bar { background:linear-gradient(110deg,#e6eef7 0 50%,#0a1a33 50% 100%); }
.theme-preview-system .tp-body{ background:transparent; }
.theme-preview-system .tp-line{ background:linear-gradient(110deg,#c3d4e6 0 50%,#2c4667 50% 100%); }

.theme-meta{ display:flex; flex-direction:column; gap:3px; min-width:0; }
.theme-name{ font-size:13.5px; font-weight:700; display:flex; align-items:center; gap:7px; }
.theme-name i{ color:var(--accent,#2D9CDB); font-size:12px; }
.theme-desc{ font-size:11px; line-height:1.45; color:var(--text-muted,#9fb4d0); }

.theme-check{
    margin-left:auto; font-size:17px; color:var(--accent,#2D9CDB);
    opacity:0; transform:scale(.7); transition:opacity .2s, transform .2s;
}
.theme-option.selected .theme-check{ opacity:1; transform:scale(1); }

/* Smooth repaint when the theme changes */
.theme-anim, .theme-anim *{
    transition:background-color .22s ease, color .22s ease, border-color .22s ease !important;
}

/* ════════════════════════════════════════════════════════════════
   PWA INSTALL BUTTON
   assets/js/pwa-init.js creates #pwa-install-btn when the browser
   fires beforeinstallprompt. It had no styling at all (and the script
   was never loaded), so the "install app" offer was invisible.
   Sits bottom-LEFT so it never collides with the app's menu FAB,
   which is bottom-right.
   ════════════════════════════════════════════════════════════════ */
.install-app-btn{
    position:fixed;
    left:16px;
    bottom:calc(16px + env(safe-area-inset-bottom, 0px));
    z-index:1500;
    display:inline-flex; align-items:center; gap:9px;
    padding:12px 20px;
    border:none; border-radius:100px; cursor:pointer;
    font-family:inherit; font-size:13.5px; font-weight:700; color:#fff;
    background:linear-gradient(135deg,#2D9CDB,#1E7BB0);
    box-shadow:0 8px 26px rgba(45,156,219,.42);
    animation:pwaRise .45s cubic-bezier(.2,.9,.3,1.2) both;
    -webkit-tap-highlight-color:transparent;
}
.install-app-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 12px 32px rgba(45,156,219,.5);
}
.install-app-btn:active{ transform:translateY(0); }
.install-app-btn i{ font-size:14px; }
@keyframes pwaRise{
    from{ opacity:0; transform:translateY(14px) scale(.94); }
    to  { opacity:1; transform:none; }
}
/* Clear the bottom navigation on phones. */
@media (max-width:1023px){
    .install-app-btn{ bottom:calc(76px + env(safe-area-inset-bottom, 0px)); }
}
/* Already installed and running standalone — nothing to offer. */
.pwa-mode .install-app-btn{ display:none !important; }
