/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --bg:          #0d0d0d;
  --bg-sidebar:  #141414;
  --bg-card:     #1e1e1e;
  --bg-inset:    #171717;
  --bg-input:    #1a1a1a;
  --border:      #252525;
  --border-card: #252525;
  --text:        #f0f0f0;
  --text-muted:  #c0c0c0;
  --text-dim:    #777777;
  --accent:      #00b894;
  --accent-dim:  #001f18;
  --accent-glow: rgba(0,184,148,0.15);
  --red:         #ff5555;
  --red-dim:     #2a0a0a;
  --yellow:      #f9ca24;
  --yellow-dim:  #2a2200;
  --sidebar-w:   48px;
  --sidebar-exp: 172px;
  --topbar-h:    44px;
  --radius:      6px;
  --radius-sm:   4px;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }

/* ── Layout ────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease;
  overflow: hidden;
}
.sidebar:hover { width: var(--sidebar-exp); }
.sidebar.sidebar-pinned { width: var(--sidebar-exp); }
.sidebar.sidebar-pinned .nav-label,
.sidebar.sidebar-pinned .sidebar-logo-text,
.sidebar.sidebar-pinned .sidebar-logo-sub { opacity: 1; }

.topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  z-index: 99;
  transition: left 0.2s ease;
}
.sidebar:hover ~ .topbar { left: var(--sidebar-exp); }

.content {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w); right: 0; bottom: 0;
  overflow-y: auto; padding: 24px;
  transition: left 0.2s ease;
}
.sidebar:hover ~ header ~ .content { left: var(--sidebar-exp); }
body.sidebar-pinned .topbar,
body.sidebar-pinned .content { left: var(--sidebar-exp); transition: left 0.2s ease; }

/* ── Sidebar pin button ─────────────────────────────────────────── */
.sidebar-pin-btn {
  display: flex; align-items: center; gap: 0;
  width: 100%; padding: 10px 0 10px 16px;
  border-radius: 0; background: none; border: none;
  color: #555; cursor: pointer;
  white-space: nowrap; overflow: hidden;
  transition: background 0.12s, color 0.12s;
}
.sidebar-pin-btn:hover { background: rgba(255,255,255,0.03); }
.sidebar-pin-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.pin-label {
  font-size: 11px; font-weight: 500;
  opacity: 0; transition: opacity 0.15s; margin-left: 13px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sidebar:hover .pin-label { opacity: 1; }
.sidebar.sidebar-pinned .sidebar-pin-btn {
  color: var(--accent); background: var(--accent-glow);
}
.sidebar.sidebar-pinned .pin-label { opacity: 1; }

/* ── Sidebar logo ──────────────────────────────────────────────── */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 13px 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; white-space: nowrap; overflow: hidden;
  min-height: 48px;
}
.sidebar-logo svg { flex-shrink: 0; }
.sidebar-logo-text {
  font-size: 12px; font-weight: 700; color: var(--accent);
  opacity: 0; transition: opacity 0.15s;
}
.sidebar-logo-sub {
  font-size: 9px; color: var(--text-dim); margin-top: 1px;
  opacity: 0; transition: opacity 0.15s;
}
.sidebar:hover .sidebar-logo-text,
.sidebar:hover .sidebar-logo-sub { opacity: 1; }

/* ── Nav items ─────────────────────────────────────────────────── */
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }

.nav-item {
  display: flex; align-items: center; gap: 0;
  padding: 10px 0 10px 16px;
  color: var(--text-dim); cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text-muted); }
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-item svg {
  width: 16px; height: 16px; flex-shrink: 0;
  opacity: 0.55; transition: opacity 0.12s;
}
.nav-item:hover svg { opacity: 0.9; }
.nav-item.active svg { opacity: 1; }

