/* =====================================================================
   OPTCG Tracker - Market Intelligence design system (2026-07 redesign)

   One coherent stylesheet replacing the previous base theme + polish
   override layers. Class names are a contract with wwwroot/js/*.js and
   index.html - do not rename selectors without updating the emitters.

   Sections:
     1.  Tokens & fonts          8.  Dashboard home modules
     2.  Reset & base            9.  Detailed panels / data health
     3.  Utilities & a11y        10. Trends tables
     4.  Shell (sidebar/topbar)  11. Market / Directory / tables
     5.  Scanner rail            12. Competitive & tournaments
     6.  Controls (btn/input)    13. Drawer, modal & fact packet
     7.  View scaffolding/states 14. Review forms & community
                                 15. Pills & badges
                                 16. Jobs & feedback
                                 17. Hidden-retained views
                                 18. Responsive
   ===================================================================== */

/* 1. TOKENS ----------------------------------------------------------- */

:root {
  /* Core surfaces (deep indigo-slate) */
  --bg:        #0a0d13;
  --surface:   #0e1119;
  --card:      #12161f;
  --elevated:  #171d2a;
  --overlay:   #1b2231;

  /* Hairlines */
  --border:    #1f2734;
  --border2:   #2e3a4e;
  --hairline:  rgba(148, 166, 196, 0.14);

  /* Ink */
  --text:      #e9edf5;
  --text-soft: #c0c9d8;
  --muted:     #8d99ad;
  --faint:     #58637a;

  /* Brand & semantics */
  --brand:       #e3b968;   /* treasure gold - identity, active states */
  --brand-ink:   #241a05;
  --brand-soft:  rgba(227, 185, 104, 0.11);
  --up:          #4cc38a;
  --up-soft:     rgba(76, 195, 138, 0.12);
  --down:        #ef7168;
  --down-soft:   rgba(239, 113, 104, 0.12);
  --warn:        #dfa63e;
  --warn-soft:   rgba(223, 166, 62, 0.13);
  --info:        #6fa8e8;
  --info-soft:   rgba(111, 168, 232, 0.12);
  --violet:      #a78be0;
  --violet-soft: rgba(167, 139, 224, 0.14);

  /* Type */
  --sans:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'DM Mono', 'SFMono-Regular', Consolas, monospace;
  --display: 'Fraunces', Georgia, serif;

  /* Shape & depth */
  --r-sm: 6px;
  --r-md: 9px;
  --r-lg: 13px;
  --shadow-1: 0 1px 2px rgba(3, 6, 12, 0.5);
  --shadow-2: 0 10px 30px rgba(3, 6, 12, 0.45);
  --shadow-3: 0 24px 70px rgba(2, 4, 10, 0.6);

  /* Layout */
  --scanner-width: 268px;

  /* Legacy aliases - inline styles in index.html and js/*.js reference
     these names directly. Keep them mapped onto the new palette. */
  --accent:  var(--brand);
  --accent2: var(--up);
  --gold:    var(--brand);
  --red:     var(--down);
  --amber:   var(--warn);
  --blue:    var(--info);
  --serif:   var(--display);
  --color-text-secondary: var(--muted);
}

/* 2. RESET & BASE ------------------------------------------------------ */

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

html { color-scheme: dark; }

body {
  background:
    radial-gradient(1100px 380px at 88% -120px, rgba(227, 185, 104, 0.05), transparent 62%),
    radial-gradient(900px 460px at -8% -60px, rgba(111, 168, 232, 0.045), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(227, 185, 104, 0.28); color: var(--text); }

a { color: var(--info); }
a:hover { color: #8fbdf0; }

img { max-width: 100%; }

/* Slim, unobtrusive scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* 3. UTILITIES & A11Y --------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
  border-radius: 4px;
}

.clickable { cursor: pointer; }

/* Numeric ink: anything that reads like a quote uses the mono, tabular. */
.price-cell, .price-hero, .market-stat-value, .score-num, .score-hero-num,
.home-row-price, .home-row-move, .scanner-item-move, .kpi-marketcap strong,
.change-pos, .change-neg, .change-neu, .t-copies, .fw-pct,
.dashboard-detail-stat strong, .dashboard-market-cap-stat strong,
.dashboard-market-cap-main strong, .home-brief-stat strong,
.bucket-mover-change, .trend-median, .home-move-context, .rank-num,
.dashboard-rank, .home-health-item strong, .modal-evidence-stat strong {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.change-pos { color: var(--up); }
.change-neg { color: var(--down); }
.change-neu { color: var(--muted); }

/* 4. SHELL -------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--scanner-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0c0f17 0%, #0a0d13 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-badge {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(227,185,104,.22), rgba(227,185,104,.08));
  border: 1px solid rgba(227, 185, 104, 0.4);
  color: var(--brand);
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.logo-mark {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 640;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.logo-mark em { font-style: normal; color: var(--brand); }
.logo-sub {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Primary navigation */
.nav-row { padding: 12px 10px 6px; }
.nav-label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 10px;
  margin: 10px 0 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: color .13s, background .13s;
}
.nav-item + .nav-item { margin-top: 1px; }
.nav-item:hover { color: var(--text); background: rgba(148, 166, 196, 0.07); }
.nav-item.active {
  color: var(--brand);
  background: var(--brand-soft);
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  opacity: .75;
}
.nav-icon svg { width: 100%; height: 100%; }

/* Sidebar footer / API status */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--border);
  background: rgba(10, 13, 19, 0.7);
}
.api-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
  transition: background .3s, box-shadow .3s;
}
.status-dot.live  { background: var(--up); box-shadow: 0 0 7px rgba(76, 195, 138, 0.8); }
.status-dot.mock  { background: var(--warn); box-shadow: 0 0 6px rgba(223, 166, 62, 0.5); }
.status-dot.error { background: var(--down); box-shadow: 0 0 6px rgba(239, 113, 104, 0.6); }

/* Main column */
.main {
  margin-left: var(--scanner-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 13, 19, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 11px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
}
.topbar-heading { margin-right: auto; min-width: 0; }
.topbar-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}
.topbar-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
  width: 24px; height: 24px;
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: color .13s, border-color .13s;
}
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border2); }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* 5. SCANNER RAIL -------------------------------------------------------- */

.scanner-search {
  position: relative;
  margin: 4px 14px 10px;
}
.scanner-search input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  padding: 7px 10px 7px 30px;
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .13s, background .13s;
}
.scanner-search input:focus { border-color: var(--border2); background: var(--elevated); }
.scanner-search input::placeholder { color: var(--faint); }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 11px; height: 11px;
  border: 1.5px solid var(--faint);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}
.search-icon::after {
  content: '';
  position: absolute;
  width: 5px; height: 1.5px;
  right: -4px; bottom: -2px;
  background: var(--faint);
  border-radius: 1px;
  transform: rotate(45deg);
}

.scanner-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin: 0 14px 8px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.scanner-tabs button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .13s, background .13s;
}
.scanner-tabs button:hover { color: var(--text); }
.scanner-tabs button.active {
  background: var(--elevated);
  color: var(--brand);
  box-shadow: var(--shadow-1);
}

.scanner-body {
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 10px;
  min-height: 0;
}
.scanner-empty {
  color: var(--faint);
  font-size: 11.5px;
  padding: 14px 8px;
  line-height: 1.5;
}
.scanner-group-label {
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 10px 8px 4px;
}
.scanner-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.35;
}
.scanner-item.clickable:hover { background: rgba(148, 166, 196, 0.08); }
.scanner-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
  font-weight: 500;
}
.scanner-item-meta {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  flex-shrink: 0;
}
.scanner-item-move { font-size: 11.5px; flex-shrink: 0; }
.scanner-item-move.pos { color: var(--up); }
.scanner-item-move.neg { color: var(--down); }
.scanner-item-move.neu { color: var(--muted); }

