/* Support Roster – mobile-first, accessible styles (WCAG 2.1 AA).
 *
 * Colour comes from CSS custom properties. The organisation's accent is served
 * by /branding.css (Branding settings; it sets --primary, --primary-dark,
 * --on-primary, --primary-text, --primary-soft, --primary-soft-border); the
 * values below are the fallbacks and the per-user Green / Purple themes.
 * The per-user High contrast theme switches gradients and shadows off and
 * uses black text and borders everywhere. */

:root {
  --primary: #1d4ed8;
  --primary-dark: #1840b1;
  --on-primary: #ffffff;
  --primary-text: #1d4ed8;          /* links and outlined buttons: at least 4.5:1 on light surfaces */
  --primary-soft: #eef2fc;          /* 8% tint of the accent for hover and selected states */
  --primary-soft-border: #a5b8ef;
  --accent: #b45309;                /* attention colour: badges, "publish" buttons */
  --bg: #eef2f7;
  --bg-top: #f8fafc;
  --surface: #ffffff;
  --text: #1b1f27;
  --muted: #4b5563;
  --border: #d5dae3;
  --border-strong: #b9c0cc;
  --focus: #f59e0b;
  --danger: #b91c1c;
  --ok-bg: #f0fdf4;  --ok-border: #15803d;  --ok-text: #14532d;
  --bad-bg: #fef2f2; --bad-border: #b91c1c; --bad-text: #7f1d1d;
  --draft-bg: #f3f4f6; --draft-border: #6b7280; --draft-text: #374151;
  --unavail-bg: #f3f4f6; --unavail-stripe: #9ca3af; --unavail-border: #4b5563; --unavail-text: #1f2937;
  --pending-bg: #fffbeb; --pending-border: #b45309; --pending-text: #78350f;
  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 14px rgba(16, 24, 40, 0.07);
  --header-gradient: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%);
  --button-gradient: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  --page-gradient: linear-gradient(180deg, var(--bg-top) 0, var(--bg) 360px);
  --sidebar-width: 250px;
}
body.theme-green  { --primary: #047857; --primary-dark: #05634a; --on-primary: #ffffff; --primary-text: #047857; --primary-soft: #ecf8f3; --primary-soft-border: #9fd3c0; --accent: #9a3412; }
body.theme-purple { --primary: #6d28d9; --primary-dark: #5a21b3; --on-primary: #ffffff; --primary-text: #6d28d9; --primary-soft: #f2edfc; --primary-soft-border: #c4ace9; --accent: #b45309; }
body.high-contrast {
  --bg: #ffffff; --bg-top: #ffffff; --surface: #ffffff; --text: #000000; --muted: #000000; --border: #000000; --border-strong: #000000;
  --primary: #0000c8; --primary-dark: #000080; --on-primary: #ffffff; --primary-text: #0000c8; --primary-soft: #ffffff; --primary-soft-border: #000000;
  --accent: #7a2e00; --danger: #a00000;
  --ok-bg: #ffffff; --ok-border: #006400; --ok-text: #003300;
  --bad-bg: #ffffff; --bad-border: #c00000; --bad-text: #600000;
  --draft-bg: #ffffff; --draft-border: #000000; --draft-text: #000000;
  --unavail-bg: #ffffff; --unavail-stripe: #000000; --unavail-border: #000000; --unavail-text: #000000;
  --pending-bg: #ffffff; --pending-border: #7a2e00; --pending-text: #000000;
  --shadow-sm: none; --shadow: none;
  --header-gradient: none; --button-gradient: none; --page-gradient: none;
}

* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background-color: var(--bg); background-image: var(--page-gradient); background-repeat: no-repeat; color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5; font-size: 1rem; min-height: 100vh;
}
body.text-large { font-size: 1.2rem; }
body.text-xlarge { font-size: 1.45rem; }

a { color: var(--primary-text); text-decoration-thickness: 1px; text-underline-offset: 0.12em; }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.7em; margin: 0.5em 0 0.6em; line-height: 1.2; letter-spacing: -0.01em; font-weight: 750; }
h2 { font-size: 1.25em; margin: 0 0 0.5em; font-weight: 700; }
h3 { font-size: 1.05em; margin: 1em 0 0.3em; font-weight: 700; }
p { margin: 0.5em 0; }
code { background: rgba(0,0,0,0.06); padding: 0.1em 0.3em; border-radius: 4px; font-size: 0.95em; }
body.high-contrast code { background: #fff; border: 1px solid #000; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--text); padding: 0.5em 1em; z-index: 100; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip-link:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header and navigation. The same markup is a top bar, a collapsible phone menu, or (per-user setting) a left sidebar. */
.site-header { background-color: var(--primary); background-image: var(--header-gradient); color: var(--on-primary); box-shadow: var(--shadow-sm); }
body.high-contrast .site-header { border-bottom: 3px solid #000; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--on-primary); font-weight: 750; text-decoration: none; font-size: 1.15em; padding: 0.5em 0; letter-spacing: -0.01em; }
.brand:hover { color: var(--on-primary); }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,0.92); padding: 3px; }
.nav-toggle { display: none; background: rgba(255,255,255,0.1); color: var(--on-primary); border: 2px solid var(--on-primary); border-radius: var(--radius-sm); padding: 0.4em 0.9em; min-height: var(--tap); font: inherit; font-weight: 600; cursor: pointer; }
.nav-toggle[aria-expanded="true"] { background: var(--on-primary); color: var(--primary); }
.site-nav { display: flex; width: 100%; flex-direction: column; padding-bottom: 0.5rem; gap: 0.1rem; }
.site-nav a, .site-nav .link-button { color: var(--on-primary); text-decoration: none; padding: 0.7em 0.75em; min-height: var(--tap); display: flex; align-items: center; border-radius: var(--radius-sm); font: inherit; font-weight: 500; }
.site-nav a[aria-current="page"] { background: rgba(255,255,255,0.2); font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }
.site-nav a:hover, .site-nav .link-button:hover { background: rgba(255,255,255,0.14); color: var(--on-primary); }
body.high-contrast .site-nav a[aria-current="page"] { background: #fff; color: #000; }
body.high-contrast .site-nav a:hover, body.high-contrast .site-nav .link-button:hover { background: #fff; color: #000; }
.link-button { background: none; border: 0; cursor: pointer; color: inherit; width: 100%; text-align: left; }
/* With JavaScript the phone menu collapses behind the Menu button; without it the list is simply visible. */
html.js .nav-toggle { display: inline-flex; align-items: center; }
html.js .site-nav { display: none; }
html.js .site-nav.open { display: flex; }
@media (min-width: 800px) {
  html.js .nav-toggle, .nav-toggle { display: none; }
  .site-nav, html.js .site-nav { display: flex; flex-direction: row; flex-wrap: wrap; width: auto; align-items: center; gap: 0.1rem; padding: 0; }
  .site-nav a, .site-nav .link-button { padding: 0.6em 0.65em; }
  .link-button { width: auto; }
}
.site-footer { margin: 2rem auto 1.25rem; color: var(--muted); font-size: 0.9em; }
.site-footer .footer-org { font-weight: 600; }
main { padding-bottom: 1rem; }

/* Left sidebar (Settings → Menu position → Down the left side), desktop and tablet widths only. */
@media (min-width: 800px) {
  body.menu-left { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); grid-template-rows: 1fr auto; align-items: start; }
  body.menu-left .site-header { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; overflow-y: auto; box-shadow: var(--shadow); }
  body.menu-left .header-inner { flex-direction: column; align-items: stretch; justify-content: flex-start; max-width: none; padding: 1rem 0.9rem; gap: 0.75rem; }
  body.menu-left .brand { font-size: 1.2em; padding: 0.4em 0.25em; }
  body.menu-left .site-nav, html.js body.menu-left .site-nav { flex-direction: column; align-items: stretch; width: 100%; gap: 0.15rem; }
  body.menu-left .site-nav a, body.menu-left .site-nav .link-button { width: 100%; padding: 0.65em 0.8em; }
  body.menu-left .site-nav .inline-form { margin-top: 0.5rem; border-top: 1px solid rgba(255,255,255,0.3); padding-top: 0.5rem; }
  body.menu-left main { grid-column: 2; grid-row: 1; width: 100%; max-width: 1180px; margin: 0; padding: 0 1.5rem; }
  body.menu-left .site-footer { grid-column: 2; grid-row: 2; width: 100%; margin: 1rem 0 1.25rem; padding: 0 1.5rem; }
  body.menu-left.high-contrast .site-header { border-bottom: 0; border-right: 3px solid #000; }
}

/* Cards and layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.15rem; margin: 0 0 1rem; box-shadow: var(--shadow-sm); }
.card.narrow { max-width: 480px; margin: 1.5rem auto; }
.card.highlight { border: 2px solid var(--accent); }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.stack > * + * { margin-top: 0.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }
.actions form { display: inline; }
.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 0; }
.dl dt { font-weight: 600; color: var(--muted); } .dl dd { margin: 0; }
body.high-contrast .dl dt { color: #000; }
@media (max-width: 480px) { .dl { grid-template-columns: 1fr; } .dl dt { margin-top: 0.4rem; } }
ul.compact { padding-left: 1.2rem; margin: 0.3rem 0; } ul.compact li { margin: 0.15rem 0; }

/* Buttons and forms: large tap targets */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0.5em 1.1em; border-radius: var(--radius-sm); border: 2px solid var(--primary); background: var(--surface); color: var(--primary-text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn-primary { background-color: var(--primary); background-image: var(--button-gradient); color: var(--on-primary); border-color: var(--primary-dark); }
.btn-primary:hover { background-color: var(--primary-dark); background-image: none; color: var(--on-primary); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { color: #fff; filter: brightness(0.9); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fff1f1; color: var(--danger); }
body.high-contrast .btn-danger:hover { background: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.form-row { margin: 0 0 0.9rem; }
label, .label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="search"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%; min-height: var(--tap); font: inherit; padding: 0.5em 0.7em; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); }
input[type="file"] { font: inherit; }
input[type="color"] { width: 3.5em; height: var(--tap); padding: 0.15em; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
textarea { min-height: 5em; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-weight: 600; margin: 0.25rem 0 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1.1rem 0.5rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 0.4em; font-size: 1.05em; }
.check { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; min-height: var(--tap); cursor: pointer; }
.check input { width: 1.4em; height: 1.4em; margin: 0; flex: none; accent-color: var(--primary); }
.check-grid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .check-grid { grid-template-columns: 1fr 1fr; } .check-grid.days { grid-template-columns: repeat(4, 1fr); } }
.code-input { font-size: 1.6em; letter-spacing: 0.25em; text-align: center; max-width: 12em; }
.code-display { background: rgba(0,0,0,0.05); padding: 0.6rem; border-radius: var(--radius-sm); word-break: break-all; }
.code-display code { background: none; font-size: 1.1em; }
.code-display.small code { font-size: 0.85em; }
.inline-form select, .inline-form input { width: auto; }
/* Shift form: the location field with its "Use client's home" button beside it (stacked on narrow screens). */
.input-with-button { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }
.input-with-button input { flex: 1 1 14em; width: auto; }
.input-with-button .btn { flex: 0 0 auto; }
.location-hint { margin: 0.3rem 0 0; min-height: 0; }
.location-hint:empty { display: none; }
.filter-form { margin-bottom: 1rem; }
.colour-row { display: flex; align-items: center; gap: 0.75rem; }
.contrast-ok { color: var(--ok-text); font-weight: 600; }
.contrast-warn { color: var(--bad-text); font-weight: 600; }
.logo-preview { display: flex; align-items: center; gap: 0.6rem; margin: 0.25rem 0 0.6rem; }
.logo-preview img { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 4px; }

/* Flash messages */
.flash { padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin: 0.75rem 0; border: 1px solid; border-left-width: 6px; box-shadow: var(--shadow-sm); }
.flash-success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.flash-error { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }
.flash-info { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
body.high-contrast .flash { border-width: 2px; border-left-width: 8px; }
body.high-contrast .flash-info { background: #fff; color: #000; }

/* Stats */
.stat-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.5rem 0 1rem; }
.stat { flex: 1 1 140px; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: var(--radius); padding: 0.8rem 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; min-height: var(--tap); box-shadow: var(--shadow-sm); }
a.stat:hover { border-color: var(--primary-soft-border); border-left-color: var(--primary); background: var(--primary-soft); }
.stat-value { font-size: 1.9em; font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); }
.stat-bad { border-left-color: var(--danger); }
.stat-bad .stat-value { color: var(--danger); }

/* Lists */
.card-list { list-style: none; padding: 0; margin: 0; }
.card-list-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.5rem; box-shadow: var(--shadow-sm); }
.card-list-item.inactive { opacity: 0.7; }
.card-link { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.8rem 1rem; text-decoration: none; color: var(--text); min-height: var(--tap); border-radius: var(--radius-sm); }
.card-link:hover { background: var(--primary-soft); }
/* Shift lists and roster cards: a light tint plus a strong coloured edge carries the status (green published,
   red conflict, grey draft); the dashed border, the "!" flag and the hidden text carry it without colour. */
.shift-list { list-style: none; padding: 0; margin: 0; }
.shift-list li { border-left: 6px solid var(--draft-border); background: var(--surface); border-radius: var(--radius-sm); margin-bottom: 0.5rem; border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.shift-list li a { display: flex; flex-direction: column; padding: 0.7rem 1rem; text-decoration: none; color: var(--text); min-height: var(--tap); }
.shift-list li.shift-ok { border-left-color: var(--ok-border); background: var(--ok-bg); }
.shift-list li.shift-conflict { border-left-color: var(--bad-border); background: var(--bad-bg); }
.shift-list li.shift-draft { border-left-color: var(--draft-border); border-left-style: dashed; background: var(--draft-bg); }
.shift-when { font-weight: 600; }
.badge { display: inline-block; font-size: 0.78em; font-weight: 700; padding: 0.1em 0.6em; border-radius: 999px; background: var(--draft-bg); color: var(--draft-text); border: 1px solid var(--draft-border); vertical-align: middle; }
.badge-published, .badge-approved { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.badge-cancelled, .badge-declined { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-border); }
.badge-pending { background: var(--pending-bg); color: var(--pending-text); border-color: var(--pending-border); }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5em; height: 1.5em; margin-left: 0.4em; padding: 0 0.4em; border-radius: 999px; background: #fff; color: var(--accent); font-size: 0.8em; font-weight: 800; }
body.high-contrast .nav-badge { background: #fff; color: #000; border: 2px solid #000; }

/* Unavailability conflict warnings */
.conflict-box { background: var(--bad-bg); border: 2px solid var(--bad-border); border-left-width: 8px; border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0.75rem 0; color: var(--text); }
.conflict-box h2 { color: var(--bad-text); font-size: 1.1em; margin-bottom: 0.4rem; }
.decision input[type="text"] { min-width: 12em; }
.offline-badge { background: var(--pending-bg); border-color: var(--pending-border); color: var(--pending-text); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { background: var(--draft-bg); font-size: 0.9em; letter-spacing: 0.01em; color: var(--muted); border-bottom: 2px solid var(--border-strong); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--primary-soft); }
.table tr.inactive { opacity: 0.65; }
body.high-contrast .table thead th { background: #fff; color: #000; }
body.high-contrast .table tbody tr:hover td { background: #fff; }

/* Week calendar: stacked on phones, 7 columns on wide screens */
.week-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.9em; }
.legend-item { padding: 0.2em 0.6em; border-radius: 6px; border: 1px solid; border-left-width: 6px; }
.legend-item.shift-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.legend-item.shift-conflict { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }
.legend-item.shift-draft { background: var(--draft-bg); border-color: var(--draft-border); border-left-style: dashed; color: var(--draft-text); }
.legend-item.unavail-band { color: var(--unavail-text); }

/* Unavailability / away markers: grey hatched band, distinct from the dashed grey draft card */
.unavail-band, .legend-item.unavail-band {
  background: repeating-linear-gradient(135deg, var(--unavail-bg) 0 6px, var(--unavail-stripe) 6px 8px);
  border: 2px solid var(--unavail-border); color: var(--unavail-text);
}
.unavail-band { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.4rem 0.6rem; margin-bottom: 0.4rem; border-radius: var(--radius-sm); text-decoration: none; min-height: var(--tap); font-size: 0.9em; }
.unavail-band .band-name, .unavail-band .band-time { font-weight: 700; }
.unavail-band .band-text { font-size: 0.9em; }
.unavail-band.pending, .legend-item.unavail-band.pending {
  background: repeating-linear-gradient(135deg, var(--pending-bg) 0 6px, #fde68a 6px 8px);
  border-style: dotted; border-color: var(--pending-border); color: var(--pending-text); opacity: 0.9;
}
body.high-contrast .unavail-band.pending, body.high-contrast .legend-item.unavail-band.pending { background: #fff; }
.unavail-band span, .legend-item.unavail-band { background-color: rgba(255,255,255,0.75); border-radius: 3px; padding: 0 0.15em; align-self: flex-start; }
.legend-item.unavail-band { background-color: transparent; border-left-width: 2px; }
/* A window that spans days: the first day's band runs on to the right edge, middle days are square, the last day runs in from the left. */
.unavail-band.part-start { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.unavail-band.part-whole { border-radius: 0; border-left-style: dashed; border-right-style: dashed; }
.unavail-band.part-end { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.unavail-band.part-start .band-time::after { content: " \2192"; }
.unavail-band.part-end .band-time::before { content: "\2190 "; }

/* Start/end date + time pickers on unavailability and away forms */
.date-time { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.date-time input[type="date"] { flex: 1 1 11em; }
.date-time input[type="time"] { flex: 0 1 8em; }
.when-preview { min-height: 1.5em; font-weight: 600; }
.shift-reason { font-size: 0.85em; color: var(--bad-text); font-weight: 600; }
.week-grid { display: grid; grid-template-columns: 1fr; gap: 0.6rem; margin-top: 0.75rem; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.55rem; min-height: 3rem; box-shadow: var(--shadow-sm); }
.day.today { border: 2px solid var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.day-head { font-size: 1em; margin: 0 0 0.45rem; display: flex; gap: 0.4rem; align-items: baseline; color: var(--muted); font-weight: 600; }
.day.today .day-head { color: var(--primary-text); }
.day-num { font-size: 1.3em; font-weight: 800; color: var(--text); }
.day-add { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); text-decoration: none; font-size: 1.4em; color: var(--muted); }
.day-add:hover { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.shift-card { position: relative; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.65rem; margin-bottom: 0.4rem; border-radius: var(--radius-sm); border: 1px solid var(--border); border-left: 6px solid var(--draft-border); text-decoration: none; color: var(--text); min-height: var(--tap); font-size: 0.95em; background: var(--surface); box-shadow: var(--shadow-sm); }
.shift-card:hover { box-shadow: var(--shadow); }
.shift-card.shift-ok { background: var(--ok-bg); border-left-color: var(--ok-border); }
.shift-card.shift-conflict { background: var(--bad-bg); border-color: var(--bad-border); border-left-color: var(--bad-border); border-left-width: 8px; border-style: double; border-left-style: solid; border-width: 3px 3px 3px 8px; }
.shift-card.shift-draft { background: var(--draft-bg); border-color: var(--draft-border); border-style: dashed; border-left-style: dashed; border-left-color: var(--draft-border); }
.shift-card.shift-cancelled { opacity: 0.5; text-decoration: line-through; }
body.high-contrast .shift-card, body.high-contrast .shift-list li { border-width: 2px; border-left-width: 8px; }
.shift-time { font-weight: 700; }
.shift-worker, .shift-group { color: var(--muted); font-size: 0.9em; }
.shift-flag { position: absolute; top: 0.3rem; right: 0.4rem; background: var(--bad-border); color: #fff; border-radius: 50%; width: 1.4em; height: 1.4em; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
@media (min-width: 900px) {
  .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.4rem; }
  .day { padding: 0.4rem; min-height: 8rem; }
  .shift-card { font-size: 0.85em; padding: 0.45rem 0.5rem; }
}

/* Notes */
.note-section { margin-bottom: 1rem; }
.quick-picks { display: grid; grid-template-columns: 1fr; gap: 0.1rem 1rem; margin-bottom: 0.5rem; }
@media (min-width: 720px) { .quick-picks { grid-template-columns: 1fr 1fr; } }
.pick { font-weight: 400; }
.note h2 { margin-top: 1rem; font-size: 1.05em; }
.note h2:first-child { margin-top: 0; }
.attachments { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.attachments img { max-width: 220px; max-height: 220px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
/* Records retention (item 20): the "Edited" marker and the version history page */
.badge-edited { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-soft-border); }
.note-edited { margin: -0.5rem 0 1rem; color: var(--muted); }
.note-history { display: grid; gap: 1rem; }
.note-version h2 { margin-top: 0; }
.note-version h3 { margin: 0.8rem 0 0.2rem; font-size: 1em; }
.note-version-meta { margin: 0 0 0.6rem; font-size: 0.92em; }
.note-version-current { border-left: 6px solid var(--primary); }
.note-version:not(.note-version-current) { border-left: 6px solid var(--border); }
body.high-contrast .note-version-current, body.high-contrast .note-version { border-left-color: #000; }
.debug { white-space: pre-wrap; font-size: 0.8em; background: #fff; border: 1px solid var(--border); padding: 0.5rem; overflow-x: auto; }

@media (prefers-reduced-motion: no-preference) { .btn, .card-link, .shift-card, .stat { transition: background-color 0.15s, box-shadow 0.15s; } }
@media print { .site-header, .site-footer, .actions, .week-nav, .nav-toggle { display: none; } body { background: #fff; } .card, .day { box-shadow: none; } }

/* Login page: the organisation's logo (or the app mark) and name above the form */
.login-card { margin-top: 2.5rem; padding: 1.5rem 1.5rem 1.25rem; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin-bottom: 0.75rem; text-align: center; }
.login-logo { width: 96px; height: 96px; object-fit: contain; border-radius: 16px; }
.login-org { margin: 0; font-weight: 700; font-size: 1.15em; color: var(--muted); letter-spacing: 0.01em; }
.login-card h1 { text-align: center; margin-top: 0.2em; }
body.high-contrast .login-org { color: #000; }

/* Calendar sync page: step-by-step instructions per calendar app */
details.howto { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.9rem; margin: 0.6rem 0; background: var(--surface); }
details.howto summary { font-weight: 700; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
details.howto ol { padding-left: 1.4rem; }
details.howto li { margin: 0.3rem 0; }
.code-display code[id] { user-select: all; -webkit-user-select: all; }

.row-actions { margin: 0; }

/* Client feedback: big radio "cards" on the form, one card per item on the admin page */
.check.choice { align-items: flex-start; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; margin: 0.4rem 0; background: var(--surface); }
.check.choice input { margin-top: 0.2em; }
.check.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
body.high-contrast .check.choice:has(input:checked) { background: #fff; border-width: 3px; }
.anon-hint { margin-top: 0.6rem; }
.feedback-item { padding: 0.9rem 1rem; border-left: 8px solid var(--draft-border); }
.feedback-item.status-new { border-left-color: var(--accent); }
.feedback-item.status-actioned { border-left-color: var(--ok-border); }
.feedback-item:target { outline: 3px solid var(--focus); }
.feedback-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.feedback-when { color: var(--muted); font-size: 0.9em; margin-left: auto; }
.feedback-meta { margin: 0.2rem 0; }
.feedback-meta .sep { margin: 0 0.4em; color: var(--muted); }
.feedback-message { white-space: pre-wrap; margin: 0.6rem 0 0.4rem; font-size: 1.05em; }
.badge-new { background: #fff7ed; color: #7c2d12; border-color: var(--accent); }
.badge-read { background: var(--draft-bg); color: var(--draft-text); border-color: var(--draft-border); }
.badge-actioned { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.note-box { margin-top: 0.6rem; }
.note-box textarea { min-height: 4em; }

/* Staff section (3 Dec 2026): photos, list avatars; mileage totals */
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; }
.avatar-empty { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.staff-basics { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.staff-photo { width: 160px; height: 160px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--border); background: var(--draft-bg); display: inline-flex; align-items: center; justify-content: center; font-size: 3em; font-weight: 700; color: var(--draft-text); flex: none; }
.staff-basics .dl { flex: 1 1 240px; }
.staff-table .avatar { vertical-align: middle; }
.mileage-total { margin: 0; }
ul.compact { margin: 0.3rem 0; padding-left: 1.2rem; }
ul.compact li { margin: 0.25rem 0; }

/* Note flags (Christy, 3 Dec 2026, item 15): admin-only review queue, rules page, indicators */
.badge-high { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-border); }
.badge-medium { background: var(--pending-bg); color: var(--pending-text); border-color: var(--pending-border); }
.badge-low { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-soft-border); }
.badge-open { background: #fff7ed; color: #7c2d12; border-color: var(--accent); }
.badge-reviewed { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.badge-dismissed { background: var(--draft-bg); color: var(--draft-text); border-color: var(--draft-border); }
.badge-flag { background: #fff7ed; color: #7c2d12; border-color: var(--accent); }
.flag-disclaimer { font-size: 0.95em; }
.flag-item { padding: 0.9rem 1rem; border-left: 8px solid var(--draft-border); }
.flag-item.severity-high { border-left-color: var(--bad-border); }
.flag-item.severity-medium { border-left-color: var(--pending-border); }
.flag-item.severity-low { border-left-color: var(--primary-soft-border); }
.flag-item.status-reviewed, .flag-item.status-dismissed { opacity: 0.85; }
.flag-item:target { outline: 3px solid var(--focus); }
.flag-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.flag-when { color: var(--muted); font-size: 0.9em; margin-left: auto; }
.flag-meta { margin: 0.2rem 0; }
.flag-meta .sep { margin: 0 0.4em; color: var(--muted); }
.flag-snippet { margin: 0.5rem 0 0.2rem; font-size: 1.05em; }
.flag-note { margin: 0.3rem 0; }
.flag-review { margin-top: 0.6rem; }
.flag-review textarea { min-height: 3em; }
mark { background: #fde68a; color: #1b1f27; padding: 0 0.15em; border-radius: 3px; font-weight: 600; }
body.high-contrast mark { background: #000; color: #fff; }
.flag-box { border-left: 6px solid var(--accent); }
.flag-summary li { margin: 0.35rem 0; }
.rule-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.rule-item { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; padding: 0.45rem 0; border-top: 1px solid var(--border); }
.rule-item:first-child { border-top: 0; }
.rule-item.rule-disabled .rule-edit { opacity: 0.6; }
.rule-edit input[type="text"] { min-width: 14rem; flex: 1 1 14rem; }
.rule-actions { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; margin-left: auto; }
.link-danger { color: var(--danger); }
.test-results { margin-top: 0.75rem; padding: 0.75rem 1rem; background: var(--primary-soft); border: 1px solid var(--primary-soft-border); border-radius: var(--radius-sm); }
body.high-contrast .test-results { background: #fff; border-color: #000; }
code { background: var(--draft-bg); padding: 0.05em 0.35em; border-radius: 3px; font-size: 0.95em; }

/* Admin "View as" (Christy, 5 Dec 2026, item 16): a banner that cannot be hidden and stays in view while
 * scrolling. Dark rust with white text (about 9:1), a strong amber edge, and a white Exit button. Sticky in the
 * normal top-menu flow; with the left sidebar the body is a grid (a sticky grid item cannot leave its own cell),
 * so there the banner is fixed at a known height and the sidebar and page move down to make room. */
:root { --view-as-h: 3.5rem; }
.view-as-banner { position: sticky; top: 0; z-index: 60; background: #7a2e0e; color: #ffffff; border-bottom: 4px solid #f59e0b; box-shadow: var(--shadow); }
.view-as-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; padding-top: 0.45rem; padding-bottom: 0.45rem; }
.view-as-text { margin: 0; font-size: 1em; line-height: 1.35; }
.view-as-exit { margin: 0; }
.view-as-exit-button { background: #ffffff; color: #7a2e0e; border-color: #ffffff; min-height: 40px; box-shadow: none; }
.view-as-exit-button:hover { background: #fde68a; color: #7a2e0e; border-color: #fde68a; }
.view-as-banner :focus-visible { outline-color: #ffffff; }
body.high-contrast .view-as-banner { background: #000000; color: #ffffff; border-bottom: 4px solid #ffffff; box-shadow: none; }
body.high-contrast .view-as-exit-button { background: #ffffff; color: #000000; border-color: #000000; }
body.high-contrast .view-as-exit-button:hover { background: #ffffff; color: #000000; }
@media (min-width: 800px) {
  body.menu-left.viewing-as { padding-top: var(--view-as-h); }
  body.menu-left.viewing-as .view-as-banner { position: fixed; left: 0; right: 0; height: var(--view-as-h); }
  body.menu-left.viewing-as .view-as-inner { flex-wrap: nowrap; height: 100%; padding-top: 0; padding-bottom: 0; max-width: none; }
  body.menu-left.viewing-as .view-as-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  body.menu-left.viewing-as .site-header { top: var(--view-as-h); height: calc(100vh - var(--view-as-h)); }
}
@media print { .view-as-banner { position: static; } }
/* An action rendered as a button but read as a link (used for "View as" in table rows). */
.link-inline { width: auto; display: inline; padding: 0; color: var(--primary-text); text-decoration: underline; text-underline-offset: 0.12em; }
.link-inline:hover { color: var(--primary-dark); }

/* Staff qualifications (Christy, 5 Dec 2026, item 18): in-table Remove/Undo buttons read as links; a compact verify button. */
.qual-table .link-button { width: auto; color: var(--primary-text); text-decoration: underline; text-underline-offset: 0.12em; padding: 0; font: inherit; min-height: var(--tap); }
.qual-table .link-button:hover { color: var(--primary-dark); }
.qual-table .inline-form { margin-left: 0.4rem; }
.qual-table .row-actions .inline-form { margin-left: 0.5rem; }
.btn-small { min-height: 2.2rem; padding: 0.25em 0.8em; font-size: 0.9em; }
.qual-attention { border-left: 4px solid var(--pending-border); }
.qual-attention.expired { border-left-color: var(--bad-border); }
/* Item 22: the one-time "Set state" control under a generic Working With Children Check row. */
.qual-table .qual-set-state { display: block; margin-top: 0.4rem; padding: 0.5rem 0.6rem; background: var(--primary-soft); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); }
.qual-table .qual-set-state label { display: block; margin-bottom: 0.3rem; font-weight: 600; }
.qual-table .qual-set-state .inline-form { margin-left: 0; }
.qual-table .qual-set-state select { max-width: 100%; }
body.high-contrast .qual-table .qual-set-state { background: #fff; }
.qual-state-prompt { margin-top: 0; }

/* Passkeys / Face ID sign-in (Christy, 5 Dec 2026, item 19). The login block is hidden until app.js confirms the
   browser supports WebAuthn; the "or" divider separates it from the password form. */
.passkey-login { margin: 0.25rem 0 0.75rem; }
.passkey-login .passkey-help { margin: 0.5rem 0 0; text-align: center; }
.passkey-status { margin: 0.5rem 0 0; min-height: 1.2em; }
.passkey-status.is-error { color: var(--bad-text); font-weight: 600; }
.passkey-status.is-busy { color: var(--muted); }
.login-or { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0 0.25rem; color: var(--muted); font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.06em; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.login-help { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.95em; }
.login-help h2 { font-size: 1.05em; margin: 0 0 0.4em; }
.login-help p { margin: 0.5em 0; }
.login-help ul { margin: 0.5em 0; padding-left: 1.2em; }
.login-help li { margin: 0.4em 0; }
.sso-login { margin-top: 0.25rem; }
.sso-login .login-or { margin-top: 1rem; }
.sso-button { gap: 0.6em; margin-top: 0.6rem; font-weight: 500; }
.sso-logo { flex: none; }
.sso-google { background: #ffffff; color: #1f1f1f; border-color: #747775; }
.sso-google:hover, .sso-google:focus-visible { background: #f3f4f6; color: #1f1f1f; }
.sso-apple { background: #000000; color: #ffffff; border-color: #000000; }
.sso-apple:hover, .sso-apple:focus-visible { background: #1f1f1f; color: #ffffff; }
.sso-help { margin: 0.6rem 0 0; text-align: center; }
body.high-contrast .sso-google { border-color: #000000; }
.passkey-rename { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.passkey-rename input { flex: 1 1 10rem; min-width: 8rem; }
.passkey-table td form { margin: 0; }
.passkey-prompt { border-left: 4px solid var(--primary); }
.passkey-details { margin-top: 0.75rem; }
body.high-contrast .passkey-status.is-error { color: #000; }
