/* Klick Care Vault staff UI. Plain CSS, no build step. Colour pairs meet WCAG 2.1 AA contrast. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #16202b; --muted: #55606d; --line: #d5dae1;
  --accent: #0b5cad; --accent-text: #ffffff; --danger: #a4262c;
  --ok-bg: #e3f3e8; --ok-text: #14532d; --warn-bg: #fdf0d5; --warn-text: #6b4200;
  --bad-bg: #fbe3e4; --bad-text: #7a1c20;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b; --surface: #1b2129; --text: #e7ebf0; --muted: #a3adb9; --line: #36404c;
    --accent: #6cb0f5; --accent-text: #0b1520; --danger: #f08a8f;
    --ok-bg: #173524; --ok-text: #a7e3bd; --warn-bg: #3d2f0c; --warn-text: #f3d27c;
    --bad-bg: #44191c; --bad-text: #f6b5b8;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
small, .sub { color: var(--muted); font-size: .875rem; font-weight: normal; }
code, kbd { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
kbd { border: 1px solid currentColor; border-radius: 3px; padding: 0 .3em; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.top { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem;
       background: var(--surface); border-bottom: 1px solid var(--line); }
.top .brand { font-weight: 700; text-decoration: none; color: var(--text); }
.top nav a { text-decoration: none; padding: .3rem 0; }
.top nav a[aria-current] { border-bottom: 2px solid var(--accent); font-weight: 600; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .875rem; color: var(--muted); }
.top .agency { color: var(--text); font-weight: 600; }

main { padding: 1.5rem 1.25rem 3rem; max-width: 90rem; margin: 0 auto; }
main.narrow { max-width: 28rem; margin-top: 3rem; background: var(--surface); border: 1px solid var(--line);
              border-radius: var(--radius); padding: 2rem; }

.stack { display: flex; flex-direction: column; gap: .35rem; }
.stack label, .picker legend { font-weight: 600; margin-top: .7rem; padding: 0; }
input, select, button, .button { font: inherit; }
input, select { padding: .5rem .6rem; border: 1px solid var(--muted); border-radius: var(--radius);
                background: var(--surface); color: var(--text); width: 100%; }
button, .button { padding: .55rem 1rem; border: 1px solid var(--muted); border-radius: var(--radius);
                  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
                  display: inline-block; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text);
                                  font-weight: 600; margin-top: 1rem; }
button.danger { border-color: var(--danger); color: var(--danger); margin-top: .6rem; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.keys { font-weight: normal; font-size: .8rem; margin-left: .5rem; opacity: .9; }

.error, .notice, .hint { border-radius: var(--radius); padding: .6rem .9rem; margin: 0 0 1rem; }
.error { background: var(--bad-bg); color: var(--bad-text); }
ul.error { padding-left: 2rem; }
.notice { background: var(--ok-bg); color: var(--ok-text); }
.hint { background: var(--warn-bg); color: var(--warn-text); }
.empty { color: var(--muted); padding: 2rem 0; }

.tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .5rem 0; text-decoration: none; color: var(--muted); }
.tabs a[aria-current] { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }
.count { background: var(--line); color: var(--text); border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }

.queue { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); }
.queue th, .queue td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.queue thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.queue tbody th { font-weight: 600; }
.queue tbody tr:last-child th, .queue tbody tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; border-radius: 999px; padding: 0 .55rem; font-size: .75rem; font-weight: 600;
         background: var(--line); color: var(--text); vertical-align: middle; }
.badge.urgent, .badge.trust-unknown { background: var(--warn-bg); color: var(--warn-text); }
.badge.emergency, .badge.trust-failed { background: var(--bad-bg); color: var(--bad-text); }
.badge.trust-verified, .badge.trust-known, .badge.suggested { background: var(--ok-bg); color: var(--ok-text); }
.badge.possibly { background: var(--warn-bg); color: var(--warn-text); }
.suggest-note { display: block; margin: .15rem 0 0; }
.read-text { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.read-text summary { cursor: pointer; color: var(--muted); }
.read-text pre { margin-top: .5rem; font-size: .9rem; }

.crumb { margin: 0 0 .5rem; font-size: .9rem; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(20rem, 2fr); gap: 1.5rem; align-items: start; }
@media (max-width: 60rem) { .split { grid-template-columns: 1fr; } }
.preview, .side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.preview iframe { width: 100%; height: 75vh; border: 0; }
.preview img { max-width: 100%; }
.preview audio { width: 100%; }
.preview pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-family: inherit; }
.side h2:first-child { margin-top: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; font-size: .925rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.picker { border: 0; padding: 0; margin: 0; }
.picker .chosen { margin: .2rem 0; padding: .45rem .6rem; background: var(--ok-bg); color: var(--ok-text);
                  border-radius: var(--radius); display: flex; justify-content: space-between; gap: 1rem; }
.picker label { font-weight: normal; font-size: .875rem; color: var(--muted); margin: 0; }
.results ul { list-style: none; margin: .3rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.results li + li { border-top: 1px solid var(--line); }
.results .pick { width: 100%; text-align: left; border: 0; border-radius: 0; background: none; }
.results .pick:hover, .results .pick:focus-visible { background: var(--bg); }
.results .add { margin-top: .4rem; }

/* charts */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }
.toolbar .button { margin-top: 0; white-space: nowrap; }
.searchbar { display: flex; gap: .5rem; max-width: 36rem; margin-bottom: 1rem; }
.searchbar button { white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card > h2:first-child { margin-top: 0; }
.card .queue { border: 0; }
.card .queue th, .card .queue td { padding-left: 0; }
textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--muted); border-radius: var(--radius);
           background: var(--surface); color: var(--text); width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem 1rem; max-width: 60rem; }
