/*
 * Slabster — Design System
 * Aesthetic: graded-card slab. Sharp corners, double borders, gold label accents.
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;          /* keeps native controls (select popups, etc.) themed dark */
  --bg:         #05070c;       /* display-case black */
  --panel:      #0d1520;       /* slab body */
  --panel2:     #09101a;       /* inset / recessed surface */
  --text:       #e8eef6;
  --muted:      #7a93ae;
  --line:       #1c2d40;       /* structural border */
  --line2:      #253648;       /* slightly brighter divider */
  --gold:       #c9a84c;       /* slab-label gold */
  --gold-faint: rgba(201,168,76,.14);
  --gold-glow:  rgba(201,168,76,.08);
  --blue:       #3a7dc4;       /* holographic accent */
  --blue-faint: rgba(58,125,196,.15);
  --green:      #3ea86a;
  --red:        #c0392b;

  /* Radius scale — the slab is sharp; keep it that way. */
  --r:          3px;         /* default: panels, cards, inputs, buttons */
  --r-inner:    2px;         /* inner surfaces: thumbnails, chips, tags */
  --r-pill:     999px;       /* pills / fully-rounded badges */
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 0%, #121f32 0%, transparent 70%),
    radial-gradient(ellipse 30% 60% at 0% 100%, #0b1520 0%, transparent 60%);
  color: var(--text);
  min-height: 100vh;
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1 { font-size: 32px; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { margin: 6px 0; font-size: 18px; }
p  { margin: 0; color: var(--muted); line-height: 1.5; }

/* ── Slab panel ──────────────────────────────────────────────────────────── */

.panel {
  background: linear-gradient(170deg, #111d2e 0%, #0a1018 100%);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  /* outer acrylic-edge ring: gap → frame */
  box-shadow:
    0 0 0 6px #07090d,
    0 0 0 7px #1a2a3e,
    0 40px 80px rgba(0,0,0,.7);
}

/* gold label stripe across top of every panel */
.panel::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, rgba(201,168,76,.3) 60%, transparent 100%);
  border-radius: 2px 2px 0 0;
  margin: -1px -1px 0;   /* bleed to cover top border */
}

/* ── Home page ───────────────────────────────────────────────────────────── */

.home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
}

@media (max-height: 660px) {
  .home {
    align-items: flex-start;
  }
}

.hero {
  max-width: 1000px;
  width: 100%;
  padding: 0;
  text-align: center;
  margin: 20px;
}

.hero-inner {
  padding: 40px 44px 44px;
}

/* Brand identity */
.slabster-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.slabster-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}

.slabster-logomark {
  width: auto;
  height: 80px;
  max-width: 100%;
  flex-shrink: 0;
}

.slabster-name {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
  font-style: italic;
}

.slabster-byline {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 6px;
}

.slabster-tagline {
  font-size: 14px;
  color: var(--muted);
  max-width: 460px;
  margin: 10px auto 0;
  line-height: 1.5;
}

/* Server status */
.server-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 20px auto 0;
  padding: 8px 16px;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .04em;
  border: 1px solid var(--line);
  color: var(--muted);
}
.server-status::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.server-status.ok  { color: #6dd98a; border-color: rgba(61,168,106,.45); background: rgba(61,168,106,.08); }
.server-status.ok::before  { background: #6dd98a; box-shadow: 0 0 6px #3da86a; }
.server-status.warn { color: #e0c96a; border-color: rgba(201,168,76,.4); background: var(--gold-glow); }
.server-status.warn::before { background: var(--gold); }

.home-note { margin-top: 22px; font-size: 13px; color: var(--muted); }

.build-version {
  margin-top: 18px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.build-version:empty { display: none; }

/* ── Tool grid (home page) ───────────────────────────────────────────────── */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 32px;
  align-items: stretch; /* every card in a row matches the row's tallest card */
}

.builder-choice-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.flow-unused {
  display: none !important;
}

/* Each card = a mini slab */
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%; /* fill the grid row rather than only its own content height */
  padding: 0;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: linear-gradient(160deg, #111d2e 0%, #09101b 100%);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  box-shadow: 0 4px 18px rgba(0,0,0,.4);
}

.tool-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(201,168,76,.2);
}

/* Gold label bar at card top */
.tool-card::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), rgba(201,168,76,.2));
  flex-shrink: 0;
}

.tool-card-body {
  padding: 18px 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Grade number badge — top right */

.tool-card h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  line-height: 1.2;
}

.tool-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

/* ── App layouts ─────────────────────────────────────────────────────────── */

.app {
  height: 100vh;
  padding: 20px;
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 20px;
}

.wide-app {
  min-height: 100vh;
  padding: 20px;
}

.csv-panel  { padding: 24px; max-width: 1280px; margin: 0 auto; }
.controls   { padding: 20px; overflow-y: auto; }

/* ── Sub-page nav ────────────────────────────────────────────────────────── */

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  position: relative;
  border-bottom: none;
}
/* Gold accent line under the logo/header (matches the panel top stripe). */
.page-nav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, rgba(201,168,76,.35) 55%, transparent 100%);
}
/* On the tool-page header panels the gold accent lives under the logo (the
   .page-nav::after line above), so drop the panel's own top stripe to avoid a
   duplicate line at the top. Targeted by the page wrapper's modifier class so
   this works in every browser (a :has() selector is silently dropped by
   browsers that do not support it, which left the top stripe showing). */
.panel.csv-panel::before,
.panel.settings-panel::before { display: none; }

/* Brand mark on sub-pages */
.page-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-brand-mark {
  width: auto;
  height: 33px;
  flex-shrink: 0;
}

/* Tool-page title in the header, styled to match the "labster" wordmark of the
   Slabster logo (Segoe UI Heavy Italic, gold) and sized to the logo mark. */
.page-title {
  margin: 0;
  font-family: 'Segoe UI', system-ui, '-apple-system', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
  font-weight: 900;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--gold);
}

.page-brand-name {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--text);
  font-style: italic;
}

.page-brand-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-top: -1px;
}

.page-nav-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  transition: color .15s;
}
.back:hover { color: var(--text); }

.settings-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .02em;
  transition: border-color .15s, color .15s;
}
.settings-link:hover { border-color: var(--gold); color: var(--text); }

/* ── Brand block (inside tool pages) ────────────────────────────────────── */

.brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand h1 { font-size: 22px; margin: 0 0 3px; }

/* ── Section labels ──────────────────────────────────────────────────────── */

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}
/* Left bar accent */
.section-label::before {
  content: "";
  display: block;
  width: 3px;
  height: 13px;
  background: var(--gold);
  border-radius: 1px;
  flex-shrink: 0;
}
/* Extending line to the right */
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.tool-section { margin-top: 28px; }

/* ── Forms & inputs ──────────────────────────────────────────────────────── */

