﻿/* Fonts are self-hosted: /vendor/fonts.css (@font-face) + a preload of the Geist
   variable woff2, wired in index.html. No third-party request, no render block. */

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

  html, body { max-width: 100%; overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  /* Design tokens (:root vars + theme classes) live in /tokens.css — shared
     with faction-admin.html and admin.html. Keep the link order tokens → styles. */

  body { background: var(--bg); color: var(--text); font-family: var(--dash-font); font-size: var(--fs-base); min-height: 100dvh; transition: background 0.3s, color 0.3s; font-variant-numeric: tabular-nums; }
  @media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; } }

  /* ── Feature flags (toggled via body class) ── */
  body.dash-compact .card-header { padding: 8px 12px; }
  body.dash-compact .card-body   { padding: 10px 12px; }
  body.dash-compact .metric      { padding: 10px 14px; }
  body.dash-compact .metric-value { font-size: var(--fs-xl); }
  body.dash-compact .report-table td { padding: 4px 8px; }
  body.dash-compact .report-table th { padding: 5px 8px; }
  body.dash-compact .attack-table td { padding: 4px 8px; }
  body.dash-compact .attack-table th { padding: 5px 8px; }
  body.dash-compact .ud-stat-row { padding: 5px 16px; }
  body.dash-flat .card:hover  { transform: none; box-shadow: 0 1px 3px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.28); }
  body.dash-flat .metric:hover { transform: none; box-shadow: 0 1px 3px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.28); }

  body::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 120% 50% at 50% -10%, rgba(88,166,255,0.06) 0%, transparent 55%); }
  body.theme-orange::before  { background: radial-gradient(ellipse 120% 50% at 50% -10%, rgba(243,138,29,0.08) 0%, transparent 55%); }
  body.theme-hacker::before  { background: radial-gradient(ellipse 120% 50% at 50% -10%, rgba(0,255,0,0.05) 0%, transparent 55%); }
  body.theme-blurple::before { background: radial-gradient(ellipse 120% 50% at 50% -10%, rgba(88,101,242,0.09) 0%, transparent 55%); }
  body.theme-light::before   { background: radial-gradient(ellipse 120% 50% at 50% -10%, rgba(9,105,218,0.04) 0%, transparent 55%); }
  /* Film-grain noise (same texture as welcome.html) — breaks digital flatness.
     Fixed + pointer-events:none so it never repaints on scroll. */
  body::after { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .35; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E"); }
  body.theme-light::after { display: none; }
  #app { position: relative; z-index: 1; }

  /* Display typography: headings get tighter tracking and never orphan a word. */
  h1, h2, h3 { letter-spacing: -.015em; text-wrap: balance; }

  /* Skeleton line stack — drop-in loading placeholder for panels. */
  .skel-lines { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
  .skel-lines .skeleton { height: 14px; }
  .skel-lines .skeleton:nth-child(1) { width: 40%; }
  .skel-lines .skeleton:nth-child(2) { width: 85%; }
  .skel-lines .skeleton:nth-child(3) { width: 65%; }

  /* ── Small shared utilities (extracted from repeated inline styles) ── */
  .kbd { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font-size: var(--fs-xs); color: var(--muted); font-family: var(--mono); }
  .shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
  .field { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: var(--fs-xs); padding: 6px 10px; outline: none; }
  .field:focus-visible { border-color: var(--blue); }
  .eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

  /* ── Icons (inline SVG sprite, currentColor) ── */
  .icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex-shrink: 0; }
  .icon-fill { fill: currentColor; stroke: none; }

  /* ── Buttons ── */
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: none; border-radius: 6px; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; transition: filter .15s, transform .05s, background .15s; }
  .btn:hover  { filter: brightness(1.12); }
  .btn:active { transform: translateY(1px); }
  .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
  .btn-ghost:hover { filter: none; background: rgba(255,255,255,.05); }
  .btn:disabled { opacity: .4; cursor: not-allowed; filter: none; transform: none; }
  .btn-primary { background: var(--blue);   color: #fff; }
  .btn-success { background: var(--green);  color: #fff; }
  .btn-danger  { background: var(--red);    color: #fff; }
  .btn-warn    { background: var(--yellow); color: #000; }
  .btn-ghost   { background: transparent; border: 1px solid var(--border); color: var(--text); }
  .btn-sm      { padding: 4px 10px; font-size: var(--fs-xs); }
  .btn-full    { width: 100%; justify-content: center; }

  /* ── App shell ── */
  #app { display: flex; flex-direction: column; min-height: 100dvh; }

  /* ── Header ── */
  header {
    background: var(--card); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 52px;
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  }
  .header-left  { display: flex; align-items: center; gap: 14px; flex: 1; }
  .header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
  
  .user-profile { display: flex; align-items: center; gap: 8px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--border); cursor: pointer; position: relative; padding: 4px 8px; border-radius: 8px; transition: background .15s; }
  .user-profile:hover { background: rgba(255,255,255,.06); }
  .user-avatar { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); }
  .user-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
  .user-chevron { font-size: var(--fs-xs); color: var(--muted); transition: transform .2s; margin-left: 2px; }
  .user-profile.open .user-chevron { transform: rotate(180deg); }

  /* ── User dropdown ── */
  .user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 260px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.6); z-index: 200; display: none; flex-direction: column; overflow: hidden; cursor: default; }
  .user-dropdown.show { display: flex; }

  /* identity header */
  .ud-identity { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.03); }
  .ud-avatar-lg { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
  .ud-names { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
  .ud-discord { font-size: var(--fs-sm); font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ud-torn { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* menu items */
  .ud-menu { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
  .ud-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text); cursor: pointer; border: none; background: none; width: 100%; text-align: left; transition: background .12s, color .12s; }
  .ud-item:hover { background: rgba(255,255,255,.07); }
  .ud-item-icon { font-size: var(--fs-lg); width: 20px; text-align: center; flex-shrink: 0; }
  .ud-item-arrow { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
  .ud-divider { height: 1px; background: var(--border); margin: 4px 6px; }
  .ud-item.danger { color: var(--red); }
  .ud-item.danger:hover { background: rgba(248,81,73,.12); }

  /* profile panel (shown after clicking Profile) */
  .ud-profile-panel { display: none; flex-direction: column; }
  .ud-profile-panel.show { display: flex; }
  .ud-back { display: flex; align-items: center; gap: 6px; padding: 10px 16px; font-size: var(--fs-xs); color: var(--muted); cursor: pointer; border-bottom: 1px solid var(--border); transition: color .12s; }
  .ud-back:hover { color: var(--text); }
  .ud-stat-grid { display: flex; flex-direction: column; gap: 0; padding: 6px 0; }
  .ud-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 16px; font-size: var(--fs-xs); border-bottom: 1px solid rgba(255,255,255,.04); }
  .ud-stat-row:last-child { border-bottom: none; }
  .ud-stat-label { color: var(--muted); }
  .ud-stat-val { font-weight: 600; color: var(--text); text-align: right; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ud-stat-val.green { color: var(--green); }
  .ud-stat-val.red   { color: var(--red); }
  .ud-stat-val.blue  { color: var(--blue); }

  /* settings panel */
  .ud-settings-panel { display: none; flex-direction: column; }
  .ud-settings-panel.show { display: flex; }
  .ud-settings-inner { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
  .ud-settings-inner select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: var(--fs-xs); padding: 6px 8px; outline: none; }
  .ud-settings-inner label { font-size: var(--fs-xs); color: var(--muted); display: block; margin-bottom: 4px; }
  .ud-check-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text); }

  /* ── Member keys grid (API breakdown panel) ── */
  .api-members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

  /* ── Global Search ── */
  #global-search-container { position: relative; max-width: 300px; width: 100%; margin-left: 20px; }
  #global-search { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; color: var(--text); font-size: var(--fs-sm); padding: 6px 36px 6px 32px; outline: none; width: 100%; transition: border-color 0.2s; cursor: pointer; }
  #global-search-kbd { position:absolute; right:10px; top:50%; transform:translateY(-50%); font-size:var(--fs-xs); color:var(--muted); background:rgba(255,255,255,.06); border-radius:3px; padding:1px 5px; pointer-events:none; font-family:inherit; }
  #global-search:focus { border-color: var(--blue); }
  #global-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: var(--fs-xs); color: var(--muted); pointer-events: none; }
  #global-search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 100; display: none; max-height: 400px; overflow-y: auto; }
  #global-search-results.show { display: block; }
  .search-result-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
  .search-result-item:last-child { border-bottom: none; }
  .search-result-item:hover { background: rgba(255,255,255,0.05); }
  .search-result-title { font-weight: 600; font-size: var(--fs-sm); color: var(--blue); }
  .search-result-desc { font-size: var(--fs-xs); color: var(--muted); }
  .bot-name     { font-weight: 700; font-size: var(--fs-lg); display: inline-flex; align-items: center; gap: 8px; }
  .bot-logo     { width: 20px; height: 20px; flex-shrink: 0; }
  .status-dot   { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; flex-shrink: 0; }
  .status-dot.online { background: var(--green); }
  .api-pill { display:flex; align-items:center; gap:5px; background:var(--bg); border:1px solid var(--border); border-radius:20px; padding:3px 10px; font-size:var(--fs-xs); white-space:nowrap; }
  .api-pill .api-dot { width:7px; height:7px; border-radius:50%; background:var(--muted); flex-shrink:0; transition:background .3s; }
  .api-pill .api-dot.online  { background:var(--green); }
  .api-pill .api-dot.offline { background:var(--red); }
  .api-pill .api-dot.calm    { background:var(--yellow); }
  .api-pill .api-label { color:var(--muted); }
  .api-pill .api-status { font-weight:600; color:var(--text); }
  .api-pill .api-usage  { color:var(--muted); font-size:var(--fs-xs); }
  .api-pill .sparkline  { display:block; margin-left:6px; opacity:0.6; }
  .stat-pill    { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
  .stat-pill span { color: var(--text); font-weight: 600; }

  /* ── Sidebar ── */
  #sidebar {
    position: fixed; top: 52px; left: 0; bottom: 0; width: var(--sidebar);
    background: var(--card); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 10; overflow-y: auto;
    transition: width 0.2s ease;
  }
  
  body.sidebar-minimized { --sidebar: 60px; }
  body.sidebar-minimized #sidebar .nav-section { display: none; }
  body.sidebar-minimized #sidebar .nav-item .nav-text { display: none; }
  body.sidebar-minimized #sidebar .nav-badge { display: none; }
  body.sidebar-minimized #notif-list-container { display: none !important; }
  body.sidebar-minimized #online-pill { display: none !important; }
  body.sidebar-minimized #sidebar .nav-item { justify-content: center; padding: 12px 0; }
  body.sidebar-minimized #sidebar-min-icon { transform: rotate(180deg); }
  .nav-section { padding: 14px 12px 6px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .admin-nav { display: none !important; }
  .nav-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 8px; cursor: pointer;
    color: var(--muted); font-size: var(--fs-sm); font-weight: 500;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
    text-decoration: none; user-select: none; overflow: hidden;
  }
  .nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
  .nav-item.active { color: var(--text); border-left-color: var(--blue); background: rgba(88,166,255,.08); }
  .nav-item:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
  .nav-icon { font-size: var(--fs-lg); width: 18px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
  .nav-badge { margin-left: auto; background: var(--blue); color: #fff; font-size: var(--fs-xs); font-weight: 700; border-radius: 10px; padding: 1px 6px; }

  .mobile-toggle { display: none; background: transparent; border: none; color: var(--text); font-size: var(--fs-xl); cursor: pointer; padding: 4px; margin-right: 8px; }
  @media (max-width: 800px) {
    /* ── Sidebar: hidden by default, overlays content when open ── */
    .mobile-toggle { display: block; }
    #sidebar {
      transform: translateX(-100%);
      transition: transform 0.2s ease;
      /* Above the war bar (40) and docked feed (45) so the open menu always
         covers them instead of the sticky war bar bleeding over the sidebar. */
      z-index: 70;
    }
    #sidebar.show {
      transform: translateX(0);
      box-shadow: 4px 0 24px rgba(0,0,0,0.7);
    }

    /* ── Main: full width, tighter padding ── */
    #main { margin-left: 0 !important; padding: 10px; gap: 10px; }

    /* ── Header: keep only essential items ── */
    header { padding: 0 12px; }
    #global-search-container { display: none; }
    #layout-lock-btn         { display: none; }
    #sys-pill                { display: none; }
    #api-pill-1              { display: none; }
    #api-pill-2              { display: none; }
    .bot-name                { font-size: var(--fs-sm); }
    #bot-tag                 { display: none; }
    /* Clock: shrink it */
    #tz-toggle               { min-width: 0; padding: 3px 6px; font-size: var(--fs-xs); }

    /* ── Cards ── */
    .card-body  { padding: 10px; }
    .card-header { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }

    /* ── Grids: always single column ── */
    .two-col, .three-col { grid-template-columns: 1fr !important; }
    .metrics { grid-template-columns: repeat(2, 1fr) !important; }
    .war-section.active[data-section="scores"] { grid-template-columns: 1fr !important; }

    /* ── Main content: never wider than viewport ── */
    #main { overflow-x: hidden; }
    .card { max-width: 100%; overflow: hidden; }

    /* ── Report table: allow horizontal scrolling on mobile instead of hiding data ── */
    .report-scroll { overflow-x: auto; overflow-y: auto; }
    .report-table { width: 100%; font-size: var(--fs-xs); min-width: 600px; }
    .report-table th, .report-table td { padding: 6px 5px; white-space: nowrap; }
    
    /* Member column: takes remaining space */
    .report-table td:nth-child(3) { width: auto; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }

    /* ── Attack feed: similar treatment ── */
    .attack-table { width: 100%; font-size: var(--fs-xs); min-width: 500px; }
    .attack-table th, .attack-table td { padding: 6px 5px; white-space: nowrap; }
    #attacks-panel { overflow-x: auto; }

    /* ── War score: shrink big numbers ── */
    .faction-pts { font-size: var(--fs-3xl); }

    /* ── Log entries: 2-col (time + message) ── */
    .log-entry { grid-template-columns: 58px 1fr; gap: 6px; }
    .log-cat, .log-level { display: none; }

    /* ── Heatmap ── */
    .hm-meta { flex: 0 0 auto; font-size: var(--fs-xs); }
    .hm-panels-wrap { grid-template-columns: 1fr !important; }

    /* ── Modal: full width on mobile ── */
    .modal { width: 96%; max-height: 85vh; }

    /* ── Revive/target grids ── */
    .revive-grid { grid-template-columns: 1fr !important; }

    /* ── War tabs: scroll horizontally on small screens ── */
    .war-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
    .war-tab  { white-space: nowrap; flex-shrink: 0; font-size: var(--fs-xs); padding: 6px 10px; }

    /* ── Sub-tabs (targets) ── */
    .sub-tab { font-size: var(--fs-xs); padding: 4px 8px; flex-shrink: 0; }

    /* ── Member rows: more compact ── */
    .member-card  { padding: 8px 10px; gap: 8px; }
    .member-stats { flex-wrap: wrap; gap: 4px; }

    /* ── Page header: stack on very small screens ── */
    .page-header { flex-wrap: wrap; gap: 8px; }

    /* ── Targets collapsible: full-width on mobile ── */
    #ws-targets-section .target-card { grid-template-columns: 1fr 1fr; }
  }

  /* ── Main content ── */
  #main { margin-left: var(--sidebar); margin-top: 52px; padding: 24px; display: flex; flex-direction: column; gap: 20px; min-height: calc(100vh - 52px); }

  /* ── Pages ── */
  .page { display: none; flex-direction: column; gap: 20px; max-width: 1400px; margin: 0 auto; width: 100%; }
  .page.active { display: flex; animation: pageIn .22s cubic-bezier(.32,.72,0,1) both; }
  @keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

  /* ── Cards ── */
  .card { background: rgba(22,27,34,0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.28); transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.35); }
  body.theme-orange .card  { background: rgba(36,28,22,0.88); }
  body.theme-hacker .card  { background: rgba(10,24,10,0.88); }
  body.theme-blurple .card { background: rgba(43,45,49,0.88); }
  body.theme-light .card   { background: rgba(255,255,255,0.88); }
  .card-header { padding: 11px 18px; border-bottom: 1px solid rgba(48,54,61,.35); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .card-header h2 { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); white-space: nowrap; }
  .card-body { padding: 18px; }

  /* ── Grids ── */
  .two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
  @media (max-width: 1100px) { .three-col { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 800px)  { .two-col, .three-col { grid-template-columns: 1fr; } }

  /* ── Metrics ── */
  .metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
  @media (max-width: 1100px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
  @media (max-width: 700px)  { .metrics { grid-template-columns: repeat(2, 1fr); } }

  /* ── Large-screen scaling (QHD / UW / 4K / 8K) ──────────────────────────── */
  /* 1440p monitors: wider sidebar, expand max-width, 6-col metrics */
  @media (min-width: 1600px) {
    :root { --sidebar: 170px; }
    #main { padding: 28px 36px; }
    .page { max-width: 1600px; }
    .metrics { grid-template-columns: repeat(6, 1fr); }
    .card-body { padding: 20px 22px; }
  }
  /* QHD/2K (2560×1440 native, or 4K at 150 % DPI) */
  @media (min-width: 2000px) {
    :root { --sidebar: 180px; }
    #main { padding: 32px 44px; }
    .page { max-width: 1960px; }
    .metrics { grid-template-columns: repeat(7, 1fr); }
    .card-body { padding: 22px 26px; }
  }
  /* UW-QHD (3440×1440 native) / 4K at 125 % DPI */
  @media (min-width: 2560px) {
    :root { --sidebar: 190px; }
    #main { padding: 36px 52px; }
    .page { max-width: 2480px; }
    .metrics { grid-template-columns: repeat(8, 1fr); }
    .card-body { padding: 24px 28px; }
    .metric { padding: 18px 20px; }
    .two-col { gap: 24px; }
    .three-col { gap: 24px; }
  }
  /* 4K UHD native (3840×2160) / 8K at 200 % DPI */
  @media (min-width: 3440px) {
    :root { --sidebar: 200px; }
    #main { padding: 40px 60px; }
    .page { max-width: 3360px; }
    .metrics { grid-template-columns: repeat(9, 1fr); }
    .card-body { padding: 26px 32px; }
    .two-col { gap: 28px; }
    .three-col { gap: 28px; }
  }
  /* 8K UHD native (7680×4320) */
  @media (min-width: 5120px) {
    :root { --sidebar: 220px; }
    #main { padding: 48px 72px; }
    .page { max-width: none; }
    .metrics { grid-template-columns: repeat(10, 1fr); }
    .card-body { padding: 30px 36px; }
    .two-col { gap: 32px; }
    .three-col { gap: 32px; }
  }
  .metric { background: rgba(22,27,34,0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.28); padding: 16px 18px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .metric:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 14px 36px rgba(0,0,0,.35); }
  body.theme-orange .metric  { background: rgba(36,28,22,0.88); }
  body.theme-hacker .metric  { background: rgba(10,24,10,0.88); }
  body.theme-blurple .metric { background: rgba(43,45,49,0.88); }
  body.theme-light .metric   { background: rgba(255,255,255,0.88); }
  .metric-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
  .metric-value { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; font-family: var(--mono); letter-spacing: -.02em; }
  .metric-sub   { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
  .metric-value.green  { color: var(--green); }
  .metric-value.yellow { color: var(--yellow); }
  .metric-value.red    { color: var(--red); }

  /* ── Xanax cost (averages) ── */
  .xc-section { margin-top: 24px; }
  .xc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 18px;
    background: linear-gradient(135deg, rgba(248,81,73,0.10), rgba(248,81,73,0.02));
    border: 1px solid rgba(248,81,73,0.22); border-radius: 14px; }
  .xc-head-icon { font-size: var(--fs-3xl); line-height: 1; filter: drop-shadow(0 2px 6px rgba(248,81,73,.4)); }
  .xc-head-title { font-size: var(--fs-lg); font-weight: 700; color: var(--text); letter-spacing: .01em; }
  .xc-head-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }

  .xc-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  @media (max-width: 800px) { .xc-cards { grid-template-columns: 1fr; } }
  .xc-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .xc-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.32); }
  .xc-card--accent { border-color: rgba(248,81,73,0.45);
    background: linear-gradient(160deg, rgba(248,81,73,0.10), var(--card) 60%);
    box-shadow: 0 0 0 1px rgba(248,81,73,0.12) inset; }
  .xc-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .xc-card-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
  .xc-card-badge { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--red); background: rgba(248,81,73,0.14); border-radius: 999px; padding: 2px 7px; }
  .xc-card-value { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; color: var(--red); letter-spacing: -.01em; }
  .xc-card--accent .xc-card-value { font-size: var(--fs-4xl); }
  .xc-card-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 8px; }

  .xc-chart { margin-top: 18px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
  .xc-chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .xc-chart-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .xc-chart-legend { font-size: var(--fs-xs); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
  .xc-dot { width: 18px; height: 0; border-top: 2px dashed var(--red); display: inline-block; }
  .xc-chart-plot { position: relative; }
  .xc-avg-line { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(248,81,73,0.6);
    pointer-events: none; z-index: 1; }
  .xc-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; position: relative; z-index: 2; }
  .xc-bar-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; }
  .xc-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
  .xc-bar { width: 100%; border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, var(--red), rgba(248,81,73,0.55));
    transition: filter .15s ease; }
  .xc-bar-col:hover .xc-bar { filter: brightness(1.18); }
  .xc-bar--partial { background: repeating-linear-gradient(135deg, rgba(248,81,73,0.45), rgba(248,81,73,0.45) 4px, rgba(248,81,73,0.18) 4px, rgba(248,81,73,0.18) 8px); }
  .xc-bar-x { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }

  /* ── Timers ── */
  .timer-row { display: grid; grid-template-columns: 1fr 56px 52px 36px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(48,54,61,.3); }
  .timer-row:last-child { border-bottom: none; }
  .timer-name     { font-weight: 500; display: flex; flex-direction: column; gap: 2px; }
  .timer-lastrun  { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
  .timer-interval { color: var(--muted); font-size: var(--fs-xs); text-align: center; }

  /* ── Badges ── */
  .badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: var(--fs-xs); font-weight: 600; }
  .badge-on  { background: rgba(63,185,80,.15);  color: var(--green); }
  .badge-off { background: rgba(248,81,73,.12);  color: var(--red); }
  .badge-warn{ background: rgba(210,153,34,.15); color: var(--yellow); }

  /* ── Profiles & War History ── */
  .profile-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
  .profile-table th { padding: 7px 10px; text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; }
  .profile-table td { padding: 7px 10px; border-bottom: 1px solid rgba(48,54,61,.5); }
  .profile-table tr:hover td { background: rgba(255,255,255,.03); cursor: pointer; }
  .member-roster-table td.num, .member-roster-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
  .member-roster-table td { white-space: nowrap; }
  /* Names match the sitewide .nx-name standard: bold text-color, accent on
     hover — not accent-colored at rest (rendered as a wall of red/orange
     under the accent themes). */
  .member-link { color: var(--text); font-weight: 600; text-decoration: none; }
  .member-link:hover { color: var(--blue); text-decoration: underline; }
  .member-roster-table tr.member-row.expanded > td { background: rgba(88,166,255,.06); }
  .member-roster-table tr.member-detail-row:hover > td { background: rgba(0,0,0,.22); cursor: default; }
  /* The logged-in member's own row — highlighted with a left accent. */
  .member-roster-table tr.member-row-me > td { background: rgba(88,166,255,.07); }
  .member-roster-table tr.member-row-me > td:first-child { box-shadow: inset 2px 0 0 var(--blue); }
  .you-tag { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--blue); background: rgba(88,166,255,.16); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
  .member-info-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: var(--fs-xs); padding: 0 2px; line-height: 1; }
  .member-info-btn:hover { color: var(--blue); }
  /* .src-pill / .src-torn removed 2026-07-24: the "TORN" pill that marked a
     self-reported battle-stat total is now a green ✓ (see _selfPowerInner in
     app-utils.js), which reads the same on a roster card, a dense numeric column
     and a stat row — the pill only fitted the first. No rule referenced it. */
  /* Battle-stats chart range chips */
  .bs-range-row { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
  .bs-range-chip { border: 0; background: none; color: var(--muted); cursor: pointer; font-family: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 3px 9px; border-radius: 5px; }
  .bs-range-chip:hover { color: var(--text); }
  .bs-range-chip.active { background: var(--blue); color: #fff; }
  .bar-wrap { background: var(--bg); border-radius: 4px; height: 6px; width: 80px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
  .bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blue), #a0d0ff); }
  .bar-fill.green { background: linear-gradient(90deg, var(--green), #58e87c); }
  .wh-split { display: flex; min-height: calc(100vh - 180px); }
  .wh-left { width: 210px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
  .wh-right { flex: 1; min-width: 0; overflow-y: auto; padding: 16px; }
  /* Both history scoreboard tables always the same viewport-relative height */
  .wh-right .report-scroll {
    max-height: none;
    height: calc(100vh - 340px);
    min-height: 300px;
  }
  .wh-entry { padding: 11px 14px; border-bottom: 1px solid rgba(48,54,61,.4); cursor: pointer; transition: background .12s; }
  .wh-entry:hover { background: rgba(255,255,255,.04); }
  .wh-entry.wh-selected { background: rgba(88,166,255,.07); border-left: 3px solid var(--blue); padding-left: 11px; }
  .pill-win  { background: rgba(63,185,80,.15);  color: var(--green);  border-radius: 10px; padding: 2px 8px; font-size: var(--fs-xs); font-weight: 700; }
  .pill-loss { background: rgba(248,81,73,.15);  color: var(--red);    border-radius: 10px; padding: 2px 8px; font-size: var(--fs-xs); font-weight: 700; }
  .scorecard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
  .scorecard-stat { background: var(--card); border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.45), 0 6px 20px rgba(0,0,0,.28); padding: 14px 16px; }
  .scorecard-stat .s-val { font-size: var(--fs-2xl); font-weight: 700; color: var(--blue); }
  .scorecard-stat .s-label { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }

  /* ── My Profile page ─────────────────────────────────── */
  #profile-page-body .card { margin-bottom: 14px; }
  .pf-hero { padding: 0; }
  .pf-section { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.05); }
  .pf-hero-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .pf-mono { position: relative; width: 54px; height: 54px; border-radius: 15px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: var(--fs-2xl); font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 55%, #000)); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
  .pf-mono .pf-dot { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%;
    border: 3px solid var(--card); }
  .pf-dot.dot-online { background: var(--green); } .pf-dot.dot-idle { background: var(--yellow); } .pf-dot.dot-offline { background: var(--muted); }
  .pf-name { font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; }
  .pf-name .pf-id { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }
  .pf-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }

  .pf-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
  .pf-metric { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.05); position: relative; }
  .pf-metric + .pf-metric { border-left: 1px solid rgba(255,255,255,.05); }
  .pf-metric-val { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
  .pf-metric-label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
  .pf-metric-spark { position: absolute; right: 12px; bottom: 12px; opacity: .85; }
  @media (max-width: 720px) {
    .pf-metrics { grid-template-columns: repeat(2, 1fr); }
    .pf-metric:nth-child(3) { border-left: none; }
  }

  .pf-chips { display: flex; gap: 8px; flex-wrap: wrap; }
  .pf-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted);
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; transition: border-color .15s; }
  .pf-chip:hover { border-color: color-mix(in srgb, var(--blue) 40%, var(--border)); }
  .pf-chip strong { color: var(--text); font-weight: 600; }

  .pf-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px 18px; }
  .pf-bar-head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-xs); margin-bottom: 5px; }
  .pf-bar-name { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: var(--fs-xs); font-weight: 600; }
  .pf-bar-val { font-weight: 600; color: var(--text); }
  .pf-bar-track { height: 8px; border-radius: 5px; background: var(--bg); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
  .pf-bar-fill { height: 100%; border-radius: 5px; transition: width 1s linear;
    background: var(--bar); box-shadow: 0 0 8px -1px color-mix(in srgb, var(--bar) 60%, transparent); }
  .pf-bar-timer { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; min-height: 13px; }

  .pf-combat { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
  .pf-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
  .pf-donut-cap { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .pf-combat-right { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 14px; }
  .pf-ratio-head { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 5px; }
  .pf-ratio-track { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg); box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
  .pf-ratio-track > div { transition: width .6s ease; }
  .pf-statcells { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 9px; }
  .pf-cell { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; transition: border-color .15s, transform .15s; }
  .pf-cell:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); transform: translateY(-1px); }
  .pf-cell-val { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .pf-cell-label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
  .pf-cell-rate { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

  /* Personal-stats range toggle */
  .pf-stats-card .card-header { gap: 10px; flex-wrap: wrap; }
  .pf-range-row { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
  .pf-range-chip { border: 0; background: none; color: var(--muted); cursor: pointer; font-family: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 4px 11px; border-radius: 6px; transition: background .12s, color .12s; }
  .pf-range-chip:hover { color: var(--text); }
  .pf-range-chip.active { background: var(--blue); color: #fff; }
  .pf-stats-sub { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 12px; }

  /* ── Members → Activity ── */
  #activity-cards { grid-template-columns: repeat(6, 1fr); margin-bottom: 0; }
  #activity-cards .s-val { font-size: var(--fs-2xl); }
  .activity-lists-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  @media (max-width: 900px) {
    #activity-cards { grid-template-columns: repeat(3, 1fr); }
    .activity-lists-grid { grid-template-columns: 1fr; }
  }

  /* ── Controls ── */
  .controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .controls-grid .btn { font-size: var(--fs-xs); padding: 8px 10px; }

  /* Status tab top row: compact metrics left, API right */
  .status-top { display: grid; grid-template-columns: 260px 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
  .metrics-compact { display: flex; flex-direction: column; gap: 0; }
  .mc-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 16px; border-bottom: 1px solid rgba(48,54,61,.3); }
  .mc-row:last-child { border-bottom: none; }
  .mc-label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .mc-value { font-size: var(--fs-xl); font-weight: 700; color: var(--text); }
  .mc-sub   { font-size: var(--fs-xs); color: var(--muted); text-align: right; margin-top: 1px; }

  /* ── Database Browser ── */
  /* ── Changelog ── */
  .cl-layout { display:flex; min-height:500px; max-height:660px; }
  .cl-left  { width:340px; flex-shrink:0; border-right:1px solid var(--border); display:flex; flex-direction:column; padding-bottom:8px; }
  .cl-right { flex:1; min-width:0; overflow-y:auto; }
  /* calendar header */
  .cl-cal-hdr { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--border); }
  .cl-cal-title { font-size:var(--fs-sm); font-weight:700; color:var(--text); letter-spacing:.02em; }
  .cl-cal-btn { background:none; border:none; color:var(--muted); cursor:pointer; font-size:var(--fs-xl); padding:2px 8px; border-radius:4px; line-height:1; }
  .cl-cal-btn:hover { background:var(--hover); color:var(--text); }
  /* calendar grid */
  .cl-cal-grid { padding:12px 14px 8px; }
  .cl-cal-week { display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
  .cl-cal-lbl  { font-size:var(--fs-xs); font-weight:700; color:var(--muted); text-align:center; padding:4px 0 8px; letter-spacing:.05em; }
  .cl-cal-day  { font-size:var(--fs-xs); font-weight:500; text-align:center; padding:8px 2px; border-radius:6px; cursor:default; position:relative; line-height:1; color:var(--muted); }
  .cl-cal-day.cl-cal-empty { color:transparent; }
  .cl-cal-day.in-month  { color:var(--text); }
  .cl-cal-day.has-deploy { background:rgba(59,130,246,.18); color:var(--blue); font-weight:700; cursor:pointer; }
  .cl-cal-day.has-deploy:hover { background:rgba(59,130,246,.32); }
  .cl-cal-day.has-deploy .cl-cal-count { display:inline-block; font-size:var(--fs-xs); font-weight:700; background:var(--blue); color:#fff; border-radius:3px; padding:0 3px; margin-left:2px; vertical-align:middle; line-height:14px; }
  .cl-cal-day.selected { background:var(--blue) !important; color:#fff !important; }
  .cl-cal-day.selected .cl-cal-count { background:rgba(255,255,255,.35) !important; color:#fff !important; }
  .cl-cal-day.today.in-month:not(.has-deploy) { font-weight:700; color:var(--green); }
  /* filter bar */
  .cl-filter-bar { display:flex; align-items:center; gap:8px; padding:6px 16px; border-top:1px solid var(--border); margin-top:4px; }
  .cl-filter-label { font-size:var(--fs-xs); color:var(--muted); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .cl-filter-clear { font-size:var(--fs-xs); color:var(--blue); cursor:pointer; background:none; border:none; padding:0; }
  .cl-filter-clear:hover { text-decoration:underline; }
  /* right — deploy cards */
  .cl-detail-empty { padding:60px 20px; text-align:center; color:var(--muted); font-size:var(--fs-xs); }
  .cl-date-sep { padding:10px 20px 6px; font-size:var(--fs-xs); font-weight:700; color:var(--muted); letter-spacing:.07em; text-transform:uppercase; border-bottom:1px solid var(--border); background:rgba(255,255,255,.02); }
  .cl-entry { padding:14px 20px; border-bottom:1px solid var(--border); }
  .cl-entry:last-child { border-bottom:none; }
  .cl-entry-top { display:flex; align-items:center; gap:8px; margin-bottom:9px; }
  .cl-entry-badge { font-size:var(--fs-xs); font-weight:700; background:var(--blue); color:#fff; border-radius:5px; padding:3px 8px; flex-shrink:0; }
  .cl-entry-meta  { font-size:var(--fs-xs); color:var(--muted); display:flex; gap:10px; margin-left:auto; flex-shrink:0; }
  .cl-entry-headline { font-size:var(--fs-sm); font-weight:600; color:var(--text); margin-bottom:8px; line-height:1.4; }
  .cl-entry-bullets  { list-style:none; padding:0; margin:0; }
  .cl-entry-bullets li { font-size:var(--fs-xs); color:var(--muted); line-height:1.7; padding-left:16px; position:relative; }
  .cl-entry-bullets li::before { content:'▸'; position:absolute; left:3px; color:var(--blue); font-size:var(--fs-xs); top:2px; }
  .db-browser { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
  .db-col-list { display: flex; flex-direction: column; gap: 2px; }
  .db-col-group { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 3px; opacity: .7; }
  .db-col-group-hdr { cursor: pointer; display: flex; align-items: center; gap: 5px; user-select: none; border-radius: 4px; transition: opacity .12s; }
  .db-col-group-hdr:hover { opacity: 1; background: rgba(255,255,255,.04); }
  .db-col-arrow { display: inline-block; font-size: var(--fs-xs); transition: transform .15s; color: var(--muted); line-height: 1; }
  .db-col-arrow-open { transform: rotate(90deg); }
  .db-col-folder { display: flex; align-items: center; gap: 5px; padding: 5px 8px 5px 16px; cursor: pointer; font-size: var(--fs-xs); font-weight: 600; color: var(--text); border-radius: 6px; user-select: none; transition: background .12s; }
  .db-col-folder:hover { background: rgba(255,255,255,.05); }
  .db-col-folder-icon { font-size: var(--fs-xs); flex-shrink: 0; }
  .db-col-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .db-col-item.db-col-item-nested { padding-left: 32px; }
  .db-col-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: var(--fs-sm); color: var(--text); transition: background .12s; }
  .db-col-item:hover { background: rgba(255,255,255,.05); }
  .db-col-item.active { background: rgba(88,166,255,.15); color: var(--blue); }
  .db-col-count { font-size: var(--fs-xs); color: var(--muted); background: var(--bg); border-radius: 10px; padding: 1px 6px; }
  /* Excel / SQL grid */
  .db-grid-wrap { overflow-x: auto; overflow-y: auto; max-height: 62vh; }
  .db-grid { border-collapse: collapse; width: 100%; font-size: var(--fs-xs); }
  .db-th { position: sticky; top: 0; z-index: 2; background: var(--bg); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 7px 10px; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; transition: color .1s; }
  .db-th:hover { color: var(--text); }
  .db-th-sorted { color: var(--blue); }
  .db-td { padding: 5px 10px; border-bottom: 1px solid rgba(48,54,61,.6); white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: var(--text); vertical-align: middle; font-size: var(--fs-xs); }
  .db-td-edit { cursor: text; }
  .db-td-edit:hover { background: rgba(88,166,255,.06) !important; }
  .db-tr:nth-child(even) .db-td { background: rgba(255,255,255,.018); }
  .db-tr:hover .db-td { background: rgba(255,255,255,.05) !important; }
  .db-null { color: var(--muted); font-style: italic; }
  .db-bool-true  { color: var(--green); font-weight: 700; }
  .db-bool-false { color: var(--red);   font-weight: 700; }
  .db-num  { color: #d19a66; font-family: 'Cascadia Code','Fira Code',monospace; }
  .db-obj  { color: var(--muted); font-family: 'Cascadia Code','Fira Code',monospace; font-size: var(--fs-xs); }
  .db-date { color: #c678dd; }
  .db-cell-input { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--blue); border-radius: 3px; padding: 2px 5px; font-size: var(--fs-xs); outline: none; font-family: inherit; box-shadow: 0 0 0 2px rgba(88,166,255,.2); }
  .db-row-edit-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: var(--fs-base); padding: 2px 5px; border-radius: 4px; transition: color .1s, background .1s; line-height: 1; }
  .db-row-edit-btn:hover { color: var(--blue); background: rgba(88,166,255,.12); }
  .db-sql-bar { font-family: 'Cascadia Code','Fira Code',monospace; font-size: var(--fs-xs); color: var(--muted); background: var(--bg); border-radius: 6px; padding: 7px 14px; margin-bottom: 12px; border: 1px solid var(--border); overflow-x: auto; white-space: nowrap; line-height: 1.6; }
  .db-sql-kw  { color: #c678dd; font-weight: 700; }
  .db-sql-tbl { color: var(--blue); }
  .db-sql-str { color: #98c379; }
  .db-pager { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: var(--fs-xs); color: var(--muted); border-top: 1px solid var(--border); }
  /* DB Activity Log */
  .db-activity-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 8px; border-radius: 4px; font-size: var(--fs-xs); font-family: 'Cascadia Code','Fira Code',monospace; line-height: 1.6; }
  .db-activity-row:nth-child(even) { background: rgba(255,255,255,.018); }
  .db-activity-ts   { color: var(--muted); flex-shrink: 0; font-size: var(--fs-xs); }
  .db-activity-lv   { flex-shrink: 0; font-weight: 700; font-size: var(--fs-xs); padding: 1px 5px; border-radius: 3px; text-transform: uppercase; letter-spacing: .04em; }
  .db-activity-lv.read  { color: #61afef; background: rgba(97,175,239,.1); }
  .db-activity-lv.write { color: #98c379; background: rgba(152,195,121,.1); }
  .db-activity-lv.info  { color: var(--muted); background: rgba(255,255,255,.06); }
  .db-activity-lv.warn  { color: #d19a66; background: rgba(209,154,102,.1); }
  .db-activity-cat  { color: var(--blue); flex-shrink: 0; }
  .db-activity-msg  { color: var(--text); word-break: break-all; }
  /* API stats */
  .db-api-key  { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .db-api-key:last-child { border-bottom: none; }
  .db-api-bar  { height: 4px; border-radius: 2px; background: var(--blue); transition: width .4s; max-width: 100%; }
  .db-api-ep   { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); padding: 1px 0; }
  .db-edit-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; }
  .db-edit-box { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 201; background: var(--card); border: 1px solid var(--border); border-radius: 10px; width: min(780px, 95vw); max-height: 85vh; display: flex; flex-direction: column; }
  .db-edit-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .db-edit-head span { font-weight: 600; font-size: var(--fs-sm); }
  #db-edit-json { flex: 1; resize: none; background: var(--bg); color: var(--text); border: none; border-radius: 0; font-family: 'Cascadia Code','Fira Code',monospace; font-size: var(--fs-xs); padding: 14px 16px; outline: none; overflow: auto; min-height: 300px; max-height: 55vh; }
  .db-edit-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
  /* Sidebar collection row: label + size badge + count */
  .db-col-item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .db-col-item-meta  { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
  .db-col-size { font-size: var(--fs-xs); color: var(--muted); opacity: .8; font-variant-numeric: tabular-nums; }
  .db-col-item.active .db-col-size { color: var(--blue); opacity: .9; }
  /* Selected-collection header metadata */
  .db-col-meta { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
  .db-col-meta-size { font-variant-numeric: tabular-nums; }
  /* Retention tier badge */
  .db-ret { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px; }
  .db-ret-ttl   { color: #61afef; background: rgba(97,175,239,.12); }
  .db-ret-prune { color: #d19a66; background: rgba(209,154,102,.12); }
  .db-ret-perm  { color: var(--muted); background: rgba(255,255,255,.06); }
  /* Live "/min" rate pill (activity + api panels) */
  .db-rate-pill { font-size: var(--fs-xs); font-weight: 700; padding: 2px 7px; border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.06); font-variant-numeric: tabular-nums; transition: color .2s, background .2s; }
  .db-rate-pill.active { color: #98c379; background: rgba(152,195,121,.14); }
  /* Tree / Raw view toggle */
  .db-view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
  .db-view-toggle button { background: none; border: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; padding: 4px 10px; cursor: pointer; transition: background .12s, color .12s; }
  .db-view-toggle button:hover { color: var(--text); background: rgba(255,255,255,.05); }
  .db-view-toggle button.active { color: var(--blue); background: rgba(88,166,255,.14); }
  /* Collapsible JSON tree */
  .db-edit-tree { flex: 1; overflow: auto; padding: 12px 16px; font-family: 'Cascadia Code','Fira Code',monospace; font-size: var(--fs-xs); line-height: 1.7; min-height: 300px; max-height: 55vh; background: var(--bg); }
  .db-tree-node { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.06); }
  .db-tree-node > summary { cursor: pointer; margin-left: -14px; list-style-position: inside; user-select: none; }
  .db-tree-node > summary:hover { color: var(--text); }
  .db-tree-leaf { padding-left: 14px; }
  .db-tree-key { color: #79c0ff; }
  .db-tree-str { color: #98c379; }

  /* Controls page tab bar */
  .ctrl-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
  .ctrl-tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--muted); font-size: var(--fs-sm); font-weight: 500;
    padding: 10px 20px; cursor: pointer; margin-bottom: -1px;
    transition: color .15s, border-color .15s; display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
  }
  .ctrl-tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
  .ctrl-tab.active { color: var(--text); border-bottom-color: var(--blue); }
  .ctrl-tab-badge {
    background: var(--red); color: #fff; font-size: var(--fs-xs); font-weight: 700;
    border-radius: 8px; padding: 1px 5px; display: none;
  }
  .ctrl-tab-badge.show { display: inline; }

  /* ── Faction stats ── */
  .faction-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 14px; }
  .faction-stat  { display: flex; flex-direction: column; gap: 2px; }
  .faction-stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .faction-stat-value { font-size: var(--fs-2xl); font-weight: 700; }

  /* ── Key health ── */
  .key-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
  .key-row:last-child { border-bottom: none; }
  .key-label { font-size: var(--fs-xs); color: var(--muted); width: 80px; flex-shrink: 0; }
  .key-name  { font-size: var(--fs-sm); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .key-level { font-size: var(--fs-xs); color: var(--muted); flex-shrink: 0; }

  /* ── War panel ── */
  .war-score { display: flex; align-items: center; justify-content: space-around; padding: 6px 0 10px; }
  .faction-score { text-align: center; flex: 1; }
  .faction-name  { font-size: var(--fs-lg); font-weight: 700; color: var(--text); margin-bottom: 6px; }
  .faction-name a { color: inherit; text-decoration: none; display: inline-block; padding: 4px 12px; border-radius: 8px; border: 1px solid rgba(139,148,158,.25); background: rgba(139,148,158,.07); transition: background .15s, border-color .15s, color .15s; }
  .faction-name a:hover { color: var(--blue); border-color: rgba(88,166,255,.5); background: rgba(88,166,255,.08); }
  .faction-pts   { font-size: var(--fs-4xl); font-weight: 800; line-height: 1; }
  .faction-pts.ours   { color: var(--green); }
  .faction-pts.theirs { color: var(--red); }
  .vs-label { color: var(--muted); font-weight: 700; font-size: var(--fs-lg); flex-shrink: 0; }
  .online-row  { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
  .online-stat { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); }
  @keyframes dot-pulse { 0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(63,185,80,0.4)} 50%{opacity:0.85;box-shadow:0 0 0 4px rgba(63,185,80,0)} }
  .dot-online  { width:8px;height:8px;border-radius:50%;background:var(--green);display:inline-block;flex-shrink:0; animation: dot-pulse 2.2s ease-in-out infinite; }
  .dot-idle    { width:8px;height:8px;border-radius:50%;background:var(--yellow);display:inline-block;flex-shrink:0; }
  .dot-offline { width:8px;height:8px;border-radius:50%;background:var(--muted);display:inline-block;flex-shrink:0; }
  .status-dot.online { animation: dot-pulse 2.2s ease-in-out infinite; }

  /* ── Member roster ── */
  .member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .member-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
  .member-name   { font-weight: 600; font-size: var(--fs-sm); word-wrap: break-word; }
  .member-meta   { font-size: var(--fs-xs); color: var(--muted); }
  .member-status { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); margin-top: 2px; }

  /* ── Armory ── */
  .armory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .armory-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .armory-item.bg-low { border-color: rgba(248,81,73,.3); background: rgba(248,81,73,.05); }
  .armory-item.bg-medium { border-color: rgba(210,153,34,.3); background: rgba(210,153,34,.05); }
  .armory-item.bg-ok { border-color: rgba(63,185,80,.3); background: rgba(63,185,80,.05); }
  .armory-name { font-size: var(--fs-xs); color: var(--text); text-transform: capitalize; flex: 1; }
  .armory-qty  { font-size: var(--fs-2xl); font-weight: 700; flex-shrink: 0; }
  .armory-qty.low    { color: var(--red); }
  .armory-qty.medium { color: var(--yellow); }
  .armory-qty.ok     { color: var(--green); }

  /* ── Vault Balance ── */
  .vault-strip { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
  .vault-strip-amount { font-size: var(--fs-2xl); font-weight: 800; color: var(--blue); letter-spacing: -0.02em; }
  .vault-strip-label  { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; font-weight: 700; }
  .vault-strip-meta   { flex: 1; min-width: 0; }
  
  .vault-req-card { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-left: 3px solid var(--blue); border-radius: 8px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; transition: background 0.15s; }
  .vault-req-card:hover { background: rgba(255,255,255,0.04); }
  .vault-req-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .vault-req-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
  .vault-req-amt  { font-size: var(--fs-base); font-weight: 700; color: var(--blue); }
  .vault-req-note { font-size: var(--fs-xs); color: var(--muted); font-style: italic; margin-top: 2px; }
  .vault-req-time { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; text-align: right; margin-bottom: 6px; }
  
  .bal-my-request { background: rgba(88,166,255,.08); border: 1px solid rgba(88,166,255,.2); border-left: 3px solid var(--blue); border-radius: 8px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); margin-top: 10px; }

  /* ── Attacks feed ── */
  .attack-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
  .attack-table th { position: sticky; top: 0; z-index: 2; background: var(--card); text-align: left; padding: 6px 10px; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid rgba(48,54,61,.4); white-space: nowrap; }
  .attack-table td { padding: 6px 10px; border-bottom: none; vertical-align: middle; }
  .attack-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.018); }
  .attack-table tr:hover td { background: rgba(88,166,255,.06) !important; }
  .attack-result { padding: 2px 7px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
  .result-attack { background: rgba(63,185,80,.15);  color: var(--green); }
  .result-defend { background: rgba(88,166,255,.12); color: var(--blue); }
  .result-loss   { background: rgba(248,81,73,.12);  color: var(--red); }
  .result-other  { background: rgba(139,148,158,.12);color: var(--muted); }
  /* Win/loss row indicator */
  .atk-bar       { width: 3px; padding: 0 !important; }
  .atk-bar.tr-win  { background: var(--green); }
  .atk-bar.tr-loss { background: var(--red); }
  .attack-table tr.tr-win td   { background: rgba(63,185,80,.13)  !important; }
  .attack-table tr.tr-loss td  { background: rgba(248,81,73,.13)  !important; }
  .attack-table tr.tr-win:hover td  { background: rgba(63,185,80,.22)  !important; }
  .attack-table tr.tr-loss:hover td { background: rgba(248,81,73,.22)  !important; }
  .attack-outcome { padding: 2px 7px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
  .out-win     { background: rgba(63,185,80,.18);  color: var(--green); }
  .out-loss    { background: rgba(248,81,73,.18);  color: var(--red); }
  .out-def     { background: rgba(88,166,255,.15); color: var(--blue); }
  .out-neutral { background: rgba(139,148,158,.12);color: var(--muted); }

  /* ── War report table ── */
  .report-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
  .report-table th { position: sticky; top: 0; z-index: 2; background: var(--card); text-align: left; padding: 7px 12px; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid rgba(48,54,61,.4); cursor: pointer; user-select: none; white-space: nowrap; }
  .report-table th:hover { color: var(--text); }
  .report-table th.num, .report-table td.num { text-align: right; }
  .report-table td { padding: 6px 12px; border-bottom: none; }
  .report-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.018); }
  .report-table tr:hover td { background: rgba(88,166,255,.15) !important; }
  .report-table td .name-cell { display: flex; align-items: center; gap: 6px; }
  .row-actions { display: none; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); gap: 4px; background: var(--card); padding: 2px; border-radius: 6px; border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 10; }
  .report-table tr:hover .row-actions { display: flex; }
  .sort-asc::after  { content: ' ↑'; color: var(--blue); }
  .sort-desc::after { content: ' ↓'; color: var(--blue); }
  .report-scroll { max-height: 500px; overflow-y: auto; overflow-x: auto; }
  .rank-cell { color: var(--muted); font-size: var(--fs-xs); width: 32px; }
  /* Compact overrides for the split (recent war) two-column layout */
  .report-split .report-table { font-size: var(--fs-xs); }
  .report-split .report-table th { padding: 6px 8px; }
  .report-split .report-table td { padding: 5px 8px; }
  .report-split .report-scroll { max-height: 460px; }

  /* ── Activity log ── */
  .log-filters { display: flex; gap: 6px; flex-wrap: wrap; }
  .filter-chip { padding: 3px 10px; border-radius: 12px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: var(--fs-xs); cursor: pointer; transition: all .15s; }
  .filter-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
  #log-list, #log-list-sys { font-family: 'SF Mono', 'Consolas', monospace; font-size: var(--fs-xs); display: flex; flex-direction: column; gap: 1px; }
  .log-entry { display: grid; grid-template-columns: 62px 46px 90px 1fr; gap: 6px; padding: 3px 6px; border-radius: 3px; align-items: baseline; }
  .log-entry:hover { background: rgba(255,255,255,.03); }
  .log-ts   { color: var(--muted); white-space: nowrap; }
  .log-lvl  { font-weight: 600; }
  .log-cat  { color: var(--muted); }
  .log-msg  { color: var(--text); word-break: break-word; }
  .log-entry.info    .log-lvl { color: var(--blue); }
  .log-entry.success .log-lvl { color: var(--green); }
  .log-entry.warn    .log-lvl { color: var(--yellow); }
  .log-entry.error   .log-lvl { color: var(--red); }
  .log-entry.hidden  { display: none; }

  /* ── Channels ── */
  .channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
  .channel-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
  .channel-id   { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 8px; font-family: monospace; }
  .channel-embeds { display: flex; flex-wrap: wrap; gap: 4px; }

  /* ── War tabs ── */
  .war-tabs { display: flex; gap: 0; border-bottom: 1px solid rgba(48,54,61,.4); margin-bottom: 4px; }
  .war-tab { padding: 8px 18px; border-radius: 0; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .03em; cursor: pointer; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--muted); transition: color .15s, border-color .15s; }
  .war-tab:hover { color: var(--text); }
  .war-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
  @keyframes tabFadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
  .war-section { display: none; }
  .war-section.active { display: flex; flex-direction: column; gap: 20px; animation: tabFadeIn .18s ease; }

  /* ── Attendance ── */
  .att-war-vs { display:flex; align-items:center; justify-content:center; gap:10px; font-size:var(--fs-base); font-weight:700; margin-bottom:16px; color:var(--muted); }
  .att-war-vs .att-vs-fac { color:var(--text); font-size:var(--fs-lg); }
  .att-war-vs .att-vs-sep { font-size:var(--fs-xs); font-weight:400; letter-spacing:.08em; color:var(--muted); text-transform:uppercase; padding:0 4px; }
  .att-vs-sep { color:#e8400c; margin:0 6px; }
  .att-summary { display:none; }
  .att-sum { font-size:var(--fs-xs); font-weight:600; padding:3px 10px; border-radius:12px; background:var(--bg); border:1px solid var(--border); }
  .att-sum.yes   { color:var(--green);  border-color:var(--green);  background:rgba(87,242,135,.08); }
  .att-sum.maybe { color:var(--yellow); border-color:var(--yellow); background:rgba(254,231,92,.08); }
  .att-sum.no    { color:var(--red);    border-color:var(--red);    background:rgba(237,66,69,.08); }
  .att-sum.mine  { color:var(--blue);   border-color:var(--blue);   background:rgba(88,101,242,.08); }
  .att-no-session { font-size:var(--fs-xs); color:var(--muted); margin-bottom:10px; padding:10px; border-left:3px solid #e8400c; background:rgba(232,64,12,.05); border-radius:0 6px 6px 0; }
  .att-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:16px; }
  .att-btn { padding:14px 12px; border-radius:8px; border:1px solid var(--border); background:var(--bg); color:var(--muted); font-size:var(--fs-sm); font-weight:600; cursor:pointer; transition:all .15s; text-align:center; display:flex; flex-direction:column; align-items:center; gap:4px; width:100%; }
  .att-btn .att-btn-label { font-size:var(--fs-sm); font-weight:700; }
  .att-btn .att-btn-sub   { font-size:var(--fs-xs); font-weight:400; opacity:.75; }
  .att-btn:hover:not(:disabled) { border-color:var(--text); color:var(--text); }
  .att-btn:disabled { opacity:.4; cursor:default; }
  .att-btn.att-btn-attending { background:rgba(87,242,135,.08); border-color:rgba(87,242,135,.5); color:var(--green); }
  .att-btn.att-btn-maybe     { background:rgba(254,231,92,.08); border-color:rgba(254,231,92,.5); color:var(--yellow); }
  .att-btn.att-btn-cant      { background:rgba(237,66,69,.08);  border-color:rgba(237,66,69,.5);  color:var(--red); }
  /* Discord-style embed fields */
  .att-embed { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:0; }
  @media(max-width:640px) { .att-embed { grid-template-columns:1fr; } }
  .att-field { padding:12px 14px; border-radius:8px; border:1px solid var(--border); background:var(--bg); }
  .att-field.att-field-attending { border-top:3px solid var(--green); }
  .att-field.att-field-maybe     { border-top:3px solid var(--yellow); }
  .att-field.att-field-cant      { border-top:3px solid var(--red); }
  .att-field-name { font-size:var(--fs-xs); font-weight:700; text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
  .att-field-value { font-size:var(--fs-xs); line-height:1.8; }
  .att-none { color:var(--muted); font-style:italic; }
  .att-member { display:flex; align-items:center; gap:5px; }
  .att-me { font-weight:700; color:var(--blue); }
  .att-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
  .att-dot.online  { background:var(--green); }
  .att-dot.idle    { background:var(--yellow); }
  .att-dot.offline { background:var(--muted); opacity:.5; }

  /* ── Scores tab two-column resizable layout ── */
  .war-section.active[data-section="scores"] { display: flex; flex-direction: row; gap: 0; align-items: start; }
  .scores-left  { flex-shrink: 0; width: 40%; min-width: 200px; display: flex; flex-direction: column; gap: 20px; }
  .scores-right { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
  .scores-right .card { flex: 1; }
  .scores-divider {
    flex-shrink: 0; width: 20px; cursor: col-resize; align-self: stretch;
    position: relative; display: flex; align-items: center; justify-content: center;
    user-select: none; -webkit-user-select: none;
  }
  .sd-line {
    position: absolute; top: 0; bottom: 0; width: 3px;
    background: var(--border); border-radius: 2px; transition: background .15s, box-shadow .15s;
  }
  .sd-handle {
    position: relative; z-index: 1; display: flex; flex-direction: column;
    gap: 4px; padding: 6px 0; background: var(--card); border-radius: 4px;
  }
  .sd-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); transition: background .15s; margin: 0 2px; }
  .scores-divider:hover .sd-line,
  .scores-divider.sd-dragging .sd-line { background: var(--blue); box-shadow: 0 0 8px rgba(88,166,255,.35); }
  .scores-divider:hover .sd-dot,
  .scores-divider.sd-dragging .sd-dot { background: var(--blue); }
  @media (max-width: 900px) {
    .war-section.active[data-section="scores"] { flex-direction: column; }
    .scores-left { width: 100% !important; min-width: 0; }
    .scores-divider { display: none; }
  }
  .sub-tab { padding: 6px 14px; border-radius: 6px 6px 0 0; font-size: var(--fs-xs); font-weight: 500; cursor: pointer; border: 1px solid transparent; background: transparent; color: var(--muted); transition: all .15s; display: inline-flex; align-items: center; gap: 5px; }
  .sub-tab:hover { color: var(--text); }
  .sub-tab.active { background: var(--card); border-color: var(--border); border-bottom-color: var(--card); color: var(--text); }
  .target-section  { display: none; }
  .target-section.active  { display: block; }
  .intel-section   { display: none; }
  .intel-section.active   { display: block; }
  .report-section  { display: none; }
  .report-section.active  { display: block; }

  /* ── Heatmap line chart ── */
  .hm-svg    { width: 100%; height: auto; display: block; overflow: hidden; }
  /* Activity chart hover layer */
  .act-chart-wrap { position: relative; }
  .act-tip { position: absolute; top: 8px; z-index: 5; pointer-events: none; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-card); padding: 8px 10px; font-size: var(--fs-xs); line-height: 1.7; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .act-tip-t { font-weight: 700; color: var(--text); margin-bottom: 2px; font-family: var(--mono); font-size: var(--fs-xs); }
  .act-tip-row { display: flex; align-items: center; gap: 6px; color: var(--muted); }
  .act-tip-row b { color: var(--text); margin-left: auto; padding-left: 14px; font-weight: 600; }
  .act-tip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

  .hm-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; font-size: var(--fs-xs); }
  .hm-legend-item { display: inline-flex; align-items: center; gap: 6px; }

  /* ── Heatmap chart type picker ── */
  .hm-type-picker { display: flex; gap: 4px; }
  .hm-type-picker button {
    background: var(--card); border: 1px solid var(--border); color: var(--muted);
    padding: 4px 14px; border-radius: 6px; font-size: var(--fs-xs); cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
  }
  .hm-type-picker button:hover { background: rgba(255,255,255,.06); color: var(--text); }
  .hm-type-picker button.active { background: var(--blue); border-color: var(--blue); color: #fff; }

  /* ── Heatmap activity panels ── */
  .hm-panels-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  @media (max-width: 700px) { .hm-panels-wrap { grid-template-columns: 1fr; } }

  /* Heatmap expand mode */
  .hm-expand-btn { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); cursor: pointer; padding: 3px 7px; font-size: var(--fs-xs); line-height: 1; transition: color .15s, border-color .15s; }
  .hm-expand-btn:hover { color: var(--text); border-color: var(--text); }
  [data-panel="ws-heatmap"].hm-expanded { position: fixed; inset: 0; z-index: 500; border-radius: 0; margin: 0; overflow-y: auto; }
  [data-panel="ws-heatmap"].hm-expanded .card-body { padding-bottom: 32px; }

  .hm-panel { background: var(--card); border-radius: 10px; overflow: hidden; }
  .hm-panel--blue { border-top: 3px solid var(--blue); }
  .hm-panel--red  { border-top: 3px solid var(--red); }

  .hm-panel-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 8px; font-weight: 600; font-size: var(--fs-sm);
    border-bottom: 1px solid var(--border);
  }
  .hm-panel--blue .hm-panel-name { color: var(--blue); }
  .hm-panel--red  .hm-panel-name { color: var(--red); }
  .hm-panel-meta { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }

  .hm-col-labels {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 14px; font-size: var(--fs-xs); color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
  }
  .hm-rows { padding: 4px 0; }

  .hm-row {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 14px; font-size: var(--fs-xs);
  }
  .hm-row:hover { background: rgba(255,255,255,.03); }

  .hm-rank       { flex: 0 0 28px; text-align: center; }
  .hm-rank-icon  { font-size: var(--fs-base); }
  .hm-rank-num   { color: var(--muted); font-size: var(--fs-xs); }
  .hm-hour       { flex: 0 0 46px; font-weight: 600; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
  .hm-avg        { flex: 0 0 40px; text-align: right; font-weight: 700; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
  .hm-bar-wrap   { flex: 1; height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
  .hm-bar        { height: 100%; border-radius: 3px; transition: width .3s; }
  .hm-bar--blue  { background: linear-gradient(90deg, var(--blue), #a0d0ff); }
  .hm-bar--red   { background: linear-gradient(90deg, var(--red), #ff8080); }
  .hm-meta       { flex: 0 0 160px; text-align: right; color: var(--muted); font-size: var(--fs-xs); display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
  .hm-meta-online { color: var(--green); font-weight: 600; }
  .hm-meta-idle   { color: var(--yellow); font-weight: 600; }
  .hm-meta-sep    { opacity: .35; }
  .hm-samples    { opacity: .6; }

  /* ── Revives ── */
  .revive-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  @media (max-width: 800px) { .revive-grid { grid-template-columns: 1fr; } }
  .revive-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); align-content: start; gap: 10px; max-height: 600px; overflow-y: auto; }
  .revive-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; transition: border-color .15s; }
  .revive-card:hover { border-color: var(--accent); }
  .revive-card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
  .revive-name { font-weight: 600; font-size: var(--fs-sm); word-break: break-word; line-height: 1.2; }
  .revive-power { font-size: var(--fs-xs); }
  .revive-setting { font-size: var(--fs-xs); color: var(--muted); }
  .revive-status-text { font-size: var(--fs-xs); color: var(--yellow); margin-top: 2px; }

  /* ── Targets ── */
  .target-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 480px; overflow-y: auto; }
  .target-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
  .target-name  { font-weight: 600; font-size: var(--fs-sm); word-wrap: break-word; }
  .target-meta  { font-size: var(--fs-xs); color: var(--muted); }
  .target-until { font-size: var(--fs-xs); color: var(--yellow); }
  .target-link  { font-size: var(--fs-xs); color: var(--blue); text-decoration: none; }
  .target-link:hover { text-decoration: underline; }

  /* ── Push message ── */
  .push-form { display: flex; flex-direction: column; gap: 10px; }
  .push-form select, .push-form textarea {
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); font-size: var(--fs-sm); padding: 9px 12px; outline: none;
    font-family: inherit; width: 100%; transition: border-color .15s;
  }
  .push-form select:focus, .push-form textarea:focus { border-color: var(--blue); }
  .push-form textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
  .push-row { display: flex; gap: 10px; }
  .push-row > * { flex: 1; }
  .char-count { font-size: var(--fs-xs); color: var(--muted); text-align: right; margin-top: -6px; }
  .char-count.warn { color: var(--yellow); }
  .char-count.over { color: var(--red); }

  /* ── Misc ── */
  .section-title { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
  .empty { color: var(--muted); font-size: var(--fs-sm); text-align: center; padding: 32px 16px; letter-spacing: .01em; }
  hr.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
  .last-updated { font-size: var(--fs-xs); color: var(--muted); }
  .page-header { display: flex; align-items: center; justify-content: space-between; }
  .page-title { font-size: var(--fs-xl); font-weight: 700; }

  /* ── Toast ── */
  #toast { position: fixed; bottom: 24px; right: 24px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 18px; font-size: var(--fs-sm); opacity: 0; transform: translateY(8px); transition: all .25s; pointer-events: none; z-index: 100; }
  #toast.show { opacity: 1; transform: translateY(0); }
  #toast.ok  { border-color: var(--green); color: var(--green); }
  #toast.err { border-color: var(--red);   color: var(--red); }

  /* ── Spinner ── */
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── Scrollbar ── */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  /* ── Layout rows & cells ── */
  .layout-row  { display: flex; align-items: stretch; }
  .layout-cell { min-width: 0; flex-shrink: 0; }

  /* ── Modal ── */
  .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.2s; }
  .modal-backdrop.show { display: flex; opacity: 1; }
  .modal { background: var(--card); border: 1px solid var(--border); border-radius: 12px; width: 92%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 16px 32px rgba(0,0,0,0.8); transform: scale(0.95); transition: transform 0.2s; }
  .modal-backdrop.show .modal { transform: scale(1); }
  .modal-header { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
  .modal-close { background: transparent; border: none; color: var(--muted); font-size: var(--fs-xl); cursor: pointer; padding: 4px; line-height: 1; }
  .modal-close:hover { color: var(--text); }
  .modal-body { padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

  /* ── Resize handle — sits between two cells, IS the gap ── */
  .layout-resize-handle {
    flex: 0 0 16px; cursor: col-resize; position: relative; z-index: 1;
  }
  .layout-resize-handle::after {
    content: ''; position: absolute; top: 8px; bottom: 8px; left: 7px; width: 2px;
    border-radius: 1px; background: transparent; transition: background .15s;
  }
  body.layout-editing .layout-resize-handle:hover::after,
  body.layout-editing .layout-resize-handle.resizing::after { background: var(--blue); }

  /* ── Drop zone indicators (shown on the cell, not the panel) ── */
  .layout-cell.dz-top    { box-shadow: 0 -3px 0 0 var(--blue); }
  .layout-cell.dz-bottom { box-shadow: 0  3px 0 0 var(--blue); }
  .layout-cell.dz-left   { box-shadow: -3px 0 0 0 var(--blue); }
  .layout-cell.dz-right  { box-shadow:  3px 0 0 0 var(--blue); }

  /* ── Drag state ── */
  .panel-dragging { opacity: .3; }

  /* ── Drag handle grip ── */
  .panel-drag-handle {
    cursor: grab; color: var(--border); font-size: var(--fs-lg); line-height: 1;
    padding: 0 8px 0 0; opacity: 0; transition: opacity .15s, color .15s;
    user-select: none; flex-shrink: 0;
  }
  body.layout-editing [data-panel]:hover .panel-drag-handle { opacity: 1; }
  .panel-drag-handle:hover { color: var(--muted) !important; }

  /* ── Dashed outline on panels when editing (edit mode hint) ── */
  [data-panel] { position: relative; }
  body.layout-editing [data-panel]::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    border: 1px dashed rgba(88,166,255,.2); border-radius: 10px;
  }

  /* ── Layout lock button ── */
  #layout-lock-btn {
    background: transparent; border: 1px solid var(--border); color: var(--muted);
    padding: 4px 12px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 500;
    cursor: pointer; transition: all .15s; white-space: nowrap;
  }
  #layout-lock-btn:hover { color: var(--text); border-color: var(--muted); }
  body.layout-editing #layout-lock-btn { border-color: var(--blue);  color: var(--blue); }
  body.layout-locked  #layout-lock-btn { border-color: var(--green); color: var(--green); }

  /* ── Zoom badge ── */
  #zoom-badge {
    position: fixed; bottom: 70px; right: 24px; z-index: 500;
    background: rgba(22,27,34,.92); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 14px; font-size: var(--fs-sm); font-weight: 700;
    color: var(--text); opacity: 0; transition: opacity .3s; pointer-events: none;
    letter-spacing: .02em;
  }

  /* ── Zoom reset hint ── */
  #zoom-badge::after {
    content: ' · Ctrl+0 to auto';
    font-size: var(--fs-xs); font-weight: 400; color: var(--muted);
  }

  /* ── Dual Range Slider ── */
  .dual-slider { position: relative; width: 140px; height: 24px; display: flex; align-items: center; }
  .dual-slider input[type="range"] { position: absolute; width: 100%; pointer-events: none; -webkit-appearance: none; appearance: none; background: transparent; z-index: 2; margin: 0; outline: none; }
  .dual-slider input[type="range"]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); cursor: pointer; }
  .dual-slider .track { position: absolute; width: 100%; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; z-index: 0; }
  .dual-slider .progress { position: absolute; height: 4px; background: var(--blue); border-radius: 2px; z-index: 1; }
  /* ── AI Chat Widget ── */
  #ai-fab { position:fixed; bottom:24px; right:24px; width:52px; height:52px; border-radius:50%; background:var(--blue); border:none; cursor:pointer; font-size:var(--fs-2xl); display:flex; align-items:center; justify-content:center; box-shadow:0 4px 16px rgba(0,0,0,.4); z-index:1000; transition:transform .15s; }
  #ai-fab:hover { transform:scale(1.08); }
  #ai-panel { position:fixed; bottom:88px; right:24px; width:520px; max-height:72vh; background:var(--card); border:1px solid var(--border); border-radius:12px; box-shadow:0 12px 48px rgba(0,0,0,.7); z-index:1000; display:none; flex-direction:column; overflow:hidden; transition:all .2s; }
  #ai-panel.open { display:flex; }
  #ai-panel.expanded { width:780px; max-height:88vh; bottom:20px; right:20px; }
  #ai-panel-header { padding:10px 14px; background:var(--blue); color:#fff; font-weight:600; font-size:var(--fs-sm); display:flex; justify-content:space-between; align-items:center; gap:8px; }
  #ai-panel-header-controls { display:flex; gap:6px; align-items:center; }
  #ai-tone-select { background:rgba(255,255,255,.15); border:1px solid rgba(255,255,255,.3); border-radius:4px; color:#fff; font-size:var(--fs-xs); padding:2px 6px; cursor:pointer; }
  #ai-tone-select option { background:var(--surface); color:var(--text); }
  #ai-messages { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:10px; }
  .ai-msg { max-width:90%; padding:10px 13px; border-radius:10px; font-size:var(--fs-xs); line-height:1.6; word-break:break-word; overflow-x: auto; }
  .ai-msg.user { align-self:flex-end; background:var(--blue); color:#fff; border-bottom-right-radius:3px; white-space:normal; }
  .ai-msg.bot  { align-self:flex-start; background:var(--bg); border:1px solid var(--border); border-bottom-left-radius:3px; max-width:96%; }
  .ai-msg table { width: 100%; border-collapse: collapse; margin: 8px 0; }
  .ai-msg th, .ai-msg td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
  .ai-msg th { background: rgba(255,255,255,0.05); }
  .ai-msg pre { background: rgba(0,0,0,0.3); padding: 8px; border-radius: 4px; overflow-x: auto; margin: 8px 0; }
  .ai-msg code { font-family: monospace; background: rgba(0,0,0,0.2); padding: 2px 4px; border-radius: 3px; }
  .ai-msg p { margin: 0 0 8px 0; }
  .ai-msg p:last-child { margin-bottom: 0; }
  .ai-msg.thinking { color:var(--muted); font-style:italic; }
  .ai-msg-ts { font-size:var(--fs-xs); color:var(--muted); margin-top:6px; display:block; }
  .ai-msg-copy { font-size:var(--fs-xs); color:var(--muted); cursor:pointer; margin-top:5px; display:inline-block; }
  .ai-msg-copy:hover { color:var(--blue); }
  .ai-dots span { display:inline-block; animation:ai-dot .8s infinite; width:5px; height:5px; background:var(--muted); border-radius:50%; margin:0 2px; }
  .ai-dots span:nth-child(2) { animation-delay:.15s; }
  .ai-dots span:nth-child(3) { animation-delay:.3s; }
  @keyframes ai-dot { 0%,80%,100%{transform:scale(0)} 40%{transform:scale(1)} }
  .ai-chips { display:flex; gap:6px; flex-wrap:wrap; padding:8px 12px; border-top:1px solid var(--border); background:rgba(255,255,255,.02); }
  .ai-chip { font-size:var(--fs-xs); padding:4px 10px; border-radius:12px; border:1px solid var(--border); color:var(--muted); cursor:pointer; white-space:nowrap; transition:all .15s; }
  .ai-chip:hover { border-color:var(--blue); color:var(--blue); }
  #ai-input-row { display:flex; gap:6px; padding:10px; border-top:1px solid var(--border); }
  #ai-input { flex:1; background:var(--bg); border:1px solid var(--border); border-radius:6px; color:var(--text); font-size:var(--fs-xs); padding:7px 10px; outline:none; resize:none; height:54px; }
  .ai-member-link { color:var(--blue); cursor:pointer; text-decoration:none; border-bottom:1px dotted var(--blue); }
  .ai-val-good { color:var(--green); font-weight:600; }
  .ai-val-warn { color:#d29922; font-weight:600; }
  .ai-val-bad  { color:var(--red); font-weight:600; }
  /* ── Section blocks ── */
  .ai-section { margin:8px 0 0; }
  .ai-section-label { display:inline-block; font-size:var(--fs-xs); font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); padding:3px 0 2px; margin-bottom:2px; }
  .ai-section-body { display:block; color:var(--text); line-height:1.6; }
  /* ── Aligned data tables (consecutive pipe rows) ── */
  .ai-table { display:table; width:100%; border-collapse:collapse; margin:3px 0; background:rgba(255,255,255,.025); border-radius:6px; overflow:hidden; border:1px solid var(--border); }
  .ai-table-single { border-radius:6px; }
  .ai-tr { display:table-row; }
  .ai-tr:not(:last-child) .ai-tc { border-bottom:1px solid var(--border); }
  .ai-tc { display:table-cell; padding:5px 11px; font-size:var(--fs-xs); color:var(--text); vertical-align:middle; white-space:nowrap; border-right:1px solid var(--border); line-height:1.45; }
  .ai-tc:first-child { font-weight:600; min-width:80px; }
  .ai-tc:last-child { border-right:none; white-space:normal; width:99%; }
  /* ── Lists ── */
  .ai-list { margin:3px 0 3px 2px; padding:0; list-style:none; }
  .ai-list li { padding:2px 0 2px 14px; position:relative; line-height:1.55; }
  .ai-list li::before { content:'·'; position:absolute; left:3px; color:var(--muted); font-weight:900; }
  ol.ai-list { counter-reset:ai-ol; }
  ol.ai-list li::before { content:counter(ai-ol) '.'; counter-increment:ai-ol; font-weight:600; color:var(--muted); font-size:var(--fs-xs); top:3px; }
  /* ── Dividers ── */
  .ai-divider { display:flex; align-items:center; gap:8px; margin:14px 0 6px; font-size:var(--fs-xs); font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); opacity:.7; }
  .ai-divider::before, .ai-divider::after { content:''; flex:1; height:1px; background:var(--border); }
  .ai-hr { height:1px; background:var(--border); margin:8px 0; opacity:.4; }
  /* ── Sub-lines and spacing ── */
  .ai-subline { font-size:var(--fs-xs); color:var(--muted); padding:1px 0 1px 10px; border-left:2px solid var(--border); margin:2px 0; line-height:1.5; }
  .ai-spacer { height:8px; }
  .ai-line { padding:1px 0; line-height:1.65; font-size:var(--fs-xs); }
  /* ── AI Bubble — dismissible inline insight panel ── */
  .ai-bubble { background:var(--bg); border:1px solid var(--blue); border-radius:8px; margin-top:14px; overflow:hidden; animation:fadeIn .2s ease; }
  @keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
  .ai-bubble-header { background:rgba(88,166,255,.08); border-bottom:1px solid rgba(88,166,255,.2); padding:8px 14px; display:flex; align-items:center; justify-content:space-between; font-size:var(--fs-xs); font-weight:600; color:var(--blue); }
  .ai-bubble-close { background:none; border:none; color:var(--muted); cursor:pointer; font-size:var(--fs-lg); line-height:1; padding:0 2px; }
  .ai-bubble-close:hover { color:var(--text); }
  .ai-bubble-body { padding:12px 16px; font-size:var(--fs-xs); line-height:1.65; color:var(--text); }
  .ai-trigger { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:5px; font-size:var(--fs-xs); font-weight:500; cursor:pointer; border:1px solid var(--border); background:transparent; color:var(--muted); transition:all .15s; white-space:nowrap; }
  .ai-trigger:hover { border-color:var(--blue); color:var(--blue); }
  .ai-trigger:disabled { opacity:.5; cursor:wait; }
  .ai-alert-banner { padding:7px 10px 7px 12px; background:rgba(248,81,73,.1); border-bottom:1px solid rgba(248,81,73,.25); font-size:var(--fs-xs); color:var(--red); display:flex; align-items:center; gap:6px; }
  .ai-alert-banner span { flex:1; }
  .ai-alert-dismiss { background:none; border:none; color:var(--red); cursor:pointer; font-size:var(--fs-sm); line-height:1; opacity:.7; padding:0 2px; flex-shrink:0; }
  .ai-alert-dismiss:hover { opacity:1; }
  .log-ai-out { display:block; font-size:var(--fs-xs); color:var(--blue); padding:2px 0 4px 8px; line-height:1.5; border-left:2px solid var(--blue); margin:2px 0 2px 8px; }
  /* ── AI panels ── */
  .ai-report-box { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:14px 16px; font-size:var(--fs-xs); line-height:1.7; color:var(--text); white-space:pre-wrap; margin-top:12px; }
  .ai-panel-btn { display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:6px; font-size:var(--fs-xs); font-weight:600; cursor:pointer; border:1px solid var(--blue); background:transparent; color:var(--blue); transition:all .15s; }
  .ai-panel-btn:hover { background:var(--blue); color:#fff; }
  .ai-panel-btn:disabled { opacity:.5; cursor:wait; }
  /* ── Attack Feed ── */
  #attack-feed { position:fixed; top:62px; right:16px; width:280px; min-width:240px; max-width:800px; max-height:calc(100vh - 80px); background:rgba(10,13,18,.45); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); border:1px solid rgba(48,54,61,.45); border-radius:10px; z-index:1500; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 8px 32px rgba(0,0,0,.4); pointer-events:auto; resize:horizontal; user-select:none; }
  #attack-feed.feed-hidden { display:none; }
  #attack-feed .feed-entry { pointer-events:auto; }
  .feed-header { display:flex; align-items:center; padding:7px 12px; border-bottom:1px solid rgba(48,54,61,.35); flex-shrink:0; cursor:grab; }
  .feed-header.feed-dragging { cursor:grabbing; }
  .feed-title { font-size:var(--fs-xs); font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:rgba(139,148,158,.5); }
  #feed-list { overflow-y:auto; flex:1; padding:4px 0; }
  .feed-empty { font-size:var(--fs-xs); color:var(--muted); text-align:center; padding:16px; font-style:italic; }
  #feed-list:not(:empty) + .feed-empty { display:none; }
  .feed-entry { padding:7px 12px 4px; border-bottom:1px solid rgba(48,54,61,.4); animation:feedSlide .25s ease; position:relative; }
  @keyframes feedSlide { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:none; } }
  .feed-names { display:flex; align-items:center; gap:5px; font-size:var(--fs-xs); font-weight:600; }
  .feed-arr { color:var(--muted); font-size:var(--fs-xs); flex-shrink:0; }
  .feed-atk { color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:95px; }
  .feed-def { color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:95px; }
  .feed-detail { display:flex; align-items:center; gap:5px; margin-top:2px; font-size:var(--fs-xs); flex-wrap:wrap; }
  .feed-result-tag { color:var(--muted); font-weight:600; }
  .feed-hosp-tag { font-size:var(--fs-xs); font-weight:700; letter-spacing:.05em; padding:1px 4px; border-radius:3px; background:rgba(188,140,255,.2); color:#bc8cff; }
  .feed-resp { font-weight:700; color:var(--green); }
  .feed-time { margin-left:auto; color:var(--muted); font-variant-numeric:tabular-nums; opacity:.6; }
  /* result tag colours */
  .res-hosp-long { color:#bc8cff !important; }
  .res-hit       { color:var(--green); }
  .res-mug       { color:#d29922; }
  .res-arrest    { color:#d29922; }
  .res-special   { color:var(--blue); }
  .res-lost      { color:var(--red); }
  .res-escape    { color:#d29922; }
  .res-assist    { color:var(--yellow); }
  .res-timeout   { color:var(--muted); }
  /* assists row */
  .feed-assists { display:flex; flex-wrap:wrap; gap:4px; margin-top:3px; align-items:center; }
  .feed-assists::before { content:'🤝'; font-size:var(--fs-xs); opacity:.7; }
  .feed-assist-name { font-size:var(--fs-xs); font-weight:600; color:#d29922; background:rgba(210,153,34,.1); padding:1px 5px; border-radius:3px; }
  .feed-bar { height:2px; background:rgba(255,255,255,.06); border-radius:1px; margin-top:5px; }
  .feed-bar-fill { height:100%; width:100%; background:rgba(255,255,255,.15); border-radius:1px; }
  /* entry colour variants */
  .feed-hosp         .feed-atk { color:#bc8cff; }
  .feed-hosp         .feed-bar-fill { background:#bc8cff; opacity:.5; }
  .feed-win          .feed-atk { color:var(--green); }
  .feed-win          .feed-bar-fill { background:var(--green); opacity:.35; }
  .feed-loss         .feed-atk { color:var(--red); }
  .feed-loss         .feed-bar-fill { background:var(--red); opacity:.35; }
  .feed-defend-win   .feed-def { color:var(--green); }
  .feed-defend-win   .feed-bar-fill { background:var(--green); opacity:.35; }
  .feed-defend-loss  .feed-def { color:var(--red); }
  .feed-defend-loss  .feed-bar-fill { background:var(--red); opacity:.35; }
  /* toggle button active state */
  .feed-btn-active { border-color:var(--blue) !important; color:var(--blue) !important; background:rgba(88,166,255,.08) !important; }
  .active-toggle { border-color:#d29922 !important; color:#d29922 !important; background:rgba(210,153,34,.08) !important; }
  .theme-swatch { outline:none; }
  .swatch-active { box-shadow:0 0 0 2px var(--blue); }
  /* feed header controls */
  #attack-feed .feed-header { pointer-events:auto; }
  .feed-ctrl-btn { background:transparent; border:1px solid rgba(48,54,61,.6); color:rgba(139,148,158,.6); border-radius:4px; padding:2px 7px; font-size:var(--fs-xs); font-weight:600; cursor:pointer; transition:all .15s; letter-spacing:.02em; }
  .feed-ctrl-btn:hover { border-color:var(--muted); color:var(--muted); }
  .feed-ctrl-active { border-color:#d29922 !important; color:#d29922 !important; background:rgba(210,153,34,.08) !important; }
  /* dismiss button on each entry */
  .feed-dismiss { position:absolute; top:5px; right:8px; background:none; border:none; cursor:pointer; color:rgba(139,148,158,.4); font-size:var(--fs-sm); line-height:1; padding:0 2px; transition:color .15s; pointer-events:auto; }
  .feed-dismiss:hover { color:var(--red); }

  .ai-btn-active { border-color: var(--blue); color: var(--blue); background: rgba(88,166,255,.08); }
  .ai-report-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
  .ai-report-loading { color: var(--muted); font-style: italic; font-size: var(--fs-xs); padding: 8px 0; }
  /* ── Goal tracking ── */
  .goal-item { display:flex; align-items:flex-start; gap:10px; padding:10px 14px; border-bottom:1px solid var(--border); }
  .goal-item:last-child { border-bottom:none; }
  .goal-text { flex:1; font-size:var(--fs-sm); }
  .goal-deadline { font-size:var(--fs-xs); color:var(--muted); margin-top:2px; }

  /* ── Skeleton loaders ── */
  @keyframes shimmer { 0% { background-position: -600px 0; } 100% { background-position: 600px 0; } }
  .skeleton { background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 75%); background-size: 1200px 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: 4px; }
  .skel-block { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
  .skel-line { height: 11px; border-radius: 4px; }
  .skel-line.short  { width: 40%; }
  .skel-line.medium { width: 65%; }
  .skel-line.long   { width: 85%; }
  .skel-line.full   { width: 100%; }

  /* ── Floating score delta ── */
  @keyframes floatUp { 0% { opacity:1; transform:translateY(0) scale(1); } 80% { opacity:.9; } 100% { opacity:0; transform:translateY(-36px) scale(.9); } }
  .score-delta { position:absolute; font-size:var(--fs-sm); font-weight:800; pointer-events:none; animation:floatUp 1.6s ease-out forwards; white-space:nowrap; }

  /* ── Command palette ── */
  #cmd-palette-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:3000; align-items:flex-start; justify-content:center; padding-top:15vh; backdrop-filter:blur(4px); }
  #cmd-palette-overlay.open { display:flex; }
  #cmd-palette { width:min(540px,92vw); background:var(--card); border-radius:14px; box-shadow:0 24px 64px rgba(0,0,0,.7); overflow:hidden; }
  #cmd-input-wrap { display:flex; align-items:center; gap:10px; padding:14px 18px; border-bottom:1px solid rgba(48,54,61,.4); }
  #cmd-input-wrap svg { color:var(--muted); flex-shrink:0; }
  #cmd-input { flex:1; background:none; border:none; outline:none; color:var(--text); font-size:var(--fs-lg); }
  #cmd-input::placeholder { color:var(--muted); }
  #cmd-results { max-height:360px; overflow-y:auto; padding:6px 0; }
  .cmd-result { display:flex; align-items:center; gap:12px; padding:10px 18px; cursor:pointer; transition:background .1s; font-size:var(--fs-sm); }
  .cmd-result:hover, .cmd-result.selected { background:rgba(88,166,255,.1); }
  .cmd-result-icon { width:28px; height:28px; border-radius:50%; background:rgba(88,166,255,.15); color:var(--blue); display:flex; align-items:center; justify-content:center; font-size:var(--fs-xs); font-weight:700; flex-shrink:0; }
  .cmd-result-name { font-weight:600; }
  .cmd-result-sub  { font-size:var(--fs-xs); color:var(--muted); margin-top:1px; }
  .cmd-empty { padding:28px; text-align:center; color:var(--muted); font-size:var(--fs-sm); }
  .cmd-hint { display:flex; align-items:center; justify-content:flex-end; gap:16px; padding:8px 18px; border-top:1px solid rgba(48,54,61,.3); font-size:var(--fs-xs); color:var(--muted); }
  .cmd-hint kbd { background:rgba(255,255,255,.07); border-radius:3px; padding:1px 5px; font-size:var(--fs-xs); font-family:inherit; }


  /* ══════════════════════════════════════════════════════════════
     NEW FEATURES
  ══════════════════════════════════════════════════════════════ */

  /* ── Sidebar resize handle ── */
  #sidebar-resize-handle {
    position: fixed; top: 52px; bottom: 0;
    left: calc(var(--sidebar) - 4px);
    width: 8px; cursor: col-resize; z-index: 15;
  }
  #sidebar-resize-handle::after {
    content: ''; position: absolute; top: 0; bottom: 0;
    left: 3px; width: 2px;
    background: transparent; border-radius: 1px; transition: background .15s;
  }
  #sidebar-resize-handle:hover::after,
  #sidebar-resize-handle.resizing::after { background: var(--blue); }
  @media (max-width: 800px) { #sidebar-resize-handle { display: none; } }
  body.sidebar-minimized #sidebar-resize-handle { display: none; }

  /* ── Collapsible cards ── */
  .card-collapse-btn {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: var(--fs-sm); padding: 2px 6px; border-radius: 4px;
    transition: color .15s, background .15s; flex-shrink: 0; line-height: 1;
  }
  .card-collapse-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
  .card-collapse-btn .cc-icon { display: inline-block; transition: transform .2s; }
  .card.collapsed .card-collapse-btn .cc-icon { transform: rotate(-90deg); }
  .card.collapsed .card-body { display: none !important; }
  .card.collapsed .card-header { border-bottom: none; border-radius: 12px; }

  /* ── Mobile bottom tab bar ── */
  #mobile-nav-bar {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px; background: var(--card);
    border-top: 1px solid var(--border); z-index: 30;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  #mobile-nav-bar-inner {
    display: flex; align-items: stretch; height: 100%;
  }
  .mobile-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    cursor: pointer; color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
    letter-spacing: .02em; transition: color .15s, background .15s;
    border: none; background: none; -webkit-tap-highlight-color: transparent;
    padding: 6px 2px;
  }
  .mobile-nav-item .mnav-icon { font-size: var(--fs-xl); line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .mobile-nav-item.active { color: var(--blue); }
  .mobile-nav-item.active .mnav-icon { filter: drop-shadow(0 0 6px currentColor); }
  .mobile-nav-item:active { background: rgba(255,255,255,.06); }
  @media (max-width: 800px) {
    #mobile-nav-bar { display: block; }
    #main { padding-bottom: 66px !important; }
  }

  /* ── Enhanced empty states ── */
  .empty {
    color: var(--muted); font-size: var(--fs-sm); text-align: center;
    padding: 40px 20px; letter-spacing: .01em;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
  }
  .empty-icon { font-size: var(--fs-4xl); opacity: 0.35; line-height: 1; }
  .empty-text { font-weight: 600; color: var(--muted); }
  .empty-sub  { font-size: var(--fs-xs); color: var(--muted); opacity: 0.7; max-width: 260px; line-height: 1.55; }

  /* ── Confirmation dialog ── */
  #confirm-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.72);
    z-index: 9000; display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
  }
  #confirm-overlay.show { display: flex; }
  #confirm-box {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 14px; padding: 28px 24px 20px;
    width: min(400px, 90vw);
    box-shadow: 0 20px 60px rgba(0,0,0,.7);
    animation: confirmPop .18s ease;
  }
  @keyframes confirmPop { from { transform: scale(.94); opacity:0; } to { transform: scale(1); opacity:1; } }
  #confirm-icon   { font-size: var(--fs-3xl); margin-bottom: 12px; }
  #confirm-title  { font-size: var(--fs-lg); font-weight: 700; color: var(--text); margin-bottom: 8px; }
  #confirm-msg    { font-size: var(--fs-sm); color: var(--muted); line-height: 1.6; margin-bottom: 24px; }
  #confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

  /* ── Custom accent color picker in settings ── */
  .ud-accent-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-top: 2px;
  }
  .ud-accent-row label { font-size: var(--fs-xs); color: var(--muted); }
  #accent-color-picker {
    width: 32px; height: 28px; border: none; border-radius: 6px;
    background: none; cursor: pointer; padding: 0;
  }
  #accent-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
  #accent-color-picker::-webkit-color-swatch { border-radius: 5px; border: 1px solid var(--border); }
  .ud-accent-reset {
    font-size: var(--fs-xs); color: var(--muted); background: none; border: none;
    cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
  }
  .ud-accent-reset:hover { color: var(--text); }

  /* ── Table column sort indicator ── */
  .sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
  .sortable-th:hover { color: var(--text); }
  .sort-indicator { display: inline-block; margin-left: 4px; font-size: var(--fs-xs); color: var(--blue); }

  /* ── Skeleton shimmer — light theme override ── */
  body.theme-light .skeleton {
    background: linear-gradient(90deg,rgba(0,0,0,.04) 25%,rgba(0,0,0,.08) 50%,rgba(0,0,0,.04) 75%);
    background-size: 1200px 100%;
  }

  /* ── header / card border consistent with glassmorphism ── */
  header { border-bottom: 1px solid rgba(255,255,255,.07); }
  #sidebar { border-right: 1px solid rgba(255,255,255,.07); }

  /* ════════════════════════════════════════════════════════════════════
     Design system v2 — tactical-dashboard polish.
     Grounded in design-references/design-md: Linear (surface/type),
     Binance (numeric + up/down direction), Raycast (soft status washes).
     ════════════════════════════════════════════════════════════════════ */

  /* #3/#6 — Live numbers in a true mono with tightened tracking, so digit
     width never jitters as values tick. One grouped rule reuses every
     existing big-number class instead of editing each in place. */
  .xc-card-value, .s-val, .pf-metric-val, .pf-cell-val, .mc-value,
  .faction-stat-value, .faction-pts {
    font-family: var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  }

  /* #2 — Directional combat deltas (Binance trading up/down). Use on a
     +/- change next to any live stat: <span class="delta up">▲ 2.4k</span> */
  .delta { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
  .delta.up   { color: var(--up); }
  .delta.down { color: var(--down); }
  .delta.up::before   { content: '▲ '; font-size: .85em; }
  .delta.down::before { content: '▼ '; font-size: .85em; }

  /* #4 — Soft status washes (Raycast ~15% alpha): status reads from the row
     fill, not just a dot. Applied to existing roster rows; opt-in elsewhere. */
  .row-hosp,   tr.member-row.is-hosp   > td { background: rgba(248,81,73,.10)  !important; }
  .row-online, tr.member-row.is-online > td { background: rgba(63,185,80,.08); }
  .row-called, tr.member-row.is-called > td { background: rgba(88,166,255,.10) !important; }
  .row-travel, tr.member-row.is-travel > td { background: rgba(210,153,34,.09); }
  /* leading status edge — a 2px colored bar reads faster than a wash alone */
  tr.member-row.is-hosp   > td:first-child { box-shadow: inset 2px 0 0 var(--red); }
  tr.member-row.is-called > td:first-child { box-shadow: inset 2px 0 0 var(--blue); }

  /* #8 — Persistent war bar: a sticky terminal-style strip (Binance ticker
     idea) keeping the most time-critical state in view on every tab. */
  /* The bar is a flex row of self-contained panel "chips" — each metric reads as
     its own tile rather than a flat run of text. */
  #war-bar {
    position: sticky; top: 52px; z-index: 50;
    display: none; align-items: stretch; gap: 8px; flex-wrap: nowrap;
    min-width: 0; padding: 0; margin: -4px 0 10px;
    font-size: var(--fs-xs); overflow: hidden;
  }
  #war-bar.show { display: flex; }

  /* Each group is a panel: elevated surface, hairline border, soft shadow. */
  .wb-item {
    display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0;
    padding: 8px 12px; border-radius: var(--r-md);
    background: var(--bg-elevated); border: 1px solid var(--hairline);
    box-shadow: var(--shadow-card);
    transition: border-color .25s, background .25s;
  }
  .wb-label { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-xs); }
  .wb-val { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text); }
  /* Separators are meaningless between free-standing panels — collapse them. */
  .wb-sep { display: none; }
  .wb-spacer { margin-left: auto; }
  .wb-conn .wb-val { color: var(--muted); font-size: var(--fs-xs); }

  /* Chain panel: accent border + emphasized count when hot, calm idle text otherwise. */
  .wb-icon { opacity: .55; font-size: var(--fs-xs); }
  .wb-chain-val { font-size: var(--fs-base); }
  .wb-state-text { color: var(--muted); font-style: italic; }
  #war-bar.wb-active .wb-chain-group { border-color: rgba(63,185,80,.45); background: linear-gradient(180deg, rgba(63,185,80,.10), var(--bg-elevated)); }
  #war-bar.wb-danger .wb-chain-group { border-color: rgba(248,81,73,.55); background: linear-gradient(180deg, rgba(248,81,73,.12), var(--bg-elevated)); }
  #war-bar.wb-danger .wb-chain-val { color: var(--red); }
  /* Toggle chain count vs idle copy, and hide the timeout panel off-war. */
  #war-bar.wb-idle   .wb-chain-val,
  #war-bar.wb-idle   .wb-icon,
  #war-bar.wb-idle   .wb-chain-group .wb-label,
  #war-bar.wb-idle   #wb-timeout-group,
  #war-bar.wb-active .wb-state-text { display: none; }

  /* Timeout drain bar — a slim track that empties as the clock runs out. */
  .wb-bar { width: 54px; height: 4px; border-radius: var(--r-pill); background: var(--hairline); overflow: hidden; flex: none; }
  .wb-bar-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--green); transition: width 1s linear, background .3s; }
  #war-bar.wb-danger .wb-bar-fill { animation: wb-flash 1s steps(2, jump-none) infinite; }
  @keyframes wb-flash { 50% { opacity: .45; } }

  /* Online roster pips: colored dot + count, no cryptic "5·2·10". */
  .wb-online { display: inline-flex; align-items: center; gap: 10px; }
  .wb-side { display: inline-flex; align-items: center; gap: 8px; }
  .wb-side-them { padding-left: 10px; border-left: 1px solid var(--hairline); }
  .wb-side-tag { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
  .wb-side-them .wb-side-tag { color: var(--red); }
  .wb-pip { display: inline-flex; align-items: center; gap: 4px; }
  .wb-pip i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
  .wb-pip b { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
  .wb-pip.on   i { background: var(--green); }
  .wb-pip.idle i { background: var(--yellow); }
  .wb-pip.off  i { background: var(--muted); opacity: .6; }
  .wb-updated { color: var(--muted); font-weight: 500; }

  /* War-only panels (score, my contribution, enemy roster) — hidden off-war,
     revealed when #war-bar carries .wb-war. */
  .wb-war-only { display: none; }
  #war-bar.wb-war .wb-war-only { display: inline-flex; }
  #war-bar.wb-war .wb-score-group,
  #war-bar.wb-war .wb-you-group { display: flex; }
  .wb-score-us   { color: var(--green); }
  .wb-score-them { color: var(--red); }
  .wb-score-sep  { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; }
  .wb-you-val    { color: var(--blue); font-size: var(--fs-base); }
  .wb-you-group  { border-color: rgba(88,166,255,.35); }

  /* Narrow viewports: drop the least-critical panels instead of overflowing. */
  @media (max-width: 980px) {
    .wb-online-group { display: none; }
  }
  @media (max-width: 760px) {
    #war-bar.wb-war .wb-you-group { display: none; }
  }
  @media (max-width: 520px) {
    .wb-spacer .wb-label { display: none; }
  }

  /* ════════════════════════════════════════════════════════════════════
     Mobile live surfaces — the war bar and attack feed are opt-in on phones
     (toggled from the sidebar), so neither floats over the page uninvited.
     ════════════════════════════════════════════════════════════════════ */

  /* Any legacy header feed button / expand button is gone — keep them hidden
     even on a stale cached page. */
  .wb-expand-btn, #feed-toggle-btn { display: none !important; }

  /* Sidebar Live toggles (war bar + feed) — shown on every viewport now that the
     header feed button is retired. Their on/off state reads as an accent dot:
     green + glow when active, dim grey when off. Pairs with the .nav-item.active
     left-border accent the toggles already pick up. */
  .lt-state {
    margin-left: auto; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%;
    background: var(--muted); opacity: .35; transition: background .15s, opacity .15s, box-shadow .15s;
  }
  .nav-item.active .lt-state { background: var(--green); opacity: 1; box-shadow: 0 0 6px rgba(63,185,80,.55); }
  body.sidebar-minimized .lt-state { display: none; }

  @media (max-width: 800px) {
    /* Stop the sidebar column above the fixed 56px bottom tab bar so its last
       items (Notifications, minimize) never tuck under / clip into it. */
    #sidebar { bottom: 56px; padding-bottom: 8px; }

    /* ── War bar: opt-in section directly below the header ──
       Shown only when JS sets .show (driven by _warBarVisible, off by default on
       mobile). It's a full-width band flush under the header whose chips WRAP
       onto as many lines as needed, so it never overflows the viewport. Its
       z-index (40) sits below the sidebar (70) so the open menu covers it. */
    #war-bar {
      position: sticky; top: 52px; z-index: 40;
      margin: -10px -10px 10px; padding: 8px 10px;
      gap: 6px; row-gap: 6px; flex-wrap: wrap; align-items: stretch;
      background: var(--card); border: none;
      border-bottom: 1px solid var(--hairline);
      border-radius: 0; box-shadow: var(--shadow-card); overflow: visible;
    }
    #war-bar .wb-item { flex: 0 1 auto; min-width: 0; }
    #war-bar .wb-spacer { margin-left: 0; }

    /* ── Attack feed: docked bottom sheet, never a floating overlay ── */
    #attack-feed {
      position: fixed !important;
      left: 8px !important; right: 8px !important;
      top: auto !important; bottom: 64px !important;
      width: auto !important; min-width: 0 !important; max-width: none !important;
      max-height: 42vh !important;
      resize: none !important; z-index: 45;
    }
    #attack-feed .feed-header { cursor: default; }
  }

  /* #7 — Live-connection dot, folded into the war bar: green pulse = live,
     amber = reconnecting. Complements the existing full-width offline banner. */
  .live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(63,185,80,.5); animation: live-pulse 2s infinite; }
  .live-dot.stale { background: var(--yellow); animation: none; }
  @keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(63,185,80,.45); } 70% { box-shadow: 0 0 0 6px rgba(63,185,80,0); } 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); } }

  /* #9 — the scores tab is already a user-resizable asymmetric split
     (.scores-left / .scores-right + drag divider), a better pattern than a
     static grid, so no change needed there. */

  /* #5 — Command-palette key hints (Raycast styled <kbd>). */
  kbd, .kbd { font-family: var(--mono); font-size: var(--fs-xs); line-height: 1; padding: 3px 6px; border-radius: var(--r-xs); background: var(--bg-elevated); border: 1px solid var(--hairline); box-shadow: 0 1px 0 rgba(0,0,0,.4); color: var(--muted); }

  /* #3 — Tighten large display headings (negative tracking, Linear). */
  .page-title, .pf-name, .faction-name { letter-spacing: -.02em; }
  @media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ─── Open mode (key sessions on the dashboard — app-open.js) ─────────────── */
body.open-mode .nav-item.nav-locked,
body.open-mode .mobile-nav-item.nav-locked { opacity: .45; }
body.open-mode .nav-item.nav-locked .nav-text::after { content: " 🔒"; font-size: var(--fs-xs); }
body.open-mode .live-toggle-section,
body.open-mode .live-toggle-item { display: none; }
/* No faction socket data in open mode — the war bar / feed would sit on "connecting…" forever. */
body.open-mode #war-bar, body.open-mode #attack-feed { display: none !important; }
.badge-tier-free    { background: rgba(63,185,80,.15);  color: var(--green); }
.badge-tier-premium { background: rgba(210,153,34,.15); color: var(--yellow); border: 1px solid rgba(210,153,34,.4); }
.nx-gold-card { border-color: rgba(210,153,34,.4); }
.nx-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); flex-wrap: wrap; }
.nx-row:last-of-type { border-bottom: none; }
.nx-row .grow { flex: 1; min-width: 0; }
.nx-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 8px; }
/* Single accent ramped by opacity (JS sets it from the value) — the old
   two-color gradient read as mud. Current TCT hour gets the .now accent. */
