/* ==========================================================================
   styles.css - look and feel for the "Frontier Flow" prototype (fictional brand).
   Colours live in variables at the top so they are easy to change.
   Text colours on tinted backgrounds are all dark-on-light for readable contrast.
   ========================================================================== */

:root {
  /* Soft ice-blue page, white cards, one royal blue (owner decision D9, refined). Dark values are in dark.css. */
  --bg: #eef3fb;
  --surface: #ffffff;
  --line: #e3eaf6;
  --text: #172033;
  --muted: #5b6b86;
  --brand: #2563eb;          /* royal blue */
  --brand-dark: #1e40af;
  --brand-tint: #e6eeff;
  --on-brand: #ffffff;       /* text on the brand colour: primary buttons, selected pills, current menu item */
  --panel: #f1f5fd;          /* inner panels inside a card */
  --head-bg: #f3f6fd;        /* table and grid header background */
  --section-bg: #f1f5fc;     /* section band in the roster grid */
  --ink: #172033;            /* counts and badges */
  --on-ink: #ffffff;
  --btn-line: #cdd8ee;       /* button border */
  --field-line: #6f7d97;     /* form field border */
  --fill: #2563eb;           /* hours bar fill and strong chart colour */
  --track: #e3eaf6;          /* hours bar track */
  --bar-off: #b9cffa;        /* soft chart fill beside the strong one */
  --focus: #b45309;

  /* Status colours (always paired with a text label / icon, never colour alone) */
  --ok: #17663a;     --ok-bg: #e0f3e8;
  --warn: #8a4b00;   --warn-bg: #fff0d1;
  --bad: #a31d1d;    --bad-bg: #fde4e4;
  --draft: #5b3d99;  --draft-bg: #ece5fa;

  /* Section colours: Kitchen / Floor / Bar (tint, border, text) */
  --kitchen-bg: #fdf0c4;  --kitchen-line: #d9a40f;  --kitchen-text: #5c4300;
  --floor-bg:   #dbeafe;  --floor-line:   #3b82d6;  --floor-text:   #0f3a6b;
  --bar-bg:     #dcefe6;  --bar-line:     #2f9e6e;  --bar-text:     #0d4a30;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(37, 99, 235, .06), 0 8px 24px rgba(37, 99, 235, .08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Visible keyboard focus everywhere */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--text); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip-link:focus { top: 8px; }

/* ---- Demo banner ------------------------------------------------------- */
.demo-banner {
  background: #0f172a; color: #fff; padding: 8px 16px; font-size: .875rem;
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
}
.demo-banner strong { background: #ffd666; color: #0f172a; padding: 1px 8px; border-radius: 99px; margin-right: 8px; }
.demo-banner button { background: transparent; border: 1px solid #fff; color: #fff; padding: 3px 10px; border-radius: 6px; cursor: pointer; }
.demo-banner button:hover { background: rgba(255,255,255,.15); }

/* ---- Layout: sidebar + main ------------------------------------------- */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 40px); }

.sidebar { background: var(--surface); color: var(--text); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; align-self: start; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
/* The Frontier Flow logo (prototype/brand/, the owner's artwork, unchanged). The mark (FF) sits in the menu; the full logo is used
   on the landing and account screens. Each comes in an ink version for light pages and a pale one for dark pages, and the theme
   switch (data-theme on <html>) shows only the right one, the same way the live program does. */
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; flex: none; }
.brand-mark img { width: 36px; height: 36px; }
.brand-logo img { height: 44px; width: auto; max-width: 100%; }
.ff-on-light, .ff-on-dark { display: block; max-width: 100%; height: auto; }
.ff-on-dark, :root[data-theme="dark"] .ff-on-light { display: none; }
:root[data-theme="dark"] .ff-on-dark { display: block; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-biz { font-size: .8rem; opacity: .85; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.nav a:hover { background: var(--brand-tint); }
.nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.nav .badge { margin-left: auto; background: var(--ink); color: var(--on-ink); border-radius: 99px; padding: 0 8px; font-size: .75rem; font-weight: 700; }

main { padding: 20px 24px 48px; min-width: 0; }
main:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: .9rem; }

/* ---- Buttons, chips, badges ------------------------------------------- */
.btn { border: 1px solid var(--btn-line); background: var(--surface); padding: 8px 16px; border-radius: 99px; cursor: pointer; font-weight: 600; min-height: 40px; }
.btn:hover:not(:disabled) { background: var(--brand-tint); border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { padding: 4px 10px; min-height: 32px; font-size: .875rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 10px; font-size: .8rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.draft { background: #fff3c9; color: #6b4b00; }
.chip.approved { background: var(--ok-bg); color: var(--ok); }
.chip.notbuilt { background: #e9ebef; color: #3b4454; }
.chip.neutral { background: #eceff3; color: #2f3846; }
.status-badge { font-size: .9rem; padding: 4px 12px; }

.sim-tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; background: #ffd666; color: #2b2140; border-radius: 4px; padding: 1px 6px; font-weight: 700; vertical-align: middle; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }

/* ---- Roster toolbar ---------------------------------------------------- */
.week-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.week-switch .label { font-weight: 700; font-size: 1.1rem; min-width: 190px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-weight: 600; min-height: 32px; }
.filters button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.banner.draft { background: #fff8de; color: #5c4300; border: 1px dashed #d9a40f; }
.banner.approved { background: var(--ok-bg); color: #0f4a28; border: 1px solid var(--ok); }
.banner.notbuilt { background: #e9ebef; color: #2f3846; border: 1px solid #b9bfca; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.5rem; font-weight: 800; }
.stat .l { font-size: .8rem; color: var(--muted); }
.stat.bad .n { color: var(--bad); } .stat.warn .n { color: var(--warn); } .stat.ok .n { color: var(--ok); }

/* ---- The weekly grid --------------------------------------------------- */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.roster { display: grid; grid-template-columns: 190px repeat(7, minmax(128px, 1fr)) 120px; min-width: 1150px; }
.roster .r { display: contents; }
.roster .r > div { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px; min-height: 48px; }
.roster .r > .hours { border-right: 0; }
.roster .head { position: sticky; top: 0; background: var(--head-bg); z-index: 3; font-weight: 700; text-align: center; padding: 8px 6px; }
.roster .head.today { background: #fff3c4; color: #3d2f00; }
.roster .head small { display: block; font-weight: 500; color: var(--muted); }
.roster .head .gapnote { display: block; margin-top: 2px; }
.roster .head.closed { color: var(--muted); }
.roster .name { position: sticky; left: 0; background: var(--surface); z-index: 2; display: flex; flex-direction: column; justify-content: center; }
.roster .name.head { z-index: 4; background: var(--head-bg); align-items: flex-start; }
.roster .name button { all: unset; cursor: pointer; font-weight: 700; color: var(--brand-dark); }
.roster .name button:hover { text-decoration: underline; }
.roster .name button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.roster .name small { color: var(--muted); }
.roster .section-row { grid-column: 1 / -1; background: var(--section-bg); font-weight: 800; letter-spacing: .02em; padding: 4px 10px; min-height: 0; display: flex; align-items: center; gap: 8px; }
.section-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cell { display: flex; flex-direction: column; gap: 4px; }
.hours { display: flex; flex-direction: column; gap: 3px; justify-content: center; font-size: .85rem; }
.hours .bar { height: 6px; border-radius: 3px; background: var(--track); position: relative; overflow: hidden; }
.hours .bar i { position: absolute; inset: 0 auto 0 0; background: var(--fill); border-radius: 3px; }
.hours.warn .bar i { background: #c27a00; } .hours.bad .bar i { background: var(--bad); }
.hours .num { font-weight: 700; }
.gap-row-label { background: var(--bad-bg) !important; color: var(--bad); font-weight: 700; }

/* Shift cards: tinted background + coloured left edge + section word (not colour alone) */
.shift {
  all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer;
  border-radius: 10px; padding: 4px 8px; border-left: 5px solid; font-size: .8rem; line-height: 1.3;
}
.shift:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.shift:hover { filter: brightness(.97); box-shadow: 0 0 0 2px rgba(0,0,0,.15); }
.shift .t { font-weight: 800; }
.shift .r { display: block; }
.shift .s { font-size: .72rem; opacity: .9; }
.shift.Kitchen { background: var(--kitchen-bg); border-color: var(--kitchen-line); color: var(--kitchen-text); }
.shift.Floor   { background: var(--floor-bg);   border-color: var(--floor-line);   color: var(--floor-text); }
.shift.Bar     { background: var(--bar-bg);     border-color: var(--bar-line);     color: var(--bar-text); }
.shift.manual::after { content: " ✎"; }
.shift.gap { background: var(--surface); border: 2px dashed var(--bad); border-left-width: 5px; color: var(--bad); }
.shift.gap .t { color: var(--bad); }
.unavail {
  border-radius: 6px; padding: 3px 8px; font-size: .75rem; color: #3b4454;
  background: repeating-linear-gradient(45deg, #eceff3, #eceff3 6px, #dfe3e9 6px, #dfe3e9 12px);
  border: 1px solid #c4cad4;
}
.locked .shift { cursor: pointer; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0; font-size: .85rem; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid; display: inline-block; }

.problems { margin-top: 16px; }
.problems ul { margin: 8px 0 0; padding-left: 20px; }
.problems li { margin-bottom: 4px; }

/* ---- Tables / forms ----------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { background: var(--head-bg); font-size: .85rem; }
table.data td.num, table.data th.num { text-align: center; }
.table-wrap { overflow-x: auto; position: relative; }
.link-btn { all: unset; cursor: pointer; color: var(--brand-dark); font-weight: 700; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

label.field { display: block; font-weight: 600; margin-bottom: 10px; }
label.field input, label.field select, label.field textarea { display: block; margin-top: 4px; width: 100%; max-width: 480px; padding: 8px 10px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--surface); }
input.cover-n { width: 56px; padding: 6px; text-align: center; border: 1px solid var(--field-line); border-radius: 6px; }

/* Level picker (1-5 buttons) */
.levels { display: inline-flex; gap: 3px; }
.levels button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--field-line); background: var(--surface); cursor: pointer; font-weight: 700; }
.levels button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.levels button:hover { background: var(--brand-tint); }
.levels button[aria-pressed="true"]:hover { background: var(--brand-dark); }

.profile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; }
.skill-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.skill-row:last-child { border-bottom: 0; }

.req { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.req-list { display: grid; gap: 10px; }

/* Skills matrix */
.matrix button { width: 34px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; }
.matrix button[data-level="0"] { color: var(--muted); background: var(--head-bg); }
.matrix button:not([data-level="0"]) { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-dark); }

/* ---- Dialog and toast --------------------------------------------------- */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.35); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(20, 30, 50, .55); }
.dlg-head { padding: 16px 20px 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dlg-body { padding: 4px 20px 16px; overflow-y: auto; max-height: calc(100vh - 190px); }
.dlg-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--head-bg); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
.cand-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.cand { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cand input { margin-top: 4px; width: 18px; height: 18px; }
.cand label { flex: 1; cursor: pointer; }
.cand.blocked { background: var(--head-bg); color: var(--muted); }
.cand.blocked label { cursor: not-allowed; }
.cand:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.cand small { display: block; color: var(--muted); }
.cand .why { color: var(--bad); font-weight: 600; }
.cand .warnline { color: var(--warn); font-weight: 600; }

.progress { height: 14px; border-radius: 7px; background: var(--track); overflow: hidden; margin: 12px 0 6px; }
.progress i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s; }
.steps { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.steps li { color: var(--muted); } .steps li.done { color: var(--ok); } .steps li.now { color: var(--text); font-weight: 700; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 200; max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 8px; }
  .brand { padding: 4px 8px 8px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  main { padding: 16px 16px 40px; }
  .profile { grid-template-columns: 1fr; }
  .week-switch .label { min-width: 0; flex: 1; }
  .page-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .demo-banner, .toolbar, .btn { display: none; } .app { display: block; } }

/* Friendly "demo" card at the foot of the sidebar (echoes the upgrade card in the reference style) */
.side-card { margin-top: 24px; background: linear-gradient(160deg, #1d4ed8, #1e3a8a); color: #fff; border-radius: 16px; padding: 14px; font-size: .85rem; }
.side-card strong { display: block; margin-bottom: 4px; }
@media (max-width: 860px) { .side-card { display: none; } }

/* ---- Dashboard ---------------------------------------------------------- */
.dash-stats .stat { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.dash-stats .stat .l { order: -1; font-size: .85rem; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.legend-inline { display: flex; gap: 14px; font-size: .85rem; color: var(--muted); }
.legend-inline .ln { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--brand); vertical-align: middle; margin-right: 6px; }
.legend-inline .ln.dash { border-top: 2px dashed var(--muted); }
.donut { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; margin-top: 8px; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.donut-legend li { display: flex; gap: 8px; align-items: center; }
table.data.compact th, table.data.compact td { padding: 6px 8px; font-size: .9rem; }
.day-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.day-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; color: inherit; }
a.btn.primary { color: var(--on-brand); }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.dash-grid .wide { grid-column: 1 / -1; }
.labour { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.labour-side { display: grid; gap: 10px; }
.big { font-size: 2rem; font-weight: 800; line-height: 1.1; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.note { margin: 12px 0 0; padding: 8px 12px; background: #fff8de; border-radius: 10px; font-size: .85rem; color: #5c4300; }
.legend-inline .sq { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--brand-dark); margin-right: 6px; vertical-align: middle; }
@media (max-width: 1000px) { .labour { grid-template-columns: minmax(0, 1fr); } }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Small form helpers (also used by the invite dialog on the Staff screen) */
.hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.err { color: var(--bad); font-weight: 600; font-size: .875rem; margin-top: 4px; }
.ff { margin-bottom: 12px; }
.ff .field-label { display: block; font-weight: 600; margin-bottom: 4px; }
.ff textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); }
.ff input, .ff select { width: 100%; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); }
.ff input[aria-invalid="true"], .ff select[aria-invalid="true"] { border-color: var(--bad); border-width: 2px; }
.alert { border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }
.alert.ok { background: var(--ok-bg); color: #0f4a28; border: 1px solid var(--ok); }
.alert.info { background: #eef4ff; color: #1b3a6b; border: 1px solid #9db8e6; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

.invite-line { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.invite-line:last-of-type { border-bottom: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }


/* ---- Staffing needs (cover.js) ------------------------------------------ */
.cover-controls { display: grid; gap: 12px; margin: 14px 0; }
.day-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.day-tab { flex: 0 0 auto; min-width: 84px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px 12px; cursor: pointer; text-align: center; position: relative; line-height: 1.25; }
.day-tab:hover { border-color: var(--brand); }
.day-tab[aria-selected="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.dt-name { display: block; font-weight: 800; }
.dt-sub { display: block; font-size: .78rem; opacity: .85; }
.dt-dot { position: absolute; top: 4px; right: 8px; color: #d9a40f; font-size: .8rem; }
.svc-pick { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.svc-pick legend { font-weight: 700; margin-right: 8px; float: left; padding: 0; line-height: 40px; }
.svc-opt { position: relative; }
.svc-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.svc-opt span { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 18px; font-weight: 700; }
.svc-opt input:checked + span { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.svc-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.needs-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.needs-head h2 { font-size: 1.3rem; }
.needs-head .btn { margin-left: auto; }
.needs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.need-card h3 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.nc-time { margin: 2px 0 10px; }
.role-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.role-name { font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--field-line); background: var(--surface); font-size: 1.3rem; font-weight: 700; cursor: pointer; line-height: 1; }
.stepper button:hover:not([aria-disabled="true"]) { background: var(--brand-tint); border-color: var(--brand); }
.stepper button[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.stepper input { width: 56px; height: 40px; text-align: center; font-size: 1.1rem; font-weight: 700; border: 1px solid var(--field-line); border-radius: 12px; }
.empty-mini { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); margin: 6px 0 10px; }
.add-role { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.add-role select { padding: 8px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); }
.need-card .hint { margin: 6px 0 0; }
.week-view { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; }
.week-view summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.wk-table th, .wk-table td { white-space: nowrap; }
.wk-total th, .wk-total td { background: var(--head-bg); }
.wk-cell { min-width: 36px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; font-weight: 700; cursor: pointer; }
.wk-cell:hover { background: var(--brand-tint); border-color: var(--brand); }
.wk-cell.current { background: var(--brand); color: var(--on-brand); }
.wk-cell.changed::after { content: "●"; color: #d9a40f; font-size: .6rem; margin-left: 2px; vertical-align: super; }
.copy-set { border: 0; padding: 0; margin: 0 0 14px; }
.copy-set legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.copy-set label { display: block; padding: 4px 0; }
.copy-day { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px !important; margin-bottom: 6px; }
@media (max-width: 960px) { .needs-grid { grid-template-columns: minmax(0, 1fr); } .needs-head .btn { margin-left: 0; } }

/* ---- Requests: History link, history list, undo dialog ---------------------------------- */
.back-link { display: inline-block; margin-bottom: 4px; color: var(--brand-dark); font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.banner-btns { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.empty-state { text-align: center; padding: 28px 16px; }
.empty-state .big-icon { font-size: 1.8rem; margin-bottom: 4px; }
.empty-state p { margin: 4px 0 0; }
.hist-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.filters + .hist-list, .filters + .empty-state { margin-top: 14px; }
.hist { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: flex-start; }
.hist-main { flex: 1 1 280px; min-width: 0; }
.hist-main h2 { font-size: 1.05rem; }
.hist-main p { margin: 2px 0 6px; }
.hist-main .btn-row { margin: 6px 0; }
.hist-note { font-style: italic; }
.hist-act { flex: 0 1 auto; margin-left: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hist-why { margin: 0; max-width: 30ch; }
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn[aria-disabled="true"]:hover { background: var(--surface); border-color: var(--btn-line); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.ack-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin: 8px 0 0; cursor: pointer; }
.ack-row input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
@media (max-width: 480px) { .hist-act { flex-basis: 100%; } .hist-why { max-width: none; } }
.effects { margin: 4px 0 12px; padding-left: 20px; } .effects li { margin: 4px 0; }
.dlg-body .alert { margin-top: 8px; }

/* ---- Chart colours: the charts in shared-screens.js carry fixed colours; these rules map them to the theme ---- */
svg [stroke="#e3e7e1"] { stroke: var(--line); }
svg [fill="#566073"] { fill: var(--muted); }
svg [stroke="#566073"] { stroke: var(--muted); }
svg [fill="#101612"] { fill: var(--text); }
svg [stroke="#fff"] { stroke: var(--surface); }
svg [fill="#14532d"] { fill: var(--brand); }
svg [fill="#b9dcc4"] { fill: var(--bar-off); }
svg [fill="#1f7a3d"] { fill: var(--brand); }
svg [stroke="#1f7a3d"] { stroke: var(--brand); }
svg [stop-color="#4cae6a"] { stop-color: var(--fill); }

/* ---- Skills ------------------------------------------------------------------------------ */
.lv { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 10px; font-weight: 700; border: 1px solid transparent; color: var(--text); }
.lv-0 { background: var(--panel); color: var(--muted); border-color: var(--line); }
.lv-1 { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.lv-2 { background: color-mix(in srgb, var(--brand) 28%, var(--surface)); }
.lv-3 { background: color-mix(in srgb, var(--brand) 45%, var(--surface)); }
.lv-4 { background: color-mix(in srgb, var(--brand) 68%, var(--surface)); color: #0b1220; }
.lv-5 { background: var(--brand); color: var(--on-brand); }
.lv-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; padding: 0; align-items: center; font-weight: 600; }
.lv-legend li { display: inline-flex; gap: 6px; align-items: center; }
.skill-help { margin-bottom: 12px; background: var(--panel); box-shadow: none; }
.skill-help p { margin: 4px 0 0; max-width: 78ch; }
.skill-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; margin-bottom: 6px; }
.skill-controls .ff { margin: 0; min-width: 240px; flex: 0 1 320px; }
.ff label { display: block; font-weight: 600; margin-bottom: 4px; }
.custom-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.chip-x { all: unset; cursor: pointer; padding: 0 4px; border-radius: 99px; font-weight: 700; }
.chip-x:hover { background: var(--bad-bg); color: var(--bad); }
.chip-x:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.skill-editor { margin: 10px 0 12px; background: var(--panel); box-shadow: none; }
.skill-effect { margin: 10px 0 4px; max-width: 78ch; }
.lvgroup { display: flex; flex-wrap: wrap; gap: 6px; }
.lvgroup button { min-width: 52px; min-height: 48px; padding: 4px 8px; border-radius: 12px; border: 1px solid var(--field-line); background: var(--surface); cursor: pointer; display: grid; place-items: center; line-height: 1.1; }
.lvgroup button b { font-size: 1.05rem; } .lvgroup button small { font-size: .7rem; color: var(--muted); min-height: .85em; }
.lvgroup button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.lvgroup button[aria-pressed="true"] small { color: var(--on-brand); }
.skill-grid th, .skill-grid td { padding: 6px 8px; }
.skill-grid thead th { text-align: center; vertical-align: bottom; }
.skill-grid thead th:first-child { text-align: left; }
.skill-grid .sk-sec { border-bottom: 3px solid var(--line); }
.skill-grid .sec-Kitchen { border-bottom-color: var(--kitchen-line); } .skill-grid .sec-Floor { border-bottom-color: var(--floor-line); } .skill-grid .sec-Bar { border-bottom-color: var(--bar-line); }
.skill-grid tbody th { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 150px; font-weight: 400; }
.skill-grid td { text-align: center; }
.skill-cell { cursor: pointer; width: 42px; height: 34px; font: inherit; font-weight: 700; }
.skill-cell:hover { box-shadow: 0 0 0 2px var(--brand); }
.skill-cell[aria-pressed="true"] { outline: 3px solid var(--brand-dark); outline-offset: 1px; }
.skills-wide { max-width: 100%; }
.skills-phone { display: none; }
.plain-select { padding: 8px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); }
@media (max-width: 720px) {
  .skills-wide, .skill-editor-wrap { display: none; }
  .skills-phone { display: block; }
  .skills-phone .card { margin-bottom: 10px; }
  .skills-phone .skill-row { display: block; }
  .skills-phone .skill-row strong { display: block; margin-bottom: 6px; }
}
[hidden] { display: none !important; }

.refresh-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: -4px 0 12px; }
.demo-banner #sim-request { margin-right: 4px; }

/* ---- Section colours (a fixed palette; a section picks one by name) ------------------------ */
.sec-amber { --sc-bg: var(--kitchen-bg); --sc-line: var(--kitchen-line); --sc-text: var(--kitchen-text); }
.sec-blue { --sc-bg: var(--floor-bg); --sc-line: var(--floor-line); --sc-text: var(--floor-text); }
.sec-green { --sc-bg: var(--bar-bg); --sc-line: var(--bar-line); --sc-text: var(--bar-text); }
.sec-violet { --sc-bg: #ece5fa; --sc-line: #7c5cd6; --sc-text: #3f2a78; }
.sec-rose { --sc-bg: #fde4ec; --sc-line: #d6457a; --sc-text: #7a1f3d; }
.sec-teal { --sc-bg: #d8f1f0; --sc-line: #1f9d99; --sc-text: #0b4f4d; }
.sec-slate { --sc-bg: #e9edf3; --sc-line: #6b7488; --sc-text: #2f3846; }
.sec-chip, .skill-chip { background: var(--sc-bg); color: var(--sc-text); border-color: var(--sc-line); }
.sec-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--sc-line); display: inline-block; }
.skill-chip { gap: 6px; padding: 2px 6px 2px 10px; }
.skill-chip .lv { min-width: 24px; height: 22px; font-size: .8rem; border-radius: 8px; }

/* ---- Employee cards ------------------------------------------------------------------------ */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-top: 8px; }
.pcard { padding: 14px 16px; }
.pcard.open { grid-column: 1 / -1; }
.pc-head { display: flex; gap: 12px; align-items: flex-start; }
.pc-head .avatar { width: 48px; height: 48px; font-size: 1.05rem; flex: none; }
.pc-id { flex: 1; min-width: 0; }
.pc-id h2 { font-size: 1.05rem; } .pc-id h2:focus { outline: none; }
.pc-contact { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .9rem; margin-top: 4px; word-break: break-word; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.pbox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.pboxes .pbox { margin-top: 0; }
.pbox h3 { font-size: 1rem; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.pbox h4 { margin: 10px 0 4px; }
.pbox-private { border-style: dashed; }
.pbox .ff { margin-bottom: 10px; }
.ff input, .ff select, .ff textarea { max-width: 100%; }
.ff3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chips-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.about-me { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }
.pc-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 14px; }
.sk-group { margin-bottom: 6px; }
.add-skill-row { margin-top: 10px; }
.pcard-page .pcard { box-shadow: none; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* ---- Settings ------------------------------------------------------------------------------ */
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.subnav a { text-decoration: none; color: var(--text); padding: 6px 14px; border-radius: 99px; border: 1px solid var(--btn-line); background: var(--surface); font-weight: 600; }
.subnav a:hover { background: var(--brand-tint); }
.subnav a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.row h2, .row h3 { margin: 0; }
.set-row { margin: 12px 0 8px; }
.chk { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.chk input { width: 18px; height: 18px; }
.hours-table input[type="time"], .sd-table input[type="time"], .sd-table select { padding: 6px 8px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); }
.hours-table td, .sd-table td { vertical-align: middle; }
.svc-list { display: grid; gap: 10px; margin: 10px 0; }
.svc, .sec-card { box-shadow: none; }
.inactive { opacity: .8; }
.sec-card { border-left: 6px solid var(--sc-line); margin-bottom: 12px; }
.area-block { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.role-list { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 6px; }
.role-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.btn.icon { min-width: 34px; padding: 4px 8px; }
.swatch-set { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 99px; border: 2px solid var(--sc-line); background: var(--sc-bg); color: var(--sc-text); font-weight: 600; cursor: pointer; }
.swatch:has(input:checked) { outline: 3px solid var(--brand); outline-offset: 2px; }
.swatch input { width: 16px; height: 16px; }
.sd-note { white-space: nowrap; }
.scope-note { margin-top: 10px; }
.pv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.pv { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.pv h3 { font-size: 1rem; margin-bottom: 8px; }
.pv-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.pv-tab { padding: 3px 10px; border-radius: 99px; border: 1px solid var(--btn-line); background: var(--surface); font-weight: 600; font-size: .85rem; }
.pv-tab.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pv-tab.off { opacity: .5; }
.pv-title { margin: 4px 0; }
.pv-role { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.pv-step { display: inline-flex; gap: 8px; align-items: center; margin-left: auto; padding: 2px 10px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); }
.pv-roster { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)); gap: 4px; align-items: center; margin-bottom: 8px; }
.pr-h { text-align: center; font-weight: 700; font-size: .85rem; padding: 4px; background: var(--head-bg); border-radius: 8px; } .pr-h.on { background: var(--brand-tint); color: var(--brand-dark); }
.pr-n { font-weight: 700; font-size: .85rem; } .pr-c { min-height: 36px; border: 1px dashed var(--line); border-radius: 8px; padding: 3px; }
.shift-mini { display: block; background: var(--sc-bg); color: var(--sc-text); border-left: 5px solid var(--sc-line); border-radius: 8px; padding: 3px 6px; font-size: .75rem; font-weight: 700; }
.shift-mini.cont { border-left-style: dashed; opacity: .85; font-weight: 600; }
@media (max-width: 720px) { .ff3 { grid-template-columns: 1fr; } .pgrid { grid-template-columns: minmax(0, 1fr); } .pboxes { grid-template-columns: minmax(0, 1fr); } .lvgroup button { min-width: 46px; } }

/* ---- Departments, Open / Close times, timelines ------------------------------------------- */
.tchoice { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tchoice select, .tchoice input[type="time"] { padding: 6px 8px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); max-width: 100%; }
.tchoice [hidden] { display: none; }
.close-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.close-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.close-ctl { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.close-ctl label { font-weight: 600; display: block; margin-bottom: 4px; }
.close-ctl input[type="time"] { padding: 6px 8px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); }
.gl-closed { background: var(--panel); }
.tl { position: relative; margin: 12px 0 4px; padding: 0 0 0 112px; }
.tl-axis { position: relative; height: 18px; font-size: .75rem; color: var(--muted); }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; } .tl-axis span:last-child { transform: translateX(-100%); }
.tl-row { position: relative; display: flex; align-items: center; min-height: 34px; }
.tl-name { position: absolute; left: -112px; width: 106px; overflow: hidden; }
.tl-track { position: relative; flex: 1; height: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.tl-bar { position: absolute; top: 2px; bottom: 2px; background: var(--sc-bg, var(--brand-tint)); border: 1px solid var(--sc-line, var(--brand)); border-left-width: 5px; border-radius: 6px; color: var(--sc-text, var(--text)); font-size: .7rem; font-weight: 700; overflow: hidden; white-space: nowrap; display: flex; align-items: center; padding: 0 4px; }
.tl-bar.unk { border-right-style: dashed; background: repeating-linear-gradient(45deg, var(--sc-bg, var(--brand-tint)), var(--sc-bg, var(--brand-tint)) 6px, var(--panel) 6px, var(--panel) 12px); }
.tl-closed { position: absolute; left: 8px; top: 2px; font-size: .8rem; }
.shift-mini.pending { border-style: dashed; border-left-style: dashed; opacity: .85; }
@media (max-width: 720px) { .tl { padding-left: 0; } .tl-name { position: static; width: auto; margin-right: 6px; } .tl-row { flex-wrap: wrap; } .tl-track { flex-basis: 100%; } }
dialog:has(.hours-table), dialog:has(.sd-table) { width: min(980px, calc(100vw - 24px)); }