.form-grid        { display: grid; gap: 14px; }
.form-grid + .form-grid { margin-top: 14px; }
.form-grid.two    { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three  { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.four   { grid-template-columns: repeat(4, minmax(0,1fr)); }
.online-grid      { grid-template-columns: 1fr 120px auto; align-items: end; }
.browse-grid      { grid-template-columns: 1fr 120px 1fr auto; align-items: end; }
.cache-load-box   { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; align-items: end; }
.pdf-grid         { grid-template-columns: 1fr auto; align-items: end; }
.span-2           { grid-column: span 2; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

select, input, textarea {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,.1);
}

textarea { min-height: 80px; resize: vertical; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button {
  border: 0;
  border-radius: var(--r);
  padding: 11px 18px;
  color: #0a0c10;
  background: linear-gradient(180deg, #d4b04a 0%, #a87e28 100%);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  text-transform: uppercase;
  transition: filter .15s, transform .1s;
}

button:hover  { filter: brightness(1.1); }
button:active { transform: translateY(1px); }

button.secondary {
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--muted);
}
button.secondary:hover { border-color: var(--gold); color: var(--text); }

button:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }

.admin-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
}
.admin-icon-btn svg { pointer-events: none; }
.admin-icon-btn.is-spinning svg { animation: admin-icon-spin .6s linear; }

@keyframes admin-icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-secondary {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--r);
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.btn-secondary:hover { border-color: var(--gold); color: var(--text); }
/* "Choose CSV File" sits beside the "Download CSV Template" button, so match
   that button's type (13px / 900 / .04em) instead of the smaller default. */
.btn-secondary.csv-file-btn { font-size: 13px; font-weight: 900; letter-spacing: .04em; }

/* ── Misc boxes ──────────────────────────────────────────────────────────── */

.upload-row, .import-box {
  display: grid; gap: 10px; margin-top: 18px;
}
.import-box { grid-template-columns: 1fr auto; align-items: end; }
.upload-row.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.filebox {
  padding: 12px;
  border: 1px dashed var(--line2);
  border-radius: var(--r);
  background: var(--gold-glow);
}

.actions {
  display: grid; grid-template-columns: 1fr;
  gap: 10px; margin-top: 18px;
}
.actions.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.row-actions { display: flex; flex-wrap: wrap; }

.cover-settings {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.color-grid input[type="color"] {
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

.cover-setting-actions {
  margin-top: 12px;
  gap: 10px;
}

.cover-library-status a {
  color: var(--gold);
  font-weight: 700;
}

/* notices */
.notice, .online-box {
  background: var(--gold-faint);
  border: 1px solid rgba(201,168,76,.35);
  color: #e8d48a;
  padding: 12px 15px;
  border-radius: var(--r);
  margin-bottom: 18px;
}

.online-box {
  background: var(--blue-faint);
  border-color: rgba(58,125,196,.35);
  color: var(--text);
  margin-top: 16px;
}
.online-box p { margin-bottom: 10px; }

.ebay-publish-box { margin-bottom: 14px; }
.ebay-publish-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.ebay-publish-row button { flex-shrink: 0; align-self: center; }

.small-status {
  color: var(--muted);
  margin-top: 10px;
  font-size: 13px;
}
.field-hint {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
}

/* ── Runtime health (ops) ─────────────────────────────────────── */
.ops-grid {
  display: grid;
  grid-template-columns: minmax(190px, 240px) 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}
.system-stats-grid {
  grid-template-columns: minmax(360px, max-content) minmax(240px, 320px);
}
.system-stats-grid .ops-metric dt {
  min-width: 0;
}
.system-stats-grid .ops-metric dd {
  white-space: nowrap;
}
@media (max-width: 900px) {
  .system-stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .ops-grid { grid-template-columns: 1fr; }
}
.ops-panel {
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--panel2, var(--panel));
  padding: 14px 16px;
}
.ops-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.ops-metrics { margin: 0; }
.ops-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line2);
}
.ops-metric:last-child { border-bottom: none; }
.ops-metric dt { color: var(--muted); font-size: 13px; margin: 0; }
.ops-metric dd {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  margin: 0;
}
.ops-workers {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ops-worker {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
}
.ops-worker-pill {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  margin-top: 1px;
}
.ops-worker-pill.ok { background: rgba(92,184,92,.15); color: #7bd88f; border: 1px solid rgba(92,184,92,.4); }
.ops-worker-pill.stale { background: rgba(224,151,58,.15); color: #e0a95a; border: 1px solid rgba(224,151,58,.45); }
.ops-worker-id { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text); word-break: break-all; }
.ops-worker-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ops-empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }
.ebay-err-code { opacity: .5; font-size: 11px; }
.small-status.status-error {
  color: #ff9090;
  background: rgba(192,57,43,.12);
  border: 1px solid rgba(192,57,43,.35);
  border-radius: var(--r);
  padding: 8px 10px;
}
.small-status.status-warning {
  color: #e0b070;
  background: rgba(191,134,43,.12);
  border: 1px solid rgba(191,134,43,.35);
  border-radius: var(--r);
  padding: 8px 10px;
}

/* ── CSV import errors ────────────────────────────────────────────────────── */
.csv-import-errors {
  color: #ff9090;
  background: rgba(192,57,43,.12);
  border: 1px solid rgba(192,57,43,.35);
  border-radius: var(--r);
  padding: 8px 10px 8px 24px;
  margin: 8px 0 0;
  font-size: 13px;
}
.csv-import-errors li { margin: 2px 0; }

/* ── Publish progress ────────────────────────────────────────────────────── */
.publish-progress { display:flex; flex-direction:column; gap:6px; }
.publish-progress-row { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.publish-step { font-size:13px; color:var(--text); }
.publish-elapsed { font-size:11px; color:var(--muted); white-space:nowrap; }
.publish-bar-wrap { height:6px; background:rgba(255,255,255,.08); border-radius:var(--r); overflow:hidden; }
.publish-bar { height:100%; width:0%; background:var(--gold); border-radius:var(--r); transition:width .3s ease; }
.publish-done { color:#6ddc8b; font-size:13px; }
.publish-done a { color:#7ab4db; }
.publish-fail { color:#ff9090; font-size:13px; }

/* ── Canvas / cover preview ──────────────────────────────────────────────── */

.preview-wrap {
  display: grid; place-items: center;
  padding: 24px; overflow: auto;
}

canvas {
  width: min(100%, 760px);
  aspect-ratio: 1;
  background: black;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  box-shadow: 0 16px 50px rgba(0,0,0,.55);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow: auto;
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: var(--panel2);
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
}

th {
  position: sticky; top: 0;
  background: #0b1725;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line2);
}

td input[type="number"] { max-width: 110px; }
td input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); }
td input.sku { max-width: 90px; font-size: 13px; }

/* ── Listings management table ───────────────────────────────────────────── */

.listings-table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); }

.listings-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--panel2);
  font-size: 13px;
}
.listings-table thead th {
  position: static;
  background: #0b1725;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line2);
  white-space: nowrap;
}
.listings-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.listings-table tbody tr.listing-row:hover { background: rgba(58,125,196,.05); }
.listings-table tbody tr.listing-row.is-expanded { background: rgba(58,125,196,.05); }
.listings-table tbody tr.listing-row.is-expanded > td { border-bottom-color: transparent; }

