/* KOPA ORDER — design system.
   Flat, tile-based ("metro") admin look: white surfaces on a soft grey
   canvas, coloured icon tiles, one accent per meaning.

   Themes (on .page, see base.html):
     .theme-light  store workspace, platform console (dark mode: [data-theme=dark] on <html>)
     .theme-dark   customer pages, login, display screens (brand dark)
   Section styles live in sections.css and use these variables. */

/* ---------- tokens ---------- */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgb(56 65 74 / 6%), 0 4px 14px rgb(56 65 74 / 6%);
  --shadow-lg: 0 10px 30px rgb(30 41 59 / 14%);
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --focus: #f7b84b;
  --c-primary: #405189;
  --c-teal: #0ab39c;
  --c-blue: #299cdb;
  --c-amber: #f7b84b;
  --c-red: #f06548;
  --c-purple: #6559cc;
  --c-pink: #e83e8c;
  --c-slate: #3577f1;
}

.theme-light {
  color-scheme: light;
  --bg: #f3f3f9;
  --bg-grad: #f3f3f9;
  --ink: #212529;
  --ink-strong: #0f172a;
  --muted: #878a99;
  --panel: #ffffff;
  --card: #ffffff;
  --panel-border: #e9ebec;
  --line: #f1f2f4;
  --primary: var(--c-teal);
  --primary-ink: #ffffff;
  --alt: #f3f6f9;
  --alt-ink: #495057;
  --danger: var(--c-red);
  --blue: var(--c-primary);
  --input: #ffffff;
  --input-border: #ced4da;
  --link: var(--c-primary);
  --sidebar-bg: #ffffff;
  --sidebar-ink: #6d7080;
  --sidebar-active: var(--c-primary);
  --topbar-bg: #ffffff;
  --new: var(--c-red);
  --accepted: var(--c-amber);
  --done: var(--c-teal);
}

:root[data-theme="dark"] .theme-light {
  color-scheme: dark;
  --bg: #1a1d21;
  --bg-grad: #1a1d21;
  --ink: #ced4da;
  --ink-strong: #f1f5f9;
  --panel: #212529;
  --card: #212529;
  --panel-border: #2a2f34;
  --line: #2a2f34;
  --alt: #2a2f34;
  --alt-ink: #ced4da;
  --input: #262a2f;
  --input-border: #2f343a;
  --link: #8ea0e3;
  --sidebar-bg: #212529;
  --sidebar-ink: #a6b0cf;
  --sidebar-active: #ffffff;
  --topbar-bg: #212529;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%);
}

