:root {
  --bg: #eceef1;
  --card: #ffffff;
  --ink: #16191d;
  --ink-2: #5b6470;
  --ink-3: #98a1ab;
  --line: #e7e9ed;
  --line-2: #eef0f3;
  --accent: #1f6feb;
  --accent-soft: #eaf1fd;
  --alert: #d92d20;
  --alert-soft: #fdecea;
  --ok: #1f8a4c;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- app bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; text-decoration: none; }
/* The two lockups differ in aspect ratio; a fixed height keeps the bar
   steady while the width breathes with whichever logo was drawn. */
.brand-logo { height: 46px; width: auto; display: block; }
.icon-btn {
  width: 40px; height: 40px; border: none; background: transparent;
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  border-radius: 10px; cursor: pointer; margin: -8px -8px -8px 0;
}
.icon-btn:active { background: var(--line-2); }

/* ---- content shell ---- */
/* Mobile-first: a single 540px column. At >=700px the shell opens to the full
   viewport width; pages that read better as a column opt back in with
   .main-narrow (via the main_class template block). */
.app-main { max-width: 540px; margin: 0 auto; padding-bottom: 40px; }
.card-grid { display: block; }
@media (max-width: 699px) {
  /* Wide tables (reading history, shift calendar) scroll sideways instead of
     overflowing the page on phones. */
  .app-main table { display: block; overflow-x: auto; }
}
@media (min-width: 700px) {
  .app-main { max-width: none; padding: 0 32px 40px; }
  .app-main.main-narrow { max-width: 640px; }
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; margin: 8px 14px; align-items: start; }
  .card-grid .card { margin: 0; }
  .card-grid .alert-banner { grid-column: 1 / -1; margin: 0; }
}
.greeting { padding: 18px 18px 6px; }
.greeting-hi { font-size: 21px; font-weight: 680; letter-spacing: -0.4px; }
.greeting-date { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.msg { margin: 8px 14px; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.msg.error { background: var(--alert-soft); color: #7a1c14; }
.msg.ok { background: #e3f4ea; color: #0a6b4f; }

/* ---- section headers ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 22px 18px 8px; }
.section-title { margin: 0; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-3); }
.section-meta { font-size: 12px; color: var(--ink-3); }

/* ---- card ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 8px 14px; box-shadow: 0 1px 2px rgba(20,25,35,0.04); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.card-title { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.2px; }
.count-pill { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }

/* ---- progress ---- */
.progress { height: 4px; background: var(--line-2); margin: 0 16px 6px; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }

/* ---- tasks ---- */
.task-list { padding: 4px 0 6px; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 11px 16px; min-height: 44px; cursor: pointer; border-top: 1px solid var(--line-2); }
.task:first-child { border-top: none; }
.task input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox { flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border: 1.8px solid #c4cad2; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: transparent; transition: all .15s ease; background: #fff; }
.task.done .checkbox { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.task-text { font-size: 15px; line-height: 1.35; color: var(--ink); }
.task.done .task-text { color: var(--ink-3); text-decoration: line-through; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-chip { font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--line-2); padding: 2px 8px; border-radius: 6px; }
.meta-loc { color: var(--accent); background: var(--accent-soft); }

/* ---- task list + detail pages ---- */
.task-link { text-decoration: none; color: inherit; }
.task-link:hover { background: #fafbfc; }
.task-go { align-self: center; font-size: 20px; line-height: 1; color: var(--ink-3); flex-shrink: 0; }
.meta-role { color: #0a6b4f; background: #d8f3e9; }
.cert-chip { font-size: 11px; font-weight: 600; color: #0f5f6b; background: #d6eef0; padding: 2px 8px; border-radius: 6px; }
.task-detail-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 4px; }
.hist-notes { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }

/* ---- shift tags ---- */
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; padding: 3px 9px; border-radius: 6px; text-transform: uppercase; flex-shrink: 0; }
.tag-c0 { color: #815400; background: #fdf0d5; }
.tag-c1 { color: #0a6b4f; background: #d8f3e9; }
.tag-c2 { color: #5b4dbd; background: #e9e7fb; }
.tag-c3 { color: #0f5f6b; background: #d6eef0; }

/* ---- readings ---- */
.alert-banner { display: flex; align-items: center; gap: 10px; margin: 6px 14px 4px; padding: 11px 14px; background: var(--alert-soft); border: 1px solid #f6c9c4; border-radius: 12px; font-size: 13px; color: #7a1c14; }
.alert-banner strong { font-weight: 700; }
a.alert-banner { text-decoration: none; }
a.alert-banner:hover span:last-child { text-decoration: underline; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--alert); flex-shrink: 0; }
.pool-attn { border-color: #f1cdc8; }
.pool-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 16px 10px; }
.pool-name { margin: 0; font-size: 17px; font-weight: 680; letter-spacing: -0.3px; }
.pool-updated { font-size: 12px; color: var(--ink-3); margin-top: 2px; display: block; }
.log-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; color: #fff; background: var(--accent); border: none; border-radius: 9px; padding: 8px 13px; cursor: pointer; flex-shrink: 0; text-decoration: none; }
.log-btn:active { background: #1a5fce; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-2); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.tile { background: var(--card); padding: 11px 14px 12px; min-height: 70px; }
.tile-top { display: flex; align-items: center; justify-content: space-between; }
.tile-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-ok { background: var(--ok); }
.dot-alert { background: var(--alert); }
.dot-empty { background: #d4d9df; }
.tile-value { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -0.5px; margin-top: 5px; color: var(--ink); }
.tile-alert .tile-value { color: var(--alert); }
.tile-empty .tile-value { color: var(--ink-3); }
.tile-unit { font-size: 11px; font-weight: 500; color: var(--ink-3); font-family: -apple-system, system-ui; margin-left: 3px; }
.tile-note { font-size: 11px; font-weight: 600; color: var(--alert); margin-top: 4px; line-height: 1.25; }
.hist-toggle { width: 100%; display: flex; align-items: center; justify-content: center; gap: 5px; background: transparent; border: none; cursor: pointer; padding: 11px; font-size: 13px; font-weight: 600; color: var(--accent); }
.hist-toggle svg { transition: transform .2s ease; }
.hist-toggle.open svg { transform: rotate(180deg); }
.hist-list { border-top: 1px solid var(--line-2); background: #fafbfc; }
.hist-list[hidden] { display: none; }
.hist { padding: 10px 16px; border-top: 1px solid var(--line-2); }
.hist:first-child { border-top: none; }
.hist-when { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.hist-date { font-size: 13px; font-weight: 650; }
.hist-time { font-size: 12px; color: var(--ink-2); }
.hist-by { font-size: 11px; color: var(--ink-3); margin-left: auto; }
.hist-vals { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-val { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; display: inline-flex; align-items: baseline; gap: 4px; }
.hist-val .hist-k { font-family: -apple-system, system-ui; font-size: 10px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; }
.hist-val.flag { color: var(--alert); border-color: #f1cdc8; background: var(--alert-soft); }
.hist-val.muted { color: var(--ink-3); }

/* ---- pool cards (pool list/detail) ---- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 18px 8px; flex-wrap: wrap; gap: 6px 16px; }
.page-title { margin: 0; font-size: 21px; font-weight: 680; letter-spacing: -0.4px; }
.page-actions { display: flex; gap: 16px; font-size: 13.5px; font-weight: 600; }
.page-actions a { color: var(--accent); text-decoration: none; }
.page-actions a:hover { text-decoration: underline; }
.pool-edit-link { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; flex-shrink: 0; }
.pool-edit-link:hover { text-decoration: underline; }
.pool-links { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 16px 12px; font-size: 13px; font-weight: 600; }
.pool-links a { color: var(--accent); text-decoration: none; }
.pool-links a:hover { text-decoration: underline; }
.pool-section { border-top: 1px solid var(--line-2); padding: 10px 16px 12px; }
.pool-section-title { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-3); margin-bottom: 6px; }
.chem-row { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; font-size: 14px; }
.chem-row .chem-name { font-weight: 600; }
.chem-row .chem-unit { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.chem-row .chem-range { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); margin-left: auto; }
.chem-row a { font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.chem-row a:hover { text-decoration: underline; }
.pool-task { font-size: 13.5px; padding: 3px 0; line-height: 1.4; }
.pool-task a { color: var(--ink); text-decoration: none; }
.pool-task a:hover { text-decoration: underline; }
.pool-task.done a { color: var(--ink-3); text-decoration: line-through; }
.pool-task .task-when { font-size: 12px; color: var(--ink-3); }
.list-empty { color: var(--ink-3); font-size: 13.5px; }

/* ---- shifts list ---- */
.shift-list { padding: 2px 0 8px; }
.shift { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-top: 1px solid var(--line-2); gap: 12px; }
.shift:first-child { border-top: none; }
.shift-you, .shift-now { background: var(--accent-soft); }
.shift-extra[hidden] { display: none; }
.shift-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shift-person { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.shift-time { font-size: 13px; color: var(--ink-2); }
.you-pill, .now-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #fff; background: var(--accent); padding: 2px 6px; border-radius: 5px; }
.more-btn { width: 100%; background: transparent; border: none; border-top: 1px solid var(--line-2); padding: 11px; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; }

/* ---- drawer ---- */
.drawer-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.drawer-root.open { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(15,20,28,0.34); opacity: 0; transition: opacity .25s ease; }
.drawer-root.open .scrim, .sheet-root.open .scrim { opacity: 1; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 78%; max-width: 320px; background: var(--card); transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,0.18); }
.drawer-root.open .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: calc(24px + env(safe-area-inset-top)) 18px 16px; border-bottom: 1px solid var(--line); }
.drawer-user { font-size: 18px; font-weight: 680; }
.drawer-sub { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.drawer-link { display: block; padding: 13px 22px; font-size: 16px; color: var(--ink); text-decoration: none; cursor: pointer; border-left: 3px solid transparent; }
.drawer-link:active { background: var(--line-2); }
.drawer-link.active { color: var(--accent); font-weight: 650; border-left-color: var(--accent); background: var(--accent-soft); }
.drawer-logout-form { margin: 0; border-top: 1px solid var(--line); }
.drawer-logout { display: block; width: 100%; text-align: left; background: none; border: none; font-family: inherit; padding: 16px 22px; font-size: 15px; font-weight: 600; color: var(--alert); text-decoration: none; cursor: pointer; }
.drawer-logout:active { background: var(--alert-soft); }

/* ---- log sheet ---- */
.sheet-root { position: fixed; inset: 0; z-index: 110; pointer-events: none; }
.sheet-root.open { pointer-events: auto; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 540px; background: var(--card); border-radius: 22px 22px 0 0; transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1); padding: 8px 18px calc(30px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,0.16); }
.sheet-root.open .sheet { transform: translateY(0); }
.sheet-grab { width: 38px; height: 5px; border-radius: 999px; background: #d4d9df; margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.sheet-eyebrow { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-3); }
.sheet-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; margin-top: 2px; }
.sheet-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field-label em { font-style: normal; color: var(--ink-3); font-weight: 500; }
.field-input { height: 46px; border: 1.5px solid var(--line); border-radius: 11px; padding: 0 13px; background: #fafbfc; font-family: var(--mono); font-size: 14px; color: var(--ink); width: 100%; }
.field-input::placeholder { color: var(--ink-3); }
.save-btn { width: 100%; height: 50px; border: none; border-radius: 13px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 650; cursor: pointer; }
.save-btn:active { background: #1a5fce; }

/* ---- generic form pages ---- */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 8px 14px; padding: 18px 18px 20px; box-shadow: 0 1px 2px rgba(20,25,35,0.04); }
.form-card .field { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-bottom: 20px; }
.form-row .field { margin-bottom: 0; }
.row-span { grid-column: 1 / -1; }
.form-card input[type="text"],
.form-card input[type="number"],
.form-card input[type="email"],
.form-card input[type="password"],
.form-card input[type="time"],
.form-card input[type="date"],
.form-card select,
.form-card textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px;
  padding: 11px 13px; background: #fafbfc; font-size: 14px; color: var(--ink);
  font-family: inherit;
}
.form-card input[type="number"] { font-family: var(--mono); }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-card textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.form-card input[type="file"] { width: 100%; font-size: 14px; color: var(--ink-2); padding: 4px 0; }
.form-card .errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--alert); font-size: 13px; font-weight: 600; }
.field-help { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.form-card .field-label { display: block; margin-bottom: 4px; }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 6px; }
.btn-primary { border: none; border-radius: 11px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 650; padding: 12px 24px; cursor: pointer; }
.btn-primary:active { background: #1a5fce; }
.btn-cancel { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.btn-cancel:hover { text-decoration: underline; color: var(--ink); }
.form-actions-page { margin: 14px 18px 4px; }
.check-inline { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; margin: 6px 0; }
.form-card .check-inline input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.radio-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.radio-list label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.radio-list input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
.dz-subhead { padding: 12px 16px 2px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); }
.dz-subhead + .person-row { border-top: none; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 4px 2px; }
.check-list label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.form-card .check-list input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.rec-card { padding: 14px 16px 16px; }
.rec-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 12px; }
.rec-grid .field { margin-bottom: 0; }
@media (max-width: 699px) { .rec-grid { grid-template-columns: 1fr 1fr; } }
.rec-remove { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--alert); cursor: pointer; }
.form-card .rec-remove input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--alert); }
.danger-link { font-size: 13px; font-weight: 600; color: var(--alert); text-decoration: none; }
.danger-link:hover { text-decoration: underline; }
.link-button { background: none; border: none; padding: 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.link-button:hover { text-decoration: underline; }
button.btn-cancel { background: none; border: none; padding: 0; cursor: pointer; }
.btn-danger { border: 1.5px solid #f1cdc8; border-radius: 11px; background: var(--alert-soft); color: var(--alert); font-size: 14px; font-weight: 650; padding: 10px 18px; cursor: pointer; }
.btn-danger:active { background: #f9ddd9; }
.btn-ghost { border: 1.5px solid var(--line); border-radius: 11px; background: var(--card); color: var(--ink-2); font-size: 14px; font-weight: 650; padding: 10px 18px; cursor: pointer; }
.btn-ghost:active { background: var(--line-2); }
.status-card { padding: 14px 16px 16px; }
.status-note { font-size: 13px; color: var(--ink-2); line-height: 1.45; margin: 0 0 12px; }
.status-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }
.modal { border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 30em; box-shadow: 0 12px 32px rgba(20,25,35,0.18); }
.modal::backdrop { background: rgba(20,25,35,0.35); }

/* ---- bulk schedule ---- */
.bulk-layout { display: flex; gap: 16px; align-items: flex-start; margin: 8px 14px; }
.bulk-main { flex: 1; min-width: 0; }
.bulk-side { width: 300px; flex-shrink: 0; }
.bulk-layout .form-card, .bulk-layout .card, .bulk-layout .msg { margin: 0 0 12px; }
@media (max-width: 899px) {
  .bulk-layout { flex-direction: column; }
  .bulk-side { width: 100%; }
}
.recent-schedule { padding: 10px 16px 12px; border-top: 1px solid var(--line-2); cursor: pointer; }
.recent-schedule:hover, .recent-schedule:focus { background: #fafbfc; outline: 2px solid var(--accent); outline-offset: -2px; }
.recent-schedule strong { font-size: 13px; }
.recent-schedule pre { font-size: 12px; margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); font-family: var(--mono); }

/* ---- shift edit ---- */
.shift-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 18px 4px; font-size: 13px; font-weight: 600; }
.shift-nav a { color: var(--accent); text-decoration: none; }
.shift-nav a:hover { text-decoration: underline; }
.person-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line-2); font-size: 14.5px; }
.person-row:first-child { border-top: none; }
.person-row form { margin: 0; }
.work-window-add { justify-content: flex-start; }
.work-window-add input[type="time"] { border: 1.5px solid var(--line); border-radius: 9px; padding: 6px 9px; background: #fafbfc; font-size: 14px; color: var(--ink); font-family: inherit; }
.work-window-add .cover-btn { margin-left: auto; }
.retired-mark { color: var(--ink-3); }
button.danger-link { background: none; border: none; padding: 0; cursor: pointer; }
.assign-row { display: flex; gap: 10px; padding: 12px 16px 14px; border-top: 1px solid var(--line-2); }
.assign-row select { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 13px; background: #fafbfc; font-size: 14px; color: var(--ink); font-family: inherit; }
.assign-row .btn-primary { padding: 10px 18px; font-size: 14px; flex-shrink: 0; }

/* ---- availability ---- */
.avail-day { padding: 10px 16px 12px; border-top: 1px solid var(--line-2); }
.avail-day:first-child { border-top: none; }
.avail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.avail-shift { margin-top: 7px; padding-left: 12px; }
.avail-date { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.avail-shift .avail-date { font-weight: 500; font-size: 13px; color: var(--ink-2); }
.avail-toggle { display: flex; gap: 8px; }
.avail-toggle form { margin: 0; }
.avail-btn { border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 5px 12px; cursor: pointer; }
.avail-btn.on-prefer { background: #d8f3e9; border-color: #b7e4cf; color: #0a6b4f; }
.avail-btn-take { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.hours-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.hours-table th, .hours-table td { padding: 10px 16px; text-align: left; border-top: 1px solid var(--line-2); }
.hours-table thead th { border-top: none; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); }
.hours-table th a { color: inherit; text-decoration: none; }
.hours-table th a.sort-active { color: var(--accent); }
.hours-table .num { text-align: right; }
.hours-table tr.over { background: var(--alert-soft); }
.hours-table tr.over td { color: var(--alert); font-weight: 650; }

/* Print: strip the app chrome (header bar, nav drawer, flash messages, and
   anything tagged .no-print) so pages print as content-only documents. */
@media print {
  .appbar, .drawer-root, .msg, .no-print { display: none !important; }
  .app-main, .app-main.main-narrow { max-width: none; margin: 0; padding: 0; }
  body { background: #fff; }
}
.avail-btn.on-unavail { background: var(--alert-soft); border-color: #f1cdc8; color: var(--alert); }
.avail-solo { padding: 12px 16px; }
.avail-chip { font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.pref-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.avail-chip-prefer { color: #0a6b4f; background: #d8f3e9; }
.avail-chip-unavail { color: var(--alert); background: var(--alert-soft); }
.shift-link { color: inherit; text-decoration: none; }
.shift-link:hover { text-decoration: underline; }
.avail-date .shift-link { display: flex; align-items: center; gap: 8px; }

/* ---- coverage requests ---- */
.cover-chip { font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: #815400; background: #fdf0d5; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.cover-actions { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.cover-actions form { margin: 0; }
.cover-btn { border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 4px 10px; cursor: pointer; }
.cover-btn:active { background: var(--line-2); }

/* ---- shift day ---- */
.shift-row { padding: 12px 16px 13px; border-top: 1px solid var(--line-2); }
.shift-row:first-child { border-top: none; }
.shift-row-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shift-row-time { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.shift-pill { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--line-2); padding: 3px 9px; border-radius: 999px; }
.shift-pill.under { color: var(--alert); background: var(--alert-soft); }
.shift-row-edit { margin-left: auto; }
.shift-row-people { margin-top: 7px; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.shift-row-people .retired { color: var(--ink-3); }
.shift-row-take { margin-top: 9px; }
.cover-take-note { font-size: 12px; color: var(--ink-3); margin-left: 6px; }

/* ---- action toast (take/cover buttons, see app.js) ---- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px);
  max-width: min(92vw, 480px); background: var(--ink); color: #fff; font-size: 14px;
  line-height: 1.4; padding: 11px 16px; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(20,25,35,0.28); opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; z-index: 130; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.toast-error { background: var(--alert); }
.toast a { color: #fff; text-decoration: underline; }

/* ---- week view ---- */
.week-day { border-top: 1px solid var(--line-2); padding-bottom: 4px; }
.week-day:first-child { border-top: none; }
.week-day-head { display: flex; align-items: center; gap: 8px; padding: 11px 16px 0; }
.week-day-date { font-size: 14px; font-weight: 700; }
.week-today { background: #f2f7ff; }
.week-shift { border-top: none; padding: 9px 16px 4px 24px; }
.week-empty { padding: 6px 24px 10px; margin: 0; }

.week-dup { padding: 2px 18px 8px; font-size: 13px; }
.week-dup a { color: var(--accent); text-decoration: none; font-weight: 600; }
.week-dup a:hover { text-decoration: underline; }
.week-dup-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; }
.week-dup-form[hidden] { display: none; }
.week-dup-target { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.week-dup-form select { border: 1.5px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #fafbfc; font-size: 13px; color: var(--ink); font-family: inherit; }
.week-dup-form input.week-dup-repeat { width: 58px; border: 1.5px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #fafbfc; font-size: 13px; color: var(--ink); font-family: inherit; }
.week-dup-form .btn-primary { padding: 7px 16px; font-size: 13px; }

/* Wide screens: the week becomes seven calendar-style columns, first
   work-week day first. Phones keep the stacked agenda above. */
@media (min-width: 700px) {
  .week-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
  .week-grid .week-day { border-top: none; border-left: 1px solid var(--line-2); min-width: 0; padding-bottom: 10px; }
  .week-grid .week-day:first-child { border-left: none; }
  .week-grid .week-day-head { flex-wrap: wrap; gap: 6px; padding: 10px 10px 0; }
  .week-grid .week-day-date { font-size: 13px; }
  .week-grid .week-shift { padding: 9px 10px 0; }
  .week-grid .shift-row-top { gap: 6px; }
  .week-grid .shift-row-time { font-size: 12.5px; }
  .week-grid .shift-row-people { font-size: 12.5px; margin-top: 4px; }
  .week-grid .week-empty { padding: 8px 10px 0; }
}

/* ---- reading tables ---- */
.table-card { overflow-x: auto; }
.rtable { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.rtable th { text-align: left; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); padding: 12px 12px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rtable th:first-child, .rtable td:first-child { padding-left: 16px; }
.rtable th:last-child, .rtable td:last-child { padding-right: 16px; }
.rtable td { padding: 9px 12px; border-top: 1px solid var(--line-2); vertical-align: top; color: var(--ink); }
.rtable tbody tr:first-child td { border-top: none; }
.rtable .val { font-family: var(--mono); font-weight: 600; }
.rtable .val.flag { color: var(--alert); }
.rtable a.val { color: inherit; text-decoration: none; border-bottom: 1px dotted #c4cad2; }
.rtable a.val:hover { border-bottom-color: var(--accent); }
.rtable a.val.flag { color: var(--alert); border-bottom-color: #f1cdc8; }
.rtable .rtable-unit { text-transform: none; font-weight: 500; letter-spacing: 0; }
.rtable .cell-note { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; max-width: 22em; }

/* ---- chart uploads ---- */
.cu-layout { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin: 8px 14px; }
.cu-image { flex: 1 1 480px; max-width: 900px; min-width: 0; }
.cu-image img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.cu-filename { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.cu-sheet { flex: 2 1 540px; min-width: 0; }
.cu-layout .card { margin: 0; }
.rtable input[type="text"] { border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; background: #fafbfc; font-family: var(--mono); }
.rtable input[type="text"]:focus { outline: none; border-color: var(--accent); background: #fff; }
.rtable input.prefilled { background: #fff7c4; }
.cu-match { font-size: 11px; color: var(--ink-3); }
.cu-mismatch { font-size: 11px; font-weight: 700; color: var(--alert); }
.cu-extra { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 4px 0; }
.cu-extra-btn { padding: 6px 12px; font-size: 13px; }

/* ---- pool reorder ---- */
.reorder-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.form-card input[type="number"].reorder-input { width: 76px; padding: 8px 10px; }
.reorder-name { font-size: 15px; font-weight: 600; }
.reorder-handle { display: flex; align-items: center; padding: 8px 4px; color: var(--ink-3); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.reorder-row.dragging { background: var(--accent-soft); border-radius: 10px; }
#reorder-list.js-drag .reorder-input { display: none; }
.reorder-row.dragging .reorder-handle { cursor: grabbing; }

/* ---- delete confirmations ---- */
.danger-title { color: var(--alert); }
.danger-card { background: var(--alert-soft); border: 1px solid #f1cdc8; border-radius: var(--r); margin: 8px 14px; padding: 14px 16px 16px; font-size: 14px; color: #7a1c14; line-height: 1.5; }
.danger-card ul { margin: 6px 0; padding-left: 20px; }
.danger-card p { margin: 6px 0; }
.danger-card code { font-family: var(--mono); font-size: 13px; }
.btn-danger-solid { border: none; border-radius: 11px; background: var(--alert); color: #fff; font-size: 15px; font-weight: 650; padding: 12px 24px; cursor: pointer; }
.btn-danger-solid:active { background: #b3241a; }

/* ---- login ---- */
.login-head { text-align: center; padding: 40px 18px 12px; }
.login-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.login-sub { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }
.login-card .btn-primary { width: 100%; padding: 13px 24px; }
.login-foot { text-align: center; margin-top: 14px; font-size: 13.5px; font-weight: 600; }
.login-foot a { color: var(--accent); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* ---- location cards ---- */
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; display: block; }
.loc-body { padding: 2px 16px 14px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.loc-group { width: 100%; }
.loc-group-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); margin-bottom: 5px; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.loc-chip { font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--line-2); padding: 4px 10px; border-radius: 8px; text-decoration: none; }
.loc-chip-pool { color: var(--accent); background: var(--accent-soft); }
a.loc-chip-pool:hover { text-decoration: underline; }
.loc-none { font-size: 12.5px; color: var(--ink-3); }
.user-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 16px 12px; border-top: 1px solid var(--line-2); }
.user-row:first-child { border-top: none; }
.user-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.user-name { font-size: 15px; font-weight: 600; }
.user-sub { font-size: 12.5px; color: var(--ink-2); }
.user-retired .user-name, .user-retired .user-sub { color: var(--ink-3); }
/* Columns layout (SiteSettings.user_list_layout='columns'): one grid row per
   account so usernames, names, phones, and roles align down the page. */
.user-cols-wrap { overflow-x: auto; }
.user-cols {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(110px, 1.2fr) minmax(90px, 1fr) minmax(110px, 1.3fr) minmax(130px, 1.5fr) auto;
  gap: 4px 14px; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--line-2); min-width: 720px;
}
.user-cols:first-child { border-top: none; }
.user-cols-head { padding: 12px 16px 6px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); }
.user-cell { font-size: 13.5px; color: var(--ink-2); }
.user-roles { display: flex; flex-wrap: wrap; gap: 4px; }
.user-retired .user-cell { color: var(--ink-3); }
.area-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.35; align-self: center; }
.area-actions { display: flex; gap: 14px; align-self: center; flex-shrink: 0; }
a.meta-chip { text-decoration: none; }
a.meta-chip:hover { text-decoration: underline; }

/* Unsaved-changes hint — rendered hidden inside opt-in forms (the
   data-unsaved-hint element); app.js fills it with a running edit count. */
.unsaved-hint {
  /* Stick just below the (sticky, z-index 5) app bar while the user is
     deep in a long form; z-index 4 so it slides under the bar. */
  position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 4;
  margin: 0 0 14px; padding: 9px 13px; border-radius: 9px;
  background: var(--alert-soft); color: var(--alert);
  font-size: 13.5px; font-weight: 650;
  border: 1px solid #f6c9c4; box-shadow: 0 2px 6px rgba(20,25,35,0.08);
}
/* The log-reading bottom sheet doesn't scroll — no need to stick. */
.sheet .unsaved-hint { position: static; }

/* Dismissible card (the dashboard's Open cover requests tile): count pill
   plus a small × in the card head's top-right corner. */
.card-head-side { display: flex; align-items: center; gap: 6px; }
.card-head-side form { margin: 0; display: flex; }
.card-dismiss { border: none; background: none; color: var(--ink-3); padding: 5px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; }
.card-dismiss:hover { background: var(--line-2); color: var(--ink); }
.drawer-link .count-pill { font-size: 11px; padding: 2px 7px; margin-left: 2px; }
.login-logo { display: block; margin: 0 auto 20px; max-width: 100%; height: auto; }
body.login-page { background: #fff; }
