/* =========================================================
   Owner portal - utilitarian counterpart to the storefront.
   Neutrals tinted toward cobalt, data set in tabular figures.
   ========================================================= */

:root {
  --ink:       oklch(23% 0.03 264);
  --ink-soft:  oklch(38% 0.028 264);
  --muted:     oklch(52% 0.024 264);
  --line:      oklch(89% 0.012 264);
  --line-strong: oklch(82% 0.02 264);
  --paper:     oklch(97.8% 0.008 264);
  --surface:   oklch(99.4% 0.004 264);
  --shade:     oklch(95% 0.012 264);

  --accent:    oklch(52% 0.19 262);
  --accent-on: oklch(98% 0.008 262);
  --accent-tint: oklch(93% 0.045 262);
  --ok:   oklch(56% 0.14 155);
  --warn: oklch(74% 0.15 78);
  --bad:  oklch(54% 0.19 25);
  --pick: oklch(58% 0.2 330);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --tint-magenta: oklch(92% 0.062 350);
  --tint-tangerine: oklch(93% 0.058 62);
  --tint-cobalt: oklch(92% 0.05 258);
  --tint-lime: oklch(94% 0.075 122);
  --tint-plum: oklch(91% 0.045 312);
  --tint-clay: oklch(93% 0.045 42);
}

[data-accent="magenta"]   { --tile: var(--tint-magenta); }
[data-accent="tangerine"] { --tile: var(--tint-tangerine); }
[data-accent="cobalt"]    { --tile: var(--tint-cobalt); }
[data-accent="lime"]      { --tile: var(--tint-lime); }
[data-accent="plum"]      { --tile: var(--tint-plum); }
[data-accent="clay"]      { --tile: var(--tint-clay); }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 0.9375rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.8125em; background: var(--shade); padding: 2px 6px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-3) clamp(16px, 3vw, 32px);
  background: var(--ink); color: oklch(92% 0.01 264);
}
.topbar__brand { display: flex; align-items: center; gap: var(--s-3); }
.topbar__mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--pick); color: oklch(98% 0.01 330);
  font-family: var(--display); font-size: 1.25rem; font-weight: 700;
}
.topbar__store { font-weight: 600; color: oklch(99% 0.005 264); }
.topbar__role { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: oklch(70% 0.02 264); }
.topbar__end { display: flex; align-items: center; gap: var(--s-4); font-size: 0.875rem; }
.topbar__link { color: oklch(85% 0.02 264); }
.topbar__who { color: oklch(72% 0.02 264); font-variant-numeric: tabular-nums; }
.topbar .btn--ghost { border-color: oklch(45% 0.03 264); color: oklch(92% 0.01 264); }
.topbar .btn--ghost:hover { background: oklch(99% 0.005 264); color: var(--ink); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } }

.sidenav {
  position: sticky; top: 64px; display: flex; flex-direction: column; gap: 2px;
  padding: var(--s-5) var(--s-3); border-right: 1px solid var(--line);
}
@media (max-width: 860px) {
  .sidenav { position: static; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: var(--s-3); }
}
.sidenav a {
  padding: 10px 14px; border-radius: 8px; text-decoration: none; color: var(--ink-soft);
  white-space: nowrap; transition: background .16s var(--out-quart), color .16s;
}
.sidenav a:hover { background: var(--shade); color: var(--ink); }
.sidenav a.is-on { background: var(--ink); color: var(--surface); }
.sidenav__cta { margin-top: var(--s-4); color: var(--accent) !important; border: 1px dashed var(--line-strong); text-align: center; }
@media (max-width: 860px) { .sidenav__cta { margin: 0; } }

.panel { padding: clamp(20px, 3vw, 40px) clamp(16px, 3vw, 40px) var(--s-8); max-width: 1280px; }

.panelhead { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); }
.panelhead h1 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); }
.panelhead p { color: var(--muted); margin-top: 6px; max-width: 68ch; font-size: 0.9375rem; }
.minihead { font-family: var(--display); font-size: 1rem; margin: var(--s-5) 0 var(--s-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 20px; border: 1px solid transparent; border-radius: 8px;
  font-size: 0.9375rem; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: transform .18s var(--out-quart), background .18s, color .18s;
}
.btn--accent { background: var(--accent); color: var(--accent-on); }
.btn--ink { background: var(--ink); color: var(--surface); }
.btn--ghost { background: none; border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); }
.btn:hover { transform: translateY(-1px); }
.btn--sm { min-height: 34px; padding: 0 13px; font-size: 0.875rem; border-radius: 7px; }
.btn--block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font-size: 0.875rem; color: var(--accent); text-decoration: underline; }
.linkbtn:hover { color: var(--ink); }
.linkbtn--bad { color: var(--bad); }
.muted { color: var(--muted); }
.sub { display: block; font-size: 0.75rem; color: var(--muted); }

