[hidden] { display: none !important; }
:root {
  --bg: #f4f6f8; --panel: #ffffff; --panel2: #f9fafb; --ink: #17212b; --ink2: #4b5866; --ink3: #6b7785; --line: #dde3e9; --line2: #eef1f4;
  --brand: #1f4f74; --brand2: #2b6a99; --brand-ink: #ffffff; --accent: #c8862a;
  --ok: #1f7a4d; --ok-bg: #e5f4ec; --warn: #9a6200; --warn-bg: #fdf3dc; --bad: #b3261e; --bad-bg: #fbe7e5; --info: #1d5f9a; --info-bg: #e3eef9; --muted-bg: #edf0f3;
  --W: #1f4f74; --SB: #6b8fb0; --OBS: #6a3f8f; --OFF: #e9edf1; --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1419; --panel: #172029; --panel2: #1c2731; --ink: #e6ebf0; --ink2: #b3bfcb; --ink3: #8e9baa; --line: #2b3946; --line2: #22303c;
    --brand: #4f8fc2; --brand2: #6aa5d4; --ok: #5cc28f; --ok-bg: #173628; --warn: #e3ae4a; --warn-bg: #3a2f14; --bad: #f08a80; --bad-bg: #3d1d1b; --info: #7db6ea; --info-bg: #182d42; --muted-bg: #24313d;
    --W: #3f7fb3; --SB: #5f7f9c; --OBS: #8a5fb3; --OFF: #24313d; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: var(--brand2); }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
small, .muted { color: var(--ink3); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--panel); padding: 6px 10px; }
.demo-banner { background: var(--warn-bg); color: var(--warn); font-size: 12px; text-align: center; padding: 4px 12px; border-bottom: 1px solid var(--line); }

