:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f0ebe3;
  --border: #e3dcd1;
  --text: #2a2521;
  --muted: #7a6f65;
  --accent: #b5652b;
  --accent-ink: #ffffff;
  --ok: #2f7d4f;
  --ok-bg: #e4f2e8;
  --bad: #b3372f;
  --bad-bg: #f8e3e1;
  --warn: #9a6a00;
  --warn-bg: #fbf0d4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(42, 37, 33, .06), 0 4px 16px rgba(42, 37, 33, .05);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714;
    --surface: #24201c;
    --surface-2: #2d2823;
    --border: #3a342e;
    --text: #efe9e1;
    --muted: #a99d90;
    --accent: #e08a4a;
    --accent-ink: #1a1714;
    --ok: #6fcf97;
    --ok-bg: #1f3328;
    --bad: #ef8a80;
    --bad-bg: #3a2220;
    --warn: #e6c068;
    --warn-bg: #3a3020;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
  border-right: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; padding: 4px 10px 18px; }
.brand span { color: var(--accent); }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--surface-2); font-weight: 600; }
.nav .count {
  min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent);
  color: var(--accent-ink); font-size: .75rem; font-weight: 700; text-align: center;
}
.sidebar .spacer { flex: 1; }
.sidebar form button { width: 100%; }
main { padding: 28px clamp(16px, 4vw, 44px) 60px; max-width: 1280px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 10px 0 4px; font-size: 1.1rem; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; }
  .sidebar .spacer, .sidebar form { display: none; }
}

/* ---------- components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.stat .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.stat.hot .value { color: var(--accent); }
.two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.reject { color: var(--bad); border-color: var(--bad); }
.btn.reject:hover { background: var(--bad-bg); }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn.icon { padding: 4px 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.chip { display: inline-block; padding: 2px 9px; margin: 0 4px 4px 0; border-radius: 999px; border: 1px solid var(--border); font-size: .8rem; }

.notice { padding: 12px 16px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); margin-bottom: 18px; }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.thumb { width: 52px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- forms */
label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
.tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.styles-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.style-opt { border: 2px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; background: var(--surface); text-align: left; }
.style-opt.active { border-color: var(--accent); }
.style-opt .swatches { display: flex; margin-top: 6px; height: 14px; border-radius: 4px; overflow: hidden; }
.style-opt .swatches i { flex: 1; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.drag { border-color: var(--accent); background: var(--surface-2); }
.dropzone img { max-height: 220px; margin: 0 auto 8px; border-radius: 8px; }

/* ---------- review */
.review { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 22px; padding: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .review { grid-template-columns: 1fr; } }
.review.focus { outline: 2px solid var(--accent); }
.review .main-img { border-radius: 10px; background: var(--surface-2); cursor: zoom-in; }
.mockups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.mockups figure { margin: 0; }
.mockups img { border-radius: 8px; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; background: var(--surface-2); }
.mockups figcaption { font-size: .75rem; color: var(--muted); text-align: center; margin-top: 2px; text-transform: capitalize; }
.listing-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin: 6px 0 10px; }
.description { white-space: pre-wrap; background: var(--surface-2); padding: 12px 14px; border-radius: 10px; margin-bottom: 10px; }
.description mark { background: var(--warn-bg); color: inherit; padding: 1px 2px; border-radius: 3px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: .88rem; margin: 10px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.decide { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.decide textarea { flex: 1 1 260px; min-height: 40px; }

/* ---------- misc */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 20; padding: 12px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 600;
  transition: opacity .2s, transform .2s;
}
.toast.error { background: var(--bad); color: #fff; }
.toast[hidden] { display: none; }
.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 92vw; border-radius: 8px; }
.result { margin-top: 18px; }
.sched-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 150px; }
.rank { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-weight: 700; font-size: .8rem; flex: none; }
