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

    :root {
      color-scheme: only dark;
      --primary: #7e4cbc;
      --primary-dim: #6a3fa3;
      --primary-glow: rgba(126, 76, 188, 0.15);
      --bg-dark: #0d0d0d;
      --bg-card: #161618;
      --bg-card-hover: #1D1D20;
      --bg-input: #242428;
      --border: #2E2E33;
      --text-primary: #F1F3F5;
      --text-secondary: #ADB5BD;
      --text-muted: #495057;
      --text-dim: #7a7a82;
      --red: #FF6B6B;
      --orange: #FFA94D;
      --blue: #4DABF7;
      --teal: #20C997;
      --event: #74C0FC;
      --positive: #69DB7C;
      --gold: #FFD43B;
      --silver: #CED4DA;
      --bronze: #E8590C;
      --cal-torn: #4DABF7;
      --cal-faction: #B197FC;
      --cal-war: #FF6B6B;
      --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    }
    /* Brand-colour cycle (logo click). data-theme is set on <html> pre-paint. */
    html[data-theme="purple"] { --primary:#7e4cbc; --primary-dim:#6a3fa3; --primary-glow:rgba(126,76,188,0.15); }
    html[data-theme="blue"]   { --primary:#2e60cf; --primary-dim:#2752b0; --primary-glow:rgba(46,96,207,0.15); }
    html[data-theme="red"]    { --primary:#bc4f48; --primary-dim:#a3433d; --primary-glow:rgba(188,79,72,0.15); }
    html[data-theme="green"]  { --primary:#31a032; --primary-dim:#298a2a; --primary-glow:rgba(49,160,50,0.15); }

    body.theme-navy {
      --bg-dark:        #08111f;
      --bg-card:        #0c1828;
      --bg-card-hover:  #122036;
      --bg-input:       #182846;
      --border:         #1e2e4e;
      --blue:           #5dc4fb;
    }

    html, body { background: var(--bg-dark); color: var(--text-primary); font-family: var(--font-sans); min-height: 100vh; }

    /* ============ HEADER ============ */
    .header {
      display: flex; align-items: center; gap: 10px;
      padding: 14px 24px;
      border-bottom: 1px solid var(--border);
      background: var(--bg-dark);
      position: sticky; top: 0; z-index: 50;
    }
    .header-logo { width: 26px; height: 26px; object-fit: contain; cursor: pointer; }
    .burger {
      background: transparent; border: none; color: var(--text-secondary);
      cursor: pointer; padding: 4px 6px; margin-right: -2px;
      display: inline-flex; align-items: center; border-radius: 4px;
      transition: color 0.15s, background 0.15s;
    }
    .burger:hover { color: var(--primary); background: var(--bg-input); }
    .burger svg { display: block; }
    .header-eyebrow {
      font-size: 11px; letter-spacing: 0.18em; color: var(--text-secondary);
      text-transform: uppercase; font-weight: 500; line-height: 21.75px;
    }
    .header-title {
      font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
      color: var(--text-primary); text-decoration: none; line-height: 21.75px;
    }
    .header-title:hover { opacity: 0.8; }

    /* TZ eyebrow in header */
    .tz-eyebrow {
      display: flex; align-items: center; gap: 8px;
      font-size: 11px; color: var(--text-secondary);
      padding: 6px 10px; border: 1px solid var(--border);
      border-radius: 6px; background: var(--bg-card);
      margin-left: auto;  /* keeps it right-aligned when hero wraps on mobile */
    }
    .tz-eyebrow .tz-time { font-family: var(--font-mono); color: var(--text-primary); font-weight: 600; }
    .tz-eyebrow .tz-sep { color: var(--text-dim); }
    .tz-eyebrow .tz-offset { color: var(--text-secondary); font-family: var(--font-mono); }
    .tz-eyebrow .tz-confirm {
      color: var(--orange); cursor: pointer; text-decoration: underline; text-decoration-style: dotted;
      background: none; border: none; padding: 0; font: inherit;
    }
    .tz-eyebrow .tz-confirm:hover { color: var(--primary); }
    .tz-eyebrow .tz-tick { color: var(--teal); font-weight: 700; }
    @media (max-width: 640px) {
      .header { padding: 10px 14px; gap: 6px; }
      .header-eyebrow { display: none; }
      /* On mobile we swap: TZ eyebrow moves into the header (via JS),
         logout hides (still in side menu). Single line, no wrap on hero. */
      #appHeader .logout-btn { display: none; }
    }

    /* ============ LAYOUT ============ */
    .container {
      max-width: 1180px; margin: 0 auto;
      padding: 24px;
    }
    @media (max-width: 640px) { .container { padding: 16px; } }

    .hero {
      display: flex; align-items: flex-end; justify-content: space-between;
      gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
    }
    .hero-greeting { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
    .hero-meta {
      font-size: 13px; color: var(--text-secondary); margin-top: 6px;
      display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    }
    .role-pill {
      display: inline-block; padding: 2px 8px; border-radius: 4px;
      font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
    }
    .role-pill.member { background: rgba(173, 181, 189, 0.12); color: var(--text-secondary); }
    .role-pill.admin { background: rgba(77, 171, 247, 0.15); color: var(--blue); }
    .role-pill.super_admin { background: var(--primary-glow); color: var(--primary); }

    /* ============ TZ MISMATCH BANNER ============ */
    .tz-mismatch {
      display: none;
      background: rgba(255, 169, 77, 0.08);
      border: 1px solid rgba(255, 169, 77, 0.3);
      border-left: 3px solid var(--orange);
      border-radius: 8px;
      padding: 10px 14px; margin-bottom: 14px;
      font-size: 13px; color: var(--text-secondary);
      display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    }
    .tz-mismatch.hidden { display: none; }
    .tz-mismatch-body { flex: 1; min-width: 0; }
    .tz-mismatch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
    .tz-mismatch-btn {
      background: none; border: 1px solid var(--border);
      color: var(--text-secondary); padding: 5px 10px; border-radius: 5px;
      font-size: 12px; font-family: inherit; cursor: pointer;
    }
    .tz-mismatch-btn.primary { background: var(--orange); color: var(--bg-dark); border-color: var(--orange); }
    .tz-mismatch-btn:hover { color: var(--text-primary); border-color: var(--text-dim); }
    .tz-mismatch-btn.primary:hover { opacity: 0.9; color: var(--bg-dark); }
    @media (max-width: 768px) {
      .tz-mismatch { flex-direction: column; align-items: stretch; }
      .tz-mismatch-actions { display: grid; grid-template-columns: 1fr 1fr; }
    }

    /* ============ ANNOUNCEMENT TOAST (reusable) ============ */
    /* Styling pattern available for future announcement use. */
    .war-toast {
      display: none;
      background: var(--primary-glow);
      border: 1px solid var(--primary-dim);
      border-left: 3px solid var(--primary);
      border-radius: 8px;
      padding: 14px 16px;
      margin-bottom: 20px;
      display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    }
    .war-toast.hidden { display: none; }
    .war-toast-icon { font-size: 22px; flex-shrink: 0; }
    .war-toast-body { flex: 1; min-width: 0; }
    .war-toast-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
    .war-toast-sub { font-size: 12px; color: var(--text-secondary); }
    .war-toast-cta {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--primary); color: var(--bg-dark);
      padding: 8px 14px; border-radius: 6px;
      font-weight: 600; font-size: 13px; text-decoration: none;
      transition: opacity 0.15s;
    }
    .war-toast-cta:hover { opacity: 0.9; }
    .war-toast-cta svg { width: 13px; height: 13px; }

    /* ============ COLLECTION HEALTH ALERT (super-admin) ============ */
    .collection-alert {
      display: none;
      background: rgba(255, 107, 107, 0.10);
      border: 1px solid rgba(255, 107, 107, 0.32);
      border-left: 3px solid var(--red, #ff6b6b);
      border-radius: 8px;
      padding: 14px 16px;
      margin-bottom: 20px;
      align-items: center; gap: 14px; flex-wrap: wrap;
    }
    .collection-alert:not(.hidden) { display: flex; }
    .collection-alert-icon { font-size: 22px; flex-shrink: 0; }
    .collection-alert-body { flex: 1; min-width: 0; }
    .collection-alert-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
    .collection-alert-sub   { font-size: 12px; color: var(--text-secondary); }
    .collection-alert-cta {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--red, #ff6b6b); color: var(--bg-dark);
      padding: 8px 14px; border-radius: 6px;
      font-weight: 600; font-size: 13px; text-decoration: none;
    }
    .collection-alert-cta:hover { opacity: 0.9; }
    @media (max-width: 768px) {
      .collection-alert-cta { flex: 1 1 100%; justify-content: center; }
    }

    /* ============ REIMBURSEMENT ALERT (finance users) ============ */
    .reimb-alert {
      display: none;
      background: var(--primary-glow);
      border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
      border-left: 3px solid var(--primary);
      border-radius: 8px;
      padding: 14px 16px;
      margin-bottom: 20px;
      align-items: center; gap: 14px; flex-wrap: wrap;
    }
    .reimb-alert:not(.hidden) { display: flex; }
    .reimb-alert-icon { font-size: 22px; flex-shrink: 0; }
    .reimb-alert-body { flex: 1; min-width: 0; }
    .reimb-alert-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
    .reimb-alert-sub   { font-size: 12px; color: var(--text-secondary); }
    .reimb-alert-cta {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--primary); color: var(--bg-dark);
      padding: 8px 14px; border-radius: 6px;
      font-weight: 600; font-size: 13px; text-decoration: none;
      transition: opacity 0.15s;
    }
    .reimb-alert-cta:hover { opacity: 0.9; }
    .reimb-alert-cta svg { width: 13px; height: 13px; }
    @media (max-width: 768px) {
      .reimb-alert-cta { flex: 1 1 100%; justify-content: center; }
    }

    /* ============ GOAL WIDGET ============ */
    .goal-card {
      display: none;
      background: var(--bg-card); border: 1px solid var(--border);
      border-radius: 10px; padding: 18px; margin-bottom: 20px;
    }
    .goal-card.show { display: block; }
    .goal-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
    .goal-title { font-weight: 600; }
    .goal-metric { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
    .goal-bar-wrap {
      position: relative; height: 12px; background: rgba(255, 255, 255, 0.10);
      border-radius: 6px; margin-top: 12px; overflow: hidden;
    }
    .goal-bar { height: 100%; background: linear-gradient(90deg, var(--primary-dim), var(--primary)); transition: width 0.4s ease; }
    .goal-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
    .goal-meta > :nth-child(1) { text-align: left; }
    .goal-meta > :nth-child(2) { text-align: center; }
    .goal-meta > :nth-child(3) { text-align: right; }
    @media (max-width: 640px) {
      .goal-meta-label { display: none; }
    }
    .goal-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

    /* ============ STAT CARDS ============ */
    .stat-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
      margin-bottom: 24px;
    }
    @media (max-width: 880px) { .stat-grid { grid-template-columns: 1fr; } }

    .stat-card {
      background: var(--bg-card); border: 1px solid var(--border);
      border-radius: 10px; padding: 18px;
      display: flex; flex-direction: column; gap: 12px;
    }
    .stat-card-header {
      display: flex; justify-content: space-between; align-items: center;
      font-size: 11px; color: var(--text-primary);
      text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
    }
    .stat-card-link {
      color: var(--text-dim); text-decoration: none; font-size: 12px;
      transition: color 0.15s;
    }
    .stat-card-link:hover { color: var(--primary); }
    .stat-hero { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
    .stat-hero-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
    .stat-rows { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
    .stat-row { display: flex; justify-content: space-between; gap: 8px; }
    .stat-row-label { color: var(--text-secondary); }
    .stat-row-value { color: var(--text-primary); font-weight: 600; }
    .stat-row-period {
      font-size: 10px; color: var(--text-muted);
      text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
      margin-left: 6px;
    }
    .rank-mode-toggle {
      cursor: pointer;
      border-bottom: 1px dashed var(--text-muted);
      transition: color 0.15s, border-color 0.15s;
    }
    .rank-mode-toggle:hover { color: var(--teal, #14b8a6); border-bottom-color: var(--teal, #14b8a6); }

    .perf-pill {
      display: inline-block; padding: 2px 8px; border-radius: 4px;
      font-size: 11px; font-weight: 600;
    }
    .perf-pill.top10   { background: rgba(255, 212, 59, 0.18); color: var(--gold); }
    .perf-pill.above   { background: rgba(105, 219, 124, 0.15); color: var(--positive); }
    .perf-pill.average { background: rgba(173, 181, 189, 0.12); color: var(--text-secondary); }
    .perf-pill.below   { background: rgba(255, 107, 107, 0.15); color: var(--red); }

    .flag-pill {
      display: inline-block; padding: 2px 8px; border-radius: 4px;
      font-size: 11px; font-weight: 600;
      background: rgba(255, 169, 77, 0.15); color: var(--orange);
    }
    .flag-pill.clean { background: rgba(105, 219, 124, 0.15); color: var(--positive); }

    .rank-medal { font-size: 13px; margin-right: 3px; vertical-align: middle; line-height: 1; }

    /* ============ 2-COLUMN BOTTOM SECTION ============ */
    /* align-items:start prevents the grid from stretching both panels to the
       taller one. The events panel sizes to its natural content; JS then
       mirrors that height onto the activity panel so it scrolls internally. */
    .bottom-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
      align-items: start;
    }
    @media (max-width: 880px) {
      .bottom-grid { grid-template-columns: 1fr; }
      /* On mobile the panels stack and each takes its natural height — no
         height mirroring needed (and would just truncate activity awkwardly). */
      #activityList { max-height: none !important; }
      .bottom-grid > .panel:first-child { height: auto !important; }
    }

    .panel {
      background: var(--bg-card); border: 1px solid var(--border);
      border-radius: 10px; padding: 18px;
      display: flex; flex-direction: column;
    }
    .panel-header {
      display: flex; justify-content: space-between; align-items: baseline;
      margin-bottom: 14px;
    }
    .panel-title { font-weight: 600; font-size: 14px; }
    .panel-sub { font-size: 11px; color: var(--text-muted); }

    /* Activity feed — fills remaining panel height (panel sizes via grid to
       match the events panel), inner list scrolls if content overflows. */
    .activity-list {
      display: flex; flex-direction: column; gap: 10px;
      flex: 1; min-height: 0;
      overflow-y: auto;
      padding-right: 4px;
    }
    .activity-list::-webkit-scrollbar { width: 6px; }
    .activity-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    .activity-list::-webkit-scrollbar-track { background: transparent; }
    .activity-item {
      display: flex; gap: 12px; align-items: flex-start;
      padding: 8px 0; border-bottom: 1px solid var(--border);
    }
    .activity-item:last-child { border-bottom: none; }
    .activity-icon {
      width: 32px; height: 32px; border-radius: 6px;
      display: flex; align-items: center; justify-content: center;
      font-size: 16px; flex-shrink: 0;
    }
    .activity-icon.payout { background: rgba(105, 219, 124, 0.15); color: var(--positive); }
    .activity-icon.success { background: rgba(77, 171, 247, 0.15); color: var(--blue); }
    .activity-icon.fail { background: rgba(255, 107, 107, 0.15); color: var(--red); }
    .activity-body { flex: 1; min-width: 0; }
    .activity-title { font-size: 13px; color: var(--text-primary); font-weight: 500; }
    .activity-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

    /* Calendar widget */
    .cal-list { display: flex; flex-direction: column; gap: 10px; }
    .cal-list-section {
      font-size: 10px; color: var(--text-muted);
      text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
      margin-top: 6px;
    }
    .cal-list-section:first-child { margin-top: 0; }
    .cal-item {
      display: flex; gap: 12px; align-items: flex-start;
      padding: 10px; border-radius: 6px;
      background: var(--bg-dark);
      border-left: 3px solid var(--text-muted);
    }
    .cal-item.cal-torn_event    { border-left-color: var(--cal-torn); }
    .cal-item.cal-faction_event { border-left-color: var(--cal-faction); }
    .cal-item.cal-war           { border-left-color: var(--cal-war); }
    /* Training breaks override the faction_event color with green */
    .cal-item.cal-training_break { border-left-color: var(--positive); }
    .cal-item-date-wrap {
      flex-shrink: 0; display: flex; flex-direction: column;
      align-items: stretch; min-width: 44px;
    }
    .cal-item-date {
      text-align: center;
      padding: 4px 8px; border-radius: 4px;
      background: var(--bg-input);
    }
    .cal-item-day { font-size: 16px; font-weight: 700; line-height: 1; color: var(--text-primary); }
    .cal-item-month { font-size: 9px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.06em; }
    .cal-item-custom-pill {
      font-size: 9px; color: var(--text-secondary);
      text-align: center; margin-top: 4px;
      text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
      white-space: nowrap;
    }
    .cal-item-body { flex: 1; min-width: 0; }
    .cal-item-title {
      font-size: 13px; font-weight: 600; color: var(--text-primary);
      display: flex; align-items: center; gap: 6px;
    }
    .cal-item-meta {
      display: inline-flex; align-items: center;
      font-size: 10px; font-weight: 600;
      padding: 2px 7px; border-radius: 10px;
      background: rgba(255, 255, 255, 0.07);
      color: var(--text-secondary);
      margin-top: 4px;
      font-family: var(--font-mono);
    }
    .cal-item-meta .info-tip { cursor: help; text-decoration: underline dotted; text-decoration-color: var(--text-muted); }

    /* Description row — up to 2 lines truncated by default, expands on "more" click */
    .cal-item-desc {
      font-size: 11px; color: var(--text-secondary);
      margin-top: 4px;
    }
    .cal-item-desc-text {
      display: -webkit-box;
      -webkit-line-clamp: 2; -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .cal-item-desc.expanded .cal-item-desc-text {
      display: block;
      -webkit-line-clamp: unset;
    }
    .cal-item-desc-toggle {
      background: none; border: none; color: var(--blue);
      cursor: pointer; font-size: 11px; padding: 0; font-family: inherit;
      text-decoration: underline; text-decoration-style: dotted;
      margin-top: 2px;
    }
    .cal-item-desc-toggle:hover { color: var(--primary); }

    .empty-state {
      text-align: center; color: var(--text-muted);
      font-size: 13px; padding: 30px 0;
    }

    /* Loading shimmer */
    .loading { color: var(--text-muted); font-size: 12px; }

    /* ============ LOGIN OVERLAY (canonical HUB pattern) ============ */
    .auth-overlay {
      position: fixed; top: 0; left: 0; right: 0; bottom: 0;
      background: var(--bg-dark); z-index: 9999;
      display: flex; align-items: center; justify-content: center;
    }
    .auth-overlay.hidden { display: none; }

    /* Loading-bar mode: triggered by sync head script when cached JWT is valid.
       Backdrop stays (page underneath stays hidden — no admin UI leak), but the
       login form is swapped for a thin animated bar. completeLogin() removes
       the whole overlay on success; checkExistingSession's finally restores
       the login form on failure. */
    .auth-loading-bar {
      display: none;
      width: 240px; height: 3px;
      background: rgba(255,255,255,0.06);
      border-radius: 2px; overflow: hidden;
      position: relative;
    }
    .auth-loading-bar::after {
      content: '';
      position: absolute; top: 0; left: 0;
      height: 100%; width: 35%;
      background: var(--primary);
      border-radius: 2px;
      animation: authLoadSlide 1.1s ease-in-out infinite;
    }
    html.auth-loading .auth-card { display: none; }
    html.auth-loading .auth-loading-bar { display: block; }
    @keyframes authLoadSlide {
      0%   { transform: translateX(-100%); }
      100% { transform: translateX(370%); }
    }
    .auth-card {
      background: var(--bg-card); border: 1px solid var(--border);
      border-radius: 12px; padding: 40px;
      max-width: 420px; width: 90%; text-align: center;
      font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    }
    .auth-title { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
    .auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
    .auth-input {
      width: 100%; padding: 12px 16px;
      background: var(--bg-input); border: 1px solid var(--border);
      border-radius: 6px; color: var(--text-primary);
      font-size: 15px; margin-bottom: 16px; outline: none;
    }
    .auth-input:focus { border-color: var(--primary); }
    .auth-btn {
      width: 100%; padding: 12px;
      background: var(--primary); color: #000;
      font-weight: 700; font-size: 15px;
      border: none; border-radius: 6px; cursor: pointer;
    }
    .auth-btn:hover { opacity: 0.9; }
    .auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .auth-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 20px; }
    .auth-privacy {
      margin-top: 20px; font-size: 12px;
      color: var(--text-secondary); line-height: 1.5;
    }

    /* ============ VIEW-AS MODAL (super_admin only) ============ */
    .view-as-modal-backdrop {
      display: none;
      position: fixed; inset: 0; background: rgba(0,0,0,0.6);
      z-index: 1000; align-items: center; justify-content: center; padding: 20px;
    }
    .view-as-modal-backdrop.open { display: flex; }
    .view-as-modal {
      background: var(--bg-card); border: 1px solid var(--border);
      border-radius: 10px; max-width: 380px; width: 100%; max-height: 70vh;
      display: flex; flex-direction: column;
    }
    .view-as-header {
      padding: 14px 18px; border-bottom: 1px solid var(--border);
      font-weight: 600; font-size: 14px;
    }
    .view-as-search {
      margin: 12px 16px 8px; padding: 8px 12px;
      background: var(--bg-input); border: 1px solid var(--border);
      border-radius: 6px; color: var(--text-primary); font-family: inherit;
      font-size: 13px;
    }
    .view-as-search:focus { outline: none; border-color: var(--primary); }
    .view-as-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
    .view-as-item {
      padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
      transition: background 0.1s;
    }
    .view-as-item:hover { background: var(--bg-input); }
    .view-as-item.back-to-me {
      color: var(--primary); font-weight: 600;
      border-bottom: 1px solid var(--border); margin-bottom: 6px; padding-bottom: 10px;
    }

    .hero-name { cursor: default; }
    .hero-name.clickable { cursor: pointer; }

    /* ============ TZ CONFIRM MODAL ============ */
    .tz-modal-backdrop {
      display: none;
      position: fixed; inset: 0; background: rgba(0,0,0,0.6);
      z-index: 1000; align-items: center; justify-content: center; padding: 20px;
    }
    .tz-modal-backdrop.open { display: flex; }
    .tz-modal {
      background: var(--bg-card); border: 1px solid var(--border);
      border-radius: 10px; max-width: 420px; width: 100%;
    }
    .tz-modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
    .tz-modal-body { padding: 18px; }
    .tz-modal-detected {
      background: var(--bg-input); padding: 12px; border-radius: 6px;
      margin: 12px 0; font-family: var(--font-sans); font-size: 13px;
    }
    .tz-modal-detected b { color: var(--primary); }
    .tz-modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

    /* ============ LOGOUT BUTTON ============ */
    .logout-btn {
      padding: 4px 10px; font-size: 11px;
      background: transparent; border: 1px solid var(--primary);
      color: var(--primary); border-radius: 4px;
      cursor: pointer; text-transform: uppercase;
      letter-spacing: 0.5px; font-weight: 700;
      font-family: inherit; transition: all 0.2s;
    }
    .logout-btn:hover { background: var(--primary); color: var(--bg-dark); }

    /* ============ BUTTONS (shared) ============ */
    .btn {
      background: var(--primary); color: var(--bg-dark);
      border: none; padding: 8px 14px; border-radius: 6px;
      font-family: inherit; font-size: 13px; font-weight: 600;
      cursor: pointer; transition: opacity 0.15s;
    }
    .btn:hover { opacity: 0.9; }
    .btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .btn-outline {
      background: transparent; color: var(--text-secondary);
      border: 1px solid var(--border);
    }
    .btn-outline:hover { color: var(--text-primary); border-color: var(--text-dim); }

    /* ============ SIDE MENU ============ */
    .side-menu-backdrop {
      position: fixed; inset: 0; background: rgba(0,0,0,0.55);
      opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 199;
    }
    .side-menu-backdrop.open { opacity: 1; pointer-events: auto; }
    .side-menu {
      position: fixed; top: 0; left: 0; bottom: 0;
      width: 320px; max-width: 88vw;
      background: var(--bg-card); border-right: 1px solid var(--border);
      transform: translateX(-100%); transition: transform 0.25s ease;
      z-index: 200; display: flex; flex-direction: column;
      box-shadow: 4px 0 24px rgba(0,0,0,0.45);
    }
    .side-menu.open { transform: translateX(0); }
    .side-menu-header {
      display: flex; align-items: center; gap: 12px;
      padding: 18px 16px; border-bottom: 1px solid var(--border);
      background: var(--bg-dark);
    }
    .side-menu-brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
    .side-menu-logo  { width: 36px; height: 36px; object-fit: contain; }
    .side-menu-eyebrow { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-secondary); font-weight: 500; }
    .side-menu-user { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .side-menu-close { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 24px; line-height: 1; padding: 4px 8px; border-radius: 4px; transition: color 0.15s, background 0.15s; }
    .side-menu-close:hover { color: var(--text-primary); background: var(--bg-input); }
    .side-menu-section-label { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; padding: 14px 14px 6px; }
    .side-menu-items { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
    .side-menu-item { display: flex; align-items: center; gap: 12px; padding: 10px 10px; text-decoration: none; color: var(--text-secondary); border-radius: 8px; transition: background 0.1s, color 0.1s; }
    .side-menu-item + .side-menu-item { margin-top: 2px; }
    .side-menu-item:hover { background: var(--bg-input); color: var(--text-primary); }
    .side-menu-item.current { background: var(--primary-glow); color: var(--primary); cursor: default; }
    .side-menu-item.current:hover { background: var(--primary-glow); }
    .side-menu-item-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg-input); flex-shrink: 0; color: var(--text-secondary); transition: background 0.1s, color 0.1s; }
    .side-menu-item:hover .side-menu-item-icon { background: rgba(255,255,255,0.05); color: var(--text-primary); }
    .side-menu-item.current .side-menu-item-icon { background: var(--primary); color: var(--bg-dark); }
    .side-menu-item-text { flex: 1; min-width: 0; }
    .side-menu-item-title { font-size: 14px; font-weight: 600; line-height: 1.2; }
    .side-menu-item-desc  { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
    .side-menu-footer { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
    .side-menu-footer .side-menu-foot-btn { flex: 1; background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 8px 10px; border-radius: 6px; font-size: 12px; font-family: inherit; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s; }
    .side-menu-footer .side-menu-foot-btn:hover { color: var(--text-primary); border-color: var(--text-dim); background: var(--bg-input); }
    .side-menu-footer .side-menu-foot-btn.danger { color: var(--red); border-color: var(--red); }
    .side-menu-footer .side-menu-foot-btn.danger:hover { background: rgba(255,107,107,0.08); }
    @media (max-width: 640px) { .side-menu { width: 88vw; } }

    /* ===== APP MODAL (shared confirm/alert) ===== */
    .app-modal {
      position: fixed; inset: 0;
      background: rgba(0, 0, 0, 0.55);
      display: flex; align-items: center; justify-content: center;
      z-index: 9999;
    }
    .app-modal-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 22px 24px;
      max-width: 460px; width: 90%;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    }
    .app-modal-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
    .app-modal-msg   { font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; line-height: 1.5; }
    .app-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
    .app-modal-actions button {
      padding: 8px 14px; font-family: inherit;
      font-size: 12px; font-weight: 600;
      background: var(--bg-input); color: var(--text-primary);
      border: 1px solid var(--border); border-radius: 6px;
      cursor: pointer;
    }
    .app-modal-actions button:hover { filter: brightness(1.1); }
    .app-modal-actions .app-modal-primary {
      background: var(--primary); color: var(--bg-card);
      border-color: var(--primary);
    }
