/* Clarity Voice — CareConnect color scheme (operator decision 2026-07-04;
   supersedes the Idaho Sky palette in UI-standard doc 04 — layout/typography
   rules from doc 04 still apply). Every text/background pair below is
   AA-checked (4.5:1 body, 3:1 large/UI).

   Tokens lifted from CareConnect cc-ui-standard.css / cc-redesign.css /
   sidebar-navigation.css. */

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #0d6efd;   /* CareConnect primary */
  --deep:    #0a4ea0;   /* headings, hover, emphasis */
  --soft:    #e7f1ff;   /* soft blue tint (selected, chips) */
  --ink:     #1b2733;   /* body text */
  --muted:   #5b6b7f;   /* secondary text — 5.4:1 on white */
  --line:    #e6ebf2;   /* borders */
  --bg:      #f3f6fa;   /* page background */
  --success: #198754;
  --warning: #f0a020;
  --danger:  #dc3545;
  --side:       #2c3e50; /* CareConnect sidebar */
  --side-hover: #34495e;
  --side-text:  #ecf0f1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--primary); }

h1, h2, h3 { color: var(--deep); line-height: 1.25; }

mark { background: #ffe69c; color: #4a3a05; border-radius: 3px; padding: 0 1px; }

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

/* ---- Centered auth card (setup / login) ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  padding: 36px;
  width: 100%;
  max-width: 440px;
}

.auth-card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }

.eyebrow {
  color: var(--deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; }

label { display: block; font-weight: 500; margin: 16px 0 6px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

button.primary {
  margin-top: 24px;
  width: 100%;
  padding: 12px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button.primary:hover { background: var(--deep); }
button.primary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.error-box {
  background: #f8d7da;
  border: 1px solid #f1aeb5;
  color: #842029; /* 6.9:1 on #f8d7da */
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 15px;
}

.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- App shell: sidebar + topbar + content ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--side);
  color: #fff;
  padding: 20px 12px;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 18px;
  padding: 0 12px 16px;
  color: #fff;
}

.sidebar .brand .spark { color: #f0a020; }

.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--side-text); /* 10.6:1 on #2c3e50 */
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 500;
}

.sidebar nav a.active,
.sidebar nav a:hover { background: var(--side-hover); color: #fff; }

.navbadge {
  background: #fff;
  color: var(--side);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 8px;
  line-height: 20px;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.topbar .who { color: var(--muted); font-size: 14px; }

.content { padding: 24px 28px 0; width: 100%; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }
.content > .page-inner { max-width: 980px; margin: 0 auto; width: 100%; flex: 1; }

.page-head h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 2px; }
.pagehint { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  padding: 24px;
}

table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }

