/* ════════════════════════════════════════════════════════════════════
   Resale Sync design system
   Neutral zinc base + single indigo accent. All colors are defined once
   as light-dark() pairs and switch via `color-scheme`, which is driven
   by the OS preference or the manual <html data-theme> override.
   Spacing follows a 4/8px grid; motion is 150–200ms ease-out.
   ════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* surfaces & text */
  --bg:          light-dark(#fafafa, #101013);
  --panel:       light-dark(#ffffff, #18181c);
  --panel-2:     light-dark(#f4f4f5, #1f1f24);          /* nested / code surfaces */
  --ink:         light-dark(#18181b, #f4f4f5);
  --muted:       light-dark(#6b6b76, #9d9da8);
  --border:      light-dark(#e4e4e7, #2a2a31);
  --border-soft: light-dark(#ececef, #232329);

  /* accent + semantics */
  --accent:        light-dark(#4f46e5, #818cf8);
  --accent-strong: light-dark(#4338ca, #93a0fa);         /* hover */
  --on-accent:     light-dark(#ffffff, #14142b);
  --success:       light-dark(#16a34a, #4ade80);
  --success-strong:light-dark(#15803d, #6ee7a0);
  --on-success:    light-dark(#ffffff, #052e16);
  --warning:       light-dark(#d97706, #fbbf24);
  --danger:        light-dark(#dc2626, #f87171);
  --danger-strong: light-dark(#b91c1c, #fca5a5);

  /* depth */
  --shadow-sm: 0 1px 2px light-dark(rgba(24,24,27,0.05), rgba(0,0,0,0.4));
  --shadow-md: 0 1px 2px light-dark(rgba(24,24,27,0.05), rgba(0,0,0,0.35)),
               0 4px 12px light-dark(rgba(24,24,27,0.06), rgba(0,0,0,0.35));
  --shadow-lg: 0 2px 4px light-dark(rgba(24,24,27,0.05), rgba(0,0,0,0.4)),
               0 12px 32px light-dark(rgba(24,24,27,0.10), rgba(0,0,0,0.5));
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

  /* shape & motion */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast: 150ms var(--ease);
  --t-med: 200ms var(--ease);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

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

/* ── base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* author rules (e.g. input { display:block }) must never resurrect [hidden] elements */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: var(--r-sm);
}
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* ── nav ──────────────────────────────────────────────────────────── */
.topnav {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1rem;
  justify-content: space-between; align-items: center;
  padding: 0.5rem max(1rem, env(safe-area-inset-left));
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.topnav a.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--ink); font-weight: 650; letter-spacing: -0.01em;
  text-decoration: none; font-size: 0.95rem; padding: 0.25rem 0;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #d946ef));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), var(--shadow-sm);
}
.nav-links { display: flex; gap: 0.125rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--muted); text-decoration: none; padding: 0.375rem 0.625rem;
  border-radius: var(--r-sm); font-size: 0.875rem; font-weight: 500;
  white-space: nowrap; transition: color var(--t-fast), background var(--t-fast);
}
.nav-links a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.nav-right { display: flex; gap: 0.5rem; align-items: center; }
.topnav .muted { color: var(--muted); font-size: 0.8125rem; }
button.link {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 0.375rem 0.5rem; font: inherit; font-size: 0.875rem; font-weight: 500;
  border-radius: var(--r-sm); transition: color var(--t-fast), background var(--t-fast);
}
button.link:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm);
  background: none; border: none; color: var(--muted); cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.theme-toggle:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (max-width: 640px) { .nav-email { display: none; } }

/* ── layout & type ────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 {
  font-size: 1.375rem; font-weight: 650; letter-spacing: -0.02em;
  line-height: 1.25; margin: 0.25rem 0 1.25rem;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
h2 { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
.card-link { float: right; font-size: 0.75rem; font-weight: 500; }
h3.muted {
  font-size: 0.6875rem; font-weight: 600; margin: 1.25rem 0 0.5rem;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.page-sub { color: var(--muted); margin: -0.75rem 0 1.25rem; font-size: 0.875rem; }
.back-link { font-size: 0.8125rem; color: var(--muted); display: inline-block; margin-bottom: 0.25rem; }
.back-link:hover { color: var(--ink); }

/* ── cards / tables ───────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.25rem; margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-weight: 600; font-size: 0.6875rem;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  padding: 0 0.5rem 0.5rem 0;
}
td { padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--border-soft); font-size: 0.875rem; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list td { padding: 0.625rem 0.75rem 0.625rem 0; }
table.list tr { transition: background var(--t-fast); }
table.list tr:hover td { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.ok-text { color: var(--success); font-weight: 600; }
.small-text { font-size: 0.8125rem; }
.inline { display: inline; }
.center-text { text-align: center; }
pre {
  overflow-x: auto; background: var(--panel-2); border: 1px solid var(--border-soft);
  padding: 0.75rem; border-radius: var(--r-sm); font-size: 0.75rem;
  font-family: var(--font-mono); line-height: 1.6;
}

/* ── empty states & skeletons ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1.5rem;
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  color: var(--muted); margin: 0.5rem 0 1rem;
}
.empty-state svg { width: 28px; height: 28px; margin-bottom: 0.5rem; opacity: 0.6; }
.empty-state strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 0.25rem; }
.empty-state p { margin: 0; font-size: 0.875rem; }
.empty-state.ok svg { color: var(--success); opacity: 1; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton, .item-card img, .photos img {
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--ink) 5%, var(--panel)) 40%,
    color-mix(in srgb, var(--ink) 9%, var(--panel)) 50%,
    color-mix(in srgb, var(--ink) 5%, var(--panel)) 60%) var(--panel);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.skeleton { border-radius: var(--r-sm); min-height: 1em; }

/* ── flash & banners ──────────────────────────────────────────────── */
.flash {
  padding: 0.75rem 1rem; border-radius: var(--r-md); margin: 0.5rem 0 1rem;
  font-size: 0.875rem; border: 1px solid transparent;
  animation: flash-in 250ms var(--ease);
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } }
.flash.ok {
  background: color-mix(in srgb, var(--success) 10%, var(--panel));
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
  color: color-mix(in srgb, var(--success) 60%, var(--ink));
}
.flash.error {
  background: color-mix(in srgb, var(--danger) 9%, var(--panel));
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: color-mix(in srgb, var(--danger) 60%, var(--ink));
}
.flash ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.quota-banner {
  display: flex; align-items: center; gap: 0.5rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: color-mix(in srgb, var(--accent) 60%, var(--ink));
  padding: 0.625rem 1rem; border-radius: var(--r-md); font-size: 0.875rem;
}

/* ── chips / status badges ────────────────────────────────────────── */
.chip {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.125rem 0.625rem; border-radius: var(--r-full);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  color: color-mix(in srgb, var(--c) 62%, var(--ink));
  font-size: 0.75rem; font-weight: 500; line-height: 1.5;
  vertical-align: middle; white-space: nowrap;
}
.chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c); flex-shrink: 0;
}
.chip.demo { --c: light-dark(#7c3aed, #a78bfa); }
.chip.ok-chip { --c: var(--success); }
.st-draft { --c: var(--muted); }
.st-ai_processed { --c: var(--warning); }
.st-reviewed { --c: light-dark(#2563eb, #60a5fa); }
.st-publishing, .st-pending, .st-relisting { --c: var(--warning); }
.st-listed, .st-live { --c: var(--success); }
.st-sold { --c: light-dark(#db2777, #f472b6); }
.st-delisting { --c: light-dark(#ea580c, #fb923c); }
.st-closed { --c: light-dark(#4f46e5, #818cf8); }
.st-withdrawn, .st-ended { --c: var(--muted); }
.st-error, .st-failed { --c: var(--danger); }
.chip.tier-basic { --c: var(--muted); }
.chip.tier-premium { --c: light-dark(#2563eb, #60a5fa); }
.chip.tier-enterprise { --c: light-dark(#7c3aed, #a78bfa); }

/* ── forms ────────────────────────────────────────────────────────── */
label { display: block; margin-bottom: 0.875rem; font-size: 0.8125rem; font-weight: 500; color: var(--ink); }
label .muted, label .counter { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; padding: 0.5rem 0.75rem; margin-top: 0.375rem;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 16px; /* prevents iOS zoom-on-focus */
  font-family: inherit; font-weight: 400;
  background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--muted) 55%, var(--border));
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--ring), var(--shadow-sm);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--panel-2); color: var(--muted); box-shadow: none; cursor: not-allowed;
}
input[type="checkbox"] { accent-color: var(--accent); box-shadow: none; }
td select { margin-top: 0; width: auto; min-width: 110px; font-size: 0.875rem; padding: 0.375rem 0.5rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

/* ── buttons ──────────────────────────────────────────────────────── */
button { font-family: inherit; }
button.primary, button.small {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: var(--r-sm); cursor: pointer; font-weight: 550;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
button.primary {
  width: 100%; padding: 0.625rem 1.125rem;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid transparent; font-size: 0.9375rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), var(--shadow-sm);
}
button.primary:hover:not(:disabled) { background: var(--accent-strong); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), var(--shadow-md); }
button.primary:active:not(:disabled) { transform: scale(0.985); box-shadow: var(--shadow-sm); }
button.primary:disabled {
  background: color-mix(in srgb, var(--muted) 22%, var(--panel));
  color: var(--muted); cursor: not-allowed; box-shadow: none;
}
button.approve { background: var(--success); color: var(--on-success); }
button.approve:hover:not(:disabled) { background: var(--success-strong); }
button.small {
  padding: 0.375rem 0.875rem; border: 1px solid var(--border);
  background: var(--panel); color: var(--ink); font-size: 0.8125rem;
  box-shadow: var(--shadow-sm);
}
button.small:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--muted) 50%, var(--border));
  background: color-mix(in srgb, var(--ink) 3%, var(--panel));
}
button.small:active:not(:disabled) { transform: scale(0.985); }
button.small:disabled { color: var(--muted); cursor: not-allowed; box-shadow: none; }
button.small.warn { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); color: var(--danger); }
button.small.warn:hover:not(:disabled) {
  border-color: var(--danger); color: var(--danger-strong);
  background: color-mix(in srgb, var(--danger) 6%, var(--panel));
}

/* spinner shown while a form is submitting (JS adds .btn-loading) */
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loading::before {
  content: ""; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── login / register ─────────────────────────────────────────────── */
.login-box {
  max-width: 380px; margin: 10vh auto 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: rise-in 300ms var(--ease);
}
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
.login-box h1 { margin: 0 0 0.375rem; font-size: 1.25rem; }
.login-box .auth-sub { margin: 0 0 1.5rem; font-size: 0.875rem; }
.login-box .brand-mark { width: 36px; height: 36px; border-radius: 11px; margin-bottom: 1rem; }
.login-box button.primary { margin-top: 0.375rem; }

/* ── dashboard ────────────────────────────────────────────────────── */
.quick-actions { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.big-action {
  flex: 1; min-width: 150px; display: flex; align-items: center; justify-content: center;
  gap: 0.625rem; padding: 1.125rem 1rem;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-md); text-decoration: none; font-weight: 600; font-size: 0.9375rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), var(--shadow-sm);
  transition: background var(--t-fast), box-shadow var(--t-med), transform var(--t-med);
}
.big-action svg { width: 18px; height: 18px; flex-shrink: 0; }
.big-action:hover {
  background: var(--accent-strong); color: var(--on-accent); text-decoration: none;
  transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), var(--shadow-md);
}
.big-action:active { transform: translateY(0); }
.big-action.secondary {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.big-action.secondary:hover { background: color-mix(in srgb, var(--ink) 3%, var(--panel)); }

/* ── capture ──────────────────────────────────────────────────────── */
.photos-hint { margin: 0.5rem 0 0.75rem; font-size: 0.875rem; }
.photo-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.75rem; margin: 0.75rem 0 1.25rem; }
.photo-tile {
  position: relative; aspect-ratio: 3/4;
  border: 1.5px dashed var(--border); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  overflow: hidden; background: var(--panel-2); margin: 0;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-med), box-shadow var(--t-med);
}
.photo-tile:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.photo-tile:focus-within { box-shadow: var(--ring); border-color: var(--accent); }
.photo-tile.tag-tile {
  border-color: color-mix(in srgb, var(--warning) 60%, var(--border));
  background: color-mix(in srgb, var(--warning) 7%, var(--panel-2));
}
.photo-tile.filled { border-style: solid; border-color: var(--success); background: var(--panel); }
.photo-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-tile .tile-ph { object-fit: contain; padding: 8% 12% 22%; opacity: 0.85; }
.photo-tile.filled .tile-ph { display: none; }
.tile-label {
  position: relative; z-index: 1; font-size: 0.75rem; font-weight: 600;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  padding: 0.125rem 0.5rem; border-radius: var(--r-full);
  align-self: flex-end; margin-bottom: 0.5rem; box-shadow: var(--shadow-sm);
}
.photo-tile.filled .tile-label { background: color-mix(in srgb, var(--success) 18%, var(--panel)); }

/* ── batch grid ───────────────────────────────────────────────────── */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.item-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-med), transform var(--t-med);
}
.item-card:hover {
  text-decoration: none; color: var(--ink); transform: translateY(-2px);
  box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--muted) 40%, var(--border));
}
.item-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.item-meta { padding: 0.625rem; display: flex; flex-direction: column; gap: 0.375rem; font-size: 0.8125rem; }
.item-meta strong { font-weight: 600; letter-spacing: -0.01em; }
.item-meta .chip { align-self: flex-start; }
.item-card.status-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

/* ── review ───────────────────────────────────────────────────────── */
.review-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; }
@media (max-width: 820px) { .review-layout { grid-template-columns: 1fr; } }
.photos { display: grid; grid-template-columns: 1fr; gap: 0.75rem; align-content: start; }
@media (max-width: 820px) {
  .photos { grid-auto-flow: column; grid-auto-columns: 45%; overflow-x: auto;
            padding-bottom: 0.5rem; -webkit-overflow-scrolling: touch; }
}
.photos figure { margin: 0; }
.photos img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--border); display: block; }
.photos figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.fields label { border-left: 2px solid transparent; padding-left: 0.5rem; border-radius: 4px; }
label.conf-low {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 7%, transparent);
}
label.conf-needs {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}
.legend { margin-bottom: 0.875rem; font-size: 0.8125rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.swatch.low { background: var(--warning); }
.swatch.needs { background: var(--danger); }
.counter { font-size: 0.75rem; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 700; }
.confirm-box {
  display: flex; gap: 0.625rem; align-items: center; margin: 1.25rem 0;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 0.875rem 1rem; border-radius: var(--r-md);
}
.confirm-box input { width: 1.25rem; height: 1.25rem; margin: 0; flex-shrink: 0; }
.actions {
  display: flex; gap: 0.75rem; position: sticky; bottom: 0.5rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 0.5rem 0; border-radius: var(--r-md);
}
.actions button { width: auto; flex: 1; padding: 0.625rem 1rem; }
.problems { font-size: 0.8125rem; }

/* ── lifecycle panel ──────────────────────────────────────────────── */
.lifecycle h2 { margin-bottom: 0.75rem; }
.channel-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.channel-row { display: flex; gap: 0.625rem; align-items: center; flex-wrap: wrap; }
.ch-name { min-width: 90px; font-weight: 600; font-size: 0.875rem; }
.publish-form { border-top: 1px solid var(--border-soft); padding-top: 1rem; }
.channel-picks { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.875rem; }
.pick { display: flex; gap: 0.5rem; align-items: center; margin: 0; font-weight: 500; }
.pick input { width: 1.125rem; height: 1.125rem; margin: 0; }

/* ── billing plans ────────────────────────────────────────────────── */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; align-items: stretch; }
.plan { display: flex; flex-direction: column; transition: box-shadow var(--t-med), transform var(--t-med); }
.plan:hover { box-shadow: var(--shadow-md); }
.plan-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}
.plan-limit { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin: 0.25rem 0 0.5rem; }
.plan-features { padding: 0; margin: 0 0 1rem; flex: 1; list-style: none; }
.plan-features li { padding-left: 1.375rem; position: relative; margin-bottom: 0.375rem; font-size: 0.875rem; }
.plan-features li::before {
  content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700;
}
.plan form { margin-top: auto; }

/* ── oversells ────────────────────────────────────────────────────── */
.oversell-head { display: flex; gap: 0.625rem; align-items: center; flex-wrap: wrap; }
.oversell { transition: opacity var(--t-med); }
.oversell.resolved { opacity: 0.55; }
.oversell.resolved:hover { opacity: 1; }
details summary {
  cursor: pointer; color: var(--muted); font-size: 0.8125rem; font-weight: 500;
  transition: color var(--t-fast); user-select: none;
}
details summary:hover { color: var(--ink); }
details[open] summary { margin-bottom: 0.5rem; }

/* ── listings ─────────────────────────────────────────────────────── */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 0.75rem; margin-bottom: 1.25rem;
}
.stat-tile {
  --c: var(--muted);
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.875rem 1rem; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-med), transform var(--t-med);
}
.stat-tile:hover {
  text-decoration: none; color: var(--ink); transform: translateY(-1px);
  box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--muted) 40%, var(--border));
}
.stat-tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.stat-num { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.stat-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.stat-tile.all .stat-label::before { display: none; }
.stat-tile.st-live { --c: var(--success); }
.stat-tile.st-pending { --c: var(--warning); }
.stat-tile.st-ended { --c: var(--muted); }
.stat-tile.st-failed { --c: var(--danger); }

.filter-bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md);
}
.seg a {
  padding: 0.3rem 0.75rem; border-radius: calc(var(--r-md) - 3px);
  font-size: 0.8125rem; font-weight: 500; color: var(--muted); text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }

.listings-table td { vertical-align: middle; }
.listing-item { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); min-width: 0; }
.listing-item:hover { text-decoration: none; }
.listing-item:hover .listing-title-main { color: var(--accent); }
.listing-thumb {
  width: 40px; height: 52px; flex-shrink: 0; border-radius: var(--r-sm);
  object-fit: cover; border: 1px solid var(--border); background: var(--panel-2);
}
.listing-thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.listing-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.listing-title-main { font-weight: 600; font-size: 0.875rem; letter-spacing: -0.01em; transition: color var(--t-fast); }
.listing-title-sub { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.channel-cell { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; font-weight: 500; }
.listing-err { margin-top: 0.25rem; max-width: 32ch; }