.scanner-sort {
  display: inline-flex;
  gap: 3px;
  margin: 8px 8px 2px;
  padding: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.scanner-sort button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-family: var(--sans);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
}
.scanner-sort button.active { background: var(--elevated); color: var(--text); }

.scanner-review-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 8px 2px;
  padding: 10px 12px;
  background: var(--warn-soft);
  border: 1px solid rgba(223, 166, 62, 0.3);
  border-radius: var(--r-md);
}
.scanner-review-total strong {
  font-family: var(--mono);
  font-size: 17px;
  color: var(--warn);
}
.scanner-review-total span { font-size: 11px; color: var(--muted); }
.scanner-review-total:hover { border-color: rgba(223, 166, 62, 0.55); }

.scanner-resize-handle {
  position: absolute;
  top: 0; right: -3px; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 31;
}
.scanner-resize-handle:hover,
body.scanner-resizing .scanner-resize-handle { background: rgba(111, 168, 232, 0.3); }
body.scanner-resizing { user-select: none; cursor: col-resize; }

/* 6. CONTROLS ------------------------------------------------------------ */

.btn {
  background: linear-gradient(180deg, #ecc47a, var(--brand));
  color: var(--brand-ink);
  border: 1px solid rgba(227, 185, 104, 0.5);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 650;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: filter .13s, transform .1s;
  box-shadow: var(--shadow-1);
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 550;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .13s, border-color .13s, background .13s;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--faint); background: rgba(148,166,196,.06); }
.btn-ghost:disabled { opacity: .4; cursor: default; }

.pill-btn {
  background: var(--elevated);
  color: var(--text-soft);
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
  transition: color .13s, border-color .13s;
}
.pill-btn:hover:not(:disabled) { color: var(--text); border-color: var(--faint); }
.pill-btn:disabled { opacity: .4; cursor: default; }

.inline-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--info);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.inline-link:hover { color: #8fbdf0; }

.filter-select,
select.filter-select,
input.filter-select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  outline: none;
  cursor: pointer;
  transition: border-color .13s, background .13s;
  max-width: 100%;
}
input.filter-select { cursor: text; }
.filter-select:hover { border-color: var(--border2); }
.filter-select:focus { border-color: var(--border2); background: var(--elevated); }
.filter-select::placeholder { color: var(--faint); }

/* Segmented switches (window pickers, scope toggles, grid/table) */
.segmented,
.dashboard-direction-toggle,
.price-range-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.segmented button,
.dashboard-direction-toggle button,
.price-range-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .13s, background .13s;
  line-height: 18px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.segmented button:hover,
.dashboard-direction-toggle button:hover,
.price-range-toggle button:hover { color: var(--text); }
.segmented button.active,
.dashboard-direction-toggle button.active,
.price-range-toggle button.active {
  background: var(--elevated);
  color: var(--brand);
  box-shadow: var(--shadow-1);
}

/* View toolbars (Market / Directory filter bars) */
.view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 16px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.toolbar-field { display: flex; flex-direction: column; gap: 4px; }
.toolbar-field > label,
.toolbar-label {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.toolbar-field-row { display: flex; gap: 8px; }
.toolbar-spacer { flex: 1; }

/* 7. VIEW SCAFFOLDING & STATES ------------------------------------------- */

.view { display: none; padding: 22px 28px 64px; animation: view-in .18s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.picks-header { margin-bottom: 18px; }
.picks-header h2,
.jobs-view h2,
.formula-view h2 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--text);
}
.picks-header p,
.lead {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 5px;
  max-width: 760px;
  line-height: 1.55;
}
.marketwatch-header { margin-bottom: 14px; }

.home-headline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.dashboard-freshness {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}
.dashboard-freshness strong { color: var(--text-soft); font-weight: 500; }

.section-title {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  margin: 20px 0 9px;
}
.section-heading-inline { display: inline-flex; align-items: center; gap: 7px; }
.section-heading-inline .section-title { margin: 0; }
.home-experiment-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(223, 166, 62, 0.45);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 8px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.info-btn {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--faint);
  font-size: 9px;
  font-family: var(--mono);
  line-height: 1;
  cursor: help;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  transition: color .13s, border-color .13s;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--info); border-color: var(--info); }

.info-popover {
  position: absolute;
  z-index: 120;
  max-width: 300px;
  background: var(--overlay);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-soft);
  box-shadow: var(--shadow-2);
}

.source-chip {
  display: inline-block;
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

/* Empty states */
.empty, .empty-state {
  border: 1px dashed var(--border2);
  border-radius: var(--r-lg);
  background: rgba(18, 22, 31, 0.5);
  color: var(--muted);
  text-align: center;
  padding: 34px 20px;
  font-size: 12.5px;
  line-height: 1.6;
}
.empty-icon {
  width: 34px; height: 34px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 13px;
}

/* Loading */
.spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--border2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  padding: 14px 4px;
}
.home-module-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 0;
}

.skeleton-row {
  height: 44px;
  border-radius: var(--r-md);
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--card) 25%, var(--elevated) 45%, var(--card) 65%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -60% 0; } }