.theme-dark {
  color-scheme: dark;
  --bg: #0c1324;
  --bg-grad: radial-gradient(ellipse at 50% -20%, #1d3a4c 0%, #101a31 45%, #0c1324 80%);
  --ink: #ecf4ff;
  --ink-strong: #ffffff;
  --muted: #a6b3c7;
  --panel: #17233a;
  --card: #17233a;
  --panel-border: #283752;
  --line: #22304a;
  --primary: #34c3a0;
  --primary-ink: #062a24;
  --alt: #24344f;
  --alt-ink: #e6eefb;
  --danger: #e5566b;
  --blue: #4f7bd9;
  --input: #0f1a2e;
  --input-border: #3a4c68;
  --link: #7bc9ff;
  --new: #fb6a77;
  --accepted: #f6c75c;
  --done: #37c18d;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; background: #f3f3f9; overflow-x: clip; }
:root[data-theme="dark"] body { background: #1a1d21; }
.page { min-height: 100vh; background: var(--bg-grad); background-color: var(--bg); color: var(--ink); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; font-weight: 700; margin: 0 0 .5em; color: var(--ink-strong); }
h1 { font-size: clamp(20px, 2.6vw, 26px); }
h2 { font-size: 16px; }
h3 { font-size: 14.5px; }
code { font-size: 12.5px; color: var(--c-pink); word-break: break-all; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-s { gap: 8px; }
.stack { display: grid; gap: 12px; }
.inline { display: inline; }
.hidden { display: none !important; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.span2 { grid-column: span 2; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 16px; }

/* ---------- icons ---------- */
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.i-lg { width: 22px; height: 22px; }

/* ---------- cards & panels ---------- */
.panel, .card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  padding: 20px; margin: 0 0 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -20px -20px 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 15px; }
.card.link { display: block; color: inherit; transition: transform .15s, box-shadow .15s; }
.card.link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.panel-accent { border-left: 4px solid var(--c-teal); }
.hero { background: linear-gradient(120deg, var(--c-primary), #2a3a6b); color: #fff; border-radius: var(--radius); padding: 24px; margin: 0 0 20px; }
.hero h1, .hero h2, .hero p { color: #fff; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty span { font-size: 34px; display: block; margin-bottom: 6px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* ---------- metro stat tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; margin-bottom: 20px; }
.kpi {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 4px 12px; color: inherit;
  background: var(--card); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s; animation: rise .3s ease-out;
}
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.kpi-label { grid-column: 1; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.kpi-value { grid-column: 1; font-size: 26px; font-weight: 700; color: var(--ink-strong); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-icon { grid-column: 2; grid-row: 1 / span 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; font-size: 22px; background: rgb(10 179 156 / 12%); color: var(--c-teal); }
.kpi-sub { grid-column: 1; font-size: 12px; color: var(--muted); }
.kpi-urgent .kpi-value { color: var(--c-red); }
.tone-teal .kpi-icon { background: rgb(10 179 156 / 12%); color: var(--c-teal); }
.tone-blue .kpi-icon { background: rgb(41 156 219 / 12%); color: var(--c-blue); }
.tone-amber .kpi-icon { background: rgb(247 184 75 / 16%); color: #d99a2b; }
.tone-red .kpi-icon { background: rgb(240 101 72 / 12%); color: var(--c-red); }
.tone-purple .kpi-icon { background: rgb(101 89 204 / 12%); color: var(--c-purple); }
.tone-primary .kpi-icon { background: rgb(64 81 137 / 12%); color: var(--c-primary); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 112px; padding: 16px;
  border-radius: var(--radius); color: #fff; font-weight: 700; background: var(--c-primary); box-shadow: var(--shadow);
  transition: transform .15s, filter .15s; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.tile:hover { transform: translateY(-2px); filter: brightness(1.06); text-decoration: none; color: #fff; }
.tile .i { width: 28px; height: 28px; }
.tile small { display: block; font-weight: 500; opacity: .85; }
.tile.teal { background: var(--c-teal); } .tile.blue { background: var(--c-blue); } .tile.amber { background: #e7a73b; }
.tile.red { background: var(--c-red); } .tile.purple { background: var(--c-purple); } .tile.slate { background: var(--c-slate); }
.tile.pink { background: var(--c-pink); }
.tile-count { position: absolute; top: 14px; right: 16px; font-size: 26px; line-height: 1; font-weight: 800; }
.trend { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.trend-up { background: rgb(10 179 156 / 12%); color: var(--c-teal); }
.trend-down { background: rgb(240 101 72 / 12%); color: var(--c-red); }
.trend-flat { background: var(--alt); color: var(--muted); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--c-primary); }
.chart .bar-alt { fill: var(--c-teal); }
.chart .bar:hover, .chart .bar-alt:hover { opacity: .8; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grow { transform-box: fill-box; transform-origin: bottom; animation: grow .5s ease-out both; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-track { height: 10px; border-radius: 5px; background: var(--alt); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--c-blue), var(--c-primary)); transform-origin: left; animation: grow-x .5s ease-out both; }
.hbar-val { font-variant-numeric: tabular-nums; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--c-primary); }
.legend i.alt { background: var(--c-teal); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius-s);
  background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: filter .15s, background .15s, transform .05s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.alt { background: var(--alt); color: var(--alt-ink); border-color: var(--panel-border); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.tiny { min-height: 30px; padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: var(--primary-ink); min-height: 44px; }
.btn.ghost { background: transparent; color: var(--alt-ink); }

/* ---------- forms ---------- */
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; font-size: 15px;
  color: var(--ink); background: var(--input); border: 1px solid var(--input-border); border-radius: var(--radius-s);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgb(64 81 137 / 18%); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--c-primary); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
textarea { min-height: 90px; }
details summary { cursor: pointer; font-weight: 600; }
.note { color: var(--muted); font-size: 13px; }

/* ---------- flash & chips ---------- */
.flash-area { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(420px, calc(100% - 32px)); }
.flash { padding: 12px 16px; border-radius: 10px; margin-top: 8px; font-weight: 600; box-shadow: var(--shadow-lg); animation: flash-in .25s ease-out, flash-out 6s forwards; border: 1px solid; }
.flash-ok { background: #e6f7f4; border-color: #9fe0d5; color: #087463; }
.flash-error { background: #fdeeea; border-color: #f7b6a8; color: #b3341b; }
.flash-info { background: #e8f4fb; border-color: #a9d6f0; color: #1d6a95; }
.theme-dark .flash-ok { background: #123b35; border-color: #29bc93; color: #b0ffde; }
.theme-dark .flash-error { background: #4a1d26; border-color: #ff8092; color: #ffd0d3; }
#call-result .flash, .inline-flash .flash { animation: flash-in .25s ease-out; box-shadow: none; }
@keyframes flash-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes flash-out { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.chip, .badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--alt); color: var(--alt-ink); white-space: nowrap; }
.chip-new { background: rgb(240 101 72 / 12%); color: var(--c-red); }
.chip-accepted { background: rgb(247 184 75 / 18%); color: #b7791f; }
.chip-done { background: rgb(10 179 156 / 12%); color: var(--c-teal); }
.badge-ok { background: rgb(10 179 156 / 12%); color: var(--c-teal); }
.badge-off { background: rgb(240 101 72 / 12%); color: var(--c-red); }
.count-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c-red); color: #fff; font-size: 11px; font-weight: 700; }

/* ---------- tables ---------- */
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: var(--alt); font-weight: 600; }
table.data tr:hover td { background: rgb(64 81 137 / 3%); }
.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--panel-border); }

/* ---------- requests ---------- */
.requests { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.request { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; background: var(--card); border: 1px solid var(--panel-border); border-left: 4px solid var(--new); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); animation: rise .25s ease-out; }
.request-accepted { border-left-color: var(--accepted); }
.request-done { border-left-color: var(--done); opacity: .75; }
.request-main { display: grid; }
.request-table { font-size: 16px; color: var(--ink-strong); }
.request-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.done-list { margin-top: 20px; }

/* ---------- app shell: sidebar + appbar ---------- */
.workspace { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar-bg); color: var(--sidebar-ink); border-right: 1px solid var(--panel-border); display: flex; flex-direction: column; z-index: 30; }
.sidebar .logo { display: flex; gap: 10px; align-items: center; height: var(--topbar-h); padding: 0 22px; color: var(--ink-strong); flex: none; }
.sidebar .logo:hover { text-decoration: none; }
.sidebar .logo small { display: block; font-size: 9.5px; letter-spacing: 2px; color: var(--muted); font-weight: 600; }
.mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, var(--c-teal), var(--c-primary)); color: #fff; font-weight: 800; }
.store-name { font-weight: 700; color: var(--ink-strong); font-size: 14px; padding: 0 22px; }
.who { color: var(--muted); padding: 2px 22px 8px; }
.nav { display: grid; gap: 1px; padding: 4px 12px 16px; }
.nav a { display: flex; align-items: center; gap: 12px; color: var(--sidebar-ink); padding: 9px 12px; border-radius: 8px; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { color: var(--sidebar-active); background: rgb(64 81 137 / 6%); text-decoration: none; }
.nav a.active { color: var(--sidebar-active); background: rgb(64 81 137 / 10%); font-weight: 600; }
:root[data-theme="dark"] .nav a.active { background: rgb(255 255 255 / 8%); }
.nav a .count-badge { margin-left: auto; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 16px 12px 6px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.btn.logout { background: transparent; color: var(--c-red); border-color: transparent; justify-content: flex-start; width: 100%; }
.main { min-width: 0; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 24px; background: var(--topbar-bg); border-bottom: 1px solid var(--panel-border); box-shadow: var(--shadow); }
.appbar .crumbs { flex: 1; min-width: 0; }
.appbar .crumb { font-size: 12px; color: var(--muted); }
.appbar .title { font-size: 16px; font-weight: 700; margin: 0; color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--alt-ink); background: transparent; border: 0; cursor: pointer; }
.appbar-btn:hover { background: var(--alt); text-decoration: none; }
.appbar-btn .count-badge { position: absolute; top: 2px; right: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgb(64 81 137 / 14%); color: var(--c-primary); font-weight: 700; }
.user-chip strong { display: block; font-size: 13px; color: var(--ink-strong); line-height: 1.2; }
.user-chip span { font-size: 12px; color: var(--muted); }
.content { padding: 24px; width: 100%; max-width: 1440px; animation: fade .2s ease-out; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.menu-toggle { display: none; }
#nav-toggle { display: none; }
.scrim { display: none; }

/* ---------- loading: progress bar, spinners, skeletons ---------- */
#progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 100; pointer-events: none; }
#progress::before { content: ""; display: block; height: 100%; width: 0; opacity: 0; background: linear-gradient(90deg, var(--c-teal), var(--c-blue), var(--c-primary)); box-shadow: 0 0 8px rgb(41 156 219 / 60%); }
#progress.run::before { opacity: 1; width: 85%; transition: width 6s cubic-bezier(.1, .7, .1, 1); }
#progress.done::before { opacity: 0; width: 100%; transition: width .15s ease, opacity .4s .15s; }
/* Only the form that was submitted (not a list that is refreshing around it). */
form.htmx-request .btn[type=submit], .btn.htmx-request { color: transparent !important; pointer-events: none; }
form.htmx-request .btn[type=submit]::after, .btn.htmx-request::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / 45%); border-top-color: #fff; animation: spin .7s linear infinite; }
form.htmx-request .btn.alt[type=submit]::after, .btn.alt.htmx-request::after { border-color: rgb(64 81 137 / 30%); border-top-color: var(--c-primary); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--c-primary); animation: spin .8s linear infinite; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.skeleton { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--alt) 25%, var(--line) 37%, var(--alt) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.skeleton.line { height: 12px; margin: 10px 0; }
.skeleton.line.short { width: 40%; }
.skeleton.block { height: 160px; border-radius: var(--radius); }
.skeleton-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; margin-bottom: 20px; }
.skeleton-kpis .skeleton { height: 104px; border-radius: var(--radius); }
.htmx-swapping { opacity: .5; transition: opacity .12s; }
.htmx-added { animation: fade .25s ease-out; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- live alert bar ---------- */
.alert-bar { display: flex; align-items: center; gap: 14px; margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius); background: linear-gradient(90deg, #f06548, #e0476b); color: #fff; box-shadow: 0 8px 22px rgb(240 101 72 / 30%); animation: rise .25s ease-out; }
.alert-bar a { color: #fff; font-weight: 700; margin-right: 12px; }
.alert-bell { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgb(255 255 255 / 18%); font-size: 20px; animation: bell 1.2s ease-in-out infinite; transform-origin: top center; }
.alert-text { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.alert-latest { font-size: 12.5px; opacity: .92; }
.alert-bar .btn.alt { background: rgb(255 255 255 / 18%); border-color: transparent; color: #fff; }
@keyframes bell { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }

/* ---------- public pages ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: rgb(12 19 36 / 85%); border-bottom: 1px solid var(--panel-border); backdrop-filter: blur(10px); }
.theme-light .topbar { background: rgb(255 255 255 / 92%); }
.topbar .container { padding-top: 10px; padding-bottom: 10px; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: 1px; color: var(--ink-strong); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--c-teal); }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.login-mode { background: radial-gradient(ellipse at 50% -15%, #244e59 0%, #111e31 46%, #0c1324 83%); }
.login-wrap { max-width: 460px; margin: 0 auto; padding-top: 8vh; animation: rise .3s ease-out; }
.login-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; color: #fff; }
.login-brand small { display: block; font-size: 9.5px; letter-spacing: 2px; color: #84b3be; }
.auth-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 28px; box-shadow: 0 24px 60px rgb(0 0 0 / 45%); }
.lead { color: var(--muted); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--input); padding: 4px; border-radius: 10px; margin: 18px 0; }
.tabs a { text-align: center; padding: 9px 4px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { background: var(--alt); color: var(--ink-strong); box-shadow: var(--shadow); }
.store-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 20px; }
.store-card { display: grid; gap: 6px; padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--panel-border); color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; }
.store-card strong { color: var(--ink-strong); font-size: 16px; }
.store-card:hover { transform: translateY(-2px); text-decoration: none; }
.store-card.off { opacity: .6; }

/* ---------- guest (customer) pages ---------- */
.guest-head { text-align: center; margin: 28px 0 22px; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 11.5px; color: var(--primary); margin: 0; font-weight: 700; }
.guest-buttons { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.actionbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 128px; padding: 22px 10px; border-radius: 16px; border: 1px solid var(--panel-border); background: var(--panel); color: var(--ink); font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; text-align: center; transition: transform .12s, background .15s, border-color .15s; box-shadow: 0 6px 18px rgb(0 0 0 / 25%); }
.actionbtn:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-2px); }
.actionbtn span { font-size: 34px; }
.actionbtn:active, .actionbtn.htmx-request, form.htmx-request .actionbtn { background: var(--primary); color: var(--primary-ink); }
.actionbtn-order { border-color: var(--primary); }
.lang a { color: var(--muted); margin-left: 10px; font-weight: 700; }
.lang a[aria-current] { color: var(--primary); }
.menu-group { margin: 24px 0; }
.menu-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.menu-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.menu-item:not(:has(img)) { grid-template-columns: 1fr auto; }
.price { font-weight: 700; white-space: nowrap; }
.menu-photo { width: 100%; border-radius: 12px; margin: 8px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { :root { --sidebar-w: 220px; } }
@media (max-width: 860px) {
  /* Mobile menu: a grid of boxes at the top; once scrolled it shrinks to a
     hover on devices with a mouse, opens the boxes again (.nav-open). */
  .workspace { display: block; }
  .sidebar { position: static; height: auto; width: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--panel-border); box-shadow: var(--shadow); }
  .sidebar .logo { height: 52px; padding: 0 16px; }
  .store-name { padding: 0 16px; }
  .who, .nav-title, .sidebar-foot { display: none; }
  .nav { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; padding: 10px 12px 14px; }
  .nav a { flex-direction: column; justify-content: center; text-align: center; gap: 6px; min-height: 76px; padding: 10px 6px; border: 1px solid var(--panel-border); border-radius: 12px; background: var(--card); font-size: 12px; line-height: 1.2; }
  .nav a .i-lg { width: 24px; height: 24px; }
  .nav a.active { border-color: var(--c-primary); }
  .appbar { position: static; padding: 0 12px; }
  .user-chip div { display: none; }
  .content { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .kpi-icon { width: 38px; height: 38px; font-size: 18px; }
  .span2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .appbar, .topbar, .footer, .no-print, .flash-area, #progress, #live-alerts { display: none !important; }
  .workspace { display: block; }
  body, .page { background: #fff; color: #000; }
}

/* == dashboards == */
.dash-head { align-items: center; }
.dash-head p { margin: 0; display: flex; align-items: center; gap: 6px; }
.dash-row { margin-bottom: 0; }
.dash-row > .card { min-width: 0; }
.dash-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; }
.dash-sum strong { font-size: 22px; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.chart .chart-val { fill: var(--ink); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-teal); box-shadow: 0 0 0 3px rgb(10 179 156 / 18%); vertical-align: 1px; }
.dot.off { background: var(--c-red); box-shadow: 0 0 0 3px rgb(240 101 72 / 16%); }
.dash-reqs li { padding-left: 10px; border-left: 3px solid var(--done); }
.dash-reqs li.dash-req-new { border-left-color: var(--new); }
.dash-reqs li.dash-req-accepted { border-left-color: var(--accepted); }
.dash-req-main { min-width: 0; }
.dash-big .request-actions .btn { min-height: 46px; padding: 10px 18px; font-size: 15px; }
.dash-big .request-actions form { flex: 1 1 160px; display: flex; }
.dash-big .request-actions .btn { flex: 1; }
.dash-tiles .tile { min-height: 120px; }
.dash-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.dtable { display: grid; align-content: space-between; gap: 6px; min-height: 88px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--panel-border); border-top: 4px solid var(--panel-border); color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.dtable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.dtable strong { font-size: 16px; color: var(--ink-strong); }
.dtable .small { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; color: var(--muted); }
.dtable-help { border-top-color: var(--c-red); background: rgb(240 101 72 / 7%); }
.dtable-help .small { color: var(--c-red); font-weight: 600; }
.dtable-order { border-top-color: var(--c-amber); }
.dtable-order .small { color: var(--ink); font-weight: 600; }
.dtable-paid { border-top-color: var(--c-teal); }
.dtable-paid .small { color: var(--c-teal); }
.dash-legend { flex-wrap: wrap; }
.legend i.l-help { background: var(--c-red); }
.legend i.l-order { background: var(--c-amber); }
.legend i.l-paid { background: var(--c-teal); }
.legend i.l-free { background: var(--panel-border); }
@media (max-width: 860px) {
  .dash-tables { grid-template-columns: repeat(2, 1fr); }
  .dash-head .row { width: 100%; }
}

/* dashboards: touch & narrow screens */
.chart-rows { display: none; gap: 8px; }
.chart-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; font-size: 13px; min-height: 28px; }
.chart-row-label { color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-row-bars { display: grid; gap: 3px; }
.chart-row .hbar-track.alt .hbar-fill { background: var(--c-teal); }
.chart-row .hbar-val { text-align: right; line-height: 1.2; }
.chart-row .hbar-val small { display: block; color: var(--c-teal); }
@media (max-width: 560px) {
  .chart { display: none; }
  .chart-rows { display: grid; }
}
.dtable { min-height: 96px; }
@media (pointer: coarse) {
  .dtable:hover { transform: none; box-shadow: var(--shadow); }
  .dtable:active { transform: scale(.97); filter: brightness(.95); }
  .dash-reqs .btn { min-height: 44px; }
}
@media (max-width: 860px) {
  .dash-tables { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dtable { min-height: 104px; padding: 14px 12px; }
  .dtable strong { font-size: 18px; }
  .dash-reqs li { flex-direction: column; align-items: stretch; }
  .dash-reqs li .row { display: grid; grid-template-columns: 1fr 1fr; }
  .dash-reqs li .row form:only-child { grid-column: 1 / -1; }
  .dash-reqs li .row .btn { width: 100%; }
  .dash-big .request-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .dash-big .request-actions form, .dash-big .request-actions .btn { width: 100%; }
  .dash-big .request-actions .btn { min-height: 52px; font-size: 16px; }
  .dash-big .request { grid-template-columns: 1fr auto; }
  .dash-tiles .tile { min-height: 112px; }
}

/* == touch == */
/* Touchscreens (any size): big targets, press feedback instead of hover,
   no double-tap zoom delay, no iOS input zoom, safe-area padding. */
html { -webkit-tap-highlight-color: transparent; }
a, button, label, summary, input, select, textarea, .btn, .tile, .kpi, .nav a { touch-action: manipulation; }
@media (pointer: coarse) {
  body { font-size: 15.5px; }
  .btn { min-height: 46px; padding: 10px 18px; border-radius: 10px; }
  .btn.tiny { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .appbar-btn { width: 46px; height: 46px; }
  input, select, textarea { min-height: 48px; font-size: 16px; padding: 10px 14px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .check { min-height: 44px; gap: 12px; }
  label { font-size: 14px; }
  details summary { min-height: 44px; display: flex; align-items: center; }
  .row.gap-s, .request-actions { gap: 10px; }
  .request { padding: 14px 16px; }
  .request-actions .btn { flex: 1 1 auto; }
  .nav a { min-height: 48px; }
  table.data th, table.data td { padding: 12px; }
  .chip, .badge { padding: 4px 10px; font-size: 12.5px; }
  /* Press feedback (there is no hover on touch). */
  .btn:active, .tile:active, .kpi:active, .store-card:active, .nav a:active, .actionbtn:active { transform: scale(.97); filter: brightness(.95); }
  .card.link:hover, a.kpi:hover, .tile:hover, .store-card:hover, .actionbtn:hover { transform: none; }
  .flash-area { right: 12px; left: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 860px) {
  .content { padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn, .page-head form, .page-head .row { width: 100%; }
  .card { padding: 16px; border-radius: 14px; }
  .card-head { margin: -16px -16px 14px; padding: 12px 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; gap: 14px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile { min-height: 104px; }
  /* Forms: one column, full-width submit buttons. */
  form.stack > .btn[type=submit], form.stack > div > .btn[type=submit] { width: 100%; }
  .alert-bar { flex-wrap: wrap; }
}

/* == notification center == */
/* Pinned bar: fixed at the top (under the app bar) or the bottom of the
   screen; ui.js picks the side (bottom on phones by default) and 📌 flips it. */
#live-alerts.pinned { position: sticky; z-index: 35; }
#live-alerts.pin-top { top: calc(var(--topbar-h) + 8px); }
#live-alerts.pin-bottom { position: fixed; left: calc(var(--sidebar-w) + 24px); right: 24px; bottom: calc(16px + env(safe-area-inset-bottom)); top: auto; }
#live-alerts.pin-bottom .alert-bar { margin: 0; box-shadow: 0 -4px 30px rgb(15 23 42 / 25%), 0 8px 22px rgb(240 101 72 / 30%); }
.alert-bar { padding: 8px 8px 8px 10px; gap: 8px; }
.alert-open { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px; border: 0; background: transparent; color: #fff; font: inherit; text-align: left; cursor: pointer; }
.alert-open strong { font-size: 15px; }
.alert-cta { margin-left: auto; padding: 6px 12px; border-radius: 8px; background: rgb(255 255 255 / 20%); font-weight: 700; font-size: 13px; white-space: nowrap; }
.alert-tool { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgb(255 255 255 / 16%); color: #fff; font-size: 18px; cursor: pointer; flex: none; }
.alert-open:hover .alert-cta, .alert-tool:hover { background: rgb(255 255 255 / 28%); }

/* Modal (native <dialog>): a sheet from the bottom on phones, a centred panel on desktop. */
.modal { width: min(640px, calc(100% - 32px)); max-height: min(86vh, 900px); padding: 0; border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; animation: modal-in .2s ease-out; }
.modal::backdrop { background: rgb(15 23 42 / 55%); backdrop-filter: blur(2px); }
#notif-panel, .notif { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.notif-head, .notif-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--line); flex: none; }
.notif-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.notif-foot { border-bottom: 0; border-top: 1px solid var(--line); }
.notif-body { overflow-y: auto; padding: 8px 20px 20px; -webkit-overflow-scrolling: touch; }
.notif-section { display: flex; align-items: center; gap: 8px; margin: 16px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notif-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 14px; border-radius: 12px; background: var(--alt); border-left: 5px solid var(--new); }
.notif-accepted { border-left-color: var(--accepted); }
.notif-order { border-left-color: var(--c-blue); }
.notif-main { display: grid; gap: 2px; min-width: 0; }
.notif-table { font-size: 18px; font-weight: 800; color: var(--ink-strong); }
.notif-what { font-size: 16px; font-weight: 600; }
.notif-meta { font-size: 13px; color: var(--muted); }
.notif-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.notif-actions form, .notif-actions > .btn { flex: 1 1 160px; }
.notif-actions .btn { width: 100%; min-height: 48px; font-size: 15px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) {
  #live-alerts.pin-bottom { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  #live-alerts.pin-top { top: 8px; }
  .alert-latest { display: none; }
  .modal { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .modal[open] { animation: sheet-in .22s ease-out; }
  .notif-body { padding: 6px 14px calc(16px + env(safe-area-inset-bottom)); }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
/* Leave room so the bottom bar never covers the last content. */
.content:has(#live-alerts.pin-bottom .alert-bar) { padding-bottom: 110px; }

/* == mobile menu strip == */
/* Phones: the box grid (in .sidebar) scrolls away with the page; once it is
   out of view, ui.js adds .nav-compact and this fixed strip slides in. It
   overlays the page, so the page height never changes (no scroll jumps).
   The chevron, or a hover with a mouse, opens the boxes as a dropdown. */
.nav-strip { display: none; }
@media (max-width: 860px) {
  .nav-strip {
    display: flex; position: fixed; z-index: 45; top: 0; left: 0; right: 0; padding: calc(6px + env(safe-area-inset-top)) 6px 6px 8px;
    background: color-mix(in srgb, var(--topbar-bg) 88%, transparent); backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--panel-border); box-shadow: var(--shadow); align-items: flex-start; gap: 6px;
    transform: translateY(-110%); transition: transform .22s ease;
  }
  .workspace.nav-compact .nav-strip { transform: none; }
  .strip-nav { flex: 1; display: flex; gap: 2px; padding: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x mandatory; }
  .strip-nav::-webkit-scrollbar { display: none; }
  .strip-nav .nav-title { display: none; }
  .strip-nav a { flex: none; width: 48px; min-height: 44px; padding: 8px; border: 0; background: transparent; scroll-snap-align: start; }
  .strip-nav a span { display: none; }
  .strip-nav a.active { background: rgb(64 81 137 / 12%); }
  .nav-expand { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--alt); color: var(--alt-ink); cursor: pointer; }
  .nav-expand svg { transition: transform .2s; }
  .workspace.nav-open .strip-nav, .nav-strip:hover .strip-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-height: 70vh; overflow-y: auto; padding: 4px 2px 8px; }
  .workspace.nav-open .strip-nav a, .nav-strip:hover .strip-nav a { width: auto; min-height: 76px; border: 1px solid var(--panel-border); background: var(--card); }
  .workspace.nav-open .strip-nav a span, .nav-strip:hover .strip-nav a span { display: inline; }
  .workspace.nav-open .nav-expand svg { transform: rotate(180deg); }
  @media (hover: none) { .nav-strip:hover .strip-nav { display: flex; } .nav-strip:hover .strip-nav a { width: 48px; min-height: 44px; border: 0; background: transparent; } .nav-strip:hover .strip-nav a span { display: none; } .workspace.nav-open .strip-nav { display: grid; } }
}

/* == polish (modern layer) == */
:root { --radius: 16px; --radius-s: 10px; }
.theme-light {
  --bg: #f4f6fb;
  --shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 6px 24px -6px rgb(16 24 40 / 10%);
  --shadow-lg: 0 18px 44px -12px rgb(16 24 40 / 22%);
  --panel-border: rgb(16 24 40 / 6%);
}
:root[data-theme="dark"] .theme-light { --panel-border: rgb(255 255 255 / 6%); --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -8px rgb(0 0 0 / 50%); }
/* A soft colour wash behind the workspace. */
.theme-light .main { background:
  radial-gradient(900px 320px at 85% -80px, rgb(41 156 219 / 10%), transparent 70%),
  radial-gradient(700px 280px at 10% -60px, rgb(10 179 156 / 10%), transparent 70%); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; letter-spacing: -.005em; }
h1, h2 { letter-spacing: -.02em; }

/* Glass app bar. */
.appbar { background: color-mix(in srgb, var(--topbar-bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.5); box-shadow: none; }
.appbar .title { font-size: 18px; letter-spacing: -.02em; }

/* Cards: defined by shadow, not borders; gentle lift on links. */
.card, .panel, .kpi, .request, .store-card { border-color: var(--panel-border); }
.card-head { border-bottom-color: var(--line); }
.card-head h2 { font-weight: 700; }

/* Stat tiles: gradient icon squares. */
.kpi { padding: 20px; gap: 6px 14px; }
.kpi-value { font-size: 28px; letter-spacing: -.02em; }
.kpi-icon { width: 52px; height: 52px; border-radius: 14px; color: #fff !important; box-shadow: 0 8px 18px -8px currentColor; }
.kpi-icon, .tone-teal .kpi-icon { background: linear-gradient(135deg, #2ad4b5, #0a9f8b); color: #0ab39c; }
.tone-blue .kpi-icon { background: linear-gradient(135deg, #4fb6ee, #1f7fc0); }
.tone-amber .kpi-icon { background: linear-gradient(135deg, #ffcf6e, #ef9f25); }
.tone-red .kpi-icon { background: linear-gradient(135deg, #ff8a6b, #e2483a); }
.tone-purple .kpi-icon { background: linear-gradient(135deg, #8b7ff0, #5446c2); }
.tone-primary .kpi-icon { background: linear-gradient(135deg, #6074c2, #33437a); }
.kpi-icon svg { filter: drop-shadow(0 1px 1px rgb(0 0 0 / 15%)); }

/* Metro tiles: subtle gradients and depth. */
.tile { border-radius: 18px; background-image: linear-gradient(150deg, rgb(255 255 255 / 16%), transparent 55%); box-shadow: 0 10px 24px -12px rgb(16 24 40 / 45%); }

/* Sidebar: active item is a gradient pill with an indicator. */
.sidebar { background: var(--sidebar-bg); }
.nav a { border-radius: 12px; }
.nav a.active { position: relative; color: #fff; background: linear-gradient(135deg, #5266b0, #3a4a86); box-shadow: 0 8px 18px -10px rgb(64 81 137 / 70%); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c-teal); }
:root[data-theme="dark"] .nav a.active { background: linear-gradient(135deg, #3d4f8f, #2b3866); }
.strip-nav a.active { color: #fff; }
.mark { border-radius: 12px; box-shadow: 0 6px 14px -6px rgb(10 179 156 / 70%); }

/* Buttons: glossy primary, softer secondary. */
.btn { border-radius: 12px; font-weight: 600; }
.btn:not(.alt):not(.ghost):not(.danger) { background-image: linear-gradient(180deg, rgb(255 255 255 / 14%), transparent); box-shadow: 0 6px 14px -8px rgb(10 179 156 / 80%); }
.btn.danger { box-shadow: 0 6px 14px -8px rgb(240 101 72 / 80%); }
.btn.alt { background: var(--alt); border-color: transparent; }
.btn.alt:hover { background: color-mix(in srgb, var(--alt) 80%, var(--c-primary) 8%); }
input, select, textarea { border-radius: 12px; background: var(--input); }

/* Pills and status dots. */
.chip, .badge { border-radius: 999px; padding: 3px 10px; }
.chip-new::before, .chip-accepted::before, .chip-done::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Requests / notifications: rounder, with a status glow. */
.request, .notif-item { border-radius: 14px; border-left-width: 0; position: relative; overflow: hidden; }
.request::before, .notif-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--new); }
.request-accepted::before, .notif-accepted::before { background: var(--accepted); }
.request-done::before { background: var(--done); }
.notif-order::before { background: var(--c-blue); }
.request { padding-left: 20px; }
.notif-item { padding-left: 18px; }

/* Alert bar and modal. */
.alert-bar { border-radius: 18px; background: linear-gradient(120deg, #ff7a59, #e8456b 60%, #c93a7d); }
.modal { border-radius: 22px; }
.notif-head h2 { font-size: 19px; }

/* Tables: airy rows. */
table.data th { background: transparent; border-bottom: 1px solid var(--panel-border); }
.table-scroll { border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); border: 0; }

/* == modal motion == */
.modal[open] { animation: modal-in .24s cubic-bezier(.2, .9, .3, 1.15); }
.modal[open]::backdrop { animation: backdrop-in .24s ease-out; }
.modal.closing { animation: modal-out .18s ease-in forwards; }
.modal.closing::backdrop { animation: backdrop-out .18s ease-in forwards; }
.modal .notif-body > * { animation: rise .22s ease-out both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { to { opacity: 0; } }
@media (max-width: 860px) {
  .modal[open] { animation: sheet-in .28s cubic-bezier(.2, .9, .3, 1); }
  .modal.closing { animation: sheet-out .2s ease-in forwards; }
}
@keyframes sheet-out { to { transform: translateY(100%); } }

/* == active menu item in the phone box grid / strip == */
@media (max-width: 860px) {
  /* The sidebar indicator stripe is for the desktop list only. */
  .nav a.active::before { display: none; }
  /* Keep the active item's gradient in every phone state (the box grid,
     the compact strip, and the strip opened with the chevron or a hover). */
  .sidebar .nav a.active,
  .strip-nav a.active,
  .workspace.nav-open .strip-nav a.active,
  .nav-strip:hover .strip-nav a.active {
    color: #fff; border-color: transparent;
    background: linear-gradient(135deg, #5266b0, #3a4a86);
    box-shadow: 0 8px 18px -10px rgb(64 81 137 / 70%);
  }
}

/* == brand colour == */
/* The logo's teal → indigo gradient is the theme colour: primary actions,
   the active place in the menu, highlights, focus. */
:root {
  --brand-a: #0ab39c;
  --brand-b: #405189;
  --brand: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  --brand-soft: linear-gradient(135deg, rgb(10 179 156 / 12%), rgb(64 81 137 / 12%));
  --brand-glow: 0 8px 20px -10px rgb(46 120 140 / 75%);
  --focus: #0ab39c;
}
::selection { background: rgb(10 179 156 / 25%); }
:focus-visible { outline-color: var(--brand-a); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-a); box-shadow: 0 0 0 3px rgb(10 179 156 / 20%); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-a); }

/* Primary actions. */
.btn:not(.alt):not(.ghost):not(.danger):not(.blue), .btn.primary, .tile:not(.teal):not(.blue):not(.amber):not(.red):not(.purple):not(.slate):not(.pink) {
  background: var(--brand); color: #fff; box-shadow: var(--brand-glow);
}
.theme-dark .btn.primary { color: #fff; }

/* Where you are. */
.nav a.active, .sidebar .nav a.active, .strip-nav a.active,
.workspace.nav-open .strip-nav a.active, .nav-strip:hover .strip-nav a.active { background: var(--brand); box-shadow: var(--brand-glow); }
.nav a.active::before { background: var(--brand-a); }
.nav a:hover:not(.active) { background: var(--brand-soft); color: var(--brand-b); }
:root[data-theme="dark"] .nav a:hover:not(.active) { color: #9fe8da; }
.tabs a.active { background: var(--brand); color: #fff; }
.mark, .avatar { background: var(--brand); color: #fff; }
.avatar { box-shadow: var(--brand-glow); }

/* Highlights. */
.kpi-icon, .tone-teal .kpi-icon { background: var(--brand); }
.card-head h2 svg, .notif-head h2 svg, .page-head h1 svg { color: var(--brand-a); }
.hbar-fill { background: var(--brand); }
#progress::before { background: linear-gradient(90deg, var(--brand-a), var(--c-blue), var(--brand-b)); }
.hero { background: var(--brand); }
.modal { border-top: 4px solid transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--brand) border-box; }
.store-card:hover, .card.link:hover { box-shadow: var(--shadow-lg), 0 0 0 2px rgb(10 179 156 / 35%); }
.badge-ok, .chip-done { background: var(--brand-soft); color: var(--brand-a); }
.ttile-selected { outline: 3px solid var(--brand-a); outline-offset: 2px; }
.eyebrow, .brand span, .lang a[aria-current] { color: var(--brand-a); }
/* The page title in the app bar carries the gradient. */
.appbar .title { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Slim brand line under the app bar. */
.appbar { border-bottom: 0; box-shadow: inset 0 -2px 0 0 transparent; }
.appbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand); opacity: .55; }
/* Scrollbars tinted to match. */
* { scrollbar-color: rgb(64 81 137 / 35%) transparent; }

/* == menu counters == */
.nav a { position: relative; }
.nc { margin-left: auto; display: inline-flex; }
.nc:empty { display: none; }
.nav-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; font-size: 12px; font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; animation: pop .25s ease-out; box-shadow: 0 0 0 2px var(--sidebar-bg); }
.nc-red { background: var(--c-red); }
.nc-amber { background: #e7a73b; }
.nc-blue { background: var(--c-blue); }
.nc-brand { background: var(--brand); }
.nav a.active .nav-count { box-shadow: 0 0 0 2px rgb(255 255 255 / 85%); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } to { transform: none; opacity: 1; } }
@media (max-width: 860px) {
  /* Phone boxes and strip: the counter sits on the box's top-right corner. */
  .nav a .nc, .strip-nav a .nc { position: absolute; top: 6px; right: 6px; margin: 0; }
  .strip-nav a .nc { top: 0; right: 0; }
  .strip-nav a .nav-count { min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; }
}

/* == interaction fixes == */
/* Background refreshes (SSE, polling) swap whole lists: their items must not
   replay the entry animations (rise / fade / growing bars) every time, which
   made lists, KPIs and the alert bar blink. ui.js adds .kopa-live to a target
   from its second background swap on. */
.kopa-live .kpi, .kopa-live .request, .kopa-live .alert-bar, .kopa-live .chart .grow,
.kopa-live .hbar-fill, .kopa-live .notif-body > *, .kopa-live .htmx-added, .kopa-live.htmx-added { animation: none; }
/* While a modal is open #flash lives inside it (ui.js): show it at the top,
   clear of the sheet's buttons on phones. */
.modal .flash-area { top: calc(12px + env(safe-area-inset-top)); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); }
/* Toasts sit above the pinned bottom bar instead of covering it. */
.page:has(#live-alerts.pin-bottom .alert-bar) > .flash-area { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
  /* The pinned top bar slides below the fixed menu strip, not under it. */
  .workspace.nav-compact #live-alerts.pin-top { top: calc(64px + env(safe-area-inset-top)); }
}
/* Dark mode: the indigo end of the brand gradient vanishes on dark surfaces. */
:root[data-theme="dark"] .appbar .title { background-image: linear-gradient(135deg, #2ad4b5, #8ea0e3); }
:root[data-theme="dark"] .theme-light .chip-accepted,
:root[data-theme="dark"] .theme-light .badge-basic,
:root[data-theme="dark"] .theme-light .platform-warn { color: var(--c-amber); }
:root[data-theme="dark"] .theme-light .btn.alt.htmx-request::after,
:root[data-theme="dark"] .theme-light form.htmx-request .btn.alt[type=submit]::after { border-color: rgb(255 255 255 / 25%); border-top-color: #fff; }
/* /home: the admin card's icon is white (polish layer), so it needs the brand fill. */
.home-admin .kpi-icon { background: var(--brand); }
/* Receipt: the indicator is #receipt-status itself (hx-indicator). */
#receipt-status.htmx-request .htmx-indicator { display: block; }
/* The AI import's wait note takes no room until the upload runs. */
.import-wait.htmx-indicator { display: none; }
form.htmx-request .import-wait.htmx-indicator { display: block; }
/* The table modal's panel is a flex column too, so a long bill scrolls inside
   .notif-body instead of being cut off (with its settle button) by the modal. */
#modal-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
/* Waiter: the sticky cart starts below a pinned top alert bar, not under it. */
.content:has(#live-alerts.pin-top .alert-bar) .waiter-grid .cart { top: calc(var(--topbar-h) + 96px); }
/* Phones: the two KPI columns may shrink (1fr kept long amounts from
   widening the page past 360px); long values wrap inside their tile. */
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { min-width: 0; grid-template-columns: minmax(0, 1fr) auto; padding: 14px 12px; gap: 4px 8px; }
  .kpi-value { overflow-wrap: anywhere; font-size: clamp(17px, 5vw, 20px); }
  .kpi-label, .kpi-sub { overflow-wrap: anywhere; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
}

/* == error page == */
.error-page { padding-top: 12vh; max-width: 520px; }
.error-page .flash { animation: none; box-shadow: none; position: static; }

/* == requests: timers & service stats == */
.req-head { align-items: center; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--alt); }
.seg a { padding: 8px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.active { background: var(--brand); color: #fff; box-shadow: var(--brand-glow); }
.sla-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sla-form label { display: flex; align-items: center; gap: 6px; }
.sla-form input { width: 84px; }
.request-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.wait { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; background: rgb(10 179 156 / 12%); color: var(--c-teal); font-size: 13px; }
.wait-warn { background: rgb(247 184 75 / 18%); color: #b7791f; }
.wait-late { background: rgb(240 101 72 / 14%); color: var(--c-red); animation: pulse-late 1.6s ease-in-out infinite; }
.request-late::before { background: var(--c-red) !important; }
@keyframes pulse-late { 50% { box-shadow: 0 0 0 4px rgb(240 101 72 / 18%); } }
.ok-text { color: var(--c-teal); font-weight: 700; }
.late-text { color: var(--c-red); font-weight: 700; }
.trend-note { margin: -8px 0 18px; }
.slowest .row { align-items: center; }
@media (max-width: 860px) {
  .request-side { flex-direction: row; align-items: center; }
  .req-head .sla-form { width: 100%; }
}

/* == guest request progress == */
.progress-steps { display: grid; gap: 10px; margin: 12px 0 4px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--panel-border); }
.step { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; }
.step .dot { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel-border); font-size: 13px; flex: none; }
.step.done { color: var(--ink); }
.step.done .dot { background: var(--brand); border-color: transparent; color: #fff; }
.step.current .dot { border-color: var(--brand-a); color: var(--brand-a); animation: pulse-late 1.6s ease-in-out infinite; }

/* == QR login == */
.qr-login { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin: 12px 0 0; background: var(--alt); box-shadow: none; }
.qr-box svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 12px; display: block; }
@media (max-width: 560px) { .qr-login { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* == table tiles (Τραπέζια & NFC) == */
.tsq-summary { margin: 0 0 12px; }
/* `dense` lets later tiles fill the row, so a full-width detail panel placed
   right after a tile ends up directly below that tile's row. */
.tsq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-flow: row dense; gap: 14px; }
.tsq {
  position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--panel-border); box-shadow: var(--shadow);
  color: var(--ink); text-align: center; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tsq:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tsq-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; }
.tsq-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-teal); box-shadow: 0 0 0 3px rgb(10 179 156 / 18%); }
.tsq-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-b); }
.tsq-label { font-size: 16px; color: var(--ink-strong); line-height: 1.2; }
.tsq-sub { font-size: 12.5px; color: var(--muted); }
.tsq-busy .tsq-icon { background: rgb(247 184 75 / 18%); color: #b7791f; }
.tsq-busy .tsq-sub { color: #b7791f; font-weight: 700; }
.tsq-help { border-color: rgb(240 101 72 / 45%); }
.tsq-help .tsq-icon { background: rgb(240 101 72 / 14%); color: var(--c-red); }
.tsq-off { opacity: .55; }
.tsq-off .tsq-dot { background: var(--muted); box-shadow: none; }
.tsq-open { border: 2px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--brand) border-box; box-shadow: var(--brand-glow); }
.tsq-open::after { content: ""; position: absolute; bottom: -16px; left: 50%; width: 18px; height: 18px; transform: translateX(-50%) rotate(45deg); background: var(--card); border-left: 1px solid var(--panel-border); border-top: 1px solid var(--panel-border); z-index: 2; }

.tdetail { grid-column: 1 / -1; margin: 0; overflow: hidden; transform-origin: top center; animation: tdetail-in .28s cubic-bezier(.2, .9, .3, 1); border-top: 3px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--brand) border-box; }
@keyframes tdetail-in { from { opacity: 0; transform: translateY(-8px) scaleY(.94); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
.tdetail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tdetail-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.tdetail-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.tdetail-qr { display: grid; gap: 8px; }
.tdetail-qr .qr-box svg { width: 100%; height: auto; background: #fff; padding: 8px; border-radius: 12px; display: block; }
.kpis-compact { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 0; gap: 12px; }
.kpis-compact .kpi { padding: 14px; }
.kpis-compact .kpi-value { font-size: 20px; }
.kpis-compact .kpi-icon { width: 40px; height: 40px; }
.tdetail-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tdetail-section h3 { display: flex; align-items: center; gap: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tdetail-forms { display: grid; gap: 12px; }
.nfc-url { font-family: ui-monospace, monospace; font-size: 13px; }
.btn.flip svg { transform: rotate(180deg); }
.thist { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 10px; }
.thist h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  .tsq-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .tsq { border-radius: 16px; }
  .tsq-icon { width: 42px; height: 42px; border-radius: 12px; }
  .tsq-label { font-size: 14px; }
  .tdetail-grid { grid-template-columns: 1fr; }
  .tdetail-qr { max-width: 240px; margin: 0 auto; }
}

/* == table detail fixes == */
.tdetail .row { justify-content: flex-start; }
.tdetail-qr .btn svg { width: 1.15em; height: 1.15em; }
.tdetail-danger { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; background: rgb(240 101 72 / 6%); border: 1px solid rgb(240 101 72 / 25%); }
.tdetail-danger p { margin: 0; }
.tdetail-danger .row { gap: 10px; }

/* == table history: orders == */
.thist { grid-template-columns: minmax(240px, 1fr) minmax(320px, 2fr); }
.ototals { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--brand-soft); font-size: 13px; }
.olist { display: grid; gap: 8px; }
.orow { border: 1px solid var(--panel-border); border-radius: 12px; background: var(--card); overflow: hidden; }
.orow-open { border-left: 4px solid var(--accepted); }
.orow > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; min-height: 48px; cursor: pointer; }
.orow > summary::-webkit-details-marker { display: none; }
.orow > summary:hover { background: var(--alt); }
.orow-main { display: grid; }
.orow-side { display: flex; align-items: center; gap: 8px; }
.orow-chev { transition: transform .2s; color: var(--muted); }
.orow[open] .orow-chev { transform: rotate(180deg); }
.orow-body { padding: 4px 12px 12px; border-top: 1px solid var(--line); animation: tdetail-in .22s ease-out; }
.oitems { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.oitems li { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: start; }
.oqty { font-weight: 800; color: var(--brand-b); }
.oname { display: grid; }
.onote { color: var(--c-red); }
.odetails { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 10px; }
@media (max-width: 860px) { .thist { grid-template-columns: 1fr; } }

/* == cart quantities == */
.qty-badge { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; vertical-align: 1px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.stepper form { display: inline; }
.step-btn { width: 40px; min-width: 40px; padding: 0; font-size: 20px; font-weight: 800; line-height: 1; }
.step-qty { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .step-btn { width: 46px; min-width: 46px; } }

/* == app-bar search == */
.search-btn { width: auto; padding: 0 14px 0 10px; gap: 8px; border-radius: 12px; background: var(--alt); display: inline-flex; align-items: center; color: var(--muted); }
.search-hint { font-size: 13px; display: inline-flex; align-items: center; gap: 10px; }
.search-hint kbd { font: 600 11px var(--font); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--panel-border); background: var(--card); }
.search-modal { width: min(720px, calc(100% - 32px)); margin-top: 8vh; max-height: 80vh; }
@media (max-width: 860px) { .search-btn { width: 46px; padding: 0; justify-content: center; } .search-hint { display: none; } .search-modal { margin-top: 0; } }
.notif-ready::before { background: var(--brand) !important; }

/* == modal panels scroll == */
/* Every modal's panel fills the dialog and lets its body scroll (the
   notification, search and general/table modals alike). */
#notif-panel, #search-panel, #modal-panel { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.modal .notif { flex: 1 1 auto; min-height: 0; }
.modal .notif-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.modal .notif-head, .modal .notif-foot { flex: none; }