.nx-bars > div { flex: 1; background: var(--green); border-radius: 2px 2px 0 0; min-height: 2px; }
.nx-bars > div.now { background: var(--yellow); }
.nx-bars-lbl { display: flex; gap: 3px; margin-top: 4px; }
.nx-bars-lbl > div { flex: 1; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.nx-bars-lbl > div.now { color: var(--yellow); font-weight: 700; }

/* Open profile — "Your Account" / "Your Faction" self view */
.op-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 14px; align-items: start; }
.op-col { min-width: 0; }
@media (max-width: 980px) { .op-grid { grid-template-columns: 1fr; } }
.op-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.op-chip { font-size: var(--fs-xs); color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.op-chip b { color: var(--text); }
.op-bars { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.op-bar-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); }
.op-bar-lbl { width: 52px; color: var(--muted); text-transform: uppercase; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; }
.op-bar { flex: 1; height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.op-bar > div { height: 100%; border-radius: 999px; transition: width .4s ease; }
.op-bar-val { min-width: 120px; text-align: right; font-weight: 600; color: var(--text); }
@media (max-width: 560px) { .op-bar-val { min-width: 0; } }
/* Player-search expandable spy detail */
.op-det { padding: 10px 8px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.015); border-radius: 0 0 8px 8px; }
.op-det:last-child { border-bottom: none; }
.op-det .nx-sec { margin-top: 12px; }
/* op-stats-sm used to shrink combat tiles — removed: tiles render at the
   same standardized size everywhere. */

