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

    /* ── Design Tokens ── */
    :root {
      /* Neutral palette — clean charcoal/slate instead of navy */
      --bg-900: #111113;
      --bg-800: #18181b;
      --bg-700: #212124;
      --bg-600: #2b2b2f;
      --bg-500: #3f3f46;
      /* Accent — refined warm white-gold */
      --accent: #a78bfa;
      --gold: #e0c872;
      --gold-dim: rgba(224,200,114,0.12);
      --silver: #a1a1aa;
      /* Text hierarchy */
      --text: #f4f4f5;
      --text-muted: #a1a1aa;
      --text-dim: #71717a;
      /* Borders — subtle */
      --border: rgba(255,255,255,.08);
      /* Semantic */
      --green: #34d399;
      --purple: #a78bfa;
      --blue: #60a5fa;
      --red: #f87171;
      /* Shadows */
      --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
      --shadow-md: 0 4px 12px rgba(0,0,0,.25);
      --shadow-lg: 0 8px 30px rgba(0,0,0,.35);
      /* Overlay — white tint in dark, dark tint in light */
      --overlay-subtle: rgba(255,255,255,.04);
      --overlay-hover: rgba(255,255,255,.08);
      --icon-bg: rgba(255,255,255,0.1);
      /* Radius scale */
      --radius-sm: 6px;
      --radius-md: 10px;
      --radius-lg: 14px;
      --radius-xl: 18px;
    }

    /* ── Light Theme ── */
    [data-theme="light"] {
      --bg-900: #f8f8fa;
      --bg-800: #ffffff;
      --bg-700: #f0f0f3;
      --bg-600: #e4e4e7;
      --bg-500: #d4d4d8;
      --text: #18181b;
      --text-muted: #52525b;
      --text-dim: #a1a1aa;
      --border: rgba(0,0,0,.08);
      --green: #16a34a;
      --purple: #9333ea;
      --blue: #2563eb;
      --red: #dc2626;
      --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
      --shadow-md: 0 4px 12px rgba(0,0,0,.08);
      --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
      --overlay-subtle: rgba(0,0,0,.03);
      --overlay-hover: rgba(0,0,0,.06);
      --icon-bg: rgba(0,0,0,0.06);
    }

    /* ── Light theme auto mode ── */
    @media (prefers-color-scheme: light) {
      [data-theme="auto"] {
        --bg-900: #f8f8fa;
        --bg-800: #ffffff;
        --bg-700: #f0f0f3;
        --bg-600: #e4e4e7;
        --bg-500: #d4d4d8;
        --text: #18181b;
        --text-muted: #52525b;
        --text-dim: #a1a1aa;
        --border: rgba(0,0,0,.08);
        --green: #16a34a;
        --purple: #9333ea;
        --blue: #2563eb;
        --red: #dc2626;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
        --shadow-md: 0 4px 12px rgba(0,0,0,.08);
        --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
        --overlay-subtle: rgba(0,0,0,.03);
        --overlay-hover: rgba(0,0,0,.06);
        --icon-bg: rgba(0,0,0,0.06);
      }
    }

    /* ── Accent color overrides ── */
    [data-accent="cyan"] {
      --gold: #22d3ee;
      --gold-dim: rgba(34,211,238,.12);
    }

    [data-accent="blue"] {
      --gold: #60a5fa;
      --gold-dim: rgba(96,165,250,.12);
    }

    [data-accent="purple"] {
      --gold: #a78bfa;
      --gold-dim: rgba(167,139,250,.12);
    }

    [data-accent="green"] {
      --gold: #34d399;
      --gold-dim: rgba(52,211,153,.12);
    }

    [data-accent="rose"] {
      --gold: #fb7185;
      --gold-dim: rgba(251,113,133,.12);
    }

    /* ── Theme transition ── */
    html {
      transition: background-color .3s, color .3s;
    }

    /* ── Light theme specific overrides ── */
    [data-theme="light"] input[type="text"],
    [data-theme="light"] textarea,
    [data-theme="light"] select {
      background: var(--bg-800);
      border-color: var(--border);
      color: var(--text);
    }

    [data-theme="light"] input[type="text"]:focus,
    [data-theme="light"] textarea:focus,
    [data-theme="light"] select:focus {
      border-color: rgba(224,200,114,.4);
      box-shadow: 0 0 0 3px rgba(224,200,114,.08);
    }

    [data-theme="light"] .pill:hover {
      background: rgba(0,0,0,.04);
      border-color: rgba(0,0,0,.12);
    }

    [data-theme="light"] .sort-btn:hover {
      border-color: rgba(0,0,0,.12);
    }

    [data-theme="light"] .btn-ghost:hover {
      background: rgba(0,0,0,.04);
    }

    [data-theme="light"] .btn-icon-subtle {
      background: rgba(0,0,0,.04);
      border-color: var(--border);
      color: var(--text-dim);
    }

    [data-theme="light"] .btn-icon-subtle:hover {
      background: rgba(0,0,0,.06);
      color: var(--text-muted);
    }

    [data-theme="light"] .app-disclaimer {
      color: rgba(0,0,0,.15);
    }

    [data-theme="light"] .app-footer {
      color: rgba(0,0,0,.2);
    }

    /* ── Faction icons: default is white (dark mode) ── */
    .faction-icon-filter {
      filter: brightness(0) invert(1);
    }

    /* ── Faction icons: black in light mode ── */
    [data-theme="light"] .faction-icon-filter {
      filter: brightness(0);
    }
    @media (prefers-color-scheme: light) {
      [data-theme="auto"] .faction-icon-filter {
        filter: brightness(0);
      }
    }

    /* ── Nav icons in light mode ── */
    [data-theme="light"] nav .nav-icon-img,
    [data-theme="light"] #bottom-nav a .nav-icon img,
    [data-theme="light"] .group-icon-img {
      filter: brightness(0); opacity: 0.5;
    }
    [data-theme="light"] nav a.active .nav-icon-img,
    [data-theme="light"] #bottom-nav a.active .nav-icon img {
      opacity: 0.85;
    }

    /* ── Auto mode nav icons ── */
    @media (prefers-color-scheme: light) {
      [data-theme="auto"] nav .nav-icon-img,
      [data-theme="auto"] #bottom-nav a .nav-icon img,
      [data-theme="auto"] .group-icon-img {
        filter: brightness(0); opacity: 0.5;
      }
      [data-theme="auto"] nav a.active .nav-icon-img,
      [data-theme="auto"] #bottom-nav a.active .nav-icon img {
        opacity: 0.85;
      }

    }

    html, body { height: 100%; background: var(--bg-800); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; line-height: 1.5; }
    #root { display: flex; flex-direction: column; min-height: 100vh; }

    /* ── Nav ── */
    nav { background: var(--bg-900); border-bottom: 1px solid var(--border); display: flex; align-items: center; }
    nav .logo { padding: 12px 16px; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 13px; line-height: 1.2; white-space: nowrap; }
    nav .logo span { font-size: 22px; }
    nav a { display: flex; align-items: center; gap: 6px; padding: 12px 16px; text-decoration: none; color: var(--text-dim); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
    nav a:hover { color: var(--text-muted); }
    nav a.active { color: var(--text); border-bottom-color: var(--gold); }
    /* Mobile bottom nav */
    #bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-900); border-top: 1px solid var(--border); display: none; z-index: 100; }
    #bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; text-decoration: none; color: var(--text-dim); font-size: 10px; font-weight: 500; border-bottom: none; transition: color .2s; }
    #bottom-nav a .nav-icon { font-size: 20px; }
    #bottom-nav a .nav-icon img { width: 20px; height: 20px; opacity: 0.4; transition: opacity .2s; }
    #bottom-nav a.active .nav-icon img { opacity: 0.9; }
    nav .nav-icon-img { width: 16px; height: 16px; opacity: 0.4; vertical-align: middle; transition: opacity .2s; }
    nav a.active .nav-icon-img { opacity: 0.9; }
    .group-icon-img { width: 1em; height: 1em; vertical-align: -0.1em; }
    #bottom-nav a.active { color: var(--text); }

    /* ── Layout ── */
    main { flex: 1; overflow-y: auto; }
    .page { max-width: 680px; margin: 0 auto; padding: 28px 20px 88px; display: none; }
    .page.active { display: block; }

    /* ── Buttons ── */
    .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .2s; }
    .btn-gold { background: var(--gold); color: var(--bg-900); }
    .btn-gold:hover { filter: brightness(1.1); box-shadow: var(--shadow-sm); }
    .btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
    .btn-ghost:hover { color: var(--text); background: var(--overlay-subtle); }
    .btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 20px; }
    .btn-danger { background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.2); }
    .btn-danger:hover { background: rgba(248,113,113,.2); }

    /* ── Cards ── */
    .card { background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; transition: all .2s; }
    .card:hover { background: var(--bg-600); box-shadow: var(--shadow-sm); }
    .card-row { display: flex; align-items: center; gap: 12px; }
    .card-row .icon { font-size: 32px; flex-shrink: 0; }
    .card-row .info { flex: 1; min-width: 0; }
    .card-row .info h3 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
    .card-row .info p { font-size: 12px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .card-row .meta { font-size: 11px; color: var(--text-dim); }
    .card-clickable { cursor: pointer; }
    .card-icon { display: flex; align-items: center; }
    .card-meta-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
    .config-label { color: var(--gold); font-weight: 600; }
    .kt-chip { font-size: 10px; background: rgba(167,139,250,.1); color: var(--purple); padding: 1px 6px; border-radius: var(--radius-sm); border: 1px solid rgba(167,139,250,.2); margin-left: 4px; }
    .qty-controls { display: flex; align-items: center; gap: 4px; }
    .qty-btn { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-600); border: 1px solid var(--border); color: var(--text-muted); font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; transition: all .2s; }
    .qty-btn:hover { background: var(--bg-500); color: var(--text); }
    .qty-val { font-size: 12px; font-weight: 600; color: var(--text-dim); min-width: 20px; text-align: center; }
    .sort-btn { background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 11px; font-size: 13px; cursor: pointer; flex-shrink: 0; white-space: nowrap; color: var(--text-dim); transition: all .2s; }
    .sort-btn:hover { color: var(--text-muted); border-color: rgba(255,255,255,.12); }
    .sort-btn-active { border-color: rgba(224,200,114,.3); color: var(--gold); background: rgba(224,200,114,.06); }

    /* ── Recipe step ── */
    .recipe-step { background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 8px; }
    .recipe-step-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .recipe-step-label { font-size: 11px; font-weight: 600; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
    .recipe-step-action { background: none; border: none; color: var(--gold); font-size: 11px; font-weight: 600; cursor: pointer; transition: opacity .2s; }
    .recipe-step-action:hover { opacity: .75; }
    .recipe-step-remove { background: none; border: none; color: var(--text-dim); font-size: 13px; cursor: pointer; line-height: 1; transition: color .2s; }
    .recipe-step-remove:hover { color: var(--text-muted); }
    .recipe-step-edit { background: none; border: none; color: var(--text-dim); font-size: 11px; cursor: pointer; transition: color .2s; }
    .recipe-step-edit:hover { color: var(--text-muted); }
    .paint-chips { display: flex; flex-wrap: wrap; margin-bottom: 4px; }
    .paint-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-600); border: 1px solid var(--border); border-radius: 16px; padding: 3px 7px 3px 5px; font-size: 10px; margin: 2px; }
    .paint-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255,255,255,.15); }
    .paint-chip-remove { background: none; border: none; color: var(--text-dim); font-size: 11px; cursor: pointer; padding: 0; line-height: 1; margin-left: 1px; }
    .paint-chip-remove:hover { color: var(--text-muted); }
    .paint-state-tag { font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
    .recipe-textarea { font-size: 12px; background: var(--bg-900); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; resize: vertical; }

    /* ── Recipe warnings ── */
    .recipe-warning { border-radius: var(--radius-md); padding: 8px 12px; font-size: 12px; margin-top: 4px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
    .recipe-warning-low { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); color: #f59e0b; }
    .recipe-warning-missing { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2); color: var(--red); }
    .recipe-warning a { font-weight: 700; cursor: pointer; white-space: nowrap; }
    .recipe-warning-low a { color: #f59e0b; }
    .recipe-warning-missing a { color: var(--red); }

    /* ── Add step / scheme buttons ── */
    .btn-dashed { display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; color: var(--gold); font-size: 12px; font-weight: 600; transition: all .2s; }
    .btn-dashed:hover { background: rgba(224,200,114,.04); border-color: rgba(224,200,114,.25); }
    .btn-accent-subtle { display: inline-flex; align-items: center; gap: 4px; background: rgba(224,200,114,.06); border: 1px solid rgba(224,200,114,.2); border-radius: var(--radius-sm); padding: 5px 12px; cursor: pointer; color: var(--gold); font-size: 12px; font-weight: 600; transition: all .2s; }
    .btn-accent-subtle:hover { background: rgba(224,200,114,.1); }
    .btn-subtle { background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-dim); font-size: 12px; padding: 5px 12px; cursor: pointer; transition: all .2s; }
    .btn-subtle:hover { color: var(--text-muted); border-color: rgba(255,255,255,.12); }
    .btn-text { background: none; border: none; color: var(--gold); font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity .2s; }
    .btn-text:hover { opacity: .75; }
    .btn-text-danger { background: none; border: none; color: var(--red); font-size: 13px; cursor: pointer; padding: 4px 0; transition: opacity .2s; }
    .btn-text-danger:hover { opacity: .75; }

    /* ── Photo strip ── */
    .photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }

    /* ── Modal utilities ── */
    .modal-title { font-size: 16px; font-weight: 700; }
    .modal-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
    .modal-close { background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; line-height: 1; transition: color .2s; }
    .modal-close:hover { color: var(--text-muted); }
    .modal-scroll { overflow-y: auto; flex: 1; min-height: 0; }
    .modal-full-btn { width: 100%; flex-shrink: 0; }

    /* ── Paint picker items ── */
    .pp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; margin-bottom: 3px; transition: background .15s; }
    .pp-item:hover { background: rgba(255,255,255,.03); }
    .pp-item-selected { background: rgba(224,200,114,.06); border-color: rgba(224,200,114,.2); }
    .pp-dot { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }
    .pp-name { flex: 1; font-size: 13px; color: var(--text); }
    .pp-line { font-size: 10px; color: var(--text-dim); }
    .pp-check { color: var(--gold); font-weight: 700; font-size: 15px; margin-left: 2px; }
    .pp-empty { text-align: center; padding: 32px 16px; color: var(--text-dim); font-size: 13px; }
    .search-icon-wrap { flex: 1; position: relative; }
    .search-icon-label { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text-dim); pointer-events: none; }

    /* ── Template list ── */
    .tpl-row { display: flex; align-items: stretch; gap: 5px; margin-bottom: 6px; }
    .tpl-edit-btn { background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-dim); font-size: 14px; cursor: pointer; padding: 0 10px; flex-shrink: 0; transition: all .2s; }
    .tpl-edit-btn:hover { color: var(--text-muted); background: var(--bg-600); }

    /* ── Browse cards ── */
    .browse-chevron-icon { color: var(--text-dim); font-size: 20px; margin-top: 4px; flex-shrink: 0; }
    .browse-card-desc { margin-top: 4px; white-space: normal; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
    .badge-added { background: rgba(52,211,153,.1); color: var(--green); white-space: nowrap; }
    .chip-owned { background: rgba(224,200,114,.1); color: var(--gold); cursor: pointer; }
    .chip-count { font-size: 10px; background: var(--bg-500); color: var(--text-dim); padding: 2px 7px; border-radius: var(--radius-sm); }
    .chip-custom { font-size: 10px; background: rgba(248,113,113,.1); color: var(--red); padding: 1px 6px; border-radius: 5px; border: 1px solid rgba(248,113,113,.2); }
    .chip-scheme { font-size: 10px; color: var(--gold); }
    .unit-row-name { color: var(--text); font-size: 14px; font-weight: 600; }
    .unit-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

    /* ── Faction page header ── */
    .faction-hero-inline { display: flex; align-items: center; gap: 10px; flex: 1; margin: 0 0 0 8px; }
    .scheme-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
    .btn-scheme { background: var(--gold-dim); border: 1px solid rgba(201,168,76,.4); border-radius: 8px; color: var(--gold); font-size: 12px; font-weight: 600; padding: 5px 12px; cursor: pointer; flex-shrink: 0; }
    .chip-kt { font-size: 10px; background: rgba(167,139,250,.15); color: #a78bfa; padding: 1px 6px; border-radius: 5px; border: 1px solid rgba(167,139,250,.3); }
    .scheme-info-box { background: var(--gold-dim); border: 1px solid rgba(201,168,76,.4); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
    .browse-section-header { display: flex; justify-content: space-between; align-items: center; user-select: none; }
    .browse-section-header-lg { font-size: 18px; padding: 10px 2px; }
    .browse-chevron { transition: transform 0.2s; display: inline-block; }
    .icon-mt { margin-top: 4px; }
    .subfaction-header { align-items: center; margin-bottom: 8px; }

    /* ── Flex utility helpers ── */
    .flex-1 { flex: 1; }
    .flex-col { display: flex; flex-direction: column; }
    .flex-wrap { display: flex; flex-wrap: wrap; }
    .gap-2 { gap: 8px; }
    .gap-1\.5 { gap: 6px; }
    .items-start { align-items: flex-start; }
    .flex-shrink-0 { flex-shrink: 0; }

    /* ── Status badges ── */
    .badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-sm); white-space: nowrap; letter-spacing: .01em; }

    /* ── Forms ── */
    input[type="text"], textarea, select {
      width: 100%; background: var(--bg-900); border: 1px solid var(--border); color: var(--text);
      border-radius: var(--radius-md); padding: 10px 14px; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s;
    }
    input[type="text"]:focus, textarea:focus, select:focus { border-color: rgba(224,200,114,.4); box-shadow: 0 0 0 3px rgba(224,200,114,.08); }
    ::placeholder { color: var(--text-dim); }
    label { display: block; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
    textarea { font-family: 'Menlo', 'Cascadia Code', 'SF Mono', monospace; font-size: 12px; resize: vertical; line-height: 1.6; }

    /* ── Pills ── */
    .pills { display: flex; flex-wrap: wrap; gap: 6px; }
    .pill { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); transition: all .2s; background: transparent; color: var(--text-muted); }
    .pill:hover { color: var(--text); background: var(--overlay-subtle); border-color: rgba(255,255,255,.12); }
    .pill.active { background: rgba(224,200,114,.12); color: var(--gold); border-color: rgba(224,200,114,.25); font-weight: 600; }

    /* ── Stat grid ── */
    .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { background: var(--bg-700); border-radius: var(--radius-lg); padding: 16px; border: 1px solid var(--border); }
    .stat-card .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
    .stat-card .lbl { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-top: 2px; }
    .stat-card .sub { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

    /* ── Progress bar ── */
    .progress-track { display: flex; border-radius: 4px; overflow: hidden; height: 8px; background: var(--bg-600); }
    .progress-seg { height: 100%; }
    .progress-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
    .progress-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }
    .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

    /* ── Status picker grid ── */
    .status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .status-btn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; font-size: 13px; color: var(--text-muted); font-weight: 500; transition: all .2s; text-align: left; }
    .status-btn:hover { color: var(--text); background: var(--bg-600); }
    .status-btn.selected { border-color: rgba(224,200,114,.35); background: rgba(224,200,114,.08); color: var(--gold); }
    .status-btn .s-icon { font-size: 16px; }

    /* ── Quantity stepper ── */
    .stepper { display: flex; align-items: center; gap: 14px; }
    .stepper-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-700); border: 1px solid var(--border); color: var(--text-muted); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; }
    .stepper-btn:hover { background: var(--bg-600); color: var(--text); }
    .stepper-val { font-size: 20px; font-weight: 700; color: var(--text); width: 32px; text-align: center; }

    /* ── Modal ── */
    .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(8px); z-index: 200; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
    .modal { background: var(--bg-800); border: 1px solid var(--border); border-radius: var(--radius-xl); width: 100%; max-width: 480px; padding: 24px; box-shadow: var(--shadow-lg); }
    @media (min-width: 600px) { .modal-overlay { align-items: center; } }

    /* ── Activity Heatmap ── */
    .heatmap-grid { display:grid;grid-template-columns:repeat(var(--hm-cols),1fr);grid-template-rows:repeat(7,1fr);gap:2px;direction:ltr;height:160px }
    .heatmap-cell { border-radius:2px;min-width:0;min-height:0 }
    .heatmap-labels { display:flex;justify-content:space-between;margin-top:6px;font-size:10px;color:var(--text-dim) }
    .heatmap-range-toggle { display:flex;gap:0;border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden }
    .heatmap-range-btn { background:none;border:none;color:var(--text-dim);font-size:11px;font-weight:500;padding:4px 10px;cursor:pointer;transition:all .2s }
    .heatmap-range-btn:hover { background:var(--overlay-subtle);color:var(--text-muted) }
    .heatmap-range-btn.active { background:var(--gold);color:var(--bg-900);font-weight:600 }
    .heatmap-range-btn:not(:last-child) { border-right:1px solid var(--border) }

    /* ── Dashboard Settings ── */
    .dash-setting-row { display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border);transition:opacity .2s }
    .dash-setting-row.dash-setting-hidden { opacity:.4 }
    .dash-setting-arrows { display:flex;flex-direction:column;gap:2px }
    .dash-arrow { background:none;border:1px solid var(--border);border-radius:4px;color:var(--text-dim);font-size:10px;cursor:pointer;padding:2px 6px;line-height:1 }
    .dash-arrow:hover:not(:disabled) { background:var(--overlay-hover);color:var(--text-muted) }
    .dash-arrow:disabled { opacity:.2;cursor:default }
    .dash-setting-icon { font-size:18px;flex-shrink:0;width:24px;text-align:center }
    .dash-setting-label { flex:1;font-size:14px;font-weight:500;color:var(--text) }
    .dash-toggle { position:relative;display:inline-block;cursor:pointer }
    .dash-toggle input { position:absolute;opacity:0;width:0;height:0 }
    .dash-toggle-track { display:block;width:40px;height:22px;border-radius:11px;background:rgba(255,255,255,.08);transition:background .2s;position:relative }
    .dash-toggle input:checked + .dash-toggle-track { background:var(--gold) }
    .dash-toggle-thumb { position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.3) }
    .dash-toggle input:checked + .dash-toggle-track .dash-toggle-thumb { transform:translateX(18px) }

    /* ── Help Panel (slide-out) ── */
    #help-panel-overlay { position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:250;opacity:0;pointer-events:none;transition:opacity .25s }
    #help-panel-overlay.open { opacity:1;pointer-events:auto }
    #help-panel { position:fixed;top:0;right:0;bottom:0;width:min(340px,85vw);background:var(--bg-800);border-left:1px solid var(--border);z-index:251;transform:translateX(100%);transition:transform .25s ease;overflow-y:auto;padding:24px 20px;-webkit-overflow-scrolling:touch }
    #help-panel-overlay.open #help-panel { transform:translateX(0) }
    #help-panel .help-title { font-size:16px;font-weight:700;color:var(--text);margin-bottom:16px;display:flex;align-items:center;gap:10px }
    #help-panel .help-section { margin-bottom:18px }
    #help-panel .help-section h3 { font-size:12px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px }
    #help-panel .help-tip { font-size:13px;color:var(--text-muted);line-height:1.5;margin-bottom:8px;padding-left:16px;position:relative }
    #help-panel .help-tip::before { content:'•';position:absolute;left:2px;color:var(--text-dim) }
    #help-panel .help-intro { font-size:13px;color:var(--text-muted);line-height:1.6;margin-bottom:16px }
    .help-btn { background:none;border:1px solid var(--border);color:var(--text-dim);width:28px;height:28px;border-radius:50%;font-size:14px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .2s }
    .help-btn:hover { color:var(--text-muted);border-color:rgba(255,255,255,.15) }

    /* ── Toast ── */
    #toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--bg-700); color: var(--text); padding: 10px 20px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 300; white-space: nowrap; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
    #toast.show { opacity: 1; }

    /* ── Save bar ── */
    #save-bar { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(24,24,27,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 12px 16px; display: none; z-index: 90; }
    #save-bar.visible { display: flex; align-items: center; gap: 12px; justify-content: flex-end; max-width: 680px; margin: 0 auto; }

    /* ── Progress steps ── */
    .step-track { display: flex; gap: 3px; margin-top: 12px; }
    .step-seg { flex: 1; height: 3px; border-radius: 2px; transition: background-color .3s; background: var(--bg-500); }

    /* ── Typography & Utilities ── */
    h1 { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
    h2 { font-size: 16px; font-weight: 600; color: var(--text); }
    .section-title { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
    .divider { height: 1px; background: var(--border); margin: 20px 0; }
    .stack { display: flex; flex-direction: column; gap: 8px; }
    .row { display: flex; align-items: center; gap: 10px; }
    .spacer { flex: 1; }
    .text-muted { color: var(--text-muted); }
    .text-dim { color: var(--text-dim); }
    .text-sm { font-size: 13px; }
    .text-xs { font-size: 11px; }
    .mt-1 { margin-top: 4px; }
    .mt-2 { margin-top: 8px; }
    .mt-3 { margin-top: 12px; }
    .mt-4 { margin-top: 16px; }
    .mt-6 { margin-top: 24px; }
    .mb-1 { margin-bottom: 4px; }
    .mb-2 { margin-bottom: 8px; }
    .mb-3 { margin-bottom: 12px; }
    .mb-4 { margin-bottom: 16px; }
    .mb-6 { margin-bottom: 24px; }

    /* ── Utility classes ── */
    .btn-icon-subtle { background: var(--overlay-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 7px 10px; flex-shrink: 0; line-height: 1; transition: all .2s; }
    .btn-icon-subtle:hover { color: var(--text-muted); background: var(--overlay-hover); }
    .sync-indicator { font-size: 11px; font-weight: 500; letter-spacing: .02em; transition: color .3s; }
    .app-disclaimer { margin-top: 32px; font-size: 10px; color: rgba(255,255,255,.15); text-align: center; line-height: 1.6; }

    /* ── Hero card ── */
    .hero-card { background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 22px; }
    .chip { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 600; }

    /* ── Empty states ── */
    .empty-state { text-align: center; padding: 48px 20px; }
    .empty-state .icon { font-size: 44px; display: block; margin-bottom: 12px; opacity: .7; }
    .empty-state p { color: var(--text-muted); font-size: 14px; }
    .empty-state .sub { font-size: 13px; margin-top: 6px; color: var(--text-dim); }

    /* ── Links ── */
    a.link { color: var(--gold); text-decoration: none; }
    a.link:hover { text-decoration: underline; }
    .back-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--text-dim); font-size: 13px; cursor: pointer; background: none; border: none; padding: 4px 0; transition: color .2s; }
    .back-btn:hover { color: var(--text-muted); }

    /* ── Phase 3 UI Overhaul: Utility classes for static inline styles ── */
    .text-dim-label { color: var(--text-dim); font-weight: 400; }
    .text-xs-muted { font-size: 11px; color: var(--text-muted); }
    .paint-count-pill { display: flex; align-items: center; gap: 6px; }
    .paint-legend-box { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 8px 12px; background: var(--bg-700); border: 1px solid var(--border); border-radius: 10px; font-size: 11px; color: var(--text-muted); }
    .gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .shop-banner { width: 100%; display: flex; align-items: center; gap: 10px; background: rgba(249, 115, 22, 0.12); border: 1px solid rgba(249, 115, 22, 0.4); border-radius: 12px; padding: 12px 14px; cursor: pointer; margin-bottom: 14px; text-align: left; }
    .items-start { align-items: flex-start; }
    .shop-name-cell { flex: 1; font-size: 14px; }
    .shop-got-btn { background: none; border: 1px solid var(--border); color: var(--text-dim); font-size: 11px; padding: 3px 8px; border-radius: 8px; cursor: pointer; flex-shrink: 0; }
    .tools-tab-bar { gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
    .tools-tab-btn { flex: 1; padding: 10px; background: none; border: none; font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
    .wheel-center { display: flex; flex-direction: column; align-items: center; gap: 16px; }
    .wheel-label { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
    .palette-label { font-size: 13px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
    .scheme-card { align-items: flex-start; padding: 12px 14px; }
    .scheme-card-row { display: flex; flex: 1; min-width: 0; gap: 10px; }
    .scheme-name { font-size: 13px; font-weight: 700; color: var(--text); }
    .scheme-title { font-size: 12px; color: #fb7185; font-weight: 600; }
    .scheme-preview { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
    .template-card { align-items: flex-start; padding: 12px 14px; }
    .template-name { font-size: 13px; font-weight: 700; color: var(--text); }
    .template-preview { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
    .settings-header { font-size: 22px; font-weight: 800; margin-bottom: 20px; }
    .dash-settings-box { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
    .status-box-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #4ade80; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
    .version-history-label { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
    .version-list-loading { font-size: 12px; color: var(--text-dim); padding: 6px 0; }
    .help-link { cursor: pointer; margin-top: 6px; display: inline-block; }
    .modal-step-input { flex: 1; font-size: 12px; font-weight: 700; color: var(--gold); }
    .btn-row-gap { gap: 8px; margin-bottom: 20px; }
    .app-footer { margin-top: 24px; font-size: 10px; color: rgba(255, 255, 255, 0.2); text-align: center; line-height: 1.6; }
    .text-center { text-align: center; }
    .hue-label { text-align: center; font-size: 10px; color: var(--text-dim); margin-bottom: 4px; }
    .hue-hex { text-align: center; font-size: 9px; color: var(--text-dim); margin-top: 2px; }
    .text-xs-dim { font-size: 11px; color: var(--text-dim); }
    .modal-footer-row { padding: 10px 14px; gap: 8px; background: var(--bg-900); }
    .modal-photo-title { font-size: 13px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .modal-photo-faction { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
    .modal-photo-counter { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
    .palette-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--bg-700); border: 1px solid var(--border); border-radius: 10px; }
    .palette-info { min-width: 0; flex: 1; }
    .palette-name { font-size: 14px; font-weight: 600; color: var(--text); }
    .palette-type { font-size: 11px; color: var(--text-dim); }
    .palette-actions { gap: 6px; flex-shrink: 0; }

    /* ── Faction hero ── */
    .faction-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
    .faction-hero .big-icon { font-size: 48px; }

    /* ── Delete zone ── */
    .delete-zone { background: rgba(248,113,113,.06); border: 1px solid rgba(248,113,113,.15); border-radius: var(--radius-md); padding: 14px; margin-top: 8px; }

    /* ── Type groups & templates ── */
    .type-group { margin-bottom: 20px; }
    .browse-section.collapsed.type-group { margin-bottom: -6px; }
    .browse-section.collapsed .section-title { margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
    .recipe-template-btn { display: block; width: 100%; text-align: left; background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; cursor: pointer; transition: all .2s; margin-bottom: 6px; }
    .recipe-template-btn:hover { background: var(--bg-600); }
    .recipe-template-btn .t-name { color: var(--text); font-size: 13px; font-weight: 600; }
    .recipe-template-btn .t-preview { color: var(--text-dim); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* ── Gear slots ── */
    .gear-slots { display: flex; flex-direction: column; gap: 10px; }
    .gear-slot-row { display: flex; flex-direction: column; gap: 5px; }
    .gear-slot-label { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
    .gear-slot-row select { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2371717a' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; appearance: none; -webkit-appearance: none; cursor: pointer; }
    .gear-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
    .gear-tag { font-size: 10px; padding: 2px 7px; border-radius: var(--radius-sm); background: rgba(224,200,114,.08); color: var(--gold); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
    .gear-section-box { background: var(--bg-900); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 12px; }

    /* ── Theme picker ── */
    .theme-mode-row { display: flex; gap: 6px; }
    .theme-mode-btn { flex: 1; padding: 10px 8px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-800); color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; }
    .theme-mode-btn:hover { background: var(--bg-600); color: var(--text); }
    .theme-mode-btn.active { border-color: var(--gold); background: var(--gold-dim); color: var(--gold); }
    .accent-row { display: flex; gap: 10px; flex-wrap: wrap; }
    .accent-dot { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: all .2s; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
    .accent-dot:hover { transform: scale(1.1); }
    .accent-dot.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-800), 0 0 0 4px var(--text-muted); }

    /* ── Settings ── */
    .settings-section { background:var(--bg-700);border:1px solid var(--border);border-radius:var(--radius-lg);padding:18px;margin-bottom:14px }
    .settings-section-title { font-size:11px;font-weight:600;color:var(--text-dim);text-transform:uppercase;letter-spacing:.06em;margin-bottom:12px }

    /* ── Help page ── */
    .help-section { margin-bottom:28px }
    .help-section h3 { font-size:14px;font-weight:600;color:var(--text);margin-bottom:8px }
    .help-section p, .help-section li { font-size:13px;color:var(--text-muted);line-height:1.6 }
    .help-section ol, .help-section ul { padding-left:20px;margin:8px 0 }
    .help-section li { margin-bottom:4px }
    .help-step { display:flex;gap:12px;align-items:flex-start;margin-bottom:12px }
    .help-step-num { width:26px;height:26px;border-radius:50%;background:var(--gold);color:var(--bg-900);font-size:13px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0 }
    .help-step-text { font-size:13px;color:var(--text-muted);line-height:1.6;padding-top:3px }

    /* ── Shopping list ── */
    .shop-row { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
    .shop-row:last-child { border-bottom:none; }
    .shop-dot { width:16px; height:16px; border-radius:50%; flex-shrink:0; border:2px solid; }
    .shop-group { background:var(--bg-700); border:1px solid var(--border); border-radius:var(--radius-md); padding:12px 14px; margin-bottom:10px; }
    .shop-group-title { font-size:10px; font-weight:600; color:var(--text-dim); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }

    /* ── Paint Collection ── */
    .paint-stats-bar { background: var(--bg-700); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
    .paint-stats-bar .ps-num { font-size: 24px; font-weight: 700; color: var(--gold); line-height: 1; }
    .paint-stats-bar .ps-lbl { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
    .paint-stats-bar .ps-div { width: 1px; height: 32px; background: var(--border); }
    .paint-search { position: relative; margin-bottom: 12px; }
    .paint-search input { padding-left: 36px; }
    .paint-search .ps-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text-dim); pointer-events: none; }
    .paint-type-badge { font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 3px; text-transform: uppercase; letter-spacing: .04em; display: inline-block; }
    .paint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; margin-top: 4px; }
    .paint-swatch { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
    .paint-swatch .color-dot { width: 48px; height: 48px; border-radius: 50%; border: 2px solid rgba(255,255,255,.08); transition: border-color .15s, transform .1s; position: relative; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
    .paint-swatch .color-dot .state-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.9); pointer-events: none; }
    .paint-swatch.ps-full .color-dot { border-color: var(--green); }
    .paint-swatch.ps-full .paint-name { color: var(--green); }
    .paint-swatch.ps-low .color-dot { border-color: #f59e0b; }
    .paint-swatch.ps-low .paint-name { color: #f59e0b; }
    .paint-swatch.ps-out .color-dot { border-color: var(--red); }
    .paint-swatch.ps-out .paint-name { color: var(--red); }
    .paint-swatch:active .color-dot { transform: scale(.9); }
    .paint-swatch .paint-name { font-size: 10px; color: var(--text-dim); text-align: center; line-height: 1.25; width: 70px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .paint-group-header { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
    .paint-section.collapsed .paint-group-header { margin: 18px 0 0; padding-bottom: 4px; }
    .paint-progress { height: 4px; background: var(--bg-600); border-radius: 2px; overflow: hidden; margin-top: 8px; flex: 1; }
    .paint-progress-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width .3s; }

    /* ── Mobile ── */
    @media (max-width: 599px) {
      nav .logo { display: none; }
      nav { display: none; }
      #bottom-nav { display: flex; }
      #bottom-nav a { font-size: 10px; padding: 8px 4px; }
      main { padding-bottom: 56px; }
      .stat-grid { grid-template-columns: repeat(2, 1fr); }
      #save-bar.visible { bottom: 56px; }
    }
    @media (min-width: 600px) {
      #save-bar.visible { bottom: 0; }
      #toast { bottom: 24px; }
    }
