/* Shared SPA styles. Mobile first; dark default with a light theme; print sheet. --accent comes from the pack. */
:root {
  --accent: #38bdf8;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --radius: 8px;
  --pxh: 64px;
  --labelw: 150px;
}
[data-theme=dark] {
  --bg: #0d1421; --card: #111d2e; --card2: #0f192a; --border: #1e3654; --text: #c8d8e8; --muted: #8aa3bd;
  --ok: #22d3a0; --warn: #f59e0b; --bad: #f87171; --night: rgba(0, 0, 0, .32); --hover: #16273d; --input: #0b1220;
  --stripe: rgba(255, 255, 255, .06); --ctl: #4d6d93; --link: var(--accent); --focus: #ffd166; color-scheme: dark;
}
[data-theme=light] {
  --bg: #f5f7fb; --card: #ffffff; --card2: #f0f3f8; --border: #d5dde8; --text: #1b2533; --muted: #556274;
  --ok: #047857; --warn: #a15c00; --bad: #c0392b; --night: rgba(20, 40, 80, .09); --hover: #eaf0f8; --input: #ffffff;
  --stripe: rgba(0, 0, 0, .05); --ctl: #7b8899; --link: color-mix(in srgb, var(--accent) 55%, #000); --focus: #1d4ed8; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); -webkit-text-size-adjust: 100%; overflow-wrap: break-word; }
body { -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 20%, transparent); }
a { color: var(--link); }
h1, h2, h3, h4 { margin: .6em 0 .4em; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
h4 { font-size: .9rem; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.mono { font-family: var(--mono); font-size: 12px; }
.grow { flex: 1; }
.right { float: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- controls */
button, .button {
  font: inherit; font-size: .92rem; color: var(--text); background: var(--card2); border: 1px solid var(--ctl);
  border-radius: var(--radius); padding: .45em .8em; cursor: pointer; min-height: 36px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .3em; white-space: nowrap; touch-action: manipulation;
}
button[aria-busy=true] { cursor: progress; }
button[aria-busy=true]:disabled { opacity: .8; }
button[aria-busy=true]::after { content: ''; width: .9em; height: .9em; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button:hover, .button:hover { background: var(--hover); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #04111d; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); }
button.icon { background: none; border: none; padding: .35em; min-height: 32px; color: var(--muted); position: relative; }
button.icon:hover { color: var(--text); }
button.tiny, .tiny { font-size: .78rem; min-height: 0; padding: 0 .3em; }
button.link { background: none; border: none; color: var(--link); padding: .2em 0; min-height: 0; }
button.big { padding: .7em 1.4em; font-size: 1rem; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--input); border: 1px solid var(--ctl); border-radius: 6px;
  padding: .45em .55em; min-height: 38px; max-width: 100%;
}
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }
textarea { width: 100%; resize: vertical; }
input.narrow { width: 6em; }
input.inline { width: auto; display: inline-block; margin-left: .5em; min-height: 30px; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--bg) 85%, transparent); }
#main:focus-visible, .modal:focus-visible { outline: none; box-shadow: none; }
.bk:focus-visible, .gtrack.row:focus-visible, .wcell:focus-visible, .mcell:focus-visible { outline-offset: -3px; z-index: 6; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: .5em; top: -3em; z-index: 100; background: var(--card); color: var(--text); padding: .5em .8em; border-radius: var(--radius); border: 2px solid var(--focus); }
.skip:focus { top: .5em; }
.warn-text { color: var(--warn); }
.field { display: flex; flex-direction: column; gap: .2em; margin-bottom: .6em; min-width: 0; }
.field > input:not([type=checkbox]), .field > select, .field > textarea, .field > .row { width: 100%; }
.flabel { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.hint { color: var(--muted); font-size: .78rem; }
.check { display: inline-flex; align-items: center; gap: .35em; cursor: pointer; margin: .2em 0; }
.checks-inline { display: flex; flex-wrap: wrap; gap: .2em 1em; }
.row { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
.row.actions { margin-top: .6em; }
.row.sticky { position: sticky; bottom: 0; z-index: 5; background: var(--bg); padding: .6em 0; padding-bottom: max(.6em, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 1em; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .5em .8em; margin: .6em 0; }
legend { color: var(--muted); font-size: .85rem; padding: 0 .3em; }
details > summary { cursor: pointer; color: var(--link); padding: .3em 0; }

/* ---------------------------------------------------------------- shell */
#top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .4em; padding: .4em .7em;
  padding-top: max(.4em, env(safe-area-inset-top)); padding-left: max(.7em, env(safe-area-inset-left)); padding-right: max(.7em, env(safe-area-inset-right));
  background: var(--card); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5em; color: var(--text); text-decoration: none; min-width: 0; }
.brand b { display: block; font-size: 1rem; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); flex: none;
  -webkit-mask: url(/static/icon.svg) center/cover; mask: url(/static/icon.svg) center/cover; }
.who { display: none; text-align: right; line-height: 1.1; }
.who small { display: block; color: var(--muted); font-size: .72rem; }
@media (min-width: 760px) { .who { display: block; } }
#bell-count { position: absolute; top: 0; right: 0; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; min-width: 16px; padding: 0 4px; line-height: 16px; }
.offline-flag { display: none; background: var(--warn); color: #000; border-radius: 4px; font-size: .72rem; padding: 0 .4em; }
body.offline .offline-flag { display: inline; }
#tabs {
  position: sticky; top: var(--toph, 49px); z-index: 19; display: flex; gap: 2px; overflow-x: auto; background: var(--card);
  border-bottom: 1px solid var(--border); padding: 0 .4em; scrollbar-width: none;
}
#tabs::-webkit-scrollbar { display: none; }
/* more tabs off-screen: soft edge shadows (scroll-shadow technique, no JS, the bar stays opaque) */
#tabs { background:
  linear-gradient(to right, var(--card) 40%, transparent) left center / 36px 100% no-repeat local,
  linear-gradient(to left, var(--card) 40%, transparent) right center / 36px 100% no-repeat local,
  radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--text) 30%, transparent), transparent) left center / 14px 100% no-repeat scroll,
  radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--text) 30%, transparent), transparent) right center / 14px 100% no-repeat scroll,
  var(--card); }
