/* Tany merchant prototype — shared styles on top of ../brand/tokens.css.
   Direction: a café's back-office ledger. Crisp paper panels with hairlines, espresso ink,
   nile for anything measured, karkadeh only for the one action that matters on a screen. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--espresso);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--nile); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--nile); outline-offset: 2px; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.muted { color: var(--roast-700); }
.faint { color: var(--roast-500); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ico, .ico svg { width: 20px; height: 20px; flex: none; }

/* ---------- buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-control); padding: 9px 16px; font-weight: 600; font-size: var(--fs-sm);
  border: 1px solid var(--roast-300); background: var(--foam); color: var(--espresso);
  transition: background .15s, border-color .15s, transform .1s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--roast-500); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--karkadeh); border-color: var(--karkadeh); color: var(--foam); }
.btn-primary:hover { background: var(--karkadeh-deep); border-color: var(--karkadeh-deep); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--nile); padding-inline: 8px; }
.btn-quiet:hover { background: var(--nile-tint); border-color: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ico svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--espresso); }
.hint { font-size: var(--fs-xs); color: var(--roast-700); }
.input, .select, textarea.input {
  inline-size: 100%; border: 1px solid var(--roast-300); border-radius: var(--r-control);
  background: var(--foam); padding: 9px 12px; min-height: 42px;
}
.input:focus, .select:focus { border-color: var(--nile); outline: none; box-shadow: 0 0 0 3px var(--nile-tint); }

.seg { display: inline-flex; border: 1px solid var(--roast-300); border-radius: var(--r-control); background: var(--foam); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: var(--fs-sm); color: var(--roast-700); }
.seg button[aria-pressed="true"] { background: var(--espresso); color: var(--foam); }

.switch { position: relative; inline-size: 44px; block-size: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--roast-300); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 20px; block-size: 20px; border-radius: 50%; background: var(--foam); transition: transform .18s var(--ease-out); box-shadow: 0 1px 2px rgba(34,22,15,.25); }
.switch input:checked + span { background: var(--nile); }
.switch input:checked + span::after { transform: translateX(-18px); }
[dir="ltr"] .switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--nile); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--roast-300); border-radius: var(--r-control); background: var(--foam); }
.stepper button { inline-size: 40px; block-size: 40px; border: 0; background: none; font-size: 20px; color: var(--espresso); }
.stepper output { min-inline-size: 36px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); }

/* ---------- chips (state is shown by form, not only by number) ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); padding: 1px 10px; font-size: var(--fs-xs); font-weight: 600; line-height: 1.9; white-space: nowrap; background: var(--roast-100); color: var(--roast-700); }
.chip::before { content: ""; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.plain::before { display: none; }
.chip.tier-guest { background: var(--roast-100); color: var(--roast-700); }
.chip.tier-regular { background: var(--nile-tint); color: var(--nile); }
.chip.tier-family { background: var(--karkadeh-tint); color: var(--karkadeh-deep); }
.chip.seg-new { background: #EAF2FB; color: #2B5C8A; }
.chip.seg-regular { background: var(--nile-tint); color: var(--nile); }
.chip.seg-atrisk { background: #FBF1DF; color: #8A5A12; }
.chip.seg-lapsed { background: #FCE9E1; color: var(--error); }
.chip.seg-casual { background: var(--roast-100); color: var(--roast-700); }
.chip.st-live { background: var(--nile-tint); color: var(--nile); }
.chip.st-shipping { background: #FBF1DF; color: #8A5A12; }
.chip.st-ordered { background: var(--roast-100); color: var(--roast-700); }
.chip.st-scheduled { background: #FBF1DF; color: #8A5A12; }
.chip.st-sent { background: var(--nile-tint); color: var(--nile); }
.chip.st-auto { background: var(--roast-100); color: var(--roast-700); }

/* ---------- panels ---------- */
.panel { background: var(--foam); border: 1px solid var(--roast-300); border-radius: var(--r-panel); min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px 0; flex-wrap: wrap; }
.panel-h h3 { font-size: var(--fs-base); }
.panel-b { padding: 14px 18px 18px; }
.panel-f { border-top: 1px solid var(--roast-100); padding: 10px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* stamp row */
.stamps { display: flex; gap: 4px; align-items: center; }
.stamps svg { inline-size: 100%; block-size: auto; display: block; }
.stamps > span { flex: 1 1 0; min-inline-size: 0; max-inline-size: 30px; }
.stamps.sm > span { max-inline-size: 14px; }

/* layout helpers + callouts (shared) */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.callout { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--r-panel); background: var(--nile-tint); color: #0E4440; font-size: var(--fs-sm); }
.callout svg { inline-size: 20px; block-size: 20px; }
.callout.warn { background: #FBF1DF; color: #6E470E; }
.callout.k { background: var(--karkadeh-tint); color: var(--karkadeh-deep); }

/* toast */
.toast {
  position: fixed; inset-block-end: max(20px, env(safe-area-inset-bottom, 0px)); inset-inline-start: 50%; transform: translateX(50%);
  background: var(--espresso); color: var(--foam); padding: 10px 16px; border-radius: var(--r-control);
  font-size: var(--fs-sm); display: flex; gap: 10px; align-items: center; z-index: 60;
  box-shadow: var(--shadow-object); max-inline-size: calc(100vw - 32px);
}
[dir="ltr"] .toast { transform: translateX(-50%); }
.toast svg { inline-size: 18px; block-size: 18px; color: #9FD8C8; }

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