.form-grid .field { grid-column: span 2; display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.form-grid .field.wide { grid-column: 1 / -1; }
.form-grid .field.half { grid-column: span 1; }
.form-grid label, .form-grid legend { font-weight: 600; }
.form-grid .primary { align-self: flex-start; margin-top: .3rem; }
@media (max-width: 40rem) { .form-grid .field, .form-grid .field.half { grid-column: 1 / -1; } }
.checks { border: 0; padding: 0; margin: 0; flex-direction: row !important; flex-wrap: wrap; gap: .4rem 1.5rem; }
.checks legend { width: 100%; padding: 0; margin-bottom: .3rem; }
.checks label { font-weight: normal; display: flex; align-items: center; gap: .4rem; }
.checks input { width: auto; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.chips li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .7rem; font-size: .875rem; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { padding: .15rem 0; }
.checklist .done span[aria-hidden] { color: var(--ok-text); font-weight: 700; }
.notes { white-space: pre-wrap; margin: 0; }
.badge.status-active { background: var(--ok-bg); color: var(--ok-text); }
.badge.status-on_hold, .badge.status-on_leave, .badge.status-suspended, .badge.status-invited { background: var(--warn-bg); color: var(--warn-text); }
h1 .badge { font-size: .8rem; }

.upload { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.upload summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.upload form { max-width: 28rem; }
input[type=file] { padding: .35rem; }
h2 .count { font-weight: normal; margin-left: .3rem; }

/* a staff member's own file: one column, made for a phone */
main.portal { max-width: 42rem; }
main.portal .card { margin-bottom: 1rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: normal !important; }
.check input { width: auto; margin-top: .35rem; }
@media (max-width: 40rem) {
  .top { flex-wrap: wrap; gap: .4rem 1rem; }
  .top .who { margin-left: 0; flex-wrap: wrap; gap: .3rem .8rem; }
  main { padding: 1rem .8rem 2.5rem; }
  main.narrow { margin-top: 1rem; padding: 1.25rem; }
}

/* roster */
.badge.shift-scheduled, .badge.shift-confirmed, .badge.shift-completed { background: var(--ok-bg); color: var(--ok-text); }
.badge.shift-open, .badge.shift-in_progress { background: var(--warn-bg); color: var(--warn-text); }
.badge.shift-call_out, .badge.shift-no_show, .badge.shift-missed { background: var(--bad-bg); color: var(--bad-text); }
.badge.standing { background: var(--ok-bg); color: var(--ok-text); }
main.portal button, main.portal .button { min-height: 44px; }

.reject { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.reject summary { cursor: pointer; color: var(--muted); }

.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .8rem; }
.qr { background: #ffffff; display: inline-block; padding: .5rem; border-radius: var(--radius); margin: .5rem 0; line-height: 0; }
.secret { font-size: 1rem; letter-spacing: .08em; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.5rem; font-size: 1.05rem; }

/* The automatic sign-out warning (app.js) */
.idle-banner { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 1rem; align-items: center; padding: .8rem 1.2rem; border-radius: var(--radius);
  background: var(--warn-bg); color: var(--warn-text); box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.idle-banner button { margin: 0; }

/* A group of actions beside a heading (History, Edit, Export) */
.toolbar .actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.toolbar .actions form { margin: 0; }
.filters { align-items: end; margin-bottom: 1rem; }

/* The pager under a long list */
.pager { display: flex; gap: 1rem; align-items: center; margin: .75rem 0; }
.pager form { margin: 0; display: inline; }
