/* TabletopMongers — Shared Stylesheet
   Design tokens locked from prototype (2026-07-04)
   All pages reference this file. */

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --bg:      #12100e;
  --panel:   #1b1815;
  --panel2:  #221e1a;
  --border:  #332d27;
  --line:    #3a332c;
  --text:    #ece6dc;
  --muted:   #a89d8c;
  --accent:  #c94f3d;
  --accent2: #d9a441;
  --good:    #5a9b6e;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ─── Typography ─────────────────────────────────────────── */
h1 { font-size: 24px; margin: 0 0 4px; color: var(--text); }
h2 { font-size: 17px; margin: 0 0 14px; color: var(--accent2); }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; margin-top: 0; }
.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .5px;
  color: var(--accent2);
  cursor: pointer;
}
.brand span { color: var(--accent); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  display: inline-block;
  transition: background .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #b13f2f; }
.btn-gold { background: var(--accent2); color: #241d10; }
.btn-gold:hover { background: #c99433; }
.btn-secondary {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--line); }
.btn-full { width: 100%; text-align: center; }
.btn-danger { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }
.btn-danger:hover { text-decoration: underline; }

/* ─── Forms ──────────────────────────────────────────────── */
.field {
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
}
.field:focus { outline: none; border-color: var(--accent2); }
.field::placeholder { color: var(--muted); }
select.field { cursor: pointer; }
textarea.field { resize: vertical; min-height: 80px; }
.field-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
label.field-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: block; }
.field-wrap { display: flex; flex-direction: column; }

/* ─── Error / Feedback ───────────────────────────────────── */
.error-msg {
  color: var(--accent);
  font-size: 13px;
  margin-top: 8px;
  display: none;
}
.error-msg.visible { display: block; }

/* ─── Panels / Cards ─────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel2-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

/* ─── Top Nav ────────────────────────────────────────────── */
header.topnav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
nav.tabs { display: flex; gap: 4px; flex: 1; }
nav.tabs a,
nav.tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background .12s, color .12s;
}
nav.tabs a:hover,
nav.tabs button:hover { background: var(--panel2); color: var(--text); }
nav.tabs a.active,
nav.tabs button.active { background: var(--accent); color: #fff; }
.user-chip {
  color: var(--muted);
  font-size: 13px;
  background: var(--panel2);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
}
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 140px;
  padding: 6px 0;
  z-index: 200;
}
.user-chip:hover .user-dropdown,
.user-chip.open .user-dropdown { display: block; }

/* Phone: brand and account on the top line, the tabs on a line of their
   own underneath. If the tabs still don't fit they slide sideways inside
   the bar, so the page itself never scrolls sideways. */
@media (max-width: 720px) {
  header.topnav { flex-wrap: wrap; padding: 10px 16px; gap: 8px 12px; }
  header.topnav .brand { font-size: 17px; margin-right: auto; }
  header.topnav nav.tabs {
    order: 3;
    flex: 1 0 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  header.topnav nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs a,
  nav.tabs button { flex-shrink: 0; white-space: nowrap; padding: 7px 12px; }
  .user-chip #user-email {
    display: inline-block;
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}
.user-dropdown a {
  display: block;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
}
.user-dropdown a:hover { background: var(--panel2); color: var(--text); }

/* ─── Main Layout ────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; }
main.content {
  padding: 28px 32px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}
main.content-narrow {
  padding: 28px 32px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* ─── Filter Chips ───────────────────────────────────────── */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent2); color: #241d10; border-color: var(--accent2); }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--accent2); }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ─── Faction / Progress rows ────────────────────────────── */