/* column sizing / alignment */
.listings-table .col-select { width: 34px; text-align: center; }
.listings-table .col-status { white-space: nowrap; }
.listings-table .col-qty { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.listings-table th.col-qty { text-align: right; }
.listings-table .col-sync { color: var(--muted); font-size: 12px; white-space: nowrap; }
.listings-table .col-lister { color: var(--muted); font-size: 12px; white-space: nowrap; }
.listings-table .col-link { white-space: nowrap; }
.listings-table .col-actions { text-align: right; white-space: nowrap; }

.title-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.listing-title-text {
  display: block; min-width: 0; max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; color: var(--text);
}

/* expander chevron */
.listing-expand-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r);
  color: var(--muted); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 400;
  transition: color .15s, border-color .15s, background .15s;
}
.listing-expand-btn:hover { color: var(--text); border-color: var(--gold); background: var(--panel2); }
.listing-expand-btn svg { transition: transform .18s ease; }
.listing-expand-btn.is-open { color: var(--gold); border-color: var(--gold); }
.listing-expand-btn.is-open svg { transform: rotate(180deg); }
.listing-expand-spacer { display: inline-block; width: 24px; flex-shrink: 0; }

/* status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: var(--r-pill); text-transform: capitalize;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active   { color: var(--green); background: rgba(62,168,106,.13); }
.status-ended    { color: #d98a6a;      background: rgba(192,57,43,.14); }
.status-archived,
.status-unknown  { color: var(--muted); background: rgba(122,147,174,.12); }

/* eBay link */
.listing-link { color: var(--blue); font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.listing-link:hover { text-decoration: underline; }

/* row action buttons — consistent size, wrap-safe */
.row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.listings-table .row-actions .secondary,
.listings-table .row-actions a.secondary {
  font-size: 11px; font-weight: 700; padding: 5px 10px;
  letter-spacing: .03em; text-transform: uppercase; line-height: 1;
  border-radius: var(--r); text-decoration: none; white-space: nowrap;
}
.row-status { display: inline-block; font-size: 11px; margin-right: 6px; }
.row-status:empty { display: none; }

/* ── Inline editor panel ─────────────────────────────────────────────────── */

.listing-editor-row > td { padding: 0 14px 16px; background: transparent; border-bottom: 1px solid var(--line); }
.listing-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 22px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: var(--r);
}
@media (max-width: 820px) { .listing-editor { grid-template-columns: 1fr; gap: 18px; } }

.editor-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.editor-heading {
  margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--gold);
}

.variation-list { display: flex; flex-direction: column; gap: 10px; }
.variation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto minmax(56px, auto);
  align-items: end; gap: 10px;
}
@media (max-width: 560px) {
  .variation-row { grid-template-columns: 1fr 1fr; }
  .variation-row .variation-name { grid-column: 1 / -1; }
  .variation-row .save-variation-btn { grid-column: 1 / -1; }
}
.variation-name {
  align-self: center;
  font-size: 13px; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.field-input {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-faint);
}
.field-input.sku-qty-input   { width: 74px; text-align: right; font-variant-numeric: tabular-nums; }
.field-input.sku-price-input { width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.editor-col--details .field-input { width: 100%; }
.editor-col--details textarea.field-input { resize: vertical; min-height: 96px; line-height: 1.5; }

.save-variation-btn.secondary {
  align-self: end; height: 34px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 0 14px; border-radius: var(--r); white-space: nowrap;
}
.editor-actions { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.save-details-btn.secondary {
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 8px 14px; border-radius: var(--r);
}

.variation-status, .details-status {
  align-self: center;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.variation-status.status-ok, .details-status.status-ok { color: var(--green); }
.variation-status.status-error, .details-status.status-error { color: #e0806a; }

.editor-empty { margin: 0; font-size: 12px; color: var(--muted); }

/* ── Cover-photo editor (inline listing editor) ──────────────────────────── */
.cover-edit { display: flex; gap: 14px; align-items: flex-start; }
.cover-thumb {
  flex: 0 0 auto;
  width: 84px; height: 84px;
  border: 1px solid var(--line2); border-radius: var(--r);
  background: var(--panel2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-thumb-empty { font-size: 11px; color: var(--muted); }
.cover-edit-controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cover-file-btn.secondary,
.save-cover-btn.secondary {
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 8px 14px; border-radius: var(--r); white-space: nowrap; cursor: pointer;
}
.save-cover-btn.secondary:disabled { opacity: .5; cursor: default; }
.cover-status { font-size: 12px; color: var(--muted); }
.cover-status.status-ok { color: var(--green); }
.cover-status.status-error { color: #e0806a; }

/* ── Manage Listings: basic portfolio stats strip ────────────────────────── */
.listings-basic-stats { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; }
.listings-basic-stats:empty { display: none; }
.listings-basic-stats .lstat { display: flex; flex-direction: column; }
.listings-basic-stats .lstat-v { font-size: 20px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.listings-basic-stats .lstat-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 2px; }
.listings-basic-stats .lstat-link { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--gold); text-decoration: none; white-space: nowrap; }
.listings-basic-stats .lstat-link:hover { text-decoration: underline; }

/* ── Toolbar / SKU bar ───────────────────────────────────────────────────── */

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 10px;
  margin: 18px 0 10px;
}

.sku-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 6px; flex-wrap: wrap;
}
.sku-bar label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .03em;
}
.sku-bar label input { width: 110px; padding: 8px 10px; font-size: 13px; }

.count-line { color: var(--muted); margin: 0 0 10px; font-size: 13px; }

/* ── Variation panel ─────────────────────────────────────────────────────── */

.variation-panel {
  margin-top: 14px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: rgba(5,7,10,.4);
  padding: 12px;
}
.variation-panel.hidden { display: none; }

.variation-head {
  display: flex; justify-content: space-between; gap: 10px;
  color: var(--text); margin-bottom: 10px;
}
.variation-head span { color: var(--muted); font-size: 12px; }

.variation-list {
  display: grid; gap: 8px;
  max-height: 260px; overflow: auto; padding-right: 4px;
}

.variation-choice {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px; align-items: start;
  border: 1px solid var(--line);
  background: rgba(9,16,26,.8);
  border-radius: var(--r);
  padding: 10px;
  color: var(--text);
}
.variation-choice input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--gold); }
.variation-choice small { display: block; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

.variation-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ── Advanced / details collapsibles ─────────────────────────────────────── */

.advanced {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  background: rgba(5,7,10,.25);
}
.advanced summary {
  cursor: pointer;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Code & misc ──────────────────────────────────────────────────────────── */

code {
  background: rgba(255,255,255,.07);
  border-radius: var(--r);
  padding: 2px 6px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: #a5c0d8;
}

.ebay-ok { color: #6dd98a; font-weight: 700; margin-bottom: 14px; }

/* ── Paste import ─────────────────────────────────────────────────────────── */

.paste-box { margin-top: 14px; }

.paste-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px; align-items: start;
}

.paste-layout textarea {
  width: 100%; min-height: 160px; resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 13px; line-height: 1.6;
}

.paste-formats {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
}
.paste-formats strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.paste-formats p { font-size: 12px; margin-bottom: 8px; }

.format-example { margin: 4px 0; }
.format-example code { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }

/* ── Preview table ────────────────────────────────────────────────────────── */

.preview-tbl {
  width: 100%; border-collapse: collapse;
  background: var(--panel2);
  border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line);
}
.preview-tbl th, .preview-tbl td {
  padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--line); font-size: 12px;
}
.preview-tbl th {
  background: #0b1725; font-size: 12px; letter-spacing: .05em; color: var(--muted); text-transform: uppercase;
}
.preview-tbl td input { width: 100%; padding: 5px 7px; font-size: 14px; border-radius: var(--r); }
.preview-tbl td:first-child { width: 90px; }
.preview-tbl td:last-child  { width: 80px; }
.pv-remove { padding: 5px 9px; font-size: 11px; }

/* ── Settings page ─────────────────────────────────────────────────────────── */

.settings-panel { padding: 24px; max-width: 1100px; margin: 0 auto; }

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid var(--line);
}

