/* Layout: dark charcoal sidebar (the brand's "school" colour) beside a warm working surface;
   maroon carries actions, amber marks money and highlights. Sidebar becomes a top bar on phones. */
:root {
  --bg: #F8F3F1;
  --surface: #FFFFFF;
  --surface-2: #F2E9E6;
  --fg: #201B19;
  --muted: #6E625E;
  --line: #E6DAD6;
  --brand: #6A1D18;
  --brand-hover: #561612;
  --brand-ink: #FFFFFF;
  --brand-text: #6A1D18;
  --brand-soft: #F5E4E1;
  --accent: #A8620B;
  --accent-soft: #F8EBD6;
  --side-bg: #201B19;
  --side-fg: #EFE6E2;
  --side-muted: #A3948F;
  --side-active: #38100E;
  --ok: #2B7346; --ok-soft: #E1F0E6;
  --warn: #9A5C06; --warn-soft: #FBEED8;
  --bad: #A12A22; --bad-soft: #F8E1DE;
  --info: #2C5E8A; --info-soft: #E2ECF5;
  --shadow: 0 1px 2px rgba(56, 16, 14, .06), 0 4px 16px rgba(56, 16, 14, .05);

  --font-ui: "Manrope", "Segoe UI", Arial, sans-serif;
  --font-accent: "Newsreader", Georgia, "Times New Roman", serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151110; --surface: #1F1917; --surface-2: #2A2220; --fg: #F1E9E6; --muted: #B3A39E; --line: #3A2F2C;
    --brand: #A3322A; --brand-hover: #B83C33; --brand-ink: #FFFFFF; --brand-text: #EBA197; --brand-soft: #3A1D1A;
    --accent: #E3A64E; --accent-soft: #3A2C17;
    --side-bg: #0E0B0A; --side-fg: #EFE6E2; --side-muted: #9A8B86; --side-active: #3A1714;
    --ok: #7CCB98; --ok-soft: #1C3325; --warn: #E8B060; --warn-soft: #3A2C14; --bad: #F08F86; --bad-soft: #3D1C19; --info: #8DB9E2; --info-soft: #1A2B3B;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151110; --surface: #1F1917; --surface-2: #2A2220; --fg: #F1E9E6; --muted: #B3A39E; --line: #3A2F2C;
  --brand: #A3322A; --brand-hover: #B83C33; --brand-ink: #FFFFFF; --brand-text: #EBA197; --brand-soft: #3A1D1A;
  --accent: #E3A64E; --accent-soft: #3A2C17;
  --side-bg: #0E0B0A; --side-fg: #EFE6E2; --side-muted: #9A8B86; --side-active: #3A1714;
  --ok: #7CCB98; --ok-soft: #1C3325; --warn: #E8B060; --warn-soft: #3A2C14; --bad: #F08F86; --bad-soft: #3D1C19; --info: #8DB9E2; --info-soft: #1A2B3B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

/* ---------- Start screen ---------- */
.start {
  min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 32px;
}
.start-inner { width: 100%; max-width: 1080px; margin: 0 auto; display: grid; gap: 32px; align-content: center; }
.start-head { display: grid; gap: 10px; max-width: 640px; }
.start-head h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.start-head h1 em { font-family: var(--font-accent); font-weight: 500; font-style: italic; color: var(--brand-text); }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .08em; font-size: 14px; }
.wordmark .mark { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-family: var(--font-accent); font-style: italic; font-size: 18px; letter-spacing: 0; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.role-group { display: grid; gap: 12px; }
.role-group h2 { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.role-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: border-color .15s, transform .15s; box-shadow: var(--shadow);
}
.role-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.role-card .ico { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; }
.role-card strong { display: block; font-size: 16px; }
.role-card .who { font-size: 13px; color: var(--muted); }
.role-card .go { color: var(--muted); }
.start-foot { max-width: 1080px; width: 100%; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); padding-top: 24px; }