.faction-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .1s;
}
.faction-row:last-child { border-bottom: none; }
.faction-row:hover { background: var(--panel2); padding-left: 6px; }
.faction-name { width: 190px; font-size: 14px; }
.faction-tag {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.bar-track { flex: 1; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 4px; }
.pct { width: 44px; text-align: right; font-size: 13px; color: var(--muted); }

/* ─── Tables ─────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
td { padding: 10px; border-bottom: 1px solid var(--line); }
tr.model-row { cursor: pointer; transition: background .1s; }
tr.model-row:hover td { background: var(--panel2); }

/* ─── Pipeline dots (table) ──────────────────────────────── */
.pipeline { display: flex; gap: 3px; align-items: center; }
.dot {
  width: 16px;
  height: 6px;
  border-radius: 3px;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.dot.filled { background: var(--good); border-color: var(--good); }
.state-label { font-size: 12px; color: var(--muted); }

/* ─── Source tag ─────────────────────────────────────────── */
.source-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ─── Pipeline tiles (model-detail) ─────────────────────── */
.pipeline-big { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.pipe-step {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 14px 8px;
  border-radius: 8px;
  background: var(--panel2);
  border: 2px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  user-select: none;
}
.pipe-step:hover { border-color: var(--muted); color: var(--text); }
.pipe-step.done { background: var(--good); color: #0e1f14; border-color: var(--good); font-weight: 600; }
.pipe-step.current { border-color: var(--accent2); color: var(--accent2); font-weight: 600; }

/* ─── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--line); }

/* ─── Product grid ───────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.product-card {
  background: var(--panel2);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.product-card:hover { border-color: var(--accent2); }
.product-card.selected { border-color: var(--accent); background: #241a17; }
.product-card .pname { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.product-card .pmeta { font-size: 12px; color: var(--muted); }

/* ─── Mode tabs (add-purchase) ───────────────────────────── */
.mode-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.mode-tab {
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background .12s, color .12s, border-color .12s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Contents preview ───────────────────────────────────── */
.contents-preview {
  margin-top: 18px;
  padding: 16px;
  background: var(--panel2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.contents-preview ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
}
.contents-preview li { margin-bottom: 4px; }

/* ─── Photo gallery (model-detail) ──────────────────────── */
#photo-gallery img {
  display: block;
  transition: opacity .15s;
}
#photo-gallery img:hover { opacity: .88; }

/* ─── Thumbnail (collection table) ──────────────────────── */
.model-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.model-thumb img,
.model-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.model-thumb img.user-photo {
  object-fit: cover;
  padding: 0;
}

/* ─── Army cards ─────────────────────────────────────────── */
.army-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.army-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: border-color .15s;
  text-decoration: none;
  display: block;
  color: inherit;
}
.army-card:hover { border-color: var(--accent2); }
.army-card .army-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.army-card .army-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.army-record { display: flex; gap: 10px; font-size: 13px; }
.army-record .rec { text-align: center; }
.army-record .rec-num { font-size: 18px; font-weight: 700; }
.army-record .rec-num.win  { color: var(--good); }
.army-record .rec-num.loss { color: var(--accent); }
.army-record .rec-num.draw { color: var(--muted); }
.army-record .rec-label { font-size: 11px; color: var(--muted); }

/* ─── History feed ────────────────────────────────────────── */
.history-feed { display: flex; flex-direction: column; gap: 0; }
.feed-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.feed-item:last-child { border-bottom: none; }
.feed-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 5px;
}
.feed-dot.deed    { background: var(--accent2); }
.feed-dot.match   { background: var(--accent); }
.feed-dot.paint   { background: var(--good); }
.feed-dot.system  { background: var(--border); }
.feed-body { flex: 1; }
.feed-type { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 3px; }
.feed-text { font-size: 14px; line-height: 1.5; }
.feed-date { font-size: 12px; color: var(--muted); margin-top: 4px; }
.feed-match-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  display: inline-block;
}
.feed-match-badge.win  { background: #0e2016; color: var(--good); border: 1px solid var(--good); }
.feed-match-badge.loss { background: #1f0d0b; color: var(--accent); border: 1px solid var(--accent); }
.feed-match-badge.draw { background: var(--panel2); color: var(--muted); border: 1px solid var(--border); }

/* ─── Deed entry form ────────────────────────────────────── */
.deed-form {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: none;
}
.deed-form.open { display: block; }
.deed-form .field-group { margin-bottom: 10px; }

/* ─── Inline editable name ───────────────────────────────── */
.inline-edit {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text);
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  padding: 2px 4px;
  cursor: text;
  width: 100%;
  transition: border-color .15s;
}
.inline-edit:focus { outline: none; border-bottom-color: var(--accent2); }
.inline-edit::placeholder { color: var(--border); font-style: italic; }

/* ─── Backstory block ────────────────────────────────────── */
.backstory-block {
  background: var(--panel2);
  border-left: 3px solid var(--accent2);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  font-style: italic;
}
.backstory-block.empty { border-left-color: var(--border); }

/* ─── Stats strip ────────────────────────────────────────── */
.stats-strip {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stats-strip .stat { text-align: center; }
.stats-strip .stat .num { font-size: 22px; font-weight: 700; color: var(--accent2); }
.stats-strip .stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─── Army tags on squad ─────────────────────────────────── */
.army-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.army-tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.army-tag:hover { border-color: var(--accent2); color: var(--text); }

/* ─── Model instance list ────────────────────────────────── */
.model-list { display: flex; flex-direction: column; gap: 6px; }
.model-instance {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel2);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .12s;
}
.model-instance:hover { border-color: var(--accent2); }
.model-instance .mi-name { flex: 1; font-weight: 600; }
.model-instance .mi-stage { color: var(--muted); font-size: 12px; }
.model-instance .mi-dots { display: flex; gap: 2px; }
.model-instance .dot { width: 10px; height: 4px; }

/* ─── Lock card (army builder stub) ─────────────────────── */
.lock-card {
  background: var(--panel);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 80px 40px;
  text-align: center;
  color: var(--muted);
  max-width: 560px;
  margin: 60px auto 0;
}
.lock-card .lock-icon { font-size: 48px; margin-bottom: 16px; }
.lock-card .lock-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.lock-card .lock-body { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ─── Toolbar ────────────────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ─── Divider ────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ─── Auth page layout ───────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, #241a15, var(--bg) 70%);
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}
.auth-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--accent2);
  text-align: center;
  margin-bottom: 28px;
  display: block;
}
.auth-brand span { color: var(--accent); }
.auth-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 24px;
  text-align: center;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.auth-footer a { color: var(--accent2); }
.auth-footer a:hover { text-decoration: underline; }

/* ─── Collection sidebar layout ──────────────────────────── */
.collection-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 57px);
}
.faction-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
}
.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  padding: 10px 16px 6px;
  opacity: .7;
}
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-left: 3px solid transparent;
  transition: background .1s, color .1s, border-color .1s;
}
.sidebar-item:hover { background: var(--panel2); color: var(--text); }
.sidebar-item.active { background: var(--panel2); color: var(--text); border-left-color: var(--accent); }
.sidebar-item .count {
  font-size: 11px;
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--muted);
}
.sidebar-item.active .count { background: var(--line); }
.collection-main { flex: 1; padding: 28px 32px; }

