/* Kerasmeno app styles: mobile-first, no framework.
   Colours, font and shapes come from the design tokens shared with the marketing site
   (marketing-site/css/tokens.css, loaded first as /site/css/tokens.css); these names map onto them.
   A business's OWN colours (--b-*: enrollment page, card previews, print sign) are never these. */
:root {
  --bg: var(--ground);
  --text: var(--ink);
  --border: var(--line-soft);
  --brand: var(--green);          /* primary: buttons, links, active tabs, chart bars */
  --brand-press: var(--green-press);
  --accent: var(--green);         /* focus rings, tab underline, bars (gold is for rewards only) */
  --error-text: var(--error-ink);
  --ok-text: var(--ok-ink);
  --warn-text: var(--warn-ink);
  --radius: var(--r-card);
  font-family: var(--font);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; font-synthesis: none; }
a { color: var(--brand); }
h1 { line-height: 1.15; margin: 0 0 .5rem; font-weight: 800; letter-spacing: -0.02em; }

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: var(--ink); color: #fff;
}
.topbar a, .topbar .link-button { color: #fff; }
.topbar .muted { color: var(--on-dark-muted); }
.topbar a:focus-visible, .topbar button:focus-visible { outline-color: var(--mint); }
/* Logo: the outlined wordmark (mark + KERASMENO); on narrow phones only the mark. */
.brand { display: flex; align-items: center; text-decoration: none; flex: none; }
.brand img { display: block; height: 26px; width: auto; }
.brand .brand-mark { display: none; height: 30px; }
@media (max-width: 640px) { .brand .brand-full { display: none; } .brand .brand-mark { display: block; } }
.topbar-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .95rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.narrow { max-width: 420px; margin: 2rem auto; }
.hero { padding: 2rem 0; max-width: 640px; }
.lead { font-size: 1.2rem; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  font: inherit; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.button {
  display: inline-block; font: inherit; font-weight: 700; text-align: center; text-decoration: none;
  padding: .8rem 1.3rem; border: 0; border-radius: var(--r-pill); background: var(--brand); color: #fff; cursor: pointer;
}
.button:hover { background: var(--brand-press); }
.button.secondary { background: var(--surface); color: var(--brand); border: 2px solid var(--brand); }
.button.secondary:hover { background: var(--mint-soft); }
.link-button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin: 0 0 1rem; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }

.small { font-size: .875rem; }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.prose p { margin: 0 0 .9rem; }
label.checkbox { flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: 400; }
label.checkbox input { margin-top: .3rem; width: 1.1rem; height: 1.1rem; flex: none; }

/* --- Customer-facing pages (branded with --b-* from public_base.html) --- */
body.public { background: var(--bg); }
.public-header {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem;
  background: var(--b-bg); color: var(--b-fg);
}
.public-header img { border-radius: 10px; }
.public-name { font-weight: 700; font-size: 1.1rem; flex: 1; }
.public-lang { color: var(--b-fg); font-size: .9rem; }
.public-main { max-width: 480px; }
.public-main.wide { max-width: 800px; }
.public-footer { text-align: center; padding: 1rem; font-size: .85rem; color: var(--muted); }
.enroll-hero { padding: .5rem 0 1rem; }
.button.brand { background: var(--b-bg); color: var(--b-fg); }

.wallet-buttons { display: flex; flex-direction: column; gap: .75rem; }
.wallet-buttons.google-first .google { order: -1; }
.wallet-button {
  display: flex; flex-direction: column; align-items: center; padding: .7rem 1rem;
  border-radius: 12px; background: #000; color: #fff; text-decoration: none; opacity: .85;
}
.wallet-button.primary { opacity: 1; box-shadow: 0 0 0 3px var(--b-label); }
.wallet-button-small { font-size: .75rem; }
.wallet-button-big { font-size: 1.25rem; font-weight: 700; }

/* --- Wallet card previews (wallet/_apple_card.html, _google_card.html) --- */
.wallet-previews { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.wallet-previews figure { margin: 0; }
.wallet-previews figcaption { font-weight: 700; margin-bottom: .5rem; color: var(--muted); }
.wc-apple, .wc-google { max-width: 360px; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.wc-apple { background: var(--b-bg); color: var(--b-fg); padding-bottom: 1rem; }
.wc-apple-top { display: flex; align-items: center; gap: .5rem; padding: .75rem; }
.wc-logo { height: 32px; width: auto; border-radius: 6px; }
.wc-logo-text { font-weight: 600; flex: 1; }
.wc-strip, .wc-hero { display: block; width: 100%; height: auto; }
.wc-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding: .6rem .75rem 0; }
.wc-field { display: flex; flex-direction: column; }
.wc-right { text-align: right; }
.wc-label { font-size: .65rem; letter-spacing: .04em; color: var(--b-label); font-weight: 600; }
.wc-value { font-size: 1.05rem; }
.wc-badge { background: var(--b-label); color: var(--b-bg); border-radius: 999px; padding: .15rem .6rem; font-size: .8rem; font-weight: 700; }
.wc-qr { margin: 1rem auto 0; width: max-content; background: #fff; color: #000; border-radius: 8px; padding: .5rem; text-align: center; }
.wc-qr svg { display: block; width: 150px; height: 150px; }
.wc-alt { font-size: .75rem; letter-spacing: .1em; }
.wc-google { background: var(--b-bg); color: var(--b-fg); }
.wc-google-top { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem .25rem; font-size: .95rem; }
.wc-google-logo { width: 32px; height: 32px; border-radius: 50%; }
.wc-google-program { padding: 0 1rem; font-size: 1.4rem; }
.wc-google .wc-row { padding: .6rem 1rem 0; }
.wc-google .wc-qr { margin-bottom: 1rem; }

/* --- Staff scanner (big touch targets, used one-handed at the counter) --- */
.button.big { width: 100%; font-size: 1.25rem; padding: 1.1rem; border-radius: 14px; }
.stamp-button { background: var(--green); }
/* Gold is reserved for rewards: the redeem button is the one place it fills a control. */
.redeem-button, .redeem-button:hover { background: var(--gold); color: var(--ink); }
.big-alert { font-size: 1.1rem; font-weight: 600; text-align: center; }
.scanner-reader { width: 100%; max-width: 420px; margin: 1rem auto; border-radius: var(--radius); overflow: hidden; background: #000; }
.staff-card { max-width: 480px; margin: 0 auto; }
.staff-summary { text-align: center; }
.staff-stamps { font-size: 3.5rem; font-weight: 800; line-height: 1; margin: .5rem 0 0; }
.staff-stamps span { color: var(--green); }
.staff-reward { display: inline-block; font-size: 1rem; }
@media (max-width: 480px) { .topbar-nav .muted { display: none; } }
.staff-card .button { width: 100%; }

/* --- Owner dashboard ------------------------------------------------------ */
:root { --chart-1: var(--green); --chart-2: var(--ink); }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.card h2:first-child { margin-top: 0; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin: 0 0 1.25rem; border-bottom: 1px solid var(--border); scroll-snap-type: x proximity; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: .6rem .8rem; text-decoration: none; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--accent); font-weight: 700; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .25rem; }
.kpi-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.kpi-label { font-size: .85rem; color: var(--muted); }
.kpi.estimate { border-style: dashed; }
.kpi.missing { background: transparent; }
.delta { font-size: .85rem; font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--error-ink); }
.info { cursor: help; color: var(--muted); font-size: .85em; }
.badge-estimate { display: inline-block; font-size: .7rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn-text); vertical-align: middle; }
.badge-churn { font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: var(--error-bg); color: var(--error-text); }
.estimate-notes p { margin: .25rem 0; }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }
.two-col { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-2, .grid-3 { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.hint { font-size: .8rem; font-weight: 400; color: var(--muted); }
.field-error { font-size: .85rem; font-weight: 600; color: var(--error-text); }
.narrow-left { max-width: 520px; }
.table-wrap { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.data tr.selected td { background: var(--mint-soft); }
table.data tr.inactive td { color: var(--muted); }
table.data tr.churn td:first-child { box-shadow: inset 3px 0 0 var(--error-ink); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions > a, td.actions > form, td.actions > details { display: inline-block; margin: 0 .75rem .2rem 0; vertical-align: baseline; }
td.heat { background: rgb(14 107 87 / calc(var(--heat) * 0.55)); }
.bars { width: 100%; border-collapse: collapse; font-size: .85rem; }
.bars th { text-align: left; font-weight: 400; width: 6.5rem; padding: .2rem 0; }
.bars td { padding: .2rem .4rem; }
.bar { display: block; height: .7rem; border-radius: 4px; background: var(--accent); min-width: 2px; }
.chart-box { position: relative; height: 280px; }
.top-list { margin: 0; padding-left: 1.4rem; }
.top-list li { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.definitions dt { font-weight: 700; margin-top: .6rem; }
.definitions dd { margin: 0; color: var(--muted); }
.search { display: flex; gap: .5rem; margin: 0 0 1rem; }
.search input { flex: 1; }
.inline-form { display: flex; align-items: center; gap: .5rem; }
.pager { display: flex; gap: 1rem; }
.link-button.danger { color: var(--error-text); }
.logo-thumb { max-height: 56px; max-width: 180px; border-radius: 8px; background: var(--line-soft); display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.url-box { display: block; padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; word-break: break-all; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
legend { font-weight: 600; margin-bottom: .4rem; }

/* --- Card designer ----------------------------------------------------------- */
.designer { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.designer-preview { order: -1; }
@media (min-width: 1000px) {
  .container:has(.designer) { max-width: 1280px; }
  .designer { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .designer-preview { order: 0; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
}
.preview-controls { margin-bottom: 1rem; }
.preview-cards { display: flex; flex-direction: column; gap: 1rem; }
.preview-cards figure { margin: 0; }
.preview-cards figcaption { font-weight: 700; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.upload-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.small-button { font-size: .9rem; padding: .5rem .8rem; align-self: flex-start; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; }
.icon-choice { flex-direction: column; align-items: center; gap: .3rem; padding: .6rem .3rem; border: 2px solid var(--border); border-radius: 10px; font-weight: 400; font-size: .8rem; cursor: pointer; text-align: center; }
.icon-choice:has(input:checked) { border-color: var(--brand); background: var(--mint-soft); }
.icon-choice input { position: absolute; opacity: 0; }
.icon-default { font-size: 1.6rem; line-height: 32px; }
.locations-map { height: 320px; border-radius: var(--radius); border: 1px solid var(--border); }
.location-row { display: flex; flex-direction: column; gap: .6rem; padding: 1rem; }
.location-actions { display: flex; justify-content: space-between; align-items: center; }
.counter { display: block; text-align: right; }
.lockscreen { max-width: 360px; border-radius: 22px; padding: 1.5rem 1rem 1rem; color: #fff; text-align: center;
  background: linear-gradient(160deg, #2b3a55, #6b4b7a 60%, #c27a5a); }
.lockscreen-time { font-size: 3.2rem; font-weight: 300; line-height: 1; }
.lockscreen-date { font-size: .9rem; opacity: .85; margin-bottom: 1.2rem; }
.lockscreen-pass { display: flex; gap: .7rem; align-items: center; text-align: left; padding: .7rem .8rem; border-radius: 16px;
  background: rgba(255, 255, 255, .22); backdrop-filter: blur(8px); }
.lockscreen-pass img { border-radius: 8px; flex: none; }
.lockscreen-title { font-weight: 700; font-size: .9rem; }
.lockscreen-text { font-size: .9rem; }
.lockscreen-note { font-size: .75rem; opacity: .85; margin: .8rem 0 0; }

/* --- Printable counter sign -------------------------------------------------- */
.print-sign { margin: 2rem auto; max-width: 420px; text-align: center; padding: 1.5rem; border-radius: 18px; background: var(--b-bg); color: var(--b-fg); }
.print-sign-name { font-size: 1.6rem; font-weight: 800; margin: 0; }
.print-sign-cta { font-size: 1.1rem; margin: .5rem 0 1rem; }
.print-sign-qr { background: #fff; border-radius: 12px; padding: .5rem; display: inline-block; }
.print-sign-qr svg { display: block; width: 260px; height: 260px; }
.print-sign-how { font-size: .9rem; margin: 1rem 0 0; }
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .print-sign { -webkit-print-color-adjust: exact; print-color-adjust: exact; margin-top: 0; }
}
[hidden] { display: none !important; }
.location-row input[type=text], .location-row input[type=number] { width: 100%; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.nearby-templates { display: flex; flex-direction: column; gap: .9rem; }
.nearby-row legend .hint { font-weight: 400; margin-left: .3rem; }
.counter.over { color: var(--warn-text); font-weight: 700; }

/* Plain list (admin: locked accounts) */
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
ul.plain li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; }

/* --- Superadmin panel (Amendment #8) -------------------------------------------- */
.container.admin-main { max-width: 1200px; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; padding: .4rem 1rem;
  background: var(--dark-2); color: #fff; font-size: .92rem; position: relative; z-index: 25; } /* dropdowns above any banner */
.admin-nav a { color: #fff; text-decoration: none; }
.admin-nav-home, .admin-menu-trigger { padding: .45rem .7rem; border-radius: 8px; cursor: pointer; }
.admin-menu-trigger { background: none; border: 0; color: #fff; font: inherit; display: inline-flex; align-items: center; }
.admin-menu-trigger:hover, .admin-menu.open > .admin-menu-trigger { background: rgb(255 255 255 / .08); }
.admin-menu-trigger:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.admin-nav-home.current, .admin-menu.current > .admin-menu-trigger { background: rgb(159 224 205 / .16); color: var(--mint); font-weight: 700; }
.admin-menu { position: relative; }
.admin-menu-trigger::after { content: "▾"; margin-left: .3em; font-size: .8em; opacity: .8; transition: transform .15s; }
.admin-menu.open > .admin-menu-trigger::after { transform: rotate(180deg); }
.admin-menu ul[hidden] { display: none; }
.admin-menu ul { position: absolute; top: 100%; left: 0; min-width: 220px; margin: .25rem 0 0; padding: .35rem 0; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.35); z-index: 10; }
.admin-menu ul a, .admin-menu ul .link-button { display: block; width: 100%; text-align: left; padding: .45rem .9rem; color: var(--text); text-decoration: none; }
.admin-menu ul a:hover, .admin-menu ul .link-button:hover { background: var(--bg); }
.admin-account { margin-left: auto; }
.admin-account ul { left: auto; right: 0; }
.admin-search input { padding: .4rem .7rem; border-radius: 999px; border: 0; min-width: 14rem; font-size: .9rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; max-width: 1200px; margin: 0 auto; padding: .75rem 1rem 0;
  font-size: .85rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--border);
  color: var(--text); vertical-align: middle; white-space: nowrap; }
.badge-active, .badge-run-success, .badge-pay-paid, .badge-email-sent { background: var(--ok-bg); color: var(--ok-text); }
.badge-trial, .badge-pay-pending, .badge-run-running, .badge-email-mock { background: var(--warn-bg); color: var(--warn-text); }
.badge-suspended, .badge-cancelled, .badge-danger, .badge-run-failed, .badge-pay-overdue, .badge-email-failed { background: var(--error-bg); color: var(--error-text); }
.badge-cancelled { background: var(--line-soft); color: var(--ink); }
.badge-group { background: var(--ground); color: var(--muted); font-weight: 600; border: 1px solid var(--border); }
.badge-danger { font-weight: 700; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin: 0 0 1rem; }
.filters label { font-size: .85rem; }
.filters .checkbox { flex-direction: row; align-items: center; padding-bottom: .6rem; }
table.data th a.sort { color: var(--muted); text-decoration: none; }
table.data th a.sort.active { color: var(--brand); }
.nowrap { white-space: nowrap; }
.bulk { margin: 0 0 1rem; }
.bulk legend { font-weight: 700; padding: 0 .3rem; }
.align-end { display: flex; align-items: flex-end; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }
.stack-links { display: flex; flex-direction: column; gap: .4rem; }
.action-box { border-top: 1px solid var(--border); padding-top: 1rem; }
.action-box h3 { margin: 0; }
.button.danger-button, .danger-button { background: var(--error-text); color: #fff; }
.secret-box code.secret { font-size: 1.3rem; letter-spacing: .05em; user-select: all; }
.tf-codes-plain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; list-style: none; padding: 0; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem .75rem; }
.inline-details { display: inline-block; }
.inline-details[open] { display: block; margin-top: .5rem; }
.inline-details summary { list-style: none; cursor: pointer; }
.health-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0 0 1.5rem; }
.health-grid h2 { font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.light { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; flex: none; }
.light.ok { background: var(--green); }
.light.bad { background: var(--error-ink); }
.error-entry { padding: .75rem 1rem; margin: 0 0 .5rem; }
.error-entry summary { cursor: pointer; }
pre.trace { overflow-x: auto; font-size: .78rem; background: var(--bg); padding: .75rem; border-radius: 8px; }
tr.admin-entry td { background: var(--error-bg); }
.badge-danger.small { font-size: .7rem; }

/* Impersonation: always visible while the superadmin acts as a business. */
.impersonation-banner { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .5rem 1rem; padding: .6rem 1rem; background: var(--error-ink); color: #fff; font-weight: 700; }
.impersonation-banner .button { background: #fff; color: var(--error-ink); }

/* Announcements from Kerasmeno on the owner dashboard. */
.announcement-banner { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: .9rem 1rem; margin: 0 0 1rem;
  border-radius: var(--radius); background: var(--info-bg); border: 1px solid var(--mint); }
.announcement-banner p { margin: .25rem 0 0; white-space: pre-line; }
.announcement-banner.kind-maintenance { background: var(--warn-bg); border-color: #EBCB8B; }
.announcement-banner.kind-payment { background: var(--error-bg); border-color: #EDB8B2; }

/* --- Mobile & touch (QA pass) ------------------------------------------------------
   Touch targets ≥ 44 px, inputs ≥ 16 px (no iOS zoom on focus), safe areas (notch, home bar),
   no horizontal page scroll. Phones: ≤ 640 px. */
html { -webkit-text-size-adjust: 100%; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date],
input[type=tel], input[type=url], select, textarea { font-size: max(16px, 1rem); min-height: 44px; max-width: 100%; }
input[type=color] { min-width: 44px; min-height: 44px; padding: 2px; }
input[type=file] { min-height: 44px; max-width: 100%; }
textarea { min-height: 88px; }
label > input:not([type=radio]):not([type=checkbox]):not([type=color]), label > select, label > textarea { width: 100%; min-width: 0; }
input[type=range] { min-height: 44px; }
.grid-2 > *, .grid-3 > *, .two-col > *, .filters > * { min-width: 0; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.link-button, td.actions > a, .tabs a, .topbar-nav > a, .topbar-nav .link-button, .pager a, .stack-links a {
  min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
summary { padding-block: .7rem; cursor: pointer; }
.admin-menu-trigger { min-height: 44px; padding-block: 0; }
.admin-nav-home, .admin-menu ul a, .admin-menu ul .link-button { min-height: 44px; display: flex; align-items: center; }
.breadcrumbs a, .breadcrumbs span { min-height: 44px; display: inline-flex; align-items: center; }
.admin-search input { min-height: 44px; }
label.checkbox { min-height: 44px; align-items: center; }
label.checkbox input { margin-top: 0; width: 22px; height: 22px; }
.check-target { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.check-target input { width: 22px; height: 22px; margin: 0; }
.break { overflow-wrap: anywhere; }
.only-phone { display: none; }
.brand { min-height: 44px; min-width: 44px; }
.menu-toggle { display: none; }

/* Safe areas (viewport-fit=cover): nothing under the notch or the home indicator. */
.topbar { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right));
  padding-top: max(.75rem, env(safe-area-inset-top)); }
.admin-nav, .public-header { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
.public-header { padding-top: max(.75rem, env(safe-area-inset-top)); }
.container { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: max(3rem, calc(env(safe-area-inset-bottom) + 1.5rem)); }
.public-footer { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.impersonation-banner { padding-top: max(.6rem, env(safe-area-inset-top)); }

/* Tabs: on narrow screens they scroll sideways; a soft shadow shows there is more.
   (Scroll shadows: the cover gradients scroll with the content, the shadows stay at the edges.) */
.tabs {
  background:
    linear-gradient(to right, var(--bg) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--bg) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(21 32 27 / .2), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgb(21 32 27 / .2), transparent) right / 14px 100% no-repeat scroll;
}
.tabs a { scroll-snap-align: start; flex: none; }
/* Wide screens: every tab visible (two rows if needed), never cut off. */
@media (min-width: 900px) { .tabs { flex-wrap: wrap; overflow: visible; background: none; } }

@media (max-width: 640px) {
  /* Header: the mark + a menu button; the links (and the admin menu) open below. */
  .topbar { flex-wrap: wrap; gap: .5rem; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: auto;
    background: none; border: 1px solid rgb(255 255 255 / .35); border-radius: var(--r-pill); color: #fff; cursor: pointer; }
  .menu-toggle span, .menu-toggle span::before, .menu-toggle span::after { display: block; width: 18px; height: 2px; background: currentColor;
    border-radius: 2px; position: relative; content: ""; }
  .menu-toggle span::before { position: absolute; top: -6px; }
  .menu-toggle span::after { position: absolute; top: 6px; }
  body.menu-open .menu-toggle span { background: transparent; }
  body.menu-open .menu-toggle span::before { top: 0; transform: rotate(45deg); }
  body.menu-open .menu-toggle span::after { top: 0; transform: rotate(-45deg); }
  .topbar-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: .25rem; }
  body.menu-open .topbar-nav { display: flex; }
  .topbar-nav > * { border-top: 1px solid rgb(255 255 255 / .12); }
  .topbar-nav .muted { display: flex; align-items: center; min-height: 44px; }
  .topbar-nav form.inline { display: block; }
  .admin-nav { display: none; flex-direction: column; align-items: stretch; }
  body.menu-open .admin-nav { display: flex; }
  .admin-menu ul { position: static; box-shadow: none; margin: 0 0 .5rem; min-width: 0; }
  .admin-account { margin-left: 0; }
  .admin-search input { width: 100%; min-width: 0; }

  /* KPI cards two per row; numbers still big. */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kpi { padding: .75rem; }
  .kpi-value { font-size: 1.5rem; }

  /* Primary actions full width, easy to reach with a thumb. */
  .stack > .button, .stack > .small-button, .filters .button, .page-head .button, .bulk .button, .search .button { width: 100%; }
  .page-head > * { width: 100%; }
  .search { flex-direction: column; }
  .filters > label, .filters > .button { flex: 1 1 100%; }
  .only-phone { display: block; }

  /* Lists that turn into cards (customers, the admin businesses list). */
  .table-wrap:has(table.stack-sm) { overflow: visible; background: none; border: 0; }
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
  table.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack-sm tr { position: relative; margin: 0 0 .6rem; padding: .75rem 1rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); }
  table.stack-sm td { padding: .2rem 0; border: 0; text-align: left; }
  table.stack-sm td[data-label] { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
  table.stack-sm td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; flex: none; max-width: 45%; }
  table.stack-sm td[data-label] > * { text-align: right; }
  table.stack-sm .stack-title { font-size: 1.05rem; padding: .1rem 3rem .35rem 0; }
  table.stack-sm .stack-check { position: absolute; top: .25rem; right: .25rem; width: auto; padding: 0; }
  table.stack-sm tr.churn { box-shadow: inset 4px 0 0 var(--error-ink); }
  table.stack-sm tr.churn td:first-child { box-shadow: none; }
}

/* Milestone (bonus) rewards: owner settings and the staff card (Amendment #10) */
.milestone-row { border-top: 1px solid var(--border); padding-top: .75rem; }
.milestone-row.inactive { opacity: .7; }
.milestone-new { border-top: 1px solid var(--border); padding-top: .75rem; }
.milestone-new h3 { margin: 0; font-size: 1rem; }
.redeem-choices { display: grid; gap: .6rem; }
.redeem-choices .button { width: 100%; min-height: 56px; font-size: 1.1rem; }

/* Features that aren't built yet (Amendment #11 F): red, disabled, "Σύντομα" */
.future-toggle { display: inline-flex; align-items: center; gap: .5rem; cursor: not-allowed; }
.switch { display: inline-block; width: 2.6rem; height: 1.5rem; border-radius: 1rem; position: relative; }
.switch > span { position: absolute; top: .2rem; left: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; }
.switch-future { background: var(--error-text); opacity: .55; }
.badge-soon { background: var(--error-bg, #fde8e8); color: var(--error-text); font-size: .75rem; padding: .1rem .5rem; border-radius: 1rem; }
.future-row { opacity: .9; }
div.future-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .4rem 0; }

/* Owner: locked (premium) and coming-soon feature cards (Amendment #11 E) */
.feature-cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.feature-card { border: 1px dashed var(--border); border-radius: var(--radius); padding: 1rem; background: var(--bg); }
.feature-card h3 { margin: 0 0 .25rem; font-size: 1rem; display: flex; gap: .4rem; align-items: center; }
.feature-card p { margin: .25rem 0; }
.feature-card.locked { opacity: .85; }
.feature-card fieldset[disabled] { opacity: .6; border: 0; padding: 0; margin: .5rem 0 0; }

/* Web card page /c/{token} (Amendment #11 B) */
.web-card-face { background: var(--b-bg); color: var(--b-fg); border-radius: var(--radius); padding: 1rem; display: grid; gap: .4rem; }
.web-card-face p { margin: 0; }
.web-card-strip { width: 100%; height: auto; border-radius: 8px; }
.web-card-stamps strong { font-size: 1.6rem; }
.web-card-stamps span { color: var(--b-label); text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; }
.web-card-qr { text-align: center; }
.web-card-qr svg { width: min(240px, 70vw); height: auto; background: #fff; border-radius: 8px; }
.center { text-align: center; }
.birthday-fields { border: 0; padding: 0; margin: 0; }
.birthday-fields legend { padding: 0; margin-bottom: .25rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.surprise-form summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* Quick demo business (feature freeze step 4) */
.badge-demo { background: #6B3FA0; color: #fff; font-size: .7rem; font-weight: 800; letter-spacing: .08em; padding: .1rem .45rem; border-radius: 6px; vertical-align: middle; }
.icon-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.icon-choice { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; }
.icon-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-choice:has(input:checked) { border-color: var(--green, #0E6B57); background: var(--mint-soft, #DCEFE9); }
.icon-choice:has(input:focus-visible) { outline: 3px solid var(--ink, #15201B); outline-offset: 2px; }
.demo-qr svg { width: min(320px, 80vw); height: auto; display: block; margin: 0 auto; }
.demo-password { font-size: 1.4rem; letter-spacing: .05em; }
.demo-banner { background: #6B3FA0; color: #fff; text-align: center; font-weight: 700; padding: .35rem 1rem; font-size: .9rem; }
@media print {
  .no-print, .topbar, .admin-nav, .admin-menu, .breadcrumbs, .backup-banner { display: none !important; }
  .demo-print { border: 0; box-shadow: none; }
  .demo-qr svg { width: 12cm; }
}


/* System alert banners with "Το είδα" (System → Health lists them all) */
.system-alert { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; background: var(--error-text, #A1261B); }
.system-alert a { color: #fff; }
.alert-ack { background: rgb(255 255 255 / .15); color: #fff; border: 1px solid rgb(255 255 255 / .5); border-radius: 999px; padding: .3rem .8rem; min-height: 44px; font: inherit; font-weight: 700; cursor: pointer; }
.alert-ack:hover { background: rgb(255 255 255 / .25); }
.alert-dot { display: inline-block; width: .55rem; height: .55rem; margin-left: .35rem; border-radius: 50%; background: #FF5A4E; box-shadow: 0 0 0 2px var(--ink, #15201B); vertical-align: middle; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.menu-toggle { position: relative; }
.menu-badge { position: absolute; top: 4px; right: 4px; margin: 0; }

/* Plan comparison on the owner's Subscription page: the current plan's column stands out. */
.plan-compare th.current, .plan-compare td.current { background: var(--mint-soft); font-weight: 600; }
.plan-compare td:not(:first-child), .plan-compare th:not(:first-child) { text-align: center; }
.plan-compare table.data { table-layout: fixed; }
.plan-compare table.data th, .plan-compare table.data td { white-space: normal; padding-left: .4rem; padding-right: .4rem; font-size: .8rem; }
.plan-compare table.data th:first-child { width: 38%; }
.plan-compare .badge { white-space: normal; }

/* Business status with the trial's end date and "Λήγει σε 2 ημ." badge: wraps on phones. */
.status-cell { display: inline-flex; flex-wrap: wrap; gap: .25rem .4rem; align-items: center; justify-content: flex-end; max-width: 100%; }
.badge-trial-ending, .badge-trial-ended { background: var(--error-bg); color: var(--error-text); }
/* Μήνυμα στους πελάτες */
.broadcast-quote { margin: 0; padding: .75rem 1rem; border-left: 4px solid var(--accent); border-radius: 8px; overflow-wrap: anywhere; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.counter { text-align: right; }
.lockscreen-text { overflow-wrap: anywhere; }