/* request in flight: thin moving bar under the header */
body.net-busy #top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; z-index: 30; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 40% 100%; animation: netbar 1s linear infinite; }
@keyframes netbar { from { background-position: -60% 0; } to { background-position: 160% 0; } }
#tabs a {
  flex: none; padding: .65em .75em; color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid transparent;
}
#tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
body.logged-out #tabs, body.logged-out #bell, body.logged-out #logout-btn, body.logged-out .who { display: none; }
#main { padding: .7em; max-width: 1400px; margin: 0 auto; padding-bottom: calc(2em + env(safe-area-inset-bottom)); }
.loading, .empty { padding: 2em 1em; text-align: center; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; margin-bottom: .6em; }
.toolbar .title { font-weight: 600; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg button.on, .chips button.on { background: var(--accent); color: #04111d; border-color: var(--accent); }
.chips { display: flex; gap: .35em; overflow-x: auto; padding-bottom: .4em; margin-bottom: .3em; scrollbar-width: thin; }
.chips button { border-radius: 999px; font-size: .8rem; min-height: 30px; padding: .2em .8em; flex: none; }
.datepick { position: relative; display: inline-flex; align-items: center; gap: .4em; }
.datepick input { width: 9.5em; }
.banner { border-radius: var(--radius); padding: .5em .8em; margin: .4em 0; display: flex; gap: .5em; flex-wrap: wrap; align-items: center; }
.banner.warn { background: color-mix(in srgb, var(--warn) 18%, var(--card)); border: 1px solid var(--warn); }

/* ---------------------------------------------------------------- cards, chips, dots */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6em; }
.cards.compact { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .7em .8em; margin-bottom: .6em; min-width: 0; }
.cards .card { margin: 0; }
.card.bcard, .card.event, .card.sq { border-left: 4px solid var(--accent); cursor: pointer; }
.card.bcard:hover, .card.sq:hover { background: var(--hover); }
.card.sq.grounded { border-left-color: var(--bad); }
.card.res.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--border)); }
.card.inactive, tr.inactive { opacity: .55; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5em; flex-wrap: wrap; margin-bottom: .2em; }
.big { font-size: 1.05rem; font-weight: 600; margin: .1em 0 .3em; }
.bignum { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance.neg .bignum { color: var(--bad); }
.daysep { margin-top: 1em; grid-column: 1 / -1; }
.chip { display: inline-block; font-size: .72rem; padding: .05em .55em; border-radius: 999px; border: 1px solid var(--border); background: var(--card2); margin: 0 .2em; white-space: nowrap; vertical-align: middle; }
.chip.ok { color: var(--ok); border-color: var(--ok); } .chip.warn { color: var(--warn); border-color: var(--warn); } .chip.bad { color: var(--bad); border-color: var(--bad); }
.chip.st-requested { border-style: dashed; color: var(--warn); } .chip.st-dispatched { color: var(--accent); border-color: var(--accent); }
.chip.st-completed { color: var(--ok); } .chip.st-cancelled, .chip.st-no_show { color: var(--bad); border-color: var(--bad); }
.card-head .ctitle { font-size: 1rem; color: var(--text); text-transform: none; letter-spacing: 0; margin: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); vertical-align: middle; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.none { background: transparent; border: 1px solid var(--muted); }
.seatbar { position: relative; display: flex; align-items: center; height: 16px; border-radius: 8px; background: var(--card2); border: 1px solid var(--border); overflow: hidden; margin: .3em 0; min-width: 48px; }
.seatbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--ok); opacity: .55; }
.seatbar.warn .fill { background: var(--warn); } .seatbar.full .fill { background: var(--bad); }
.seatbar span { position: relative; font-size: 11px; line-height: 14px; padding: 0 .5em; font-weight: 600; white-space: nowrap; color: var(--text); }
ul.plain, ol.plain { list-style: none; padding: 0; margin: .2em 0; }
ul.plain.meta li { font-size: .88rem; }
.notes { white-space: pre-wrap; background: var(--card2); border-radius: 6px; padding: .4em .6em; margin: .4em 0; font-size: .9rem; }
.counters { display: flex; flex-wrap: wrap; gap: .3em 1em; margin: .3em 0; font-variant-numeric: tabular-nums; }
.code { font: 700 1.8rem var(--mono); letter-spacing: .15em; text-align: center; padding: .5em; background: var(--card2); border-radius: var(--radius); user-select: all; }

