/* Management app — mobile first: bottom tab bar on phones, sidebar on wide screens. */
:root {
  --ink: #1c1917; --ink2: #44403c; --muted: #78716c; --line: #e7e5e4; --bg: #f5f5f4; --surface: #fff;
  --accent: #e8590c; --accent-soft: #fff1e8; --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7;
  --bad: #b91c1c; --bad-soft: #fee2e2; --info: #1d4ed8; --info-soft: #dbeafe;
  --r: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 10px rgba(0,0,0,.05);
  color-scheme: light;
}
* { box-sizing: border-box; }
body.qa { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(232, 89, 12, .45); outline-offset: 2px; }
.qa-loading { padding: 40px; text-align: center; color: var(--muted); }
.qa-muted { color: var(--muted); }
.qa-small { font-size: 13px; }
.qa-center { text-align: center; }
.qa-logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; }

/* layout */
.qa-shell { min-height: 100vh; display: flex; flex-direction: column; }
.qa-top { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.qa-top select { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: 6px 8px; max-width: 52vw; font-weight: 600; }
.qa-top select option { color: var(--ink); }
.qa-top .qa-spacer { flex: 1; }
.qa-top a, .qa-top button.qa-plain { color: #fff; }
.qa-main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 14px 96px; }
.qa-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.qa-nav a { flex: 1; text-align: center; padding: 8px 2px 6px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; position: relative; }
.qa-nav a .qa-ico { display: block; font-size: 20px; line-height: 1.2; }
.qa-nav a.is-on { color: var(--accent); }
.qa-nav .qa-dot { position: absolute; top: 4px; left: 50%; margin-left: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; }
.qa-nav .qa-more-only { display: none; }
@media (min-width: 900px) {
  .qa-shell { flex-direction: row; flex-wrap: wrap; }
  .qa-top { width: 100%; }
  .qa-nav { position: sticky; top: 52px; align-self: flex-start; flex-direction: column; width: 210px; height: calc(100vh - 52px); border: 0; border-right: 1px solid var(--line); padding: 12px 8px; gap: 2px; }
  .qa-nav a { flex: 0; display: flex; gap: 10px; align-items: center; text-align: left; font-size: 14px; padding: 10px 12px; border-radius: 10px; }
  .qa-nav a .qa-ico { font-size: 18px; }
  .qa-nav a.is-on { background: var(--accent-soft); }
  .qa-nav .qa-dot { position: static; margin: 0 0 0 auto; }
  .qa-nav .qa-more-only { display: flex; }
  .qa-nav .qa-mobile-only { display: none; }
  .qa-main { flex: 1; padding: 24px 28px 48px; width: auto; }
}

/* blocks */
.qa-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.qa-head h1 { flex: 1; min-width: 160px; }
.qa-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.qa-card > h2 { margin-bottom: 10px; }
.qa-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.qa-card__head h2 { flex: 1; }
.qa-grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .qa-grid--2 { grid-template-columns: 1fr 1fr; } .qa-grid--3 { grid-template-columns: repeat(3, 1fr); } }
.qa-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.qa-kpi { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; }
.qa-kpi span { color: var(--muted); font-size: 13px; }
.qa-kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.qa-list { list-style: none; margin: 0; padding: 0; }
.qa-list > li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.qa-list > li:first-child { border-top: 0; }
.qa-grow { flex: 1; min-width: 0; }
.qa-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--bg); flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.qa-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--ink2); white-space: nowrap; }
.qa-pill--ok { background: var(--ok-soft); color: var(--ok); }
.qa-pill--warn { background: var(--warn-soft); color: var(--warn); }
.qa-pill--bad { background: var(--bad-soft); color: var(--bad); }
.qa-pill--info { background: var(--info-soft); color: var(--info); }
.qa-pill--accent { background: var(--accent-soft); color: var(--accent); }
.qa-alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; background: var(--info-soft); color: var(--info); }
.qa-alert--bad { background: var(--bad-soft); color: var(--bad); }
.qa-alert--warn { background: var(--warn-soft); color: var(--warn); }
.qa-alert--ok { background: var(--ok-soft); color: var(--ok); }
.qa-empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.qa-check-list { list-style: none; padding: 0; margin: 0; }
.qa-check-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.qa-check-list .qa-tick { width: 22px; height: 22px; border-radius: 99px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; flex: 0 0 auto; }
.qa-check-list .is-done .qa-tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.qa-check-list .is-done span.qa-grow { color: var(--muted); text-decoration: line-through; }

