/* Rota Core: "the timetable". Warm stone paper, ink, deep teal and one coral; a literary serif for headings; a clock-face mark.
   Loaded after the suite kit, app.css and identity.css; its tokens replace the notice-board palette. */
:root {
  --ink: #20252d; --ink-soft: #343b47; --muted: #525a68;
  --paper: #f5f2ec; --surface: #ffffff; --rule: #d9d3c7; --rule-soft: #e9e4d9; --field-border: #7b7466;
  --brand: #0f5c63; --brand-deep: #0a4046; --brand-tint: #dcecec;
  --saffron: #d9593d; --saffron-tint: #fbe6df; --saffron-deep: #7a2a17;
}
.logo::before { width: 1.45rem; height: 1.45rem; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fff 0 14%, transparent 15%), conic-gradient(var(--brand) 0 25%, var(--saffron) 0 100%); box-shadow: inset 0 0 0 3px var(--brand); clip-path: none; }
header { border-top-color: var(--saffron); }
.nav-menu a[aria-current="page"] { background: var(--brand-tint); box-shadow: inset 0 -3px 0 var(--brand); }
.page-head::after { background: var(--brand); }

.st { border: 1px solid var(--rule); background: #fff; color: var(--ink); font-weight: 600; }
.st-valid, .st-full { background: #e0f0e4; border-color: #8fc2a0; color: #0e3a28; }
.st-soon, .st-short { background: var(--saffron-tint); border-color: #e8b3a3; color: var(--saffron-deep); }
.st-overdue, .st-open { background: #fbe2de; border-color: #e0988c; color: #6a1d12; }
.st-due, .st-over { background: var(--brand-tint); border-color: #9cc4c7; color: var(--brand-deep); }
.st-waiting { background: #efe9f7; border-color: #c9b9e4; color: #3d2766; }
.st-cancelled { background: #eceae4; color: var(--muted); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.4rem; }
.day { padding: .7rem .6rem; } .day h2 { font-size: 1rem; margin: 0 0 .5rem; color: var(--brand-deep); }
.day-today { outline: 2px solid var(--brand); outline-offset: -2px; }
.shift { border: 1px solid var(--rule); border-radius: 10px; padding: .5rem .55rem; margin-bottom: .5rem; background: var(--paper); font-size: .86rem; }
.shift header { border: 0; background: none; margin-bottom: .2rem; }
.shift.st-open { border-color: #e0988c; background: #fdf1ee; } .shift.st-short { border-color: #e8b3a3; background: #fdf6f3; } .shift.st-cancelled { opacity: .6; text-decoration: line-through; }
.shift .badge { font-size: .7rem; padding: .05rem .4rem; }
.shift li.me { font-weight: 700; }
.shift details summary { cursor: pointer; font-size: .8rem; color: var(--brand-deep); }
.plainlist { list-style: none; margin: 0; padding: 0; } .plainlist li { padding: .12rem 0; }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.num { text-align: right; }
@media (max-width: 70rem) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split2 { grid-template-columns: 1fr; } }
@media (max-width: 40rem) { .week { grid-template-columns: 1fr; } }
@media print { header, footer, .no-print, .demo-bar, details, form { display: none !important; } .week { grid-template-columns: repeat(7, 1fr); font-size: .7rem; } }

.shift li { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .4rem; }
.shift form.inline, .shift .row-actions { display: inline-flex; margin: 0; }
.shift header strong { display: block; } .shift header .muted { display: block; }
.shift .linkbtn { font-size: .78rem; }
.container { max-width: 1240px; }
.stats .stat strong { display: block; font-size: 1.9rem; line-height: 1.1; } .stats .stat span { display: block; }

/* The week as a table: a row per person, a column per day */
.grid-wrap { overflow-x: auto; margin-bottom: 1rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.rgrid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 56rem; font-size: .9rem; }
.rgrid th, .rgrid td { padding: .55rem .6rem; vertical-align: top; text-align: left; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.rgrid th:last-child, .rgrid td:last-child { border-right: 0; }
.rgrid thead th { background: var(--paper); font-weight: 600; position: sticky; top: 0; }
.rgrid tbody tr:last-child th, .rgrid tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.rgrid .rg-name { position: sticky; left: 0; background: var(--surface); min-width: 9rem; font-weight: 600; z-index: 1; }
.rgrid thead .rg-name { background: var(--paper); z-index: 2; }
.rgrid .rg-today { background: #f3f8f6; }
.rgrid .rg-hours { min-width: 6rem; white-space: nowrap; }
.rgrid .rg-me .rg-name { box-shadow: inset 0 -2px 0 var(--brand); }
.rgrid .rg-none { color: var(--muted); }
.rgrid .rg-open td, .rgrid .rg-open th { background: #fdf3ef; }
.rgrid tfoot th, .rgrid tfoot td { border-bottom: 0; background: var(--paper); }
.rg-miss { display: block; font-size: .8rem; margin-top: .15rem; }
.sc { display: block; padding: .35rem .5rem; margin-bottom: .35rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; color: inherit; text-decoration: none; line-height: 1.3; }
.sc:hover, .sc:focus-visible { border-color: var(--brand); }
.sc:last-child { margin-bottom: 0; }
.sc strong { display: block; }
.sc-time { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-words { display: block; margin-top: .2rem; }
.sc-open { border-style: dashed; background: #fff8f5; }
@media print { .rgrid { min-width: 0; font-size: .75rem; } .grid-wrap { border: 0; overflow: visible; } .rgrid .rg-name { position: static; } }

/* ── My day: a member of staff's phone ─────────────────────────────────── */
.day-head { margin: 1rem 0; } .day-head h1 { margin: 0; }
.day-head p { margin: .15rem 0; }
.day-nav { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.day-changes { border-color: #e8b3a3; background: #fff8f5; }
.day-changes li { padding: .3rem 0; }
.nownext { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .75rem; margin-bottom: 1.2rem; }
.nn { display: grid; gap: .1rem; padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.nn-now { background: var(--brand); border-color: var(--brand); color: #fff; }
.nn-k { font-weight: 700; font-size: .85rem; }
.nn-t { font-size: 1.7rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.nn strong { font-size: 1.15rem; }
.day-time { font-size: 1rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.day-shift h3 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--brand-deep); }
.day-note { background: var(--brand-tint); border-radius: 8px; padding: .6rem .75rem; }
.mates { list-style: none; margin: 0; padding: 0; } .mates li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--rule-soft); }
.mates li:first-child { border-top: 0; } .mates li span span { display: block; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .75rem; padding: .85rem 0; border-top: 1px solid var(--rule); scroll-margin-top: 1rem; }
.tl-time { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.35; }
.tl-time span { display: block; font-weight: 500; font-size: .85rem; color: var(--muted); }
.tl-title { margin: 0 0 .25rem; font-size: 1.1rem; }
.tl-now { background: #eef7f6; box-shadow: 0 0 0 .5rem #eef7f6; }
.tl-done .tl-title strong { color: var(--muted); }
.tl-facts { margin: 0; } .tl-facts div { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: .5rem; } .tl-facts dt { color: var(--muted); } .tl-facts dd { margin: 0; }
.tl-details { margin: .4rem 0 0; } .tl-updates { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .92rem; } .tl-updates li { padding: .15rem 0; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .6rem; margin-top: .55rem; }
.tl-actions details { flex: 1 1 12rem; } .tl-actions summary, .day-shift summary, #help summary, #handover summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--brand-deep); font-weight: 600; }
.ho { border: 1px solid var(--rule); border-radius: 10px; padding: .7rem .85rem; } .ho p { margin: .25rem 0; } .ho-new { border-color: #e8b3a3; background: #fff8f5; }
.install-card[hidden] { display: none; }
.shift-acts { margin-top: .35rem; } .shift-acts li { display: block; padding: .3rem 0; border-top: 1px solid var(--rule-soft); } .shift-acts li .muted { display: block; }
#usual summary, #teams summary { cursor: pointer; padding: .55rem 0; }

/* The bar of quick links, on a phone only */
.tabbar { display: none; }
@media (max-width: 48rem) {
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; padding: .3rem; font-size: .88rem; font-weight: 600; line-height: 1.2; color: var(--ink); text-decoration: none; }
  .tabbar a[aria-current="page"] { background: var(--brand-tint); box-shadow: inset 0 3px 0 var(--brand); }
  .tabbar a.tab-call { background: var(--brand); color: #fff; }
  body.has-tabs { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

/* Narrow screens: the week one day at a time, tables as stacked rows, one line of week buttons */
.week-list { display: none; }
@media (max-width: 40rem) {
  .grid-wrap, .grid-hint { display: none; }
  .week-list { display: block; }
  .wl-day { margin-bottom: 1rem; } .wl-day h2 { font-size: 1.1rem; margin: 0 0 .4rem; color: var(--brand-deep); }
  .wl-today h2 { text-decoration: underline; text-underline-offset: .25em; }
  .wl-shift { display: block; padding: .65rem .75rem; margin-bottom: .45rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
  .wl-top { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; } .wl-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
  .wl-who { display: block; margin: .15rem 0; }
  .cta-row.week-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; } .cta-row.week-nav .btn { margin: 0; justify-content: center; text-align: center; font-size: .85rem; padding-left: .3rem; padding-right: .3rem; line-height: 1.2; }
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; min-width: 0; }
  .table.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.stack-sm tr { padding: .7rem .75rem; border-bottom: 1px solid var(--rule); }
  .table.stack-sm tr:last-child { border-bottom: 0; }
  .table.stack-sm td { border: 0; padding: .1rem 0; }
  .table.stack-sm tbody tr:hover td { background: transparent; }
  .table.stack-sm td:empty { display: none; }
  .table.stack-sm td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .table.stack-sm td .btn { margin-top: .35rem; min-height: 44px; }
}
@media print { .tabbar, .week-list { display: none !important; } .grid-wrap { display: block !important; } }

#help .cta-row .btn { height: auto; min-height: 44px; padding-top: .55rem; padding-bottom: .55rem; text-align: center; line-height: 1.3; }

/* ── Cover: gaps, candidates, "I can't make it" and notifications ──────── */
.push-card[hidden], .push-card [hidden], .install-card [hidden] { display: none !important; }   /* button styles would otherwise show them */
.tabs-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.gaps { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.gap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1rem; padding: .7rem .85rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
.gap:hover, .gap:focus-visible { border-color: var(--brand); }
.gap-urgent { border-color: #e0988c; background: #fdf1ee; }
.gap-state { display: flex; flex-wrap: wrap; gap: .3rem; }
a.stat-link { display: block; color: var(--ink); text-decoration: none; }
a.stat-link:hover, a.stat-link:focus-visible { border-color: var(--brand); }
a.stat-link span { text-decoration: underline; text-underline-offset: .2em; }
.cands { list-style: none; margin: 0; padding: 0; }
.cands > li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .8rem 0; border-top: 1px solid var(--rule); }
.cands > li:first-child { border-top: 0; }
.cand-who { flex: 1 1 18rem; } .cand-who p { margin: 0 0 .15rem; }
.cand-problem { color: var(--saffron-deep); }
.cand-act { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.cand-act form { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; } .cand-act input { min-width: 12rem; min-height: 40px; }
.cand-act .btn { min-height: 40px; }
.concern summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--brand-deep); font-weight: 600; }
.cant summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--saffron-deep); font-weight: 600; }
.day-shift .cant { border-top: 1px solid var(--rule); padding-top: .25rem; }
.results li { padding: .45rem 0; border-top: 1px solid var(--rule-soft); } .results li:first-child { border-top: 0; }
details.card > summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; }
@media (max-width: 40rem) { .cand-act, .cand-act form { width: 100%; } .cand-act input { flex: 1 1 100%; } }

/* ── Import, reports and the overview ──────────────────────────────────── */
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .25rem 1rem; }
input[type="file"] { padding: .5rem; width: 100%; }
.rec h2 { font-size: 1.1rem; } .rec h2 .small { font-family: inherit; }
.fire-list { list-style: none; margin: 0; padding: 0; } .fire-list li { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--rule); font-size: 1.1rem; }
.fire-list li span span { display: block; } .tickbox { width: 1.4rem; height: 1.4rem; border: 2px solid var(--ink); border-radius: 4px; flex: none; }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.mini { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: .8rem .9rem .4rem; }
.mini figcaption { font-weight: 600; margin-bottom: .3rem; } .mini svg { width: 100%; height: auto; display: block; }
.mini .bar { fill: var(--brand); } .mini .bar-ahead { fill: #8fbcc0; } .mini .bar-base { stroke: var(--field-border); stroke-width: 1; }
.mini .bar-v { font-size: 12px; fill: var(--ink); } .mini .bar-l { font-size: 11px; fill: var(--muted); }

/* ── Writing the rota ──────────────────────────────────────────────────── */
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; } .checks.wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.undo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.filter { padding-top: .5rem; padding-bottom: .5rem; margin-bottom: 1rem; }
.dayflags { margin-bottom: 1rem; } .dayflags li { padding: .2rem 0; }
.week-more summary { cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; color: var(--brand-deep); font-weight: 600; }
.compact .rgrid { font-size: .8rem; min-width: 44rem; } .compact .rgrid th, .compact .rgrid td { padding: .25rem .35rem; } .compact .sc { padding: .15rem .3rem; margin-bottom: .2rem; } .compact .sc strong { display: inline; }
.mini.hours { margin-bottom: .6rem; } .mini .bar-need { fill: none; stroke: var(--field-border); stroke-width: 1.5; } .mini .bar-short { fill: var(--saffron); }
.figure-big { font-size: 2.4rem; font-weight: 700; line-height: 1.1; margin: 0; }
.month { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.month .m-head { font-weight: 600; font-size: .85rem; } .month li a { display: grid; gap: .15rem; align-content: start; min-height: 6.2rem; height: 100%; padding: .45rem .5rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; }
.month li a:hover, .month li a:focus-visible { border-color: var(--brand); } .month .m-out a { opacity: .55; } .month .m-today a { outline: 2px solid var(--brand); outline-offset: -2px; }
.m-date { font-weight: 700; } .m-dow { display: none; } .m-day { font-size: .78rem; font-weight: 600; color: var(--brand-deep); }
@media (max-width: 40rem) { .month { grid-template-columns: 1fr; } .month .m-head, .month .m-out { display: none; } .month li a { min-height: 0; grid-auto-flow: column; justify-content: start; align-items: center; gap: .5rem; flex-wrap: wrap; } .m-dow { display: inline; } .grid-wrap.show-narrow { display: block; } }
.wall { margin-bottom: 1.5rem; overflow-x: auto; } .wall h2 { font-size: 1.1rem; }
.wall-table { border-collapse: collapse; width: 100%; min-width: 50rem; background: #fff; font-size: .85rem; } .wall-table th, .wall-table td { border: 1px solid #444; padding: .3rem .4rem; vertical-align: top; text-align: left; } .wall-open th, .wall-open td { font-style: italic; }
@media print { @page { size: A4 landscape; margin: 10mm; } .wall { break-inside: avoid; overflow: visible; } .wall-table { min-width: 0; font-size: 8.5pt; } }

/* ── Clocking and timesheets ───────────────────────────────────────────── */
.clock { background: var(--brand-tint); border-radius: 10px; padding: .75rem .85rem; } .clock p { margin: 0 0 .5rem; }
.btn-clock { min-height: 56px; font-size: 1.15rem; min-width: 12rem; }
.cand-act input.short { min-width: 5rem; width: 6rem; }
@media (max-width: 40rem) { .btn-clock { width: 100%; } .cand-act input.short { width: 100%; } }
.ring summary { cursor: pointer; font-size: .88rem; color: var(--brand-deep); min-height: 32px; display: flex; align-items: center; }
.cands .ring form { margin: 0 0 .3rem; }

/* ── Reading settings ──────────────────────────────────────────────────── */
html:has(body.ui-large) { font-size: 118.75%; }
body.ui-large .btn { min-height: 48px; } body.ui-large .tabbar a { min-height: 66px; }
body.ui-contrast { --ink: #000; --ink-soft: #111; --muted: #1d222b; --paper: #fff; --surface: #fff; --rule: #444; --rule-soft: #666; --field-border: #000; --brand: #06383c; --brand-deep: #031f22; --brand-tint: #d4eaea; --saffron: #9c2f13; --saffron-deep: #4d1708; }
body.ui-contrast a { text-decoration: underline; } body.ui-contrast .st { border-width: 2px; }
.shift-msgs { margin-bottom: .25rem; }

/* ── Care at home visits ───────────────────────────────────────────────── */
.visits { list-style: none; margin: 0; padding: 0; } .visits > li { border-top: 1px solid var(--rule); padding: .9rem 0; scroll-margin-top: 1rem; }
.visits p { margin: .2rem 0; } .visit-time { font-size: 1.5rem; font-variant-numeric: tabular-nums; margin-right: .3rem; } .visit-acts { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-top: .4rem; } .visit-acts details { flex: 1 1 12rem; }
.setup-steps { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .5rem; } .setup-steps li.done .gap { opacity: .75; }
.guide-card { border-color: var(--brand); }
.sc[draggable="true"] { cursor: grab; }
.shift .ring { width: 100%; } .shift .ring form { margin: .4rem 0; display: grid; gap: .3rem; } .shift .ring select, .shift .ring input { width: 100%; min-width: 0; }

/* ── Menu: the less used places under "More" ── */
.nav-more { position: relative; }
.nav-group > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .4rem .6rem; border-radius: 999px; font-size: .92rem; color: var(--ink-soft); user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: .4rem; height: .4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-.12rem) rotate(45deg); }
.nav-group > summary:hover, .nav-group[open] > summary { background: var(--brand-tint); color: var(--brand-deep); }
.nav-group.is-current > summary { background: var(--saffron-tint); color: var(--ink); font-weight: 600; }
.nav-sub { list-style: none; margin: 0; padding: .3rem; position: absolute; right: 0; top: calc(100% + .2rem); z-index: 30; min-width: 13rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 10px 28px rgba(26, 32, 36, .14); }
.nav-sub a { display: block; }
@media (max-width: 64rem) { .nav-more { width: 100%; } .nav-sub { position: static; box-shadow: none; border: 0; padding: 0 0 0 .8rem; background: transparent; } }

/* ── My day: what is waiting, overnight shifts and finished ones ── */
.day-look { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); padding: .6rem .9rem; margin-bottom: 1rem; }
.day-look-h { font-weight: 700; margin: 0; }
.day-look ul { list-style: none; margin: 0; padding: 0; }
.day-look a { display: block; min-height: 44px; padding: .65rem 0; border-top: 1px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-glance { margin: 0 0 1rem; }
.day-glance a, .day-glance > span { display: block; font-size: 1.08rem; }
.day-glance > a { min-height: 48px; padding: .7rem .9rem; border: 2px solid var(--brand); border-radius: 10px; background: var(--surface); text-decoration: none; margin-bottom: .4rem; }
[id^="sh"] { scroll-margin-top: 1rem; }
.day-overnight { font-weight: 600; }
.day-done { margin-bottom: 1rem; }
.day-done > summary { cursor: pointer; min-height: 48px; padding: .75rem .9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); color: var(--ink-soft); font-weight: 600; }
.day-done[open] > summary { margin-bottom: .6rem; }
#changes, [id^="notice-"], [id^="read-"], #handover { scroll-margin-top: 1rem; }

/* ── Week page: the rota starts near the top ── */
.week-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.5rem; margin: .1rem 0 .4rem; }
.week-title h1 { font-size: 1.6rem; margin: 0; } .week-title h1 span { font-weight: 400; color: var(--muted); font-size: 1.15rem; white-space: nowrap; }
.week-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; } .week-title p { margin: 0; }
.week-tools .btn { min-height: 40px; padding: .35rem .7rem; font-size: .86rem; }
@media (pointer: coarse) { .week-tools .btn { min-height: 44px; } }
.week-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .8rem; }
.week-tools .cta-row { margin: 0; }
.week-crumbs { margin: 0; font-size: .85rem; }
.week-needs { margin: 0 0 .4rem; font-size: .92rem; }
main:has(.week-head) { padding-top: 1rem; }
main:has(.week-head) .filter { margin: 0 0 .2rem; padding: 0; border: 0; background: transparent; box-shadow: none; }
main:has(.week-head) .filter summary { min-height: 36px; display: inline-flex; align-items: center; font-size: .9rem; }
main:has(.week-head) .filter[open] { padding: .5rem .9rem .9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
main:has(.week-head) .dayflags { margin-bottom: .4rem; } main:has(.week-head) .dayflags li { padding: 0; }
main:has(.week-head) .undo-bar { margin-bottom: .4rem; }

/* ── Day by day: fewer, wider columns ── */
.week { grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); }
.shift .plainlist > li { padding: .35rem 0; border-top: 1px solid var(--rule); }
.shift .plainlist > li > form.inline { display: inline-block; margin-left: .6rem; }
.shift .plainlist > li > details.ring { display: inline-block; margin-left: .3rem; vertical-align: top; }
.shift .plainlist > li > details.ring[open] { display: block; margin-left: 0; }
@media (max-width: 40rem) { .week { grid-template-columns: 1fr; } }


@media print { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

/* ── The planning board ── */
.board-help { margin: 0 0 .8rem; padding: .7rem .9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); font-size: .95rem; }
.board-help[hidden] { display: none; } .board-help p { margin: 0; } .board-help p + p { margin-top: .35rem; }
.board .sc-done { background: #f1efea; border-color: #dedad1; color: #5f5b52; cursor: default; }
.board td.rg-past { background: #faf8f3; }
.board.bd-holding td[data-day]:not(.bd-t), .board.bd-holding td[data-open-day]:not(.bd-t) { opacity: .45; }
.board.bd-holding .cell-add { visibility: hidden; }
main:has(.board) > .container { max-width: 96rem; }
.board .rgrid th, .board .rgrid td { padding: .4rem .45rem; }
.board .sc { font-size: .84rem; padding: .25rem .4rem; margin-bottom: .25rem; }
.board td[data-person] { position: relative; min-width: 6.8rem; }
.board .rg-hours { min-width: 7rem; }
.cell-add { display: none; }
.js-board .cell-add { display: block; width: 100%; min-height: 44px; margin-top: .2rem; padding: 0; border: 1px dashed transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer; opacity: 0; }
.js-board td:hover .cell-add, .js-board .cell-add:focus-visible { opacity: 1; border-color: var(--field-border); }
.js-board .cell-add:hover { background: var(--brand-tint); color: var(--brand-deep); }
.js-board td:not(:has(.sc)):not(.rg-past) .cell-add { opacity: .55; border-color: var(--rule); }
.js-board td:not(:has(.sc)):hover .cell-add, .js-board td:not(:has(.sc)) .cell-add:focus-visible { opacity: 1; }
@media (hover: none) { .js-board .cell-add { opacity: 1; border-color: var(--rule); min-height: 44px; } }
.sc.bd-held { outline: 3px solid var(--ink); outline-offset: 1px; }
.rgrid td.bd-t { cursor: pointer; box-shadow: inset 0 0 0 2px var(--bd, var(--rule)); background: var(--bd-bg, var(--surface)); }
.rgrid td.bd-t:focus-visible { outline: 3px solid var(--ink); outline-offset: -5px; }
.rgrid td.bd-over { box-shadow: inset 0 0 0 4px var(--bd, var(--ink)); }
.bd-ok { --bd: #1f7a4d; --bd-bg: #eaf6ef; }
.bd-warn { --bd: #9a6400; --bd-bg: #fdf3dc; }
.bd-choose { --bd: #1d5f8a; --bd-bg: #e9f2f8; }
.bd-off { --bd: #5a5f63; --bd-bg: #f1f1ef; }
.bd-extra { --bd: #6d7f8c; --bd-bg: #fbfcfc; }
.bd-no { --bd: #c9c5bd; --bd-bg: #efede8; }
.rgrid td.bd-no { cursor: not-allowed; box-shadow: inset 0 0 0 1px var(--bd); }
.rgrid td.bd-no .sc { opacity: .75; }
.bd-mark { position: absolute; top: 3px; right: 3px; z-index: 2; padding: .05rem .35rem; border: 1.5px solid var(--bd, var(--ink)); border-radius: 6px; background: var(--surface); font-size: .72rem; font-weight: 700; line-height: 1.35; color: var(--bd, var(--ink)); pointer-events: none; }
.rgrid td[data-open-day] { position: relative; }
.bd-no .bd-mark { color: #5c5850; }
.board-bar { position: fixed; left: 50%; transform: translateX(-50%); width: min(60rem, calc(100vw - 1.2rem)); bottom: .6rem; z-index: 25; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .8rem 1rem; border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); box-shadow: 0 10px 30px rgba(26, 32, 36, .28); }
.board-bar[hidden] { display: none; }
.bb-body { flex: 1 1 18rem; } .board-bar p { margin: 0; } .bb-what { font-weight: 700; font-size: 1.1rem; } .bb-what:empty { display: none; }
.board-bar .bb-now { margin-top: .35rem; font-weight: 600; } .bb-now:empty { display: none; }
.bb-key { display: flex; flex-wrap: wrap; gap: .4rem; margin: .45rem 0 0; padding: 0; list-style: none; font-size: .8rem; font-weight: 600; }
.bb-key li { padding: .05rem .5rem; border: 2px solid var(--bd); border-radius: 6px; background: var(--bd-bg); }
@media (max-width: 40rem) { body.has-tabs .board-bar { bottom: 4.4rem; } .bb-key { display: none; } }
.board-bar:has(.bb-now:not(:empty)) #board-bar-text { display: none; }   /* once a square is pointed at, say only what would happen there */
.board-bar.bar-drag { pointer-events: none; left: auto; right: .6rem; transform: none; width: min(34rem, calc(100vw - 1.2rem)); } .board-bar.bar-drag button { display: none; }
@media (max-width: 40rem) { .bb-what { font-size: 1rem; } .board-bar { font-size: .9rem; padding: .6rem .8rem; } }
body.bd-picking { padding-bottom: 11rem; }
.board-add { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.2rem; }
.board-add label { font-weight: 600; } .board-add select { max-width: 22rem; }
.board-dialog { width: min(32rem, calc(100vw - 2rem)); max-height: 85vh; padding: 1.1rem 1.2rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink); }
.board-dialog::backdrop { background: rgba(26, 32, 36, .45); }
.board-dialog h2 { margin: 0 0 .6rem; font-size: 1.2rem; }
.board-dialog .cta-row { position: sticky; bottom: -1.1rem; margin: .9rem -1.2rem -1.1rem; padding: .7rem 1.2rem; background: var(--surface); border-top: 1px solid var(--rule); }
.board-dialog input[type="text"] { width: 100%; }
.guide-how { margin: 0; } .guide-how dt { font-weight: 700; margin-top: .6rem; } .guide-how dd { margin: .1rem 0 0; }
.bd-why { margin: .25rem 0 .5rem; padding-left: 1.1rem; font-size: .92rem; }
.bd-error { color: #a12b1c; font-weight: 600; margin: 0; }
.bd-choices { list-style: none; margin: 0; padding: 0; }
.bd-choices li { margin-bottom: .5rem; }
.bd-choice { display: flex; gap: .6rem; align-items: baseline; width: 100%; min-height: 44px; padding: .5rem .7rem; text-align: left; font: inherit; color: inherit; border: 2px solid var(--bd); border-radius: 8px; background: var(--bd-bg); cursor: pointer; }
.bd-choice:disabled { cursor: not-allowed; opacity: .75; }
.bd-choice .bd-tag { font-weight: 700; color: var(--bd); min-width: 3rem; } .bd-choice.bd-no .bd-tag { color: #5c5850; }
body.bd-busy { cursor: progress; } body.bd-busy [data-board] { opacity: .6; }
@media (max-width: 40rem) {
  .grid-wrap.board { display: block; }
  .grid-wrap.board .rgrid { min-width: 52rem; font-size: .82rem; }
  .board .rgrid .rg-name { min-width: 6.5rem; max-width: 7.5rem; }
}
@media print { .cell-add, .board-bar, .board-add { display: none !important; } }


.week-skills { margin: 0 0 .5rem; font-size: .92rem; } .week-skills summary { cursor: pointer; min-height: 36px; }

/* ── Fill the week ── */
.fill-opts { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem 1.25rem; border-top: 1px solid var(--rule); padding-top: .6rem; }
.fill-opts .check, .fill-opts .cta-row { margin: 0; }
#away h3 { margin-top: 1.1rem; }
.fill-list li { display: block; padding: .6rem 0; border-top: 1px solid var(--rule); }
.fill-list label { display: block; margin-bottom: .25rem; }
.fill-who { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; }
.fill-who select { max-width: 26rem; flex: 1 1 14rem; }
.fill-list p { margin: .25rem 0 0; }

/* ── Today and tonight ── */
.tn-head { margin-bottom: .8rem; }
.tn-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.tn-team { display: flex; gap: .4rem; margin: 0; align-items: center; } .tn-team select { min-height: 40px; width: 13rem; max-width: 46vw; }
.tn-tools .btn, .need-do .btn, .mates .btn { min-height: 40px; }
@media (pointer: coarse) { .tn-tools .btn, .need-do .btn, .mates .btn, .tn-team select { min-height: 44px; } }
@media (max-width: 40rem) { .tn-print { display: none; } .tn-team select { width: 9.5rem; } }
.tn-call { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0 0 1.5rem; }
.tn-block { margin-bottom: 1.75rem; } .tn-block h2 { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.tn-count { font-family: var(--font-body); font-size: .85rem; font-weight: 600; min-width: 1.7rem; text-align: center; padding: .1rem .45rem; border-radius: 999px; background: var(--rule-soft); border: 1px solid var(--rule); }
.tn-clear { padding: .9rem 1rem; border: 1px solid #8fc2a0; background: #e9f4ec; border-radius: 10px; }
/* One list in time order: when, what, what to do. */
.needs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.need { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: start; padding: .8rem 1rem; }
.need + .need { border-top: 1px solid var(--rule-soft); }
.need-when { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.need h3 { margin: 0; font-family: var(--font-body); font-size: 1.02rem; font-weight: 600; }
.need-what p { margin: .1rem 0 0; } .need-sub { font-size: .9rem; color: var(--ink-soft); }
.need-do { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; max-width: 18rem; }
@media (max-width: 44rem) { .need { grid-template-columns: minmax(0, 1fr); } .need-do { justify-content: flex-start; max-width: none; margin-top: .3rem; } }
/* A team: the next day in stretches, then who is on each shift. */
.tn-team-card { scroll-margin-top: 1rem; }
.tn-team-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; } .tn-team-head h2, .tn-team-head p { margin: 0; } .tn-team-head a { margin-left: auto; }
.tn-note { margin: 0; padding: .6rem .8rem; background: var(--paper); border-radius: 8px; }
.strip { list-style: none; margin: .75rem 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .4rem; }
.strip li { display: grid; align-content: start; gap: .1rem; padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: 8px; font-size: .88rem; }
.strip-ok { background: #e9f4ec; border-color: #8fc2a0; }
.strip-bad { background: var(--saffron-tint); border-color: #d98a75; color: var(--saffron-deep); }
.strip-none { background: var(--paper); border-style: dashed; }
.strip-day { font-size: .76rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.strip-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-num strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
/* On a phone each stretch is two short lines, not a tall box. */
@media (max-width: 40rem) { .strip { grid-template-columns: minmax(0, 1fr); } .strip li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .05rem .7rem; } .strip-num strong { font-size: 1.05rem; } }
.tn-shifts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: .25rem 1.75rem; }
.tn-shifts > li { padding-top: .6rem; border-top: 2px solid var(--rule); }
.tn-shift-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; } .tn-shift-head h3 { margin: 0; font-size: 1.05rem; } .tn-span { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: .92rem; }
.mates li > span > span.tn-name { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; }
.tn-empty { color: var(--saffron-deep); }
.tn-changes { margin-top: 1rem; }
@media print { .tn-changes { display: none !important; } .strip { grid-template-columns: repeat(4, 1fr); } .need { grid-template-columns: 6rem minmax(0, 1fr) auto; break-inside: avoid; } .tn-shifts > li { break-inside: avoid; } }
/* Sign-off warnings: the equipment once, then its times. */
.signoff-item { margin: .35rem 0 .25rem; } .signoff-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: .15rem 1.5rem; margin: 0 0 .75rem; }
/* Paired form fields: side by side where there is room, with space between them either way. */
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); gap: .75rem 1.25rem; align-items: end; margin-bottom: 1rem; }
.row2:has(> .form-group > :is(p, small, .hint)) { align-items: start; } /* helper text under one field must not push its neighbour down */

/* Touch targets: buttons, fields and links that act like buttons are at least 44px tall, so a thumb can hit them */
.btn, button, input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea,
.cand-act input, .cand-act .btn, .week-tools .btn, .tn-tools .btn, .need-do .btn, .mates .btn, .tn-team select, details.card > summary, .week-more summary { min-height: 44px; }
/* Days outside the month are shown quieter by colour, not by fading the text (fading dropped the contrast under 4.5:1) */
.month .m-out a { opacity: 1; }
.month .m-out .m-date, .month .m-out .m-day, .month .m-out .m-dow { color: #565a5e; }

/* Small screens: nothing may push the page wider than the screen; hidden labels inside a scroller are clipped by it, not by the page. */
.table-wrap, .grid-wrap { position: relative; }
.card, section, .table-wrap, .grid-wrap { min-width: 0; max-width: 100%; }
select, input, textarea { max-width: 100%; }
.cell-add { min-height: 44px; }
#badd, .board-add select, .board-bar select { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; }
select[id^="pk"] { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; }
