/* ============================================================
   RespiteCare — design system
   Subject: respite care handovers. Signature: the allergy band.
   Type: Georgia display / system sans body / mono for records.
   ============================================================ */

:root {
  /* colour */
  --rc-ink:         #10312A;
  --rc-ink-2:       #24463E;
  --rc-primary:     #0E6E6B;
  --rc-primary-strong:#0A5754;
  --rc-primary-lift:#14847F;
  --rc-primary-soft:#E3EFEE;
  --rc-mist:        #F2F6F4;
  --rc-surface:     #FFFFFF;
  --rc-line:        #E1E9E6;
  --rc-mute:        #5F736E;
  --rc-band:        #C4553B;   /* allergy / incident — the one loud colour */
  --rc-band-soft:   #FBEBE6;
  --rc-meadow:      #3F8F5B;
  --rc-meadow-soft: #E4F2E8;
  --rc-sun:         #B47A15;
  --rc-sun-soft:    #FBF1DC;
  --rc-shadow:      0 1px 2px rgba(16,49,42,.05), 0 8px 24px rgba(16,49,42,.06);
  --rc-shadow-lift: 0 2px 6px rgba(16,49,42,.08), 0 16px 40px rgba(16,49,42,.10);

  /* type */
  --rc-display: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --rc-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rc-data: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* rhythm */
  --rc-radius: 12px;
  --rc-radius-sm: 8px;
  --rc-gutter: 1.5rem;

  --bs-body-bg: var(--rc-mist);
  --bs-body-color: var(--rc-ink);
  --bs-primary: var(--rc-primary);
  --bs-primary-rgb: 14,110,107;
  --bs-border-color: var(--rc-line);
  --bs-link-color: var(--rc-primary);
  --bs-link-hover-color: var(--rc-primary-lift);
}

* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--rc-body);
  background: var(--rc-mist);
  color: var(--rc-ink);
  font-size: .95rem;
  line-height: 1.55;
}

/* ---------- Type scale ---------- */
h1, .h1, h2, .h2, h3, .h3 { font-family: var(--rc-display); letter-spacing: -.015em; font-weight: 600; }
h4, .h4 { font-family: var(--rc-display); letter-spacing: -.01em; font-weight: 600; }
h5, .h5, h6, .h6 { font-family: var(--rc-body); font-weight: 600; letter-spacing: .005em; }
.h6 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--rc-mute); }

code, .mono, .code-input, .backup-grid code { font-family: var(--rc-data); font-size: .86em; }
code { color: var(--rc-ink-2); background: var(--rc-primary-soft); padding: .1em .38em; border-radius: 5px; }

.page-head { padding: .25rem 0 .35rem; }
.page-head h1 { font-size: 1.55rem; margin-bottom: .15rem; }
.page-head p { font-size: .9rem; color: var(--rc-mute); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* THE FIX: a scrollable flex column, not a fixed 100vh box */
.app-sidebar {
  width: 244px; flex: 0 0 244px;
  background: var(--rc-ink); color: #C9DAD5;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 1rem .75rem 1.25rem;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 8px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 99px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-brand {
  display: flex; align-items: center; gap: .6rem; color: #fff;
  padding: .3rem .4rem 1.1rem; font-family: var(--rc-display);
  font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em;
  position: sticky; top: -1rem; background: var(--rc-ink); z-index: 2;
  margin: -1rem -.75rem .35rem; padding: 1.25rem 1.15rem 1rem;
}
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: var(--rc-primary); color: #fff;
  display: grid; place-items: center;
  font-family: var(--rc-display); font-weight: 700; font-size: .95rem;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 1px; padding-bottom: .5rem; }