.settings-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  border-radius: 0 3px 3px 0;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.settings-nav a svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  opacity: .7;
  transition: opacity .15s ease;
}

.settings-nav a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.settings-nav a:hover svg { opacity: 1; }

.settings-nav a.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--gold-faint);
}

.settings-nav a.active svg { opacity: 1; }

.settings-content { min-width: 0; }
.settings-content .settings-section:first-child { margin-top: 0; }

@media (max-width: 760px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    border-left: none;
    margin-bottom: 8px;
  }
  .settings-nav a {
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-left: 0;
  }
  .settings-nav a.active { border-color: var(--gold); }
}

.settings-section {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(5,7,10,.2);
  border-left: 3px solid var(--line2);
  scroll-margin-top: 20px;
}

.settings-section h2 {
  margin: 0 0 16px; font-size: 14px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text);
}

.settings-save-row {
  display: flex; align-items: center; gap: 14px; margin-top: 16px;
}

.settings-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: none;
  color: var(--muted); margin-top: 14px;
}
.settings-toggle input[type="checkbox"] {
  width: 16px; height: 16px; flex: none; accent-color: var(--gold);
}

/* Backups */
.backup-options {
  display: flex; flex-direction: column; gap: 10px; margin-top: 14px;
}
.backup-option {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--panel2, var(--panel));
  padding: 12px 14px;
  cursor: pointer;
}
.backup-option input[type="checkbox"] {
  width: 16px; height: 16px; flex: none; margin-top: 2px; accent-color: var(--gold);
}
.backup-option span { display: flex; flex-direction: column; gap: 3px; }
.backup-option strong { font-size: 13px; font-weight: 700; }
.backup-option small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.backup-suboption { margin-left: 28px; }
.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.backup-actions .backup-danger { color: #e06c75; }
.backup-contents { font-size: 12px; color: var(--muted); line-height: 1.5; }
.backup-contents strong { color: var(--text, inherit); font-weight: 600; }

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.usage-card {
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 12px 14px 14px;
  background:
    linear-gradient(180deg, rgba(58,125,196,.08) 0%, rgba(5,7,10,.06) 100%),
    var(--panel2);
  min-height: 154px;
}

.usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.usage-head strong {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0;
}

.usage-gauge {
  --usage: 0;
  --usage-deg: 0deg;
  --needle-rotation: -90deg;
  position: relative;
  width: min(150px, 100%);
  aspect-ratio: 2 / 1;
  margin: 16px auto 8px;
  overflow: hidden;
  border-radius: 150px 150px 0 0;
  background:
    radial-gradient(circle at 50% 100%, var(--panel2) 0 34%, transparent 35%),
    conic-gradient(from 270deg at 50% 100%,
      var(--green) 0deg,
      var(--gold) var(--usage-deg),
      rgba(122,147,174,.22) var(--usage-deg),
      rgba(122,147,174,.22) 180deg,
      transparent 180deg);
  border: 1px solid rgba(37,54,72,.8);
  border-bottom: none;
  box-shadow: inset 0 0 18px rgba(0,0,0,.34);
}

.usage-gauge::after {
  content: "";
  position: absolute;
  inset: 12px 12px 0;
  border-radius: 120px 120px 0 0;
  border: 1px solid rgba(255,255,255,.04);
  border-bottom: none;
}

.usage-needle {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 2px;
  height: 68%;
  background: linear-gradient(180deg, var(--text), var(--gold));
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--needle-rotation));
  border-radius: var(--r-pill);
  box-shadow: 0 0 10px rgba(201,168,76,.32);
}

.usage-hub {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 18px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(201,168,76,.13), 0 0 16px rgba(201,168,76,.3);
}