.home-loading-line {
  display: inline-block;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--elevated) 25%, var(--overlay) 45%, var(--elevated) 65%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease infinite;
}
.home-loading-thumb {
  width: 30px; height: 42px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--elevated);
  animation: shimmer 1.4s ease infinite;
}
.home-loading-row td { padding: 8px 8px; }
.home-loading-row .home-mover-copy { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.home-brief-loading-lines { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.home-action-loading-card, .home-health-loading-card { gap: 8px; }
.home-health-loading-card .home-loading-line { margin-top: 6px; }

/* 8. DASHBOARD HOME MODULES ---------------------------------------------- */

.dashboard-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.dashboard-kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  min-width: 0;
}
.dashboard-kpi-card.placeholder { opacity: .6; }
.dashboard-kpi-card > strong { font-size: 17px; display: block; margin-top: 3px; }
.dashboard-kpi-card > em { display: block; font-style: normal; color: var(--muted); font-size: 11px; margin-top: 2px; }

.metric-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.kpi-marketcap { margin-top: 5px; }
.kpi-marketcap-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.kpi-marketcap-top strong { font-size: 19px; }
.kpi-marketcap-move { font-size: 12px; display: inline-flex; gap: 7px; }
.kpi-neutral { color: var(--faint); font-size: 11px; font-family: var(--mono); }

.kpi-movement { display: flex; flex-direction: column; gap: 7px; margin-top: 7px; }
.kpi-movement-item { min-width: 0; }
.kpi-movement-empty { color: var(--faint); }
.kpi-movement-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kpi-movement-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-movement-sub { color: var(--faint); font-size: 10.5px; }

/* Module cards */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 12px;
  margin-bottom: 12px;
}
.home-module {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  min-width: 0;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.home-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.home-module-sub {
  color: var(--faint);
  font-size: 11px;
  margin: 3px 0 9px;
  line-height: 1.45;
}
.home-viewall {
  background: none;
  border: none;
  color: var(--info);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  white-space: nowrap;
}
.home-viewall:hover { color: #8fbdf0; }

.home-module-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.home-table-scroll {
  min-height: 0;
  max-height: clamp(270px, 34vh, 460px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
.home-table-scroll .home-module-table { margin: 0; }
.home-table-scroll .home-module-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
}
.home-actions-scroll { max-height: clamp(340px, 43vh, 560px); }
.home-module-table thead th {
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
  text-align: left;
  padding: 0 8px 6px;
  border-bottom: 1px solid var(--border);
}
.home-module-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 12px;
}
.home-module-table tr:last-child td { border-bottom: none; }
.home-row.clickable:hover td { background: rgba(148, 166, 196, 0.05); }

.home-movers-table th:nth-child(1) { width: 55%; }
.home-movers-table th:nth-child(2) { width: 20%; }
.home-movers-table th:nth-child(3) { width: 25%; }
.home-volume-table th:nth-child(1) { width: 58%; }
.home-volume-table th:nth-child(2) { width: 22%; }
.home-volume-table th:nth-child(3) { width: 20%; }
.home-trends-table th:nth-child(1) { width: 52%; }
.home-trends-table th:nth-child(2) { width: 25%; }
.home-trends-table th:nth-child(3) { width: 23%; }
/* Finance convention: numeric columns read right-aligned */
.home-movers-table th:nth-child(2),
.home-movers-table th:nth-child(3),
.home-row-price,
.home-row-move,
.home-row-tag { text-align: right; }
.home-row-move .home-move-context { justify-content: flex-end; }
.home-volume-table th:nth-child(2),
.home-volume-table th:nth-child(3),
.home-row-volume,
.home-trends-table th:nth-child(2),
.home-trends-table th:nth-child(3) { text-align: right; }
.home-row-volume strong {
  display: block;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.2;
}
.home-row-volume em {
  display: block;
  color: var(--faint);
  font-style: normal;
  font-size: 10px;
  line-height: 1.3;
}
.home-row-card { min-width: 0; }
.home-loading-row .home-row-card > .home-loading-line { display: block; margin-top: 6px; }
.home-loading-row .home-row-card > .home-loading-line:first-child { margin-top: 0; }

.home-mover-card { display: flex; gap: 9px; align-items: center; min-width: 0; }
.home-mover-thumb,
.home-mover-thumb-placeholder {
  width: 30px; height: 42px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  background: var(--elevated);
  border: 1px solid var(--border);
}
.home-mover-copy { min-width: 0; flex: 1; }
.home-card-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-card-meta {
  color: var(--faint);
  font-size: 10.5px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-card-trust { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-top: 3px; }
.home-card-volume {
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
  white-space: nowrap;
}
.home-trust-chip {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 1px 7px;
  border: 1px solid;
}
.home-trust-chip.ok { color: var(--up); border-color: rgba(76,195,138,.4); background: var(--up-soft); }
.home-trust-chip.warn { color: var(--warn); border-color: rgba(223,166,62,.4); background: var(--warn-soft); }
.home-inspect-cue {
  font-size: 10px;
  color: var(--info);
  font-weight: 600;
  opacity: 0;
  transition: opacity .13s;
}
.home-row:hover .home-inspect-cue,
.home-action-card:hover .home-inspect-cue { opacity: 1; }

.home-row-price { font-size: 12px; color: var(--text-soft); }
.home-row-price strong,
.home-row-price .home-row-from {
  display: block;
}
.home-row-price strong { font-weight: 600; }
.home-row-price .home-row-from {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
  font-style: normal;
  line-height: 1.25;
}
.home-row-move { font-size: 12px; }
.home-move-stack > div:first-child { font-size: 12.5px; }
.home-move-context {
  display: flex;
  gap: 5px;
  align-items: baseline;
  font-size: 10px;
  color: var(--faint);
}
.home-move-context span { letter-spacing: 0.06em; }
.home-move-context.muted { opacity: .7; }

.home-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}
.home-tag.pos { color: var(--up); background: var(--up-soft); }
.home-tag.neg { color: var(--down); background: var(--down-soft); }
.home-tag.warn { color: var(--warn); background: var(--warn-soft); }
.home-tag.neu { color: var(--muted); background: rgba(148, 166, 196, 0.1); }

.home-empty {
  color: var(--faint);
  font-size: 11.5px;
  padding: 14px 4px;
  text-align: center;
}

/* Market Brief */
.home-brief-module { margin-bottom: 12px; }
.home-brief-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 18px;
  align-items: start;
  margin-top: 8px;
}
.market-status {
  display: inline-block;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.01em;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid;
  margin-bottom: 9px;
}
.market-status.pos { color: var(--up); border-color: rgba(76,195,138,.45); background: var(--up-soft); }
.market-status.neg { color: var(--down); border-color: rgba(239,113,104,.45); background: var(--down-soft); }
.market-status.mixed { color: var(--warn); border-color: rgba(223,166,62,.45); background: var(--warn-soft); }
.market-status.neutral { color: var(--muted); border-color: var(--border2); background: rgba(148,166,196,.08); }

.home-brief-text { min-width: 0; }
.home-brief-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-soft);
}
.home-brief-bullets li { padding-left: 14px; position: relative; line-height: 1.5; }
.home-brief-bullets li::before {
  content: '';
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 2px;
  background: var(--brand);
  opacity: .75;
}
.home-brief-note {
  display: inline-block;
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--faint);
  font-style: italic;
}
.home-brief-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-brief-stat {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.home-brief-stat span {
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.home-brief-stat strong { font-size: 17px; }
.home-brief-stat em { font-style: normal; color: var(--muted); font-size: 10.5px; }

/* Needs Inspection */
.home-actions-table td { padding: 5px 0; border-bottom: none; }
.home-action-cell { padding: 5px 0 !important; }
.home-action-card {
  display: flex;
  gap: 12px;
  align-items: stretch;
  justify-content: space-between;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  transition: border-color .13s;
}
.home-row:hover .home-action-card { border-color: var(--border2); }
.home-action-main { min-width: 0; flex: 1; }
.home-action-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.home-action-reason-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
  margin-top: 7px;
}
.home-action-reasons {
  list-style: none;
  margin-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.home-action-reasons li {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  padding-left: 11px;
  position: relative;
}
.home-action-reasons li::before {
  content: '';
  position: absolute;
  left: 0; top: 7px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--faint);
}
.home-action-ctx {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
}

.signal-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
  border: 1px solid;
  flex-shrink: 0;
}
.signal-badge.review { color: var(--info); border-color: rgba(111,168,232,.45); background: var(--info-soft); }
.signal-badge.watch { color: var(--brand); border-color: rgba(227,185,104,.45); background: var(--brand-soft); }
.signal-badge.caution { color: var(--warn); border-color: rgba(223,166,62,.45); background: var(--warn-soft); }
.signal-badge.avoid { color: var(--down); border-color: rgba(239,113,104,.45); background: var(--down-soft); }
.signal-badge.neu { color: var(--muted); border-color: var(--border2); background: rgba(148,166,196,.08); }