.nav-group-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .12em;
  color: #7B958F; padding: 1rem .8rem .3rem; font-weight: 600;
}
.sidebar-nav .nav-item {
  color: #BCCFCA; text-decoration: none; padding: .5rem .8rem; border-radius: 9px;
  font-size: .9rem; display: flex; align-items: center; gap: .6rem;
  transition: background .12s ease, color .12s ease;
}
.sidebar-nav .nav-item .nav-label { flex: 1 1 auto; }
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-item.active { background: var(--rc-primary); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.sidebar-nav .nav-item.active .nav-ico { opacity: 1; }
.nav-ico { width: 17px; height: 17px; flex: none; opacity: .72; stroke-width: 1.6; }
.nav-count {
  font-family: var(--rc-data); font-size: .68rem; font-weight: 600;
  background: var(--rc-band); color: #fff; border-radius: 999px;
  min-width: 19px; height: 19px; padding: 0 .35rem;
  display: inline-grid; place-items: center;
}
.nav-item.active .nav-count { background: rgba(255,255,255,.22); }

.sidebar-foot { margin-top: auto; padding: 1rem .8rem .25rem; font-size: .72rem; color: #6E8983; }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  background: var(--rc-surface); border-bottom: 1px solid var(--rc-line);
  padding: .7rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 10;
}
.topbar-who { text-align: right; line-height: 1.25; }
.topbar-name { font-weight: 600; font-size: .88rem; }
.topbar-role { font-size: .74rem; color: var(--rc-mute); }
.app-content { padding: var(--rc-gutter); max-width: 1180px; width: 100%; }

.sidebar-toggle { display: none; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--rc-surface); border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius); box-shadow: var(--rc-shadow);
}
.card-body { padding: 1.15rem 1.25rem; }

/* ---------- Stat cards ---------- */
.stat-card {
  background: var(--rc-surface); border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius); padding: 1.1rem 1.15rem;
  display: flex; flex-direction: column; gap: .1rem; height: 100%;
  box-shadow: var(--rc-shadow); position: relative; overflow: hidden;
}
.stat-num {
  font-family: var(--rc-display); font-size: 2.1rem; line-height: 1.05;
  font-weight: 600; color: var(--rc-ink); letter-spacing: -.02em;
}
.stat-label { font-size: .76rem; color: var(--rc-mute); text-transform: uppercase; letter-spacing: .07em; }
.stat-card.stat-alert { border-color: #EBC7BC; }
.stat-card.stat-alert .stat-num { color: var(--rc-band); }
.stat-card.stat-alert::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rc-band);
}

/* ---------- SIGNATURE: the allergy band ----------
   A wristband down the edge of any card about a child with allergies. */
