/* ==========================================================================
   POS design system
   Themes are CSS variable sets selected with data-theme on <html>.
   ========================================================================== */

:root {
  --bg: #0b1020;
  --surface: #141a2e;
  --surface-2: #1c2440;
  --surface-3: #263055;
  --text: #eef2ff;
  --muted: #9aa6c7;
  --primary: #4f7cff;
  /* dark, not white: #fff on #4f7cff is only 3.7:1 and fails WCAG AA.
     The primary must stay light enough for link text on this dark bg. */
  --primary-contrast: #0b1020;
  --accent: #22d3ee;
  --border: #26304d;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

html[data-theme="daylight"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f0f3fa;
  --surface-3: #e3e9f5;
  --text: #16203a;
  --muted: #64708c;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --accent: #0891b2;
  --border: #dde4f0;
  --shadow: 0 10px 24px rgba(20, 35, 80, .10);
}

html[data-theme="graphite"] {
  --bg: #121212;
  --surface: #1c1c1c;
  --surface-2: #262626;
  --surface-3: #333333;
  --text: #f2f2f2;
  --muted: #a1a1a1;
  --primary: #d4d4d4;
  --primary-contrast: #171717;
  --accent: #f5a524;
  --border: #303030;
}

html[data-theme="sandstone"] {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #f2ebdd;
  --surface-3: #e6dcc8;
  --text: #3a3227;
  --muted: #857a67;
  --primary: #a45928;
  --primary-contrast: #fff8f0;
  --accent: #3f6f5f;
  --border: #e0d6c2;
}

html[data-theme="forest"] {
  --bg: #0c1512;
  --surface: #132220;
  --surface-2: #1b2e2a;
  --surface-3: #24403a;
  --text: #e8f3ee;
  --muted: #92b3a7;
  --primary: #34a06a;
  --primary-contrast: #06130d;
  --accent: #d9b44a;
  --border: #22403a;
}

html[data-theme="royal"] {
  --bg: #120f26;
  --surface: #1b1738;
  --surface-2: #251f4a;
  --surface-3: #322a5e;
  --text: #efeaff;
  --muted: #a89fd4;
  --primary: #a36cff;
  --primary-contrast: #0d0a1c;
  --accent: #f472b6;
  --border: #2c2553;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
small { color: var(--muted); }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.grow { flex: 1; }
.flex { display: flex; gap: .6rem; align-items: center; }
.flex-between { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
/* active state on a transparent button: --primary-contrast can be dark on
   light primaries (forest, graphite), so it must not be used as text here */
.btn-ghost.btn-primary { background: color-mix(in srgb, var(--primary) 16%, transparent); border-color: color-mix(in srgb, var(--primary) 55%, transparent); color: var(--text); }
.btn-ghost.btn-primary:hover { background: color-mix(in srgb, var(--primary) 28%, transparent); }
.btn-sm { padding: .3rem .6rem; font-size: .84rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-3); color: var(--text);
}
.badge-ok { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.badge-warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.badge-danger { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger); }
/* solid, not tinted: --primary as text over a 22% tint is only 3.4:1 */
.badge-info { background: var(--primary); color: var(--primary-contrast); }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.card-title { font-weight: 650; font-size: .95rem; }
.card-sub { color: var(--muted); font-size: .82rem; }

.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.6rem; font-weight: 680; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ forms */
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; font-weight: 550; }
input, select, textarea {
  width: 100%; padding: .55rem .7rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: .4rem; }
.field { margin-bottom: .8rem; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .2rem; }
.help { color: var(--muted); font-size: .78rem; margin-top: .2rem; }

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- sync status */
.sync-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.sync-status.online .sync-dot { background: var(--ok); }

/* -------------------------------------------------------- context switcher */
.context-switcher { display: flex; align-items: center; gap: .25rem; }
.context-switcher form { display: flex; }
.context-switcher select { padding: .3rem 1.6rem .3rem .5rem; font-size: .85rem; max-width: 190px; border-radius: var(--radius-sm); }
.context-item { padding: .3rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .85rem; white-space: nowrap; }
.context-sep { color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .8rem; display: flex; flex-direction: column; gap: .2rem; }
.brand { display: flex; align-items: center; gap: .55rem; padding: .3rem .5rem 1rem; font-weight: 700; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--primary-contrast); display: grid; place-items: center; font-size: .9rem; }
.brand-logo { height: 26px; width: auto; display: block; }
.nav-link { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--primary); font-weight: 600; }
.nav-section { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; margin: .9rem .6rem .3rem; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar h1 { margin: 0; font-size: 1.05rem; }
.content { padding: 1.1rem; flex: 1; }
.content-narrow { max-width: 1180px; }

/* ------------------------------------------------------------------- auth */
/* Two fixed columns: identity on the left, the auth card on the right.
   Everything derives from theme variables, so all 6 themes stay correct. */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.auth-brand {
  --auth-pad: clamp(1.6rem, 4vw, 3rem);
  background: var(--surface); border-right: 1px solid var(--border);
  padding: var(--auth-pad); display: flex; flex-direction: column; overflow: hidden;
}
.auth-tagline {
  font-family: var(--font-display); font-weight: 650;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem); line-height: 1.3; letter-spacing: -.01em;
  /* pairs with the tape's margin-top:auto so this block settles mid-panel */
  margin: auto 0 0; max-width: 24ch;
}
.auth-facts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.auth-fact { font-size: .8rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: .25rem .7rem; }
.auth-panel { display: grid; place-items: center; padding: 1.5rem; min-width: 0; }
.auth-card { width: 100%; max-width: 400px; }
.auth-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); }