/* ─── ✦ Nexus — cross-faction service network ─────────────────────────────────
   Purple is the Nexus signature accent (matches the userscript panel) so the
   network zone reads differently from faction-internal blue. */
#page-nexus { --nx: var(--purple); }
.nx-title { color: var(--nx); }
.nx-tagline { font-size: var(--fs-xs); color: var(--muted); margin-left: 10px; align-self: center; }
.nx-live { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.nx-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; }
.nx-live.on { color: var(--green); }
.nx-live.on .nx-live-dot { background: var(--green); opacity: 1; box-shadow: 0 0 0 0 rgba(63,185,80,.5); animation: live-pulse 2s infinite; }

.nx-note { font-size: var(--fs-sm); color: var(--muted); margin-top: 10px; line-height: 1.55; }
.nx-dim { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }
.nx-upsell { font-size: var(--fs-xs); color: var(--yellow); background: rgba(210,153,34,.08); border: 1px solid rgba(210,153,34,.35); border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; line-height: 1.5; }

/* Main tabs */
.nx-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.nx-tab { position: relative; padding: 8px 16px; border-radius: 8px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; color: var(--muted); background: transparent; border: 1px solid transparent; transition: all .15s; }
.nx-tab:hover { color: var(--text); background: rgba(163,113,247,.06); }
.nx-tab.active { color: var(--nx); background: rgba(163,113,247,.10); border-color: rgba(163,113,247,.35); }
.nx-badge { display: inline-block; min-width: 16px; padding: 1px 5px; margin-left: 4px; border-radius: 9px; background: var(--yellow); color: #1a1200; font-size: var(--fs-xs); font-weight: 800; text-align: center; animation: nx-pulse 2s infinite; }
@keyframes nx-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(210,153,34,.45); } 50% { box-shadow: 0 0 0 5px rgba(210,153,34,0); } }

