/* Staff app. Visual idea: a polished pass. A deep green glass rail with brass
   highlights; frosted panels on warm paper; orders as crisp paper tickets.
   The kitchen screen uses a dark backdrop (less glare by the stove) with bright
   high-contrast tickets. */

body.staff { background: var(--page); background-attachment: fixed; }

/* ---------------------------------------------------------------- sign in */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: var(--hero); background-color: var(--brand); position: relative; overflow: hidden;
}
.login::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--mirror),
              radial-gradient(45% 35% at 82% 12%, rgba(232, 211, 168, .3), transparent 70%),
              linear-gradient(0deg, rgba(255, 255, 255, .1), transparent 16%);
}
.login-card {
  position: relative; width: min(390px, 100%); display: grid; gap: 14px; padding: 30px 26px;
  border-radius: 22px; background: rgba(251, 250, 246, .9);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: inset 0 1px 0 #fff, 0 30px 60px -24px rgba(0, 0, 0, .6);
  animation: rise .4s var(--ease);
}
.login-brand { display: grid; justify-items: center; gap: 12px; text-align: center; margin-bottom: 4px; }
.login-logo {
  width: 124px; height: 124px; border-radius: 50%; background: #fff url("../img/logo.png") center / cover no-repeat;
  box-shadow: 0 0 0 2px #1a2c18, 0 0 0 4px var(--accent), 0 14px 26px -10px rgba(0, 0, 0, .55);
}
.login-name { margin: 0; font-family: var(--display); color: var(--brand-ink); font-size: 1.85rem; font-weight: 700; line-height: 1.12; }
.login-name small { display: block; margin-top: 3px; font-size: .95rem; font-weight: 500; letter-spacing: .03em; color: var(--accent-lo); }
.login h1 { color: var(--brand-ink); font-size: 1.05rem; font-weight: 700; }
:where(.login, .modal, .panel, .form-grid) label { display: grid; gap: 5px; font-weight: 650; font-size: .9rem; }
.login input, .modal input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .modal select, .modal textarea,
.history select, .menu-avail input[type="search"], .panel input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]),
.panel select, .panel textarea, .page-actions input[type="search"] {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; min-height: 44px;
  box-shadow: inset 0 1px 2px rgba(16, 28, 18, .06); transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(172, 139, 93, .25) !important; }