/* ---------------------------------------------------------------- tables */
table { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: .45em .5em; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.list th { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
table.list tbody tr { cursor: default; }
table.list tbody tr[onclick], .view-people tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--hover); }
table.list tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
table.kv th { text-align: left; font-weight: normal; color: var(--muted); padding: .2em .6em .2em 0; width: 40%; vertical-align: top; }
table.kv td { padding: .2em 0; }
table.perms td { text-align: center; }
.scroll-x { overflow-x: auto; }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* ---------------------------------------------------------------- gate preview */
.preview { margin: .6em 0; }
.gate { border: 1px solid var(--border); border-radius: var(--radius); padding: .5em .7em; background: var(--card2); }
.gate-head { display: flex; align-items: center; gap: .5em; }
.gate-head.ok b { color: var(--ok); } .gate-head.warn b { color: var(--warn); } .gate-head.bad b { color: var(--bad); }
ul.issues { margin: .4em 0 0; padding-left: 1.2em; font-size: .88rem; }
ul.issues li.bad::marker { color: var(--bad); } ul.issues li.warn::marker { color: var(--warn); }
ul.issues li.overridden { text-decoration: line-through; opacity: .7; }
ul.issues li.none { color: var(--muted); list-style: circle; }
ol.occ { font-size: .85rem; margin: .4em 0 0; padding-left: 1.4em; }
.inline-err:empty { display: none; }
.inline-err { margin: .4em 0; color: var(--bad); }