/* Nested sub-tabs (mercenary) + losses side flip */
.nx-subtabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.nx-subtab { padding: 5px 13px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--muted); background: var(--bg); border: 1px solid var(--border); transition: all .15s; }
.nx-subtab:hover { color: var(--text); }
.nx-subtab.active { color: var(--text); background: var(--card); border-color: rgba(163,113,247,.45); }
.nx-flip { display: flex; gap: 0; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; width: fit-content; max-width: 100%; }
.nx-flip-btn { padding: 8px 18px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; color: var(--muted); background: var(--bg); border: none; transition: all .15s; }
.nx-flip-btn + .nx-flip-btn { border-left: 1px solid var(--border); }
.nx-flip-btn.active { color: var(--text); background: rgba(163,113,247,.12); }

/* Toolbar — the big request CTAs */
.nx-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.nx-toolbar-note { flex: 1; min-width: 200px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.nx-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 18px; border-radius: 10px; font-size: var(--fs-base); font-weight: 700; cursor: pointer; border: 1px solid; transition: transform .1s, box-shadow .15s; text-align: left; }
.nx-cta:hover { transform: translateY(-1px); }
.nx-cta:active { transform: none; }
.nx-cta-sub { font-size: var(--fs-xs); font-weight: 500; opacity: .75; }
.nx-cta-green  { background: rgba(63,185,80,.12);   border-color: rgba(63,185,80,.5);   color: var(--green); }
.nx-cta-green:hover  { box-shadow: 0 4px 16px rgba(63,185,80,.18); }
.nx-cta-purple { background: rgba(163,113,247,.12); border-color: rgba(163,113,247,.5); color: var(--nx); }
.nx-cta-purple:hover { box-shadow: 0 4px 16px rgba(163,113,247,.18); }
.nx-cta-blue   { background: rgba(88,166,255,.10);  border-color: rgba(88,166,255,.45); color: var(--blue); }
.nx-cta-blue:hover   { box-shadow: 0 4px 16px rgba(88,166,255,.15); }