/* receipt tape — the single moving element on the auth pages.
   Rows crawl one 54px tile period so the loop is seamless; the conic
   mask cuts the torn zigzag along the bottom edge. */
.receipt-tape {
  position: relative; overflow: hidden;
  margin: auto calc(-1 * var(--auth-pad)) calc(-1 * var(--auth-pad));
  height: 120px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-2));
  border-top: 1px solid var(--border);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100% repeat-x;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100% repeat-x;
}
.receipt-tape::before {
  content: "";
  position: absolute; top: 12px; bottom: 18px; left: 0; right: -54px;
  background:
    repeating-linear-gradient(90deg, var(--surface-3) 0 40px, transparent 40px 54px) 0 0/54px 6px repeat-x,
    repeating-linear-gradient(90deg, var(--surface-3) 0 24px, transparent 24px 54px) 14px 18px/54px 6px repeat-x,
    repeating-linear-gradient(90deg, var(--surface-3) 0 48px, transparent 48px 54px) 6px 36px/54px 6px repeat-x,
    repeating-linear-gradient(90deg, var(--surface-3) 0 32px, transparent 32px 54px) 22px 54px/54px 6px repeat-x,
    repeating-linear-gradient(90deg, var(--surface-3) 0 44px, transparent 44px 54px) 10px 72px/54px 6px repeat-x;
  animation: receipt-crawl 14s linear infinite;
}
@keyframes receipt-crawl { to { transform: translateX(-54px); } }