.usage-value {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.usage-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.usage-card.usage-warm .usage-head strong { color: #e0c96a; }
.usage-card.usage-hot .usage-head strong { color: #e57373; }
.usage-card.usage-hot .usage-gauge {
  background:
    radial-gradient(circle at 50% 100%, var(--panel2) 0 34%, transparent 35%),
    conic-gradient(from 270deg at 50% 100%,
      var(--green) 0deg,
      var(--gold) 112deg,
      #e57373 var(--usage-deg),
      rgba(122,147,174,.22) var(--usage-deg),
      rgba(122,147,174,.22) 180deg,
      transparent 180deg);
}

.usage-card.usage-unlimited .usage-gauge {
  background:
    radial-gradient(circle at 50% 100%, var(--panel2) 0 34%, transparent 35%),
    conic-gradient(from 270deg at 50% 100%, var(--blue) 0deg, var(--green) 180deg, transparent 180deg);
}

@media (max-width: 900px) {
  .usage-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .usage-grid { grid-template-columns: 1fr; }
}

/* Admin enterprise console */
.admin-app {
  padding: 16px;
}

.admin-console {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  max-width: 1480px;
  min-height: calc(100vh - 32px);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.admin-console::before {
  grid-column: 1 / -1;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(9,16,26,.82);
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* The admin brand now uses the full S-card lockup (wordmark baked in), so it
   needs a touch more height than the bare glyph mark to stay legible. */
.admin-sidebar-logo { height: 40px; }

.admin-sidebar-wordmark {
  font-family: 'Segoe UI', system-ui, '-apple-system', 'Helvetica Neue', Arial, sans-serif;
  font-size: 25px;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  color: var(--gold);
  white-space: nowrap;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav-label {
  margin: 0 8px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 800;
}

.admin-nav-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: .75;
}

.admin-nav-item:hover svg,
.admin-nav-item.active svg {
  opacity: 1;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  border-color: var(--line2);
  background: rgba(201,168,76,.08);
  color: var(--text);
  filter: none;
}

.admin-main {
  min-width: 0;
  padding: 22px;
  overflow: auto;
}

.admin-topbar {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#adminGlobalSearch {
  width: 230px;
  padding: 8px 10px;
  font-size: 13px;
}

.admin-env-pill,
.admin-identity {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--panel2);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.admin-signout {
  min-height: 32px;
  padding: 7px 12px;
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: block;
}

.admin-view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-view-head h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.admin-section-copy {
  margin-bottom: 16px;
  font-size: 13px;
}

/* Card catalog inventory tiles */
.catalog-inventory-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.catalog-stat {
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 12px 14px;
  min-width: 0;
}
.catalog-stat .num {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
}
.catalog-stat .lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 3px;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-kpi {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 118px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  background: rgba(5,7,10,.25);
  color: var(--text);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.admin-kpi:hover {
  border-color: var(--gold);
  filter: none;
}

.admin-kpi span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-kpi strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.admin-kpi small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.admin-workflow-block {
  margin-top: 8px;
}

.admin-workflow-block h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.admin-workflow-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-workflow-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 118px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  background: rgba(5,7,10,.25);
  color: var(--text);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.admin-workflow-tile:hover {
  border-color: var(--gold);
  filter: none;
}

.admin-workflow-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--gold);
}

.admin-workflow-icon svg {
  width: 100%;
  height: 100%;
}

.admin-workflow-label {
  font-size: 13px;
  line-height: 1.35;
}

.admin-jump {
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.admin-panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-panel-tabs button {
  min-height: 36px;
  padding: 8px 12px;
  border-color: var(--line2);
  background: var(--panel2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-panel-tabs button.active {
  border-color: var(--gold);
  color: var(--text);
  background: rgba(201,168,76,.12);
}

.catalog-panel-view {
  display: none;
}

.catalog-panel-view.active {
  display: block;
}

/* In-page quick-jump tiles: same tile look as Primary Workflows, but sized
   to however many sub-sections a page actually has instead of a fixed
   4-column grid, and used to smooth-scroll within the current view/page
   rather than switching admin views. */
.quickjump-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.quickjump-tiles .admin-workflow-icon {
  width: 26px;
  height: 26px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-toolbar.align-end {
  align-items: end;
}

.admin-toolbar input,
.admin-toolbar select {
  width: auto;
  min-width: 150px;
  padding: 7px 10px;
  font-size: 13px;
}

.admin-toolbar label {
  min-width: 120px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel2);
}

.admin-table-wrap table {
  min-width: 760px;
  font-size: 12px;
}

.admin-inline-panel {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line2);
  border-radius: var(--r);
  background: var(--panel2);
}

.admin-inline-panel h3,
.settings-section h3 {
  margin: 20px 0 10px;
  color: var(--text);
  font-size: 14px;
}

.admin-inline-panel h3:first-child,
.settings-section h3:first-child {
  margin-top: 0;
}

/* Divider between each service block (Anthropic / Atlas / PSA / eBay) on the
   admin Services page — a rule above each subsection heading keeps them
   visually distinct without extra markup. */
#aiProvidersSection h3 {
  border-top: 1px solid var(--line2);
  margin-top: 26px;
  padding-top: 24px;
}

.admin-reset-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto minmax(120px, auto);
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.admin-catalog-grid {
  display: grid;
  gap: 16px;
}

.admin-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}

.admin-subhead h3 {
  margin: 0;
}

.admin-load-row {
  margin-top: 14px;
}

.pw-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.pw-wrap input {
  min-width: 0;
}

.pw-eye {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--line2);
  font-size: 11px;
}

/* Help box (collapsible) */
.help-box {
  background: var(--blue-faint);
  border: 1px solid rgba(58,125,196,.35);
  border-radius: var(--r);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #a8c8e8;
}
.help-box summary {
  cursor: pointer; font-weight: 700; color: #7ab4db;
  user-select: none; list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.help-box summary::before { content: "▶"; font-size: 9px; transition: transform .15s; }
.help-box[open] summary::before { transform: rotate(90deg); }
.help-box ol { margin: 10px 0 0 18px; padding: 0; line-height: 1.8; }
.help-box li { margin-bottom: 2px; }
.help-box a  { color: #7ab4db; }
.help-box code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: var(--r); font-size: 11px; }
.help-box p { margin: 0; color: var(--muted); font-size: 13px; }

/* ── Cover photo ─────────────────────────────────────────────────────────── */

.cover-photo-row {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap;
}

.cover-photo-zone {
  width: 120px; height: 80px;
  border: 2px dashed var(--line2);
  border-radius: var(--r);
  background: var(--gold-glow);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; overflow: hidden;
  transition: border-color .15s;
}
.cover-photo-zone:hover { border-color: var(--gold); }

#coverPhotoThumb { width: 100%; height: 100%; object-fit: cover; }

#coverPhotoHint {
  font-size: 10px; color: var(--muted);
  text-align: center; padding: 4px;
}

/* Per-card photo cell */
.card-photo-btn {
  width: 44px; height: 44px;
  border: 1px dashed var(--line2);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; transition: border-color .15s;
}
.card-photo-btn:hover { border-color: var(--gold); }
.card-photo-thumb { width: 100%; height: 100%; object-fit: cover; }
.photo-add-icon { font-size: 18px; line-height: 1; }

/* ── Bulk photo modal ─────────────────────────────────────────────────────── */

.photo-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.photo-modal.hidden { display: none !important; }

.photo-modal-inner {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  width: 100%; max-width: 860px;
  max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 0 0 5px #07090d, 0 0 0 6px #1a2a3e, 0 24px 60px rgba(0,0,0,.8);
}

.photo-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.photo-modal-header h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }

.photo-pool-section { border-bottom: 1px solid var(--line); background: rgba(0,0,0,.3); flex-shrink: 0; }

.photo-pool-label {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 8px 20px 4px;
}

.photo-pool {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 20px 12px; min-height: 76px;
  align-items: center; transition: background .15s;
}
.photo-pool.pool-dragover { background: rgba(201,168,76,.08); }

.pool-thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: var(--r); cursor: grab;
  border: 2px solid transparent;
  transition: border-color .15s, opacity .15s; flex-shrink: 0;
}
.pool-thumb:hover { border-color: var(--gold); }
.pool-thumb[data-dragging] { opacity: .35; }

.photo-pool-add {
  width: 56px; height: 56px;
  border: 2px dashed var(--line2);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 26px; color: var(--line2);
  flex-shrink: 0; transition: border-color .15s, color .15s; user-select: none;
}
.photo-pool-add:hover { border-color: var(--gold); color: var(--gold); }

.photo-slots-wrap { overflow-y: auto; flex: 1; }

.photo-slots-table { width: 100%; border-collapse: collapse; }
.photo-slots-table th {
  background: #090f18; padding: 8px 20px;
  text-align: left; font-size: 10px; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
  position: sticky; top: 0; z-index: 1;
}
.photo-slots-table th.slot-col { width: 80px; text-align: center; }
.photo-slots-table td {
  padding: 8px 20px; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: 12px;
}
.photo-slots-table td:last-child { text-align: center; }

.slot-drop {
  width: 56px; height: 56px;
  border: 2px dashed var(--line2);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
  margin: 0 auto; overflow: hidden;
}
.slot-drop.drag-over { border-color: var(--gold); background: var(--gold-glow); }
.slot-drop .slot-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-inner); cursor: grab; border: none; }
.slot-drop .slot-hint { font-size: 20px; color: var(--line2); }