/* ---------- notes ---------- */
.note { padding: 13px 16px; border-radius: 10px; margin-bottom: var(--s-5); font-size: 0.9375rem; border: 1px solid var(--line); background: var(--surface); }
.note--ok   { background: oklch(95% 0.06 155); border-color: oklch(85% 0.09 155); }
.note--warn { background: oklch(96% 0.07 85); border-color: oklch(87% 0.11 85); }
.note--bad  { background: oklch(96% 0.04 25); border-color: oklch(85% 0.09 25); }
.note ul { margin: 8px 0 0; padding-left: 18px; }
.noteform { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); }

/* ---------- figures strip ---------- */
.figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--surface); margin-bottom: var(--s-6);
}
.figure { padding: var(--s-4) var(--s-5); border-right: 1px solid var(--line); }
.figure:last-child { border-right: 0; }
.figure__k { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.figure__v { font-family: var(--display); font-size: 1.75rem; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; }
.figure__v em { font-family: var(--sans); font-size: 0.75rem; font-style: normal; color: var(--muted); font-weight: 400; }
.figure__v--sm { font-size: 1.125rem; }

/* ---------- cards + layout ---------- */
.twocol { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); align-items: start; }
.twocol--wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 960px) { .twocol, .twocol--wide { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: var(--s-5); }
.card--quiet { background: none; }
.card h2 { font-size: 1.125rem; margin-bottom: var(--s-4); }
.card h2 + h2 { margin-top: var(--s-6); }
.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); }
.cardhead h2 { margin: 0; }