/* -------------------------------------------------------------------- pos */
.pos { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.pos-body { display: grid; grid-template-columns: 1fr 400px; grid-template-rows: minmax(0, 1fr); flex: 1; min-height: 0; }
.pos-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pos-content { flex: 1; overflow-y: auto; padding: .9rem; }
.pos-bar { display: flex; gap: .6rem; align-items: center; padding: .7rem .9rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.pos-bar-sub { padding: .4rem .9rem; background: var(--surface-2); font-size: .85rem; }
.pos-bar-sub label { margin: 0; white-space: nowrap; }
.pos-bar-sub select { padding: .3rem .5rem; }
.pos-search { flex: 1 1 280px; min-width: 200px; font-size: 1rem; padding: .6rem .8rem; }
.cart-loader { display: flex; gap: .3rem; align-items: center; white-space: nowrap; }
.pos-bar .badge { white-space: nowrap; }
.pos-bar select { max-width: 170px; }
.member-info { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .55rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: .84rem; }
.member-info.hidden { display: none; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chip { padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: .84rem; }
.chip.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .7rem; cursor: pointer; text-align: left; color: inherit; font: inherit;
  display: flex; flex-direction: column; gap: .2rem; min-height: 92px;
}
.product-card:hover { border-color: var(--primary); background: var(--surface-2); }
.product-card .name { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.product-card .price { font-family: var(--mono); color: var(--primary); font-weight: 650; }
.product-card .stock { font-size: .74rem; color: var(--muted); }
.product-card.out { opacity: .5; }
.cart { display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); min-width: 0; min-height: 0; overflow: hidden; }
.cart.disabled { opacity: .45; pointer-events: none; filter: saturate(.4); }
.cart.disabled::after { content: ''; }
.cart-head { padding: .8rem .9rem; border-bottom: 1px solid var(--border); }
.cart-lines { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .5rem .6rem; }
.cart-lines::-webkit-scrollbar { width: 9px; }
.cart-lines::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 5px; }
.cart-lines::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
.cart-lines::-webkit-scrollbar-thumb:hover { background: var(--border); }
.cart-totals, .cart-actions { flex: 0 0 auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .3rem; padding: .45rem .2rem; border-bottom: 1px dashed var(--border); }
.cart-line .title { font-size: .88rem; font-weight: 550; }
.cart-line .meta { font-size: .76rem; color: var(--muted); }
.qty { display: inline-flex; align-items: center; gap: .25rem; }
.qty button { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; line-height: 1; }
.qty input { width: 52px; padding: .15rem .25rem; text-align: center; font-family: var(--mono); }
.cart-totals { padding: .8rem .9rem; border-top: 1px solid var(--border); }
.tot-row { display: flex; justify-content: space-between; font-size: .88rem; padding: .15rem 0; }
.tot-row.grand { font-size: 1.25rem; font-weight: 700; font-family: var(--mono); padding-top: .4rem; }
.cart-actions { padding: .8rem .9rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .5rem; }
.cash-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; }
.payment-row { display: flex; gap: .3rem; align-items: center; margin-bottom: .3rem; }
.cash-grid button { padding: .4rem .2rem; font-family: var(--mono); font-size: .82rem; white-space: nowrap; }

/* ---------------------------------------------------------------- display */
.display { height: 100vh; display: flex; flex-direction: column; padding: 2rem; overflow: hidden; }
.display-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--border); padding-bottom: 1rem; }
.display-lines { flex: 1 1 auto; min-height: 0; padding: 1rem 0; overflow-y: auto; overscroll-behavior: contain; }
.display-lines::-webkit-scrollbar { width: 12px; }
.display-lines::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 6px; }
.display-lines::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
.display-totals { flex: 0 0 auto; }
.display-line { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: 1.25rem; }
.display-name { display: flex; align-items: center; gap: .7rem; }
.display-name img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.display-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 3px solid var(--border); padding-top: 1rem; font-size: 2.4rem; font-weight: 750; font-family: var(--mono); }
.display-empty { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; color: var(--muted); font-size: 1.2rem; }

/* ------------------------------------------------- price and stock tables */
.price-form, .stock-form { gap: .3rem; }
.price-form input { flex: 0 0 110px; width: auto; }
.stock-form input, .stock-form select { flex: 0 0 auto; width: auto; }
.stock-form input[name="qty"] { flex: 0 0 72px; }
.stock-form input[name="low_stock_at"] { flex: 0 0 72px; }
.stock-form input[name="cost"] { flex: 0 0 104px; }
.stock-form input, .stock-form select { padding: .35rem .45rem; font-size: .9rem; }
.stock-form input[type="number"]::-webkit-outer-spin-button,
.stock-form input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stock-form input[type="number"] { -moz-appearance: textfield; }
.stock-form input[type="text"] { flex: 0 0 80px; }
.stock-form select { flex: 0 0 100px; }

/* ---------------------------------------------------------- customer picker */
.customer-picker { position: relative; }
.customer-suggestions { position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 30; min-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden; }
.customer-suggestion { display: block; width: 100%; text-align: left; padding: .45rem .6rem; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: .84rem; }
.customer-suggestion:hover { background: var(--surface-2); }
.customer-suggestion:last-child { border-bottom: 0; }