.photo-modal-footer {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0; flex-wrap: wrap;
}

/* ── AI Listing Builder ───────────────────────────────────────────────────── */

.ai-drop-zone {
  border: 2px dashed var(--line2);
  border-radius: var(--r);
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--gold-glow);
}
.ai-drop-zone.drag-over {
  border-color: var(--gold);
  background: var(--gold-faint);
}
.ai-drop-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ai-drop-icon  { font-size: 40px; }
.ai-drop-inner p { margin: 0; font-size: 13px; }
.ai-drop-note  { font-size: 13px !important; color: var(--muted) !important; }
.ai-browse-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.ai-photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* Unmatched-backs tray: backs the pairing couldn't attach to a front. */
.unmatched-backs-tray {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(224, 108, 117, .5);
  border-radius: var(--r);
  background: rgba(224, 108, 117, .07);
}
.unmatched-backs-tray.drag-over {
  border-color: var(--gold);
  background: var(--gold-glow);
}
.unmatched-backs-head { font-size: 12px; color: var(--text); margin-bottom: 10px; line-height: 1.5; }
.unmatched-backs-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.unmatched-back {
  width: 96px; display: flex; flex-direction: column; gap: 4px;
  cursor: grab;
}
.unmatched-back img {
  width: 96px; height: 128px; object-fit: cover; border-radius: var(--r-inner);
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.unmatched-back-name {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.unmatched-back-btns { display: flex; flex-direction: column; gap: 4px; }
.unmatched-back-btns button {
  background: var(--panel2); border: 1px solid var(--line2); color: var(--muted);
  border-radius: var(--r); font-size: 10px; font-weight: 700; padding: 4px 6px;
  cursor: pointer; text-transform: none; letter-spacing: 0;
}
.unmatched-back-btns button:hover { border-color: var(--gold); color: var(--text); }
.held-card-photos {
  display: flex;
  gap: 3px;
}
.held-card-photos img {
  width: 46px;
  height: 64px;
}

.ai-photo-thumb {
  position: relative;
  width: 90px; height: 90px;
  border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); background: var(--panel2);
}
.ai-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ai-thumb-badge {
  position: absolute; top: 4px; left: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.ai-thumb-badge.ok  { background: #1c3d28; color: #6dd98a; }
.ai-thumb-badge.err { background: #4a1a1a; color: #e06c75; }

.ai-thumb-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,.72); color: #fff;
  border: none; font-size: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1;
}
.ai-thumb-remove:hover { background: var(--red); }

.ai-table-thumb {
  width: 54px; height: 70px;
  object-fit: cover; border-radius: var(--r-inner);
  border: 1px solid var(--line); display: block;
  cursor: zoom-in;
}
.ai-row-drag {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: grab;
  font-size: 11px;
  line-height: 1;
  vertical-align: middle;
}
.ai-row-drag:hover { border-color: var(--gold); color: var(--text); }

.ai-lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.85);
  align-items: center; justify-content: center;
  padding: 40px; cursor: zoom-out;
}
.ai-lightbox.open { display: flex; }
.ai-lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--r);
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}

.ai-field {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  padding: 5px 7px;
  font-size: 12px;
  width: 100%; min-width: 80px;
}
.ai-field.ai-narrow { min-width: 56px; width: 80px; }
.ai-field:focus { outline: none; border-color: var(--gold); }

#aiCardTable th, #aiCardTable td { padding: 6px 8px; vertical-align: middle; }
#gradedCardTable th, #gradedCardTable td { padding: 6px 8px; vertical-align: middle; }
.graded-cards-wrap { margin-bottom: 18px; }
.ai-subtable-title {
  margin: 0 0 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gold);
}
.ai-subtable-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.ai-graded-row { background: rgba(201,168,76,.035); }

/* Listing type selector */
.ai-type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-type-option { display: flex; cursor: pointer; }
.ai-type-option input { display: none; }
.ai-type-card {
  flex: 1; padding: 14px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: rgba(5,7,10,.4);
  transition: border-color .15s, background .15s;
}
.ai-type-option input:checked + .ai-type-card {
  border-color: var(--gold);
  background: var(--gold-faint);
}
.ai-type-card strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.ai-type-card p { margin: 0; font-size: 12px; color: var(--muted); }

/* Cover / fields layout */
.ai-listing-layout {
  display: grid; grid-template-columns: 320px 1fr;
  gap: 24px; align-items: start;
}
.ai-cover-col { display: flex; flex-direction: column; }
.ai-cover-label {
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px; color: var(--muted);
}
#aiCoverCanvas {
  width: 100%; height: auto;
  border-radius: var(--r);
  border: 1px solid var(--line2); display: block;
}
.ai-cover-canvas-wrap { position: relative; }
.ai-cover-slot {
  position: absolute;
  border: 2px dashed transparent;
  border-radius: var(--r);
}
.ai-cover-slot[data-slot="0"] { left: 7.5%;  top: 32.5%; width: 25%; height: 38.75%; }
.ai-cover-slot[data-slot="1"] { left: 37.5%; top: 32.5%; width: 25%; height: 38.75%; }
.ai-cover-slot[data-slot="2"] { left: 67.5%; top: 32.5%; width: 25%; height: 38.75%; }
.ai-cover-slot.drag-over { border-color: var(--gold); background: rgba(201,168,76,.15); }
.ai-table-thumb[draggable="true"] { cursor: grab; }
.ai-fields-col { display: flex; flex-direction: column; gap: 0; }
.ai-label-block {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 14px;
}
.ai-label-block input,
.ai-label-block textarea {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  border-radius: var(--r); color: var(--text);
  padding: 9px 11px; font-size: 13px;
  font-family: inherit; resize: vertical;
  text-transform: none; letter-spacing: 0; font-weight: 400;
}
.ai-label-block input:focus,
.ai-label-block textarea:focus { outline: none; border-color: var(--gold); }
.ai-char-count { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: auto; }