/* Data Health & Review module */
.home-health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.home-health-item {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  border-left-width: 2px;
}
.home-health-item.pos { border-left-color: var(--up); }
.home-health-item.warn { border-left-color: var(--warn); }
.home-health-item.neu { border-left-color: var(--border2); }
.home-health-item.placeholder { opacity: .55; }
.home-health-item span {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.home-health-item strong {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-health-item em {
  font-style: normal;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

/* Window switcher in dashboard header */
.home-window button { min-width: 42px; }

/* 9. DETAILED PANELS / DATA HEALTH ---------------------------------------- */

.dashboard-details {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.dashboard-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}
.dashboard-details > summary::-webkit-details-marker { display: none; }
.dashboard-details > summary::before {
  content: '';
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(-45deg);
  transition: transform .15s;
  flex-shrink: 0;
}
.dashboard-details[open] > summary::before { transform: rotate(45deg); }
.dashboard-details > summary:hover { color: var(--text); }
.dashboard-details[open] > summary { border-bottom: 1px solid var(--border); }

.dashboard-section-panel {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.dashboard-section-panel:last-child { border-bottom: none; }

.dashboard-market-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.dashboard-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.compact-controls { margin-bottom: 8px; }
.dashboard-summary { color: var(--muted); font-size: 11.5px; margin-top: 4px; max-width: 640px; }

.dashboard-table-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: var(--r-md); }
.dashboard-table-scroll .lb-table { margin: 0; border: none; border-radius: 0; }
.dashboard-table-scroll thead th { position: sticky; top: 0; background: var(--elevated); z-index: 2; }

.dashboard-mover-card-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dashboard-rank {
  font-size: 10.5px;
  color: var(--faint);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.dashboard-rank.top3 { color: var(--brand); font-weight: 600; }

.dashboard-data-health { background: transparent; }
.data-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 9px;
  margin-top: 12px;
}
.data-health-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.data-health-item span,
.data-health-item .metric-heading {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.data-health-item strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-health-item em { font-style: normal; color: var(--muted); font-size: 10.5px; line-height: 1.4; }

.data-health-caveats { margin-top: 12px; }
.data-health-caveats-label {
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
  margin-bottom: 6px;
}
.dashboard-gap-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dashboard-gap-list span {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--border2);
  border-radius: 999px;
  padding: 3px 10px;
}

.raw-explorer-panel .dashboard-summary { margin-bottom: 12px; }
.raw-explorer-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.dashboard-market-loading, .dashboard-trends-loading { justify-content: center; }

/* Market cap strip (detailed panel) */
.dashboard-market-cap-loading { color: var(--muted); font-size: 12px; padding: 10px 0; display: flex; gap: 9px; align-items: center; }
.dashboard-market-cap-main,
.dashboard-market-cap-stat { display: flex; flex-direction: column; gap: 2px; }
.dashboard-market-cap-main span,
.dashboard-market-cap-stat span {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.dashboard-market-cap-main strong { font-size: 18px; }
.dashboard-market-cap-stat strong { font-size: 14px; }
.dashboard-market-cap-main em,
.dashboard-market-cap-stat em { font-style: normal; color: var(--muted); font-size: 10.5px; }
.dashboard-market-cap-value-move.positive strong { color: var(--up); }
.dashboard-market-cap-value-move.negative strong { color: var(--down); }

/* 10. TRENDS --------------------------------------------------------------- */

.dashboard-trends-section { margin-bottom: 14px; }
.trends-page-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.dashboard-trends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
}
.dashboard-trend-scope[hidden] { display: none; }
.dashboard-trends-table-wrap {
  overflow: auto;
  max-height: 640px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 10px;
}
.dashboard-trends-table { margin: 0; border: none; border-radius: 0; }
.dashboard-trends-table thead th { position: sticky; top: 0; background: var(--elevated); z-index: 2; }

.sortable-trend { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-trend:hover { color: var(--text); }
.sortable-trend::after { content: ''; display: inline-block; width: 0; margin-left: 5px; }
.sortable-trend.sorted-asc::after { content: '^'; font-size: 8px; color: var(--brand); width: auto; }
.sortable-trend.sorted-desc::after { content: 'v'; font-size: 8px; color: var(--brand); width: auto; }

.trend-median { font-size: 10px; color: var(--faint); margin-top: 1px; }
.trend-detail-row:hover td { background: rgba(148, 166, 196, 0.05); }

.trend-breadth strong { display: block; font-size: 12px; }
.trend-breadth em { font-style: normal; font-size: 10px; color: var(--faint); }
.trend-breadth.ok strong { color: var(--up); }
.trend-breadth.mid strong { color: var(--warn); }
.trend-breadth.down strong { color: var(--down); }

.trend-activity-stack strong { display: block; font-size: 11.5px; font-weight: 500; }
.trend-activity-stack em { font-style: normal; font-size: 11.5px; }
.activity-label { color: var(--faint); font-size: 9.5px; font-family: var(--sans); }

.trend-freshness strong { display: block; font-size: 11px; font-weight: 600; }
.trend-freshness em { font-style: normal; font-size: 10px; color: var(--faint); }
.trend-freshness.ok strong { color: var(--up); }
.trend-freshness.caution strong { color: var(--warn); }

/* 11. TABLES, MARKET & DIRECTORY -------------------------------------------- */

.lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 12.5px;
}
.lb-table thead th {
  text-align: left;
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  padding: 9px 12px;
  background: var(--elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lb-table thead th.sorted { color: var(--brand); }
.lb-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table tbody tr[onclick], .lb-table tbody tr.clickable { cursor: pointer; }
.lb-table tbody tr[onclick]:hover td,
.lb-table tbody tr.clickable:hover td { background: rgba(148, 166, 196, 0.05); }
.lb-table tbody tr.selected td { background: var(--brand-soft); }

.rank-num { color: var(--faint); font-size: 11px; }
.rank-num.top3 { color: var(--brand); font-weight: 600; }

.card-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.35;
}
.card-meta {
  color: var(--faint);
  font-size: 10.5px;
  font-family: var(--mono);
  line-height: 1.4;
}
.card-thumb,
.card-thumb-placeholder {
  width: 32px; height: 45px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  background: var(--elevated);
  border: 1px solid var(--border);
}
.price-cell { white-space: nowrap; }
.lb-subtext { color: var(--faint); font-size: 10.5px; display: block; }

/* Market movement grid */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.market-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s, box-shadow .14s;
  min-width: 0;
}
.market-card:hover {
  transform: translateY(-2px);
  border-color: var(--border2);
  box-shadow: var(--shadow-2);
}
.market-card.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.market-card-image-wrap {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(148, 166, 196, 0.09), transparent 70%),
    var(--elevated);
  display: flex;
  justify-content: center;
  padding: 14px 14px 0;
}
.market-card-image {
  width: 74%;
  border-radius: 7px;
  box-shadow: var(--shadow-2);
  transform: translateY(6px);
  transition: transform .16s ease;
}
.market-card:hover .market-card-image { transform: translateY(2px); }
.market-card-image-placeholder {
  width: 74%;
  aspect-ratio: 5 / 7;
  border-radius: 7px;
  background: var(--overlay);
  border: 1px dashed var(--border2);
  transform: translateY(6px);
}
.market-card-body { padding: 14px; }
.market-card-title {
  font-weight: 650;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-card-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px 10px;
  margin-top: 10px;
}
/* Price and Move are short numbers (2-up); Activity and Compare carry longer
   evidence text ("Strong · 1,773 sold", "Mixed sources - verify"), so give them
   their own full-width rows rather than crushing them into half a card. */
.market-card-stats > div:nth-child(n+3) { grid-column: 1 / -1; }
.market-stat-label {
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.market-stat-value { font-size: 12.5px; margin-top: 1px; }

/* Directory (card bucket review) */
.classification-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}
.classification-summary:empty { display: none; }
.classification-summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.classification-summary-card .market-stat-value { font-size: 16px; font-family: var(--mono); }

.classification-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.classification-table td { vertical-align: middle; }
.classification-stack { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.directory-bucket-stack { min-width: 0; }
.directory-set-cell .card-meta { display: block; }

.rarity-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  padding: 2px 7px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--text-soft);
}
.rarity-badge.r-SEC { color: var(--brand); border-color: rgba(227,185,104,.5); background: var(--brand-soft); }
.rarity-badge.r-SR { color: var(--violet); border-color: rgba(167,139,224,.45); background: var(--violet-soft); }
.rarity-badge.r-L { color: var(--info); border-color: rgba(111,168,232,.45); background: var(--info-soft); }
.rarity-badge.r-SP { color: var(--up); border-color: rgba(76,195,138,.45); background: var(--up-soft); }

/* 12. COMPETITIVE & TOURNAMENTS ---------------------------------------------- */

.dashboard-competitive-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.dashboard-competitive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.3fr);
  gap: 18px;
  align-items: start;
}