/* ------------------------------------------------------------- split bills */
.bill-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .5rem; }
.bill-tab { padding: .25rem .5rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: .78rem; }
.bill-tab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); font-weight: 600; }
.bill-tab.add { border-style: dashed; }
.bill-select { padding: .1rem .3rem; font-size: .74rem; max-width: 90px; }

/* -------------------------------------------------------------- discounts */
.disc-btn { padding: .1rem .35rem; font-size: .74rem; margin-top: .15rem; }
.cart-line .disc { color: var(--accent); font-weight: 600; }
.disc-modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; margin-bottom: .8rem; }
.disc-mode { padding: .45rem .5rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: .85rem; }
.disc-mode.active { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); font-weight: 600; }

/* ----------------------------------------------------------------- photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; }
.photo-item { display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem; background: var(--surface-2); }
.photo-item img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; background: var(--surface-3); }

.product-card.with-image { padding: 0; overflow: hidden; }
.product-card.with-image .photo { width: 100%; height: 96px; object-fit: cover; background: var(--surface-3); display: block; }
.product-card.with-image .photo.placeholder { background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); }
.product-card.with-image .info { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.product-list img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.product-list td { vertical-align: middle; }

/* ------------------------------------------------------------------ misc */
.alert { padding: .6rem .8rem; border-radius: var(--radius-sm); margin-bottom: .9rem; border: 1px solid; }
.alert-ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.alert-danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.alert-info { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
.alert-warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 8, 20, .62); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.1rem; }
.modal-foot { padding: .9rem 1.1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; }

.toast { position: fixed; right: 1rem; bottom: 1rem; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .9rem; box-shadow: var(--shadow); z-index: 80; }
.toast.error { border-color: var(--danger); color: var(--danger); }

.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.spark div { flex: 1; background: color-mix(in srgb, var(--primary) 55%, transparent); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.spark div:hover { background: var(--primary); }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: .3rem .8rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tab { padding: .45rem .8rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.tab:hover { text-decoration: none; color: var(--text); }

/* --------------------------------------------------------------- landing */
.landing { min-height: 100vh; overflow-x: hidden; }
.landing h1, .landing h2, .landing h3, .landing .kicker, .landing .step-num,
.landing .price-tag, .landing .proof-item strong { font-family: var(--font-display); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--primary-contrast); padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0; z-index: 90; }
.skip-link:focus { left: 0; }

/* nav */
.landing-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 5vw;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}
.landing-nav.stuck { border-bottom-color: var(--border); background: color-mix(in srgb, var(--bg) 94%, transparent); }
.landing-nav .brand { padding: 0; }
.nav-actions { flex-wrap: wrap; justify-content: flex-end; }
.nav-anchor { display: none; }
@media (min-width: 1040px) { .nav-anchor { display: inline-flex; } }

/* hero */
.hero { position: relative; padding: 3.5rem 5vw 1rem; max-width: 1180px; margin: 0 auto; text-align: center; }
.hero-canvas { position: absolute; left: 0; top: 30px; width: 100%; height: 560px; z-index: 0; pointer-events: none; opacity: .62;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 62%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 62%, transparent); }
.hero-inner { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; }
/* keeps the headline readable while the boxes drift behind it */
.hero-inner::before { content: ''; position: absolute; inset: -30px -60px; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 80%, transparent) 0%, transparent 72%); }
.hero-inner h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); letter-spacing: -.02em; line-height: 1.08; }
.hero-inner p { font-size: 1.12rem; color: var(--muted); max-width: 640px; margin: 1rem auto 1.6rem; }
.hero-cta { justify-content: center; flex-wrap: wrap; }
.glow { box-shadow: 0 10px 34px color-mix(in srgb, var(--primary) 42%, transparent); }
.glow:hover { box-shadow: 0 12px 40px color-mix(in srgb, var(--primary) 55%, transparent); }

