/* AZ POS — shared design tokens & components */
:root {
  --ink: #0F3D47;          /* ledger ink: rails, headers */
  --ink-2: #155563;
  --ink-soft: #D7E4E5;
  --paper: #FDFDFA;        /* thermal paper: bill, cards */
  --floor: #E9EDEC;        /* shop floor canvas */
  --line: #D3DAD9;
  --text: #17262A;
  --muted: #5E6F73;
  --turmeric: #F0A202;     /* the one primary action */
  --turmeric-ink: #2B1D00;
  --ok: #1E8A5A;
  --warn: #B86E00;
  --bad: #C4382C;
  --focus: #2D7FF9;
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --shadow: 0 1px 0 rgba(15, 61, 71, .06), 0 6px 18px -10px rgba(15, 61, 71, .35);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0B2E35; --ink-2: #134652; --ink-soft: #234B53; --paper: #18262A; --floor: #0F1A1D; --line: #2A3B3F;
    --text: #E6EEEE; --muted: #93A6A9; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #0B2E35; --ink-2: #134652; --ink-soft: #234B53; --paper: #18262A; --floor: #0F1A1D; --line: #2A3B3F;
  --text: #E6EEEE; --muted: #93A6A9; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.8); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--text); background: var(--floor); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--display); font-weight: 650; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
a { color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* buttons */
.btn { font: 600 .95rem var(--font); border: 1px solid var(--line); background: var(--paper); color: var(--text); padding: .6rem 1rem;
  border-radius: var(--r-s); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; text-decoration: none; }
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.charge { background: var(--turmeric); color: var(--turmeric-ink); border-color: #C98700; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: .3rem .65rem; font-size: .85rem; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; color: inherit; cursor: pointer; padding: .4rem; border-radius: var(--r-s); line-height: 0; }
.icon-btn:hover { background: rgba(127,127,127,.15); }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* fields */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-s); padding: .55rem .7rem; min-height: 42px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: 20px; min-height: 20px; height: 20px; padding: 0; flex: none; accent-color: var(--ink); }
input[type=color] { padding: 2px; }
.check { display: flex; gap: .5rem; align-items: center; margin-bottom: .7rem; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* pills */
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: var(--ink-soft); color: var(--ink); white-space: nowrap; }
.pill.ok { background: #D5EFE2; color: #0F5A39; } .pill.bad { background: #F7DAD6; color: #8A1F16; } .pill.warn { background: #FBE8C4; color: #6B4000; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; padding: .6rem .75rem; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; }
table.t td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: rgba(127,127,127,.06); }
table.t td.r, table.t th.r { text-align: right; }

/* modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(8, 24, 28, .55); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s ease-out; }
.modal { background: var(--paper); border-radius: var(--r-l); padding: 1.4rem; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.modal.wide { width: min(860px, 100%); }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: .65rem 1.1rem; border-radius: 99px; font-weight: 500; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast.error { background: var(--bad); } .toast.ok { background: var(--ok); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* banners */
.banner { padding: .55rem 1rem; font-weight: 500; font-size: .9rem; display: flex; gap: .75rem; align-items: center; }
.banner.warn { background: #FBE8C4; color: #5A3600; } .banner.bad { background: #F7DAD6; color: #7A1A12; }

/* auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.auth .card { background: var(--paper); border-radius: var(--r-l); padding: 2rem; width: min(420px, 100%); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--turmeric); color: var(--turmeric-ink); display: grid; place-items: center; font-weight: 800; }
.err { color: var(--bad); font-weight: 500; min-height: 1.3em; margin: .2rem 0 .6rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

.list-rows > div { display: flex; justify-content: space-between; gap: .6rem; padding: .4rem 0; border-bottom: 1px dotted var(--line); font-size: .92rem; }
.list-rows > div:last-child { border-bottom: 0; }