/* Individual card blocks */
.ind-card-block {
  display: grid; grid-template-columns: 110px 1fr;
  gap: 16px; padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 10px;
  background: rgba(5,7,10,.25);
  border-left: 3px solid var(--line2);
}
.ind-card-photo img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; border-radius: var(--r-inner);
  border: 1px solid var(--line); display: block;
}
.ind-card-info { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; line-height: 1.4; }
.ind-card-fields { display: flex; flex-direction: column; gap: 8px; }
.ind-card-status { font-size: 12px; margin-top: 4px; }
.ind-status-ok  { color: #6dd98a; }
.ind-status-err { color: #e06c75; }
.ind-photos { display: flex; gap: 6px; }
/* Share the fixed photo column between front and back so a back image can't
   overflow the column and overlap the title/description. flex + min-width:0 lets
   two thumbs shrink to fit (~52px each); a lone thumb still caps at 80px. */
.ind-photos img {
  flex: 1 1 0; min-width: 0; max-width: 80px; aspect-ratio: 3/4;
  object-fit: cover; border-radius: var(--r-inner);
  border: 1px solid var(--line); display: block;
}

/* Front/back pairs toggle */
.ai-pairs-toggle {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--r);
  background: var(--blue-faint);
  font-size: 12px; color: var(--muted);
  line-height: 1.5; cursor: pointer;
}
.ai-pairs-toggle input { width: auto; margin-top: 3px; flex-shrink: 0; accent-color: var(--gold); }
.ai-pairs-toggle strong { color: var(--text); }
.ai-pairs-toggle code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: var(--r); font-size: 11px; }

/* Static front/back pairs explainer (the opt-in checkbox was removed — pairing
   is always on for singles), so this is the same callout minus the control. */
.ai-pairs-note {
  padding: 10px 14px; margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--r);
  background: var(--blue-faint);
  font-size: 14px; color: var(--muted); line-height: 1.5;
}
.ai-pairs-note strong { color: var(--text); }

.ai-pair-tag {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(58,125,196,.9);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: var(--r-inner);
}

.ai-photo-cell { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.ai-card-photo-drop {
  min-width: 64px;
  padding: 3px;
  border: 1px dashed transparent;
  border-radius: var(--r);
}
.ai-card-photo-drop.drag-over,
tr.ai-card-row.drag-over {
  border-color: var(--gold);
  background: rgba(201,168,76,.12);
}
.ai-back-drop-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}
.ai-rotate-btn {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(0,0,0,.62);
  color: var(--text);
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  padding: 3px 4px;
}
.ai-fb .ai-rotate-btn {
  position: absolute;
  right: 2px;
  bottom: 2px;
}
.ai-photo-cell > .ai-rotate-btn {
  width: 54px;
}
.ai-rotate-btn:hover { border-color: var(--gold); }
.ai-fb-pair { display: flex; gap: 6px; }
.ai-fb { position: relative; }
.ai-fb-lbl {
  position: absolute; top: 2px; left: 2px;
  background: rgba(0,0,0,.7); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 0 4px; border-radius: var(--r-inner);
}
.ai-swap-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--muted); border-radius: var(--r);
  font-size: 11px; padding: 3px 8px; cursor: pointer;
}
.ai-swap-btn:hover { background: rgba(255,255,255,.1); color: var(--text); }
.ai-row-busy { opacity: .45; }

/* Match cell */
.ai-match-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 96px; }
.ai-match-top  { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ai-match-btns { display: flex; gap: 4px; }

/* Confidence badges */
.conf {
  font-size: 9px; font-weight: 900;
  text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--r-inner);
  letter-spacing: .4px;
}
.conf-high   { background: #0f2e1a; color: #6dd98a; border: 1px solid rgba(109,217,138,.25); }
.conf-medium { background: #2e2412; color: var(--gold); border: 1px solid rgba(201,168,76,.25); }
.conf-low    { background: #2e1010; color: #e06c75; border: 1px solid rgba(224,108,117,.25); }

/* Candidate switcher */
.ai-switch {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  color: var(--text); border-radius: var(--r);
  font-size: 11px; padding: 3px 5px;
  max-width: 130px;
}
.ai-switch:focus { outline: none; border-color: var(--gold); }
/* The control's translucent background does not carry into the native open
   option list, so give the options a solid dark background and light text —
   otherwise the dropdown renders near-invisible (dark text on a light popup). */
.ai-switch option { background-color: var(--panel); color: var(--text); }

/* Detail toggle button */
.ai-detail-toggle {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--muted); border-radius: var(--r);
  font-size: 13px; line-height: 1;
  padding: 2px 8px; cursor: pointer;
}
.ai-detail-toggle:hover { background: rgba(255,255,255,.1); color: var(--text); }
.ai-detail-toggle.open  { background: var(--gold-faint); border-color: rgba(201,168,76,.4); color: var(--gold); }

.ai-detail-row > td { background: rgba(201,168,76,.04); border-left: 3px solid rgba(201,168,76,.2); }
.ai-detail-grid {
  display: flex; gap: 18px; flex-wrap: wrap; padding: 6px 8px;
}
.ai-detail-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.ai-detail-grid input,
.ai-detail-grid select {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); padding: 5px 8px;
  font-size: 12px; min-width: 160px;
  text-transform: none; letter-spacing: 0;
}
.ai-detail-grid input:focus,
.ai-detail-grid select:focus { outline: none; border-color: var(--gold); }

/* OCR fallback banner */
.ocr-fallback-banner {
  background: var(--gold-faint);
  border: 1px solid rgba(201,168,76,.35);
  color: #e8d48a;
  padding: 10px 14px;
  border-radius: var(--r);
  margin-top: 10px;
  font-size: 13px;
}

/* Pricing comparison panel (per-row, on-demand) */
.ai-pricing-panel { margin-top: 10px; padding: 0 8px; }
.ai-pricing-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--text); border-radius: var(--r);
  font-size: 12px; padding: 5px 10px; cursor: pointer;
}
.ai-pricing-btn:hover { border-color: var(--gold); }
.ai-pricing-results { margin-top: 8px; font-size: 12px; }
.ai-pricing-note { color: var(--muted); margin-bottom: 6px; font-size: 11px; }
.ai-pricing-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.ai-pricing-row:hover { color: var(--gold); }
.ai-pricing-row strong { white-space: nowrap; }
.ai-pricing-summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}
.ai-pricing-summary strong { color: var(--text); }
.ai-apply-price {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--text); border-radius: var(--r);
  font-size: 12px; padding: 4px 9px; cursor: pointer;
}
.ai-apply-price:hover { border-color: var(--gold); color: var(--gold); }

/* Policy picker (shipping/payment/return, real eBay policies) */
.policy-picker {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.policy-picker label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  flex: 1; min-width: 160px;
}
.policy-picker select {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); padding: 6px 8px;
  font-size: 12px; text-transform: none; letter-spacing: 0;
}
.policy-picker select:focus { outline: none; border-color: var(--gold); }

/* Re-identify button */
.ai-reid-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--muted); border-radius: var(--r);
  font-size: 13px; line-height: 1;
  padding: 2px 8px; cursor: pointer;
}
.ai-reid-btn:hover { background: var(--gold-faint); border-color: rgba(201,168,76,.4); color: var(--gold); }

