/* ====================================================================
   Application shell: sidebar + top bar.
   Look: the Union Group design system (docs/04-design-brief.md): PLU Management System benchmark,
   cream / brown / gold, Montserrat headings + Inter body. ONE light design: there is no dark mode
   and no theme switch. The sidebar is a fixed dark surface, as in the PLU portal.

   Loaded LAST, after admin.css, dashboard.css and tokens.css: it re-themes every existing component
   by redefining the colour variables they already use, mapped onto the design tokens, so all pages
   change together. No inline styles are needed by any page (root Content-Security-Policy).
   ==================================================================== */

:root {
  color-scheme: light;

  /* legacy variable names used by admin.css / dashboard.css  ->  design tokens (tokens.css) */
  --bg-canvas: var(--bg-cream);
  --bg-header: rgba(250, 247, 242, 0.9);
  --bg-surface: var(--bg-card);
  --bg-surface-hover: #FFFFFF;
  --bg-surface-active: var(--bg-row-alt);
  --bg-surface-solid: var(--bg-card);
  --bg-input: var(--bg-card);
  --bg-pill: rgba(26, 16, 8, 0.04);

  --border-subtle: var(--border);
  --border-hover: var(--input-border);
  --border-active: var(--accent-gold);
  --border-focus: var(--accent-gold-ring);

  --text-muted: #7A6652;               /* 5:1 on --bg-cream; --text-secondary is #6B5744 */
  --text-accent: var(--status-pending-text);

  --accent-primary: var(--accent-gold);
  --accent-hover: var(--accent-gold-deep);
  --accent-gradient: linear-gradient(135deg, var(--accent-gold-light), var(--accent-gold) 55%, var(--accent-gold-deep));
  --accent-glow: rgba(201, 168, 76, 0.45);
  --accent-tint: rgba(201, 168, 76, 0.14);
  --accent-text: var(--status-pending-text);   /* gold as TEXT on light surfaces must be the darker shade */

  --success-primary: #3D5A3E;
  --danger-primary: var(--danger);      /* --danger-hover comes straight from tokens.css */
  --warning-primary: #8B6914;

  --card-radius: 8px;
  --font-stack: var(--font-body);
  --font-mono: var(--font-body);       /* no third family: figures use Inter's tabular numerals */

  /* status dots on the dark sidebar need a lighter green/red than the pills on cream */
  --dot-up: #6FB07A;
  --dot-down: #E0836B;
  --dot-unknown: #8A7B6B;
}

[hidden] { display: none !important; }

body { background-color: var(--bg-canvas); font-family: var(--font-body); color: var(--text-primary); position: relative; overflow-x: hidden; }
h1, h2, h3, h4, .page-title, .metric-value, .panel-head h2, .sb-brand-text b { font-family: var(--font-display); }
.clock, .table-info, .sb-count, .panel-head small, .svc-num, .signin-row time, kbd { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: flex; flex: 1; width: 100%; min-height: 100vh; }
.shell-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-container { max-width: 1320px; padding: 28px 32px 56px; }
.only-mobile { display: none; }

/* ---------- sidebar (a fixed dark surface, exactly like the PLU portal; not a theme) ---------- */
.sidebar {
  position: sticky; top: 0; z-index: 60;
  flex: 0 0 240px; width: 240px; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-dark);
  color: rgba(255, 255, 255, 0.5);
}
.sb-brand { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 22px 16px 16px; text-align: center; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.sb-logo { display: block; width: 112px; height: auto; }
.sb-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sb-brand-text b { font-size: 12.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-gold); line-height: 1.35; }

.sb-nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.sb-label { display: flex; justify-content: space-between; padding: 16px 10px 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.3); }
.sb-count { letter-spacing: 0; color: rgba(255, 255, 255, 0.4); }
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border: 1px solid transparent; border-radius: 5px;
  font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.5); text-decoration: none;
  transition: background 150ms, color 150ms;
}
.sb-link:hover { background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.85); }
.sb-link.active { color: var(--accent-gold); background: rgba(201, 168, 76, 0.12); }
.sb-link.active .ico { color: var(--accent-gold); }
.sb-app { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 5px; font-size: 12.5px; color: rgba(255, 255, 255, 0.5); text-decoration: none; }
.sb-app:hover { background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.85); }
.sb-app .ico { margin-left: auto; opacity: 0; transition: opacity 150ms; }
.sb-app:hover .ico { opacity: 0.7; }
.sb-app-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--dot-unknown); }
.sb-dot[data-state="up"] { background: var(--dot-up); box-shadow: 0 0 0 3px rgba(111, 176, 122, 0.2); }
.sb-dot[data-state="down"] { background: var(--dot-down); box-shadow: 0 0 0 3px rgba(224, 131, 107, 0.2); }

