/* Chop Chain — staff & platform look. Loaded AFTER app.css by every logged-in screen (views/shared/header.php,
   views/platform/_head.php). Mirrors the school app's shell: dark accent-tinted sidebar, gradient topbar,
   card + gradient-header tables, pill badges, KPI tiles. Everything is scoped to body.staff so the customer
   ordering pages (which share app.css) are untouched.

   Colours are derived from the restaurant's saved palette (--accent, --accent-strong, --ink, --paper…, set
   server-side by core/Theme.php), so choosing a palette in Settings recolours this whole shell for everyone. */

:root {
  --sidebar-w: 262px;
  --sidebar-collapsed-w: 72px;
  --header-h: 64px;
  --imp-h: 0px;                                   /* set to 34px while a platform admin is impersonating */

  --brand-500: var(--accent);
  --brand-600: var(--accent-strong);
  --brand-700: color-mix(in srgb, var(--accent-strong) 72%, black);
  --brand-tint: color-mix(in srgb, var(--accent) 55%, white);
  --nav-bg: color-mix(in srgb, var(--brand-700) 62%, #05080f);
  --nav-hover: rgba(255,255,255,.06);
  --nav-text: rgba(255,255,255,.78);
  --nav-text-hi: #fff;
  --nav-muted: rgba(255,255,255,.55);
  --nav-border: rgba(255,255,255,.06);
  --group-bg: rgba(0,0,0,.15);

  --border-strong: color-mix(in srgb, var(--border) 55%, var(--text-muted));
  --label-color: color-mix(in srgb, var(--text) 78%, white);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.05);
  --shadow-md: 0 10px 28px rgba(15,23,42,.12), 0 3px 8px rgba(15,23,42,.07);
}
body:has(.impersonation-bar) { --imp-h: 34px; }

body.staff {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  font-size: 14px;
}
.staff h1, .staff h2, .staff h3, .staff h4 { font-family: var(--font); font-weight: 700; letter-spacing: -.01em; }
.staff .mono { font-variant-numeric: tabular-nums; }
.staff a { color: var(--accent-strong); }