.dashboard-leader-list { display: flex; flex-direction: column; gap: 6px; }
.dashboard-leader-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color .13s;
}
.dashboard-leader-row:hover { border-color: var(--border2); }
.dashboard-leader-row.selected { border-color: var(--brand); background: var(--brand-soft); }
.dashboard-leader-rank {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.dashboard-leader-thumb,
.dashboard-leader-thumb-placeholder {
  width: 34px; height: 48px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  object-position: top;
  background: var(--elevated);
  border: 1px solid var(--border);
}
.dashboard-leader-main { flex: 1; min-width: 0; }
.dashboard-leader-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 9px;
}
.dashboard-leader-top strong {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-leader-top span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--brand);
  flex-shrink: 0;
}
.dashboard-leader-bar {
  height: 4px;
  border-radius: 3px;
  background: var(--elevated);
  margin: 5px 0 4px;
  overflow: hidden;
}
.dashboard-leader-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), #c99a45);
}

.dashboard-leader-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  min-height: 28px;
}
.dashboard-leader-page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.dashboard-competitive-changes {
  margin-top: 8px;
  overflow-x: auto;
}
.dashboard-competitive-changes-table { min-width: 620px; }
.dashboard-competitive-changes-table td {
  font-size: 12px;
  vertical-align: middle;
}
.dashboard-change-count {
  font-family: var(--mono);
  color: var(--text-soft);
}
.dashboard-change-count span {
  color: var(--faint);
  font-size: 10.5px;
}

.dashboard-leader-context {
  margin-top: 8px;
}
.leader-context-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.leader-context-stats > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 11px;
  min-width: 0;
}
.leader-context-stats span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
}
.leader-context-stats strong {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
  margin-top: 2px;
}
.leader-context-stats em {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
}
.leader-context-grid {
  display: grid;
  /* Single column: this panel sits in the narrow left column of the competitive
     layout, which cannot fit the wide Common Cards table beside the events column
     without overlap. Stack them and let the table scroll if the column is tight. */
  grid-template-columns: 1fr;
  gap: 12px;
}
.leader-context-grid > div { min-width: 0; }
.leader-context-grid > div:first-child { overflow-x: auto; }
.leader-context-card-table { min-width: 520px; }
.dashboard-deck-card-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.leader-context-event-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.leader-context-event {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  min-width: 0;
}
.leader-context-card-appearance-row td {
  background: var(--elevated);
  padding-top: 6px;
  padding-bottom: 10px;
}
.leader-context-card-appearances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.leader-context-card-appearance {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  min-width: 0;
}
.leader-context-card-appearance > span {
  font-family: var(--mono);
  color: var(--brand);
  font-size: 12px;
}
.dashboard-archetype-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.dashboard-archetype-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.dashboard-archetype-stats > div,
.dashboard-archetype-row {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 9px 11px;
}
.dashboard-archetype-stats span,
.dashboard-archetype-stats em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.dashboard-archetype-stats strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
  margin: 2px 0;
}
.dashboard-archetype-list {
  display: grid;
  gap: 6px;
}
.dashboard-archetype-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  font-size: 12px;
}
.dashboard-archetype-row.needs-review {
  color: var(--muted);
}
.dashboard-card-usage { display: grid; gap: 10px; }
.card-usage-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.card-usage-controls .filter-select { max-width: 260px; }
.card-usage-table td { font-size: 12px; }
.card-usage-table .card-name { color: var(--text); }
/* Role labels are descriptive published-list evidence, not verdicts: keep them
   visually neutral (no good/bad color coding). */
.card-usage-role {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.card-usage-table tbody tr.clickable.selected td { background: var(--brand-soft); }
.card-in-play-row td { background: var(--brand-soft); }
.card-in-play { display: grid; gap: 6px; padding: 4px 2px; }
.card-in-play-list { display: grid; gap: 4px; }
.card-in-play-leader {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-soft);
}
.card-in-play-leader-name { color: var(--text); font-weight: 600; }
.dashboard-deck-compare { margin: 8px 0; }
.deck-compare-btn { margin-top: 4px; }
.deck-compare-btn.active { border-color: var(--brand); color: var(--brand); }
.deck-compare {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}
.deck-compare-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.deck-compare-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); }
.deck-compare-legend strong { color: var(--brand); margin-right: 4px; }
.deck-compare-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.deck-compare-stats > div { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px; }
.deck-compare-stats span, .deck-compare-stats em { display: block; color: var(--muted); font-size: 11px; font-style: normal; }
.deck-compare-stats strong { display: block; color: var(--text); font-size: 18px; line-height: 1.2; margin: 2px 0; }
.deck-compare-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.deck-compare-list { display: grid; gap: 4px; margin-top: 4px; }
.deck-compare-item { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 11.5px; }
@media (max-width: 900px) { .deck-compare-grid { grid-template-columns: 1fr; } }
#dashboard-competitive-decks { display: flex; flex-direction: column; gap: 8px; }
.deck-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.deck-card:hover { border-color: var(--brand); background: var(--elevated); }
.deck-card.comparing { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.deck-card .dashboard-deck-leader-cell { flex: 0 0 auto; max-width: 190px; }
.deck-card-body { flex: 1 1 auto; min-width: 0; }
.deck-card-event { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-card-event a { color: var(--brand); }
.deck-card-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.deck-card-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.deck-card-count { font-size: 10.5px; color: var(--muted); text-align: right; line-height: 1.25; }
.deck-card-count strong { font-family: var(--mono); font-size: 15px; color: var(--text); }
.deck-card-count span { display: block; }
.deck-compare-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--brand); border-radius: var(--r-md);
  background: var(--brand-soft); padding: 7px 11px; font-size: 12px; margin-bottom: 8px;
}
.deck-compare-bar-label { color: var(--text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-compare-bar-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
@media (max-width: 700px) {
  .deck-card { flex-wrap: wrap; }
  .deck-card-actions { width: 100%; justify-content: space-between; }
}
.leader-modal { display: grid; gap: 14px; }
.evolution { display: grid; gap: 10px; }
.evolution-table th, .evolution-table td { text-align: center; }
.evolution-table th:first-child, .evolution-table td:first-child { text-align: left; }
.evolution-table td { font-size: 11.5px; }
.dashboard-deck-row td { font-size: 12px; }
.dashboard-deck-row.selected td { background: var(--brand-soft); }
.dashboard-deck-leader-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.dashboard-deck-archetype {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  max-width: 170px;
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.2;
}
.dashboard-deck-archetype span {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dashboard-deck-leader-thumb,
.dashboard-deck-leader-placeholder {
  width: 28px; height: 39px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  object-position: top;
  background: var(--elevated);
  border: 1px solid var(--border);
}
.dashboard-deck-detail-row td {
  background: var(--surface);
  padding: 14px;
}
.dashboard-deck-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.dashboard-deck-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}
.dashboard-deck-card {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 7px 9px;
  min-width: 0;
}
.dashboard-deck-card-image,
.dashboard-deck-card-image-placeholder {
  width: 26px; height: 36px;
  flex-shrink: 0;
  border-radius: 3px;
  object-fit: cover;
  background: var(--elevated);
  border: 1px solid var(--border);
}
.dashboard-deck-card-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.dashboard-deck-card-main span { font-family: var(--mono); font-size: 10px; color: var(--brand); }
.dashboard-deck-card-main strong {
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-deck-card-main em {
  font-style: normal;
  font-size: 9.5px;
  color: var(--faint);
  font-family: var(--mono);
}
.dashboard-deck-card-main small { font-size: 9.5px; color: var(--muted); font-family: var(--mono); }

/* Tournament drawer items + tournaments view */
.tournament-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.tournament-item:last-child { border-bottom: none; }
.t-name { font-size: 12.5px; font-weight: 600; }
.t-detail { font-size: 10.5px; color: var(--faint); font-family: var(--mono); margin-top: 2px; }
.t-grouped { font-size: 10px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.t-copies { font-size: 13px; color: var(--brand); flex-shrink: 0; }
.tier-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: 1px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--muted);
}
.tier-tag.tier-World { color: var(--brand); border-color: rgba(227,185,104,.5); background: var(--brand-soft); }
.tier-tag.tier-Major { color: var(--info); border-color: rgba(111,168,232,.45); background: var(--info-soft); }

/* 13. DRAWER, MODAL & FACT PACKET --------------------------------------------- */

.detail-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 6, 11, 0.66);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}
.detail-modal-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--border2);
  box-shadow: var(--shadow-3);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform .2s ease;
}
.drawer.open { transform: translateX(0); }