.sb-foot { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.sb-user { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sb-user b { font-size: 12.5px; color: rgba(255, 255, 255, 0.9); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user small { font-size: 11px; color: rgba(255, 255, 255, 0.45); }
.sb-signout { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: rgba(255, 255, 255, 0.5); }
.sb-signout:hover { background: rgba(224, 131, 107, 0.16); color: var(--dot-down); }
.sb-backdrop { display: none; }

.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-gradient); color: var(--text-primary); font-size: 13px; font-weight: 700; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 28px;
  background: var(--bg-header);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
.crumbs { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.crumbs b { color: var(--text-primary); font-weight: 600; }
.crumb-sep { margin: 0 8px; opacity: 0.5; }
.quick-btn {
  display: flex; align-items: center; gap: 10px; min-width: 280px; margin-left: 16px;
  padding: 7px 12px; border-radius: 4px;
  border: 1px solid var(--border-subtle); background: var(--bg-input);
  font: inherit; font-size: 12.5px; color: var(--text-muted); cursor: pointer;
  transition: border-color 150ms;
}
.quick-btn:hover { border-color: var(--border-hover); }
kbd { font-family: var(--font-body); font-size: 10.5px; padding: 1px 6px; border: 1px solid var(--border-subtle); border-radius: 4px; background: var(--bg-pill); color: var(--text-muted); }
.quick-btn kbd { margin-left: auto; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.sys-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); background: var(--bg-pill); border: 1px solid var(--border-subtle); white-space: nowrap; }
.sys-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.sys-chip[data-state="up"] { color: var(--status-done-text); border-color: var(--status-done-border); background: var(--status-done-bg); }
.sys-chip[data-state="up"] .sys-dot { background: var(--success-primary); box-shadow: 0 0 0 3px rgba(61, 90, 62, 0.18); }
.sys-chip[data-state="down"] { color: var(--status-down-text); border-color: var(--status-down-border); background: var(--status-down-bg); }
.sys-chip[data-state="down"] .sys-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(122, 46, 31, 0.18); }

.clock { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.clock .ico { color: var(--text-muted); }
.clock small { font-size: 11.5px; color: var(--text-muted); font-weight: 400; }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 4px; border: 1px solid var(--border-subtle); background: var(--bg-pill); color: var(--text-secondary); cursor: pointer; }
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }
.icon-btn.only-mobile { display: none; }

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--border-subtle); background: var(--bg-pill); color: var(--text-primary); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.user-btn:hover { border-color: var(--border-hover); }
.user-btn .avatar { width: 28px; height: 28px; font-size: 12px; }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; min-width: 240px; padding: 6px; background: var(--bg-surface-solid); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); box-shadow: var(--shadow-card-md); }
.user-pop-head { display: flex; flex-direction: column; padding: 10px 10px 8px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 6px; }
.user-pop-head b { font-size: 13px; }
.user-pop-head small { font-size: 11.5px; color: var(--text-muted); }
.user-pop a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.user-pop a:hover { background: var(--bg-pill); color: var(--text-primary); }
.user-pop a.danger:hover { color: var(--danger); background: var(--status-down-bg); }

/* ---------- quick launch ---------- */
.ql { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; background: rgba(26, 16, 8, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ql-box { width: min(560px, 100%); background: var(--bg-surface-solid); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); box-shadow: 0 30px 80px -10px rgba(26, 16, 8, 0.45); overflow: hidden; }
.ql-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); }
.ql-input input { flex: 1; padding: 15px 0; background: transparent; border: 0; outline: 0; color: var(--text-primary); font: inherit; font-size: 15px; }
.ql-list { list-style: none; max-height: 50vh; overflow-y: auto; padding: 6px; }
.ql-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; cursor: pointer; }
.ql-item small { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ql-item.active { background: var(--accent-tint); color: var(--accent-text); }
.ql-none { padding: 18px; text-align: center; font-size: 13px; color: var(--text-muted); }
.ql-hint { display: flex; gap: 8px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--border-subtle); font-size: 11px; color: var(--text-muted); }