/* ---------------------------------------------------------------- modal, toast */
.backdrop { position: fixed; left: 0; right: 0; top: var(--vvtop, 0px); height: 100%; height: var(--vvh, 100dvh); z-index: 50; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); border: 1px solid var(--border); width: 100%; max-height: 92vh; max-height: calc(var(--vvh, 100dvh) - max(16px, env(safe-area-inset-top))); display: flex; flex-direction: column; border-radius: 14px 14px 0 0; }
@media (min-width: 640px) { .backdrop { align-items: center; } .modal { width: min(560px, 94vw); border-radius: 12px; } .modal.wide { width: min(820px, 96vw); } }
.mhead { display: flex; justify-content: space-between; align-items: center; padding: .6em .9em; border-bottom: 1px solid var(--border); }
.mhead h2 { font-size: 1.05rem; }
.mbody { padding: .7em .9em; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.mfoot { display: flex; gap: .5em; justify-content: flex-end; flex-wrap: wrap; padding: .6em .9em; padding-bottom: max(.6em, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.mfoot:empty { display: none; }
#toasts { position: fixed; bottom: max(1em, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: .4em; width: min(480px, 92vw); }
.toast { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: .6em .8em; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); transition: opacity .4s; }
.toast.good { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.bad { border-left-color: var(--bad); }
.toast.out { opacity: 0; }

/* ---------------------------------------------------------------- login */
.login { max-width: 360px; margin: 12vh auto; display: flex; flex-direction: column; gap: .7em; text-align: center; padding: 1.5em; }
.login input { text-align: center; font: 600 1.3rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }

/* ---------------------------------------------------------------- schedule */
.wx-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .3em .9em; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .35em .7em; margin-bottom: .5em; font-size: .85rem; }
.wx-title { font-weight: 700; }
.wx-item { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wx-raw { flex-basis: 100%; }
.wx-raw:not([open]) { flex-basis: auto; }
.wx-raw pre { font: 12px var(--mono); white-space: pre-wrap; margin: .2em 0; }
.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.grid { position: relative; }
.ghead, .ggroup, .grow-row { display: flex; }
.glabel { flex: none; width: var(--labelw); position: sticky; left: 0; z-index: 3; background: var(--card); border-right: 1px solid var(--border); padding: .3em .5em; overflow: hidden; }
.ghead { position: sticky; top: 0; z-index: 4; border-bottom: 1px solid var(--border); background: var(--card); }
.ghead .glabel { z-index: 5; }
.ticks { position: relative; height: 26px; flex: none; }
.tick { position: absolute; top: 5px; font-size: 11px; color: var(--muted); transform: translateX(3px); font-variant-numeric: tabular-nums; }
.ggroup .glabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--card2); }
.ggroup .gtrack { background: var(--card2); height: 22px; flex: none; }
.grow-row { border-bottom: 1px solid var(--border); align-items: stretch; }
.glabel.res .rname { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glabel.res .rsub { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glabel.res.bad { background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
.gtrack.row { position: relative; flex: none; cursor: copy; touch-action: pan-x pan-y;
  background-image: repeating-linear-gradient(90deg, var(--stripe) 0 1px, transparent 1px calc(var(--pxh) / 2), color-mix(in srgb, var(--stripe) 50%, transparent) calc(var(--pxh) / 2) calc(var(--pxh) / 2 + 1px), transparent calc(var(--pxh) / 2 + 1px) var(--pxh)); }
.gtrack.row.bad { cursor: not-allowed; background-color: color-mix(in srgb, var(--bad) 8%, transparent); }
.night { position: absolute; top: 0; bottom: 0; background: var(--night); pointer-events: none; }
.nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.blk { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; z-index: 1; font-size: 11px; padding: 2px 5px; overflow: hidden; color: var(--bad); cursor: pointer;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--bad) 22%, transparent) 0 6px, transparent 6px 12px); border: 1px solid color-mix(in srgb, var(--bad) 50%, transparent); }
.bk { position: absolute; top: 4px; bottom: 4px; z-index: 2; border-radius: 6px; padding: 2px 6px; font-size: 12px; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; color: #04111d;
  background: color-mix(in srgb, var(--kc, var(--accent)) 80%, #fff); border: 1px solid color-mix(in srgb, var(--kc, var(--accent)) 70%, #000); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
[data-theme=dark] .bk { background: color-mix(in srgb, var(--kc, var(--accent)) 70%, #0d1421); color: #fff; }
.bk:hover { filter: brightness(1.1); z-index: 3; }
.bk .bk-t { font-weight: 700; font-variant-numeric: tabular-nums; }
.bk .bk-k { opacity: .8; }
.bk.mine { outline: 2px solid var(--text); outline-offset: -2px; }
.bk.st-requested { background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 5px, transparent 5px 10px); border-style: dashed; }
.bk.st-dispatched { box-shadow: inset 4px 0 0 #fff; }
.bk.st-completed { opacity: .55; }
.bk.st-no_show { opacity: .6; text-decoration: line-through; background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, .18) 0 4px, transparent 4px 8px); }
.bk.event { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .3em; white-space: normal; }
.bk.event .seatbar { flex: 1 1 60px; height: 13px; margin: 1px 0; background: rgba(0, 0, 0, .25); border-color: transparent; }
.bk.event .seatbar span { font-size: 10px; line-height: 12px; color: #fff; }
.bk .join { font-size: 11px; padding: 0 .5em; min-height: 18px; border-radius: 9px; background: #fff; color: #04111d; border: none; font-weight: 700; }
.bk .grip { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; cursor: ew-resize; touch-action: none; }
.bk .grip::after { content: ''; position: absolute; right: 3px; top: 30%; bottom: 30%; width: 2px; border-left: 1px solid rgba(255, 255, 255, .7); border-right: 1px solid rgba(255, 255, 255, .7); }
.bk.resizing { z-index: 5; opacity: .9; }
.bk.resizing::after { content: attr(data-end); position: absolute; right: 12px; top: 2px; font-weight: 700; }
.bk.chk-ok { box-shadow: 0 0 0 2px var(--ok); } .bk.chk-warn { box-shadow: 0 0 0 2px var(--warn); } .bk.chk-bad { box-shadow: 0 0 0 2px var(--bad); }
.ghost { position: absolute; top: 4px; bottom: 4px; background: color-mix(in srgb, var(--accent) 30%, transparent); border: 1px dashed var(--accent); border-radius: 6px; font-size: 11px; padding: 2px 4px; pointer-events: none; z-index: 4; }
.legend { display: flex; flex-wrap: wrap; gap: .3em 1em; margin: .5em 0; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3em; vertical-align: -2px; }
.legend .lg-night { background: var(--night); border: 1px solid var(--border); }
.legend .lg-blk { background: repeating-linear-gradient(45deg, var(--bad) 0 2px, transparent 2px 4px); }
.legend .lg-req { border: 1px dashed var(--warn); }
/* week */
.grid.week { min-width: calc(var(--labelw) + 7 * 92px); }
.wrow { display: grid; grid-template-columns: var(--labelw) repeat(7, minmax(92px, 1fr)); border-bottom: 1px solid var(--border); }
.wrow .glabel { width: auto; }
.wcell { position: relative; min-height: 38px; border-left: 1px solid var(--border); cursor: pointer; }
.wcell:hover { background: var(--hover); }
.wcell.today { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.whead .wcell { min-height: 0; padding: .4em; font-size: .8rem; font-weight: 600; text-align: center; }
.wgroup .wcell { min-height: 22px; background: var(--card2); }
.wgroup .glabel { font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--card2); }
.wbk { position: absolute; top: 6px; bottom: 6px; border-radius: 4px; background: var(--kc, var(--accent)); font-size: 10px; color: #fff; overflow: hidden; text-align: center; line-height: 24px; }
.wbk.st-requested { opacity: .6; }
.wbk.mine { outline: 2px solid var(--text); }
.wblk { position: absolute; top: 3px; bottom: 3px; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--bad) 35%, transparent) 0 3px, transparent 3px 6px); }
/* month */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mdow { font-size: .72rem; color: var(--muted); text-align: center; text-transform: uppercase; padding: .3em 0; }
.mcell { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 6px; min-height: 64px; padding: 3px; cursor: pointer; overflow: hidden; }
.mcell:hover { background: var(--hover); }
.mcell.other { opacity: .45; }
.mcell.today { border-color: var(--accent); }
.mnum { font-weight: 700; font-size: .85rem; display: flex; justify-content: space-between; }
.mnum .count { font-weight: 400; font-size: .7rem; color: var(--muted); }
.mitem { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--kc, var(--accent)); padding-left: 3px; margin-top: 2px; }
.mitem.mine { font-weight: 700; }
.more { font-size: 10px; color: var(--muted); }
.mine-dot { position: absolute; top: 8px; right: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (max-width: 600px) { .mitem { display: none; } .mcell { min-height: 46px; } .mnum .count { display: block; } }

/* ---------------------------------------------------------------- booking / events */
.extras .row { margin: .2em 0; }
.event-sec .staff-list .row { margin: .25em 0; }
.event-sec .lead { font-size: .8rem; color: var(--muted); }
.recur { margin: .3em 0 .6em; }
.summary .plain li { font-size: .92rem; }
.roster h4 { margin: .8em 0 .2em; }
.roster .rgroup { margin: .2em 0; }
.roster ol.names { margin: .2em 0; padding-left: 1.6em; }
.roster .person sup { color: var(--accent); }
.addstaff { margin: .3em 0; }
.notifs { list-style: none; padding: 0; margin: 0; }
.notifs li { border-bottom: 1px solid var(--border); padding: .5em 0; }
.notifs li.read { opacity: .6; }

/* ---------------------------------------------------------------- dispatch, squawks, lessons */
.dispatch-form .card legend { font-weight: 700; color: var(--text); }
.delta { font-variant-numeric: tabular-nums; color: var(--ok); min-width: 4em; }
.delta.bad { color: var(--bad); }
ul.checklist { list-style: none; padding: 0; margin: .3em 0; }
ul.checklist li { padding: .25em 0; border-bottom: 1px dashed var(--border); }
ul.checklist .check { align-items: flex-start; }
ul.checklist input { margin-top: 2px; flex: none; width: 22px; height: 22px; }
ol.timeline { list-style: none; padding: 0; border-left: 2px solid var(--border); margin: .5em 0 .5em .4em; }
ol.timeline li { padding: .2em 0 .5em .8em; position: relative; }
ol.timeline li::before { content: ''; position: absolute; left: -6px; top: .6em; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.chip.sq-open { color: var(--bad); border-color: var(--bad); } .chip.sq-closed { color: var(--ok); border-color: var(--ok); }
.chip.pr-high, .chip.pr-aog { color: var(--bad); }
.syllabus h4 { margin: 1em 0 .3em; color: var(--muted); }
.sitem { display: grid; grid-template-columns: 5.5em 1fr auto auto; gap: .5em; align-items: center; padding: .35em .4em; border-bottom: 1px solid var(--border); }
.sitem.done { background: color-mix(in srgb, var(--ok) 8%, transparent); }
.sitem.started .sk { color: var(--warn); }
.sitem.done .sk { color: var(--ok); }
.sitem .sk { font: 600 11px var(--mono); color: var(--muted); }
.sitem .links { margin-left: .5em; font-size: .75rem; }
.sitem .links a { margin-right: .4em; }
@media (max-width: 600px) { .sitem { grid-template-columns: 1fr auto; } .sitem .sk { display: none; } }
.grades { display: flex; flex-wrap: wrap; gap: .3em; }
.grades button.on { background: var(--accent); color: #04111d; border-color: var(--accent); }
.addcred { margin-top: .6em; }

/* ---------------------------------------------------------------- print */
#print-area { display: none; }
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  #top, #tabs, #toasts, .backdrop, .toolbar, .chips, button, .row.actions { display: none !important; }
  body.printing #main { display: none !important; }
  body.printing #print-area { display: block; }
  #print-area h1 { font-size: 16pt; margin: .2em 0 .5em; }
  #print-area h3 { color: #000; margin-top: 1em; }
  .print-head { font-size: 9pt; border-bottom: 1px solid #000; padding-bottom: 3pt; }
  #print-area table { margin: .4em 0; }
  #print-area table.grid th, #print-area table.grid td { border: 1px solid #000; padding: 3pt 5pt; text-align: left; }
  #print-area table.kv th, #print-area table.kv td { border-bottom: 1px solid #bbb; padding: 3pt 4pt; color: #000; }
  #print-area td.fill-in { min-width: 40mm; }
  #print-area td.box { width: 14mm; }
  #print-area ul.checks { list-style: none; padding: 0; }
  #print-area ul.checks li { padding: 2pt 0; }
  #print-area .box { display: inline-block; width: 11pt; height: 11pt; border: 1px solid #000; margin-right: 6pt; text-align: center; line-height: 11pt; }
  #print-area td.box { display: table-cell; }
  .sigs { display: flex; gap: 10mm; margin-top: 14mm; }
  .sig { flex: 1; font-size: 9pt; }
  .sig .line { border-bottom: 1px solid #000; height: 10mm; }
  .card, .grid-wrap { border: 1px solid #999; break-inside: avoid; background: #fff; }
  #print-area table.grid td { height: 7mm; }
  #print-area table.grid { break-inside: auto; }
  #print-area tr { break-inside: avoid; }
  #print-area thead { display: table-header-group; }
  #print-area .cblock { break-inside: avoid; margin: 2mm 0; }
  #print-area .cblock h4 { margin: 2mm 0 1mm; font-size: 10pt; }
  #print-area .fill-in.line { display: inline-block; width: 55mm; border-bottom: 1px solid #000; height: 6mm; vertical-align: bottom; }
  #print-area div.fill-in { min-height: 14mm; border: 1px solid #000; }
  #print-area ol.pairs-print li { padding: 1.5mm 0; }
  #print-area h3 { break-after: avoid; font-size: 11pt; }
  #print-area .sigs { break-inside: avoid; }
  #print-area tr.total td { border-top: 2px solid #000; }
  #print-area a { color: #000; text-decoration: none; }
  .bk { color: #000 !important; background: #ddd !important; border: 1px solid #000; }
  .night { background: #eee; }
}

.card .row.actions button { min-height: 32px; padding: .3em .65em; font-size: .85rem; }

/* ---------------------------------------------------------------- touch create, keyboard slot cursor */
.gtrack.row { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.gtrack.row.pressing { background-color: color-mix(in srgb, var(--accent) 6%, transparent); }
.ghost.touch { border-style: solid; box-shadow: 0 0 0 2px var(--accent); }
.kcursor { position: absolute; top: 2px; bottom: 2px; border: 2px solid var(--focus); border-radius: 5px; pointer-events: none; z-index: 4; display: none; }
.gtrack.row:focus-visible .kcursor { display: block; }
.gtrack.row:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--focus); }

/* ---------------------------------------------------------------- structured dispatch editors */
.ced { margin: .4em 0 .8em; }
.ced table.list { width: auto; min-width: min(100%, 520px); }
.ced table.list td, .ced table.list th { padding: .3em .35em; vertical-align: middle; }
.ced table.list select { max-width: 11em; }
.ced table.list input[type=text] { width: 7em; }
.ced table.list input, .ced table.list select { min-height: 34px; padding: .25em .4em; }
.ced table.list input[type=number] { width: 6.5em; }
.ced .outv { font-size: .78rem; color: var(--muted); display: block; }
.ced .rowdel { min-height: 30px; }
.pairs .pair { display: flex; flex-wrap: wrap; gap: .35em; align-items: center; padding: .35em 0; border-bottom: 1px dashed var(--border); }
.pairs .pair .pn { font-weight: 700; min-width: 1.8em; color: var(--muted); }
.pairs .unpaired { margin: .4em 0; }
.pairs .unpaired button { border-radius: 999px; min-height: 32px; }
.pairs .unpaired button[aria-pressed=true] { background: var(--accent); color: #04111d; border-color: var(--accent); }
.multi { display: flex; flex-wrap: wrap; gap: .2em 1em; }

/* ---------------------------------------------------------------- logbook / conditions */
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5em; margin: .4em 0; }
.stat { background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius); padding: .45em .6em; }
.stat .v { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.decision { font-weight: 800; letter-spacing: .04em; }
.decision.go { color: var(--ok); } .decision.no_go { color: var(--bad); }
.gn-item { padding: .55em 0; border-bottom: 1px solid var(--border); }
.gn-item:last-child { border-bottom: none; }
.gn-dec { margin: .2em 0; }
.gn-act input { flex: 1 1 12em; min-width: 0; }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* report share bars */
.shares { display: grid; gap: .25em; margin: .3em 0 .8em; max-width: 640px; }
.share { display: grid; grid-template-columns: minmax(6em, 10em) 1fr auto; gap: .6em; align-items: center; font-size: .88rem; }
.share .sb { height: 10px; background: var(--card2); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.share .sb i { display: block; height: 100%; background: var(--accent); }
table.kv.hours th { width: 5.5em; }
table.kv.hours td { display: flex; flex-wrap: wrap; align-items: center; gap: .3em; }
table.kv.hours input[type=time] { width: 8.5em; }

/* ---------------------------------------------------------------- wide tables: own horizontal scroll + hint */
.twrap { position: relative; max-width: 100%; }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.thint { display: none; font-size: .78rem; color: var(--muted); text-align: right; padding: .1em 0 .2em; }
.twrap.wide .thint { display: block; }
.twrap.wide.at-end .thint { visibility: hidden; }
.twrap.wide:not(.at-end)::after { content: ''; position: absolute; top: 1.5em; right: 0; bottom: 0; width: 26px; pointer-events: none;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--text) 16%, transparent)); border-radius: 0 6px 6px 0; }

/* ---------------------------------------------------------------- phones (touch: 44 px targets) */
@media (pointer: coarse) {
  button, .button { min-height: 44px; }
  button.icon { min-width: 44px; min-height: 44px; }
  button.tiny, button.link, .card .row.actions button, .chips button, .pairs .unpaired button, .ced .rowdel { min-height: 44px; }
  button.tiny { min-width: 44px; }
  input, select { min-height: 44px; }
  .ced table.list input, .ced table.list select { min-height: 44px; }
  input.inline { min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  label.check { min-height: 44px; }
  #tabs a { display: flex; align-items: center; min-height: 44px; }
  .brand { min-height: 44px; }
  details > summary { padding: .7em 0; }
  .wx-raw summary { padding: .5em .2em; }
  .bk .join { min-height: 28px; padding: 0 .8em; font-size: 13px; }
  .sitem .links a { display: inline-block; padding: .55em .3em; }
  .datepick input { min-height: 44px; }
}
@media (max-width: 640px) {
  .hint { font-size: .85rem; }
  .small { font-size: .9em; }
  .chip { font-size: .78rem; }
  .tick { font-size: 12px; }
  .glabel.res .rsub, .ggroup .glabel, .wgroup .glabel { font-size: .78rem; }
  .glabel.res .rname { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; font-size: .84rem; }
  ul.issues, .notes, ul.plain.meta li { font-size: .94rem; }
  .brand small { font-size: .78rem; }
  table.list th { font-size: .78rem; }
  .mono { font-size: 13px; }
  .seatbar span { font-size: 12px; }
  #main { padding-left: max(.7em, env(safe-area-inset-left)); padding-right: max(.7em, env(safe-area-inset-right)); }
}
/* the schedule grid scrolls inside its own box on small screens, so the time row and resource column stay pinned */
/* detached sticky time header (sched.js stickyHead) */
.ghead-wrap { position: sticky; top: calc(var(--toph, 49px) + var(--tabsh, 35px)); z-index: 15; overflow: hidden; background: var(--card);
  border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; }
.ghead-wrap + .grid-wrap { border-top-left-radius: 0; border-top-right-radius: 0; }
.ghead-wrap .ghead { position: static; }
.grid.week.ghead-grid { min-width: calc(var(--labelw) + 7 * 92px); }
.glabel.res, .card.res { color: var(--text); }
.ggroup .glabel, .wgroup .glabel { overflow-wrap: normal; letter-spacing: .02em; }
@media (max-width: 640px) {
  /* weather: one swipeable line instead of three */
  .wx-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .wx-strip::-webkit-scrollbar { display: none; }
  .wx-strip > * { flex: none; }
  .wx-raw[open] { flex-basis: auto; white-space: normal; }
}
.ghead .glabel.corner { display: flex; align-items: center; padding: 0 .4em; }
.ghead .glabel.corner .small { font-size: 12px; white-space: nowrap; }
[role=button][aria-busy=true] { opacity: .7; cursor: progress; }
@media (pointer: coarse) {
  button, .button { min-width: 44px; }
  table.list tbody tr[role=button] td { padding-top: .8em; padding-bottom: .8em; }
  .sitem .links a { min-height: 32px; padding: .5em .35em; }
  a.study, .card-head a { display: inline-block; padding: .6em 0; }
}
@media (max-width: 640px) {
  /* toasts drop from the top on phones so they never sit on the action buttons at the bottom of a form / dialog */
  #toasts { bottom: auto; top: calc(var(--toph, 49px) + var(--tabsh, 35px) + 6px); }
  body.logged-out #toasts { top: calc(var(--toph, 49px) + 6px); }
}
@media (pointer: coarse) { table.perms input[type=checkbox] { width: 30px; height: 30px; } table.perms td { padding: .4em .5em; } }
/* row actions in the resource column (Block / Mark me unavailable) stay tappable without tripling the row height */
@media (pointer: coarse) { .glabel.res button.link.tiny { min-height: 32px; font-size: .8rem; padding: 0; } }
@media (pointer: coarse) and (max-width: 640px) { .glabel.res:has(button) .rname { -webkit-line-clamp: 1; } }
.preview.checking { opacity: .55; transition: opacity .2s; }
@media (max-width: 640px) {
  .ced table.list select { max-width: 8em; }
  .ced table.list input[type=number] { width: 5.2em; }
  .ced table.list input[type=text] { width: 6em; }
  .ced table.list td, .ced table.list th { padding: .3em .2em; }
}
@media (pointer: coarse) { main p.small a, main p.hint a { display: inline-block; padding: .65em 0; } }
/* phone in landscape: only the tab bar stays pinned (the header would take a quarter of a 390 px tall screen) */
@media (max-height: 500px) {
  #top { position: relative; }
  #tabs { top: 0; }
  .ghead-wrap { top: var(--tabsh, 35px); }
  #toasts { top: auto; bottom: max(.6em, env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  /* wide lists keep readable columns and scroll sideways instead of wrapping one word per line */
  .tscroll > table.list { width: max-content; min-width: 100%; }
  .tscroll > table.list td, .tscroll > table.list th { max-width: 15em; }
  .ced .tscroll > table.list { width: auto; }
}