.drawer.modal-mode {
  top: 4vh; right: auto; bottom: auto;
  left: 50%;
  width: min(880px, 94vw);
  max-height: 92vh;
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
}
.drawer.modal-mode.open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.drawer.modal-mode.trend-modal-mode {
  top: 12px;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.drawer-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.drawer-meta { font-size: 10.5px; color: var(--faint); font-family: var(--mono); margin-top: 3px; }
.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.drawer-watch {
  min-width: 76px;
  height: 27px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: var(--elevated);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
  transition: color .13s, border-color .13s, background .13s;
}
.drawer-watch:hover { color: var(--text); border-color: var(--faint); }
.drawer-watch.watching {
  color: var(--brand);
  border-color: rgba(227, 185, 104, .5);
  background: var(--brand-soft);
}
.drawer-watch[hidden] { display: none; }
.drawer-close {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--muted);
  width: 27px; height: 27px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  flex-shrink: 0;
  transition: color .13s, border-color .13s;
}
.drawer-close:hover { color: var(--text); border-color: var(--faint); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 30px; min-height: 0; }

/* Card modal hero */
.dashboard-detail-return {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 11.5px;
  color: var(--muted);
}
.dashboard-detail-hero {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.dashboard-detail-image-wrap { position: relative; }
.dashboard-detail-image-wrap.zoomable { cursor: zoom-in; }
.dashboard-detail-image-wrap.zoomable:hover .dashboard-detail-image { filter: brightness(1.07); }
.dashboard-detail-image {
  width: 100%;
  border-radius: 9px;
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-2);
  display: block;
  transition: filter .13s;
}
.dashboard-detail-image-wrap .market-card-image-placeholder { width: 100%; transform: none; }
.dashboard-detail-main { min-width: 0; }
.daily-brief-label {
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 650;
}
.dashboard-detail-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 630;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 3px 0 2px;
}

.dashboard-detail-stats,
.dashboard-hero-stats,
.dashboard-movement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.dashboard-detail-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.dashboard-detail-stat span {
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.dashboard-detail-stat strong { font-size: 14.5px; }
.dashboard-detail-stat em { font-style: normal; font-size: 10px; color: var(--muted); line-height: 1.4; }
.dashboard-hero-stats .dashboard-detail-stat.move.positive strong,
.dashboard-hero-stats .dashboard-detail-stat.move.positive .move-percent { color: var(--up); }
.dashboard-hero-stats .dashboard-detail-stat.move.negative strong,
.dashboard-hero-stats .dashboard-detail-stat.move.negative .move-percent { color: var(--down); }
.dashboard-hero-stats .dashboard-detail-stat.move .change-pos { color: var(--up); }
.dashboard-hero-stats .dashboard-detail-stat.move .change-neg { color: var(--down); }
.dashboard-hero-stats .dashboard-detail-stat.move .change-neu { color: var(--muted); }
.dashboard-hero-stats .dashboard-detail-stat.move .move-percent { font-weight: 700; }
.dashboard-hero-stats .dashboard-detail-stat.move .move-date { color: var(--muted); font-weight: 500; }
.dashboard-hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.dashboard-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dashboard-chip-row[hidden] { display: none; }
.dashboard-detail-chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 550;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--text-soft);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-detail-chip.warn { color: var(--warn); border-color: rgba(223,166,62,.45); background: var(--warn-soft); }
.dashboard-detail-chip.muted { color: var(--muted); }
button.dashboard-detail-chip { font: inherit; cursor: pointer; appearance: none; }
.dashboard-detail-chip.clickable:hover { color: var(--text); border-color: var(--brand); }

.dashboard-context-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.dashboard-context-line[hidden] { display: none; }
.dashboard-context-line span { display: inline-flex; align-items: center; min-width: 0; }
.dashboard-context-line span:not(:last-child)::after { content: '/'; color: var(--faint); margin-left: 10px; }
.dashboard-context-line .warn { color: var(--warn); }
.dashboard-detail-context { margin-top: 14px; }
.dashboard-detail-context[hidden] { display: none; }

.modal-evidence-panel {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 13px;
}
.modal-evidence-panel[hidden] { display: none; }
.modal-evidence-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-evidence-head span {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
}
.modal-evidence-head strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}
.modal-evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}
.modal-evidence-stat {
  min-width: 0;
  padding-left: 10px;
  border-left: 1px solid var(--border2);
}
.modal-evidence-stat:first-child { padding-left: 0; border-left: 0; }
.modal-evidence-stat strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-evidence-stat span {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 650;
}
.modal-evidence-stat em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
  line-height: 1.35;
}
.modal-evidence-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.evidence-show-more { margin-top: 8px; display: flex; justify-content: flex-start; }
.evidence-show-more .btn-ghost { padding: 6px 10px; font-size: 11px; }

.dashboard-market-read {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.dashboard-market-read span {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
  display: block;
}
.dashboard-market-read strong { font-size: 12.5px; display: block; margin: 3px 0; }
.dashboard-market-read p { font-size: 11px; color: var(--muted); line-height: 1.5; }
.dashboard-market-read.placeholder { border-style: dashed; opacity: .75; }

.dashboard-detail-section { margin-top: 16px; }
.dashboard-detail-section > summary {
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--muted);
  padding: 9px 0;
  border-top: 1px solid var(--border);
  user-select: none;
}
.dashboard-detail-section > summary:hover { color: var(--text); }

/* Chart */
.dashboard-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.dashboard-chart-head .section-title { margin: 0; }
.chart-container {
  position: relative;
  height: 210px;
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px 6px;
}
.dashboard-detail-chart { height: 230px; }
.chart-range-status {
  font-size: 10.5px;
  color: var(--faint);
  font-family: var(--mono);
  margin-top: 6px;
}

