/* Laxis Apps: one stylesheet for the landing, signup and every store's app.
   Layout: single column, phone first; content max 34rem, centered on bigger screens.
   Store pages set --brand/--accent (and their ink colors) inline from the tenant's colors.
   System fonts only: fast on budget phones, no data cost, works offline. */

:root {
  color-scheme: light;
  --brand: #17324D;
  --brand-ink: #FFFFFF;
  --accent: #F2B134;
  --accent-ink: #14181F;

  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --ink: #1B1F24;
  --ink-2: #5A6370;
  --line: #E3E1DA;
  --danger: #B42318;
  --danger-bg: #FDECEA;
  --ok: #157347;
  --ok-bg: #E7F5EE;
  --warn-bg: #FFF6DB;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
  --r-sm: 10px;
  --tap: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: 0 1.1rem;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #F1C5C0; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 .8rem; font-size: .92rem; }
.link { background: none; border: 0; padding: .25rem 0; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

.field { display: grid; gap: .4rem; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .label { font-weight: 600; font-size: .95rem; padding: 0; }
.optional { font-weight: 400; color: var(--ink-2); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: .6rem .8rem;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: .88rem; color: var(--ink-2); }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }
.form-error { background: var(--danger-bg); color: var(--danger); padding: .75rem .9rem; border-radius: var(--r-sm); font-weight: 600; }
.fine { font-size: .82rem; color: var(--ink-2); text-align: center; }

.slug-row, .phone-row { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; min-width: 0; }
.slug-row:focus-within, .phone-row:focus-within { border-color: var(--brand); }
.slug-row input, .phone-row input { border: 0; border-radius: 0; min-width: 0; flex: 1; box-shadow: none !important; }
.slug-prefix, .phone-prefix { display: flex; align-items: center; padding: 0 .1rem 0 .8rem; color: var(--ink-2); white-space: nowrap; font-size: .92rem; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.phone-prefix { padding-right: .4rem; font-weight: 600; color: var(--ink); }
.slug-row .btn { border: 0; border-radius: 0; border-left: 1.5px solid var(--line); }

/* ---------- Landing (Laxis brand) ---------- */
.landing, .signup, .error-page { max-width: 34rem; margin: 0 auto; padding: 1.25rem max(16px, env(safe-area-inset-right, 0px)) 2.5rem max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 1.75rem; }
.wordmark { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; color: var(--brand); }
.wordmark span { color: var(--ink-2); font-weight: 600; margin-left: .3rem; }
.landing-hero h1 { font-size: clamp(2rem, 8vw, 2.6rem); letter-spacing: -.02em; }
.landing-hero p { margin-top: .6rem; color: var(--ink-2); font-size: 1.05rem; max-width: 30rem; }
.type-list { display: grid; gap: .75rem; }
.type-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: 1rem; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.type-card:hover { border-color: var(--brand); }
.type-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 30%, #fff); color: var(--brand); }
.type-icon svg { width: 30px; height: 30px; }
.type-text { display: grid; gap: .15rem; min-width: 0; }
.type-text strong { font-size: 1.15rem; }
.type-text span { color: var(--ink-2); font-size: .92rem; }
.type-go { font-size: 1.8rem; color: var(--ink-2); line-height: 1; }
.landing-how h2 { font-size: 1.05rem; margin-bottom: .6rem; }
.landing-how ol { margin: 0; padding-left: 1.25rem; display: grid; gap: .4rem; color: var(--ink-2); }
.landing-how strong { color: var(--ink); }
.landing-open { display: grid; gap: .5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.landing-open label { font-weight: 600; font-size: .95rem; }

/* "What you get" and FAQ */
.landing-what { display: grid; gap: .9rem; padding: 1.1rem; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line); }
.landing-what h2, .landing-faq h2 { font-size: 1.2rem; letter-spacing: -.01em; }
.hl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.hl { display: grid; grid-template-columns: 2.4rem 1fr; gap: .7rem; align-items: start; }
.hl-icon { width: 2.4rem; height: 2.4rem; border-radius: 10px; display: grid; place-items: center; font-size: 1.25rem; background: color-mix(in srgb, var(--accent) 25%, #fff); }
.hl strong { display: block; font-size: 1rem; }
.hl-text { display: block; color: var(--ink-2); font-size: .92rem; margin-top: .1rem; }
.hl-list.compact { gap: .5rem; }
.hl-list.compact .hl { grid-template-columns: 1.9rem 1fr; align-items: center; }
.hl-list.compact .hl-icon { width: 1.9rem; height: 1.9rem; font-size: 1rem; border-radius: 8px; }
.hl-list.compact strong { font-weight: 600; font-size: .95rem; }
.hl-note { font-size: .82rem; }
.landing-faq { display: grid; gap: .5rem; }
.faq { border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 1rem; }
.faq summary { cursor: pointer; font-weight: 600; padding: .85rem 0; min-height: 44px; list-style-position: outside; }
.faq p { margin: 0 0 .9rem; color: var(--ink-2); }
.landing-faq .btn { margin-top: .5rem; }
.signup-what { border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 1rem; }
.signup-what summary { cursor: pointer; font-weight: 700; padding: .85rem 0; min-height: 44px; }
.signup-what .hl-list { padding-bottom: .5rem; }

/* ---------- Signup ---------- */
.back { color: var(--ink-2); text-decoration: none; font-weight: 600; justify-self: start; min-height: 36px; display: inline-flex; align-items: center; }
.signup-head { display: flex; gap: .9rem; align-items: center; }
.signup-head h1 { font-size: 1.55rem; letter-spacing: -.01em; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
#signup { display: grid; gap: 1.15rem; }
.palettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.palette { position: relative; display: grid; gap: .35rem; justify-items: center; padding: .6rem .3rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; font-size: .85rem; font-weight: 600; }
.palette input { position: absolute; opacity: 0; inset: 0; cursor: pointer; min-height: 0; }
.palette:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.palette:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch { display: flex; width: 44px; height: 28px; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.swatch i { flex: 2; } .swatch i + i { flex: 1; }
.custom-colors { display: none; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: .5rem; }
.palettes:has(#palette-custom:checked) .custom-colors { display: grid; }
.custom-colors label { display: grid; gap: .25rem; font-size: .85rem; color: var(--ink-2); }
.custom-colors input[type="color"] { padding: .2rem; height: var(--tap); }
.logo-pick { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.logo-preview { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 1.4rem; overflow: hidden; flex: none; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.error-page h1 { font-size: 1.5rem; }

/* ---------- Store app ---------- */
body.tenant { background: var(--bg); }
.boot { min-height: 80vh; display: grid; place-items: center; }
.boot-mark { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 1.6rem; }
.screen { max-width: 34rem; margin: 0 auto; padding: 1rem max(16px, env(safe-area-inset-right, 0px)) 2rem max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 1.25rem; }
.screen-narrow { max-width: 24rem; }

.appbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--brand); color: var(--brand-ink); }
body.tenant::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--brand); z-index: 10; }
.appbar-inner { max-width: 34rem; margin: 0 auto; padding: .6rem max(16px, env(safe-area-inset-right, 0px)) .6rem max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: .7rem; min-height: 58px; }
.appbar h1 { font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .btn { background: transparent; color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand-ink) 35%, transparent); }
.appbar-back { background: none; border: 0; color: var(--brand-ink); font-size: 1.6rem; width: 40px; height: 40px; margin-left: -8px; cursor: pointer; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--brand-ink); color: var(--brand); font-weight: 800; font-size: .95rem; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-mark.lg { width: 84px; height: 84px; border-radius: 22px; font-size: 1.9rem; background: var(--brand); color: var(--brand-ink); }

.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; gap: .8rem; min-width: 0; }
.card h2 { font-size: 1.05rem; }
.section-title { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

/* Login */
.login-head { display: grid; justify-items: center; gap: .7rem; text-align: center; padding-top: 1.5rem; }
.login-head h1 { font-size: 1.5rem; }
.who-list { display: grid; gap: .5rem; }
.who { display: flex; align-items: center; gap: .8rem; min-height: 60px; padding: .5rem .9rem; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.who:hover { border-color: var(--brand); }
.who .avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 14%, #fff); color: var(--brand); font-weight: 700; flex: none; }
.who strong { display: block; }
.who small { color: var(--ink-2); }

.pin-dots { display: flex; justify-content: center; gap: .8rem; min-height: 24px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-2); }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 20rem; margin: 0 auto; width: 100%; }
.pinpad button { min-height: 64px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); font: inherit; font-size: 1.5rem; font-weight: 600; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.pinpad button:active { background: color-mix(in srgb, var(--brand) 10%, #fff); }
.pinpad .pin-go { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-size: 1.05rem; }
.pinpad .pin-del { font-size: 1.05rem; }
.pin-error { text-align: center; color: var(--danger); font-weight: 600; min-height: 1.4em; }

/* Banners */
.banner { display: flex; gap: .8rem; align-items: center; padding: .8rem .9rem; border-radius: var(--r); background: var(--warn-bg); border: 1.5px solid #F3E2A9; }
.banner p { flex: 1; font-size: .95rem; }
.banner.install { background: color-mix(in srgb, var(--brand) 8%, #fff); border-color: color-mix(in srgb, var(--brand) 25%, #fff); }

.banner.trial, .banner.renew { background: color-mix(in srgb, var(--accent) 22%, #fff); border-color: color-mix(in srgb, var(--accent) 55%, #fff); }
.banner-sub { color: var(--ink-2); font-size: .88rem; }

/* Plans and paywall */
.plans { display: grid; gap: .75rem; }
.plan { display: grid; gap: .7rem; padding: 1rem; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); }
.plan.current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.plan-head h3 { font-size: 1.15rem; }
.plan-price strong { font-size: 1.4rem; }
.plan-price span { color: var(--ink-2); }
.plan-features { margin: 0; padding-left: 1.2rem; display: grid; gap: .25rem; color: var(--ink-2); font-size: .95rem; }
.paywall-actions { display: grid; gap: .5rem; }
.login-head h1 { max-width: 22rem; }

/* Home tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tile { display: grid; gap: .35rem; align-content: start; min-height: 112px; padding: 1rem; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.tile strong { font-size: 1.05rem; }
.tile span { color: var(--ink-2); font-size: .88rem; }
.tile.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); grid-column: 1 / -1; }
.tile.primary span { color: color-mix(in srgb, var(--brand-ink) 80%, transparent); }
.tile[disabled] { cursor: default; opacity: 1; }
.pill { display: inline-block; justify-self: start; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--accent); color: var(--accent-ink); }

/* Products */
.progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.progress-label { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-2); }
.product-form { display: grid; gap: .9rem; }
.photo-pick { display: grid; grid-template-columns: 96px 1fr; gap: .8rem; align-items: center; }
.photo-box { width: 96px; height: 96px; border-radius: var(--r-sm); border: 1.5px dashed var(--line); display: grid; place-items: center; overflow: hidden; background: var(--bg); color: var(--ink-2); font-size: .8rem; text-align: center; cursor: pointer; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.price-row { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.price-row:focus-within { border-color: var(--brand); }
.price-row span { display: flex; align-items: center; padding-left: .8rem; font-weight: 700; }
.price-row input { border: 0; box-shadow: none !important; }
.product-list { display: grid; gap: .5rem; }
.product { display: grid; grid-template-columns: 56px 1fr auto; gap: .75rem; align-items: center; padding: .5rem; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); min-width: 0; }
.product .thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--brand) 10%, #fff); display: grid; place-items: center; color: var(--brand); font-weight: 700; }
.product .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product .meta { min-width: 0; }
.product .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product .meta small { color: var(--ink-2); }
.product .price { font-weight: 700; font-variant-numeric: tabular-nums; }
.product.off { opacity: .55; }
.empty { text-align: center; color: var(--ink-2); padding: 1.5rem .5rem; }

/* Settings */
.settings-list { display: grid; gap: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.row > .grow { flex: 1; min-width: 0; }
.user-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-row .grow small { color: var(--ink-2); display: block; }
.badge-off { font-size: .75rem; font-weight: 700; color: var(--danger); }
.powered { text-align: center; font-size: .78rem; color: var(--ink-2); padding-top: .5rem; }

/* Sheet (iPhone install guide, forms) */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 34rem; border-radius: 20px 20px 0 0; padding: 1.25rem max(16px, env(safe-area-inset-right, 0px)) calc(1.25rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 1rem; max-height: 90vh; overflow: auto; }
.sheet h2 { font-size: 1.2rem; }
.steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .6rem; }
.steps svg { width: 20px; height: 20px; vertical-align: -4px; }

.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 999px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }

/* ---------- Payment screen (store app) ---------- */
.pay-amount { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.code-box { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 2px dashed var(--brand); border-radius: var(--r-sm); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.code-box strong { flex: 1; font-size: 1.35rem; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.qr { width: 220px; max-width: 100%; aspect-ratio: 1; object-fit: contain; margin: 0 auto; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: #fff; }
.pay-dest { display: grid; gap: .2rem; }
.status-card.pending_review { background: var(--ok-bg); border-color: #BFE3CF; }
.status-card.rejected { background: var(--danger-bg); border-color: #F1C5C0; }

/* ---------- POS ---------- */
.screen.pos { padding-bottom: 6rem; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr)); gap: .6rem; }
.pos-tile { position: relative; display: grid; gap: .2rem; align-content: start; padding: .5rem; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); font: inherit; text-align: left; cursor: pointer; color: var(--ink); min-width: 0; }
.pos-tile:active { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.pos-tile.out { opacity: .6; }
.tile-img { aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--brand); font-weight: 800; font-size: 1.3rem; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile-name { font-weight: 600; font-size: .9rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-price { font-weight: 800; }
.tile-stock { font-size: .75rem; color: var(--ink-2); }
.qty-badge { position: absolute; top: .3rem; right: .3rem; min-width: 1.7rem; height: 1.7rem; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; padding: .6rem max(16px, env(safe-area-inset-right, 0px)) calc(.6rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: var(--brand); color: var(--brand-ink); border: 0; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.cart-bar strong { font-size: 1.3rem; }
.co-lines { display: grid; gap: .4rem; }
.co-line { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.co-line .grow { flex: 1; min-width: 0; }
.co-line strong { min-width: 1.5rem; text-align: center; }
.co-sub { min-width: 4.5rem; text-align: right; font-weight: 600; }
.co-total { display: flex; justify-content: space-between; font-size: 1.3rem; font-weight: 800; }
.quick-cash { display: flex; flex-wrap: wrap; gap: .4rem; }
.change { font-size: 1.6rem; font-weight: 800; text-align: center; min-height: 2rem; font-variant-numeric: tabular-nums; }
.change.ok { color: var(--ok); }
.change.short { color: var(--danger); font-size: 1.15rem; }

/* Receipt: on screen as a card, printed at 58mm */
.receipt { width: 100%; max-width: 58mm; margin: 0 auto; padding: .6rem; background: #fff; color: #000; border: 1px dashed var(--line); font-family: ui-monospace, "Courier New", monospace; font-size: 12px; line-height: 1.35; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: .35rem 0; }
.r-store { font-weight: 700; text-align: center; font-size: 14px; }
.r-small { text-align: center; font-size: 11px; }
.r-line { display: flex; justify-content: space-between; gap: .5rem; }
.r-total { font-weight: 700; }
.r-thanks { margin-top: .4rem; }
.receipt-text { white-space: pre-wrap; text-align: left; }
#print-area { display: none; }
@media print {
  @page { size: 58mm auto; margin: 2mm; }
  body > *:not(#print-area) { display: none !important; }
  body::before { display: none !important; }
  #print-area { display: block !important; }
  #print-area .receipt { border: 0; max-width: none; width: 54mm; padding: 0; }
}

/* ---------- Inventory ---------- */
.inv-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.inv-card { display: grid; gap: .1rem; justify-items: center; padding: .6rem .2rem; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); font: inherit; cursor: pointer; color: var(--ink); }
.inv-card strong { font-size: 1.35rem; }
.inv-card span { font-size: .8rem; font-weight: 600; }
.inv-card.safe { border-color: #BFE3CF; } .inv-card.safe strong { color: var(--ok); }
.inv-card.low { border-color: #F3E2A9; } .inv-card.low strong { color: #8A5A00; }
.inv-card.critical { border-color: #F1C5C0; } .inv-card.critical strong { color: var(--danger); }
.inv-card.on { box-shadow: 0 0 0 2px var(--ink) inset; }
.inv-row { display: grid; grid-template-columns: 52px 1fr auto; gap: .7rem; align-items: center; padding: .5rem; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); min-width: 0; }
.inv-row .thumb, .restock-card .thumb { width: 52px; height: 52px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--brand); font-weight: 700; flex: none; }
.inv-row .thumb img, .restock-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.inv-row .meta, .restock-card .meta { display: grid; gap: .15rem; min-width: 0; }
.inv-row .meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row small { color: var(--ink-2); }

/* ---------- Utang ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.seg-btn { min-height: 48px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 1rem; color: var(--ink); cursor: pointer; }
.seg-btn.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--brand); }
.utang-pick { display: grid; gap: .5rem; }
.utang-list { display: grid; gap: .35rem; }
.utang-opt { display: flex; align-items: center; gap: .5rem; min-height: 46px; padding: .4rem .8rem; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: .98rem; text-align: left; cursor: pointer; }
.utang-opt.new { border-style: dashed; color: var(--brand); font-weight: 600; }
.utang-opt .owes, .utang-bal.owes, .utang-head .owes { color: var(--danger); font-weight: 700; }
.utang-chosen { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: var(--r-sm); border: 1.5px solid var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.utang-chosen .grow { display: grid; gap: .1rem; }
.utang-summary .big { font-size: 2rem; font-weight: 800; }
.list { display: grid; gap: .5rem; }
.row-card { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .6rem .7rem; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.row-card .grow, .utang-entry .grow, .utang-opt .grow, .utang-chosen .grow { flex: 1 1 auto; }
.row-card .grow { display: grid; gap: .1rem; min-width: 0; }
.row-card.over { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.avatar { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); font-weight: 700; }
.utang-bal { white-space: nowrap; }
.utang-head { display: grid; gap: .15rem; justify-items: start; }
.utang-head .big { font-size: 2rem; }
.utang-history { display: grid; gap: .4rem; }
.utang-entry { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: var(--r-sm); border: 1px solid var(--line); }
.utang-entry .grow { display: grid; gap: .1rem; min-width: 0; }
.utang-entry.charge .num { color: var(--danger); font-weight: 700; }
.utang-entry.payment .num { color: #1F7A4D; font-weight: 700; }
.utang-entry.voided { opacity: .55; }
.utang-entry.voided .num { text-decoration: line-through; }
.stock-badge { justify-self: start; display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.stock-badge.safe, .stock-badge.safe_no_sales { background: var(--ok-bg); color: var(--ok); }
.stock-badge.low { background: var(--warn-bg); color: #8A5A00; }
.stock-badge.critical, .stock-badge.out { background: var(--danger-bg); color: var(--danger); }
.btn.plus { width: 48px; padding: 0; font-size: 1.5rem; background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.batches { display: grid; gap: .8rem; }
.batch-day { display: grid; gap: .4rem; }
.batch { display: grid; gap: .3rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--r-sm); }
.batch input { width: 6rem; flex: 0 1 auto; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: .25rem 0; }
.summary-card .big { font-size: 1.6rem; }
.admin-list li.voided { opacity: .55; text-decoration: line-through; }

/* ---------- Restock Checklist ---------- */
.screen.restock { padding-bottom: 9rem; }
.restock-list { display: grid; gap: .6rem; }
.restock-card { display: grid; gap: .5rem; padding: .7rem; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line); }
.restock-card.off { opacity: .6; }
.restock-card input[type="checkbox"] { width: 1.4rem; height: 1.4rem; min-height: 0; flex: none; }
.restock-card .kv { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .35rem; font-size: .88rem; }
.restock-card .kv dt::after { content: ":"; }
.restock-card .kv dd { margin-right: .7rem; white-space: nowrap; font-weight: 700; }
.cost-alert { background: var(--warn-bg); border-radius: var(--r-sm); padding: .45rem .6rem; font-size: .88rem; }
.budget { grid-template-columns: auto 1fr; align-items: center; }
.budget input { max-width: 10rem; }
.budget small { grid-column: 1 / -1; }
.restock-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: grid; gap: .5rem; padding: .6rem max(16px, env(safe-area-inset-right, 0px)) calc(.6rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: var(--surface); border-top: 1.5px solid var(--line); box-shadow: 0 -4px 16px rgb(0 0 0 / .06); }
.restock-bar .row { max-width: 34rem; margin: 0 auto; width: 100%; }
.restock-bar > .btn { max-width: 34rem; margin: 0 auto; }
.check-list { display: grid; gap: .3rem; max-height: 55vh; overflow: auto; }
.check-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .2rem; border-bottom: 1px solid var(--line); }
.check-row input { width: 1.3rem; height: 1.3rem; min-height: 0; }
td.bad { color: var(--danger); }
.tabs button { padding: .45rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); color: var(--ink); font: inherit; font-weight: 600; background: var(--surface); cursor: pointer; }
.tabs button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- Languages, help, reminders, expiry ---------- */
.lang-picker { width: auto; min-height: 40px; padding: .35rem .6rem; font-size: .9rem; }
.lang-picker.compact { max-width: 11rem; }
.landing-top { display: flex; align-items: center; gap: .5rem; }
.landing-top .grow, .row .grow { flex: 1; }
.login-top { width: 100%; }
.help-btn { justify-self: center; }
.appbar-bell { position: relative; background: none; border: 0; font-size: 1.25rem; width: 40px; height: 40px; cursor: pointer; color: var(--brand-ink); }
.appbar-bell .badge { position: absolute; top: 2px; right: 0; }
.notif-list { display: grid; gap: .4rem; }
.notif { display: grid; gap: .15rem; text-align: left; padding: .6rem .7rem; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); font: inherit; color: var(--ink); cursor: pointer; }
.notif.unread { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.push-card { gap: .5rem; }
.hint.ok { color: var(--ok); font-weight: 700; }
.renew-card { background: color-mix(in srgb, var(--accent) 14%, #fff); border-color: color-mix(in srgb, var(--accent) 45%, #fff); }
.inv-cards { grid-template-columns: repeat(5, 1fr); }
.inv-card.expiring { border-color: #F5C9A8; } .inv-card.expiring strong { color: #B4530A; }
.badges { gap: .3rem; }
.expiry-badge { display: inline-block; align-self: flex-start; justify-self: start; width: fit-content; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.expiry-badge.expiring { background: #FFEBD9; color: #B4530A; }
.expiry-badge.expired { background: var(--danger); color: #fff; }
.expiring-row.expired { border-color: #F1C5C0; }
.expiry-btn { color: #B4530A; border-color: #F5C9A8; }
.batch input[type="date"] { width: auto; }
@media (max-width: 420px) {
  .inv-cards { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Super-admin console ---------- */
body.admin { background: var(--bg); }
.boot-text { padding: 2rem; color: var(--ink-2); }
.admin-auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem max(16px, env(safe-area-inset-right, 0px)) 1rem max(16px, env(safe-area-inset-left, 0px)); }
.admin-auth { width: 100%; max-width: 24rem; }
.admin-auth h1 { font-size: 1.3rem; }
.admin-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem; padding: .6rem max(16px, env(safe-area-inset-right, 0px)) .6rem max(16px, env(safe-area-inset-left, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-top .grow { flex: 1; }
.admin-body { display: grid; grid-template-columns: 12rem 1fr; min-height: calc(100vh - 56px); }
.admin-nav { display: grid; align-content: start; gap: .2rem; padding: 1rem .6rem; border-right: 1px solid var(--line); background: var(--surface); }
.admin-nav a { display: flex; align-items: center; justify-content: space-between; padding: .6rem .75rem; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 600; }
.admin-nav a.on { background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--brand); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: .75rem; padding: .05rem .45rem; font-variant-numeric: tabular-nums; }
.admin-main { padding: 1.25rem max(16px, env(safe-area-inset-right, 0px)) 3rem 1.25rem; display: grid; gap: 1rem; align-content: start; min-width: 0; max-width: 64rem; }
.admin-main h1 { font-size: 1.5rem; }
.admin-grid { display: grid; gap: 1rem; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.kpi { display: grid; gap: .2rem; padding: 1rem; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); }
.kpi-label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.kpi strong { font-size: 1.6rem; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; }
.admin-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .55rem 0; border-top: 1px solid var(--line); }
.admin-list li:first-child { border-top: 0; }
.admin-list li.unread strong { color: var(--brand); }
.bars { display: flex; align-items: flex-end; gap: .4rem; height: 9rem; overflow-x: auto; }
.bar { flex: 1 0 2rem; max-width: 3.5rem; height: 100%; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; font-size: .75rem; }
.bar i { align-self: end; width: 70%; min-height: 3px; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar small { color: var(--ink-2); }
.tabs { display: flex; gap: .4rem; }
.tabs a { padding: .45rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; background: var(--surface); }
.tabs a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pay-list { display: grid; gap: .75rem; }
.pay-card { grid-template-columns: 9rem 1fr; align-items: start; }
.shot { display: block; width: 9rem; aspect-ratio: 9 / 16; border-radius: var(--r-sm); overflow: hidden; background: var(--bg); border: 1.5px solid var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.empty-shot { display: grid; place-items: center; text-align: center; font-size: .8rem; color: var(--ink-2); padding: .5rem; }
.pay-info { display: grid; gap: .5rem; min-width: 0; }
.pay-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.pay-actions .row { flex-basis: 100%; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--line); color: var(--ink); white-space: nowrap; }
.chip-trial, .chip-awaiting_payment { background: #E8EEF8; color: #1D4ED8; }
.chip-active, .chip-approved { background: var(--ok-bg); color: var(--ok); }
.chip-expired, .chip-rejected { background: var(--danger-bg); color: var(--danger); }
.chip-suspended { background: #2B2F36; color: #fff; }
.chip-pending_review { background: var(--warn-bg); color: #8A5A00; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.filters input { flex: 1 1 14rem; }
.filters select { width: auto; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.admin-table th, .admin-table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.row.wrap { flex-wrap: wrap; }
.days { width: 5.5rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.check input { width: auto; min-height: 0; }
.features { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.plan-edit input:not([type]), .plan-edit input[inputmode] { width: auto; flex: 1 1 8rem; }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.settings-form { display: grid; gap: .7rem; }
.settings-form h3 { font-size: .95rem; margin-top: .4rem; }
.qr-preview { width: 10rem; aspect-ratio: 1; object-fit: contain; border: 1.5px solid var(--line); border-radius: var(--r-sm); }
@media (max-width: 720px) {
  .admin-body { grid-template-columns: 1fr; }
  .admin-nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: .4rem; }
  .admin-nav a { white-space: nowrap; }
  .admin-main { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .pay-card { grid-template-columns: 1fr; }
  .shot { width: 100%; max-width: 14rem; }
}

@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tile.primary { grid-column: span 3; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
