/* ============================================================
   Café QR — shared design system
   ============================================================ */
:root {
  --accent: #6b4226;                       /* overridden per café */
  --accent-soft: color-mix(in srgb, var(--accent) 11%, #fff);
  --accent-softer: color-mix(in srgb, var(--accent) 5%, #fff);
  --accent-strong: color-mix(in srgb, var(--accent) 82%, #000);
  --bg: #f8f5f1;
  --card: #ffffff;
  --text: #241a12;
  --muted: #86786b;
  --line: #ece4da;
  --ok: #23804e;
  --warn: #b86e00;
  --danger: #b3261e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(36, 26, 18, .05);
  --shadow: 0 1px 2px rgba(36, 26, 18, .04), 0 6px 20px -6px rgba(36, 26, 18, .10);
  --shadow-lg: 0 24px 60px -12px rgba(36, 26, 18, .30);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
img { display: block; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.12rem; font-weight: 700; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }

/* ---------- animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 9px transparent; } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-up { animation: fadeUp .45s var(--ease) both; }
.pop { animation: pop .35s var(--spring); }
.skeleton {
  background: linear-gradient(90deg, #eee7df 0, #f6f1eb 160px, #eee7df 320px);
  background-size: 800px 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px;
}

/* ---------- layout ---------- */
.topbar {
  background: rgba(255, 255, 255, .85); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; min-width: 0; letter-spacing: -.01em; }
.brand > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-dot {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 17px; flex-shrink: 0; overflow: hidden; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 60%, transparent);
}
.brand-dot img { width: 100%; height: 100%; object-fit: cover; }
.container { max-width: 1180px; margin: 0 auto; padding: 24px 16px 70px; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; flex: 1; min-width: 160px; }

.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); padding: 0 12px; position: sticky; top: 55px; z-index: 19;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 13px 14px; border: none; background: none; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted);
  position: relative; white-space: nowrap; transition: color .2s;
}
.tab::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--accent); transform: scaleX(0); transition: transform .3s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); }
.tab.active::after { transform: scaleX(1); }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .72rem; line-height: 20px; text-align: center; margin-left: 4px; animation: pop .4s var(--spring);
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); transition: box-shadow .25s, transform .25s var(--ease), border-color .25s;
}
.stat { position: relative; overflow: hidden; }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat .value { font-size: 1.65rem; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat .icon { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 17px; }
.stat.accent { background: var(--accent); color: #fff; border-color: transparent; }
.stat.accent .label, .stat.accent .muted { color: rgba(255, 255, 255, .78); }
.stat.accent .icon { background: rgba(255, 255, 255, .16); }

.empty { text-align: center; padding: 48px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; background: var(--accent-soft); display: grid; place-items: center; font-size: 30px; }
.empty p { margin: 0 auto; max-width: 380px; }

/* ---------- forms ---------- */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: 8px; font-size: .85rem; }
textarea { min-height: 76px; resize: vertical; }
select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386786b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 34px; }
.inline-check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }

/* period picker (presets + range calendar) */
.range-picker { position: relative; }
.range-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font: inherit; color: var(--text); cursor: pointer; max-width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.range-btn:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.range-btn[aria-expanded=true] { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.range-btn #rangeLabel { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.range-btn strong { font-weight: 700; font-size: .92rem; }
.range-dates { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.range-caret { color: var(--muted); font-size: .75rem; transition: transform .25s var(--ease); }
.range-btn[aria-expanded=true] .range-caret { transform: rotate(180deg); }
.range-ic { font-size: 1rem; }

.range-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; display: flex; background: #fff;
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden;
  width: max-content; max-width: calc(100vw - 24px); transform-origin: top right; animation: popIn .22s var(--spring) both;
}
.range-pop.closing { animation: popIn .15s ease reverse both; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.range-presets { display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--accent-softer); border-right: 1px solid var(--line); min-width: 150px; }
.range-presets button {
  text-align: left; padding: 9px 12px; border: none; background: none; border-radius: 10px; font: inherit; font-size: .88rem;
  font-weight: 600; color: var(--text); cursor: pointer; transition: background .15s, color .15s;
}
.range-presets button:hover { background: var(--accent-soft); }
.range-presets button.active { background: var(--accent); color: #fff; }

.cal { padding: 14px 14px 12px; width: 300px; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-title { flex: 1; text-align: center; font-weight: 800; text-transform: capitalize; }
.cal-nav {
  width: 32px; height: 32px; border-radius: 10px; border: none; background: var(--bg); color: var(--text); font-size: 1.2rem;
  line-height: 1; cursor: pointer; transition: background .15s, transform .15s;
}
.cal-nav:hover:not(:disabled) { background: var(--accent-soft); }
.cal-nav:active:not(:disabled) { transform: scale(.9); }
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week span { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 0 6px; }
.cal-day { position: relative; height: 38px; border: none; background: none; padding: 0; font: inherit; font-size: .88rem; color: var(--text); cursor: pointer; }
.cal-day span {
  position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; margin: 2px auto; border-radius: 10px;
  transition: background .15s, color .15s, transform .15s;
}
.cal-day:hover:not(:disabled) span { background: var(--accent-soft); }
.cal-day:active:not(:disabled) span { transform: scale(.9); }
.cal-day.out { color: #c4b9ae; }
.cal-day:disabled { color: #d8d0c7; cursor: default; }
.cal-day.today span { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 700; }
.cal-day.in-range::before, .cal-day.start.has-end::before, .cal-day.end::before {
  content: ""; position: absolute; top: 2px; bottom: 2px; left: 0; right: 0; background: var(--accent-soft);
}
.cal-day.start.has-end::before { left: 50%; }
.cal-day.end::before { right: 50%; }
.cal-day.start:not(.has-end)::before { display: none; }
.cal-day.start.end::before { display: none; }
.cal-day.sel span { background: var(--accent) !important; color: #fff; font-weight: 800; box-shadow: 0 4px 10px -4px var(--accent); }
.cal-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }

@media (max-width: 600px) {
  .range-picker { width: 100%; }
  .range-btn { width: 100%; }
  .range-btn #rangeLabel { flex: 1; }
  .range-pop { left: 0; right: auto; flex-direction: column; width: calc(100vw - 24px); }
  .range-presets { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .range-presets button { white-space: nowrap; }
  .cal { width: 100%; }
}

/* image uploader */
.uploader { display: flex; align-items: center; gap: 14px; }
.upl-drop {
  position: relative; flex: 1; display: flex; align-items: center; min-height: 104px; margin: 0; padding: 16px;
  border: 2px dashed color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 16px; background: var(--accent-softer);
  color: var(--text); cursor: pointer; overflow: hidden; font-weight: 500;
  transition: border-color .2s, background .2s, transform .2s var(--ease), box-shadow .2s;
}
.upl-drop:hover, .upl-drop:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.uploader.dragging .upl-drop { border-color: var(--accent); border-style: solid; background: var(--accent-soft); transform: scale(1.015); box-shadow: 0 0 0 5px var(--accent-soft); }
.upl-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upl-empty { display: flex; align-items: center; gap: 14px; }
.upl-ic {
  width: 46px; height: 46px; border-radius: 14px; background: #fff; color: var(--accent); display: grid; place-items: center; flex-shrink: 0;
  box-shadow: var(--shadow-sm); transition: transform .3s var(--spring);
}
.upl-drop:hover .upl-ic, .uploader.dragging .upl-ic { transform: translateY(-3px); }
.upl-text { display: flex; flex-direction: column; line-height: 1.35; }
.upl-text strong { font-size: .95rem; color: var(--text); }
.upl-text span { font-size: .84rem; color: var(--muted); }
.upl-text .upl-hint { font-size: .74rem; opacity: .8; margin-top: 2px; }
.upl-img, .upl-overlay, .upl-loading { display: none; }
.upl-actions { display: none; flex-direction: column; gap: 6px; }

/* with an image: show the picture as a tile + buttons next to it */
.uploader.has-img .upl-drop { flex: 0 0 auto; width: 150px; height: 112px; min-height: 0; padding: 0; border-style: solid; border-color: var(--line); background: #fff; }
.uploader.square.has-img .upl-drop { width: 112px; }
.uploader.has-img .upl-empty { display: none; }
.uploader.has-img .upl-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.uploader.has-img .upl-overlay {
  display: grid; place-items: center; position: absolute; inset: 0; background: rgba(28, 18, 10, .45); color: #fff;
  font-weight: 700; font-size: .85rem; opacity: 0; transition: opacity .2s;
}
.uploader.has-img .upl-drop:hover .upl-overlay { opacity: 1; }
.uploader.has-img .upl-actions { display: flex; }
.uploader.loading .upl-loading { display: grid; place-items: center; position: absolute; inset: 0; background: rgba(255, 255, 255, .75); }
.upl-spin { width: 26px; height: 26px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }

/* connection banner */
#netBanner {
  position: fixed; top: 12px; left: 50%; z-index: 400; transform: translate(-50%, -150%); max-width: calc(100vw - 24px);
  background: var(--text); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: .85rem; font-weight: 700;
  box-shadow: var(--shadow-lg); transition: transform .4s var(--spring); pointer-events: none; text-align: center;
}
#netBanner.show { transform: translate(-50%, 0); }
#netBanner.online { background: var(--ok); }

#whoami { max-width: 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* table ↔ server */
.server-tag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 10px; border-radius: 999px;
  background: #eef2fb; color: #2f4f8f; font: inherit; font-size: .78rem; font-weight: 700; border: 1px solid transparent;
}
.server-tag.none { background: var(--bg); color: var(--muted); }
.server-tag.clickable { cursor: pointer; margin: 0 0 12px; transition: border-color .2s, transform .15s; }
.server-tag.clickable:hover { border-color: currentColor; }
.server-tag.clickable:active { transform: scale(.96); }
.server-tag .edit-ic { opacity: .55; font-size: .8rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.table-tag { background: var(--accent-soft); color: var(--accent-strong); border-radius: 7px; padding: 2px 8px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { position: relative; margin: 0; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--text); font-size: .86rem; font-weight: 700; cursor: pointer; user-select: none;
  transition: background .2s, border-color .2s, color .2s, transform .15s var(--spring);
}
.pick span:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pick span:active { transform: scale(.95); }
.pick small { font-weight: 500; color: var(--muted); }
.pick input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px -6px var(--accent); }
.pick input:checked + span small { color: rgba(255, 255, 255, .8); }
.pick input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }

/* segmented control (e.g. Live / Today / History) */
.segmented {
  position: relative; display: inline-flex; padding: 4px; gap: 2px; background: #efe8e0; border-radius: 13px;
  box-shadow: inset 0 1px 2px rgba(36, 26, 18, .06);
}
.seg-indicator {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 10px; background: #fff;
  box-shadow: 0 1px 2px rgba(36, 26, 18, .08), 0 3px 10px -3px rgba(36, 26, 18, .18);
  transition: transform .35s var(--spring), width .35s var(--ease);
}
.seg {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border: none; background: none;
  font: inherit; font-size: .88rem; font-weight: 700; color: var(--muted); border-radius: 10px; cursor: pointer; white-space: nowrap;
  transition: color .25s;
}
.seg:hover { color: var(--text); }
.seg.active { color: var(--accent-strong); }
.seg:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(35, 128, 78, .45); } 50% { box-shadow: 0 0 0 6px rgba(35, 128, 78, 0); } }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; margin: 0; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d9d0c6; border-radius: 999px; transition: background .25s; }
.switch span::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s var(--spring);
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 17px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 700; font-size: .92rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, filter .2s, opacity .2s;
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn:active { transform: scale(.96); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.ghost:hover { background: var(--accent-softer); box-shadow: none; }
.btn.light { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.btn.light:hover { box-shadow: none; filter: brightness(.97); }
.btn.danger { background: transparent; color: var(--danger); border-color: #f0d0cd; }
.btn.danger:hover { background: #fdf1f0; box-shadow: none; filter: none; }
.btn.sm { padding: 6px 11px; font-size: .82rem; border-radius: 9px; }
.btn.icon { padding: 0; width: 32px; height: 32px; border-radius: 9px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 20px; font-size: 1rem; border-radius: 14px; }

/* ---------- tables ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { transition: background .15s; }
table.list tbody tr:hover { background: var(--accent-softer); }
table.list th { font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.new { background: #fdeceb; color: var(--danger); }
.pill.new::before { animation: pulse 1.6s infinite; }
.pill.preparing { background: #fff2dc; color: var(--warn); }
.pill.served { background: #e6effd; color: #2558a8; }
.pill.paid { background: #e2f4e9; color: var(--ok); }
.pill.cancelled, .pill.off { background: #f0edea; color: #7d746c; }
.pill.on { background: #e2f4e9; color: var(--ok); }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(28, 18, 10, .42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 16px; animation: fadeIn .2s ease both;
}
.modal {
  background: var(--card); border-radius: 20px; padding: 24px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow-lg); animation: scaleIn .3s var(--spring) both;
}
.modal-bg.closing { animation: fadeIn .18s ease reverse both; }
.modal-bg.closing .modal { animation: scaleIn .18s ease reverse both; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: #fff;
  padding: 11px 18px; border-radius: 12px; z-index: 300; opacity: 0; pointer-events: none; max-width: 90vw;
  font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); transition: opacity .25s, transform .35s var(--spring);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side {
  background: radial-gradient(circle at 20% 15%, #8a5a37 0, transparent 55%), radial-gradient(circle at 85% 90%, #3d2414 0, transparent 50%), #5a361e;
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-side h2 { font-size: 2.1rem; line-height: 1.15; font-weight: 800; max-width: 420px; margin: 0 0 14px; }
.auth-side p { opacity: .8; max-width: 380px; margin: 0; }
.auth-side .float { position: absolute; font-size: 64px; opacity: .14; animation: floaty 7s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-16px) rotate(6deg); } }
.auth-main { display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; animation: fadeUp .5s var(--ease) both; }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- orders board ---------- */
.board { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); align-items: start; }
.order { border-top: 4px solid var(--line); display: flex; flex-direction: column; }
.order.st-new { border-top-color: var(--danger); }
.order.st-preparing { border-top-color: var(--warn); }
.order.st-served { border-top-color: #2558a8; }
.order.st-paid { border-top-color: var(--ok); }
.order:hover { transform: translateY(-2px); }
.order-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.order-head h2 { margin: 0 0 2px; }
.order-lines { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.order-lines li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.qty-tag { background: var(--accent-soft); color: var(--accent-strong); border-radius: 7px; padding: 1px 7px; font-weight: 800; font-size: .82rem; }
.order-note { background: #fff8e8; border: 1px solid #f3e3bc; padding: 8px 11px; border-radius: 10px; margin: 0 0 10px; font-size: .88rem; }
.order-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px dashed var(--line); margin-top: auto; }
.order-foot .total { font-weight: 800; font-size: 1.1rem; margin-right: auto; }
.order-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- menu admin ---------- */
.cat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 6px; }
.cat-name { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 150px; }
.cat-name h2 { margin: 0; }
.cat-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.item-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; grid-template-areas: "thumb main price actions";
  gap: 6px 14px; align-items: center; padding: 12px 6px; border-top: 1px solid var(--line); border-radius: 10px; transition: background .15s, opacity .2s;
}
.item-row:hover { background: var(--accent-softer); }
.item-row.is-off .thumb, .item-row.is-off .item-main { opacity: .55; }
.item-row > .thumb { grid-area: thumb; }
.item-main { grid-area: main; min-width: 0; }
.item-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-price { grid-area: price; font-weight: 800; white-space: nowrap; }
.item-actions { grid-area: actions; display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .item-row { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "thumb main price" "thumb actions actions"; }
  .item-actions { justify-content: flex-end; }
}
.thumb {
  width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--accent-soft); flex-shrink: 0;
  display: grid; place-items: center; color: var(--accent); font-size: 20px;
}

/* ---------- QR ---------- */
.qr-card { text-align: center; }
.qr-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.qr-card img { width: 100%; max-width: 190px; margin: 6px auto 4px; image-rendering: pixelated; border-radius: 8px; }
.qr-card .actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* ---------- bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 10px; }
.bar {
  flex: 1; background: linear-gradient(to top, var(--accent), color-mix(in srgb, var(--accent) 65%, #fff));
  border-radius: 6px 6px 2px 2px; min-height: 3px; transform-origin: bottom; animation: growUp .7s var(--ease) both;
  transition: filter .15s;
}
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar:hover { filter: brightness(1.2); }
.bar-labels { display: flex; gap: 4px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: .68rem; color: var(--muted); overflow: hidden; white-space: nowrap; }

@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .container { padding: 18px 12px 60px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 15px; }
  .stat .value { font-size: 1.35rem; }
  .hide-sm { display: none !important; }
}

@media print {
  .no-print, .topbar, .tabs { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