/* Phone: the faction list sits above the page instead of beside it,
   the stat cards go two to a row, and wide tables slide inside the page. */
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-layout { flex-direction: column; }
  .faction-sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 0; }
  .collection-main { min-width: 0; padding: 20px 16px; overflow-x: auto; }
}


/* ─── Aboutus page ─────────────────────────────────────────── */
/* ─── About page — public ──────────────────────── */
  .public-nav {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .public-nav .nav-actions { display: flex; gap: 10px; }

  .about-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 60px 32px 80px;
  }

  .about-hero {
    text-align: center;
    margin-bottom: 64px;
  }
  .about-hero h1 {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: .5px;
    margin-bottom: 16px;
    line-height: 1.2;
  }
  .about-hero h1 em {
    font-style: normal;
    color: var(--accent2);
  }
  .about-hero p {
    font-size: 17px;
    color: var(--muted);
    max-width: 580px;
    margin: 0 auto 28px;
    line-height: 1.7;
  }

  .section { margin-bottom: 60px; }
  .section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 10px;
  }
  .section h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 14px;
  }
  .section p {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.75;
    margin: 0 0 12px;
  }
  .section p:last-child { margin-bottom: 0; }

  .feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 28px;
  }
  .feature-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
  }
  .feature-icon { font-size: 26px; margin-bottom: 12px; }
  .feature-card h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; color: var(--text); }
  .feature-card p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.6; }

  .who-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 28px;
  }
  .who-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
  }
  .who-card .who-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--accent2);
  }
  .who-card .who-role {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 14px;
  }
  .who-card p { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 0; }

  .cta-banner {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 36px;
    text-align: center;
    margin-top: 60px;
  }
  .cta-banner h2 {
    font-size: 22px;
    color: var(--text);
    margin: 0 0 10px;
  }
  .cta-banner p {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 24px;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }
  .cta-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

  @media (max-width: 640px) {
    .feature-grid, .who-grid { grid-template-columns: 1fr; }
    .about-hero h1 { font-size: 28px; }
    .about-page { padding: 40px 20px 60px; }
    .public-nav { padding: 14px 20px; }
  }


