/* Price Stamp admin. Layout: top nav bar, centered content column; the editor page uses the full width. */
:root {
  --bg: #f5f3f6;
  --surface: #ffffff;
  --ink: #1f1a24;
  --muted: #6c6474;
  --line: #e2dce6;
  --accent: #8b1d3d;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7ec;
  --gold: #a87a22;
  --gold-soft: #f6eedd;
  --stage: #2a2430;
  --ok: #1f7a4d;
  --ok-soft: #e3f3ea;
  --danger: #b42318;
  --danger-soft: #fbe9e7;
  --font-ui: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Reem Kufi", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141118; --surface: #1d1922; --ink: #efeaf2; --muted: #a59dac; --line: #332c3a;
    --accent: #e0607f; --accent-ink: #1a0d12; --accent-soft: #3a1d27; --gold: #d8ae58; --gold-soft: #3a3020;
    --stage: #0c0a0e; --ok: #5fd39a; --ok-soft: #173326; --danger: #ff7a6e; --danger-soft: #3d1c19; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141118; --surface: #1d1922; --ink: #efeaf2; --muted: #a59dac; --line: #332c3a;
  --accent: #e0607f; --accent-ink: #1a0d12; --accent-soft: #3a1d27; --gold: #d8ae58; --gold-soft: #3a3020;
  --stage: #0c0a0e; --ok: #5fd39a; --ok-soft: #173326; --danger: #ff7a6e; --danger-soft: #3d1c19; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-ui); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 16px; }
code, .mono { font-family: var(--font-mono); font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
@media (max-width: 760px) { .nav { position: static; } }
.wordmark { font: 700 19px/1 var(--font-display); text-decoration: none; color: var(--ink); white-space: nowrap; }
.wordmark span { color: var(--accent); }
.nav-links { display: flex; gap: 2px; flex-wrap: wrap; margin-right: auto; }
.nav-links a {
  padding: 8px 11px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav-links a:hover { color: var(--ink); background: var(--bg); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav form { margin: 0; }

/* ---------- page ---------- */
.page { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 22px 60px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.cols-wide { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .cols, .cols-wide { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-pad { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.note { margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 8px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; }
.btn-quiet:hover { color: var(--ink); border-color: var(--line); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-end { justify-content: flex-end; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field .help { font-size: 12px; color: var(--muted); }
.input {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); font-size: 15px;
}
textarea.input { min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.error { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice b { display: block; }
.choice span { color: var(--muted); font-size: 13px; }

/* ---------- feedback ---------- */
.flash { padding: 10px 14px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 600; border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill-bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill-warn { color: var(--gold); background: var(--gold-soft); border-color: transparent; }
.kw {
  display: inline-block; min-width: 26px; padding: 1px 8px; border-radius: 6px; text-align: center;
  background: var(--ink); color: var(--bg); font: 600 13px var(--font-mono);
}
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--gold-soft); color: var(--gold); font-weight: 600; font-size: 12.5px; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 12.5px; }
.list { display: flex; flex-direction: column; }
.list > * { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 14px 16px; }
.stat b { display: block; font: 700 26px/1.1 var(--font-ui); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- photo grid ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.photo:has(.pick:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; background: var(--line); }
.photo.hidden-photo img { opacity: .4; }
.photo .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; min-width: 0; }
.photo .meta b { font-family: var(--font-mono); font-size: 12.5px; }
.photo .meta span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo .pick-wrap { position: absolute; top: 8px; left: 8px; background: var(--surface); border-radius: 6px; padding: 4px; display: flex; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.photo .pick { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.photo .state { position: absolute; top: 8px; right: 8px; }
.bulkbar {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--ink); color: var(--bg); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
.bulkbar .input { width: auto; min-height: 34px; padding: 4px 8px; background: var(--surface); color: var(--ink); font-size: 14px; }
.bulkbar .btn { min-height: 34px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input { width: auto; min-width: 140px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty b { color: var(--ink); font-size: 15px; }

/* ---------- switch ---------- */
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch-row .grow { flex: 1; min-width: 0; }
.switch-row .grow b { display: block; }
.switch-row .grow span { color: var(--muted); font-size: 13px; }
.switch-row .grow .error { color: var(--danger); }
.switch { position: relative; width: 46px; height: 26px; border-radius: 99px; border: 0; padding: 0; cursor: pointer; background: var(--line); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding-inline: 16px; padding-block: 40px; }
.login { width: min(100%, 380px); }
.login .wordmark { font-size: 28px; display: block; margin-bottom: 18px; text-align: center; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