/* Image zoom overlay */
.card-image-zoom-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(3, 5, 9, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.card-image-zoom-backdrop.open { opacity: 1; pointer-events: auto; }
.card-image-zoom-frame {
  position: relative;
  max-width: min(680px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.card-image-zoom-image {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  display: block;
  border-radius: 11px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-3);
  background: var(--card);
}
.card-image-zoom-close {
  position: absolute;
  top: -14px; right: -14px;
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--overlay);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  z-index: 2;
}
.card-image-zoom-title { font-size: 12px; color: var(--muted); }

/* Trend (bucket/set) modal */
.bucket-modal-summary {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
}
.bucket-modal-summary > div { display: flex; flex-direction: column; gap: 1px; }
.bucket-modal-summary span {
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.bucket-modal-summary strong { font-size: 13.5px; }
.bucket-modal-total-move strong { font-size: 16px; }
.bucket-modal-total-move em {
  font-style: normal;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}
.bucket-window-control {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.bucket-window-control button {
  height: 25px;
  min-width: 38px;
  padding: 0 8px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  background: var(--elevated);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.bucket-window-control button:hover {
  color: var(--text);
  border-color: var(--faint);
}
.bucket-window-control button.active {
  color: var(--ink);
  border-color: transparent;
  background: var(--brand);
}
.bucket-modal-action { margin-left: auto; }

.bucket-mover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.bucket-mover-section { min-width: 0; }
.bucket-mover-section .section-title { margin-top: 0; }
.bucket-mover-section-full { margin-top: 4px; }
.bucket-mover-table {
  width: 100%;
  table-layout: fixed;
}
.bucket-mover-table th:nth-child(1), .bucket-mover-table td:nth-child(1) { width: 42%; }
.bucket-mover-table th:nth-child(2), .bucket-mover-table td:nth-child(2) { width: 17%; }
.bucket-mover-table th:nth-child(3), .bucket-mover-table td:nth-child(3) { width: 16%; }
.bucket-mover-table th:nth-child(4), .bucket-mover-table td:nth-child(4) { width: 25%; }
.bucket-mover-table td { padding: 8px 10px; }
.bucket-mover-card { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bucket-mover-card > div { min-width: 0; }
.bucket-mover-change { font-size: 13px; }
.bucket-mover-change.positive { color: var(--up); }
.bucket-mover-change.negative { color: var(--down); }
@media (max-width: 920px) {
  .drawer.modal-mode.trend-modal-mode { width: min(760px, calc(100vw - 20px)); }
  .bucket-mover-grid { grid-template-columns: 1fr; }
}

/* 14. REVIEW FORMS & COMMUNITY -------------------------------------------------- */

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.review-field label {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
  position: relative;
  width: fit-content;
}
.review-field label[data-help]::after,
.review-check[data-help]::after {
  content: attr(data-help);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 260px;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-soft);
  background: var(--overlay);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 8px 10px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  transition: opacity .12s;
}
.review-field label[data-help]:hover::after,
.review-check[data-help]:hover::after { opacity: 1; }

.review-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .13s, background .13s;
}
.review-input:focus { border-color: var(--border2); background: var(--elevated); }
.review-input::placeholder { color: var(--faint); }
.review-textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
.review-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
  margin: 4px 0 12px;
  position: relative;
  width: fit-content;
  cursor: pointer;
}
.review-check input { accent-color: var(--brand); }

/* Bucket review drawer */
.bucket-review-drawer { display: flex; flex-direction: column; }
.bucket-review-readonly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}
.bucket-review-readonly-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.bucket-review-readonly-item span {
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.bucket-review-readonly-item strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bucket-review-identity {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.bucket-review-identity .card-thumb,
.bucket-review-identity .card-thumb-placeholder { width: 52px; height: 73px; }
.bucket-review-note {
  margin: 12px 0 2px;
  font-size: 11px;
  color: var(--muted);
  background: var(--info-soft);
  border: 1px solid rgba(111, 168, 232, 0.3);
  border-radius: var(--r-md);
  padding: 8px 11px;
  line-height: 1.5;
}
.bucket-tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  max-height: 210px;
  overflow-y: auto;
}
.bucket-tag-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-soft);
  cursor: pointer;
  padding: 2px 0;
}
.bucket-tag-option input { accent-color: var(--brand); flex-shrink: 0; }
.bucket-review-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* Audit / factor blocks (drawer) */
.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.audit-grid > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.audit-grid span {
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.audit-grid strong { font-size: 12px; }

.factor-row {
  display: grid;
  grid-template-columns: 130px 34px 1fr 34px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 11.5px;
}
.factor-label { color: var(--text-soft); }
.factor-weight { color: var(--faint); font-family: var(--mono); font-size: 10.5px; text-align: right; }
.factor-track { height: 5px; border-radius: 3px; background: var(--elevated); overflow: hidden; }
.factor-fill { height: 100%; border-radius: 3px; }
.factor-score { font-family: var(--mono); font-size: 11px; text-align: right; color: var(--text-soft); }

.score-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.score-hero-num { font-size: 34px; font-weight: 500; line-height: 1; }
.score-hero-label {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 4px;
}
.score-hero-right { text-align: right; }
.price-hero { font-size: 21px; }
.price-hero-change { font-size: 12px; margin-top: 2px; }

.score-bar-wrap { display: flex; align-items: center; gap: 8px; }
.score-num { font-size: 12.5px; min-width: 24px; text-align: right; }
.score-bar-track { flex: 1; height: 5px; border-radius: 3px; background: var(--elevated); overflow: hidden; min-width: 40px; }
.score-bar-fill { height: 100%; border-radius: 3px; }

/* Community sources */
.community-source-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.community-source {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 11.5px;
  min-width: 0;
}
.community-source a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
}
.community-source-meta { color: var(--muted); font-size: 10.5px; margin-top: 3px; line-height: 1.5; }

/* 15. PILLS & BADGES -------------------------------------------------------------- */

.decision-pill, .signal-pill {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  border-radius: 4px;
  padding: 2px 8px;
  border: 1px solid;
}
.decision-pill.decision-BUY, .signal-pill.sig-BUY { color: var(--up); border-color: rgba(76,195,138,.5); background: var(--up-soft); }
.decision-pill.decision-WATCH, .signal-pill.sig-WATCH { color: var(--warn); border-color: rgba(223,166,62,.5); background: var(--warn-soft); }
.decision-pill.decision-REJECT, .signal-pill.sig-SELL { color: var(--down); border-color: rgba(239,113,104,.5); background: var(--down-soft); }

.reason-chip {
  display: inline-block;
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.entry-chip, .target-chip {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--muted);
}
.entry-chip.entry-GOOD_ENTRY { color: var(--up); border-color: rgba(76,195,138,.45); background: var(--up-soft); }
.entry-chip.entry-TOO_EXPENSIVE { color: var(--down); border-color: rgba(239,113,104,.45); background: var(--down-soft); }
.entry-chip.entry-FAIR_PRICE { color: var(--warn); border-color: rgba(223,166,62,.45); background: var(--warn-soft); }
.target-chip.target-MANUAL { color: var(--info); border-color: rgba(111,168,232,.45); background: var(--info-soft); }

.segment-pill, .opportunity-pill, .classification-pill {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 8px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--text-soft);
  white-space: nowrap;
}
.segment-pill.seg-GRAIL, .segment-pill.seg-TRUE_GRAIL, .classification-pill.seg-GRAIL { color: var(--brand); border-color: rgba(227,185,104,.5); background: var(--brand-soft); }
.segment-pill.seg-MINI_GRAIL, .segment-pill.seg-PSEUDO_GRAIL, .classification-pill.seg-MINI_GRAIL { color: var(--violet); border-color: rgba(167,139,224,.45); background: var(--violet-soft); }
.segment-pill.seg-MID, .classification-pill.seg-MID { color: var(--info); border-color: rgba(111,168,232,.45); background: var(--info-soft); }
.segment-pill.seg-PREMIUM_COLLECTOR, .segment-pill.seg-TROPHY_PRIZE { color: var(--brand); border-color: rgba(227,185,104,.5); background: var(--brand-soft); }
.opportunity-pill.opp-GRAIL_HOLD, .classification-pill.opp-GRAIL_HOLD { color: var(--brand); border-color: rgba(227,185,104,.5); background: var(--brand-soft); }
.opportunity-pill.opp-QUICK_FLIP, .classification-pill.opp-QUICK_FLIP { color: var(--up); border-color: rgba(76,195,138,.45); background: var(--up-soft); }
.opportunity-pill.opp-AVOID_TRAP, .classification-pill.opp-AVOID_TRAP { color: var(--down); border-color: rgba(239,113,104,.45); background: var(--down-soft); }
.opportunity-pill.opp-META_SELL_HIGH { color: var(--warn); border-color: rgba(223,166,62,.45); background: var(--warn-soft); }

.data-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.data-flag {
  display: inline-block;
  font-size: 9px;
  font-family: var(--mono);
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--muted);
  white-space: nowrap;
}
.data-flag.warn { color: var(--warn); border-color: rgba(223,166,62,.4); background: var(--warn-soft); }

.action-stack { min-width: 0; }
.action-line { font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.action-sub { font-size: 10px; color: var(--faint); }
.conflict-dot {
  display: inline-grid;
  place-items: center;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--down-soft);
  border: 1px solid rgba(239,113,104,.5);
  color: var(--down);
  font-size: 9px;
  font-weight: 700;
}