/* Section headers + list cards */
.nx-sec { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 8px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.nx-sec-extra { font-size: var(--fs-xs); font-weight: 500; text-transform: none; letter-spacing: 0; opacity: .8; }
.nx-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 4px 14px; }
.nx-card + .nx-sec { margin-top: 18px; }
.nx-mine { border-color: rgba(163,113,247,.4); margin-bottom: 14px; }

/* Rows */
.nx-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); font-size: var(--fs-base); }
.nx-item:last-child { border-bottom: none; }
.nx-item:hover { background: rgba(255,255,255,.015); }
.nx-item-dim { opacity: .5; }
.nx-item-hot { background: rgba(63,185,80,.04); }
.nx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
/* Standardized name links — bold, text-colored, never default browser blue.
   Scoped to .nx-name wherever it appears (result rows, faction headers,
   roster tables), not just inside .nx-main. */
.nx-name { font-weight: 600; color: var(--text); text-decoration: none; }
.nx-name:hover { color: var(--blue); }
.nx-sub { font-size: var(--fs-sm); color: var(--muted); }
.nx-rep { color: var(--yellow); font-weight: 600; }
.nx-rank { width: 20px; height: 20px; border-radius: 50%; background: rgba(163,113,247,.12); color: var(--nx); font-size: var(--fs-xs); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nx-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.nx-dot-on   { background: var(--green); box-shadow: 0 0 5px rgba(63,185,80,.6); }
.nx-dot-idle { background: var(--yellow); }
.nx-dot-off  { background: var(--muted); opacity: .4; }
.nx-price { color: var(--green); font-weight: 700; white-space: nowrap; font-size: var(--fs-base); }
.nx-xan { color: var(--yellow); font-weight: 700; }
.nx-icon-btn { padding: 4px 8px; }
.nx-btn-hire { color: var(--nx); border-color: rgba(163,113,247,.45); background: rgba(163,113,247,.08); }
.nx-btn-hire:hover { background: rgba(163,113,247,.16); }
.nx-btn-go { color: var(--green); border-color: rgba(63,185,80,.5); background: rgba(63,185,80,.1); font-weight: 700; }
.nx-btn-go:hover { background: rgba(63,185,80,.18); }
.nx-danger { color: var(--red) !important; }

/* Status + role chips */
.nx-st { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; padding: 1px 7px; border-radius: 9px; white-space: nowrap; }
.nx-st-open      { background: rgba(63,185,80,.15);   color: var(--green); }
.nx-st-offered   { background: rgba(88,166,255,.15);  color: var(--blue); }
.nx-st-claimed   { background: rgba(210,153,34,.15);  color: var(--yellow); }
.nx-st-disputed  { background: rgba(248,81,73,.15);   color: var(--red); }
.nx-st-completed { background: rgba(139,148,158,.15); color: var(--muted); }
.nx-st-cancelled, .nx-st-declined { background: rgba(139,148,158,.1); color: var(--muted); }
.nx-role { font-size: var(--fs-xs); font-weight: 700; padding: 1px 7px; border-radius: 9px; }
.nx-role-b { background: rgba(88,166,255,.12);  color: var(--blue); }
.nx-role-p { background: rgba(163,113,247,.12); color: var(--nx); }

/* Personal — stats strip + contract cards */
/* Equal-width grid (flex-wrap made tile widths ragged per row) — every tile
   the same size, rows aligned. */
.nx-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 4px; }
/* Borderless: depth comes from a surface a step off the card, so nested
   boxes stop stacking 1px borders. color-mix keeps it theme-safe (lighter
   on dark themes, darker on theme-light). */