.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 56px; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--brand); text-decoration: none; min-width: 0; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { color: var(--ink); font-size: 15px; }
.brand small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.top-meta { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.nav-toggle { display: none; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; text-align: center; padding: 0 4px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 82px); }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; position: sticky; top: 56px; height: calc(100vh - 82px); overflow: auto; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink3); padding: 12px 10px 4px; }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--ink2); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--panel2); color: var(--ink); }
.side a.on { background: var(--info-bg); color: var(--brand); }
.side a .n { font-size: 11px; background: var(--warn-bg); color: var(--warn); border-radius: 9px; padding: 0 6px; }
main { padding: 20px 24px 60px; min-width: 0; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { color: var(--ink2); margin: 0; max-width: 760px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi-l { font-size: 12px; color: var(--ink3); } .kpi-v { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; } .kpi-s { font-size: 12px; color: var(--ink2); }
.kpi.bad .kpi-v { color: var(--bad); } .kpi.warn .kpi-v { color: var(--warn); } .kpi.ok .kpi-v { color: var(--ok); }

.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 7px 12px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand2); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { appearance: none; border: 0; background: transparent; color: var(--ink2); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 18px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--panel2); }
:focus-visible { outline: 2px solid var(--brand2); outline-offset: 2px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--muted-bg); color: var(--ink2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); } .badge.muted { background: var(--muted-bg); color: var(--ink3); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
th { font-size: 12px; color: var(--ink3); font-weight: 600; background: var(--panel2); position: sticky; top: 0; }
tr:hover td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
.tbl-wrap { overflow: auto; max-width: 100%; }
td.num, th.num { text-align: right; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink2); }
.field small { font-size: 12px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sep { height: 1px; background: var(--line); margin: 12px 0; }

.checks { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.ck { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.ck-i { width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.ck.ok .ck-i { background: var(--ok-bg); color: var(--ok); } .ck.warn .ck-i { background: var(--warn-bg); color: var(--warn); } .ck.block .ck-i { background: var(--bad-bg); color: var(--bad); } .ck.info .ck-i { background: var(--info-bg); color: var(--info); }

.alert { border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid; font-size: 13px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { appearance: none; border: 0; background: none; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--ink3); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.on { color: var(--brand); border-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { appearance: none; border: 0; background: var(--panel); padding: 6px 11px; font: inherit; font-weight: 550; color: var(--ink2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; }

/* Staffing grid */
.sgrid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.sgrid th, .sgrid td { padding: 0; border-bottom: 1px solid var(--line2); border-right: 1px solid var(--line2); text-align: center; min-width: 34px; height: 30px; }
.sgrid thead th { position: sticky; top: 0; z-index: 2; padding: 4px 2px; line-height: 1.1; font-size: 11px; }
.sgrid th.who, .sgrid td.who { position: sticky; left: 0; z-index: 3; background: var(--panel); text-align: left; padding: 4px 10px; min-width: 170px; white-space: nowrap; }
.sgrid thead th.who { z-index: 4; background: var(--panel2); }
.sgrid th.wk { background: color-mix(in srgb, var(--warn-bg) 70%, var(--panel2)); }
.sgrid th.hol { color: var(--bad); }
.sgrid th.lk { border-bottom: 3px solid var(--info); }
.sgrid th.pub { border-bottom: 3px solid var(--ok); }
.sgrid td.grp { background: var(--panel2); font-weight: 650; text-align: left; padding: 4px 10px; position: sticky; left: 0; }
.cell { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 29px; border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 650; color: var(--ink2); cursor: default; padding: 0; }
button.cell { cursor: pointer; } button.cell:hover { outline: 2px solid var(--brand2); outline-offset: -2px; }
.c-W { background: var(--W); color: #fff; } .c-SB { background: var(--SB); color: #fff; } .c-off { background: var(--OFF); color: var(--ink3); }
.c-OBS { background: var(--OBS); color: #fff; }
.c-trip { box-shadow: inset 0 -4px 0 var(--accent); }
.sgrid tr.me td { background: var(--info-bg); }
.sgrid tr.cov td { height: 26px; font-size: 11px; }
.cov-ok { color: var(--ok); } .cov-bad { color: var(--bad); font-weight: 700; background: var(--bad-bg); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink2); margin: 8px 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal .dh { background: var(--panel2); font-size: 12px; font-weight: 600; color: var(--ink3); padding: 6px 8px; }
.cal .day { background: var(--panel); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day.out { background: var(--panel2); opacity: .55; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--brand2); }
.cal .dn { font-size: 12px; font-weight: 650; display: flex; justify-content: space-between; gap: 4px; }
.chip { font-size: 11px; padding: 1px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--W); }
.chip.light { background: var(--muted-bg); color: var(--ink2); }
.chip.trip { background: var(--accent); }
.chip.bad { background: var(--bad); }

/* Modal & chooser */
#modal { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(10,18,26,.5); }
.modal-card { position: relative; background: var(--panel); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-card.wide { width: min(920px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal-err { color: var(--bad); font-weight: 600; }
#chooser { position: fixed; inset: 0; z-index: 70; background: var(--bg); overflow: auto; padding: 32px 16px; }
.choose { max-width: 980px; margin: 0 auto; }
.choose h1 { font-size: 26px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 8px 0 18px; }
.opt { text-align: left; border: 1.5px solid var(--line); background: var(--panel); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); }
.opt strong { display: block; margin-bottom: 2px; }
.opt span { font-size: 12.5px; color: var(--ink2); }
.opt.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; margin-right: 6px; }

#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 360px; transition: opacity .4s, transform .4s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }
.empty { text-align: center; padding: 28px 12px; color: var(--ink3); }
.list { display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--panel); }
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.legs td input { min-width: 80px; }
.steps { display: grid; gap: 14px; }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.step h3 { display: flex; align-items: center; }
.bar { height: 8px; background: var(--muted-bg); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand2); }
.notice-list li { margin-bottom: 4px; }
#printArea { display: none; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .nav-toggle { display: inline-grid; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: 82px; left: 0; bottom: 0; width: 250px; height: auto; z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  main { padding: 14px 12px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .top { gap: 8px; padding: 6px 10px; }
  .top-meta { display: none; }
  .brand small { max-width: 150px; }
  .cal .day { min-height: 70px; padding: 4px; }
  .cal .chip { font-size: 10px; padding: 0 3px; }
  .cal .dh { padding: 4px; font-size: 11px; }
  h1 { font-size: 19px; }
  #switchUser { padding: 4px 8px; font-size: 12px; }
}
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; color: #000; font: 12px/1.4 var(--font); }
  #printArea table { border: 1px solid #999; } #printArea th, #printArea td { border: 1px solid #bbb; background: #fff; color: #000; }
  @page { margin: 14mm; }
}

/* keep record identifiers on one line */
td:first-child a, td:first-child strong { white-space: nowrap; }

/* ---- accounts, feedback, what's new */
.choose-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.choose-brand strong { display: block; font-size: 20px; }
.choose-brand small { color: var(--ink3); }
.acct-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.acct-bar .row { gap: 8px; }
.acct-btn.avatar { border-radius: 999px; min-width: 34px; height: 34px; padding: 0 8px; background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.ver-line { font-size: 11px; color: var(--ink3); padding: 14px 10px 4px; }
.fb-item { border-top: 1px solid var(--line2); padding: 10px 0; }
.fb-item:first-child { border-top: 0; padding-top: 0; }
.fb-msg { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.fb-reply { background: var(--info-bg); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.fb-reply p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-admin .fb-edit { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; align-items: end; margin-top: 10px; }
.fb-admin .fb-edit .field { margin: 0; }
.qr { background: #fff; display: inline-block; padding: 8px; border-radius: 8px; margin: 8px 0; }
.secret { display: inline-block; font-family: ui-monospace, monospace; word-break: break-all; background: var(--panel2); padding: 6px 8px; border-radius: 6px; margin-top: 6px; }
.rel h3 { margin: 0 0 4px; }
.rel ul { margin: 6px 0 12px; padding-left: 20px; }
.rel li { margin: 4px 0; }
.auth-form .btn { width: 100%; justify-content: center; }
@media (max-width: 820px) {
  .fb-admin .fb-edit { grid-template-columns: 1fr; }
  #switchUser { display: none; }
  .fb-btn { padding: 4px 8px; }
}
@media (max-width: 420px) { .fb-btn { font-size: 12px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.support-bar { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.support-bar button { font: inherit; font-weight: 700; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 6px; padding: 1px 8px; cursor: pointer; }
.landing { max-width: 640px; margin: 8vh auto 0; }
.landing .card { padding: 22px; }
.landing ul { margin: 10px 0 16px; padding-left: 20px; }
