/* hellocoffee design system: tokens + base components shared by the buyer screen, the seller app and the admin portal.
   Source of truth. scripts/sync-ui.mjs copies it into each app (and inlines it into the in-chat screen). */
:root {
  --espresso: #30160d; --roast: #52301f; --bean: #865539;
  --brand-cream: #fff4e7; --brand-highlight: #e6ad80;
  --accent: #754627; --accent-strong: #54301d; --accent-soft: #f5e4d4; --on-accent: #fff;
  --bg: #faf3e9; --surface: #fffdfa; --surface-2: #f5eadc; --surface-3: #eadccd; --line: #e9dcce; --line-strong: #d3bcaa;
  --text: #301c13; --text-2: #553c2f; --muted: #735c4b;
  --success: #2f8a57; --success-bg: #e5f3eb; --warn: #a8690f; --warn-bg: #fcf1dc; --danger: #c2413a; --danger-bg: #fbe9e7; --info: #2e6fd8; --info-bg: #e7effc;
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(43, 26, 18, .06); --sh-2: 0 2px 6px rgba(43, 26, 18, .06), 0 10px 28px rgba(43, 26, 18, .08); --sh-3: 0 18px 50px rgba(43, 26, 18, .22);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #e2ab80; --accent-strong: #f4c6a2; --accent-soft: #402b20; --on-accent: #26140c;
    --bg: #1b120e; --surface: #241a15; --surface-2: #2c2019; --surface-3: #37291f; --line: #3a3029; --line-strong: #4d4037;
    --text: #f4eee8; --text-2: #dcd1c6; --muted: #ad9f92;
    --success: #5cc48a; --success-bg: #173324; --warn: #e9b04f; --warn-bg: #3a2c12; --danger: #f07a72; --danger-bg: #3d1c19; --info: #7aa7f5; --info-bg: #182641;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .3); --sh-2: 0 2px 8px rgba(0, 0, 0, .35), 0 12px 30px rgba(0, 0, 0, .3); --sh-3: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #e2ab80; --accent-strong: #f4c6a2; --accent-soft: #402b20; --on-accent: #26140c;
  --bg: #1b120e; --surface: #241a15; --surface-2: #2c2019; --surface-3: #37291f; --line: #3a3029; --line-strong: #4d4037;
  --text: #f4eee8; --text-2: #dcd1c6; --muted: #ad9f92;
  --success: #5cc48a; --success-bg: #173324; --warn: #e9b04f; --warn-bg: #3a2c12; --danger: #f07a72; --danger-bg: #3d1c19; --info: #7aa7f5; --info-bg: #182641;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .3); --sh-2: 0 2px 8px rgba(0, 0, 0, .35), 0 12px 30px rgba(0, 0, 0, .3); --sh-3: 0 18px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 800; } h2 { font-size: 18px; font-weight: 750; } h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-strong); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; } .strong { font-weight: 700; } .mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 8px; } .row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; align-content: start; } .stack.tight { gap: 6px; } .stack.loose { gap: 20px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price { font-weight: 750; font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; } .icon.lg { width: 22px; height: 22px; }

/* The cup stays espresso brown on its cream tile in both themes. */
.hc-mark { display: inline-block; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--brand-cream) var(--hc-icon, url('./brand-icon.png')) center / 72% no-repeat; }
.hc-mark-lg { width: 52px; height: 52px; border-radius: 16px; }
.hc-logo { width: 92px; height: 92px; object-fit: contain; padding: 9px; border-radius: 20px; background: var(--brand-cream); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r); border: 1px solid transparent; font-weight: 650; cursor: pointer; transition: transform .12s var(--ease), background .15s, box-shadow .15s, opacity .15s; text-decoration: none; white-space: nowrap; user-select: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -6px var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-dark { background: var(--espresso); color: #fff; }
:root[data-theme="dark"] .btn-dark { background: var(--surface-3); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 16px; border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; border-radius: var(--r); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.invalid { border-color: var(--danger); }
.input-prefix { position: relative; } .input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; } .input-prefix > .input { padding-left: 40px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; } .check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }

/* switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line-strong); transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card.pad { padding: 16px; } .card.pad-lg { padding: 22px; }
.card.hover { transition: box-shadow .2s, transform .2s var(--ease), border-color .2s; cursor: pointer; } .card.hover:hover { box-shadow: var(--sh-2); transform: translateY(-1px); border-color: var(--line-strong); }
.divider { height: 1px; background: var(--line); border: 0; margin: 4px 0; }
.section-title { font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* chips, pills, badges */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--accent); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.chip.off { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.chip .delta { color: var(--muted); font-weight: 500; font-size: 13px; }
.chip.off .delta:last-child { text-decoration: none; display: inline-block; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--success-bg); color: var(--success); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--danger-bg); color: var(--danger); } .pill.info { background: var(--info-bg); color: var(--info); } .pill.brand { background: var(--accent-soft); color: var(--accent-strong); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; color: var(--text-2); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.count.soft { background: var(--surface-3); color: var(--text-2); }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 650; font-size: 14px; color: var(--text-2); cursor: pointer; transition: all .15s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 9px 14px; border-radius: var(--r-pill); font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--espresso); color: #fff; }
:root[data-theme="dark"] .tab.on { background: var(--text); color: var(--bg); }

/* alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--info-bg); color: var(--text); font-size: 14px; }
.alert .icon { margin-top: 2px; color: var(--info); }
.alert.warn { background: var(--warn-bg); } .alert.warn .icon { color: var(--warn); }
.alert.bad { background: var(--danger-bg); } .alert.bad .icon { color: var(--danger); }
.alert.ok { background: var(--success-bg); } .alert.ok .icon { color: var(--success); }

/* overlays: backdrop, bottom sheet, drawer, modal */
.backdrop { position: fixed; inset: 0; background: rgba(20, 12, 8, .45); backdrop-filter: blur(2px); z-index: 50; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--sh-3); z-index: 51; animation: up .28s var(--ease); }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; }
@media (min-width: 720px) { .sheet { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 24px; border-radius: var(--r-xl); animation: pop .25s var(--ease); } .sheet .grip { display: none; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg); box-shadow: var(--sh-3); z-index: 51; display: flex; flex-direction: column; animation: slide .28s var(--ease); }
.drawer > header { padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 10px; }
.drawer > .body { flex: 1; overflow: auto; padding: 20px; align-content: start; }
.drawer > footer { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: 10px; justify-content: flex-end; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); z-index: 51; padding: 22px; animation: pop .22s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { opacity: 0; scale: .96; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* toast */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r); background: var(--espresso); color: #fff; box-shadow: var(--sh-3); font-weight: 600; font-size: 14px; animation: up .25s var(--ease); }
.toast.bad { background: var(--danger); } .toast.ok { background: var(--success); }

/* misc */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; stroke-width: 1.5; color: var(--line-strong); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; flex: none; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.code-tag { font-family: var(--mono); font-weight: 800; letter-spacing: .06em; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: ring 2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(47, 138, 87, .5); } 70% { box-shadow: 0 0 0 8px rgba(47, 138, 87, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 138, 87, 0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