.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
}
/* AA-checked chip pairs (dark text on tinted fills) */
.badge.voicemail { background: var(--soft); color: var(--deep); }
.badge.missed    { background: #f8d7da; color: #842029; }
.badge.completed { background: #d1e7dd; color: #0f5132; }
.badge.blocked   { background: #eef1f3; color: #3e5260; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 24px;
}
.empty .hills-mini { color: #9ec5ef; font-size: 28px; letter-spacing: 4px; }
.empty a { font-weight: 600; }

/* ---- Search bar ---- */
.searchbar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}
.searchbar .grow { flex: 1 1 260px; }
.searchbar input[type="search"] { padding: 8px 12px; }
.searchbar .datewrap { display: flex; align-items: center; gap: 6px; }
.searchbar .datewrap label { margin: 0; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.searchbar input.date { width: 118px; padding: 8px 10px; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.searchbar button[type="submit"] {
  font: inherit; font-weight: 600; font-size: 14.5px; color: #fff;
  background: var(--primary); border: 0; border-radius: 8px; padding: 8px 18px; cursor: pointer;
}
.searchbar button[type="submit"]:hover { background: var(--deep); }
.searchbar button[type="submit"]:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.searchbar .clear { font-size: 14px; font-weight: 600; text-decoration: none; padding: 8px 6px; }
.searchbar .clear:hover { text-decoration: underline; }

/* View toggle: real radios styled as a segmented control */
.viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.viewtoggle label {
  margin: 0; padding: 7px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; background: #fff;
}
.viewtoggle input { position: absolute; opacity: 0; pointer-events: none; }
.viewtoggle input:checked + label { background: var(--soft); color: var(--deep); }
.viewtoggle input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: -3px; }
.viewtoggle label + input + label { border-left: 1px solid var(--line); }

.results-note { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* ---- Day groups ---- */
.day {
  font-size: 13px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 26px 0 8px 4px;
}
.day:first-of-type { margin-top: 0; }

/* ---- Voicemail rows (Ledger view) ---- */
.vm {
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05); margin-bottom: 10px; overflow: hidden;
}
.vm-head {
  display: grid; grid-template-columns: 4px 1fr auto; align-items: stretch;
  cursor: pointer; width: 100%; text-align: left; border: 0; background: none; padding: 0; font: inherit; color: inherit;
}
.vm-head:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; border-radius: 13px; }
.spine { background: transparent; transition: background .3s; }
.vm.unheard .spine { background: var(--primary); }
.vm-body { padding: 13px 16px 13px 14px; min-width: 0; }
.vm-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.caller { font-weight: 500; font-size: 16px; }
.vm.unheard .caller { font-weight: 650; }
.chip {
  font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px;
  background: var(--soft); color: var(--deep); border: 1px solid #cfe2ff;
}
.chip.spam    { background: #f8d7da; color: #842029; border-color: #f1aeb5; }
.chip.pending { background: #fff3cd; color: #664d03; border-color: #ffe69c; }
.chip.plain   { background: #eef1f3; color: #3e5260; border-color: #dde3e8; }
.when { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.preview {
  color: var(--muted); font-size: 14.5px; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vm.unheard .preview { color: var(--ink); }
.vm-side {
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums;
}
.vm-side .playhint {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  color: var(--deep); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.vm-head:hover .playhint { border-color: var(--primary); background: var(--soft); }

/* Expanded reading room */
.vm-expand { display: none; border-top: 1px solid var(--line); background: #fbfdff; }
.vm.open .vm-expand { display: block; }
.expand-meta {
  margin: 0; padding: 10px 18px; color: var(--muted); font-size: 13.5px;
  font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line);
}
.dirmark { color: var(--muted); font-size: 14px; }

.statusselect {
  font: inherit; font-size: 14.5px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.statusselect:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }

/* ---- The player (shared by both views) ---- */
.player {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.playbtn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--primary); color: #fff;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.playbtn:hover { background: var(--deep); }
.playbtn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.playbtn[disabled] { background: var(--line); color: var(--muted); cursor: default; }
.scrub { flex: 1; height: 26px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.scrub:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.track { position: relative; height: 5px; width: 100%; border-radius: 999px; background: var(--line); }
.fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0%; border-radius: 999px; background: var(--deep); }
.thumb {
  position: absolute; left: 0%; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  background: var(--deep); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px #fff;
}
.times { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.speed, .dl {
  border: 1.5px solid var(--line); background: #fff; color: var(--deep); font: inherit; font-size: 13px; font-weight: 600;
  border-radius: 8px; padding: 4px 10px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.speed:hover, .dl:hover { border-color: var(--primary); background: var(--soft); }
.speed:focus-visible, .dl:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.player-note { color: var(--muted); font-size: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }

.transcript { padding: 16px 20px 20px; }
.transcript h3 {
  margin: 0 0 6px; font-size: 12.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.transcript p { max-width: 70ch; margin: 0; font-size: 15.5px; white-space: pre-line; }
.transcript .t-muted { color: var(--muted); }

/* ---- Split view ---- */
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0; flex: 1; min-height: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
  overflow: hidden; }
.split-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; max-height: 72vh; }
.split-list .day { margin: 12px 0 4px 8px; font-size: 12px; }
.item {
  display: grid; grid-template-columns: 3px 1fr; gap: 9px; width: 100%; text-align: left;
  border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  padding: 9px 8px 9px 6px; border-radius: 10px;
}
.item:hover { background: var(--bg); }
.item:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.item.selected { background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--primary); }
.item .spine { border-radius: 999px; }
.item .row1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.item .caller { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .when { font-size: 12.5px; flex-shrink: 0; }
.item .prev {
  color: var(--muted); font-size: 13.5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vm-item.unheard .caller { font-weight: 650; }
.vm-item.unheard .prev { color: var(--ink); }
.vm-item.unheard .spine { background: var(--primary); }

.split-pane { overflow-y: auto; max-height: 72vh; padding: 24px 28px; display: flex; flex-direction: column; }
.pane-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pane-head h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.pane-meta { color: var(--muted); font-size: 14px; margin: 4px 0 16px; font-variant-numeric: tabular-nums; }
.pane-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #fff; }
.pane-empty { color: var(--muted); text-align: center; margin: auto; padding: 40px 20px; }
.pane-back { display: none; }

/* ---- Contacts ---- */
.flash-ok {
  background: #d1e7dd; border: 1px solid #a3cfbb; color: #0f5132;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 15px;
}
.newcontact, .linklike {
  font: inherit; font-weight: 600; font-size: 14px; color: var(--deep);
  background: #fff; border: 1.5px dashed var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
.newcontact:hover, .linklike:hover { border-color: var(--primary); background: var(--soft); }
.contact-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; }
.contact-main { flex: 1; min-width: 0; }
.star {
  border: 0; background: none; font-size: 20px; line-height: 1.2; cursor: pointer;
  color: #c9d4de; padding: 2px 4px;
}
.star.on { color: var(--warning); }
.star:hover { color: var(--warning); }
.star:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.contact-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.rowact {
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--deep);
  background: none; border: 0; cursor: pointer; text-decoration: none; padding: 4px 8px; border-radius: 7px;
}
.rowact:hover { background: var(--soft); }
.rowact:focus-visible { outline: 3px solid var(--primary); outline-offset: -2px; }
.rowact.danger-text { color: #b02a37; }
.rowact.danger-text:hover { background: #f8d7da; }
.inline-confirm {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line); background: #fff8f8; padding: 10px 16px; font-size: 14.5px;
}
.inline-confirm[hidden] { display: none; } /* author display beats the hidden attr otherwise */
.inline-confirm form { margin: 0; }
.inline-confirm .danger {
  font: inherit; font-size: 13.5px; font-weight: 600; color: #fff; background: var(--danger);
  border: 0; border-radius: 8px; padding: 6px 14px; cursor: pointer;
}
.inline-confirm .danger:hover { background: #bb2d3b; }
.inline-confirm .save, .cf-actions .save, .newdev-form .save {
  font: inherit; font-size: 13.5px; font-weight: 600; color: #fff; background: var(--primary);
  border: 0; border-radius: 8px; padding: 6px 14px; cursor: pointer;
}
.inline-confirm .save:hover, .cf-actions .save:hover, .newdev-form .save:hover { background: var(--deep); }
.contact-form { padding: 14px 18px 16px; border-top: 1px solid var(--line); background: #fbfdff; }
.contact-new .contact-form { border-top: 0; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.contact-form label { font-size: 13.5px; margin: 10px 0 4px; }
.contact-form textarea {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink); resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
.contact-form textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.cf-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.cf-fav { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.cf-spacer { flex: 1; }
.cf-actions .quiet, .cf-actions .quiet-danger {
  font: inherit; font-size: 13.5px; font-weight: 600; background: #fff; border: 1.5px solid var(--line);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--muted);
}
.cf-actions .quiet-danger { color: #b02a37; }
.cf-actions .quiet:hover { border-color: var(--primary); color: var(--deep); }
.cf-actions .quiet-danger:hover { border-color: #f1aeb5; background: #f8d7da; }

/* ---- Numbers ---- */
.section-title { margin: 30px 0 2px; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.number-card { margin-bottom: 12px; }
.healthrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.healthrow .badge, .healthrow .chip { font-size: 12px; }
.greeting-new { margin-bottom: 12px; }
.rec-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-row .pbtn { padding: 6px 12px; font-size: 13.5px; }
input[type="file"] { font-size: 13.5px; color: var(--muted); }
input[type="number"] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-variant-numeric: tabular-nums;
}
input[type="number"]:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }

/* ---- Devices ---- */
.regdot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 8px;
  background: #b6c2cd; /* unknown = gray */
}
.regdot.registered { background: var(--success); }
.regdot.unregistered { background: var(--danger); }
.cred-reveal {
  background: #fff; border: 2px solid var(--warning); border-radius: 13px;
  padding: 16px 20px; margin-bottom: 16px;
}
.cred-reveal h3 { margin: 0 0 4px; font-size: 16px; }
.cred-reveal p { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; }
.cred-reveal dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 15px; }
.cred-reveal dt { color: var(--muted); }
.cred-reveal dd { margin: 0; }
.cred-reveal code {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 8px; font-size: 14.5px; user-select: all;
}
.newdev-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; width: 100%; }
.newdev-form input[type="text"] { flex: 1 1 220px; padding: 8px 12px; }
.ringfor { display: flex; gap: 4px 18px; flex-wrap: wrap; padding: 4px 0; }

/* ---- Favorites strip (Calls landing screen) ---- */
.fav-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.fav-strip .fav-label {
  font-size: 12.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin-right: 2px;
}
.fav-chip {
  display: inline-flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 13px;
  font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.fav-chip:hover { border-color: var(--primary); }
.fav-chip .fc-star { color: var(--warning); font-size: 13px; }
.fav-chip .fc-msg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: var(--soft); color: var(--deep);
  font-size: 13px; text-decoration: none;
}
.fav-chip .fc-msg:hover { background: var(--primary); color: #fff; }
.fav-manage { font-size: 13px; font-weight: 600; text-decoration: none; margin-left: 2px; }

/* ---- Contact typeahead (new-message To field) ---- */
.ta-wrap { position: relative; max-width: 340px; }
.ta-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 4px 14px rgba(27, 39, 51, .12); overflow: hidden; max-height: 280px; overflow-y: auto;
}
.ta-item {
  display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  padding: 8px 12px; border: 0; background: #fff; font: inherit; font-size: 14.5px; cursor: pointer;
}
.ta-item:hover, .ta-item.active { background: var(--soft); }
.ta-item .ta-name { font-weight: 600; color: var(--ink); }
.ta-item .ta-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.ta-item .ta-star { color: var(--warning); margin-right: 4px; }

/* ---- Messages ---- */
.msgsplit .split-list { display: flex; flex-direction: column; }
.msgsplit .item { text-decoration: none; color: inherit; }
.msgsearch { display: flex; gap: 8px; align-items: center; margin: 2px 4px 8px; }
.msgsearch input[type="search"] { padding: 8px 12px; font-size: 14.5px; }
.msgsearch .clear { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.newmsg {
  display: block; margin: 0 4px 10px; padding: 8px 12px; border: 1.5px dashed var(--line);
  border-radius: 10px; text-align: center; font-weight: 600; font-size: 14px;
  color: var(--deep); text-decoration: none;
}
.newmsg:hover { border-color: var(--primary); background: var(--soft); }

.msgpane { overflow: hidden; padding: 20px 24px; }
.msgpane .pane-head h2 { margin-bottom: 0; }
.msgpane .pane-meta { margin-bottom: 10px; }
.tolabel { margin: 8px 0 4px; font-size: 14px; color: var(--muted); }
#msg-to { max-width: 280px; }

.thread { flex: 1; overflow-y: auto; padding: 8px 4px 12px; min-height: 120px; }
.day-divider { text-align: center; margin: 14px 0 10px; }
.day-divider span {
  font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: var(--bg); border-radius: 999px; padding: 2px 12px;
}
.bubble-row { display: flex; flex-direction: column; margin: 6px 0; align-items: flex-start; }
.bubble-row.out { align-items: flex-end; }
.bubble {
  max-width: min(62ch, 82%); border-radius: 14px; padding: 8px 13px; font-size: 15px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  display: flex; flex-direction: column; gap: 6px;
}
.bubble-row.out .bubble { background: var(--soft); border-color: #cfe2ff; }
.bubble .bodytext { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { font-size: 12px; color: var(--muted); margin: 3px 6px 0; font-variant-numeric: tabular-nums; }
.failedmark { color: #b02a37; font-weight: 600; }
.msgimg { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; }
.attach {
  display: inline-block; font-size: 13.5px; font-weight: 600; color: var(--deep);
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px;
  text-decoration: none;
}
.attach.failedmark { color: #b02a37; border-color: #f1aeb5; background: #f8d7da; }
.attach.t-muted { color: var(--muted); font-weight: 500; }

.composer { border-top: 1px solid var(--line); padding-top: 10px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.fromline {
  font: inherit; font-size: 13.5px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 8px; max-width: 150px;
}
.attachbtn {
  font-size: 17px; line-height: 1; padding: 9px 11px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.attachbtn:hover { border-color: var(--primary); background: var(--soft); }
.attachbtn:focus-visible, .sendbtn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.composer textarea {
  flex: 1; resize: none; font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; max-height: 130px;
}
.composer textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.sendbtn {
  font: inherit; font-weight: 600; font-size: 14.5px; color: #fff; background: var(--primary);
  border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer;
}
.sendbtn:hover { background: var(--deep); }
.sendbtn[disabled] { background: var(--line); color: var(--muted); cursor: default; }
.attach-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.attach-strip .attach button {
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0 0 0 6px;
}
.composer-err { color: #b02a37; font-size: 13.5px; margin: 6px 2px 0; }
.msgsplit.dragover .msgpane { outline: 2px dashed var(--primary); outline-offset: -8px; }

/* ---- Person timeline ---- */
.person-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person-head h1 { margin: 0; }
.person-head .star { font-size: 24px; }
.person-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.pbtn {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--deep); background: #fff;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 16px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.pbtn:hover { border-color: var(--primary); background: var(--soft); }
.pbtn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pbtn.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.pbtn.primary:hover { background: var(--deep); border-color: var(--deep); }
.pbtn.danger-text { color: #b02a37; }
.pbtn.danger-text:hover { border-color: #f1aeb5; background: #f8d7da; }
.pbtn[hidden] { display: none; }
.inline-confirm.standalone {
  border: 1px solid #f1aeb5; border-radius: 10px; margin: 0 0 16px;
}
.person-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
.msg-event { display: grid; grid-template-columns: 4px 1fr; text-decoration: none; color: inherit; }
.msg-event .vm-body { padding: 11px 16px 11px 14px; }
.msg-event:hover { border-color: var(--primary); }
.person-link { color: inherit; text-decoration: none; }
.person-link:hover { color: var(--deep); text-decoration: underline; }

.profile-card {
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); padding: 18px 20px; position: sticky; top: 16px;
}
.profile-card h3 {
  margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.profile-card h3:first-child { margin-top: 0; }
.profile-facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 14.5px; }
.profile-facts dt { color: var(--muted); }
.profile-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.profile-stats { display: flex; gap: 8px; margin: 12px 0 2px; }
.pstat {
  flex: 1; text-align: center; background: var(--bg); border-radius: 10px; padding: 8px 4px;
}
.pstat strong { display: block; font-size: 18px; color: var(--deep); font-variant-numeric: tabular-nums; }
.pstat span { font-size: 12px; color: var(--muted); }
.profile-notes { font-size: 14.5px; margin: 0; }
.t-muted-count { color: var(--muted); font-weight: 500; font-size: 13px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block;
  border: 1px solid var(--line);
}
.media-grid a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

@media (max-width: 1100px) {
  .person-grid { grid-template-columns: 1fr; }
  .profile-card { position: static; }
}

/* ---- Hills footer (CareConnect blues) ---- */
.hills { margin-top: auto; padding-top: 36px; line-height: 0; }
.hills svg { width: 100%; height: 56px; display: block; }

@media (max-width: 1000px) {
  .sidebar { width: 64px; }
  .sidebar .brand .word, .sidebar nav a .word, .navbadge { display: none; }
  .sidebar nav a::before { content: attr(data-initial); font-weight: 600; }
  .content { padding: 16px 16px 0; }
  .vm-side .dur { display: none; }
  .player { flex-wrap: wrap; row-gap: 8px; }
  .scrub { flex: 1 1 100%; order: 5; }
  .split { display: block; }
  .split-list { border-right: 0; max-height: none; }
  .split-pane { display: none; max-height: none; }
  .split.pane-open .split-list { display: none; }
  .split.pane-open .split-pane { display: flex; }
  .pane-back {
    display: inline-block; margin: 0 0 12px; border: 0; background: none; color: var(--primary);
    font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; text-align: left;
  }
}