/* buttons & forms */
.qa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent; background: var(--accent); color: #fff; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; }
.qa-btn:disabled { opacity: .5; cursor: not-allowed; }
.qa-btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.qa-btn--soft { background: var(--accent-soft); color: var(--accent); }
.qa-btn--danger { background: var(--surface); color: var(--bad); border-color: #fecaca; }
.qa-btn--ok { background: var(--ok); }
.qa-btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.qa-btn--block { width: 100%; min-height: 46px; }
.qa-plain { background: none; border: 0; padding: 4px; cursor: pointer; color: inherit; }
.qa-iconbtn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; font-size: 15px; }
.qa-iconbtn:disabled { opacity: .35; }
.qa-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qa-form { display: grid; gap: 12px; }
.qa-field { display: grid; gap: 5px; }
.qa-field > span { font-weight: 600; font-size: 13px; color: var(--ink2); }
.qa-field small { color: var(--muted); }
.qa-field input:not([type=checkbox]):not([type=radio]):not([type=color]), .qa-field select, .qa-field textarea, .qa-input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 11px; }
.qa-field textarea { min-height: 80px; resize: vertical; }
.qa-field input:focus, .qa-field select:focus, .qa-field textarea:focus, .qa-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(232,89,12,.15); }
.qa-check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.qa-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.qa-cols { display: grid; gap: 12px; }
@media (min-width: 600px) { .qa-cols { grid-template-columns: 1fr 1fr; } }
.qa-seg { display: flex; background: var(--bg); padding: 3px; border-radius: 10px; gap: 2px; overflow-x: auto; }
.qa-seg a, .qa-seg button { flex: 1; text-align: center; padding: 7px 10px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; font-size: 14px; }
.qa-seg [aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* orders board */
.qa-board { display: grid; gap: 12px; }
@media (min-width: 720px) { .qa-board { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.qa-order { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; border-left: 5px solid var(--line); }
.qa-order--new { border-left-color: var(--accent); animation: qa-pulse 1.6s ease-in-out 3; }
.qa-order--preparing { border-left-color: var(--warn); }
.qa-order--served { border-left-color: var(--info); }
.qa-order--paid { border-left-color: var(--ok); }
.qa-order--cancelled { border-left-color: var(--bad); opacity: .7; }
@keyframes qa-pulse { 50% { box-shadow: 0 0 0 4px rgba(232,89,12,.25); } }
@media (prefers-reduced-motion: reduce) { .qa-order--new { animation: none; } }
.qa-order__head { display: flex; gap: 8px; align-items: baseline; }
.qa-order__head b { font-size: 20px; }
.qa-order__lines { list-style: none; padding: 0; margin: 10px 0; }
.qa-order__lines li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.qa-order__lines li small { display: block; color: var(--muted); }
.qa-requests { display: grid; gap: 8px; margin-bottom: 14px; }
.qa-request { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-weight: 650; }
.qa-request--bill { background: var(--ok-soft); color: var(--ok); }

/* menu editor */
.qa-cat { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.qa-cat__head { display: flex; align-items: center; gap: 6px; padding: 12px 14px; background: #fafaf9; border-bottom: 1px solid var(--line); }
.qa-cat__head h2 { flex: 1; font-size: 16px; }
.qa-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.qa-item:first-of-type { border-top: 0; }
.qa-item.is-hidden { opacity: .5; }
.qa-item__price { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.qa-switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.qa-switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.qa-switch span { position: absolute; inset: 0; border-radius: 99px; background: #d6d3d1; transition: background .15s; }
.qa-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 99px; background: #fff; transition: transform .15s; }
.qa-switch input:checked + span { background: var(--ok); }
.qa-switch input:checked + span::after { transform: translateX(18px); }
.qa-switch input:focus-visible + span { outline: 3px solid rgba(232,89,12,.45); }

/* modal */
.qa-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .qa-modal { align-items: center; padding: 24px; } }
.qa-modal__bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.qa-modal__box { position: relative; background: var(--surface); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .qa-modal__box { border-radius: 16px; } }
.qa-modal__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.qa-modal__head h2 { flex: 1; }
.qa-modal__foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; position: sticky; bottom: -18px; background: var(--surface); padding: 10px 0 0; }
.qa-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.qa-group__opts { display: grid; gap: 6px; margin-top: 8px; }
.qa-group__opt { display: grid; grid-template-columns: 1fr 110px 34px; gap: 6px; }
.qa-imgpick { display: flex; gap: 12px; align-items: center; }
.qa-imgpick img, .qa-imgpick .qa-thumb { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; }
.qa-cover-preview { width: 100%; aspect-ratio: 3/1; border-radius: 10px; object-fit: cover; background: var(--bg); }
.qa-toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 92vw; }
.qa-toast--bad { background: var(--bad); }
.qa-qrprev { display: grid; justify-items: center; gap: 10px; }
.qa-qrprev img { width: 220px; max-width: 70vw; border: 1px solid var(--line); border-radius: 12px; }
.qa-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.qa-table { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 6px; background: var(--surface); }
.qa-table.is-off { opacity: .55; }
.qa-table img { width: 100%; border-radius: 6px; }
.qa-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.qa-bars div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.qa-bars div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.qa-bars--hours div { background: #a8a29e; }
.qa-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }
.qa-table-data { width: 100%; border-collapse: collapse; }
.qa-table-data th, .qa-table-data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.qa-table-data td.num, .qa-table-data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.qa-plans { display: grid; gap: 12px; }
@media (min-width: 760px) { .qa-plans { grid-template-columns: repeat(3, 1fr); } }
.qa-plan { border: 2px solid var(--line); border-radius: var(--r); padding: 16px; background: var(--surface); display: grid; gap: 8px; align-content: start; }
.qa-plan.is-current { border-color: var(--accent); }
.qa-plan ul { margin: 0; padding-left: 18px; color: var(--ink2); font-size: 14px; }
.qa-price { font-size: 24px; font-weight: 800; }
.qa-hours-row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.qa-hours-row .qa-row input[type=time] { width: 110px; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }

/* auth */
.qa-auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 14px; background: linear-gradient(160deg, #fff7ed, #f5f5f4 60%); }
.qa-auth__box { width: 100%; max-width: 420px; background: var(--surface); border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.08); padding: 24px 20px; display: grid; gap: 14px; }
.qa-auth__brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.qa-auth .qa-alert { margin: 0; }
@media print { .qa-top, .qa-nav { display: none !important; } }