/* ── Sidebar ─────────────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: var(--imp-h); left: 0; height: calc(100vh - var(--imp-h)); width: var(--sidebar-w);
  background: var(--nav-bg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-700) 55%, black) 0%, var(--nav-bg) 18%, var(--nav-bg) 100%);
  display: flex; flex-direction: column; z-index: 1050; overflow: hidden;
  transition: width .22s ease, transform .3s ease;
}
#sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sb-brand { padding: 15px 14px; border-bottom: 1px solid var(--nav-border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.sb-brand-icon {
  width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14) inset;
}
.sb-brand-text { min-width: 0; }
.sb-brand-name { color: #fff; font-weight: 700; font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand-sub { color: var(--nav-muted); font-size: 10px; }
.sb-collapse-btn {
  margin-left: auto; flex-shrink: 0; width: 26px; height: 26px; border-radius: 6px; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.8);
}
.sb-collapse-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
#sidebar.collapsed .sb-collapse-btn i { transform: rotate(180deg); }
#sidebar.collapsed .sb-collapse-btn { margin-left: 0; }
#sidebar.collapsed .sb-brand { flex-direction: column; padding: 12px 8px; gap: 8px; }
#sidebar.collapsed .sb-brand-text { display: none; }

.sb-nav { flex: 1; min-height: 0; padding: 8px 0 12px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }
.sb-group-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px 8px 13px; background: none; border: 0; cursor: pointer;
  color: var(--nav-muted); font: 700 10.5px/1.2 var(--font); text-transform: uppercase; letter-spacing: .7px; user-select: none;
}
.sb-group-btn:hover, .sb-group-btn[aria-expanded="true"] { color: var(--nav-text-hi); }
.sb-group-icon { width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.sb-chevron { margin-left: auto; font-size: 10px; transition: transform .25s ease; }
.sb-group-btn[aria-expanded="true"] .sb-chevron { transform: rotate(90deg); }
.sb-group-items { background: var(--group-bg); border-left: 2px solid var(--nav-border); margin: 0 10px 4px 12px; border-radius: 0 0 7px 7px; overflow: hidden; }
.sb-group-items[hidden] { display: none; }
.sb-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px; margin: 1px 6px; border-radius: 7px;
  color: var(--nav-text); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.staff .sb-item { color: var(--nav-text); }
.sb-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; opacity: .8; }
.sb-item:hover, .staff .sb-item:hover { background: var(--nav-hover); color: var(--nav-text-hi); }
.sb-item:hover i { opacity: 1; }
.sb-item.active, .staff .sb-item.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent) 20%, transparent));
  color: var(--brand-tint); transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 3px 6px rgba(0,0,0,.4), 0 2px 10px color-mix(in srgb, var(--accent) 25%, transparent), inset 0 1px 0 rgba(255,255,255,.25);
}
.sb-item.active i { opacity: 1; color: var(--brand-tint); }
.sb-group-items .sb-item { margin: 1px 4px; padding: 6px 10px; font-size: 12.5px; border-radius: 6px; }
.sb-standalone { padding: 0 6px; margin-bottom: 1px; }
.sb-standalone .sb-item { margin: 1px 0; }
.sb-divider { height: 1px; background: var(--nav-border); margin: 6px 14px; }
#sidebar.collapsed .sb-group-btn { justify-content: center; }
#sidebar.collapsed .sb-group-label, #sidebar.collapsed .sb-chevron, #sidebar.collapsed .sb-item-text, #sidebar.collapsed .sb-group-items { display: none; }
#sidebar.collapsed .sb-item { justify-content: center; margin: 1px 10px; }

.sb-footer { border-top: 1px solid var(--nav-border); padding: 11px 13px; flex-shrink: 0; }
.sb-user { display: flex; align-items: center; gap: 9px; text-decoration: none; margin-bottom: 6px; }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; font-size: 12px; font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255,255,255,.16) inset;
}
.sb-user-name { color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { color: var(--nav-muted); font-size: 10.5px; text-transform: capitalize; }
.sb-logout, .staff .sb-logout { display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.5); text-decoration: none; font-size: 12px; }
.sb-logout:hover, .staff .sb-logout:hover { color: rgba(255,255,255,.85); }
#sidebar.collapsed .sb-user-text, #sidebar.collapsed .sb-logout span { display: none; }
#sidebar.collapsed .sb-footer { display: flex; flex-direction: column; align-items: center; }

/* ── Topbar ──────────────────────────────────────────────────────── */
#topbar {
  position: fixed; top: var(--imp-h); left: var(--sidebar-w); right: 0; height: var(--header-h); z-index: 1040;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--accent-strong);
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-600) 55%, var(--brand-500) 100%);
  border-bottom: 1px solid rgba(255,255,255,.06); box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 4px 12px rgba(0,0,0,.08);
  color: var(--on-accent); transition: left .22s ease;
}
body.sb-collapsed #topbar { left: var(--sidebar-collapsed-w); }
.topbar-page-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tb-icon-btn, .staff a.tb-icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.85); font-size: 14px; text-decoration: none;
  transition: background .2s, color .2s;
}
.tb-icon-btn:hover, .staff a.tb-icon-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.tb-menu-toggle { display: none; }
.tb-user { position: relative; }
.tb-user-pill {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px; border-radius: 40px; cursor: pointer;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.92); font: 500 13px var(--font);
}
.tb-user-pill:hover { background: rgba(255,255,255,.14); color: #fff; }
.tb-user-pill .sb-avatar { width: 26px; height: 26px; font-size: 10px; }
.tb-user-name { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user-pill .bi-chevron-down { font-size: 10px; opacity: .6; }
.tb-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; z-index: 1100;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.tb-dropdown[hidden] { display: none; }
.tb-dropdown-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.tb-dropdown-head b { display: block; font-size: 13px; }
.tb-dropdown-head span { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.tb-dropdown a, .staff .tb-dropdown a { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 7px; font-size: 13px; color: var(--text); text-decoration: none; }
.tb-dropdown a:hover { background: var(--surface-2); }
.tb-dropdown a i { color: var(--text-muted); }
.tb-dropdown a.danger, .staff .tb-dropdown a.danger { color: var(--danger); }
.tb-dropdown a.danger i { color: inherit; }

/* ── Main ────────────────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w); margin-top: calc(var(--header-h) + var(--imp-h)); padding: 22px;
  min-height: calc(100vh - var(--header-h) - var(--imp-h)); transition: margin-left .22s ease;
}
body.sb-collapsed #main { margin-left: var(--sidebar-collapsed-w); }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1039; }
.mobile-overlay.show { display: block; }
.impersonation-bar { position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 1100; padding: 0 16px; }
#main .flash { max-width: none; margin: 0 0 16px; }

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  #sidebar.open { transform: none; }
  #topbar, body.sb-collapsed #topbar { left: 0; padding: 0 12px; gap: 8px; }
  #main, body.sb-collapsed #main { margin-left: 0; padding: 14px; }
  .sb-collapse-btn { display: none; }
  .tb-menu-toggle { display: flex; }
  .topbar-page-title { font-size: 14px; }
  .tb-user-name { display: none; }
  .tb-user-pill { padding: 0 8px 0 4px; }
}

/* ── Page heading ────────────────────────────────────────────────── */
.staff .page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 20px; }
/* The school's title pill: dark palette chip with a fixed gold edge (a signature stripe, the same in every palette). */
.staff .page-head h2 {
  display: inline-flex; align-items: center; margin: 0; padding: 7px 22px; border-radius: 50rem;
  background: var(--brand-700); color: #fff; border-left: 4px solid #f2a900;
  font-size: 1.05rem; font-weight: 700; letter-spacing: .3px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 25%, transparent);
}
.page-sub { color: var(--text-muted); font-size: .82rem; margin: 7px 0 0 4px; }
.staff .empty-state { color: var(--text-muted); }

/* ── Cards, buttons, forms, modal ────────────────────────────────── */
.staff .card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 20px; }
.staff .card h3 { font-size: 1.05rem; margin: 0 0 8px; }
.staff .btn {
  font-family: var(--font); font-size: 13.7px; font-weight: 500; padding: 8px 16px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); transition: all .2s ease;
}
.staff .btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.staff .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 28%, transparent); }
.staff .btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent); transform: translateY(-1px); }
.staff .btn-primary:active { transform: translateY(0); }
.staff .btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.staff .btn-danger:hover { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: var(--danger); }
.staff .btn-sm { padding: 5px 12px; font-size: 12.8px; }
.staff .btn:disabled { opacity: .55; box-shadow: none; transform: none; }