/* ---------- tables ---------- */
.grid { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.grid th {
  text-align: left; font-size: 0.75rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; padding: 0 var(--s-3) 10px; border-bottom: 1px solid var(--line-strong);
}
.grid td { padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .end { text-align: right; }
.grid .is-zero { color: var(--bad); font-weight: 600; }
.grid tbody tr:hover { background: var(--shade); }
.grid--products td:first-child { min-width: 240px; }
.rowitem { display: flex; align-items: center; gap: var(--s-3); }
.rowitem__thumb { width: 46px; height: 46px; border-radius: 8px; overflow: hidden; background: var(--tile, var(--shade)); flex: none; }
.rowitem__thumb img { width: 100%; height: 100%; object-fit: cover; }
.rowitem__name { font-weight: 500; text-decoration: none; }
.rowitem__name:hover { text-decoration: underline; }
.rowacts { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: flex-end; align-items: center; }
.rowacts form { display: contents; }
@media (max-width: 760px) {
  .grid thead { display: none; }
  .grid tr { display: grid; gap: 6px; padding: var(--s-4) 0; border-bottom: 1px solid var(--line); }
  .grid td { border: 0; padding: 0; }
  .grid .num, .grid .end { text-align: left; }
  .rowacts { justify-content: flex-start; }
}

.chip {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 0.6875rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600;
  background: var(--shade); color: var(--ink-soft);
}
.chip--new { background: oklch(93% 0.09 85); color: oklch(38% 0.11 70); }
.chip--confirmed { background: oklch(93% 0.08 155); color: oklch(38% 0.1 155); }
.chip--packed { background: var(--accent-tint); color: oklch(38% 0.14 262); }
.chip--shipped { background: oklch(92% 0.07 200); color: oklch(36% 0.1 220); }
.chip--completed { background: var(--ink); color: var(--surface); }
.chip--cancelled { background: oklch(94% 0.05 25); color: oklch(44% 0.14 25); }
.chip--pick { background: oklch(93% 0.07 330); color: oklch(42% 0.16 330); }

.factlist { margin: 0; }
.factlist > div { display: flex; justify-content: space-between; gap: var(--s-4); padding: 8px 0; border-bottom: 1px dotted var(--line-strong); font-size: 0.875rem; }
.factlist dt { color: var(--muted); }
.factlist dd { margin: 0; text-align: right; }
.ticklist { margin: 0; padding-left: 18px; font-size: 0.875rem; color: var(--ink-soft); }
.ticklist li { margin-bottom: 5px; }
.attention { list-style: none; margin: 0 0 var(--s-5); padding: 0; }
.attention li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 9px 0; border-bottom: 1px solid var(--line); }

/* ---------- tabs, filter bar ---------- */
.tabs { display: flex; gap: var(--s-2); overflow-x: auto; margin-bottom: var(--s-5); padding-bottom: 4px; }
.tab { padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.875rem; text-decoration: none; white-space: nowrap; }
.tab span { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.75rem; }
.tab.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tab.is-on span { color: oklch(78% 0.02 264); }
.filterbar { display: flex; gap: var(--s-3); align-items: center; margin-bottom: var(--s-5); }
.filterbar input { flex: 1; max-width: 420px; min-height: 42px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; }

/* ---------- forms ---------- */
.itemform { display: grid; gap: var(--s-5); }
.field { display: grid; gap: 6px; margin-bottom: var(--s-4); }
.field > span { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.field em { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .75; }
.field input, .field textarea, .field select {
  min-height: 42px; padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; transition: border-color .15s;
}
.field textarea { min-height: auto; resize: vertical; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--ink-soft); }
.field.has-error input, .field.has-error textarea { border-color: var(--bad); background: oklch(97% 0.03 25); }
.field2 { display: grid; gap: var(--s-4); grid-template-columns: 1fr 1fr; }
.field3 { display: grid; gap: var(--s-4); grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .field2, .field3 { grid-template-columns: 1fr; } }
.toggles { display: flex; flex-wrap: wrap; gap: var(--s-5); margin-top: var(--s-2); }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 0.9375rem; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.formbar { display: flex; align-items: center; gap: var(--s-4); padding-top: var(--s-2); }
.statusform { display: grid; gap: var(--s-3); width: 100%; min-width: 0; }
.statusform .field { margin: 0; min-width: 0; }
.statusform .field input, .statusform .field select { width: 100%; min-width: 0; }
.statusform .btn, .order__acts > .btn { width: 100%; white-space: normal; text-align: center; }
.statusform .trackingfield input { min-width: 0; }
@media (max-width: 860px) { .statusform { width: 100%; } }

.logopick { border: 0; padding: 0; margin: var(--s-4) 0; display: grid; gap: var(--s-3); grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .logopick { grid-template-columns: 1fr; } }
.logopick legend { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-3); }
.radiocard { display: flex; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; background: var(--surface); transition: border-color .18s, background .18s; }
.radiocard:hover { border-color: var(--ink-soft); }
.radiocard:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.radiocard input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 3px; }
.radiocard__body { display: grid; gap: 8px; }
.radiocard__body strong { font-size: 0.9375rem; }
.radiocard__body em { font-style: normal; font-size: 0.8125rem; color: var(--muted); }
.radiocard input[type="text"], .radiocard input[type="file"] { min-height: 38px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 0.875rem; }
.logopreview { display: block; padding: 10px; background: var(--shade); border-radius: 8px; }
.logopreview img { max-height: 46px; width: auto; }

.pwwrap { position: relative; display: block; }
.pwwrap input { width: 100%; }
.pwtoggle { position: absolute; right: 6px; top: 50%; translate: 0 -50%; background: none; border: 0; padding: 6px 10px; cursor: pointer; font-size: 0.8125rem; color: var(--accent); }
.meter { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 0.75rem; color: var(--muted); }
.meter__bar { flex: 1; height: 5px; border-radius: 999px; background: var(--shade); overflow: hidden; position: relative; }
.meter__bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--fill, 0%); background: var(--meter, var(--warn)); transition: width .3s var(--out-quart), background .3s; }
.meter em { font-style: normal; }

