:root {
  --green: #557a32; --green-dark: #2f3b25; --green-soft: #eaf1e2;
  --ink: #1c2b25; --muted: #63736c; --line: #dfe6e2; --bg: #f5f7f6; --card: #fff;
  --danger: #b3261e; --danger-soft: #fbe9e7; --amber-soft: #fff4d6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--green-dark); color: #fff; padding: 1.25rem 0; }
.sidebar a.brand { display: block; margin: 0 1rem 1rem; padding: .9rem; background: #fff; border-radius: 10px; border: 0; opacity: 1; text-align: center; }
.sidebar a.brand:hover { background: #fff; }
.brand img { width: 100%; max-width: 132px; height: auto; display: block; margin: 0 auto; }
.sidebar a.brand.wide { padding: .8rem .6rem; }
.brand.wide img { max-width: 100%; }
.sidebar .group { padding: 1rem 1.25rem .25rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
.sidebar .nav-group { border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .nav-group:last-of-type { border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .nav-group > summary { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.25rem; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.75); cursor: pointer; list-style: none; user-select: none; }
.sidebar .nav-group > summary::-webkit-details-marker { display: none; }
.sidebar .nav-group > summary::after { content: ""; width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
.sidebar .nav-group[open] > summary { color: #fff; }
.sidebar .nav-group[open] > summary::after { transform: rotate(45deg); }
.sidebar .nav-group > summary:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar .nav-group > summary:focus-visible { outline: 2px solid #a9c98a; outline-offset: -2px; }
.sidebar .nav-group[open] { padding-bottom: .5rem; }
.sidebar a:not(.brand) {
  display: block; margin: .3rem .75rem; padding: .5rem .85rem; color: #fff; font-size: .93rem;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14); border-radius: 9px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}
.sidebar a:not(.brand):hover {
  background: rgba(255,255,255,.14); border-color: #a9c98a; text-decoration: none;
  transform: translateX(4px); box-shadow: 0 5px 12px rgba(0,0,0,.4);
}
.sidebar a:not(.brand):active { transform: translateX(4px) scale(.98); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.sidebar a:not(.brand):focus-visible { outline: 2px solid #a9c98a; outline-offset: 2px; }
.sidebar a.active, .sidebar a.active:hover {
  background: #fff; color: var(--green-dark); font-weight: 600; border-color: #fff;
  box-shadow: 0 5px 14px rgba(0,0,0,.4), inset 4px 0 0 var(--green);
  animation: nav-select .3s ease-out;
}
@keyframes nav-select { from { transform: translateX(-8px) scale(.97); opacity: .5; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sidebar a:not(.brand) { transition: none; }
  .sidebar a:not(.brand):hover, .sidebar a:not(.brand):active { transform: none; }
  .sidebar a.active { animation: none; }
}

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.footer { margin-top: auto; padding: 1rem 2rem 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; line-height: 1.6; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .75rem 2rem; background: var(--card); border-bottom: 1px solid var(--line); font-size: .9rem; }
.topbar .who { color: var(--muted); }
.topbar form { margin: 0; }
.content { padding: 1.75rem 2rem 3rem; max-width: 1200px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; margin-bottom: 1.25rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; color: var(--ink); display: block; }
.tile:hover { border-color: var(--green); text-decoration: none; }
.tile .num { font-size: 1.9rem; font-weight: 700; color: var(--green); line-height: 1.2; }
.tile .lbl { color: var(--muted); font-size: .85rem; }
.tile.warn .num { color: var(--danger); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.empty { color: var(--muted); padding: 1rem 0; }
.card.empty { padding: 1.25rem; }   /* a message that is the whole card keeps the card's own spacing */

.btn { display: inline-block; padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--green); background: var(--green); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--green-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--green); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.link { background: none; border: 0; color: var(--green); padding: 0; font-weight: 400; }

input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid #c3cec8; border-radius: 7px; width: 100%; background: #fff; color: var(--ink); }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a9c98a; border-color: var(--green); }
select[multiple] { min-height: 7rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.field .help { color: var(--muted); font-size: .8rem; }
.field:has(textarea) { grid-column: 1 / -1; }
.errorlist { list-style: none; margin: .25rem 0 0; padding: 0; color: var(--danger); font-size: .85rem; }
.search { display: flex; gap: .5rem; max-width: 420px; }
.inline td input, .inline td select { min-width: 110px; }

.dl { display: grid; grid-template-columns: 200px 1fr; gap: .5rem 1rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; white-space: pre-line; }

.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.messages li { padding: .65rem 1rem; border-radius: 8px; background: var(--green-soft); border: 1px solid #bcdccd; margin-bottom: .5rem; }
.messages li.error { background: var(--danger-soft); border-color: #f0b8b3; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.notice { background: var(--amber-soft); border: 1px solid #ecd58c; border-radius: 8px; padding: .65rem 1rem; margin-bottom: 1rem; font-size: .9rem; }

.notice.ok { background: var(--green-soft); border-color: #bcdccd; }
.dim { color: var(--muted); font-size: .85rem; }
.weekbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .85rem 1.25rem; }
.weekbar-form { display: flex; align-items: center; gap: .6rem; margin: 0; }
.weekbar-form label { font-weight: 600; font-size: .85rem; white-space: nowrap; }
.weekbar-form select { min-width: 230px; }
table.rota td { min-width: 118px; }
table.rota td:first-child { min-width: 130px; background: #fafcfb; }
table.rota small { color: var(--muted); }
table.rota form { margin: 0; }
table.rota select { padding: .25rem .4rem; font-size: .85rem; margin-top: .25rem; color: var(--green); border-style: dashed; }
.chip { display: flex; justify-content: space-between; align-items: center; gap: .25rem; background: var(--green-soft); border-radius: 6px; padding: .2rem .45rem; margin-bottom: .25rem; font-size: .88rem; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .15rem; }
.chip button:hover { color: var(--danger); }
.open { color: var(--danger); font-size: .8rem; font-weight: 600; }
table.num td:not(:first-child), table.num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
table.num tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }

.pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill.valid { background: var(--green-soft); color: var(--green-dark); }
.pill.due { background: var(--amber-soft); color: #7a5600; }
.pill.expired, .pill.missing { background: var(--danger-soft); color: var(--danger); }
.pill.optional { background: #ebedeb; color: #5a625c; }      /* an optional item that is missing or expired */
table.matrix td { min-width: 120px; }
table.matrix td small, table.matrix th small { display: block; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
table.matrix .renew { font-size: .8rem; }
/* The employee's name stays in view while the items are scrolled sideways. */
table.matrix th:first-child, table.matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); min-width: 150px; box-shadow: 1px 0 0 var(--line), 6px 0 6px -6px rgba(28, 43, 37, .18); }

.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; background: var(--green-dark); padding: 1rem; }
.auth .logo { display: block; width: 170px; height: auto; margin: 0 auto 1rem; }
.auth .logo.wide { width: 270px; max-width: 100%; }
.auth .footer { margin: 0; padding: 0; border: 0; color: rgba(255,255,255,.75); text-align: center; }
.sys-line { margin-top: .35rem; }
.sys-status { display: inline-flex; align-items: center; gap: .4rem; }
.sys-light { width: .6rem; height: .6rem; border-radius: 50%; background: #9aa39a; display: inline-block; }
.sys-status.online .sys-light { background: #2fae5a; animation: sys-pulse 1.6s ease-in-out infinite; }
.sys-status.offline .sys-light { background: #d0392f; animation: sys-pulse .7s ease-in-out infinite; }
.sys-status.offline .sys-text { color: #d0392f; font-weight: 600; }
.auth .sys-status.offline .sys-text { color: #ffb4ad; }
@keyframes sys-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(47,174,90,.55); }
  50% { opacity: .35; box-shadow: 0 0 0 .3rem rgba(47,174,90,0); }
}
@media (prefers-reduced-motion: reduce) { .sys-light { animation: none !important; } }
.auth .card p { text-align: center; }
.auth .card { width: 100%; max-width: 380px; padding: 2rem; }
.auth h1 { margin-bottom: .25rem; color: var(--green); }
.auth p { color: var(--muted); margin: 0 0 1.25rem; }
.auth .field { margin-bottom: 1rem; }
.auth .btn { width: 100%; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: .75rem 0; }
  .cols, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1.25rem 1rem 2rem; }
  .dl { grid-template-columns: 1fr; gap: 0 0; }
  .dl dd { margin-bottom: .6rem; }
}

/* medication */
table.round td small { display: block; color: var(--muted); }
table.round td:last-child { min-width: 380px; }
form.dose { display: flex; gap: .4rem; margin: 0; align-items: center; }
form.dose select { width: auto; }
form.dose .btn { white-space: nowrap; padding: .4rem .8rem; }
form.undo { margin: .15rem 0 0; font-size: .8rem; }
.prn { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.prn small { display: block; color: var(--muted); }
.prn form.dose { max-width: 480px; margin-top: .4rem; }
.mar-card h2 small { font-weight: 400; color: var(--muted); }
table.mar { font-size: .78rem; }
table.mar th, table.mar td { padding: .25rem .2rem; border: 1px solid var(--line); text-align: center; }
table.mar th.today { background: var(--green-soft); }
table.mar td.med { text-align: left; min-width: 150px; padding: .3rem .45rem; }
table.mar td.med small { display: block; color: var(--muted); }
table.mar td.slot { text-align: left; white-space: nowrap; padding: .3rem .45rem; }
table.mar td.c { min-width: 24px; font-weight: 600; }
.c.given { background: var(--green-soft); color: var(--green-dark); }
.c.notgiven { background: var(--amber-soft); color: #7a5600; }
.c.missed { background: var(--danger-soft); color: var(--danger); }
.c.off { background: repeating-linear-gradient(45deg, #eef1ef, #eef1ef 3px, #fff 3px, #fff 6px); }
.mar-notes { margin-top: .75rem; font-size: .85rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; font-size: .85rem; }
.legend b.c { display: inline-block; min-width: 26px; text-align: center; padding: .05rem .25rem; border: 1px solid var(--line); margin-right: .25rem; }

@media print {
  .sidebar, .topbar, .noprint, .messages { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11px; }
  .card { border: 0; padding: 0; break-inside: avoid; }
  .mar-card { break-after: page; }
  .table-wrap { overflow: visible; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 10mm; }
}
/* care log forms and body map */
.field.checks > div, .field.checks ul { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; margin: 0; padding: 0; }
.field.checks label, label.tick { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; font-size: .95rem; margin: 0; }
label.tick { padding-top: 1.5rem; }
.bodymap-wrap { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 1.5rem; align-items: start; }
.bodymap { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
form .bodymap { cursor: crosshair; }
.bm-figure > * { fill: #eef2ea; stroke: #7d8c80; stroke-width: 1.5; }
.bm-figure .bm-spine { stroke-dasharray: 3 3; }
.bm-label { font-size: 12px; fill: var(--muted); }
.bm-mark circle { fill: var(--danger); stroke: #fff; stroke-width: 1.5; }
.bm-mark text { fill: #fff; font-size: 10px; font-weight: 700; pointer-events: none; }
.bm-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.bm-num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
@media (max-width: 800px) { .bodymap-wrap { grid-template-columns: 1fr; } }
/* notifications */
.bell { position: relative; display: inline-flex; color: var(--ink); padding: .2rem; margin-right: .25rem; }
.bell:hover { color: var(--green); }
.bell .badge { position: absolute; top: -6px; right: -10px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; border-radius: 999px; padding: .05rem .35rem; line-height: 1.4; }
.notes { padding: 0; }
.note { display: grid; gap: .1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.note:last-child { border-bottom: 0; }
.note:hover { background: #fafcf8; text-decoration: none; }
.note.unread { background: var(--green-soft); border-left: 3px solid var(--green); }
.note-title { font-weight: 600; }
.note-text { color: var(--muted); }
.notes .empty { padding: 1.25rem; }
/* availability */
table.avail td form { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
table.avail td.past { opacity: .55; }
table.avail .onrota { display: block; color: var(--green); font-weight: 600; }
button.mini { font: inherit; font-size: .75rem; padding: .1rem .4rem; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); cursor: pointer; }
button.mini.yes:hover { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); }
button.mini.no:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.chip.clash { background: var(--amber-soft); }
.bel-table table { min-width: 1080px; }
.bel-table td select { min-width: 8.5rem; }
.bel-table td input[type=text] { min-width: 11rem; }
.sign-lines { display: none; }
@media print { .sign-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; margin-top: 3rem; }
  .sign-lines div { border-top: 1px solid #333; padding-top: .3rem; font-size: .85rem; } }
.reg-action { padding: .9rem 0; border-bottom: 1px solid var(--line, #e6e9e3); }
.reg-updates { margin: .5rem 0 .5rem 1.1rem; padding: 0; font-size: .92rem; }
.reg-updates li { margin-bottom: .4rem; }
.policy-confirm { display: flex; gap: .6rem; align-items: flex-start; padding: .35rem 0; font-weight: 500; }
.policy-confirm input { width: auto; margin-top: .25rem; flex: none; }
.policy-viewer { user-select: none; }
a.pill { text-decoration: none; }
@media print { .policy-viewer { display: none !important; } }
.clock-shift { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .9rem 0; border-bottom: 1px solid var(--line, #e6e9e3); flex-wrap: wrap; }
.clock-shift:last-child { border-bottom: 0; }
.clock-action { text-align: right; }
.clock-btn { font-size: 1.05rem; padding: .7rem 1.6rem; }
.clock-btn.out { background: #a3312a; border-color: #a3312a; }
.clock-msg { margin-top: .35rem; max-width: 18rem; }
.clock-anyway { margin-top: .4rem; }
.clock-anyway[hidden] { display: none; }
.clock-done { margin-top: .3rem; font-size: .9rem; }
@media (max-width: 640px) { .clock-action { text-align: left; width: 100%; } .clock-btn { width: 100%; } }
.check-q { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--line, #e6e9e3); }
.check-q:last-child { border-bottom: 0; }
.check-q > label { flex: 1 1 55%; font-weight: 500; }
.check-q .check-a { flex: 0 1 40%; min-width: 13rem; }
.check-q.wide { display: block; }
.check-q.wide .check-a { margin-top: .35rem; }
.check-q .check-a input[type=text], .check-q .check-a textarea, .check-q .check-a select { width: 100%; }
.check-q .help.block { display: block; font-weight: 400; }
.yn { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.yn label { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line, #d5dad2); border-radius: 6px; padding: .3rem .65rem; cursor: pointer; font-weight: 400; }
.yn input { width: auto; margin: 0; }
.with-unit { display: inline-flex; align-items: center; gap: .35rem; }
.with-unit input { width: 7rem; }
.check-table { padding: .6rem 0; }
.check-table .check-label { font-weight: 600; margin-bottom: .2rem; }
.check-table td { vertical-align: top; }
.check-table td input, .check-table td select { width: 100%; min-width: 5.5rem; }
.check-table td .with-unit input { min-width: 4.5rem; }
.check-table td .with-unit span { display: none; }
.check-table .add-row { margin-top: .4rem; }
@media (max-width: 640px) { .check-q { display: block; } .check-q .check-a { margin-top: .35rem; } }
.chip .mail { display: block; font-size: .72rem; line-height: 1.2; }
.chip .mail.sent { color: var(--muted); }
.chip .mail.waiting { color: #9a5b00; font-weight: 600; }
/* record sections */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.report-head { display: none; }
@media print { .report-head { display: block; margin-bottom: 1rem; } }
/* shift pay */
table.paygrid input { min-width: 84px; }
table.paygrid small { display: block; }

/* staffing levels */
.bar { height: 6px; background: var(--line); border-radius: 999px; margin-top: .5rem; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.tile.warn .bar span { background: var(--danger); }
.fill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; background: #eef1ef; color: var(--muted); margin-bottom: .3rem; white-space: nowrap; }
.fill.ok { background: var(--green-soft); color: var(--green-dark); }
.fill.short { background: var(--danger-soft); color: var(--danger); }
table.rota tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 600; background: #fafcfb; }
.need-form { display: flex; align-items: center; gap: .3rem; margin-top: .35rem; font-size: .8rem; }
.need-form label { display: flex; align-items: center; gap: .3rem; color: var(--muted); }
.need-form input[type=number] { width: 58px; padding: .15rem .3rem; font-size: .85rem; }
details.need { margin-top: .3rem; font-size: .78rem; color: var(--muted); }
details.need summary { cursor: pointer; }
details.need small { display: block; margin-top: .2rem; }

/* physical intervention holds */
.hold-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.hold-row select { max-width: 320px; }
/* training matrix */
.pick-list { display: grid; gap: .5rem; }
.pick-list label { display: flex; align-items: center; gap: .5rem; }
.pick-list .tick-all { padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.swatch { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line); border-radius: 3px; vertical-align: -2px; margin-right: .3rem; }

/* shift times */
table.times input[type=time] { width: 110px; padding: .3rem .4rem; }
table.times td { vertical-align: middle; }

/* DBS checks */
label.declare { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; padding: .75rem 1rem; background: var(--amber-soft); border: 1px solid #ecd58c; border-radius: 8px; font-size: .9rem; }
label.declare input { margin-top: .25rem; }

/* log type icons */
.log-icon { vertical-align: -4px; color: var(--green); flex: none; }
.log-icon.log-incident, .log-icon.log-missing { color: var(--danger); }
.log-icon.log-return_home, .log-icon.log-sleep { color: #4a6fa5; }
.log-icon.log-property_damage { color: #a8632a; }
.log-icon.log-observation { color: #6b5ca5; }
.log-icon.log-body_map, .log-icon.log-clinical, .log-icon.log-health_visit, .log-icon.log-health_recording { color: #8a5a00; }
.with-icon { display: flex; align-items: center; gap: .5rem; }
.log-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.plan-grid th, .plan-grid td { vertical-align: top; min-width: 120px; }
.plan-grid th:first-child { min-width: 90px; }
.plan-grid textarea { width: 100%; min-height: 4.6rem; resize: vertical; font: inherit; font-size: .88rem; padding: .4rem .5rem; }
.plan-grid .today { background: #f1f6ea; }
.plan-text { white-space: pre-line; }
.money-in { color: var(--green); font-weight: 600; }
.money-out { color: #a33; font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
@media print { .plan-grid textarea { border: 0; resize: none; padding: 0; } }
.doc-viewer { padding: 0; overflow: hidden; }
.doc-viewer iframe { display: block; width: 100%; height: calc(100vh - 150px); min-height: 640px; border: 0; background: #525659; }
.doc-viewer .doc-image { background: #525659; padding: 1rem; text-align: center; overflow: auto; max-height: calc(100vh - 150px); min-height: 400px; }
.doc-viewer .doc-image img { max-width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); cursor: zoom-in; }
.doc-viewer .doc-image.zoomed img { max-width: none; cursor: zoom-out; }
.upload-preview { margin-top: .6rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; grid-column: 1 / -1; }
.upload-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .8rem; font-size: .85rem; background: #f4f7ef; }
.upload-preview iframe { display: block; width: 100%; height: 75vh; min-height: 520px; border: 0; background: #525659; }
.upload-preview .doc-image { background: #525659; padding: 1rem; text-align: center; overflow: auto; max-height: 75vh; }
.upload-preview .doc-image img { max-width: 100%; height: auto; background: #fff; cursor: zoom-in; }
.upload-preview .doc-image.zoomed img { max-width: none; cursor: zoom-out; }
.field:has(.upload-preview) { grid-column: 1 / -1; }
.current-file { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin-bottom: .3rem; font-size: .9rem; }
.hover-preview { position: fixed; z-index: 1000; width: min(620px, 46vw); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.28); overflow: hidden; }
.hover-preview-head { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .75rem; font-size: .8rem; font-weight: 600; background: #f4f7ef; border-bottom: 1px solid var(--line); }
.hover-preview-head span:last-child { font-weight: 400; color: var(--muted); white-space: nowrap; }
.hover-preview iframe { display: block; width: 100%; height: min(72vh, 760px); border: 0; background: #525659; }
.hover-preview .hover-image { background: #525659; padding: .6rem; text-align: center; max-height: min(72vh, 760px); overflow: auto; }
.hover-preview .hover-image img { max-width: 100%; height: auto; background: #fff; }
.hover-preview .hover-note { padding: 1rem; color: var(--muted); font-size: .9rem; }
@media print { .hover-preview { display: none; } }
@media (max-width: 760px) { .hover-preview { display: none; } }
.annex h2 { margin-bottom: .5rem; }
.annex-rows td, .annex-grid td { vertical-align: top; }
.annex-rows input[type=text], .annex-rows select, .annex-rows textarea, .annex-grid input[type=text] { width: 100%; }
.annex-rows textarea { min-height: 3.2rem; resize: vertical; font: inherit; }
.annex-grid th { font-size: .72rem; min-width: 110px; }
.annex-grid input[type=text] { min-width: 100px; font-size: .88rem; padding: .3rem .4rem; }
.annex-table-title { font-size: .95rem; margin: 1.1rem 0 .3rem; }
.annex-save { position: sticky; bottom: 0; background: var(--bg, #f4f6f4); padding: .75rem 0; }
.rent-table td:first-child { min-width: 230px; }
.rent-table td { white-space: nowrap; }
.rent-table td:first-child small { white-space: normal; }
.doc-facts { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; align-items: center; padding: .8rem 1.25rem; }
.doc-facts div { font-size: .9rem; }
.doc-facts small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.type-picks { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.type-picks label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; margin: 0; }
.alert { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--danger-soft); border: 1px solid #f0b8b3; border-left: 5px solid var(--danger); border-radius: 8px; padding: .85rem 1rem; margin-bottom: 1rem; }
/* onboarding and public forms */
.bar.big { height: 12px; margin: .5rem 0 .75rem; }
.onboard-top { display: flex; justify-content: space-between; align-items: baseline; }
.onboard-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .35rem 1rem; font-size: .9rem; color: var(--muted); }
.onboard-steps li.done { color: var(--ink); }
.tick { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #e3e8e4; color: var(--muted); font-size: .7rem; font-weight: 700; margin-right: .25rem; flex: none; }
.done > .tick { background: var(--green); color: #fff; }
.ref { border-top: 1px solid var(--line); padding: .85rem 0; }
.ref:first-of-type { border-top: 0; padding-top: 0; }
details summary { cursor: pointer; color: var(--green); margin: .35rem 0; }
code.code { font: 600 1rem/1 ui-monospace, Consolas, monospace; background: #f0f3f1; padding: .15rem .45rem; border-radius: 5px; letter-spacing: .08em; }
body.public { background: var(--bg); }
.public-head { display: flex; align-items: center; gap: 1rem; background: #fff; border-bottom: 1px solid var(--line); padding: .75rem max(1rem, calc((100% - 820px) / 2)); }
.public-head img { height: 56px; width: auto; }
.public-main { max-width: 820px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; }
.public-main h1 { margin-bottom: .75rem; }
.form-grid.one { grid-template-columns: 1fr; }
label.tick.plain { padding-top: 0; align-items: flex-start; font-weight: 400; }
label.tick.plain input { margin-top: .25rem; }
.steps { display: grid; gap: .5rem; margin-top: 1rem; }
.step { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
.step:hover { border-color: var(--green); text-decoration: none; }
.step.done { background: var(--green-soft); border-color: #cfe0c1; }
label.tick.plain { display: flex; gap: .5rem; }
label.tick.plain span { flex: 1; }
/* ".tick" is also the round progress marker (20px circle). A tick-box label must not inherit that size. */
label.tick { width: auto; height: auto; border-radius: 0; background: none; color: inherit; font-size: .95rem; font-weight: 400; margin-right: 0; place-items: initial; }
/* Application form: the driving questions start on their own row, under the right to work ones. */
.checks-grid .field:has(#id_drives) { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: .25rem; }

/* two-step sign-in */
.codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin: 1rem 0; }
.codes .code { text-align: center; padding: .5rem; }
ol.setup { padding-left: 1.2rem; display: grid; gap: .9rem; }
ol.setup img { border: 1px solid var(--line); border-radius: 8px; margin: .5rem 0; background: #fff; }
@media print { .public-head, .footer, .actions, .messages { display: none !important; } }

/* Photos on care logs */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin: .5rem 0 1rem; }
.photo-grid:empty { display: none; }
.photo-tile { display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; text-decoration: none; }
.photo-tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line, #d9ded3); background: #f3f5ef; }
a.photo-tile:hover img { outline: 2px solid var(--green, #5a7a36); }
.photo-remove { display: flex; align-items: center; gap: .4rem; font-size: .85rem; cursor: pointer; }
.photo-remove input { width: 1rem; height: 1rem; margin: 0; flex: none; }

/* Outcomes tracker */
.oc-track { position: relative; height: 10px; background: var(--line); border-radius: 5px; }
.oc-track span { display: block; height: 100%; background: var(--green); border-radius: 5px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.oc-track i { position: absolute; top: -4px; width: 2px; height: 18px; margin-left: -1px; background: var(--ink); box-shadow: 0 0 0 2px var(--card); }
.oc-key { display: inline-block; width: 2px; height: 12px; background: var(--ink); vertical-align: -2px; }
.oc-meter { display: grid; grid-template-columns: minmax(4rem, 1fr) auto auto; gap: .5rem; align-items: center; }
.oc-row { display: grid; grid-template-columns: 14rem minmax(6rem, 1fr) 11rem 10rem; gap: .25rem 1rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.oc-row:first-child { border-top: 0; }
.oc-name { font-weight: 600; }
.oc-change { font-size: .85rem; white-space: nowrap; }
.oc-note { grid-column: 2 / -1; color: var(--muted); font-size: .88rem; white-space: pre-wrap; }
@media (max-width: 800px) { .oc-row { grid-template-columns: 1fr 1fr; } .oc-name, .oc-track, .oc-note { grid-column: 1 / -1; } }
.oc-trend { width: 100%; max-width: 720px; height: auto; display: block; }
.oc-trend text { font-size: 11px; fill: var(--muted); }
.oc-trend text.value { font-size: 13px; font-weight: 700; fill: var(--ink); }
.oc-trend .grid { stroke: var(--line); stroke-width: 1; }
.oc-trend .line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.oc-trend .dot { fill: var(--green); stroke: var(--card); stroke-width: 2; }
.oc-trend .hit { fill: transparent; }
.oc-trend a:hover .dot, .oc-trend a:focus .dot { fill: var(--green-dark); }
.oc-goal { padding: .75rem 0; border-top: 1px solid var(--line); }
.oc-goal:first-of-type { border-top: 0; }
.oc-goal-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.oc-update { margin: .3rem 0 .3rem .75rem; padding-left: .75rem; border-left: 2px solid var(--line); font-size: .9rem; }
.oc-scale { display: flex; flex-wrap: wrap; gap: .4rem; }
.oc-scale label { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .7rem; cursor: pointer; font-size: .88rem; font-weight: 400; margin: 0; }
.oc-scale input { width: auto; min-width: 0; margin: 0; }
.oc-scale label:has(input:checked) { background: var(--green-soft); border-color: var(--green); }
.oc-scale label:has(input:focus-visible) { outline: 2px solid var(--green-dark); outline-offset: 1px; }
/* Tick lists (for example the homes an employee works at) */
.tick-list > div:first-child { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .15rem .75rem; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; max-height: 16rem; overflow-y: auto; background: var(--card); }
.tick-list label { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin: 0; padding: .25rem 0; cursor: pointer; }
.tick-list input[type="checkbox"] { width: auto; min-width: 0; margin: 0; flex: none; }
.tick-tools { margin-top: .4rem; display: flex; align-items: center; gap: .5rem; }

/* A child's photo beside their name */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: .45rem; background: var(--green-soft); border: 1px solid var(--line); flex: none; }
.avatar.none { display: inline-flex; align-items: center; justify-content: center; color: var(--green-dark); font-weight: 600; line-height: 1; }
h1 .avatar { margin-right: .75rem; }
@media print { .avatar { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* Philomena Protocol form */
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-grid.phil .field.wide { grid-column: 1 / -1; }
.phil-list { margin: .25rem 0 .75rem 1.25rem; padding: 0; color: var(--muted); font-size: .9rem; }
.phil-list li { margin: .15rem 0; }

/* The dashboard on a child's profile */
.child-dash-head { margin: .25rem 0 .6rem; }
.child-dash { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.child-dash .tile { padding: .75rem 1rem; }
.child-dash .tile .num { font-size: 1.45rem; }
.dash-charts { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; }
.dash-charts .card { margin-bottom: 1.25rem; }
@media (max-width: 900px) { .dash-charts { grid-template-columns: 1fr; } }
.day-bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; }
.day-bars .day { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.day-bars .n { font-size: .72rem; color: var(--ink); height: 1rem; line-height: 1rem; }
.day-bars .bar-col { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.day-bars .bar-col span { display: block; width: 62%; max-width: 26px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.day-bars .day:hover .bar-col span { background: var(--green-dark); }
.day-bars .d { font-size: .68rem; color: var(--muted); text-align: center; line-height: 1.15; margin-top: .25rem; }
.kind-bars .kind { display: grid; grid-template-columns: 9.5rem minmax(3rem, 1fr) 2rem; gap: .6rem; align-items: center; padding: .35rem 0; font-size: .9rem; }
.kind-bars .kind strong { text-align: right; }

/* A client's logo beside their name */
.avatar.logo { border-radius: 6px; object-fit: contain; background: #fff; }

/* Care plan sections */
.dl.plan dt { color: var(--muted); }

/* The photo of a children's home, wide at the top of its page. */
.home-photo { display: block; margin: 0 0 1rem; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--green-soft); }
.home-photo img { display: block; margin: 0 auto; max-width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.home-photo.none { padding: 1.5rem 1rem; text-align: center; border-style: dashed; background: none; color: inherit; }
.avatar.home { border-radius: 6px; }
@media print { .home-photo img { max-height: 80mm;print-color-adjust: exact; -webkit-print-color-adjust: exact; } }
