/* ==========================================================================
   Turno — base design system (shared by every page).
   Tenant look arrives at runtime: Turno.accent(hex) sets --accent,
   --accent-rgb, --on-accent, --accent-ink; Turno.theme(config) may also set
   --paper --card --ink --muted --line --soft --accent2 and html[data-font].
   Mobile-first, one-thumb, big type. System fonts; the only web font is the
   self-hosted Playfair Display (OFL) used for display headings when a shop's
   theme asks for serif — no external font requests at runtime.
   ========================================================================== */
/* Playfair Display — SIL Open Font License 1.1 (© The Playfair Display Project
   Authors, github.com/clauseggers/Playfair-Display). Latin subset, weights
   600–700, from Google Fonts' served woff2. */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --accent: #40203f;
  --accent-rgb: 64, 32, 63;
  --on-accent: #ffffff;
  --accent-ink: #36193a;
  --accent2: var(--accent);              /* thin rules / ornament; a theme may set brass etc. */
  --paper: #fbf8f3;
  --card: #ffffff;
  --ink: #1d1a1f;
  --muted: #5f5866;
  --line: #e4ddd6;
  --soft: #f1ece5;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: var(--font-body);      /* display headings: .h1 .h2 .brand .big-number, the board verdict, the sign headline */
  --ok: #1e8a4c;
  --ok-bg: #e4f5ea;
  --warn: #9a6400;
  --warn-bg: #fff3d6;
  --bad: #b3261e;
  --bad-bg: #fde7e5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .06);
  --fs-xs: 14px; --fs-sm: 16px; --fs-md: 18px; --fs-lg: 22px; --fs-xl: 28px; --fs-2xl: 36px; --fs-3xl: 48px;
  --tap: 56px;
  --maxw: 640px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-md); line-height: 1.5; min-height: 100vh; overflow-x: hidden;
}
/* serif look (theme.font = 'serif'): display headings only; reading text stays sans */
html[data-font="serif"] { --font-display: "Playfair Display", Georgia, "Times New Roman", serif; }
html[data-font="serif"] .h1, html[data-font="serif"] .h2, html[data-font="serif"] .brand, html[data-font="serif"] .big-number { letter-spacing: 0; font-weight: 700; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .55); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; }
.row > * + * { margin-left: 12px; }
.row.between { justify-content: space-between; }
/* wrapped rows: 12 px between items on both axes via child margins (no flex gap —
   Chromium < 84 ignores it); the negative outer margins cancel the edges */
.row.wrap { flex-wrap: wrap; margin-left: -6px; margin-right: -6px; margin-bottom: -12px; }
.row.wrap > * { margin: 0 6px 12px; }
.row.wrap > * + * { margin-left: 6px; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--accent); color: var(--on-accent);
  padding: 14px 16px; position: sticky; top: 0; z-index: 20;
}
.topbar .wrap { padding: 0; display: flex; align-items: center; }
.topbar .wrap > * + * { margin-left: 12px; }
.topbar .brand { font-weight: 800; font-size: var(--fs-lg); letter-spacing: .01em; font-family: var(--font-display); }
.topbar a { color: inherit; }

/* ---------- type ---------- */
.h1 { font-size: var(--fs-xl); font-weight: 800; line-height: 1.15; margin: 0; font-family: var(--font-display); }
.h2 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; margin: 0; font-family: var(--font-display); }
.h3 { font-size: var(--fs-md); font-weight: 700; margin: 0; }
.big-number { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; letter-spacing: -.01em; font-family: var(--font-display); }
.rule2 { height: 2px; width: 56px; background: var(--accent2); border-radius: 2px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.card.soft { background: var(--soft); box-shadow: none; }
.card.ok { background: var(--ok-bg); border-color: transparent; }
.card.warn { background: var(--warn-bg); border-color: transparent; }
.card.bad { background: var(--bad-bg); border-color: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 20px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--card); color: var(--accent-ink); font-weight: 700; font-size: var(--fs-md);
  text-decoration: none; -webkit-tap-highlight-color: transparent; user-select: none;
  transition: transform .06s ease, background .15s ease, opacity .15s ease;
}
.btn > * + * { margin-left: 8px; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-block { display: flex; width: 100%; }
.btn-big { min-height: 72px; font-size: var(--fs-lg); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: var(--fs-sm); }
.btn-round { width: 72px; min-width: 72px; height: 72px; padding: 0; border-radius: 50%; font-size: var(--fs-2xl); line-height: 1; }
.btn-icon { width: var(--tap); min-width: var(--tap); padding: 0; border-radius: 50%; }

/* ---------- pills / status ---------- */
.pill {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 700; background: var(--soft); color: var(--ink); white-space: nowrap;
}
.pill > * + * { margin-left: 6px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.accent { background: rgba(var(--accent-rgb), .12); color: var(--accent-ink); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: var(--ok); }
.dot.off { background: #b8b0b9; }

/* ---------- language toggle ---------- */
.lang-toggle { display: inline-flex; border: 2px solid rgba(255, 255, 255, .55); border-radius: 999px; overflow: hidden; }
.lang-toggle button {
  min-width: 52px; min-height: 40px; padding: 0 12px; border: 0; background: transparent; color: inherit;
  font-weight: 700; font-size: var(--fs-sm); opacity: .75;
}
.lang-toggle button[aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: var(--accent-ink); opacity: 1; }
.card .lang-toggle, .paper .lang-toggle { border-color: var(--line); }
.card .lang-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- switches ---------- */
.switch { position: relative; width: 64px; height: 36px; border-radius: 999px; background: #c9c2c6; border: 0; padding: 0; flex: 0 0 auto; transition: background .15s ease; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s ease; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { left: 32px; }

/* ---------- forms ---------- */
.field { display: block; }
.field > span { display: block; font-weight: 700; font-size: var(--fs-sm); margin-bottom: 6px; }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); font-size: var(--fs-md);
}
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.help { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }

/* ---------- PIN pad ---------- */
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 330px; margin: 0 auto; }
.pinpad .btn { min-height: 64px; font-size: var(--fs-xl); border-radius: var(--radius-sm); margin: 5px; }
.pin-dots { display: flex; justify-content: center; margin: 12px 0; }
.pin-dots > * + * { margin-left: 14px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dots span.filled { background: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 700;
  box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center;
}
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
.toast.warn { background: var(--warn); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }

/* ---------- footer ---------- */
.foot { padding: 24px 16px 40px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.foot a { color: inherit; font-weight: 700; }
.powered { display: inline-flex; align-items: center; }
.powered > * + * { margin-left: 8px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .25s ease both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- print ---------- */
@media print {
  .topbar, .no-print, .toast { display: none !important; }
  body { background: #fff; }
}