/* ---------- uploads ---------- */
.dropzone {
  display: grid; gap: 6px; place-items: center; text-align: center;
  padding: var(--s-6); border: 2px dashed var(--line-strong); border-radius: 12px;
  cursor: pointer; background: var(--surface); transition: border-color .2s, background .2s;
}
.orline {
  display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0;
  color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
}
.orline::before, .orline::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.dropzone:hover, .dropzone.is-hot { border-color: var(--accent); background: var(--accent-tint); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone__label { font-size: 0.9375rem; }
.dropzone__hint { font-size: 0.8125rem; color: var(--muted); }
.dropzone.has-error { border-color: var(--bad); }
.previews { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); }
.previews figure { margin: 0; width: 104px; }
.previews img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--shade); }
.previews figcaption { font-size: 0.6875rem; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.imggrid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.imggrid li { position: relative; }
.imggrid img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--shade); }
.imggrid__acts { position: absolute; top: 8px; left: 8px; }
.imgtools { display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.imgtool { display: flex; align-items: center; gap: var(--s-4); font-size: 0.8125rem; padding: 7px 0; border-bottom: 1px dotted var(--line-strong); }
.imgtool code { margin-right: auto; }

.media { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media__item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.media__item img { aspect-ratio: 4 / 3; object-fit: cover; background: var(--shade); }
.media__meta { padding: var(--s-3); display: grid; gap: 6px; justify-items: start; }

/* ---------- orders ---------- */
.orderstack { display: grid; gap: var(--s-3); }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.order[open] { border-color: var(--line-strong); }
.order summary {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) 130px 100px 110px; gap: var(--s-3);
  align-items: center; padding: var(--s-4); cursor: pointer; list-style: none;
}
.order summary::-webkit-details-marker { display: none; }
.order summary:hover { background: var(--shade); }
.order__ref { font-family: ui-monospace, Menlo, monospace; font-size: 0.8125rem; }
.order__who em { display: block; font-style: normal; font-size: 0.75rem; color: var(--muted); }
.order__when { font-size: 0.8125rem; color: var(--muted); }
.order__tot { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .order summary { grid-template-columns: 1fr 1fr; } }
.order__body { padding: 0 var(--s-4) var(--s-5); border-top: 1px solid var(--line); }
.order__grid { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); margin-top: var(--s-4); }
@media (max-width: 860px) { .order__grid { grid-template-columns: 1fr; } }
.order__acts { display: grid; gap: var(--s-3); align-content: start; min-width: 0; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: var(--s-7) var(--s-4); max-width: 44ch; margin-inline: auto; }
.empty__title { font-family: var(--display); font-size: 1.25rem; font-weight: 600; }
.empty__text { color: var(--muted); margin: 8px 0 var(--s-4); font-size: 0.9375rem; }

/* ---------- login gate ---------- */
body.gate { min-height: 100vh; display: grid; place-items: center; padding: var(--s-5); position: relative; overflow: hidden; background: oklch(96% 0.014 330); }
.gate__art { position: absolute; inset: 0; pointer-events: none; }
.gate__blob { position: absolute; border-radius: 50%; filter: blur(2px); }
.gate__blob--1 { width: 46vw; height: 46vw; background: oklch(88% 0.13 340); top: -14vw; left: -10vw; }
.gate__blob--2 { width: 34vw; height: 34vw; background: oklch(90% 0.14 95); bottom: -12vw; right: -8vw; }
.gate__blob--3 { width: 22vw; height: 22vw; background: oklch(86% 0.11 210); bottom: 18vh; left: 12vw; }
.gate__card {
  position: relative; width: min(430px, 100%); background: oklch(99.5% 0.004 330);
  border: 1px solid oklch(88% 0.02 330); border-radius: 18px; padding: clamp(24px, 5vw, 40px);
  box-shadow: 0 24px 60px oklch(30% 0.06 330 / 0.14);
}
.gate__kicker { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.gate__card h1 { font-size: 1.75rem; margin: var(--s-3) 0 var(--s-5); }
.gate__card .btn { margin-top: var(--s-2); }
.gate__hint { margin-top: var(--s-5); padding: 12px 14px; background: oklch(95% 0.05 85); border-radius: 10px; font-size: 0.8125rem; }
.gate__back { display: block; margin-top: var(--s-5); font-size: 0.875rem; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

.category-manager { max-width: 860px; }
.category-add, .category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: end; }
.category-add .field, .category-row .field { margin: 0; }
.category-list { display: grid; gap: var(--s-3); }
.category-row { padding-block: var(--s-3); border-bottom: 1px solid var(--line); }
.category-row:last-child { border-bottom: 0; }
@media (max-width: 620px) {
  .category-add, .category-row { grid-template-columns: 1fr; }
  .category-add .btn, .category-row .btn { width: 100%; }
}