/* theme switcher */
.hero-stage { position: relative; z-index: 1; margin-top: 2.6rem; }
.theme-switch { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-bottom: .9rem; flex-wrap: wrap; }
.theme-switch-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-right: .2rem; }
.theme-dot { width: 26px; height: 26px; padding: 3px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; transition: transform .15s ease, border-color .15s ease; }
.theme-dot i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--primary); }
.theme-dot[data-theme-set="daylight"] i { background: #2563eb; }
.theme-dot[data-theme-set="graphite"] i { background: #d4d4d4; }
.theme-dot[data-theme-set="sandstone"] i { background: #a45928; }
.theme-dot[data-theme-set="forest"] i { background: #34a06a; }
.theme-dot[data-theme-set="royal"] i { background: #a36cff; }
.theme-dot:hover { transform: scale(1.12); }
.theme-dot[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.theme-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* mockups shared */
.mock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-align: left; }
.mock-bar { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid var(--border); font-size: .84rem; background: var(--surface); }
.mock-bar-title { font-family: var(--font-display); }
.mock-search { display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mock-input { flex: 1 1 200px; padding: .45rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: .86rem; }
.mock-body { display: grid; grid-template-columns: 1fr 300px; }
.mock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; padding: .7rem; align-content: start; }
.mock .product-card.with-image { background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); }
.mock .product-card { min-height: 84px; }
/* five payment keys do not fit the narrow mock cart, two rows read better */
.mock .cash-grid { grid-template-columns: repeat(3, 1fr); }
.mock-pos { max-width: 1020px; margin: 0 auto; }

/* customer display mockup */
.mock-display { max-width: 470px; margin: 0 auto; }
.mock-display .display-lines { padding: .5rem .9rem; }
.mock-display .display-line { font-size: .98rem; padding: .4rem 0; }
.mock-display .display-name img { width: 32px; height: 32px; }
.mock-display .display-total { font-size: 1.7rem; padding: .6rem .9rem .8rem; margin: 0; border-top: 2px solid var(--border); }

/* receipt + invoice mockup */
.mock-print { display: grid; grid-template-columns: 205px 1fr; gap: 1rem; align-items: center; background: transparent; border: 0; box-shadow: none; overflow: visible; }
.receipt { background: #fcfcfa; color: #171717; font-family: var(--mono); font-size: .7rem; line-height: 1.45; padding: .9rem .8rem 1rem; border-radius: 3px; box-shadow: var(--shadow); transform: rotate(-1.4deg); }
.rc-brand { font-weight: 700; text-align: center; font-size: .8rem; letter-spacing: .04em; }
.rc-sub { text-align: center; color: #6b6b6b; font-size: .62rem; margin-bottom: .5rem; }
.rc-line { display: flex; justify-content: space-between; gap: .5rem; padding: .1rem 0; border-bottom: 1px dashed #d9d9d2; }
.rc-disc { color: #b45309; }
.rc-total { display: flex; justify-content: space-between; font-weight: 700; font-size: .8rem; padding: .35rem 0 .1rem; border-top: 2px solid #171717; margin-top: .3rem; }
.rc-barcode { height: 24px; margin-top: .55rem; background: repeating-linear-gradient(90deg, #171717 0 2px, transparent 2px 4px, #171717 4px 5px, transparent 5px 9px); }
.mock-invoice { background: var(--surface); }

/* z report mockup */
.mock-report { max-width: 470px; margin: 0 auto; }
.report-foot { border-top: 1px solid var(--border); margin-top: .5rem; padding-top: .5rem; }

/* org + recipe mockup */
.mock-org { max-width: 470px; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.org-row { display: flex; align-items: center; gap: .5rem; }
.org-arrow { color: var(--muted); }
.mock-recipe { background: transparent; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: .7rem 0 0; margin-top: .3rem; }
.recipe-line { display: flex; justify-content: space-between; font-size: .86rem; padding: .2rem 0; border-bottom: 1px dashed var(--border); }

/* proof strip */
.proof { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; max-width: 1100px; margin: 0 auto; padding: 1.6rem 5vw 2.2rem; }
.proof-item { display: flex; flex-direction: column; gap: .1rem; padding: .75rem 1rem; border-left: 2px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 11%, transparent), transparent); }
.proof-item strong { font-size: .97rem; }
.proof-item span { color: var(--muted); font-size: .8rem; }

/* feature sections */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 2.6rem; align-items: center; max-width: 1100px; margin: 0 auto; padding: 2.6rem 5vw; }
.feature.flip .feature-copy { order: 2; }
.kicker { display: inline-block; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--primary); font-weight: 700; margin-bottom: .5rem; }
.feature-copy h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); letter-spacing: -.01em; }
.ticks { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.ticks li { position: relative; padding-left: 1.7rem; font-size: .95rem; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: .05rem; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); font-size: .7rem; font-weight: 700; display: grid; place-items: center; }

/* section shells */
.steps, .compare-section, .pricing, .faq { max-width: 1100px; margin: 0 auto; padding: 2.6rem 5vw; }
.section-head { max-width: 720px; margin: 0 auto 1.6rem; text-align: center; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.step-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); font-weight: 700; margin-bottom: .55rem; }

/* comparison table */
.compare-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.compare th[scope="row"] { color: var(--muted); text-transform: none; font-size: .86rem; }
.compare .ours { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.compare td.ours { font-weight: 600; }
.compare td { font-size: .9rem; vertical-align: top; }
.tick { color: var(--ok); font-weight: 700; }
.cross { color: var(--danger); opacity: .85; }

/* pricing */
.pricing { display: flex; justify-content: center; }
.price-card { text-align: center; max-width: 460px; width: 100%; padding: 1.7rem 1.5rem; }
.price-card .price-tag { font-size: 2rem; margin: .3rem 0 .4rem; letter-spacing: -.01em; }

/* faq */
.faq-list { display: flex; flex-direction: column; gap: .6rem; max-width: 800px; margin: 0 auto; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 1rem; }
.faq-item summary { cursor: pointer; padding: .85rem 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--primary); font-size: 1.25rem; font-weight: 700; line-height: 1; transition: transform .2s ease; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.faq-item p { margin: 0 0 .95rem; font-size: .93rem; }

/* closing cta */
.cta-band { padding: 3.4rem 5vw; text-align: center; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--primary) 13%, transparent)); }
.cta-inner { max-width: 660px; margin: 0 auto; }
.cta-inner h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.cta-inner .hero-cta { justify-content: center; }

/* footer */
.landing-foot { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding: 1.7rem 5vw; color: var(--muted); font-size: .85rem; }
.foot-brand { display: flex; gap: .65rem; align-items: center; }
.foot-brand strong { color: var(--text); display: block; }
.foot-contact { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.foot-label { text-transform: uppercase; font-size: .68rem; letter-spacing: .09em; }

/* scroll reveal (only when JS is on) */
.js [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s ease; }
.js [data-reveal].in { opacity: 1; transform: none; }

/* responsive */
@media (max-width: 880px) {
  /* auth pages: the brand panel becomes a compact header above the card */
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { border-right: 0; border-bottom: 1px solid var(--border); }
  .auth-tagline { font-size: 1.25rem; max-width: none; margin-top: .9rem; }
  .receipt-tape { height: 72px; }
  .feature { grid-template-columns: 1fr; gap: 1.6rem; padding: 2rem 5vw; }
  .feature.flip .feature-copy { order: 0; }
  .mock-body { grid-template-columns: 1fr; }
  .mock-cart { display: none; }
  .mock-print { grid-template-columns: 1fr; justify-items: center; }
  .receipt { transform: none; width: 100%; max-width: 250px; }
  .mock-display, .mock-report, .mock-org { max-width: 100%; }
  .hero-canvas { height: 420px; top: -40px; }
  /* the scrim must stay inside the viewport once the side padding shrinks */
  .hero-inner::before { inset: -30px -6px; }
}
@media (max-width: 640px) {
  .hero { padding-top: 2.2rem; }
  .landing-nav { flex-wrap: wrap; row-gap: .5rem; }
  .mock-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .proof { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .receipt-tape::before { animation: none; }
}

/* ----------------------------------------------------------------- print */
@media print {
  .no-print, .sidebar, .topbar, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .shell { box-shadow: none; border: 0; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; }
  .pos { height: auto; }
  .pos-body { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .pos-content { max-height: 60vh; }
  .cart-lines { max-height: 45vh; }
  .cart { border-left: 0; border-top: 1px solid var(--border); }
}

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