.nav-label {
  font-size: 11px; font-weight: 500;
  opacity: 0; transition: opacity 0.15s;
  margin-left: 13px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sidebar:hover .nav-label { opacity: 1; }

.sidebar-bottom {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar-title-group { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-desc  { font-size: 11px; color: var(--text-dim); }
.topbar-spacer { flex: 1; }

.topbar-refresh {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); color: var(--text-dim);
  font-size: 12px; transition: all 0.15s;
}
.topbar-refresh:hover { border-color: var(--accent); color: var(--accent); }
.topbar-refresh svg { width: 13px; height: 13px; }
.topbar-refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ── Stat cards ────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: 0 0 0 1px var(--accent) inset; }
.stat-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 10px;
}
.stat-value {
  font-size: 28px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ── Stub states ───────────────────────────────────────────────── */
.stub-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: calc(100vh - var(--topbar-h) - 48px);
  gap: 8px; text-align: center;
}
.stub-title { font-size: 16px; font-weight: 600; color: var(--text-muted); }
.stub-sub   { font-size: 12px; color: var(--text-dim); }

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

/* ── Shared buttons ────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: #000;
  font-size: 12px; font-weight: 600;
  border: none; cursor: pointer; white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: none; color: var(--text-muted);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }

/* ── Inventory toolbar ─────────────────────────────────────────── */
.inv-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.inv-search {
  flex: 1; min-width: 180px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text); font-size: 12px;
  outline: none; transition: border-color 0.12s;
}
.inv-search:focus { border-color: var(--accent); }
.inv-search::placeholder { color: var(--text-dim); }

.inv-filter {
  padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text); font-size: 12px;
  outline: none; cursor: pointer; transition: border-color 0.12s;
}
.inv-filter:focus { border-color: var(--accent); }

/* ── Inventory table ───────────────────────────────────────────── */
.inv-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 12px;
}
.inv-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.inv-table thead tr {
  border-bottom: 1px solid var(--border);
}
.inv-table th {
  padding: 9px 12px; text-align: left;
  font-size: 10px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap; user-select: none;
}
.inv-table th.sortable { cursor: pointer; }
.inv-table th.sortable:hover { color: var(--text-muted); }
.inv-table th.sort-asc::after  { content: ' ↑'; color: var(--accent); }
.inv-table th.sort-desc::after { content: ' ↓'; color: var(--accent); }