/* ---------- re-themed components ---------- */
.page-title { font-size: 1.65rem; font-weight: 600; letter-spacing: -0.005em; line-height: 1.2; }
.page-subtitle { font-size: 13px; }

.btn { border-radius: var(--radius-control); font-weight: 600; letter-spacing: 0.03em; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-gold-ring); }
.btn-primary { background: var(--accent-gradient); color: var(--text-primary); box-shadow: var(--shadow-gold); }
.btn-primary:hover { background: var(--accent-gradient); color: var(--text-primary); filter: brightness(1.05); transform: translateY(-1px); }
.btn-secondary { background: transparent; }

.form-card, .table-card, .metric-card, .app-card, .panel, .empty-state, .filter-bar {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-card);
}
.form-control, .admin-search-input, .admin-select { background: var(--bg-input); border-color: var(--border-subtle); color: var(--text-primary); border-radius: var(--radius-control); }
.form-control:focus, .admin-search-input:focus, .admin-select:focus { border-color: var(--border-active); box-shadow: 0 0 0 3px var(--border-focus); outline: 0; }
.admin-table th { color: var(--text-muted); }
.admin-table tbody tr:hover { background: var(--bg-pill); }

.metric-card { position: relative; overflow: hidden; transition: transform 180ms, border-color 180ms; }
.metric-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent-gradient); opacity: 0.7; }
.metric-card:hover { transform: translateY(-2px); border-color: var(--border-hover); }
.metric-value { letter-spacing: -0.02em; }

.app-card { position: relative; transition: transform 180ms, border-color 180ms, box-shadow 180ms; }
.app-card:hover { transform: translateY(-3px); border-color: var(--border-active); box-shadow: var(--shadow-card-hover), 0 0 0 1px var(--accent-tint); background: var(--bg-surface-hover); }
.app-card-icon { background: var(--accent-tint); border-color: var(--border-subtle); }
.dash-section-title { color: var(--text-muted); }
.health-chip { background: var(--bg-pill); }
.health-chip[data-state="up"] { color: var(--status-done-text); }
.health-chip[data-state="down"] { color: var(--status-down-text); }