/* ---------- Portal switcher (top of every portal screen) ---------- */
.pswitch {
  display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none;
  background: var(--brand-deep, #38100E); color: #F4E9E5;
  padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.pswitch-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #C9A9A3; margin-right: 6px; }
.pswitch-btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px; color: #F4E9E5; text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; border: 1px solid rgba(255, 255, 255, .18); }
.pswitch-btn svg { width: 16px; height: 16px; }
.pswitch-btn:hover { background: rgba(255, 255, 255, .08); }
.pswitch-btn[aria-current="true"] { background: #D88B20; border-color: #D88B20; color: #201B19; }
.pswitch-home { margin-left: auto; color: #C9A9A3; font-size: 13px; white-space: nowrap; padding-left: 12px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-fg); display: flex; flex-direction: column; gap: 24px; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.app { min-height: calc(100vh - 50px); }
.side .wordmark { padding: 0 8px; }
.side .wordmark small { display: block; font-weight: 600; letter-spacing: .04em; font-size: 11px; color: var(--side-muted); }
.portal-label { padding: 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-fg); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover { background: rgba(255, 255, 255, .06); }
.nav a[aria-current="page"] { background: var(--side-active); box-shadow: inset 3px 0 0 #D88B20; }
.nav .badge { margin-left: auto; background: #D88B20; color: #201B19; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 7px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.me { display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #6A1D18; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.me strong { display: block; font-size: 14px; }
.me span { font-size: 12px; color: var(--side-muted); }
.switch { color: var(--side-muted); font-size: 13px; text-decoration: none; }
.switch:hover { color: var(--side-fg); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 22px 32px 0; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.proto-note { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.proto-note .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.view { padding: 20px 32px 48px; display: grid; gap: 20px; align-content: start; }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; font-weight: 800; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 12px; align-content: start; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .sub { font-size: 12px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-text); padding-inline: 6px; }
.btn-ghost:hover { border-color: transparent; text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brand { background: var(--brand-soft); color: var(--brand-text); }

.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-size: 13px; font-weight: 700; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px;
}
textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.radio-list { display: grid; gap: 6px; }
.radio { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; background: var(--surface); }
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio .pm { font-weight: 700; font-size: 14px; }
.radio .pm small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.brand > span { background: var(--brand); }

.empty { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
.list { display: grid; }
.list > * { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }

/* ---------- Client: menu + cart ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dish { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; grid-template-rows: auto 1fr auto; }
.dish h3 { font-size: 15px; font-weight: 800; }
.dish p { font-size: 13px; color: var(--muted); }
.dish .price { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.dish.off { opacity: .55; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { border: 0; background: var(--surface-2); width: 30px; height: 30px; cursor: pointer; font-weight: 800; }
.qty span { min-width: 30px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.cart { position: sticky; top: 16px; display: grid; gap: 14px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 14px; }
.totals { display: grid; gap: 4px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 800; font-size: 17px; padding-top: 6px; border-top: 1px solid var(--line); }

.basket-bar { display: none; }

/* Order tracker */
.track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.track .step { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.track .step::before { content: ""; height: 5px; border-radius: 99px; background: var(--surface-2); }
.track .step.done { color: var(--fg); }
.track .step.done::before { background: var(--brand); }
.track .step.now::before { background: var(--accent); }

/* ---------- Restaurant board ---------- */
.board-wrap { overflow-x: auto; }
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; min-width: 1000px; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: grid; gap: 10px; align-content: start; }
.col-head { display: flex; justify-content: space-between; font-weight: 800; font-size: 13px; padding: 2px 4px; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 8px; font-size: 13px; }
.ticket .ref { font-weight: 800; font-size: 14px; }
.ticket ul { margin: 0; padding-left: 18px; }
.ticket .note { background: var(--accent-soft); color: var(--fg); border-radius: 6px; padding: 6px 8px; }

/* ---------- Student ---------- */
.hello { font-family: var(--font-accent); font-style: italic; font-weight: 500; font-size: 26px; color: var(--brand-text); }
.timetable td, .timetable th { min-width: 130px; }
.slot { background: var(--surface-2); border-radius: 6px; padding: 8px; font-size: 13px; display: grid; gap: 2px; }
.slot strong { font-size: 13px; }
.slot.practical { background: var(--brand-soft); }
.notice h3 { font-size: 15px; font-weight: 800; }
.notice p { font-size: 14px; }

/* ---------- Modal + toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 10, 9, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 440px; padding: 22px; display: grid; gap: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { font-size: 18px; font-weight: 800; }
.amount-big { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.callout { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }

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

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .cart { position: static; scroll-margin-top: 120px; }
  .basket-bar {
    display: flex; justify-content: space-between; gap: 12px; align-items: center;
    position: fixed; z-index: 20; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 14px 18px;
    font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  }
  .view:has(.basket-bar) { padding-bottom: 96px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--side-bg); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .pswitch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .pswitch-label, .pswitch-home { display: none; }
  .pswitch-btn { flex-direction: column; gap: 3px; padding: 6px 2px; border-radius: 8px; font-size: 12px; justify-content: center; }
  .side {
    position: sticky; top: env(safe-area-inset-top, 0px); height: auto; z-index: 5; gap: 10px;
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
    display: grid; grid-template-columns: 1fr auto; align-items: center;
  }
  .side .wordmark { padding: 0; }
  .portal-label { display: none; }
  .side-foot { margin: 0; padding: 0; border: 0; grid-column: 2; grid-row: 1; }
  .side-foot .me { display: none; }
  .nav { grid-column: 1 / -1; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 #D88B20; }
  .topbar { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
  .view { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
  .grid-2, .role-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi .value { font-size: 19px; }
  .track .step { font-size: 11px; }
}

/* ---------- v2: student & school features ---------- */
.side { overflow-y: auto; }
.nav-head { display: block; padding: 14px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); }
.nav-head:first-child { padding-top: 0; }
.viewas { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.viewas select { width: auto; padding: 5px 8px; }
.video { aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); background: #201B19; color: #EFE6E2; display: grid; place-content: center; justify-items: center; gap: 10px; font-weight: 700; }
.video .play { width: 56px; height: 56px; border-radius: 50%; background: #D88B20; color: #201B19; display: grid; place-items: center; font-size: 22px; padding-left: 4px; }
.lesson-body { max-width: 68ch; white-space: normal; line-height: 1.7; }
fieldset.quiz { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
fieldset.quiz legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.tick { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.tick.on { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.thread { display: grid; gap: 10px; }
.msg { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; max-width: 85%; font-size: 14px; }
.msg.mine { background: var(--brand-soft); justify-self: end; }
.msg-meta { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.thread-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 6px; cursor: pointer; border-radius: 0; }
.thread-row:hover, .thread-row.on { background: var(--surface-2); }
.list > .thread-row { padding: 10px 6px; }
.badge-dot { width: 9px; height: 9px; border-radius: 50%; background: #D88B20; flex: none; }
.stars { color: var(--accent); letter-spacing: 2px; }
.rate { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rate label { position: relative; }
.rate input { position: absolute; opacity: 0; inset: 0; }
.rate span { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; font-weight: 800; cursor: pointer; background: var(--surface); }
.rate input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.rate input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip .x { border: 0; background: transparent; color: inherit; cursor: pointer; font-weight: 800; padding: 0 0 0 4px; font-size: 14px; line-height: 1; }
details summary { cursor: pointer; color: var(--brand-text); font-weight: 700; }
.modal.doc { max-width: 620px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--brand); }
.doc-head .wordmark small { display: block; font-weight: 600; letter-spacing: .04em; font-size: 11px; color: var(--muted); }
.doc-kind { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px 14px; font-size: 14px; }
.doc-grid span { color: var(--muted); }
.doc-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-weight: 700; }
.doc-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .nav-head { display: none; }
  .side { overflow: visible; }
  .viewas { width: 100%; }
}

/* ---------- v4: company footer, testimonials, Highfield logo ---------- */
.company { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; }
.company strong { color: var(--fg); }
figure.quote { margin: 0; display: grid; gap: 12px; align-content: space-between; }
figure.quote blockquote { margin: 0; font-family: var(--font-accent); font-style: italic; font-size: 17px; line-height: 1.5; }
figure.quote figcaption { display: grid; gap: 2px; }
.hf-logo { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex: none; }
.hf-banner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; flex-wrap: nowrap; }
.dish { grid-template-rows: auto auto 1fr auto; }
.dish-photo { width: calc(100% + 32px); max-width: none; margin: -16px -16px 4px; aspect-ratio: 4 / 3; height: auto; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; display: block; background: var(--surface-2); }
.dish:not(:has(.dish-photo)) { grid-template-rows: auto 1fr auto; }

/* ---------- v6: connected app ---------- */
button.switch { background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer; font-size: 13px; color: var(--side-muted); }
button.switch:hover { color: var(--side-fg); text-decoration: underline; }
button.pswitch-home { background: transparent; border: 0; cursor: pointer; text-decoration: underline; font: inherit; font-size: 13px; }
.sms { background: var(--surface-2); border-radius: 12px 12px 12px 4px; padding: 10px 12px; font-size: 14px; max-width: 46ch; }

/* ---------- v7: phone app ---------- */
.net-banner { position: fixed; z-index: 70; left: 0; right: 0; top: 0; padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); background: #9A5C06; color: #fff; font-weight: 700; font-size: 14px; text-align: center; }
.install-btn { width: 100%; background: transparent; color: var(--side-fg); border-color: rgba(255, 255, 255, .25); }

/* ---------- v8: kitchen extras ---------- */
.calc { background: var(--surface-2); border-radius: var(--radius); padding: 16px; }
#print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  .print-ticket { font-family: var(--font-ui); color: #000; width: 72mm; font-size: 13px; }
  .print-ticket h1 { font-size: 22px; margin: 0 0 4px; }
  .print-ticket ul { padding-left: 18px; font-size: 15px; }
  .print-ticket .note { border: 2px solid #000; padding: 6px; font-weight: 700; }
  .no-print { display: none !important; }
}

/* ---------- v9: school extras ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-link { font-weight: 700; color: var(--brand-text); word-break: break-word; }
.idcard { width: 100%; max-width: 86mm; aspect-ratio: 85.6 / 54; border-radius: 12px; overflow: hidden; background: #fff; color: #201B19; border: 1px solid #E6DAD6; display: grid; grid-template-rows: auto 1fr auto; box-shadow: var(--shadow); font-size: 11px; }
.idcard-top { background: #6A1D18; color: #fff; display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.idcard-top .mark { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #6A1D18; display: grid; place-items: center; font-family: var(--font-accent); font-style: italic; font-size: 17px; }
.idcard-top strong { display: block; letter-spacing: .08em; font-size: 12px; } .idcard-top small { display: block; opacity: .8; font-size: 9px; }
.idcard-body { display: flex; gap: 12px; align-items: center; padding: 8px 12px; }
.idcard-photo { width: 56px; height: 68px; border-radius: 6px; background: #F2E9E6; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #6A1D18; flex: none; }
.idcard-name { font-weight: 800; font-size: 15px; } .idcard-no { font-weight: 800; color: #A8620B; letter-spacing: .04em; } .idcard-prog { font-weight: 700; } .idcard-meta { color: #6E625E; }
.idcard-foot { background: #F2E9E6; padding: 5px 12px; font-size: 8px; color: #6E625E; }
@media print {
  .print-doc { color: #000; font-family: var(--font-ui); }
  .print-doc .card, .print-doc .kpi { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .print-doc .idcard { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- v10: customer extras ---------- */
.addr-chip { display: inline-flex; align-items: center; gap: 2px; }
.addr-chip .x { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0 4px; }
.reward-line { display: flex; justify-content: space-between; color: var(--ok); font-weight: 700; font-variant-numeric: tabular-nums; }
.loyalty { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }
.loyalty .dots { display: flex; gap: 4px; }
.loyalty .dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.loyalty .dots span.on { background: var(--accent); }
.loyalty .dots span.gift { border-style: dashed; }

/* ---------- v11: import ---------- */
.steps-list { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.steps-list li { padding-left: 4px; }

/* ---------- v12: accessibility ---------- */
.dish h2 { font-size: 15px; font-weight: 800; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dish.off { opacity: 1; }
.dish.off .dish-photo { filter: grayscale(1); opacity: .45; }
.dish.off .price { color: var(--muted); }
/* Wide tables scroll inside their own box instead of widening the page on small phones. */
.view { grid-template-columns: minmax(0, 1fr); }
.view > *, .grid-2 > *, .grid-main > *, .stack > * { min-width: 0; }
.table-wrap, .card { position: relative; } /* keep screen-reader-only labels inside their scroll box */

/* Language switch (customer screens) */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; flex: none; }
.lang-switch button { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; min-height: 32px; background: transparent; border: 0; color: inherit; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.lang-switch.on-dark { border-color: rgba(255, 255, 255, .2); justify-self: start; }

.lang-switch .ls-short { display: none; }
.lang-switch button { white-space: nowrap; position: relative; }
@media (max-width: 520px) {
  .lang-switch .ls-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lang-switch .ls-short { display: inline; }
  .lang-switch button { padding: 6px 10px; }
}
@media (max-width: 860px) {
  .side-foot { display: flex; align-items: center; gap: 12px; }
}