input[aria-invalid="true"] { border-color: var(--danger) !important; }
.otp-input { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.outlet-pick { display: grid; gap: 10px; max-width: 420px; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 18px 12px;
  color: #fff; background: var(--hero); background-color: var(--brand);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06), 8px 0 30px -18px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.rail::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .02) 45%, rgba(255, 255, 255, 0) 46%),
              radial-gradient(80% 40% at 0% 0%, rgba(232, 211, 168, .18), transparent 70%);
}
.rail::after { /* gilt edge */
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--accent) 20%, #f3e3bf 50%, var(--accent) 80%, transparent); opacity: .55;
}
.rail > * { position: relative; }
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 4px; }
.brand img { border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--accent), 0 6px 14px -6px rgba(0, 0, 0, .6); }
.brand strong small { display: block; margin-top: 2px; font-size: .74rem; font-weight: 500; letter-spacing: .03em; }
.brand strong {
  font-family: var(--display); font-size: 1.22rem; font-weight: 650; line-height: 1.2; display: block; letter-spacing: .01em;
  background: var(--gilt-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand select {
  margin-top: 5px; max-width: 150px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1); color: #fff; padding: 3px 6px;
}
.brand select option { color: var(--ink); }
.rail nav { display: grid; gap: 3px; }
.rail nav button {
  position: relative; text-align: left; background: none; border: 1px solid transparent; color: #dbe5d6;
  padding: 10px 14px; border-radius: 11px; font-weight: 650; transition: background .2s, color .2s;
}
.rail nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail nav button.is-active {
  color: #fff; background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  border-color: rgba(255, 255, 255, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 18px -12px rgba(0, 0, 0, .7);
}
.rail nav button.is-active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brass);
}
.rail-foot { margin-top: auto; display: grid; gap: 6px; font-size: .86rem; padding: 0 4px; }
.rail .muted { color: #b8c6b2; }
.rail .link-btn { color: #f3ead8; justify-self: start; text-decoration-color: rgba(232, 211, 168, .5); }
.conn { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.conn .dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa; }
.conn-live .dot { background: #6fd67f; box-shadow: 0 0 0 3px rgba(111, 214, 127, .22), 0 0 12px rgba(111, 214, 127, .7); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(111, 214, 127, .1), 0 0 16px rgba(111, 214, 127, .5); } }
.conn-reconnecting .dot, .conn-connecting .dot { background: #f0c050; }
.conn-offline { color: #ffd2c8; }
.conn-offline .dot { background: #ff7a63; }

.workspace { padding: 20px 22px 40px; min-width: 0; }
.stack { display: grid; gap: 16px; }
.banner {
  padding: 11px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
  border: 1px solid transparent; box-shadow: var(--shadow-1);
}
.banner.warn { background: linear-gradient(180deg, #fff6df, #fdecc4); color: #5f4306; border-color: #efd69f; }
.banner.paused { background: linear-gradient(180deg, #fff0ec, #fbdcd4); color: #6d2017; border-color: #efbfb3; }
.action-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

/* ---------------------------------------------------------------- panels (Stage 7) */
.panel {
  border-radius: var(--radius-lg); padding: 18px 20px; background: var(--glass); border: 1px solid var(--glass-edge);
  box-shadow: var(--hairline), var(--shadow-1);
}
.panel-head, .page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.panel-head h2, .page-head h2 { font-family: var(--display); font-size: 1.4rem; font-weight: 700; color: var(--brand-ink); }
.panel-head h3 { font-family: var(--display); font-size: 1.2rem; font-weight: 700; color: var(--brand-ink); }
.panel-actions, .page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.page-actions input[type="search"] { width: 220px; }
.page-head { margin-bottom: 4px; }
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; justify-self: start;
  background: rgba(255, 255, 255, .6); border: 1px solid var(--glass-edge); box-shadow: var(--hairline), var(--shadow-1);
}
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 10px; font-weight: 650; color: var(--muted); }
.seg button.is-on { color: #fff; background: var(--sheen), linear-gradient(180deg, var(--brand-hi), var(--brand-ink)); box-shadow: 0 6px 14px -8px var(--brand-deep); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: linear-gradient(180deg, #fff, #f0f1eb);
  font-weight: 800; color: var(--brand-ink);
}
.icon-btn:disabled { opacity: .35; }
.inline-label { display: flex !important; align-items: center; gap: 8px !important; }
.inline-label select { width: auto !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid fieldset, .role-pick, .diet-pick {
  border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px;
  background: rgba(255, 255, 255, .5);
}
legend { font-weight: 750; font-size: .86rem; padding: 0 6px; color: var(--brand-ink); letter-spacing: .02em; }
.form-grid fieldset.diet-pick, .diet-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.diet-pick legend { width: 100%; }
.diet-pick .chip, .chips label.chip { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.diet-pick input, .chips label.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.outlet-box { padding: 12px 14px; border-radius: 14px; background: linear-gradient(180deg, #f6f8f3, #eef2ea); border: 1px solid var(--line-soft); }
.narrow { max-width: 160px; }
.narrow-form { max-width: 560px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.settings-form .form-actions { justify-content: flex-start; }
.check { display: flex !important; gap: 9px; align-items: center; font-weight: 600; grid-template-columns: none !important; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.kv { display: grid; gap: 6px; margin: 0; }
.kv div { display: flex; gap: 12px; }
.kv dt { width: 80px; color: var(--muted); }
.kv dd { margin: 0; font-weight: 650; }
.ok-line { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dot-ok { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(43, 122, 61, .18); }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 650; margin-bottom: 10px; }
.totp-setup ol { padding-left: 20px; display: grid; gap: 16px; margin: 0 0 14px; }
.totp-qr { margin: 10px 0; border-radius: 12px; background: #fff; padding: 6px; box-shadow: var(--shadow-1); }
.pw {
  display: inline-block; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.05rem; font-weight: 700;
  background: #fff; border: 1px dashed var(--accent); border-radius: 8px; padding: 6px 10px; letter-spacing: .03em; user-select: all;
}
.pw-reveal { display: grid; gap: 10px; }
.pw-reveal .pw { font-size: 1.3rem; justify-self: start; }
.role-option {
  display: grid !important; grid-template-columns: auto 1fr; gap: 10px !important; align-items: start; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 400 !important;
}
.role-option.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(46, 73, 41, .15); }
.role-option input { margin-top: 3px; accent-color: var(--brand); }
.role-option small { display: block; color: var(--muted); }
.role { font-weight: 700; font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: #eceee8; }
.role-org_admin { background: var(--brass); color: #231b0e; }
.role-outlet_manager { background: linear-gradient(180deg, #e9f0e6, #d8e4d3); color: var(--brand-ink); }
.role-kitchen_staff { background: linear-gradient(180deg, #ebf3fb, #d9e7f5); color: #1d4b7a; }

/* data tables */
.data-table, .history-table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; background: rgba(255, 255, 255, .7);
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line-soft);
}
.data-table th, .data-table td, .history-table th, .history-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.data-table tr:last-child td, .history-table tr:last-child td { border-bottom: 0; }
.data-table th, .history-table th {
  font-size: .82rem; color: var(--muted); font-weight: 700;
  background: linear-gradient(180deg, #f6f7f2, #eceee7);
}
.data-table tbody tr:hover td { background: rgba(172, 139, 93, .06); }
.data-table .row-actions { text-align: right; white-space: nowrap; }
.data-table .row-actions .link-btn + .link-btn { margin-left: 12px; }
.data-table tr.is-warn td { background: rgba(163, 54, 42, .05); }
.history-table .num { text-align: right; }

/* menu editor */
.menu-editor { display: grid; gap: 16px; }
.cat-panel.is-hidden { opacity: .72; }
.dish-list { list-style: none; margin: 0; padding: 0; }
.dish-list .dish {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 90px 150px auto; gap: 12px; align-items: center;
  padding: 11px 6px; border-bottom: 1px solid var(--line-soft);
}
.dish-list .dish:last-child { border-bottom: 0; }
.dish-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.dish-name { font-weight: 650; }
.dish-name .variant {
  margin-left: 8px; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(180deg, #faf3e4, #f1e2c2); color: #5f4306; border: 1px solid #e9d6ac;
}
.dish-desc { flex-basis: 100%; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dish-price { text-align: right; font-weight: 750; }
.dish-actions { display: flex; gap: 10px; justify-content: flex-end; white-space: nowrap; }
.dish.is-off .dish-name { color: var(--muted); }
.dish.not-sold, .dish.is-archived { opacity: .6; }
.modal-wide { width: min(720px, 100%) !important; max-height: 92vh; overflow: auto; }
.confirm-body { color: var(--ink); }

/* tables & QR */
.add-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; max-width: 560px; }
.add-row label { flex: 1; }
.table-grid { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tcard {
  padding: 14px; border-radius: 16px; background: linear-gradient(180deg, #fff, #f7f7f2); border: 1px solid var(--line-soft);
  box-shadow: var(--hairline), var(--shadow-1); display: grid; gap: 8px; transition: transform .2s var(--ease), box-shadow .2s;
}
.tcard:hover { transform: translateY(-2px); box-shadow: var(--hairline), var(--shadow-2); }
.tcard.is-off { opacity: .6; }
.tcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tcard-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* branding */
.brand-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin-bottom: 8px; }
.logo-box { display: flex; align-items: center; gap: 14px; }
.logo-box img { border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--accent), var(--shadow-1); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.colour-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.colour-pick input[type="color"] { width: 64px; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #fff; }

/* counter order */
.co-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; min-height: 0; }
.co-top { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.co-list { max-height: 52vh; overflow: auto; padding-right: 4px; }
.co-list h4 { font-family: var(--display); font-size: 1rem; color: var(--brand-ink); margin: 12px 0 6px; }
.co-item {
  width: 100%; display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: center; text-align: left;
  padding: 9px 10px; margin-bottom: 4px; border-radius: 10px; border: 1px solid var(--line-soft); background: #fff;
  transition: border-color .15s, transform .1s;
}
.co-item:hover { border-color: var(--accent); }
.co-item:active { transform: scale(.99); }
.co-item small, .co-cart small { color: var(--muted); }
.co-cart {
  display: grid; align-content: start; gap: 10px; padding: 14px; border-radius: 16px;
  background: linear-gradient(180deg, #f6f8f3, #edf1e9); border: 1px solid var(--line-soft);
}
.co-cart h4 { font-family: var(--display); font-size: 1.15rem; color: var(--brand-ink); }
.co-cart ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.co-cart li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.co-cart .stepper { display: inline-flex; align-items: center; gap: 6px; }
.co-cart .stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 800; }
.co-total { display: flex; justify-content: space-between; font-size: 1.15rem; border-top: 1px solid var(--line-soft); padding-top: 8px; }

/* ---------------------------------------------------------------- requests strip */
.req-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.req-card {
  color: var(--ink);
  display: flex; align-items: center; gap: 10px; padding: 9px 9px 9px 16px; border-radius: 14px;
  background: linear-gradient(180deg, #fff8e6, #f9e8c2); border: 1px solid var(--accent); box-shadow: var(--shadow-1);
}
.req-card.kind-bill { background: linear-gradient(180deg, #f1f6ee, #dfe9da); border-color: var(--brand); }
.req-card.req-open { animation: nudge 1.4s ease-in-out 2; }
.req-card .secondary, .req-card .primary { min-height: 36px; padding: 6px 12px; }
.rq-table { font-weight: 800; font-size: 1.1rem; }
.rq-time { color: var(--muted); font-size: .85rem; }
@keyframes nudge { 50% { transform: translateY(-2px); box-shadow: 0 8px 20px -6px rgba(172, 139, 93, .7); } }

/* ---------------------------------------------------------------- order board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.column {
  padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .42); border: 1px solid var(--glass-edge);
  box-shadow: var(--hairline); min-height: 120px;
}
.column h2 { font-family: var(--display); font-size: 1.1rem; font-weight: 650; color: var(--brand-ink); margin: 2px 2px 14px; display: flex; gap: 8px; align-items: center; }
.count {
  background: var(--sheen), linear-gradient(180deg, var(--brand-hi), var(--brand-ink)); color: #fff;
  border-radius: 999px; font-size: .76rem; padding: 1px 8px; letter-spacing: 0;
}
.column .empty { font-size: .9rem; }

.ticket {
  position: relative; background: #fffefb; border-radius: 6px 6px 12px 12px; margin-bottom: 16px;
  padding: 15px 13px 11px; box-shadow: 0 1px 0 #e1ddd0, 0 10px 22px -12px rgba(16, 28, 18, .35);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.ticket:hover { transform: translateY(-2px); box-shadow: 0 1px 0 #e1ddd0, 0 16px 30px -14px rgba(16, 28, 18, .45); }
.ticket::before { /* torn paper edge */
  content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 8px;
  background: radial-gradient(circle at 6px -2px, transparent 6px, #fffefb 6.5px) repeat-x;
  background-size: 12px 8px;
}
.ticket.is-fresh { outline: 3px solid var(--accent); animation: arrive .6s var(--ease); }
@keyframes arrive { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.ticket.is-late .t-time { color: var(--danger); font-weight: 800; }
.ticket-head { display: flex; align-items: flex-start; gap: 10px; border-bottom: 1.5px dashed var(--line); padding-bottom: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.t-table { font-family: var(--display); font-size: 2rem; font-weight: 700; line-height: 1; color: var(--brand-ink); }
.t-table small { display: block; font-size: .74rem; font-weight: 650; color: var(--muted); margin-bottom: 3px; font-family: var(--font); }
.t-meta { display: grid; font-size: .85rem; color: var(--muted); margin-left: auto; text-align: right; }
.t-src { flex-basis: 100%; font-size: .78rem; font-weight: 700; color: var(--warn); }
.t-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.t-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 3px 6px; position: relative; padding-right: 22px; }
.t-item .item-step, .t-item .item-state { grid-column: 2; justify-self: start; }
.t-qty { font-weight: 800; font-size: 1.05rem; }
.t-name { font-weight: 600; }
.item-step, .item-state { font-size: .74rem; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.item-step { border: 1px solid var(--brand); background: #fff; color: var(--brand); font-weight: 700; }
.item-state { color: var(--muted); }
.item-ready .t-name::after { content: " ✓"; color: var(--ok); font-weight: 800; }
.item-served .t-name, .item-cancelled .t-name { color: var(--muted); }
.item-cancelled .t-name { text-decoration: line-through; }
.t-note, .t-order-note { grid-column: 2 / -1; background: #fff3c4; border-radius: 6px; padding: 3px 7px; font-size: .88rem; font-weight: 600; }
.t-order-note { margin-top: 8px; }
.item-x { position: absolute; right: 0; top: 0; border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 4px; }
.ticket-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1.5px dashed var(--line); }
.t-total { font-weight: 750; margin-right: auto; font-variant-numeric: tabular-nums; }
.ticket-foot .primary { min-height: 40px; padding: 8px 14px; }

/* ---------------------------------------------------------------- tables in use */
.tables-view h2, .history h2, .menu-avail h2 { font-family: var(--display); font-size: 1.4rem; font-weight: 700; color: var(--brand-ink); display: flex; gap: 8px; align-items: center; }
.tables-view h3 { margin: 26px 0 8px; font-size: 1rem; }
.visit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 12px; }
.visit {
  border-radius: 18px; padding: 16px; background: linear-gradient(180deg, #fff, #f7f7f2); border: 1px solid var(--line-soft);
  box-shadow: var(--hairline), var(--shadow-1); transition: transform .2s var(--ease), box-shadow .2s;
}
.visit:hover { transform: translateY(-2px); box-shadow: var(--hairline), var(--shadow-2); }
.visit.has-request { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(172, 139, 93, .35), var(--shadow-1); }
.visit header { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.visit dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 6px; }
.visit dt { font-size: .78rem; color: var(--muted); }
.visit dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.flag { color: #6b4d12; font-weight: 700; font-size: .9rem; }
.visit-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; flex-wrap: wrap; gap: 8px; }
.visit-orders { list-style: none; padding: 8px 0 0; margin: 8px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 8px; font-size: .9rem; }
.visit-orders ul { list-style: none; padding: 0; margin: 4px 0 0; }
.visit-orders .is-cancelled { text-decoration: line-through; color: var(--muted); }
.closed-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; max-width: 620px; }
.closed-list li { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }

/* ---------------------------------------------------------------- history + sold-out */
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.menu-avail > .muted { margin-bottom: 10px; }
.ma-cat h3 { font-family: var(--display); font-size: 1.1rem; color: var(--brand-ink); margin: 18px 0 8px; }
.ma-cat ul { list-style: none; padding: 0; margin: 0; background: rgba(255, 255, 255, .75); border-radius: 14px; border: 1px solid var(--line-soft); box-shadow: var(--shadow-1); }
.ma-cat li { display: grid; grid-template-columns: 18px 1fr auto 140px; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.ma-cat li:last-child { border-bottom: 0; }
.ma-cat li.is-off .ma-name { color: var(--muted); text-decoration: line-through; }

/* switches: a real toggle look on top of a checkbox */
.switch { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .88rem; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; position: relative; flex: none; margin: 0;
  background: #cfd4ca; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); transition: background .2s; cursor: pointer;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, #eef0ea); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--ease);
}
.switch input:checked { background: linear-gradient(180deg, var(--brand-hi), var(--brand)); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; padding: 16px;
  background: rgba(12, 20, 13, .42); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  border-radius: 20px; padding: 22px; width: min(480px, 100%); display: grid; gap: 14px;
  background: linear-gradient(180deg, #fff, #f8f8f4); border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: inset 0 1px 0 #fff, 0 40px 80px -30px rgba(0, 0, 0, .55); animation: pop .25s var(--ease);
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal h3 { font-family: var(--display); font-size: 1.3rem; font-weight: 700; color: var(--brand-ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; border: 1px solid var(--line); background: linear-gradient(180deg, #fff, #f3f4ef); border-radius: 999px;
  padding: 5px 12px; font-size: .86rem; box-shadow: var(--hairline);
}
.chip.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(46, 73, 41, .15); font-weight: 700; }

@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .dish-list .dish { grid-template-columns: 18px minmax(0, 1fr) 80px auto; }
  .dish-list .dish .dish-actions { grid-column: 2 / -1; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  /* phones (kitchen): the side rail becomes a compact sticky top bar */
  .rail { position: sticky; top: 0; z-index: 30; height: auto; gap: 6px; padding: 8px 10px; }
  .rail nav button.is-active::before { display: none; }
  .brand img { width: 28px; height: 28px; }
  .brand strong { font-size: 1rem; }
  .brand strong small { font-size: .68rem; margin-top: 0; }
  .rail nav { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .rail nav button { padding: 6px 12px; white-space: nowrap; }
  .rail-foot { margin-top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; }
  .rail-foot .muted { display: none; }
  .workspace { padding: 10px 10px 30px; }
  .board { grid-template-columns: 1fr; }
  .ma-cat li { grid-template-columns: 18px 1fr auto; }
  .ma-cat li .switch { grid-column: 2 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .co-grid, .co-top { grid-template-columns: 1fr; }
  .dish-list .dish { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .dish-list .dish .switch, .dish-list .dish .dish-actions { grid-column: 2 / -1; }
  .data-table thead { display: none; }
  .data-table tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
  .data-table td { border: 0; padding: 2px 12px; }
  .data-table .row-actions { text-align: left; }
  .panel { padding: 14px; }
  .page-actions input[type="search"] { width: 100%; }
}

/* ---------------------------------------------------------------- kitchen (Stage 5) */
.workspace.is-kitchen {
  background: radial-gradient(80% 40% at 50% 0%, rgba(232, 211, 168, .10), transparent 70%), linear-gradient(180deg, #172318, #0e150f);
  color: #eef2ea;
}
.kitchen { --k-gap: 12px; }
.kitchen .muted { color: #a9b6a5; }
.k-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.k-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); }
.k-tabs button { border: 0; background: none; color: #d6dfd2; border-radius: 999px; padding: 8px 18px; font-weight: 800; font-size: 1.05rem; min-height: 46px; }
.k-tabs button.is-on { background: var(--brass); color: #221a0d; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 16px -8px rgba(0, 0, 0, .8); }
.k-tabs .count { background: rgba(0, 0, 0, .25); color: inherit; margin-left: 4px; }
.k-tabs button:not(.is-on) .count { background: rgba(255, 255, 255, .14); }
.kitchen .primary { background: var(--brass); color: #221a0d; border-color: var(--accent-lo); }
.k-hint { margin-bottom: 10px; }
.k-empty { font-size: 1.2rem; color: #a9b6a5; padding: 60px 0; text-align: center; }
.k-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--k-gap); align-items: start; }
.kt {
  color: var(--ink); background: linear-gradient(180deg, #fffefb, #f6f5ef); border-radius: 16px; padding: 14px;
  border-top: 8px solid var(--brand-hi); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .8), inset 0 1px 0 #fff;
}
.kt.status-new { border-top-color: var(--accent); }
.kt.is-amber { border-top-color: #e0a52a; }
.kt.is-red { border-top-color: #d9503f; }
.kt.is-red .kt-time { color: var(--danger); }
.kt.is-amber .kt-time { color: #8a5b00; }
.kt.is-fresh { outline: 4px solid var(--accent); animation: arrive .6s var(--ease); }
.kt-head { display: flex; align-items: baseline; gap: 10px; }
.kt-table { font-size: 2.7rem; font-weight: 900; line-height: 1; color: var(--brand-ink); }
.kt-meta { color: var(--muted); font-weight: 600; }
.kt-time { margin-left: auto; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kt-new { display: inline-block; margin-top: 6px; background: var(--brass); color: #1c1a14; font-weight: 800; border-radius: 6px; padding: 2px 9px; }
.kt-items { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.kt-item {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; color: var(--ink);
  text-align: left; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 10px; min-height: 58px; font-size: 1.1rem;
}
button.kt-item:active { transform: scale(.99); }
.kt-qty { font-size: 1.5rem; font-weight: 900; text-align: center; }
.kt-name { font-weight: 700; }
.kt-note { display: block; font-style: normal; font-weight: 700; font-size: .95rem; background: #fff3c4; border-radius: 6px; padding: 2px 7px; margin-top: 4px; }
.kt-state { font-size: .82rem; font-weight: 800; border-radius: 999px; padding: 4px 10px; background: #e8ebe5; }
.item-preparing { border-color: #8fb3d9; background: #f2f7fc; }
.st-preparing { background: #dbe8f6; color: #1d4b7a; }
.item-ready { border-color: #8cc79a; background: #effaf1; }
.st-ready { background: #cfeed6; color: #1d5e2b; }
.kt-order-note { background: #fff3c4; border-radius: 8px; padding: 6px 9px; margin-top: 8px; font-weight: 700; }
.kt-foot { display: flex; gap: 8px; margin-top: 12px; }
.kt-go {
  flex: 1; min-height: 58px; border: 1px solid var(--brand-ink); border-radius: 12px; color: #fff; font-size: 1.2rem; font-weight: 800;
  background: var(--sheen), linear-gradient(180deg, var(--brand-hi), var(--brand-ink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 20px -12px var(--brand-deep);
}
.kt-go:disabled { opacity: .6; }
.kt-reject { min-height: 58px; border: 1.5px solid var(--danger); background: #fff; color: var(--danger); border-radius: 12px; font-weight: 700; padding: 0 14px; }
@media (max-width: 720px) { .k-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- payments (Stage 6) */
.visit .is-due dd { color: var(--danger); }
.visit .is-owed dd { color: var(--warn); }
.visit.is-paid { border-color: rgba(43, 122, 61, .5); }
.pay-modal { width: min(580px, 100%); max-height: 92vh; overflow: auto; }
.bill-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.bill-sum div { background: linear-gradient(180deg, #f7f8f3, #eef1ea); border: 1px solid var(--line-soft); border-radius: 12px; padding: 9px 11px; }
.bill-sum dt { font-size: .82rem; color: var(--muted); }
.bill-sum dd { margin: 0; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bill-sum .is-due { background: linear-gradient(180deg, #fdf0ed, #f9e1dc); border-color: #efc3ba; }
.bill-sum .is-due dd { color: var(--danger); }
.pay-form { display: grid; gap: 12px; }
.pay-form label { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
.pay-form input, .inline-prompt input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 1.05rem; }
.chip.big { padding: 10px 20px; font-size: 1rem; font-weight: 700; }
.change { color: var(--ok); }
.ledger { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ledger caption { text-align: left; font-weight: 700; margin: 6px 0; }
.ledger td { padding: 7px 4px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.ledger .num { text-align: right; font-weight: 700; }
.ledger .is-void td { color: var(--muted); }
.ledger .is-void .num { text-decoration: line-through; }
.inline-prompt { display: grid; gap: 8px; background: linear-gradient(180deg, #fffaf0, #fbefd8); border: 1px solid var(--accent); border-radius: 14px; padding: 12px; }
.inline-prompt .check input { accent-color: var(--danger); }
.takings { margin-bottom: 28px; }
.takings input[type="date"] { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.takings-table tfoot th { background: linear-gradient(180deg, #f1f3ec, #e4e8de); }
.takings-table .num { text-align: right; }

/* request cards on phones: who + what on one line, buttons underneath */
@media (max-width: 720px) {
  .req-strip { display: grid; gap: 8px; }
  .req-card { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 8px; padding: 10px 12px; }
  .req-card .rq-table, .req-card .rq-what, .req-card .rq-time { white-space: nowrap; }
  .req-card .rq-what { overflow: hidden; text-overflow: ellipsis; }
  .req-card .secondary, .req-card .primary { grid-row: 2; }
  .req-card .secondary { grid-column: 1 / 3; }
  .req-card .primary { grid-column: 3; }
  .req-card .primary:only-of-type { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- KOT printing + device settings */
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.kot-btn { font-size: .85rem; white-space: nowrap; }
.device-box { border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px 14px 14px; margin: 12px 0 0; display: grid; gap: 10px; background: rgba(255, 255, 255, .5); }
.device-box code { font-size: .85em; background: #f1efe6; padding: 1px 5px; border-radius: 5px; }
.sound-nudge { cursor: pointer; }

/* ---------------------------------------------------------------- stock (inventory) */
.stock-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.stock-summary .chip { border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .92rem;
  border: 1px solid var(--line); background: linear-gradient(180deg, #fff, #f2f3ee); }
.stock-summary button.chip { cursor: pointer; }
.chip.warn { color: var(--warn); border-color: #e7cf9c; background: linear-gradient(180deg, #fffaf0, #fbefd3); }
.chip.warn.is-on { background: linear-gradient(180deg, #fbefd3, #f4dfae); }
.chip.ok { color: var(--ok); border-color: #c6e1cc; background: linear-gradient(180deg, #f7fcf8, #e7f4ea); }
.stock-table .group-row th { text-align: left; font-family: var(--display); font-size: 1.02rem; color: var(--brand-ink);
  padding-top: 16px; border-bottom: 1px solid var(--line); }
.stock-table tr.is-low td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.data-table tr.is-off td { opacity: .55; }
.badge-low { background: linear-gradient(180deg, #fff6e0, #fbe7bd); color: #6e4b00; margin-left: 8px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn-text { color: var(--warn); font-weight: 700; }
.kind { font-weight: 650; font-size: .9rem; }
.kind-purchase, .kind-opening { color: var(--ok); }
.kind-wastage { color: var(--danger); }
.kind-count { color: #1d4b7a; }
.kind-sale { color: var(--muted); }
.qty-entry { display: flex; gap: 8px; align-items: center; }
.qty-entry input { flex: 1; min-width: 0; }
.qty-entry select { width: auto; flex: 0 0 auto; }
.unit { color: var(--muted); font-weight: 650; min-width: 2.2em; }
.recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5em auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.modal label.check, .panel label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px;
  background: linear-gradient(180deg, #fff, #f6f7f2); box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat b { font-family: var(--display); font-size: 1.35rem; color: var(--brand-ink); }
@media (max-width: 640px) {
  .stock-table th:nth-child(3), .stock-table td:nth-child(3) { display: none; }
  .recipe-row { grid-template-columns: minmax(0, 1fr) 5.5em auto; }
  .recipe-row .link-btn { grid-column: 1 / -1; justify-self: start; }
}
.discount-line { margin: 4px 0; font-weight: 650; color: var(--ok); } .discount-line .link-btn { margin-left: 8px; }
.hours-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- sales report, enquiries */
.sub-h { font-family: var(--display); font-size: 1.12rem; color: var(--brand-ink); margin: 18px 0 8px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
.bar-col { width: 34%; }
.bar { display: block; height: 10px; width: var(--w, 0); border-radius: 999px; background: var(--brass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.enquiry-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.enquiry { border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px 14px; background: #fff; }
.enquiry.is-new { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.enquiry.is-closed { opacity: .65; }
.enquiry-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 4px; }
.enquiry p { margin: 4px 0; }
.two-factor-gate { max-width: 760px; margin: 0 auto; }
@media (max-width: 640px) { .bar-col { width: 22%; } }
.enquiry .row-actions { display: flex; flex-wrap: wrap; gap: 6px 16px; } .enquiry a[href^="tel:"] { color: var(--brand); font-weight: 650; }

/* Dashboard */
.stat small { font-size: .78rem; }
.stat b.is-high { color: var(--danger); }
.delta-up { color: var(--ok); }
.delta-down { color: var(--danger); }
.trend { display: block; width: 100%; height: auto; }
.trend-axis { stroke: var(--line); }
.trend-bar { fill: var(--accent); }
.trend-bar.is-today { fill: var(--brand); }
.trend-label { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.feedback-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.feedback-list li { border: 1px solid var(--line-soft); border-radius: 12px; padding: 8px 12px; background: #fff; }
.feedback-list li.is-low { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.feedback-list p { margin: 4px 0 0; }

/* Orders not served in time */
.banner.late { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  background: linear-gradient(180deg, #fbe3de, #f6c9c1); color: #5e150d; border-color: var(--danger); }
.banner.late p { margin: 0; }
.check input.late-mins { display: inline-block; width: 4.5em !important; min-width: 0; margin: 0 6px; padding: 2px 6px; font: inherit; }

/* Dish photos */
.photo-pick { display: flex; gap: 14px; align-items: center; }
.photo-pick img, .photo-empty { flex: none; width: 96px; height: 96px; border-radius: 10px; object-fit: cover; }
.photo-empty { display: grid; place-items: center; background: var(--brand-soft); color: var(--muted); font-size: .8rem; }
.photo-pick p { margin: 6px 0 0; }
.dish-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; align-self: center; }

.banner.music { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  background: linear-gradient(180deg, #fff6df, #fdecc4); color: #5f4306; border-color: var(--accent); }
.banner.music p { margin: 0; }

/* Daily count and order list */
.count-group { border: 1px solid var(--line-soft); border-radius: 12px; margin: 0 0 12px; padding: 6px 14px 10px; }
.count-group legend { font-weight: 700; padding: 0 6px; color: var(--brand-ink); }
.panel .count-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.count-row:last-child { border-bottom: 0; }
.panel .count-row .qty-entry input, .order-lines .qty-entry input { width: 88px !important; }
.order-card { border: 1px solid var(--line-soft); border-radius: 12px; padding: 4px 14px 14px; margin-bottom: 14px; background: #fff; }
.order-lines { list-style: none; margin: 0 0 10px; padding: 0; }
.order-lines li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.order-lines li .check { flex: 1 1 160px; }