/* ---------- dashboard panels ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; margin-bottom: 8px; }
.panel { border: 1px solid var(--border-subtle); border-radius: var(--card-radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.panel-head h2 { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.panel-head small { font-size: 11.5px; color: var(--text-muted); }
.panel-link { font-size: 12px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.panel-scroll { max-height: 380px; overflow-y: auto; }

/* ---------- data tables: scrollable body, sticky header, sortable columns, pager ---------- */
.table-card { display: flex; flex-direction: column; }
.table-scroll { overflow: auto; max-height: min(64vh, 620px); -webkit-overflow-scrolling: touch; }
.table-scroll .admin-table { min-width: 720px; }
.admin-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-surface-solid); white-space: nowrap; }
.admin-table th[data-sort] { cursor: pointer; user-select: none; }
.admin-table th[data-sort]:hover { color: var(--text-primary); }
.admin-table th[data-sort]::after { content: "\2195"; margin-left: 6px; opacity: 0.35; font-size: 10px; }
.admin-table th[aria-sort="ascending"]::after { content: "\2191"; opacity: 1; color: var(--accent-text); }
.admin-table th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; color: var(--accent-text); }
.table-empty td { padding: 40px 16px; text-align: center; color: var(--text-muted); }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 12px 16px; border-top: 1px solid var(--border-subtle); font-size: 12.5px; color: var(--text-secondary); }
.table-info { font-size: 12px; color: var(--text-muted); }
.table-size { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.table-size .admin-select { height: 30px; padding: 0 8px; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--border-subtle); background: var(--bg-pill); color: var(--text-secondary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pager button:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-hover); }
.pager button.is-current { background: var(--accent-gradient); border-color: transparent; color: var(--text-primary); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-gap { padding: 0 4px; color: var(--text-muted); }
.filter-left { flex-wrap: wrap; }

/* ---------- keyboard + motion details ---------- */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 200; padding: 8px 14px; border-radius: 4px; background: var(--bg-dark); color: var(--accent-gold); font-size: 13px; font-weight: 600; text-decoration: none; transition: top 150ms; }
.skip-link:focus { top: 10px; }
:focus-visible { outline: 2px solid var(--border-active); outline-offset: 2px; }
.sb-link:focus-visible, .sb-app:focus-visible, .sb-signout:focus-visible { outline-color: var(--accent-gold); }
.inline-form { display: contents; }
.sb-signout { border: 0; background: none; cursor: pointer; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 13px; color: var(--text-secondary); text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--bg-pill); color: var(--text-primary); }
.menu-item.danger:hover { color: var(--danger); background: var(--status-down-bg); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.svc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px 78px; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.svc-row:last-child, .signin-row:last-child { border-bottom: 0; }
.svc-name { display: flex; flex-direction: column; min-width: 0; }
.svc-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-name small { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-num { font-size: 12px; color: var(--text-secondary); text-align: right; }
.signin-row { display: flex; align-items: center; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.signin-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.signin-row .who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signin-row .who small { font-size: 11.5px; color: var(--text-muted); }
.signin-row time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.panel-empty { padding: 28px 18px; text-align: center; font-size: 13px; color: var(--text-muted); }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.section-title { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

/* ---------- colours that admin.css hard-codes for its old dark look ---------- */
.flash-alert.success { color: var(--status-done-text); background: var(--status-done-bg); border-color: var(--status-done-border); }
.flash-alert.error { color: var(--status-down-text); background: var(--status-down-bg); border-color: var(--status-down-border); }
.btn-danger { color: var(--danger); background: var(--status-down-bg); border-color: var(--status-down-border); }
.btn-danger:hover { color: var(--bg-card); background: var(--danger); }
.badge-status.active { color: var(--status-done-text); background: var(--status-done-bg); border-color: var(--status-done-border); }
.badge-status.draft { color: var(--text-secondary); background: var(--bg-pill); border-color: var(--border-subtle); }
.status-slider { background-color: rgba(26, 16, 8, 0.16); }
.preset-icon-btn.selected { background: var(--accent-tint); }
.modal-overlay { background: rgba(26, 16, 8, 0.55); }
.admin-table th { background: var(--bg-surface-solid); }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .quick-btn { min-width: 0; }
  .quick-btn span, .quick-btn kbd { display: none; }
  .clock small { display: none; }
}
@media (max-width: 960px) {
  .icon-btn.only-mobile { display: inline-grid; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 0 60px rgba(26, 16, 8, 0.5); }
  .sidebar.open { transform: none; }
  .sb-backdrop.show { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(26, 16, 8, 0.55); }
  .topbar { padding: 0 10px; gap: 8px; }
  .top-right { gap: 8px; }
  .crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .crumb-root, .crumb-sep, .user-name, .clock { display: none; }
  .admin-container { padding: 20px 16px 48px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .two-col { grid-template-columns: 1fr; }
  .page-header { flex-wrap: wrap; gap: 12px; }
  .svc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .svc-row .svc-num { display: none; }
}

/* ---------- application card preview (admin/app-edit) ---------- */
.app-card-preview { pointer-events: none; margin: 0; }
.cat-pill { display: inline-flex; max-width: 60%; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--accent-text); background: var(--accent-tint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-target-host { font-size: 11.5px; color: var(--text-muted); }

/* ---------- table cells that must stay on one line, and the collapsible "add" form ---------- */
.admin-table .badge-status, .admin-table .btn { white-space: nowrap; }
.add-person > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; margin: 0; }
.add-person > summary::-webkit-details-marker { display: none; }
.add-person > summary::after { content: "+ Add"; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.add-person[open] > summary::after { content: "Close"; }
.add-person[open] > summary { margin-bottom: 14px; }

/* ---------- page-level helpers (these replace the inline style="" attributes the admin pages used to carry,
   so that the Content-Security-Policy can forbid inline styles everywhere) ---------- */
.ta-center { text-align: center; }
.ta-right { text-align: right; }
.col-id { width: 50px; }
.col-icon { width: 45px; }
.col-order, .col-count { text-align: center; }
.col-order { width: 80px; }
.col-count { width: 110px; }
.col-opens { width: 100px; text-align: center; }
.col-status { width: 120px; text-align: center; }
.col-actions { width: 120px; text-align: right; }
.cell-empty { text-align: center; padding: 44px 16px; color: var(--text-muted); }
.cell-muted { color: var(--text-muted); }
.cell-order { text-align: center; color: var(--text-muted); }
.strong-ink { color: var(--text-primary); }
.text-muted-sm { color: var(--text-muted); font-size: 11px; }
.metric-value.is-ok { color: var(--success-primary); }
.metric-value.is-muted { color: var(--text-muted); }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 10px; color: var(--text-muted); pointer-events: none; }

.badge-neutral { background: var(--bg-pill); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.badge-small { font-size: 10.5px; }
.draft-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.status-cell { display: flex; align-items: center; justify-content: center; gap: 8px; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; }
.link-target { color: var(--text-accent); text-decoration: none; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.link-target-text { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid-1-2, .grid-1-1 { display: grid; gap: 24px; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.grid-1-1 { grid-template-columns: 1fr 1fr; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.card-heading { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.card-heading-tight { margin-bottom: 6px; }
.card-gap { margin-bottom: 20px; }
.help-line { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.help-line-gap { margin: 16px 0 8px; }
.help-line-block { margin-bottom: 16px; }
.help-line-lg { font-size: 12.5px; margin-bottom: 20px; }
.preview-note { margin-top: 16px; font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.error-list { margin: 6px 0 0 18px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 10px 24px; }
.form-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.form-group-last { margin-bottom: 24px; }
.form-group-first { margin-top: 16px; }
.form-group-modal-last { margin-bottom: 20px; }
.check-box-list { background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); padding: 14px 16px; margin-bottom: 24px; display: flex; flex-direction: column; gap: 12px; }
.check-line { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }

.kv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv-table tr { border-bottom: 1px solid var(--border-subtle); }
.kv-table tr:last-child { border-bottom: 0; }
.kv-key, .kv-val { padding: 8px 0; }
.kv-key { color: var(--text-muted); }
.kv-key-wide { width: 140px; }
.kv-strong { font-weight: 600; color: var(--text-primary); }
.kv-soft { color: var(--text-secondary); }
.kv-note { font-size: 11.5px; color: var(--text-secondary); margin-left: 6px; }

@media (max-width: 960px) {
  .grid-1-2, .grid-1-1, .grid-2-1 { grid-template-columns: 1fr; }
}
.nowrap { white-space: nowrap; }
.audit-detail { max-width: 460px; overflow-wrap: anywhere; color: var(--text-secondary); }

/* A grid track defaults to minmax(auto, 1fr): a wide child (the file input) then pushes the whole page sideways on a phone. */
.form-grid-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .form-grid-layout { grid-template-columns: minmax(0, 1fr); } }
.form-card, .preview-container { min-width: 0; }
input[type="file"].form-control { max-width: 100%; }

/* A long category name makes a <select> as wide as its longest option; on a phone that pushed the whole page sideways. */
.filter-left { max-width: 100%; }
.filter-left > * { min-width: 0; max-width: 100%; }
.admin-select { max-width: 100%; text-overflow: ellipsis; }

/* No breadcrumb trail: the top bar just names the page, large and plain. */
.crumb-root, .crumb-sep { display: none; }
.crumbs b { font-family: var(--font-display); font-size: 18px; font-weight: 700; }

/* ==========================================================================
   PLU layer: the same look as the PLU Management System and the IT Ticketing app.
   Last in the file on purpose: it refines the rules above. No colour or font is hard-coded except the toast's neutral greys.
   ========================================================================== */

/* Sidebar menu: still scrolls (wheel, touch, keyboard), but no scrollbar is drawn. */
.sb-nav { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
.sb-nav::-webkit-scrollbar { display: none; }

/* Search boxes: the icon is part of the field, so a box never has an empty gap on its left. */
.admin-search-input:not(.is-search) {
  padding-left: 36px; height: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B5744' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px 50%; background-size: 16px;
}
.search-wrap .admin-search-input:not(.is-search) { background-image: none; padding-left: 34px; }
.admin-search-input::placeholder { color: var(--text-secondary); opacity: 0.8; }

/* Selects and date fields: one height, a quiet chevron instead of the browser's own control. */
select.admin-select {
  -webkit-appearance: none; appearance: none; height: 40px; padding: 0 34px 0 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B5744' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
input[type="date"].admin-select { height: 40px; padding: 0 10px; }
.filter-left { flex-wrap: wrap; }
.filter-left select.admin-select { width: 240px; }
.filter-left .admin-search-input { width: 240px; }
.table-size select.admin-select { height: 30px; padding: 0 28px 0 10px; font-size: 12px; }

/* Filters are buttons (one pressed per group), as in PLU and the ticketing app. */
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.fgroup-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); min-width: 56px; }
.fbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.fbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--border); background: transparent; color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 150ms, border-color 150ms; }
.fbtn:hover { background: var(--border); border-color: var(--input-border); }
.fbtn.is-on, .fbtn[aria-pressed="true"] { background: var(--bg-dark); border-color: var(--bg-dark); color: var(--accent-gold); }
.fbtn:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 2px; }
.fbtn small { font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.filter-bar.is-stack { flex-direction: column; align-items: stretch; gap: 14px; }
.filter-bar .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
@media (max-width: 760px) {
  .fgroup { flex-wrap: nowrap; }
  .fgroup .fbtns { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .fgroup .fbtns::-webkit-scrollbar { display: none; }
  .fbtn { flex: none; min-height: 40px; }
  .admin-search-input:not(.is-search) { width: 100%; }
}

/* Tables: cream capital header, zebra rows, gold hover; cards are flat with a soft shadow. */
.table-card, .filter-bar, .panel, .metric-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.admin-table thead th { background: var(--bg-cream); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.admin-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.admin-table tbody tr:hover { background: rgba(201, 168, 76, 0.09); }
.admin-table td { font-variant-numeric: tabular-nums; }

/* Pager: the PLU pager (count left, numbered buttons right, gold current page). */
.table-foot { background: var(--bg-card); }
.pager button { height: 30px; min-width: 30px; border-radius: 6px; background: transparent; border-color: var(--border); color: var(--text-primary); }
.pager button:hover:not(:disabled) { background: rgba(201, 168, 76, 0.12); border-color: var(--accent-gold); color: var(--text-primary); }
.pager button.is-current { background: rgba(201, 168, 76, 0.18); border: 1px solid var(--accent-gold); color: var(--text-primary); font-weight: 700; }

/* Toasts: the PLU look (sonner). White card, top right, small icon, soft shadow; full width at the top on phones.
   Server messages (.flash-alert) are moved in here by shell.js; they stay in the page for assistive technology. */
.toast-stack { position: fixed; top: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; width: 356px; max-width: calc(100% - 32px); pointer-events: none; }
.toast-stack .flash-alert { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 16px; border-radius: 8px; background: #fff; color: #171717; border: 1px solid #ededed; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); font: 500 13px/1.4 var(--font-body); animation: toast-in 200ms ease both; }
.toast-stack .flash-alert.success, .toast-stack .flash-alert.error, .toast-stack .flash-alert.info { background: #fff; color: #171717; border-color: #ededed; }
.toast-stack .flash-alert > span:not(.toast-ico) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-ico { display: inline-flex; flex: none; margin-top: 1px; color: #171717; }
.toast-x { flex: none; border: 0; background: transparent; color: #737373; font: inherit; font-size: 16px; line-height: 1; padding: 0 2px; cursor: pointer; }
.toast-x:hover { color: #171717; }
.toast-stack .flash-alert.is-leaving { animation: toast-out 200ms ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(16px); } }
@media (max-width: 760px) { .toast-stack { top: 16px; right: 16px; left: 16px; width: auto; max-width: none; } }
@media (prefers-reduced-motion: reduce) { .toast-stack .flash-alert, .toast-stack .flash-alert.is-leaving { animation: none; } }
.sb-more { padding: 6px 10px; font-size: 11.5px; color: #8E7D6B; }
