:root {
  /* Layout: segmented tabs (Customer view / Seller setup). Customer view = item list and details on the left, order summary plus a live WhatsApp message preview on the right; stacks on phones. */
  --bg: #F1F5F2;
  --surface: #FFFFFF;
  --ink: #14201B;
  --muted: #586861;
  --line: #D3DDD7;
  --accent: #0E7A55;
  --accent-ink: #FFFFFF;
  --chat-bg: #E4ECE7;
  --bubble: #D9F2E2;
  --bubble-ink: #10261C;
  --warn: #A8461A;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1714;
    --surface: #17221D;
    --ink: #E6EFEA;
    --muted: #93A59B;
    --line: #27362F;
    --accent: #3DDC97;
    --accent-ink: #06251A;
    --chat-bg: #0B1210;
    --bubble: #164633;
    --bubble-ink: #DDF5E7;
    --warn: #F0A06F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1714;
  --surface: #17221D;
  --ink: #E6EFEA;
  --muted: #93A59B;
  --line: #27362F;
  --accent: #3DDC97;
  --accent-ink: #06251A;
  --chat-bg: #0B1210;
  --bubble: #164633;
  --bubble-ink: #DDF5E7;
  --warn: #F0A06F;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding-inline: 16px;
  padding-block: 24px 56px;
}
.wrap { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.top { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin: 6px 0 8px; text-wrap: balance; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.2; margin: 0; text-wrap: balance; }
h3 { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }
p { margin: 0; }
.lede { color: var(--muted); max-width: 54ch; }
.muted { color: var(--muted); }

.tabs { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tab { font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 24px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.aside { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); }
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.shop-line { display: flex; flex-direction: column; gap: 4px; }
.shop-line .muted { font-size: 14px; }

/* items */
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item-name { font-weight: 600; }
.item-note { font-size: 13px; color: var(--muted); }
.item-price { font-variant-numeric: tabular-nums; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.step:hover { border-color: var(--accent); }
.qty { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 520px) {
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .item .stepper { grid-column: 1 / -1; }
}
.empty { color: var(--muted); }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .legend { font-weight: 500; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 72px; }
input:focus-visible, textarea:focus-visible, .btn:focus-visible, .tab:focus-visible, .step:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.radios label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

/* summary */
.sum-line { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.sum-line span:first-child { min-width: 0; overflow-wrap: anywhere; }
.sum-lines { display: flex; flex-direction: column; gap: 6px; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; font-family: var(--font-display); font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; }
.problem { font-size: 13px; color: var(--warn); min-height: 1.4em; }
.btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: 14px 16px; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; text-align: center; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btns { display: flex; flex-direction: column; gap: 8px; }
.email-wrap { font-size: 13px; color: var(--muted); }
.email-wrap a { color: var(--accent); font-weight: 500; }
.status { font-size: 13px; color: var(--muted); min-height: 1.4em; }

/* chat preview */
.chat { background: var(--chat-bg); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-head { font-family: var(--font-mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.bubble { background: var(--bubble); color: var(--bubble-ink); padding: 12px 14px; border-radius: 12px 12px 2px 12px; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.placeholder { opacity: 0.7; }

/* setup */
.prow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) auto; gap: 10px; align-items: end; padding: 14px 0; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; padding-top: 0; }
.prow label { font-size: 12px; color: var(--muted); }
.rm { height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.rm:hover { border-color: var(--warn); color: var(--warn); }
@media (max-width: 680px) {
  .prow { grid-template-columns: minmax(0, 1fr) auto; }
  .prow .f-name, .prow .f-note { grid-column: 1 / -1; }
}
.inline-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-btns .btn { width: auto; padding: 10px 16px; }
.note { font-size: 14px; color: var(--muted); max-width: 62ch; }

.item-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; background: var(--chat-bg); display: block; }
.thumb.ph { border: 1px dashed var(--line); }
.small { font-size: 13px; }
.f-photo { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.btn.sm { width: auto; padding: 8px 14px; font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* standalone page additions */
:root { color-scheme: light; }
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--accent); }
.keybox { font-family: var(--font-mono); font-size: 14px; background: var(--chat-bg); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.linkrow { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.linkrow a { overflow-wrap: anywhere; font-weight: 600; }
.warnbox { color: var(--warn); font-size: 14px; }
.foot { text-align: center; font-size: 13px; color: var(--muted); }