.allergy-band {
  position: relative; padding-left: 1.15rem;
}
.allergy-band::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: repeating-linear-gradient(
    -45deg, var(--rc-band) 0 6px, #A9452F 6px 12px);
  border-radius: var(--rc-radius) 0 0 var(--rc-radius);
}
.allergy-strip {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
  background: var(--rc-band-soft); border: 1px solid #F0D2C8;
  border-radius: var(--rc-radius-sm); padding: .55rem .75rem; margin-bottom: .9rem;
}
.allergy-strip .allergy-kicker {
  font-size: .64rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--rc-band);
}
.allergy-strip .allergy-list { font-family: var(--rc-data); font-size: .85rem; color: #7E3624; }

/* ---------- Handover slip (session card) ---------- */
.sess-card {
  background: var(--rc-surface); border: 1px solid var(--rc-line);
  border-left: 3px solid var(--rc-primary);
  border-radius: var(--rc-radius-sm); padding: .7rem .8rem;
  display: block; text-decoration: none; color: inherit; margin-bottom: .5rem;
  box-shadow: 0 1px 2px rgba(16,49,42,.04); transition: box-shadow .14s ease, transform .14s ease;
}
.sess-card:hover { box-shadow: var(--rc-shadow-lift); transform: translateY(-1px); color: inherit; }
.sess-time { font-family: var(--rc-data); font-size: .76rem; color: var(--rc-mute); letter-spacing: -.01em; }
.sess-client { font-weight: 600; font-size: .92rem; margin: .1rem 0; }
.sess-cg { font-size: .78rem; color: var(--rc-mute); }
.sess-badge {
  display: inline-block; font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
  background: var(--rc-primary-soft); color: var(--rc-primary); border-radius: 999px;
  padding: .1rem .5rem; font-weight: 600; margin-top: .3rem;
}
.sess-card.sess-completed { border-left-color: var(--rc-meadow); }
.sess-card.sess-cancelled { border-left-color: #B9C4C1; opacity: .62; }
.sess-card.sess-no_show { border-left-color: var(--rc-band); }

/* ---------- Week calendar ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: .6rem; }
.week-col { background: var(--rc-surface); border: 1px solid var(--rc-line); border-radius: var(--rc-radius-sm); padding: .55rem; min-height: 150px; }
.week-col.is-today { border-color: var(--rc-primary); box-shadow: 0 0 0 2px var(--rc-primary-soft); }
.week-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .5rem; padding: 0 .1rem; }
.week-dow { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--rc-mute); font-weight: 600; }
.week-dom { font-family: var(--rc-display); font-size: 1.05rem; font-weight: 600; }
.week-col.is-today .week-dom { color: var(--rc-primary); }

/* ---------- Empty states: an invitation to act ---------- */
.empty-state { text-align: center; padding: 2.75rem 1rem; }
.empty-mark {
  width: 46px; height: 46px; margin: 0 auto .75rem; border-radius: 14px;
  background: var(--rc-primary-soft); color: var(--rc-primary);
  display: grid; place-items: center;
}
.empty-title { font-family: var(--rc-display); font-size: 1.05rem; font-weight: 600; margin-bottom: .2rem; }
.empty-body { font-size: .87rem; color: var(--rc-mute); max-width: 34rem; margin: 0 auto .9rem; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--rc-mute); font-weight: 600; border-bottom: 1px solid var(--rc-line);
  padding: .6rem .75rem; white-space: nowrap;
}
.table > tbody td { padding: .7rem .75rem; border-bottom: 1px solid var(--rc-line); vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: var(--rc-mist); }
.card > .table-responsive > .table > tbody > tr:last-child > td { border-bottom: 0; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--rc-radius-sm); font-weight: 500; font-size: .875rem; padding: .45rem .9rem; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-primary { background: var(--rc-primary); border-color: var(--rc-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--rc-primary-lift); border-color: var(--rc-primary-lift); }
.btn-outline-primary { color: var(--rc-primary); border-color: #B7D3D1; }
.btn-outline-primary:hover { background: var(--rc-primary); border-color: var(--rc-primary); }
.btn-outline-secondary { color: var(--rc-ink-2); border-color: var(--rc-line); background: var(--rc-surface); }
.btn-outline-secondary:hover { background: var(--rc-mist); color: var(--rc-ink); border-color: #CBD8D4; }
.btn-outline-danger { color: var(--rc-band); border-color: #E7C3B8; }
.btn-outline-danger:hover { background: var(--rc-band); border-color: var(--rc-band); }
.btn-link { color: var(--rc-primary); text-decoration: none; padding-left: 0; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form-label { font-size: .8rem; font-weight: 600; color: var(--rc-ink-2); margin-bottom: .25rem; }
.form-control, .form-select {
  border-radius: var(--rc-radius-sm); border-color: #D6E1DD; font-size: .9rem; padding: .45rem .7rem;
  background: var(--rc-surface); color: var(--rc-ink);
}
.form-control:focus, .form-select:focus {
  border-color: var(--rc-primary); box-shadow: 0 0 0 3px var(--rc-primary-soft);
}
.form-text { font-size: .76rem; color: var(--rc-mute); }
.form-check-input:checked { background-color: var(--rc-primary); border-color: var(--rc-primary); }

/* Visible keyboard focus everywhere */
:focus-visible { outline: 2px solid var(--rc-primary); outline-offset: 2px; border-radius: 4px; }
.sidebar-nav .nav-item:focus-visible { outline-color: #7FD3CE; }

/* ---------- Badges: status vocabulary ---------- */
.badge { font-weight: 600; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase;
  padding: .28em .6em; border-radius: 999px; }
.badge.lead-new       { background: var(--rc-primary-soft); color: var(--rc-primary); }
.badge.lead-contacted { background: var(--rc-sun-soft); color: var(--rc-sun); }
.badge.lead-vetted    { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.badge.lead-converted { background: var(--rc-meadow); color: #fff; }
.badge.lead-declined  { background: #ECEFEE; color: var(--rc-mute); }

.badge.sess-scheduled { background: var(--rc-primary-soft); color: var(--rc-primary); }
.badge.sess-in_progress{ background: var(--rc-sun-soft); color: var(--rc-sun); }
.badge.sess-completed { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.badge.sess-cancelled { background: #ECEFEE; color: var(--rc-mute); }
.badge.sess-no_show   { background: var(--rc-band-soft); color: var(--rc-band); }

.badge.note-draft     { background: #ECEFEE; color: var(--rc-mute); }
.badge.note-submitted { background: var(--rc-sun-soft); color: var(--rc-sun); }
.badge.note-approved  { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.badge.note-returned  { background: var(--rc-band-soft); color: var(--rc-band); }
.badge.note-void      { background: #ECEFEE; color: #93A29E; text-decoration: line-through; }

.badge.sev-low    { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.badge.sev-medium { background: var(--rc-sun-soft); color: var(--rc-sun); }
.badge.sev-high   { background: var(--rc-band); color: #fff; }

.badge.inc-submitted   { background: var(--rc-sun-soft); color: var(--rc-sun); }
.badge.inc-under_review{ background: var(--rc-primary-soft); color: var(--rc-primary); }
.badge.inc-resolved    { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.badge.inc-void        { background: #ECEFEE; color: #93A29E; text-decoration: line-through; }

.badge.inv-draft   { background: #ECEFEE; color: var(--rc-mute); }
.badge.inv-sent    { background: var(--rc-primary-soft); color: var(--rc-primary); }
.badge.inv-paid    { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.badge.inv-overdue { background: var(--rc-band-soft); color: var(--rc-band); }
.badge.inv-void    { background: #ECEFEE; color: #93A29E; text-decoration: line-through; }

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 78% -12%, #DCEBE8, transparent 70%),
    radial-gradient(700px 400px at 10% 110%, #E7F0EC, transparent 70%),
    var(--rc-mist);
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--rc-surface); border: 1px solid var(--rc-line);
  border-radius: 16px; padding: 2rem 1.75rem; box-shadow: var(--rc-shadow-lift);
}
.auth-card h1 { font-size: 1.5rem; }
.qr-box { background: #fff; padding: .85rem; border-radius: var(--rc-radius-sm); border: 1px solid var(--rc-line); display: inline-block; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 1.35rem; padding: .6rem; }
.backup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.backup-grid code { background: var(--rc-mist); border: 1px solid var(--rc-line); padding: .35rem .5rem; border-radius: 6px; text-align: center; color: var(--rc-ink); }

/* ---------- Signature pad ---------- */
.sig-pad-wrap { display: inline-block; }
.sig-pad {
  border: 1px dashed #BFCEC9; border-radius: var(--rc-radius-sm); background: #fff;
  touch-action: none; display: block; max-width: 100%; cursor: crosshair;
}
.sig-img { border: 1px solid var(--rc-line); border-radius: var(--rc-radius-sm); background: #fff; max-width: 320px; }

/* ---------- Messages ---------- */
.msg-stream { display: flex; flex-direction: column; gap: .7rem; }
.msg { background: var(--rc-mist); border: 1px solid var(--rc-line); border-radius: 14px 14px 14px 4px; padding: .6rem .85rem; max-width: 85%; }
.msg-mine { align-self: flex-end; background: var(--rc-primary-soft); border-color: #CBE2E0; border-radius: 14px 14px 4px 14px; }
.msg-meta { font-size: .74rem; margin-bottom: .2rem; display: flex; gap: .5rem; color: var(--rc-mute); }
.msg-body { font-size: .9rem; white-space: pre-line; }

/* ---------- Reports ---------- */
.bar-track { height: 7px; background: var(--rc-line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--rc-primary); border-radius: 999px; }
.void-banner { border-left: 3px solid #9AA3A0; background: var(--rc-mist); }
.audit-detail { font-family: var(--rc-data); font-size: .78rem; color: var(--rc-mute); }
.form-body { line-height: 1.6; }
.form-body p { margin-bottom: .6rem; }

/* ---------- Flash ---------- */
.alert { border-radius: var(--rc-radius-sm); border: 1px solid transparent; font-size: .88rem; }
.alert-success { background: var(--rc-meadow-soft); border-color: #C7E2D1; color: #22603C; }
.alert-danger  { background: var(--rc-band-soft); border-color: #F0D2C8; color: #82301D; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040; width: 262px; flex-basis: 262px;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.3);
  }
  .app-shell.nav-open .app-sidebar { transform: translateX(0); }
  .app-shell.nav-open .nav-scrim {
    position: fixed; inset: 0; background: rgba(8,26,22,.45); z-index: 1030;
  }
  .sidebar-toggle {
    display: inline-grid; place-items: center; width: 38px; height: 38px;
    border-radius: var(--rc-radius-sm); border: 1px solid var(--rc-line);
    background: var(--rc-surface); color: var(--rc-ink);
  }
  .app-content { padding: 1rem; }
  .app-topbar { padding: .6rem 1rem; }
  .week-grid { grid-template-columns: 1fr; }
  .week-col { min-height: auto; }
  .msg { max-width: 94%; }
}
@media (max-width: 575.98px) {
  .page-head h1 { font-size: 1.3rem; }
  .stat-num { font-size: 1.75rem; }
  .topbar-who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .app-sidebar, .app-topbar, .btn, form { display: none !important; }
  .app-content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ============================================================
   Dark theme
   ============================================================ */
[data-bs-theme="dark"] {
  --rc-ink:         #E4EDEA;
  --rc-ink-2:       #C2D3CE;
  --rc-primary:     #35A39D;
  --rc-primary-lift:#46B7B0;
  --rc-primary-soft:#14312F;
  --rc-mist:        #0D1514;
  --rc-surface:     #16211F;
  --rc-line:        #293936;
  --rc-mute:        #91A7A2;
  --rc-band:        #E0795A;
  --rc-band-soft:   #33201A;
  --rc-meadow:      #5FB47A;
  --rc-meadow-soft: #17301F;
  --rc-sun:         #D9A441;
  --rc-sun-soft:    #322611;
  --rc-shadow:      0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.28);
  --rc-shadow-lift: 0 2px 8px rgba(0,0,0,.4), 0 18px 44px rgba(0,0,0,.34);
  --bs-body-bg: var(--rc-mist);
  --bs-body-color: var(--rc-ink);
  --bs-primary: var(--rc-primary);
  --bs-primary-rgb: 53,163,157;
  --bs-border-color: var(--rc-line);
}
[data-bs-theme="dark"] .app-sidebar { background: #0A1211; }
[data-bs-theme="dark"] .sidebar-brand { background: #0A1211; }
[data-bs-theme="dark"] code { background: var(--rc-primary-soft); color: #9FD8D4; }
[data-bs-theme="dark"] .btn-outline-secondary { background: var(--rc-surface); color: var(--rc-ink-2); }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background: #1E2C29; color: #fff; }
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * { background: #1B2725; }
[data-bs-theme="dark"] .auth-body {
  background: radial-gradient(900px 500px at 78% -12%, #16302F, transparent 70%), var(--rc-mist);
}
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
  background: #101B1A; border-color: #2C3D39; color: var(--rc-ink);
}
[data-bs-theme="dark"] .form-control::placeholder { color: #6C817C; }
[data-bs-theme="dark"] .backup-grid code { background: #101B1A; border-color: var(--rc-line); }
[data-bs-theme="dark"] .bg-light { background-color: #1B2725 !important; color: var(--rc-ink); }
[data-bs-theme="dark"] .alert-success { background: var(--rc-meadow-soft); border-color: #27503A; color: #A5DCB8; }
[data-bs-theme="dark"] .alert-danger  { background: var(--rc-band-soft); border-color: #5A3125; color: #F0B49C; }
[data-bs-theme="dark"] .allergy-strip { background: var(--rc-band-soft); border-color: #5A3125; }
[data-bs-theme="dark"] .allergy-strip .allergy-list { color: #F0B49C; }
/* These must stay light: they are scanned or drawn on. */
[data-bs-theme="dark"] .qr-box, [data-bs-theme="dark"] .sig-pad, [data-bs-theme="dark"] .sig-img { background: #fff; }

/* ---------- Dashboard: attention rows + today cards ---------- */
.attn-row {
  display: flex; align-items: center; gap: .8rem; padding: .6rem .35rem;
  text-decoration: none; color: inherit; border-radius: var(--rc-radius-sm);
  border-bottom: 1px solid var(--rc-line);
}
.attn-row:last-child { border-bottom: 0; }
.attn-row:hover { background: var(--rc-mist); color: inherit; }
.attn-num {
  font-family: var(--rc-data); font-weight: 700; font-size: .82rem;
  min-width: 30px; height: 26px; padding: 0 .45rem; border-radius: 7px;
  display: inline-grid; place-items: center;
}
.attn-primary { background: var(--rc-primary-soft); color: var(--rc-primary); }
.attn-sun     { background: var(--rc-sun-soft); color: var(--rc-sun); }
.attn-band    { background: var(--rc-band-soft); color: var(--rc-band); }
.attn-text { flex: 1 1 auto; font-size: .9rem; }
.attn-go { color: var(--rc-mute); font-size: 1rem; }
.attn-row:hover .attn-go { color: var(--rc-primary); }

.today-card {
  display: block; text-decoration: none; color: inherit; height: 100%;
  background: var(--rc-surface); border: 1px solid var(--rc-line);
  border-radius: var(--rc-radius); padding: .95rem 1rem;
  box-shadow: var(--rc-shadow); transition: box-shadow .14s ease, transform .14s ease;
}
.today-card:hover { box-shadow: var(--rc-shadow-lift); transform: translateY(-1px); color: inherit; }
.today-card.allergy-band { padding-left: 1.35rem; }
.today-time { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.today-time .mono { font-family: var(--rc-data); font-size: .78rem; color: var(--rc-mute); }
.today-state { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border-radius: 999px; padding: .12rem .5rem; }
.today-upcoming { background: var(--rc-primary-soft); color: var(--rc-primary); }
.today-active   { background: var(--rc-sun-soft); color: var(--rc-sun); }
.today-done     { background: var(--rc-meadow-soft); color: var(--rc-meadow); }
.today-name { font-family: var(--rc-display); font-size: 1.12rem; font-weight: 600; letter-spacing: -.01em; }
.today-cg { font-size: .8rem; color: var(--rc-mute); }
.today-allergy {
  margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed #E9D5CD;
  display: flex; flex-direction: column; gap: .1rem;
}
.today-allergy .allergy-kicker { font-size: .6rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--rc-band); }
.today-allergy .allergy-list { font-family: var(--rc-data); font-size: .78rem; color: #8A3E2A; }
[data-bs-theme="dark"] .today-allergy { border-top-color: #4A2A20; }
[data-bs-theme="dark"] .today-allergy .allergy-list { color: #EFAF97; }

/* ---------- System health ---------- */
.health-row { display: flex; gap: .65rem; align-items: flex-start; padding: .6rem .7rem;
  border: 1px solid var(--rc-line); border-radius: var(--rc-radius-sm); height: 100%; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .42rem; flex: none; }
.health-ok  { border-color: #C7E2D1; background: var(--rc-meadow-soft); }
.health-ok .health-dot { background: var(--rc-meadow); }
.health-bad { border-color: #F0D2C8; background: var(--rc-band-soft); }
.health-bad .health-dot { background: var(--rc-band); }
.health-label { font-weight: 600; font-size: .85rem; }
.health-detail { font-size: .78rem; color: var(--rc-mute); }
.health-fix { font-size: .75rem; margin-top: .15rem; color: var(--rc-band); }
[data-bs-theme="dark"] .health-ok { background: var(--rc-meadow-soft); border-color: #27503A; }
[data-bs-theme="dark"] .health-bad { background: var(--rc-band-soft); border-color: #5A3125; }
[data-bs-theme="dark"] .health-detail { color: #9BB0AC; }