.inv-table td {
  padding: 9px 12px; vertical-align: middle;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.inv-row { cursor: pointer; transition: background 0.1s; }
.inv-row:hover td { background: rgba(255,255,255,0.025); }
.inv-row:last-child td { border-bottom: none; }
.inv-sku  { font-family: monospace; font-size: 11px; color: var(--text-dim); }
.inv-title { color: var(--text); font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-actions button {
  padding: 3px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 11px;
  color: var(--text-dim); cursor: pointer;
  background: none; transition: all 0.12s;
}
.inv-actions button:hover { border-color: var(--accent); color: var(--accent); }
.inv-btn-archive { color: var(--text-dim) !important; font-size: 13px !important; padding: 2px 5px !important; }
.inv-btn-archive:hover { border-color: #888 !important; color: #bbb !important; }
.inv-btn-delete  { color: #c0392b !important; font-size: 13px !important; padding: 2px 5px !important; }
.inv-btn-delete:hover  { border-color: #e74c3c !important; color: #e74c3c !important; background: rgba(231,76,60,0.08) !important; }

/* ── Confirm dialog ─────────────────────────────────────────────── */
.inv-confirm-modal {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 202;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.inv-confirm-modal.active { display: flex; }
.inv-confirm-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--text);
}
.inv-confirm-body {
  padding: 16px 18px;
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
}
.inv-confirm-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.btn-secondary {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: none; color: var(--text-dim);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); cursor: pointer;
  transition: all 0.12s;
}
.btn-secondary:hover { border-color: var(--text-dim); color: var(--text); }
.btn-danger {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: #c0392b; color: #fff;
  font-size: 12px; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }
.inv-empty { text-align: center; color: var(--text-dim); padding: 40px; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
}
.badge-cond-new        { background: rgba(0,184,148,0.15); color: #00b894; }
.badge-cond-like_new   { background: rgba(0,184,148,0.10); color: #00d2a0; }
.badge-cond-very_good  { background: rgba(100,200,100,0.12); color: #7dc97d; }
.badge-cond-good       { background: rgba(249,202,36,0.12); color: #c9a600; }
.badge-cond-acceptable { background: rgba(255,150,50,0.12); color: #d48b3d; }
.badge-cond-for_parts  { background: rgba(255,85,85,0.12);  color: #ff5555; }

.badge-status-sourced  { background: rgba(100,150,255,0.12); color: #8aa4f5; }
.badge-status-listed   { background: rgba(0,184,148,0.12);   color: #00b894; }
.badge-status-sold     { background: rgba(100,200,100,0.12); color: #7dc97d; }
.badge-status-archived { background: rgba(120,120,120,0.12); color: #888; }

/* ── Pagination ────────────────────────────────────────────────── */
.inv-pagination {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-dim);
  margin-bottom: 16px;
}
.pag-btn {
  padding: 3px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: none;
  color: var(--text-dim); cursor: pointer; font-size: 14px;
  transition: all 0.12s;
}
.pag-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pag-btn:disabled { opacity: 0.3; cursor: default; }
.pag-info { margin-right: 4px; }
.pag-page { color: var(--text-muted); }

/* ── Modal overlay + dialog ────────────────────────────────────── */
.inv-modal-overlay {
  display: none; position: fixed;
  inset: 0; z-index: 200;
  background: rgba(0,0,0,0.55);
}
.inv-modal-overlay.active { display: block; }

.inv-modal {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 201;
  flex-direction: column;
  overflow: hidden;
}
.inv-modal.active { display: flex; }

.inv-modal-header {
  display: flex; align-items: center;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--text);
  flex-shrink: 0;
}
.inv-modal-header button {
  margin-left: auto; color: var(--text-dim);
  font-size: 18px; line-height: 1; padding: 0 2px;
  cursor: pointer; background: none; border: none;
  transition: color 0.12s;
}
.inv-modal-header button:hover { color: var(--text); }

.inv-modal-body {
  flex: 1; overflow-y: auto; padding: 18px;
}

.inv-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Form sections ─────────────────────────────────────────────── */
.form-section {
  margin-bottom: 18px;
}
.form-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-dim);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.collapsible .form-section-title { cursor: pointer; user-select: none; }
.collapsible .collapse-arrow {
  width: 12px; height: 12px; margin-left: auto;
  transition: transform 0.15s;
}
.collapsible.collapsed .collapse-arrow { transform: rotate(-90deg); }
.collapsible .form-section-body { overflow: hidden; }
.collapsible.collapsed .form-section-body { display: none; }

.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-row label { font-size: 11px; color: var(--text-dim); font-weight: 500; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.field-error {
  display: block;
  color: var(--red);
  font-size: 11px;
  margin-top: 3px;
}
.field-invalid { border-color: var(--red) !important; }

.form-error-banner {
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 12px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 6px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text); font-size: 12px; font-family: inherit;
  outline: none; transition: border-color 0.12s; resize: vertical;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { border-color: var(--accent); }
.form-row input::placeholder,
.form-row textarea::placeholder { color: var(--text-dim); }

/* ── Detail footer ─────────────────────────────────────────────── */
.detail-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-shrink: 0;
}
.detail-footer:empty { display: none; }

/* ── Listings toolbar ──────────────────────────────────────────── */
.lst-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* ── Listings table ────────────────────────────────────────────── */
.lst-table .lst-thumb-cell { width: 56px; padding: 6px 8px 6px 12px; }
.lst-thumb {
  width: 48px; height: 48px;
  object-fit: cover; border-radius: var(--radius-sm);
  background: var(--border); display: block;
}
.lst-thumb-blank {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--border);
}

/* ── Platform badges ───────────────────────────────────────────── */
.badge-plat-ebay       { background: rgba(0,100,210,0.15);  color: #4a9eff; }
.badge-plat-facebook   { background: rgba(0,184,148,0.12);  color: #00b894; }
.badge-plat-craigslist { background: rgba(130,80,200,0.12); color: #a070e0; }
.badge-plat-offerup    { background: rgba(0,200,100,0.12);  color: #00c864; }
.badge-plat-mercari    { background: rgba(255,60,60,0.12);  color: #ff5555; }

/* ── Listing status badges ─────────────────────────────────────── */
.badge-lst-draft     { background: rgba(120,120,120,0.12); color: #888; }
.badge-lst-submitted { background: rgba(249,202,36,0.12);  color: #c9a600; }
.badge-lst-active    { background: rgba(0,184,148,0.12);   color: #00b894; }
.badge-lst-sold      { background: rgba(0,210,160,0.12);   color: #00d2a0; }
.badge-lst-ended     { background: rgba(90,90,90,0.12);    color: #666; }
.badge-lst-pulled    { background: rgba(255,85,85,0.12);   color: #ff5555; }

/* ── Item picker ───────────────────────────────────────────────── */
.picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.picker-item:hover { background: rgba(255,255,255,0.03); }
.picker-item:last-child { border-bottom: none; }
.picker-thumb {
  width: 40px; height: 40px;
  object-fit: cover; border-radius: 3px;
  background: var(--border); flex-shrink: 0;
}
.picker-thumb-blank { width: 40px; height: 40px; border-radius: 3px; background: var(--border); flex-shrink: 0; }
.picker-item-info  { flex: 1; min-width: 0; }
.picker-item-title { font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item-sub   { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ── Listing form modal ────────────────────────────────────────── */
.lform-modal { width: min(680px, calc(100vw - 32px)); }

.lform-item-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-inset); margin-bottom: 16px;
}
.lform-item-summary:empty { display: none; }
.lform-item-thumb {
  width: 44px; height: 44px;
  object-fit: cover; border-radius: 3px;
  background: var(--border); flex-shrink: 0;
}
.lform-item-thumb-blank { width: 44px; height: 44px; border-radius: 3px; background: var(--border); flex-shrink: 0; }
.lform-item-info  { flex: 1; min-width: 0; }
.lform-item-title { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lform-item-sub   { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* ── Char counter ──────────────────────────────────────────────── */
.char-count {
  float: right; font-size: 10px; color: var(--text-dim); font-weight: 400;
}
.char-count.near-limit { color: var(--yellow); }
.char-count.at-limit   { color: var(--red); }

/* ── Form note ─────────────────────────────────────────────────── */
.form-note { font-size: 11px; color: var(--text-dim); margin-bottom: 10px; line-height: 1.5; }

/* ── Toast ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 500; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 14px;
  font-size: 12px; color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: toastIn 0.18s ease;
}
.toast-success { border-color: var(--accent); color: var(--accent); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Existing photos in edit form ──────────────────────────────── */
#photo-existing-list { margin-bottom: 8px; }

.photo-existing-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  background: var(--bg-inset); margin-bottom: 4px;
  font-size: 11px;
}
.photo-existing-thumb {
  width: 36px; height: 36px;
  object-fit: cover; border-radius: 3px; flex-shrink: 0;
  background: var(--border);
}
.photo-existing-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-muted);
}
.photo-primary-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--accent);
  background: var(--accent-dim); padding: 2px 5px;
  border-radius: 3px; flex-shrink: 0;
}
.photo-existing-del {
  color: var(--text-dim); font-size: 16px; line-height: 1;
  cursor: pointer; padding: 0 3px; flex-shrink: 0;
  background: none; border: none;
  transition: color 0.12s;
}
.photo-existing-del:hover { color: var(--red); }

/* ── Photo drop zone ───────────────────────────────────────────── */
.photo-drop-zone {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  margin-bottom: 10px;
}
.photo-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.drop-link {
  color: var(--accent); cursor: pointer; text-decoration: underline;
}

.photo-staged-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  background: var(--bg-inset); margin-bottom: 4px;
  font-size: 11px;
}
.photo-staged-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-staged-size { color: var(--text-dim); flex-shrink: 0; }
.photo-staged-item button {
  color: var(--text-dim); font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0 2px; flex-shrink: 0;
  transition: color 0.12s;
}
.photo-staged-item button:hover { color: var(--red); }

/* ── Detail panel ──────────────────────────────────────────────── */
.inv-detail-overlay {
  display: none; position: fixed;
  inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
}
.inv-detail-overlay.active { display: block; }

.inv-detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.inv-detail-panel.active { transform: translateX(0); }

.detail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-sku {
  font-family: monospace; font-size: 12px; color: var(--text-dim);
  flex: 1;
}
.detail-body { flex: 1; overflow-y: auto; }

.detail-gallery {
  display: flex; gap: 0; overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  max-height: 200px;
}
.detail-gallery img {
  height: 200px; width: auto; object-fit: cover;
  flex-shrink: 0;
}

.detail-section { padding: 14px 16px; }
.detail-field {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.detail-field:last-child { border-bottom: none; }
.detail-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-dim);
  flex-shrink: 0; width: 90px;
}
.detail-field-block { flex-direction: column; gap: 4px; align-items: flex-start; }
.detail-field-block .detail-label { width: auto; }
.detail-loading { padding: 40px; text-align: center; color: var(--text-dim); }

/* ── Comps section in item detail panel ────────────────────────── */
#inv-comps-wrap {
  border-top: 1px solid var(--border);
  padding-top: 0;
}
.detail-comps-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 8px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim);
}
.btn-sm {
  font-size: 11px; padding: 3px 10px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.btn-sm:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.detail-comp-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--border);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.comp-stat {
  background: var(--bg); padding: 8px 6px; text-align: center;
}
.comp-stat-val {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.comp-stat-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); margin-top: 2px;
}
.comp-stat-suggested .comp-stat-val { color: var(--accent); }
.comp-meta {
  font-size: 10px; color: var(--text-dim);
  padding: 4px 16px 8px; text-align: center;
}
.comp-empty {
  font-size: 12px; color: var(--text-dim);
  padding: 16px; text-align: center;
}
.detail-comp-row {
  padding: 7px 16px; border-top: 1px solid var(--border);
  font-size: 11px;
}
.detail-comp-title {
  color: var(--text); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-bottom: 2px;
}
.detail-comp-meta { color: var(--text-dim); font-size: 10px; }
.detail-comp-price { font-weight: 600; color: var(--text); }

/* ── Dashboard stat sub-label ──────────────────────────────────── */
.stat-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.stat-card-accent {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow) inset;
}
.stat-card-accent .stat-value { color: var(--accent); }
.stat-card-accent .stat-label { color: var(--accent); opacity: 0.7; }

/* ── Pills ─────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
  vertical-align: middle;
}
.pill-gray   { background: rgba(120,120,120,0.14); color: #888; }
.pill-green  { background: rgba(0,184,148,0.14);   color: #00b894; }
.pill-yellow { background: rgba(249,202,36,0.14);  color: #c9a600; }
.pill-accent { background: var(--accent-dim);       color: var(--accent); }
.pill-env-production { background: rgba(0,100,210,0.14); color: #4a9eff; }
.pill-env-sandbox    { background: rgba(255,150,50,0.14); color: #d48b3d; }

/* ── Settings sections ─────────────────────────────────────────── */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.settings-section-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section-header > div { flex: 1; min-width: 0; }
.settings-section-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 2px;
}
.settings-section-sub {
  font-size: 11px; color: var(--text-dim);
}

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Inventory: imported badge ─────────────────────────────────── */
.badge-imported { background: rgba(60,100,255,0.14); color: #7090ff; }

/* ── Listings: eBay link ───────────────────────────────────────── */
.lst-ebay-link {
  color: inherit; text-decoration: none;
  transition: color 0.12s;
}
.lst-ebay-link:hover { color: var(--accent); }

/* ── Detail tabs ───────────────────────────────────────────────── */
.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.detail-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 6px 14px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  margin-bottom: -1px;
}
.detail-tab:hover  { color: var(--text); }
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

#dtp-details, #dtp-comps { padding: 0; }

/* ── Comp audit rows ───────────────────────────────────────────── */
.comp-agg-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.comp-agg-stat { text-align: center; }
.comp-agg-val  { font-size: 18px; font-weight: 700; color: var(--text); }
.comp-agg-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); margin-top: 2px; }

.comp-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.comp-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.comp-chip:hover  { background: var(--surface3); color: var(--text); }
.comp-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.comp-audit-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.comp-audit-row:hover { background: var(--surface2); }

.car-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.car-verdict { font-size: 10px; padding: 2px 7px; }
.car-conf    { font-size: 11px; color: var(--text-dim); }
.car-price   { font-size: 13px; font-weight: 600; margin-left: auto; }
.car-cond    { font-size: 11px; color: var(--text-dim); }
.car-title   { font-size: 13px; color: var(--text); margin-bottom: 3px; }
.car-reason  { font-size: 11px; color: var(--text-dim); font-style: italic; margin-bottom: 4px; }
.car-human-note { font-size: 11px; color: var(--text-muted); background: var(--surface2);
                  border-radius: 4px; padding: 2px 6px; margin-bottom: 4px; }
.car-audited-by { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.car-audit-btns {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.car-btn-keep, .car-btn-reject, .car-btn-unsure {
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s;
}
.car-btn-keep   { background: rgba(52,199,89,0.18); color: #34c759; }
.car-btn-reject { background: rgba(255,59,48,0.18);  color: #ff3b30; }
.car-btn-unsure { background: var(--surface2); color: var(--text-dim); }
.car-btn-keep:hover   { opacity: 0.8; }
.car-btn-reject:hover { opacity: 0.8; }
.car-btn-unsure:hover { opacity: 0.8; }

.car-note-form { margin-top: 6px; }
.car-note-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 8px;
  resize: vertical;
  margin-bottom: 4px;
}
.car-note-actions { display: flex; gap: 6px; }

.comp-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.comp-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ── Audit history ─────────────────────────────────────────────── */
.comp-history-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  padding: 8px 16px 4px;
  border-top: 1px solid var(--border);
}
.comp-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.comp-history-row .car-title { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-history-row .car-price { font-size: 12px; }

/* ── Audit queue section ───────────────────────────────────────── */
.aq-title { font-size: 13px; }
.aq-count { font-weight: 600; text-align: center; }
.aq-total { text-align: center; color: var(--text-dim); font-size: 12px; }
.aq-action { text-align: right; }

/* ── Pill variants ─────────────────────────────────────────────── */
.pill-red { background: rgba(255,59,48,0.15); color: #ff3b30; }

/* ── Inventory: comp status cell ───────────────────────────────── */
.inv-comp-cell { cursor: pointer; white-space: nowrap; font-size: 12px; }
.inv-comp-cell:hover { background: var(--surface3) !important; }
.inv-comp-good    { color: #34c759; }
.inv-comp-mixed   { color: #f4a726; }
.inv-comp-review  { color: #f4a726; }
.inv-comp-pending { color: var(--text-dim); font-style: italic; }
.inv-comp-none    { color: var(--text-dim); }

/* ── Audit: quality link ───────────────────────────────────────── */
.audit-quality-link {
  padding: 12px 16px;
  text-align: right;
}

/* ── Comp Quality page ─────────────────────────────────────────── */
.cq-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.cq-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.cq-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  padding: 14px 20px 6px;
}
.cq-agreement-row {
  display: flex;
  gap: 32px;
  padding: 12px 20px;
}
.cq-agreement-stat { display: flex; flex-direction: column; gap: 2px; }
.cq-big  { font-size: 28px; font-weight: 700; color: var(--text); }
.cq-dim  { font-size: 12px; color: var(--text-dim); }
.cq-bar-wrap {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  margin: 0 20px 12px;
  overflow: hidden;
}
.cq-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}


/* ── Cockpit ────────────────────────────────────────────────────── */
.cockpit-header { padding: 20px 24px 4px; }
.cockpit-title  { font-size: 18px; font-weight: 700; color: var(--text); }
.cockpit-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.cockpit-today-row {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
}
.cockpit-today-tile {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: center;
}
.ct-value { font-size: 28px; font-weight: 700; color: var(--text); }
.ct-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }
.ct-has-exceptions .ct-value { color: var(--red); }

.cockpit-panels-row {
  display: flex;
  gap: 16px;
  padding: 0 24px 16px;
}

.cockpit-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  margin: 0 24px 16px;
  overflow: hidden;
}
.cockpit-panel.cp-half {
  flex: 1;
  margin: 0;
}

.cp-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.cp-panel-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; flex: 1; }
.cp-refresh { background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 15px; padding: 2px 6px; border-radius: var(--radius-sm); }
.cp-refresh:hover { color: var(--text); background: var(--bg-inset); }

.cp-panel-body { padding: 8px 0; max-height: 320px; overflow-y: auto; }

.cp-loading, .cp-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 12px; }
.cp-error  { padding: 12px 14px; color: var(--red); font-size: 12px; }

.cp-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.cp-item-row:last-child { border-bottom: none; }
.cp-item-main { flex: 1; min-width: 0; }
.cp-item-title { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-item-meta  { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.cp-item-ts    { font-size: 11px; color: var(--text-dim); white-space: nowrap; padding-top: 1px; }

.cp-stage {
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stage-pending   { background: var(--yellow-dim); color: var(--yellow); }
.stage-resolved  { background: var(--accent-dim); color: var(--accent); }
.stage-exception { background: var(--red-dim); color: var(--red); }
.stage-default   { background: var(--bg-inset); color: var(--text-dim); }

.cp-fp-name    { font-size: 11px; color: var(--text-dim); }
.cp-fp-missing { font-size: 11px; color: var(--yellow); }

.cp-exception-row {}
.cp-exception-reason { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.cp-exception-event-type { font-size: 11px; color: var(--text-dim); }

.cp-badge {
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 5px;
  text-transform: uppercase;
}
.cp-badge-info    { background: var(--bg-inset); color: var(--text-dim); }
.cp-badge-warning { background: var(--yellow-dim); color: var(--yellow); }
.cp-badge-error   { background: var(--red-dim); color: var(--red); }

/* Activity table */
.cp-activity-filters { display: flex; gap: 8px; margin-right: 4px; }
.cp-activity-filters select {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 6px;
}
.cp-activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.cp-activity-table th {
  padding: 6px 12px;
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .05em;
}
.cp-activity-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.cp-activity-row:last-child td { border-bottom: none; }
.cp-activity-row.sev-error   { background: rgba(255,85,85,0.04); }
.cp-activity-row.sev-warning { background: rgba(249,202,36,0.04); }
.cp-event-type { font-family: monospace; font-size: 11px; color: var(--text-muted); }
.cp-ts         { color: var(--text-dim); white-space: nowrap; }
.cp-actor      { color: var(--text-dim); }
.cp-item-ref   { color: var(--text); }

/* Batch intake */
.batch-intake-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 14px;
  flex-wrap: wrap;
}
.batch-title-input, .batch-notes-input {
  flex: 1;
  min-width: 140px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
}
.batch-result { padding: 6px 14px; font-size: 11px; }
.batch-result-ok    { color: var(--accent); }
.batch-result-error { color: var(--red); }
.hidden { display: none !important; }

/* ── Fingerprint editor ─────────────────────────────────────────── */
.fp-editor { padding: 12px 16px; }
.fp-editor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.fp-stage-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 3px;
  padding: 2px 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fp-id-hint   { font-size: 11px; color: var(--text-dim); font-family: monospace; }
.fp-no-fp     { color: var(--yellow); }

.fp-form      { display: flex; flex-direction: column; gap: 8px; }
.fp-row       { display: flex; align-items: center; gap: 10px; }
.fp-label     { font-size: 11px; color: var(--text-dim); width: 90px; flex-shrink: 0; text-align: right; }
.fp-input {
  flex: 1;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
}
.fp-input:focus { outline: none; border-color: var(--accent); }
.fp-actions    { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding-left: 100px; }
.fp-save-btn   { padding: 5px 16px; font-size: 12px; }
.fp-save-msg   { font-size: 11px; color: var(--text-dim); }
.fp-msg-ok     { color: var(--accent); }
.fp-msg-error  { color: var(--red); }
.fp-msg-warn   { color: var(--yellow); }