.reason-stack, .decision-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.triage-text {
  font-size: 11px;
  color: var(--text-soft);
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.triage-warn { color: var(--warn); }

/* 16. JOBS & FEEDBACK --------------------------------------------------------------- */

.jobs-view .lead { margin-bottom: 16px; }

.job-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.job-action {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 15px;
  min-width: 0;
}
.job-action-title { font-size: 12.5px; font-weight: 650; }
.job-action-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin: 4px 0 10px;
}
.job-message { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; min-height: 16px; }

.job-log-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 12px;
}
.job-log-table th {
  text-align: left;
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  padding: 9px 12px;
  background: var(--elevated);
  border-bottom: 1px solid var(--border);
}
.job-log-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.job-log-table tr:last-child td { border-bottom: none; }

.job-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  border-radius: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border2);
  background: var(--elevated);
  color: var(--muted);
}
.job-status-Success, .job-status-Succeeded { color: var(--up); border-color: rgba(76,195,138,.45); background: var(--up-soft); }
.job-status-Failed, .job-status-Error { color: var(--down); border-color: rgba(239,113,104,.45); background: var(--down-soft); }
.job-status-Running { color: var(--info); border-color: rgba(111,168,232,.45); background: var(--info-soft); }
.job-status-Stale { color: var(--warn); border-color: rgba(223,166,62,.45); background: var(--warn-soft); }

.feedback-inbox-title { margin-top: 28px; }
.feedback-inbox-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.feedback-inbox-message { margin: 0; }
.feedback-table td { font-size: 11.5px; }
.feedback-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  border-radius: 4px;
  padding: 2px 8px;
  background: var(--info-soft);
  border: 1px solid rgba(111,168,232,.4);
  color: var(--info);
}
.feedback-muted { color: var(--faint); font-size: 10px; margin-top: 2px; }
.feedback-message-cell { max-width: 340px; line-height: 1.5; }
.feedback-notes { min-height: 44px; min-width: 160px; font-size: 11px; }
.feedback-status-select { font-size: 11px; }

/* Feedback FAB + modal */
.feedback-fab {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 80;
  background: var(--overlay);
  color: var(--text-soft);
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  transition: color .13s, border-color .13s, transform .12s;
}
.feedback-fab:hover { color: var(--text); border-color: var(--faint); transform: translateY(-1px); }

.feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(4, 6, 11, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.feedback-modal {
  position: fixed;
  right: 20px; bottom: 66px;
  z-index: 112;
  width: min(430px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .16s, transform .16s;
}
.feedback-modal.open { opacity: 1; transform: none; pointer-events: auto; }
.feedback-backdrop.open { opacity: 1; pointer-events: auto; }
.feedback-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 11px;
  border-bottom: 1px solid var(--border);
}
.feedback-modal-body { padding: 14px 16px 16px; }
.feedback-textarea { min-height: 86px; }
.feedback-form-message { font-size: 11px; color: var(--muted); min-height: 15px; margin: 6px 0; }
.feedback-modal-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* 17. HIDDEN-RETAINED VIEWS (leaderboard / picks / formula / historical / community) */

.picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.formula-view .lead { margin-bottom: 18px; }
.formula-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  margin-bottom: 12px;
}
.formula-card-header { display: flex; gap: 15px; align-items: flex-start; }
.fw-pct { font-size: 21px; color: var(--info); min-width: 56px; }
.fw-name { font-size: 13.5px; font-weight: 650; }
.fw-desc { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.fw-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }

.historical-target-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
}
.historical-reason, .historical-diagnostics {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}

/* 18. RESPONSIVE ---------------------------------------------------------------- */

@media (min-width: 1600px) {
  .view { padding-left: 36px; padding-right: 36px; }
}

@media (max-width: 1280px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .home-grid .home-health-module { grid-column: span 2; }
  .dashboard-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .dashboard-competitive-layout { grid-template-columns: 1fr; }
  .leader-context-grid { grid-template-columns: 1fr; }
  .bucket-mover-grid { grid-template-columns: 1fr; }
  .home-brief-body { grid-template-columns: 1fr; }
  .home-brief-stats { max-width: 460px; }
}

@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-grid .home-health-module { grid-column: auto; }
  .dashboard-detail-hero { grid-template-columns: 145px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .leader-context-stats { grid-template-columns: 1fr; }
  .leader-context-card-appearances { grid-template-columns: 1fr; }
  .modal-evidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-evidence-stat:nth-child(odd) { padding-left: 0; border-left: 0; }
  .modal-evidence-stat:nth-child(even) { padding-left: 10px; border-left: 1px solid var(--border2); }
  .shell { display: block; }
  .sidebar {
    position: static;
    width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main { margin-left: 0; }
  .nav-row {
    display: flex;
    overflow-x: auto;
    gap: 3px;
    padding: 10px 12px 6px;
  }
  .nav-item { width: auto; white-space: nowrap; flex-shrink: 0; }
  /* Enlarge the info "i" tap target on touch without changing its desktop size. */
  .info-btn { width: 22px; height: 22px; font-size: 11px; }
  .scanner-body { max-height: 218px; }
  .scanner-resize-handle { display: none; }

  .topbar { padding: 10px 16px; }
  .topbar-sub { display: none; }

  .view { padding: 16px 14px 56px; }
  .picks-header h2, .jobs-view h2, .formula-view h2 { font-size: 19px; }

  .dashboard-kpi-strip { grid-template-columns: 1fr; }
  .home-headline-row { align-items: flex-start; flex-direction: column; }
  .home-health-grid { grid-template-columns: 1fr; }
  .home-brief-stats { grid-template-columns: 1fr 1fr; max-width: none; }

  .view-toolbar { padding: 10px 12px; gap: 9px 12px; }
  .dashboard-market-toolbar { flex-direction: column; }

  .review-grid { grid-template-columns: 1fr; }
  .dashboard-detail-hero { grid-template-columns: 1fr; }
  .dashboard-detail-image { max-width: 190px; }
  .dashboard-detail-stats, .dashboard-hero-stats, .dashboard-movement-grid { grid-template-columns: 1fr; }
  .dashboard-chart-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .price-range-toggle { flex-wrap: wrap; }

  .drawer { width: 100vw; border-left: none; }
  .drawer.modal-mode {
    top: 0; left: 0;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    transform: translateY(12px);
  }
  .drawer.modal-mode.open { transform: none; }

  .market-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 9px; }
  .bucket-modal-summary { gap: 12px; }
  .bucket-modal-action { margin-left: 0; width: 100%; }

  .feedback-fab { right: 12px; bottom: 12px; }
  .feedback-modal { right: 12px; bottom: 58px; }

  /* Dense tables scroll horizontally instead of crushing */
  .lb-table { display: block; overflow-x: auto; white-space: nowrap; }
  .lb-table thead th, .lb-table tbody td { white-space: nowrap; }
  /* Home module tables stay fixed-layout so the % columns hold and the nowrap
     card name ellipsizes within its cell — auto layout let the name push the
     table past the viewport and scrolled the whole page. */
  .home-module-table { table-layout: fixed; }
  /* The inline activity line is a single unbreakable string; let it wrap in the
     narrow mobile card column instead of clipping. */
  .home-card-volume { white-space: normal; }
}

/* ---- Observed TCGplayer activity (liquidity evidence v0) ----------------
   Neutral evidence styling on purpose: activity labels are information, not
   verdicts, so no ok/warn/pos/neg tones apply anywhere in these blocks. */
.home-trust-chip.activity { color: var(--muted); border-color: var(--border2); background: var(--elevated); }
.activity-chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 550;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  color: var(--text-soft);
  white-space: nowrap;
}
.evidence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin: 6px 0 10px;
}
.evidence-table th {
  text-align: left;
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.evidence-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}