/* ─── Add Purchase page ─────────────────────────────────────────── */
/* ─── Status toggle ──────────────────────────────────────── */
  .status-toggle {
    display: flex;
    gap: 0;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    width: fit-content;
    margin-bottom: 24px;
  }
  .status-toggle button {
    background: none;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: background .12s, color .12s;
  }
  .status-toggle button.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
  }
  .status-toggle button.active.wishlist { color: var(--accent2); }
  .wishlist-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: -18px;
    margin-bottom: 20px;
    display: none;
  }
  .wishlist-hint.visible { display: block; }

  /* ─── Unit search (quick add / secondhand) ───────────────── */
  .unit-search-wrap { position: relative; margin-bottom: 14px; }
  .unit-search-wrap .field { padding-left: 36px; }
  .unit-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 15px;
    pointer-events: none;
  }
  .unit-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
  }
  .unit-results.open { display: block; }
  .unit-result-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
    transition: background .1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .unit-result-item:last-child { border-bottom: none; }
  .unit-result-item:hover { background: var(--panel2); }
  .unit-result-meta { font-size: 12px; color: var(--muted); }
  .unit-result-empty { padding: 14px; font-size: 13px; color: var(--muted); }

  .selected-unit-pill {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--panel2);
    border: 1px solid var(--accent2);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 14px;
    font-size: 14px;
  }
  .selected-unit-pill.visible { display: flex; }
  .selected-unit-pill .pill-name { font-weight: 600; color: var(--text); }
  .selected-unit-pill .pill-meta { font-size: 12px; color: var(--muted); flex: 1; }
  .pill-clear {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
  }
  .pill-clear:hover { color: var(--accent); }

  /* ─── Source chips ───────────────────────────────────────── */
  .source-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
  .source-chip {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition: background .12s, color .12s, border-color .12s;
  }
  .source-chip:hover { color: var(--text); }
  .source-chip.active { background: var(--panel2); border-color: var(--accent2); color: var(--accent2); }

  /* ─── Qty row ────────────────────────────────────────────── */
  .qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }
  .qty-row label { font-size: 13px; color: var(--muted); white-space: nowrap; }
  .qty-big {
    width: 90px;
    padding: 10px 12px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
  }

  /* ─── Box contents checkboxes ────────────────────────────── */
  .contents-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 16px; }
  .content-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--panel2);
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .12s;
    user-select: none;
  }
  .content-row:hover { border-color: var(--muted); }
  .content-row input[type=checkbox] { accent-color: var(--accent2); width: 15px; height: 15px; cursor: pointer; }
  .content-row.unchecked { opacity: .45; }
  .content-row .content-name { flex: 1; }
  .content-row .content-qty-note { font-size: 12px; color: var(--muted); }

  /* ─── Affiliate link ─────────────────────────────────────── */
  .affiliate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
  }
  .affiliate-link {
    color: var(--accent2);
    font-size: 13px;
    text-decoration: none;
  }
  .affiliate-link:hover { text-decoration: underline; }
  .aff-tag {
    font-size: 10px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--muted);
    letter-spacing: .3px;
  }

  /* ─── Add button / action row ────────────────────────────── */
  .add-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .btn-wishlist { background: var(--accent2); color: #241d10; }
  .btn-wishlist:hover { background: #c99433; }

  /* ─── Notes field ────────────────────────────────────────── */
  .sh-source-locked {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--muted);
  }

  /* ─── Add-more row ───────────────────────────────────────── */
  .add-another { font-size: 13px; color: var(--accent2); cursor: pointer; background: none; border: none; font-family: inherit; padding: 0; }
  .add-another:hover { text-decoration: underline; }


/* ─── Admin page ─────────────────────────────────────────── */
/* ─── Admin chrome ───────────────────────────────────────── */
  .admin-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--accent);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
  }

  /* ─── Two-col layout ─────────────────────────────────────── */
  .admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    min-height: calc(100vh - 57px);
  }
  .admin-sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 57px;
    height: calc(100vh - 57px);
    overflow-y: auto;
  }
  .admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .1s, color .1s, border-color .1s;
    text-decoration: none;
  }
  .admin-nav-item:hover { background: var(--panel2); color: var(--text); }
  .admin-nav-item.active { background: var(--panel2); color: var(--text); border-left-color: var(--accent); }
  .admin-nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    padding: 14px 18px 6px;
    opacity: .6;
  }
  .admin-main { padding: 28px 32px; }

  /* ─── Section visibility ─────────────────────────────────── */
  .admin-section { display: none; }
  .admin-section.active { display: block; }

  /* ─── Status indicators ──────────────────────────────────── */
  .status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
  }
  .status-dot.ok      { background: var(--good); }
  .status-dot.warn    { background: var(--accent2); }
  .status-dot.error   { background: var(--accent); }
  .status-dot.idle    { background: var(--border); }

  /* ─── Workflow stages ─────────────────────────────────────── */
  .scraper-stage { margin-bottom: 32px; }
  .stage-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
  }
  .stage-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--panel2);
    border: 1px solid var(--border);
    color: var(--accent2);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
  }
  .stage-head h2 { font-size: 16px; margin: 0; color: var(--text); }
  .stage-body { margin-left: 32px; }
  .stage-sub { font-size: 12px; color: var(--muted); margin: 0 0 14px 0; }
  .stage-note {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent2);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 14px 0;
  }
  .stage-note.warn { border-left-color: var(--accent); }
  .stage-note strong { color: var(--text); }
  .stage-later {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
  }
  .stage-later .stage-head h2 { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
  .stage-later .stage-num { opacity: .5; }
  .stage-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin: 0 0 8px 0;
    opacity: .7;
  }

  /* ─── Scraper cards ──────────────────────────────────────── */
  .scraper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
  }
  .scraper-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
  }
  .scraper-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
  }
  .scraper-card-head h3 { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
  .scraper-meta { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
  .scraper-actions { display: flex; gap: 8px; flex-wrap: wrap; }

  .btn-sm {
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background .12s, opacity .12s;
  }
  .btn-sm:disabled { opacity: .4; cursor: not-allowed; }
  .btn-sm.primary { background: var(--accent); color: #fff; }
  .btn-sm.primary:hover:not(:disabled) { background: #b13f2f; }
  .btn-sm.secondary { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }
  .btn-sm.secondary:hover:not(:disabled) { background: var(--line); }
  .btn-sm.gold { background: var(--accent2); color: #241d10; }
  .btn-sm.gold:hover:not(:disabled) { background: #c99433; }

  /* ─── Log panel ──────────────────────────────────────────── */
  .log-panel {
    background: #0a0908;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #a89d8c;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
  }
  .log-panel .log-ok   { color: #5a9b6e; }
  .log-panel .log-warn { color: #d9a441; }
  .log-panel .log-err  { color: #c94f3d; }
  .log-panel .log-dim  { color: #555; }
  .log-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 8px;
  }

  /* ─── Ruleset table ──────────────────────────────────────── */
  .current-badge {
    font-size: 10px;
    background: var(--good);
    color: #0e1f14;
    border-radius: 3px;
    padding: 2px 6px;
    font-weight: 700;
    letter-spacing: .3px;
  }
  .game-tag {
    font-size: 11px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--muted);
  }
  .row-counts {
    display: flex; gap: 6px; flex-wrap: wrap;
  }
  .row-count-chip {
    font-size: 11px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--muted);
  }

  /* ─── Stats strip ────────────────────────────────────────── */
  .admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
  }
  .admin-stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
  }
  .admin-stat .num { font-size: 24px; font-weight: 700; color: var(--accent2); }
  .admin-stat .label { font-size: 12px; color: var(--muted); margin-top: 3px; }

  /* ─── Progress bar (scraper running) ────────────────────── */
  .run-progress {
    display: none;
    margin-top: 12px;
    background: var(--panel2);
    border-radius: 4px;
    height: 4px;
    overflow: hidden;
  }
  .run-progress.visible { display: block; }
  .run-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 4px;
    transition: width .3s ease;
  }

  @media (max-width: 768px) {
    .admin-layout { grid-template-columns: minmax(0, 1fr); }
    .admin-sidebar { position: relative; top: 0; height: auto; }
    .admin-main { padding: 20px 16px; overflow-x: auto; }   /* wide tables slide, the page doesn't */
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
  }