.staff .field label { font-size: 13px; font-weight: 600; color: var(--label-color); }
.staff .field input, .staff .field select, .staff .field textarea, .staff .inline-test input, .staff .inline-test select,
.staff .toolbar-select, .staff .table-toolbar input[type="search"], .staff .table-toolbar select,
.staff .grid-toolbar .grid-search, .staff .grid-pager select, .staff .inline-form input {
  font-family: var(--font); font-size: 14px; padding: 9px 12px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.staff .grid-pager select, .staff .inline-form input { padding: 5px 8px; }
.staff .field input:focus, .staff .field select:focus, .staff .field textarea:focus, .staff .grid-search:focus, .staff .inline-test input:focus,
.staff .inline-test select:focus, .staff .table-toolbar input:focus, .staff .table-toolbar select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.staff .modal { border-radius: 16px; padding: 24px; }
.staff .modal h3 { font-size: 1.1rem; }

/* ── Badges (pastel pills, like the school app) ──────────────────── */
.staff .badge { font-family: var(--font); font-weight: 600; font-size: .72rem; letter-spacing: 0; padding: 3px 10px; border-radius: 20px; }
.staff .badge-on, .staff .badge-ready       { background: #d1fae5; color: #065f46; }
.staff .badge-off, .staff .badge-cancelled  { background: #fee2e2; color: #991b1b; }
.staff .badge-preparing                     { background: #fef9c3; color: #713f12; }
.staff .badge-received                      { background: #e0e7ff; color: #3730a3; }
.staff .badge-served                        { background: #f1f5f9; color: #475569; }
.staff button.badge { border: 0; }

/* ── Universal table (DataGrid) — the school's DataTable, coloured by the chosen palette ────── */
.staff .grid { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.staff .card .grid { box-shadow: none; border-radius: 10px; }

/* toolbar: actions in a tinted bar on the left, Search on the right */
.staff .grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 14px 16px; margin: 0; }
.staff .grid-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; min-height: 46px; }
.staff .grid-count { font-size: 13px; color: var(--text-muted); padding: 0 6px 0 4px; white-space: nowrap; }
.staff .grid-count.on { color: var(--accent-strong); font-weight: 700; }
.staff .grid-tools .btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 50rem;
  font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap;
}
.staff .grid-tools .btn[hidden] { display: none; }
.staff .grid-tools .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.14); }
.staff .btn-dt { background: var(--herb); border-color: var(--herb); color: #fff; }
.staff .btn-dt:hover { background: color-mix(in srgb, var(--herb) 82%, black); border-color: color-mix(in srgb, var(--herb) 82%, black); }
.staff .btn-edit { background: transparent; border-color: var(--accent); color: var(--accent-strong); }
.staff .btn-edit:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.staff .btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.staff .btn-ok:hover { background: color-mix(in srgb, var(--ok) 85%, black); border-color: color-mix(in srgb, var(--ok) 85%, black); color: #fff; }
.staff a.btn.grid-link { text-decoration: none; }
.staff .grid-switch-wrap .grid-menu { z-index: 45; }
.staff .btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.staff .btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, black); border-color: color-mix(in srgb, var(--danger) 85%, black); }
.staff .btn-cancel { background: #6b7280; border-color: #6b7280; color: #fff; }
.staff .btn-cancel:hover { background: #4b5563; border-color: #4b5563; }
.staff .grid-export { position: relative; }
.staff .grid-menu { position: absolute; left: 0; top: calc(100% + 6px); border-radius: 10px; z-index: 40; }
.staff .grid-search-box { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 14px; color: var(--text); }
.staff .grid-toolbar .grid-search {
  min-width: 250px; padding: 8px 16px 8px 38px; border-radius: 50rem; border: 1.5px solid var(--border-strong); font-size: 13px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='6.5' cy='6.5' r='5'/%3E%3Cline x1='10.2' y1='10.2' x2='14.5' y2='14.5'/%3E%3C/svg%3E") no-repeat 14px center;
}

/* the table: a fixed-height body that scrolls under a sticky header */
.staff .grid-scroll { max-height: 68vh; overflow: auto; border-top: 1px solid var(--border); position: relative; }
.staff table.crud-table { border: 0; border-radius: 0; background: transparent; overflow: visible; }
.staff .grid-scroll table.crud-table { border-collapse: separate; border-spacing: 0; }
.staff .grid-scroll thead { position: sticky; top: 0; z-index: 3; }
.staff .grid-scroll tfoot td { position: sticky; bottom: 0; z-index: 2; }
/* the gradient runs across the whole header row (not repeated per cell) */
.staff table.crud-table thead { background: var(--brand-600); background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-500) 100%); }
.staff table.crud-table th {
  background: transparent; color: #fff; font-family: var(--font); font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; padding: 11px 14px; border-bottom: 0; white-space: nowrap;
}
.staff table.crud-table td { font-size: 12.5px; padding: 9px 14px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.staff table.crud-table tbody tr:nth-child(even) > td { background: color-mix(in srgb, var(--surface-2) 40%, var(--surface)); }
.staff table.crud-table tbody tr:hover > td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.staff table.crud-table tbody tr.row-selected > td { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
.staff .grid-table.grid-table tbody tr[data-i] { cursor: default; }
.staff table.crud-table th.grid-check-col, .staff table.crud-table td.grid-check-col { width: 38px; text-align: center; padding-left: 12px; padding-right: 6px; }
.staff .grid-check, .staff .grid-check-all, .staff .grid-pop input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
.staff .empty-state { padding: 34px 14px; }
.staff table.crud-table td.nowrap { white-space: nowrap; }
.staff table.crud-table tbody td:not(.nowrap):not(.num):not(.grid-check-col):not(.empty-state) { min-width: 120px; }

/* sortable headers: both arrows show, the active one lights up */
.staff .grid-sort { display: inline-flex; align-items: center; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; }
.staff .grid-sort:hover { color: #fff; }
.staff .grid-arrows { display: inline-flex; flex-direction: column; gap: 2px; margin-left: 7px; }
.staff .grid-arrows i { width: 0; height: 0; border: 4px solid transparent; opacity: .4; }
.staff .grid-arrows .up { border-top-width: 0; border-bottom-color: #fff; }
.staff .grid-arrows .down { border-bottom-width: 0; border-top-color: #fff; }
.staff th.sorted-asc .grid-arrows .up, .staff th.sorted-desc .grid-arrows .down { opacity: 1; }
.staff .grid-filter-btn { color: rgba(255,255,255,.85); opacity: .85; }
.staff .grid-filter-btn:hover { color: #fff; background: rgba(255,255,255,.18); opacity: 1; }
.staff .grid-filter-btn.on { color: #d32f2f; background: rgba(255,255,255,.95); opacity: 1; }
.staff tfoot td { background: var(--surface-2); }
.staff button.badge.grid-toggle { cursor: pointer; }

/* footer: "Showing…" left, "Show N entries" centre, numbered pages right */
.staff .grid-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 16px 14px; margin: 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.staff .grid-size-box { display: inline-flex; align-items: center; gap: 8px; justify-self: center; color: var(--text-muted); }
.staff .grid-size-box select { padding: 4px 8px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font-family: var(--font); font-size: 13px; }
.staff .grid-pager { display: inline-flex; align-items: center; gap: 4px; justify-self: end; flex-wrap: wrap; }
.staff .grid-pg {
  min-width: 32px; height: 30px; padding: 0 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 6px; font: 500 12px var(--font); cursor: pointer; transition: all .15s ease; display: inline-flex; align-items: center; justify-content: center;
}
.staff .grid-pg:hover:not(:disabled):not(.on):not(.gap) { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-color: var(--accent); color: var(--accent-strong); }
.staff .grid-pg.on { background: var(--brand-600); background: linear-gradient(135deg, var(--brand-700), var(--brand-500)); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.staff .grid-pg.edge { border-radius: 20px; padding: 0 14px; font-size: 15px; font-weight: 700; }
.staff .grid-pg:disabled { color: var(--text-muted); background: var(--surface-2); cursor: not-allowed; opacity: .7; }
.staff .grid-pg.gap { border: 0; background: none; cursor: default; min-width: 18px; padding: 0 2px; }

/* column-filter popover */
.staff .grid-pop { z-index: 1200; width: 260px; border-radius: 10px; padding: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.staff .grid-pop-title { font-family: var(--font); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.staff .grid-pop-search { width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); margin-bottom: 8px; font-size: 13px; }
.staff .grid-pop-all { font-weight: 600; padding: 6px 2px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.staff .grid-pop-list { max-height: 220px; border-top: 0; margin-top: 0; padding-top: 0; }
.staff .grid-pop-item { padding: 5px 2px; font-size: 13px; }
.staff .grid-pop-actions { margin-top: 12px; }
.staff .grid-pop-actions .btn { flex: 1; justify-content: center; }
.staff .btn-apply { background: var(--ok); border-color: var(--ok); color: #fff; }
.staff .btn-apply:hover { background: color-mix(in srgb, var(--ok) 85%, black); border-color: color-mix(in srgb, var(--ok) 85%, black); }
.staff .btn-clear { background: transparent; border-color: var(--danger); color: var(--danger); }
.staff .btn-clear:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: var(--danger); }

/* Every dialog, like the school's: above the sidebar and topbar, anchored to the TOP of the screen at the same
   offset (never vertically centred, so it can't jump as its content changes), square, sliding down into place. */
.staff .modal-backdrop { z-index: 1100; align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto; }
.staff .modal { border-radius: 0; margin: 0 auto; max-height: calc(100vh - 4rem); box-shadow: 0 24px 64px rgba(0,0,0,.22); transform: translateY(-28px); }
.staff .modal-backdrop.open .modal { transform: translateY(0); }
.staff .grid-modal { max-width: 760px; width: 100%; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.staff .gm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 28px 12px; border-bottom: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); flex-shrink: 0; }
.staff .gm-head h3 {
  display: inline-flex; align-items: center; margin: 0; padding: 7px 22px; border-radius: 50rem; background: var(--brand-700); color: #fff;
  border-left: 4px solid #f2a900; font-size: 1.02rem; font-weight: 700; letter-spacing: .3px; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 25%, transparent);
}
.staff .gm-close { border: 0; background: none; color: var(--text-muted); width: 36px; height: 36px; border-radius: 8px; font-size: 16px; cursor: pointer; }
.staff .gm-close:hover { background: var(--surface-2); color: var(--text); }
.staff .gm-body { padding: 22px 28px 4px; overflow-y: auto; }
.staff .gm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.staff .gm-grid .field { min-width: 0; }
.staff .gm-grid .field.wide { grid-column: 1 / -1; }
.staff .field .req { color: var(--danger); }
.staff .field .hint { font-size: 12px; color: var(--text-muted); }
.staff .gm-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 28px 20px; border-top: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); flex-shrink: 0; }
.staff .gm-confirm { max-width: 400px; padding: 28px 26px 22px; text-align: center; }
.staff .gm-confirm h3 { margin: 12px 0 6px; }
.staff .gm-confirm p { margin: 0 0 4px; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.staff .gm-confirm-icon { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 26px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-strong); }
.staff .gm-confirm-icon.danger { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }
.staff .gm-confirm-actions { justify-content: center; }

/* corner messages */
.grid-toasts { position: fixed; bottom: 24px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.grid-toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 9px; font-size: 13.5px; border-left: 4px solid var(--accent); box-shadow: 0 8px 24px rgba(0,0,0,.28); transition: opacity .3s, transform .3s; }
.grid-toast.ok { border-left-color: var(--ok); }
.grid-toast.warn { border-left-color: var(--warn); }
.grid-toast.err { border-left-color: var(--danger); }
.grid-toast.out { opacity: 0; transform: translateX(12px); }

@media (max-width: 768px) {
  .staff .grid-toolbar { padding: 12px; }
  .staff .grid-search-box { width: 100%; margin-left: 0; }
  .staff .grid-toolbar .grid-search { flex: 1; min-width: 0; }
  .staff .grid-foot { grid-template-columns: 1fr; justify-items: center; }
  .staff .grid-pager { justify-self: center; }
  .staff .gm-grid { grid-template-columns: 1fr; }
  .staff .gm-body { padding: 18px 18px 4px; }
  .staff .gm-head, .staff .gm-foot { padding-left: 18px; padding-right: 18px; }
}

/* ── Kitchen / Porter tickets ────────────────────────────────────── */
.staff .board { padding: 4px 0 20px; }
.staff .ticket { border: 1px solid var(--border); border-top: 4px solid var(--warn); border-radius: 14px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.staff .ticket:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.staff .ticket.ready { border-top-color: var(--ok); }
.staff .ticket .code { font-weight: 800; font-size: 1.02rem; }
.staff .ticket .type { font-weight: 600; }

/* ── Dashboard ───────────────────────────────────────────────────── */
.dash-banner {
  position: relative; overflow: hidden; border-radius: 14px; padding: 22px 26px; margin-bottom: 20px; color: var(--on-accent);
  background: var(--accent-strong); background: linear-gradient(135deg, var(--brand-700), var(--brand-600) 55%, var(--brand-500));
  box-shadow: var(--shadow-md);
}
.dash-banner::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(circle at 1px 1px, rgba(255,255,255,.22) 1px, transparent 1.4px) 0 0 / 16px 16px;
}
.dash-banner > * { position: relative; }
.dash-banner h2 { color: #fff; font-size: 1.35rem; margin: 0 0 4px; }
.dash-banner p { margin: 0; opacity: .9; font-size: .9rem; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  display: grid; grid-template-columns: 42px 1fr; grid-template-areas: "icon value" "icon label"; column-gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 18px 20px;
  color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon { grid-area: icon; width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.kpi-icon.primary { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-strong); }
.kpi-icon.green   { background: #d1fae5; color: #059669; }
.kpi-icon.amber   { background: #fef9c3; color: #d97706; }
.kpi-icon.red     { background: #fee2e2; color: #dc2626; }
.kpi-icon.indigo  { background: #e0e7ff; color: #4338ca; }
.kpi-icon.teal    { background: #ccfbf1; color: #0d9488; }
.kpi-value { grid-area: value; font-size: 19px; font-weight: 800; line-height: 1.15; word-break: break-word; }
.kpi-label { grid-area: label; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 4px; }
.section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); margin: 0 0 12px; display: flex; align-items: center; gap: 12px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.qa {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; font-weight: 600; font-size: 13.5px; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.staff a.qa { color: var(--text); }
.qa:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.qa .kpi-icon { width: 38px; height: 38px; font-size: 1rem; flex-shrink: 0; }
.qa small { display: block; font-weight: 400; color: var(--text-muted); font-size: 11.5px; margin-top: 1px; }

/* ── Stat tiles used on the platform dashboard ───────────────────── */
.staff .stat-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.staff .stat-tile { border-left: 4px solid var(--accent); }
.staff .stat-tile .num { font-size: 1.6rem; font-weight: 800; }
.staff .stat-tile .label { font-weight: 600; letter-spacing: .06em; }
.staff a.stat-link, .staff a.kpi-card { color: var(--text); text-decoration: none; }
.staff a.stat-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ── Settings: sticky category nav + section dividers ────────────── */
.staff .settings-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 26px; }
.staff .settings-nav { top: calc(var(--header-h) + var(--imp-h) + 16px); gap: 0; }
.staff .settings-nav .nav-group-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); padding: 12px 14px 4px; }
.staff .settings-nav .nav-group-label:first-child { padding-top: 0; }
.staff .settings-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; margin-bottom: 2px; border: 0; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted); transition: background .15s, color .15s;
}
.staff .settings-nav a:hover:not(.active) { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--accent-strong); }
.staff .settings-nav a.active {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500)); color: var(--on-accent); font-weight: 700;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}
.staff .settings-nav a i { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.staff .settings-body { gap: 0; }
.staff .settings-section { scroll-margin-top: calc(var(--header-h) + var(--imp-h) + 16px); background: none; border: 0; box-shadow: none; padding: 0; margin-bottom: 8px; }
.section-divider { display: flex; align-items: center; gap: 10px; margin: 28px 0 16px; }
.settings-section:first-child .section-divider { margin-top: 0; }
.section-divider i { color: var(--text-muted); font-size: 13px; }
.section-divider h6 { margin: 0; font: 800 11px var(--font); text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); white-space: nowrap; }
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.staff .settings-section h4 { font-size: .95rem; margin: 22px 0 10px; }
.staff .swatch { border-radius: 12px; }
.staff .swatch-label { font-weight: 600; }
.staff .sub-summary { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.staff .sub-summary .label { font-weight: 700; letter-spacing: .06em; }
.staff .drive-box { border-radius: 12px; }
.staff .discount-note { border-radius: 10px; }
@media (max-width: 820px) {
  .staff .settings-layout { grid-template-columns: 1fr; gap: 10px; }
  .staff .settings-nav {
    top: calc(var(--header-h) + var(--imp-h)); z-index: 15; flex-direction: row; overflow-x: auto; background: var(--paper);
    padding: 8px 14px; margin: -14px -14px 0; -ms-overflow-style: none; scrollbar-width: none; border-bottom: 1px solid var(--border);
  }
  .staff .settings-nav::-webkit-scrollbar { display: none; }
  .staff .settings-nav .nav-group-label { display: none; }
  .staff .settings-nav a { white-space: nowrap; margin: 0 4px 0 0; padding: 7px 12px; }
  .staff .settings-section { scroll-margin-top: calc(var(--header-h) + var(--imp-h) + 56px); }
}

/* ── Platform-only bits ──────────────────────────────────────────── */
.platform-tag { font: 700 9px var(--font); letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.14); color: #fff; }
.staff .detail-grid { margin-top: 18px; }
.staff .danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.staff .secret-card { border-left: 4px solid var(--warn); }

/* ── Standalone pages: login book, billing, lapsed / suspended / 404… ── */
body.staff.auth-page {
  background: var(--accent-strong);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-strong) 62%, var(--ink)) 0%, var(--accent-strong) 50%, color-mix(in srgb, var(--accent-strong) 62%, var(--ink)) 100%);
}
.staff.auth-page .auth-card { border: 0; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 30px 28px; }
.staff.auth-page .auth-card::before { display: none; }
.staff.auth-page .auth-card h2 { font-size: 1.35rem; }
.staff.auth-page .back-link { font-weight: 500; }

/* ── Menu item editor (views/admin/menu-item-edit.php) ───────────────────────────────────────── */
.staff .editor { display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.staff .editor-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr); gap: 16px; align-items: start; }
.staff .editor .card h3 { display: flex; align-items: center; gap: 8px; font-size: 1rem; margin: 0 0 12px; }
.staff .editor .card h3 i { color: var(--accent-strong); }
.staff .ed-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.staff .ed-fields .field.wide { grid-column: 1 / -1; }
.staff .ed-input {
  font-family: var(--font); font-size: 14px; padding: 9px 12px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); width: 100%; min-width: 0; transition: border-color .2s, box-shadow .2s;
}
.staff .ed-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.staff .ed-input:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
.staff .field small.hint { margin-top: 2px; }
.staff .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.staff .section-head h3 { margin-bottom: 4px; }
.staff .section-head p { margin: 0; font-size: 13px; max-width: 70ch; }

.staff .photo-preview {
  aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px dashed var(--border-strong);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.staff .photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.staff .photo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.staff .photo-empty i { font-size: 2rem; opacity: .6; }
.staff .photo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.staff .photo-actions .btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.staff .row-line { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.staff .money-in { display: flex; align-items: center; gap: 8px; }
.staff .money-in span { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.staff .icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.staff .icon-btn:hover { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.staff .empty-hint { color: var(--text-muted); font-size: 13px; margin: 4px 0; }
.staff .addon-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.staff .addon-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; }
.staff .addon-head .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.staff .addon-head .g-max { width: 64px; padding: 6px 8px; }
.staff .g-hint { font-size: 12.5px; margin: 8px 0 10px; }
.staff .addon-card .btn-sm { margin-top: 2px; }
.staff .editor-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(to top, var(--paper) 70%, transparent); z-index: 5; }
.staff .editor-actions .form-error { margin: 0 auto 0 0; }
.staff .editor-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.staff .grid-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); }
.staff .grid-thumb-empty { width: 44px; height: 44px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
@media (max-width: 860px) {
  .staff .editor-grid { grid-template-columns: 1fr; }
  .staff .ed-fields { grid-template-columns: 1fr; }
  .staff .row-line { grid-template-columns: minmax(0, 1fr) auto; }
  .staff .row-line .money-in { grid-column: 1 / 2; }
  .staff .addon-head { grid-template-columns: 1fr auto; }
  .staff .addon-head .g-name { grid-column: 1 / -1; }
  .staff .section-head { flex-direction: column; }
}

.staff .grid-modal.gm-small { max-width: 460px; }
.staff .gm-small .gm-body { padding-bottom: 8px; }