.nx-stat { background: color-mix(in srgb, var(--text) 4%, var(--card)); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* break-word (not anywhere): long ranges like "588.54m – 800.04m" still wrap
   at spaces, but "Platinum" no longer breaks mid-word into "Platinu m". */
.nx-stat b { font-size: var(--fs-xl); color: var(--text); line-height: 1.2; min-width: 0; overflow-wrap: break-word; font-variant-numeric: tabular-nums; }
/* Direct child only: colored value spans nested inside the <b> (e.g.
   <b><span style="color:var(--green)">3,721</span></b>) must NOT get the
   tiny uppercase caption style — that was the "small numbers" bug. */
.nx-stat > span { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
/* Semantic tile tints — good/bad/warn wash the whole tile instead of only
   coloring the digits. Pass the class via _selfTile's cls arg. */
.nx-stat.t-good { background: color-mix(in srgb, var(--green) 9%, var(--card)); }
.nx-stat.t-good b { color: var(--green); }
.nx-stat.t-bad  { background: color-mix(in srgb, var(--red) 9%, var(--card)); }
.nx-stat.t-bad b  { color: var(--red); }
.nx-stat.t-warn { background: color-mix(in srgb, var(--yellow) 9%, var(--card)); }
.nx-stat.t-warn b { color: var(--yellow); }
/* Slim win-rate underline — lives in the section header area, replaces the
   old detached labeled bar. */
.op-wr { height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; margin: 4px 0 10px; }
.op-wr > div { height: 100%; border-radius: 2px; }

/* Lifetime Statistics tabs (open profile) — labeled horizontal bar lists */
.op-stat-pane > .nx-sec:first-child { margin-top: 0; }
.op-hbars { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.op-hbar { display: grid; grid-template-columns: 150px minmax(40px, 1fr) auto; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.op-hbar .lbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-hbar .trk { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; }
.op-hbar .trk > div { height: 100%; border-radius: 3px; }
.op-hbar .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 560px) { .op-hbar { grid-template-columns: 110px minmax(30px, 1fr) auto; } }
.nx-ccard { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.nx-ccard:last-child { border-bottom: none; }
.nx-ccard-hot { border-left: 3px solid var(--yellow); padding-left: 10px; margin-left: -12px; background: rgba(210,153,34,.03); }
.nx-ccard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nx-ccard-top .grow { flex: 1; }
.nx-ckind { font-size: var(--fs-sm); font-weight: 700; }
.nx-ccard-mid { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.nx-proof { font-size: var(--fs-xs); color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; margin-top: 6px; word-break: break-all; }
.nx-ccard-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.nx-histnav { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 10px 0; }

/* Empty states */
.nx-empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: var(--fs-sm); }
.nx-empty-ico { font-size: var(--fs-3xl); opacity: .4; margin-bottom: 6px; }

/* Modal forms */
#nx-modal { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; padding: 24px; }
.nx-modal-card { background: var(--card); border: 1px solid rgba(163,113,247,.35); border-radius: 14px; padding: 22px 24px; max-width: 440px; width: 100%; box-shadow: 0 24px 64px rgba(0,0,0,.7); max-height: 90vh; overflow-y: auto; }
.nx-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: var(--fs-lg); font-weight: 700; }
.nx-modal-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: var(--fs-xl); line-height: 1; }
.nx-modal-form { display: flex; flex-direction: column; gap: 12px; }
.nx-field { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.nx-field i { color: var(--red); font-style: normal; }
.nx-field input, .nx-field textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 9px 12px; font-size: var(--fs-sm); outline: none; font-family: inherit; resize: vertical; }
.nx-field input:focus, .nx-field textarea:focus { border-color: var(--nx); }
.nx-modal-submit { background: rgba(163,113,247,.14); border-color: rgba(163,113,247,.5); color: var(--nx); font-weight: 700; padding: 10px; }
.nx-modal-submit:hover { background: rgba(163,113,247,.22); }
.nx-modal-err { font-size: var(--fs-xs); color: var(--red); line-height: 1.4; }

@media (max-width: 640px) {
  .nx-item { flex-wrap: wrap; }
  .nx-main { flex-basis: 100%; order: -1; }
  .nx-tagline { display: none; }
}

/* ── Search page (#page-search) — inherits the sitewide type scale from
   tokens.css like every other page; only structural tweaks live here. ── */
#page-search .nx-bars            { height: 90px; }

/* Side-by-side intel: player (left) ↔ faction (right). Single column until a
   faction pane opens, and back to single column on narrow screens. */
#page-search .sr-grid          { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 14px; }
#page-search .sr-grid.has-fac  { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1200px) {
  #page-search .sr-grid.has-fac { grid-template-columns: minmax(0, 1fr); }
}
