/* CATsNAP — shelter logs & scheduling */

:root {
  --bg: #f6f2ea;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --ink: #1e2427;
  --ink-2: #3a4246;
  --muted: #6c757a;
  --line: #e6dfd2;
  --line-strong: #d3c9b8;
  --brand: #22615c;
  --brand-hover: #1a4f4b;
  --brand-ink: #ffffff;
  --brand-soft: #e1eeec;
  --am: #f7e7b4;
  --am-strong: #e7c25a;
  --am-ink: #5c4510;
  --pm: #dbe6f8;
  --pm-strong: #8fb0e3;
  --pm-ink: #213d6b;
  --danger: #b3261e;
  --danger-soft: #fbe6e4;
  --warn: #9a5b00;
  --warn-soft: #fdf0d6;
  --ok: #2b7a4b;
  --ok-soft: #e0f2e7;
  --info: #3b5b8f;
  --info-soft: #e5ecf7;
  --medical: #6a4c93;
  --medical-soft: #efe8f7;
  --highlight: #f4f19a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.06), 0 4px 14px rgba(40, 30, 10, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131819;
    --surface: #1b2224;
    --surface-2: #202829;
    --ink: #e9ecec;
    --ink-2: #c9d0d1;
    --muted: #9aa5a8;
    --line: #2c3638;
    --line-strong: #3b4749;
    --brand: #62b8ad;
    --brand-hover: #7cc9bf;
    --brand-ink: #0c1918;
    --brand-soft: #1f3533;
    --am: #3a3117;
    --am-strong: #8a7030;
    --am-ink: #f1d68a;
    --pm: #1d2a3f;
    --pm-strong: #45679b;
    --pm-ink: #b9cff3;
    --danger: #ff8a80;
    --danger-soft: #3b2120;
    --warn: #f0b65a;
    --warn-soft: #3a2c15;
    --ok: #74c995;
    --ok-soft: #1c3426;
    --info: #9bb7e6;
    --info-soft: #1f2a3b;
    --medical: #c3a6ec;
    --medical-soft: #2c2340;
    --highlight: #4a4818;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.print-only { display: none; }

.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.icon svg { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 38px; padding: 0.45rem 0.9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0.25rem 0.65rem; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; align-items: center; gap: 0.15rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn.tiny { width: 24px; height: 24px; }

:where(input:not([type='checkbox']):not([type='radio'])), select, textarea {
  width: 100%; min-height: 40px; padding: 0.45rem 0.65rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
textarea { resize: vertical; }
input.input-short { max-width: 8rem; }
input.input-date { width: auto; min-height: 34px; padding: 0.25rem 0.5rem; }

.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; flex: 1; }
.field-label { font-weight: 600; font-size: 0.88rem; }
.hint { color: var(--muted); font-size: 0.8rem; }
.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-row > .field { min-width: 10rem; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.check-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.check-list { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.inline { display: flex; gap: 0.5rem; align-items: center; }
.inline input { width: auto; }
.form-error { padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 600; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 0.3rem 0.75rem; border-radius: 7px; font-weight: 600; font-size: 0.88rem; color: var(--muted); cursor: pointer; min-height: 30px; }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.chip-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip-highlight { background: var(--highlight); border-color: transparent; color: var(--ink); }
.chip-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.chip-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip-muted { color: var(--muted); }
.chip-removable button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 0.15rem; font-size: 1rem; line-height: 1; }
.role-admin { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.role-experienced { background: var(--info-soft); color: var(--info); border-color: transparent; }

.initials {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 36px; height: 36px; padding: 0 0.35rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 0.85rem; letter-spacing: 0.02em;
}
.initials.sm { min-width: 26px; height: 26px; font-size: 0.72rem; }
.initials.lg { min-width: 56px; height: 56px; font-size: 1.2rem; }
.initials.ok { background: var(--ok-soft); color: var(--ok); }

.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 14px; font-weight: 800; font-size: 1.15rem; }
.av-0 { background: #f6dcc8; color: #8a4b1c; }
.av-1 { background: #d8e9d3; color: #2f6327; }
.av-2 { background: #dde3f6; color: #33478a; }
.av-3 { background: #f3d9e3; color: #8a2f54; }
.av-4 { background: #ece3cf; color: #6b5420; }
.av-5 { background: #d6ebea; color: #1f625d; }
@media (prefers-color-scheme: dark) {
  .avatar { filter: brightness(0.8) saturate(1.1); }
}

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 0.9rem; padding: 2rem; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.auth-brand .logo-mark { width: 44px; height: 44px; }

.logo-mark { display: inline-flex; width: 34px; height: 34px; color: var(--brand); }
.logo-mark svg { width: 100%; height: 100%; overflow: visible; }
.logo-eyes { stroke: var(--surface); }
.logo-z { font: 800 9px var(--font); fill: var(--brand); }
.wordmark { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; color: var(--ink); }
.wordmark b { color: var(--brand); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem;
  padding: 1.1rem 0.8rem; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 0.55rem; padding: 0.2rem 0.5rem; text-decoration: none !important; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 600; text-decoration: none !important; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand); }
.nav-link .icon { width: 1.25em; height: 1.25em; }
.me { display: flex; align-items: center; gap: 0.25rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.me-link { display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0; padding: 0.3rem; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none !important; }
.me-link:hover { background: var(--surface-2); }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 700; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 0.78rem; color: var(--muted); }
.content { min-width: 0; }
.main { padding: 1.5rem 2rem 4rem; outline: none; min-width: 0; }
.demo-banner { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 2rem; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 0.88rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .main { min-width: 0; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 0.25rem 0.5rem; padding: 0.5rem 0.75rem; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { order: 1; }
  .me { order: 2; margin-left: auto; padding: 0; border: 0; }
  .me-text { display: none; }
  .nav { order: 3; flex-direction: row; flex: 1 0 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; gap: 0.25rem; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { flex: none; padding: 0.4rem 0.65rem; font-size: 0.9rem; }
  .main { padding: 1rem 0.9rem 4rem; }
  .demo-banner { padding: 0.45rem 0.9rem; }
  h1 { font-size: 1.35rem; }
}

/* ---------------------------------------------------------------- page scaffolding */
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; }
.page-narrow { max-width: 720px; }
.page-wide { max-width: 1500px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-sub { color: var(--muted); margin-top: 0.2rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 0.4rem; padding: 0 0.6rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); flex: 1; max-width: 320px; color: var(--muted); }
.search input { border: 0 !important; padding-left: 0 !important; background: transparent !important; min-height: 38px; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; align-items: start; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 0.6rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty.error strong { color: var(--danger); }
.loading { display: flex; align-items: center; justify-content: center; gap: 0.6rem; padding: 3rem; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.back { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 600; font-size: 0.9rem; }
.row-actions { display: inline-flex; gap: 2px; align-items: center; }
.warn-text { color: var(--warn); display: flex; align-items: center; gap: 0.3rem; }

/* ---------------------------------------------------------------- today */
.today-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.today-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.crew { display: flex; align-items: center; gap: 0.5rem 0.9rem; flex-wrap: wrap; }
.crew-person { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.6rem 1rem; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 700; text-decoration: none !important; }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }

.sheet-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.sheet-progress { flex: 1; min-width: 220px; max-width: 480px; }
.progress { margin-top: 0.4rem; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width 0.3s; }
.sheet-tools { display: flex; align-items: center; gap: 1rem; }

.section-banner { margin-top: 0.75rem; padding: 0.55rem 0.9rem; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 5px solid var(--line-strong); }
.section-banner h2 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; }
.section-banner p { color: var(--muted); font-size: 0.88rem; }
.tone-medical { border-left-color: var(--medical); background: var(--medical-soft); }
.tone-sick { border-left-color: var(--danger); background: var(--danger-soft); }
.tone-sick h2 { color: var(--danger); }
.tone-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.banner-warn { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.1rem 0.5rem; border-radius: 99px; background: var(--danger); color: #fff; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
.stop-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.7rem 0.2rem 0.3rem; }
.stop-loc { font-weight: 800; }
.stop-note { color: var(--medical); font-weight: 600; font-size: 0.88rem; }

.sheet-list { display: flex; flex-direction: column; gap: 0.4rem; }
.sheet-row {
  display: grid; grid-template-columns: minmax(130px, 200px) 1fr auto; gap: 0.4rem 1rem; align-items: start;
  padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.sheet-row.is-done { background: var(--surface-2); }
.sheet-row.is-done .sheet-lines { color: var(--muted); }
.sheet-name { font-weight: 800; font-size: 1.05rem; color: var(--ink); margin-right: 0.35rem; }
.sheet-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.sheet-lines li { display: flex; gap: 0.5rem; align-items: flex-start; }
.sheet-lines .icon { margin-top: 0.15em; color: var(--muted); }
.line-med .icon { color: var(--medical); }
.line-med .line-text { font-weight: 700; }
.line-sub { display: block; color: var(--muted); font-size: 0.85rem; }
.is-skipped .line-text { text-decoration: line-through; }
.sheet-note { grid-column: 2 / 3; display: flex; gap: 0.35rem; align-items: flex-start; font-size: 0.88rem; color: var(--warn); }
.sign-actions, .sign-done { display: flex; align-items: center; gap: 0.4rem; grid-column: 3; grid-row: 1; }
.btn-sign { min-height: 42px; }
.sign-meta { display: flex; flex-direction: column; font-size: 0.8rem; line-height: 1.25; font-weight: 600; }
@media (max-width: 700px) {
  .sheet-row { grid-template-columns: 1fr auto; }
  .sheet-lines, .sheet-note { grid-column: 1 / -1; }
  .sign-actions, .sign-done { grid-column: 2; }
}

/* daily log table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.log-table, .people-table { width: 100%; border-collapse: collapse; }
.log-table th, .log-table td, .people-table th, .people-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.log-table thead th, .people-table thead th { background: var(--ink); color: var(--surface); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.log-table tbody tr:hover { background: var(--surface-2); }
.log-table .c-cat { font-weight: 700; white-space: nowrap; }
.log-table .c-cat a { color: var(--ink); }
.log-table .c-food, .log-table .c-water, .log-table .c-meds, .log-table .c-init { text-align: center; width: 1%; }
.group-row th { background: var(--surface-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.group-row.tone-sick th { background: var(--danger-soft); color: var(--danger); }
.group-row.tone-medical th { background: var(--medical-soft); color: var(--medical); }
.group-row .banner-warn { margin-left: 0.5rem; }
.litter { display: inline-flex; gap: 3px; }
.litter button { min-width: 42px; min-height: 36px; padding: 0 0.5rem; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.litter button.is-active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tick-btn { width: 40px; height: 36px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tick-btn:hover { color: var(--line-strong); }
.tick-btn.is-on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.tick { color: var(--ok); display: inline-flex; }
.tick .icon { width: 1.4em; height: 1.4em; }
.med-due { font-weight: 700; color: var(--warn); font-size: 0.85rem; }
.med-partial { font-weight: 700; color: var(--warn); font-size: 0.85rem; }
.comment-btn { border: 0; background: none; text-align: left; cursor: pointer; padding: 0.3rem; border-radius: 6px; font-size: 0.88rem; min-height: 34px; max-width: 280px; }
.comment-btn:hover { background: var(--surface-2); }
.comment-btn.has-comment { color: var(--ink-2); }
.legend { margin-top: -0.4rem; }
@media (max-width: 760px) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  .log-table thead { display: none; }
  .log-table, .log-table tbody { display: block; }
  .log-table tr:not(.group-row) {
    display: grid; grid-template-columns: auto auto auto 1fr auto; grid-template-areas: 'cat cat cat cat init' 'litter litter litter litter litter' 'food water meds comment comment';
    gap: 0.4rem 0.5rem; align-items: center; margin-bottom: 0.4rem; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  }
  .log-table tr.group-row { display: block; margin: 0.8rem 0 0.4rem; }
  .log-table tr.group-row th { display: block; border-radius: var(--radius-sm); border: 0; }
  .log-table td, .log-table th { border: 0; padding: 0; }
  .log-table .c-cat { grid-area: cat; }
  .log-table .c-init { grid-area: init; }
  .log-table .c-litter { grid-area: litter; }
  .log-table .c-food { grid-area: food; }
  .log-table .c-water { grid-area: water; }
  .log-table .c-meds { grid-area: meds; }
  .log-table .c-comment { grid-area: comment; }
  .log-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }
  .log-table .c-litter::before, .log-table .c-comment::before, .log-table .c-init::before { display: none !important; }
  .litter { display: flex; }
  .litter button { flex: 1; min-height: 40px; }
}

/* ---------------------------------------------------------------- whiteboard */
.whiteboard { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1.5rem; border-radius: 14px; background: var(--surface); border: 8px solid #2a2a2a; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .whiteboard { border-color: #0a0c0c; } }
.board-section { padding-bottom: 0.5rem; border-bottom: 2px dashed var(--line); }
.board-section:last-of-type { border-bottom: 0; }
.board-section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.board-section-head h2 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 1.15rem; text-decoration: underline; text-underline-offset: 4px; }
.board-section.tone-medical h2 { color: var(--medical); }
.board-section.tone-sick h2 { color: var(--danger); }
.board-section-head p { color: var(--muted); }
.board-stops { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.board-stop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; font-size: 1.05rem; padding: 0.15rem 0; }
.board-stop .stop-loc { min-width: 6.5rem; }
.stop-dash { color: var(--muted); }
.stop-cats a { color: var(--ink); }
.stop-cats a.is-archived { color: var(--muted); text-decoration: line-through; }
.stop-flags { display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.whiteboard.is-editing .board-stop { padding: 0.35rem 0.5rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.whiteboard.is-editing .board-stop .row-actions { margin-left: auto; }
.add-stop { margin-top: 0.3rem; }
.add-section { align-self: flex-start; }
.picker { display: flex; flex-direction: column; gap: 0.5rem; }
.pick-list { margin: 0; padding: 0.4rem; list-style: none; counter-reset: pick; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); max-height: 260px; overflow-y: auto; }
.pick-list li { display: flex; align-items: center; gap: 0.1rem; padding: 0.1rem 0.25rem; counter-increment: pick; }
.pick-list li.muted { counter-increment: none; padding: 0.4rem; }
.pick-name { flex: 1; font-weight: 600; }
.pick-name::before { content: counter(pick) '.'; color: var(--muted); display: inline-block; min-width: 1.6rem; font-weight: 400; }
.picker-add { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.picker-add select { flex: 1; min-width: 10rem; width: auto; }
.picker-new { display: flex; gap: 0.4rem; flex: 1; min-width: 14rem; }

/* ---------------------------------------------------------------- med cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.9rem; align-items: start; }
.index-card {
  position: relative; display: flex; flex-direction: column; gap: 0.45rem;
  padding: 0.8rem 1rem 1rem; border-radius: 4px; box-shadow: var(--shadow);
  background: var(--surface) repeating-linear-gradient(to bottom, transparent 0, transparent 23px, rgba(80, 130, 200, 0.18) 23px, rgba(80, 130, 200, 0.18) 24px);
  background-position: 0 34px; border-top: 2px solid rgba(214, 79, 79, 0.55);
}
.index-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.card-name { font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.card-where { color: var(--muted); font-size: 0.85rem; text-align: right; }
.card-food { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.92rem; }
.slot-tag { flex: none; font-size: 0.68rem; font-weight: 800; padding: 0.05rem 0.4rem; border-radius: 4px; }
.slot-tag.am { background: var(--am); color: var(--am-ink); }
.slot-tag.pm { background: var(--pm); color: var(--pm-ink); }
.card-items { list-style: none; margin: 0.2rem 0 0; padding: 0.5rem 0 0; border-top: 1px dashed var(--line-strong); display: flex; flex-direction: column; gap: 0.5rem; }
.card-item { display: flex; gap: 0.5rem; font-size: 0.92rem; }
.card-item > .icon { color: var(--medical); margin-top: 0.15em; }
.food-rows { display: flex; flex-direction: column; gap: 0.35rem; }

/* ---------------------------------------------------------------- cats */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.cat-tile { display: flex; gap: 0.75rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); }
.cat-tile:hover { border-color: var(--brand); }
.cat-tile-body { min-width: 0; }
.cat-tile-name { font-weight: 800; display: flex; gap: 0.4rem; align-items: center; }
.cat-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.cat-head .avatar { width: 64px; height: 64px; font-size: 1.6rem; border-radius: 18px; }
.cat-head-main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 0.2rem; }
.cat-head-main h1 { display: flex; align-items: center; gap: 0.5rem; }
.cat-notes { padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: var(--warn-soft); white-space: pre-wrap; }
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.item-row { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem; border-radius: var(--radius-sm); }
.item-row:hover { background: var(--surface-2); }
.item-row > .icon { color: var(--medical); margin-top: 0.2em; }
.item-row.is-past { opacity: 0.6; }
.item-main { flex: 1; min-width: 0; }
.item-main .chip { margin-left: 0.35rem; }
.past summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 0.88rem; }
.signoff-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.signoff-list li { display: grid; grid-template-columns: 6.5rem auto 1fr; gap: 0.6rem; align-items: start; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.signoff-list li:last-child { border-bottom: 0; }
.signoff-list .is-skipped { text-decoration: line-through; color: var(--warn); }
.quick-log { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.kind-btn.kind-health { border-color: var(--medical-soft); }
.timeline { list-style: none; margin: 0; padding: 0; }
.day-sep { margin: 0.8rem 0 0.2rem; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.day-sep:first-child { margin-top: 0; }
.entry { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.entry-time { flex: none; width: 4.8rem; color: var(--muted); font-size: 0.85rem; padding-top: 0.1rem; }
.entry-body { flex: 1; min-width: 0; }
.entry-notes { white-space: pre-wrap; font-size: 0.9rem; color: var(--ink-2); }
.kind { display: inline-block; padding: 0 0.45rem; border-radius: 5px; font-size: 0.78rem; font-weight: 800; }
.kind-care { background: var(--am); color: var(--am-ink); }
.kind-health { background: var(--medical-soft); color: var(--medical); }

/* ---------------------------------------------------------------- shelter log */
.composer textarea { min-height: 80px; }
.composer-foot { display: flex; justify-content: flex-end; gap: 0.5rem; }
.composer-foot select { width: auto; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.post { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.post.is-incident { border-left: 4px solid var(--danger); }
.post-body { flex: 1; min-width: 0; }
.post-body p { white-space: pre-wrap; margin-top: 0.2rem; }
.post-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------- calendar (rota) */
.rota { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.5rem; }
@media (max-width: 1100px) { .rota { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.rota-day { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rota-day.is-today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.rota-day.is-past { opacity: 0.8; }
.rota-date { display: flex; justify-content: space-between; align-items: baseline; padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--line); }
.rota-date .dow { font-weight: 800; }
.rota-date .dnum { font-weight: 700; color: var(--muted); }
.rota-day.is-today .rota-date { background: var(--brand-soft); color: var(--brand); }
.rota-block { display: flex; flex-direction: column; }
.rota-row { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.35rem 0.6rem; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.slot-am .rota-row { background: var(--am); color: var(--am-ink); }
.slot-am .rota-row.role-extra { background: color-mix(in srgb, var(--am-strong) 55%, var(--am)); }
.slot-pm .rota-row { background: var(--pm); color: var(--pm-ink); }
.slot-pm .rota-row.role-extra { background: color-mix(in srgb, var(--pm-strong) 55%, var(--pm)); }
.rota-label { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.8; }
.rota-row.role-lead .rota-label { font-size: 0.78rem; opacity: 1; }
.rota-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; min-height: 1.6rem; }
.rota-person { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; padding: 0.1rem 0.25rem; margin-left: -0.25rem; border: 0; border-radius: 6px; background: transparent; color: inherit; font-weight: 700; text-align: left; cursor: default; }
button.rota-person { cursor: pointer; }
button.rota-person:hover { background: rgba(255, 255, 255, 0.55); }
.rota-person.is-me .rota-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.rota-note { font-weight: 500; font-size: 0.82rem; opacity: 0.85; }
.rota-note::before { content: '– '; }
.rota-add { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.45rem; border: 1px dashed currentColor; border-radius: 6px; background: transparent; color: inherit; opacity: 0.55; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.rota-add:hover { opacity: 1; background: rgba(255, 255, 255, 0.5); }
@media (prefers-color-scheme: dark) {
  button.rota-person:hover, .rota-add:hover { background: rgba(255, 255, 255, 0.08); }
}

/* ---------------------------------------------------------------- people / account */
.people-table tr.is-inactive td { color: var(--muted); }
.people-table .row-actions { justify-content: flex-end; }
.account-card { flex-direction: row; align-items: center; gap: 1rem; }
.form-card { max-width: 420px; }
.form-card .btn { align-self: flex-start; }
.day-chips { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { display: inline-block; padding: 0.3rem 0.65rem; border: 1px solid var(--line-strong); border-radius: 99px; font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.day-chip input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.day-chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------------------------------------------------------- modal & toasts */
.modal { width: min(520px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.modal-wide { width: min(720px, calc(100vw - 1.5rem)); }
.modal::backdrop { background: rgba(20, 20, 15, 0.45); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem 1rem 0.6rem 1.25rem; }
.modal-body { display: flex; flex-direction: column; gap: 0.85rem; padding: 0.25rem 1.25rem 1rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }
#toasts { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.toast { padding: 0.6rem 1rem; border-radius: 10px; background: var(--ink); color: var(--surface); font-weight: 600; box-shadow: var(--shadow); transition: opacity 0.3s, transform 0.3s; max-width: min(90vw, 480px); }
.toast-error { background: var(--danger); color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }

/* ---------------------------------------------------------------- print */
/* ---------------------------------------------------------------- notifications, shift comments, training */
.bell { position: relative; }
.bell .badge { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 800; line-height: 16px; text-align: center; }
.notice-banner { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.6rem 0.85rem; border: 0; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.notice-more { margin-left: auto; text-decoration: underline; white-space: nowrap; }
.notice { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); font-weight: 600; }
.notice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.notice-list li { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.6rem; align-items: start; }
.notice-list li > .icon { color: var(--warn); margin-top: 2px; }
.notice-actions { grid-column: 2; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.shift-comments .card-head h2 { display: flex; align-items: center; gap: 0.4rem; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.comment { display: flex; gap: 0.6rem; align-items: flex-start; }
.comment .post-body p { margin-top: 0.1rem; }
.comment-form { display: flex; gap: 0.5rem; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 44px; }
.chip-train { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.role-junior { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.rota-entry { display: flex; flex-direction: column; gap: 0.15rem; }
.rota-trainees { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; margin-left: 0.55rem; padding-left: 0.6rem; border-left: 2px solid currentColor; }
.rota-trainee { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.05rem 0.2rem; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-weight: 600; font-size: 0.85rem; text-align: left; }
button.rota-trainee { cursor: pointer; }
button.rota-trainee:hover { background: rgba(255, 255, 255, 0.45); }
.rota-warn { display: flex; align-items: center; gap: 0.3rem; margin: 0.35rem 0.5rem 0.45rem; padding: 0.2rem 0.45rem; border-radius: 6px; background: var(--danger-soft); color: var(--danger); font-size: 0.78rem; font-weight: 700; }
.cage-mark { font-size: 0.85rem; font-weight: 700; color: var(--ok); }
.training-fields { display: flex; flex-direction: column; gap: 0.5rem; }

@media print {
  @page { margin: 12mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --muted: #444; --line: #999; --line-strong: #777; }
  body { font-size: 11pt; background: #fff; }
  .sidebar, .no-print, .demo-banner, .crew, .tabs, .today-controls, .icon-btn, .btn, .rota-add { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .print-only { display: block; }
  .print-title { font-weight: 800; font-size: 14pt; margin-bottom: 6pt; }
  .today-head, .sheet-summary { display: none; }
  .sheet-row { grid-template-columns: 1.4in 1fr 0.7in; break-inside: avoid; border-radius: 0; border-width: 0 0 1px; padding: 4pt 0; box-shadow: none; }
  .sign-actions, .sign-done { display: none !important; }
  .print-sign { grid-column: 3; grid-row: 1 / span 3; border: 1px solid #000; min-height: 0.35in; text-align: center; font-weight: 800; padding-top: 4pt; }
  .section-banner { break-after: avoid; border: 0; border-bottom: 2px solid #000; border-radius: 0; background: none !important; padding-left: 0; }
  .banner-warn { background: none; color: #000; border: 1px solid #000; }
  .log-table thead th { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .log-table th, .log-table td { border: 1px solid #999; padding: 3pt 5pt; }
  .tick-btn, .litter button { border: 0; background: none; min-height: 0; }
  .litter button:not(.is-active) { display: none; }
  .tick-btn:not(.is-on) { visibility: hidden; }
  .index-card { break-inside: avoid; box-shadow: none; border: 1px solid #999; background: #fff; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  a { color: #000; }
}