/* Identification feedback (was this good/bad?) */
.ai-fb-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--muted); border-radius: var(--r);
  font-size: 13px; line-height: 1;
  padding: 2px 6px; cursor: pointer;
}
.ai-fb-btn:hover { background: rgba(255,255,255,.1); }
.ai-fb-btn[data-verdict="good"]:hover { border-color: rgba(90,180,110,.5); }
.ai-fb-btn[data-verdict="bad"]:hover  { border-color: rgba(200,90,90,.5); }
.ai-fb-status { font-size: 12px; color: var(--muted); align-self: center; }
.ai-fb-cell { white-space: nowrap; }
.ai-fb-cell .ai-fb-btn { margin-right: 2px; }

/* Duplicate badge */
.ai-dup {
  display: none; font-size: 9px; font-weight: 900;
  text-transform: uppercase; padding: 2px 6px;
  border-radius: var(--r-inner);
  background: #2e1a0a; color: #e0a64a;
  border: 1px solid rgba(224,166,74,.25);
}
.ai-dup.show { display: inline-block; }

/* Running totals */
.ai-summary-bar {
  display: flex; flex-wrap: wrap; gap: 18px;
  align-items: center; margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  background: var(--gold-glow);
  font-size: 12px; color: var(--muted);
}
.ai-summary-bar:empty { display: none; }
.ai-summary-bar strong { color: var(--text); font-weight: 700; }
.ai-summary-bar .ai-dup-note { color: #e0a64a; font-weight: 600; }

/* Topps PDF row */
.topps-pdf-row {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.topps-pdf-row > strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.topps-pdf-row p { margin-bottom: 10px; font-size: 12px; }

/* ── U-Pick: Choose Your Set ──────────────────────────────────────────────── */

.set-search-wrap { position: relative; max-width: 520px; }
.set-search-input {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  border-radius: var(--r); color: var(--text);
  padding: 10px 12px; font-size: 13px;
  font-family: inherit;
}
.set-search-input:focus { outline: none; border-color: var(--gold); }

.set-search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 5; max-height: 320px; overflow-y: auto;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: 0 16px 50px rgba(0,0,0,.55);
}

.set-result-row {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  padding: 9px 12px; cursor: pointer;
  font-size: 12px; color: var(--text);
  border-bottom: 1px solid var(--line);
}
.set-result-row:last-child { border-bottom: none; }
.set-result-row:hover { background: var(--gold-faint); }
.set-result-row .set-result-empty { color: var(--muted); cursor: default; }
.set-result-row .set-result-empty:hover { background: transparent; }
.set-result-row span { color: var(--muted); }
.set-result-row strong { color: var(--text); }

.chosen-set-header {
  margin-top: 14px; padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  background: var(--gold-glow);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.chosen-set-summary { font-size: 13px; color: var(--text); }
.change-set-link { font-size: 12px; color: #7ab4db; margin-left: 12px; }
.change-set-link:hover { text-decoration: underline; }

.missing-set-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 14px;
  margin-bottom: 16px;
}
.missing-set-fields label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}
.missing-set-fields input {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line2);
  border-radius: var(--r); color: var(--text);
  padding: 8px 10px; font-size: 13px;
  font-family: inherit; text-transform: none; letter-spacing: 0; font-weight: 400;
}
.missing-set-fields input:focus { outline: none; border-color: var(--gold); }

.unmatched-photo-tray {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

/* ── Password reveal ─────────────────────────────────────────────────────── */

.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input {
  padding-right: 38px;
}

.pw-eye {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 36px;
  background: none;
  border: none;
  border-radius: 0 3px 3px 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  padding: 0;
  line-height: 1;
  transition: color .15s;
  text-transform: none;
  letter-spacing: 0;
}

.pw-eye:hover { color: var(--text); background: none; filter: none; }

.admin-console .pw-wrap input {
  padding-right: 54px;
}

.admin-console .pw-eye {
  width: 52px;
  font-size: 11px;
  font-weight: 800;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 950px) {
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .controls { overflow-y: visible; }
  .tool-grid, .form-grid.four, .form-grid.three, .toolbar,
  .import-box, .online-grid, .browse-grid, .cache-load-box, .pdf-grid,
  .upload-row.three, .actions.three {
    grid-template-columns: 1fr;
  }
  .span-2 { grid-column: span 1; }
  .paste-layout { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .ebay-publish-row { flex-direction: column; }
  .page-nav { flex-wrap: wrap; gap: 8px; }
  .ai-listing-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .admin-console {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-nav-label {
    grid-column: 1 / -1;
  }

  .admin-topbar,
  .admin-kpi-grid,
  .admin-workflow-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .admin-app {
    padding: 10px;
  }

  .admin-main {
    padding: 16px;
  }

  .admin-nav,
  .admin-topbar,
  .admin-kpi-grid,
  .admin-workflow-tiles {
    grid-template-columns: 1fr;
  }

  .admin-view-head,
  .admin-subhead {
    display: grid;
  }

  .admin-toolbar input,
  .admin-toolbar select,
  #adminGlobalSearch {
    width: 100%;
  }

  .admin-reset-row {
    grid-template-columns: 1fr;
  }
}

/* Onboarding checklist steps — shared between onboarding.html (first-run
   flow) and settings.html's "Getting Started" section (so a user who
   skipped onboarding can come back and check progress later). */
.ob-steps { display: flex; flex-direction: column; gap: 12px; }
.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 18px 20px;
  transition: border-color .15s;
}
.ob-step.done  { border-color: rgba(76,175,129,.35); }
.ob-step.active { border-color: rgba(201,168,76,.45); }
.ob-step-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 700;
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--muted);
}
.ob-step.done  .ob-step-icon { background: rgba(76,175,129,.15); border-color: rgba(76,175,129,.4); color: #4caf81; }
.ob-step.active .ob-step-icon { background: rgba(201,168,76,.12); border-color: rgba(201,168,76,.45); color: var(--gold); }
.ob-step-body { flex: 1; }
.ob-step-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.ob-step.done .ob-step-title { color: var(--muted); }
.ob-step-desc  { font-size: 13px; color: var(--muted); margin-bottom: 0; }
.ob-step-action {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--gold);
  color: #0a0c10;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--r);
  text-decoration: none;
  transition: opacity .15s;
}
.ob-step-action:hover { opacity: .88; text-decoration: none; }
.ob-step-action.outline {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
}
button.ob-step-action { cursor: pointer; }

.ob-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.ob-modal-backdrop.open { display: flex; }
.ob-modal {
  position: relative;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel2, var(--panel));
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 24px;
}
.ob-modal h2 { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.ob-modal-intro { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.ob-modal-address {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 18px;
}
.ob-modal-actions { display: flex; gap: 10px; }
.ob-modal-footnote { margin-top: 20px; font-size: 12px; color: var(--muted); }
.ob-modal-footnote a { color: var(--gold); }
.ob-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.ob-modal-close:hover { color: var(--gold); }
