/* Hanks Home: Page — warm, accessible, high-contrast household control center */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #202a3b;
  --muted: #5c6675;
  --border: #dfe3e8;
  --accent: #315ecc;
  --accent-soft: #edf2ff;
  --accent-hover: #234ba9;
  --shared: #3a6ea5;
  --shared-soft: #e3eef8;
  --mom: #7253a0;
  --mom-soft: #f3eef9;
  --dad: #365c93;
  --dad-soft: #edf2fa;
  --focus: #315ecc;
  --danger: #a33b2d;
  --danger-soft: #f8e8e5;
  --urgent: #b45309;
  --urgent-soft: #fff7ed;
  --shadow: 0 2px 8px rgba(25, 35, 54, 0.025);
  --radius: 12px;
  --rail-w: 238px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 112.5%; /* ~18px base for readability */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
  font-weight: 600;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== Login ========== */
.login-page {
  min-height: 100vh;
  background: #f1f2f4;
}

.login-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem 1.5rem;
}

.login-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.login-card h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 5vw, 2rem);
  color: var(--text);
}

.login-lead {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.login-note {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1rem;
}

.login-choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-choice {
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  background: var(--bg);
  color: var(--text);
  min-height: 64px;
}

.login-choice:hover,
.login-choice:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.login-choice:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.login-choice[data-who="mom"]:hover,
.login-choice[data-who="mom"]:focus-visible {
  border-color: var(--mom);
  background: var(--mom-soft);
}

.login-choice[data-who="dad"]:hover,
.login-choice[data-who="dad"]:focus-visible {
  border-color: var(--dad);
  background: var(--dad-soft);
}

.login-choice-title {
  display: block;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.login-choice-desc {
  display: block;
  color: var(--muted);
  font-size: 1rem;
}

.login-footer-note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ========== App shell + left rail ========== */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: #192334;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
  padding: 0 0.35rem;
}

.brand-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.rail-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 600;
}

.rail-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.15);
}

.nav-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.nav-link.is-active {
  background: #fff;
  color: var(--accent);
}

.rail-footer {
  padding: 1rem 0.35rem 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 1rem;
}

.who-line {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.95;
}

.sign-out-rail {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.95rem;
}

.app-main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.nav-toggle {
  display: none;
  background: var(--accent-soft);
  border: 2px solid var(--border);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  top: 6px;
}

.nav-backdrop {
  display: none;
}

.app-content {
  flex: 1;
  padding: 1.25rem 1.25rem 2rem;
  max-width: 1100px;
  width: 100%;
}

.intro {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* Phone: collapse rail */
@media (max-width: 600px) {
  .rail {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .app-shell.nav-open .rail {
    transform: translateX(0);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 43, 42, 0.45);
    z-index: 35;
    border: none;
    padding: 0;
    cursor: pointer;
  }

  .app-shell.nav-open .nav-backdrop {
    display: block;
  }
}

/* ========== Buttons ========== */
.btn {
  display: inline-block;
  margin-top: 0;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
  min-height: 44px;
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent-hover);
}

.btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: #862f24;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  min-height: 36px;
  margin-top: 0.5rem;
}

.card .btn {
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* ========== Filter bar ========== */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.filter-heading {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
}

.filter-help {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 1rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  min-height: 44px;
}

.chip:hover {
  border-color: var(--accent);
}

.chip:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chip[data-filter="mom"].is-active {
  background: var(--mom);
  border-color: var(--mom);
}

.chip[data-filter="dad"].is-active {
  background: var(--dad);
  border-color: var(--dad);
}

.chip[data-filter="shared"].is-active {
  background: var(--shared);
  border-color: var(--shared);
}

.filter-status {
  margin: 0.85rem 0 0;
  font-weight: 600;
  color: var(--accent);
}

/* ========== Cards / panels / lists ========== */
.entry-cards {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .entry-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.card h2,
.card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  flex: 1;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1.35rem;
}

.panel-header--actions {
  justify-content: space-between;
  align-items: center;
}

.example-label {
  display: inline-block;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--accent-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border-left: 5px solid var(--accent);
}

.item[data-who="shared"] {
  border-left-color: var(--shared);
  background: var(--shared-soft);
}

.item[data-who="mom"] {
  border-left-color: var(--mom);
  background: var(--mom-soft);
}

.item[data-who="dad"] {
  border-left-color: var(--dad);
  background: var(--dad-soft);
}

.item--urgent {
  box-shadow: inset 0 0 0 2px rgba(180, 83, 9, 0.35);
}

.item--note {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.item-title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.note-body {
  white-space: pre-wrap;
  font-weight: 600;
}

.item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.who-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.35rem;
  margin-right: 0.35rem;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
}

.urgent-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.35rem;
  background: var(--urgent-soft);
  color: var(--urgent);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.empty-msg {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

/* ========== Calendar grid ========== */
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.cal-nav-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cal-month-label {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.cal-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .cal-layout {
    grid-template-columns: 1fr 300px;
    align-items: start;
  }
}

.cal-grid-wrap {
  margin-bottom: 0;
  overflow-x: auto;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-width: 280px;
}

.cal-dow {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.35rem 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cal-cell {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 0.35rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  color: var(--text);
}

.cal-cell--empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  min-height: 0;
}

.cal-cell:hover:not(.cal-cell--empty),
.cal-cell:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cal-cell:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.cal-cell.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-day-num {
  font-weight: 700;
  font-size: 0.95rem;
}

.cal-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.cal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-dot--mom {
  background: var(--mom);
}

.cal-dot--dad {
  background: var(--dad);
}

.cal-dot--shared {
  background: var(--shared);
}

.cal-titles {
  display: none;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

@media (min-width: 700px) {
  .cal-cell {
    min-height: 88px;
  }

  .cal-titles {
    display: flex;
  }

  .cal-dots {
    display: none;
  }
}

.cal-title-chip {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255, 255, 255, 0.85);
}

.cal-title-chip.who-mom {
  color: var(--mom);
  border-left: 3px solid var(--mom);
}

.cal-title-chip.who-dad {
  color: var(--dad);
  border-left: 3px solid var(--dad);
}

.cal-title-chip.who-shared {
  color: var(--shared);
  border-left: 3px solid var(--shared);
}

.cal-more {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.side-heading {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.cal-side {
  margin-bottom: 0;
}

.day-event-row {
  margin-bottom: 0.75rem;
}

/* ========== Modals ========== */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 43, 42, 0.5);
  border: none;
  cursor: pointer;
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(26, 43, 42, 0.2);
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  border: 1px solid var(--border);
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: #fff;
  color: var(--text);
}

.modal-close:focus-visible {
  outline: 3px solid var(--focus);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.25rem 1.25rem;
  align-items: center;
}

.modal-footer--form {
  padding: 0.5rem 0 0;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.modal-footer-spacer {
  flex: 1;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  min-height: 44px;
}

.field textarea {
  resize: vertical;
  min-height: 5rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--accent);
}

.field-row {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========== Footer ========== */
.site-footer {
  text-align: center;
  padding: 1.5rem 1.25rem 2rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer p {
  margin: 0 0 0.5rem;
  max-width: 36em;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.05rem;
}

.footer-brand {
  font-weight: 700;
  color: var(--accent) !important;
}

.app-footer {
  margin-top: auto;
}

/* ========== Login Form ========== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.login-form .field {
  margin-bottom: 0;
}

.login-btn {
  width: 100%;
  margin-top: 0.5rem;
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-error {
  background: var(--danger-soft);
  border: 2px solid var(--danger);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-weight: 600;
  font-size: 1rem;
}

/* ========== Logout button in rail ========== */
.logout-btn-rail {
  background: transparent;
  border: none;
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.logout-btn-rail:hover,
.logout-btn-rail:focus-visible {
  opacity: 0.85;
}

.logout-btn-rail:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
/* Shared record loading and save feedback */
.data-banner { padding: .75rem 1.25rem; background: #eaf2f0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.data-banner p { margin: 0; }
.save-error { color: var(--danger); font-weight: 600; }
.save-error:empty { display: none; }
button:disabled { opacity: .6; cursor: wait; }
[hidden] { display: none !important; }
/* Daily care workspace */
html { font-size: 106.25%; }
.app-content { max-width: 1440px; padding: 28px 38px 88px; margin: 0 auto; }
.app-topbar { padding: 20px 38px; min-height: 80px; background: #fff; }
.page-title { font-size: 1.05rem; font-weight: 650; }
.page-date { margin: 0 0 0 auto; color: var(--muted); font-size: .85rem; }
.rail { padding: 30px 18px 24px; }
.rail-brand { gap: 12px; margin-bottom: 44px; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #354868; font-size: 1.35rem; font-weight: 650; }
.rail-eyebrow { font-size: .62rem; letter-spacing: .16em; color: #b5c1d6; }
.rail-title { font-size: 1.12rem; letter-spacing: -.03em; }
.nav-link { color: #bfcadb; font-size: .9rem; font-weight: 500; gap: 12px; padding: 12px 14px; margin-bottom: 3px; }
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-link.is-active { background: #2b3a53; color: white; box-shadow: inset 3px 0 #8fabf7; }
.rail-footer { font-size: .8rem; }
.who-line { font-size: .8rem; color: #c8d2e1; margin-bottom: 12px; }
.sign-out-rail,.logout-btn-rail { font-size: .8rem; color: #c8d2e1; font-weight: 400; }
.logout-btn-rail { margin-top: 12px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: transparent; box-shadow: none; border: 0; padding: 0; margin-bottom: 32px; }
.filter-heading { font-size: .82rem; color: var(--muted); font-weight: 500; margin: 0 8px 0 0; }
.filter-bar > .filter-help { display: none; }
.filter-chips { gap: 6px; }
.chip { font-size: .82rem; padding: 7px 16px; min-height: 40px; border: 1px solid var(--border); background: white; }
.chip.is-active { background: #263750; border-color: #263750; }
.filter-status { margin: 0 0 0 auto; font-size: .78rem; color: var(--muted); font-weight: 400; }
.overview-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.section-kicker { font-size: .65rem; letter-spacing: .13em; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.overview-heading h2 { font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.04em; line-height: 1.2; margin: 0 0 10px; }
.view-description { margin: 0 0 24px; color: var(--muted); font-size: .92rem; }
.overview-heading .view-description { margin-bottom: 0; }
.btn { font-size: .85rem; border-radius: 8px; padding: 11px 18px; min-height: 44px; font-weight: 600; }
.btn-secondary { border: 1px solid #cdd5e1; background: #fff; color: #334864; }
.btn-small { margin-top: 0; min-height: 40px; padding: 8px 14px; font-size: .78rem; }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.summary-tile { font: inherit; text-align: left; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; cursor: pointer; color: var(--text); transition: border-color .15s, transform .15s; }
.summary-tile:hover { border-color: #859ec8; transform: translateY(-2px); }
.summary-tile > span { display: block; font-size: .8rem; color: var(--muted); }
.summary-tile strong { display: block; font-size: 2.4rem; font-weight: 550; letter-spacing: -.06em; line-height: 1.5; }
.summary-tile small { display: flex; justify-content: space-between; gap: 8px; font-size: .7rem; color: var(--muted); }
.summary-tile small span { color: var(--accent); }
.review-callout { display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: 10px; border: 1px solid #e6d9bc; background: #fcf8ee; margin-bottom: 26px; }
.callout-symbol { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border: 1px solid #b69146; border-radius: 50%; font-weight: 700; color: #806021; }
.review-callout h3 { margin: 0 0 5px; font-size: .96rem; }
.review-callout p { font-size: .8rem; margin: 0; color: #6f6046; max-width: 650px; }
.review-callout .btn { margin-left: auto; flex-shrink: 0; border-color: #d3bf97; color: #70511b; background: transparent; }
.overview-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; align-items: stretch; }
.overview-panel { margin: 0; padding: 24px; display: flex; flex-direction: column; min-width: 0; }
.overview-panel .panel-header { align-items: center; justify-content: space-between; margin-bottom: 14px; }
.overview-panel h3 { font-size: 1.05rem; letter-spacing: -.02em; margin: 0; }
.panel { box-shadow: var(--shadow); }
.text-button { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: .8rem; cursor: pointer; padding: 10px 0; text-decoration: none; }
.panel-link { border-top: 1px solid var(--border); padding-top: 17px; margin-top: auto; display: flex; justify-content: space-between; font-size: .82rem; color: var(--accent); font-weight: 600; text-decoration: none; }
.empty-state { text-align: center; padding: 28px 12px 34px; margin: auto 0; }
.empty-symbol { display: inline-grid; place-items: center; background: #f2f4f7; color: #78859a; width: 44px; height: 44px; border-radius: 12px; font-size: .8rem; margin-bottom: 14px; }
.empty-state h4 { margin: 0 0 8px; font-size: .95rem; }
.empty-state p { color: var(--muted); font-size: .82rem; margin: 0 auto 18px; max-width: 290px; }
.empty-msg { color: var(--muted); font-size: .88rem; }
.count-badge { background: #f0f2f5; padding: 3px 10px; border-radius: 20px; font-size: .8rem; }
.refill-overview { grid-column: 1 / -1; }
.item { box-shadow: none; border-radius: 9px; border-color: var(--border); padding: 18px; }
.item-title { font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.item-meta { font-size: .82rem; color: var(--muted); }
.task-title-button { text-align: left; font: inherit; font-weight: 600; font-size: .95rem; background: none; border: 0; padding: 4px 0; color: var(--text); cursor: pointer; }
.task-title-button:hover { color: var(--accent); text-decoration: underline; }
.overdue-text { color: #9a452b !important; font-weight: 600; }
.medication-tools { display: flex; gap: 20px; align-items: flex-end; margin: 24px 0 20px; }
.search-field { flex: 1; max-width: 540px; }
.search-field label { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 8px; }
.search-field input { width: 100%; font: inherit; font-size: .9rem; border: 1px solid #cbd3dd; border-radius: 9px; padding: 13px 16px; color: var(--text); background: white; min-height: 48px; }
.status-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 22px; flex-wrap: wrap; }
.status-tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 12px 16px; font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer; min-height: 44px; }
.status-tabs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.status-tabs button span { margin-left: 7px; font-size: .72rem; background: #e9edf3; border-radius: 20px; padding: 2px 7px; color: #4b5a70; }
.result-count { font-size: .78rem; color: var(--muted); margin: 0 0 18px; }
.medication-item { padding: 22px 24px; border-left: 1px solid var(--border) !important; background: white; }
.medication-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.medication-heading .btn { flex-shrink: 0; }
.medication-badges { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.medication-badges .who-badge { margin: 0; font-size: .66rem; border-radius: 5px; padding: 3px 8px; }
.status-badge { display: inline-block; font-size: .66rem; padding: 3px 8px; border-radius: 5px; background: #f0f2f5; color: #596579; }
.status-needs-review { background: #fcf3df; color: #805d18; }
.status-current { background: #edf2ff; color: #365bae; }
.medication-details { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 20px; margin: 22px 0 0; }
.medication-details dt { color: var(--muted); font-size: .68rem; margin-bottom: 5px; }
.medication-details dd { font-size: .82rem; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.medication-note { border-top: 1px solid #eceff3; padding-top: 13px; margin: 18px 0 0; font-size: .78rem; color: var(--muted); }
.item[data-who] { background: var(--surface); border-left: 1px solid var(--border); }
#home-refills .medication-details { grid-template-columns: 1fr; margin-top: 10px; }
.modal-panel { border-radius: 14px; box-shadow: 0 20px 80px #19233433; }
.modal-header { background: #f8f9fb; }
.modal-header h2 { font-size: 1.15rem; }
.field label { font-size: .85rem; }
.field input,.field select,.field textarea { border-width: 1px; border-color: #cbd3dd; font-size: .9rem; border-radius: 8px; }
.site-footer { font-size: .75rem; padding: 20px 30px 85px; background: var(--bg); }
.site-footer p { font-size: .75rem; }
.footer-brand { display: none; }
.data-banner { position: fixed; right: 20px; bottom: 16px; z-index: 25; padding: 8px 10px 8px 16px; background: white; border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 4px 18px #202a3b0d; max-width: calc(100vw - 40px); gap: 14px; }
.data-banner p { font-size: .72rem; color: var(--muted); }
.data-banner .btn { font-size: .7rem; padding: 7px 10px; min-height: 34px; border: 0; background: #f3f5f8; }
.login-shell { padding-top: 12vh; max-width: 500px; }
.login-card { padding: 36px; border-radius: 18px; box-shadow: 0 15px 60px #202a3b08; }
.login-eyebrow { color: var(--muted); font-size: .75rem; }
.login-card h1 { letter-spacing: -.04em; }
.login-choice { background: #fff; border-width: 1px; }
.login-choice-desc { font-size: .88rem; }
button:focus-visible,a:focus-visible,input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (max-width: 1150px) {
  .app-content { padding: 24px 24px 88px; }
  .summary-grid { gap: 10px; }
  .summary-tile { padding: 17px; }
  .summary-tile small { font-size: .63rem; }
  .review-callout { flex-wrap: wrap; }
  .review-callout .btn { margin-left: 52px; }
  .medication-details { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 800px) {
  .app-topbar { padding: 14px 18px; min-height: 68px; }
  .app-content { padding: 22px 18px 90px; }
  .page-date { font-size: .7rem; }
  .filter-status { display: none; }
  .filter-bar { gap: 8px; margin-bottom: 26px; }
  .overview-heading { align-items: flex-start; }
  .overview-heading .btn { max-width: 160px; }
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .summary-tile small { font-size: .72rem; }
  .overview-grid { grid-template-columns: 1fr; gap: 16px; }
  .review-callout { padding: 18px; gap: 12px; }
  .review-callout > div { flex: 1; }
  .review-callout .btn { margin: 0 0 0 46px; }
  .medication-item { padding: 18px; }
  .data-banner { bottom: 10px; right: 10px; max-width: calc(100vw - 20px); }
}
@media (max-width: 480px) {
  .overview-heading { flex-direction: column; gap: 16px; }
  .overview-heading .btn { max-width: none; }
  .chip { padding: 7px 12px; }
  .filter-heading { width: 100%; }
  .summary-tile { padding: 16px; }
  .summary-tile > span { font-size: .74rem; }
  .summary-tile small { font-size: .62rem; }
  .page-date { max-width: 120px; text-align: right; }
  .medication-tools { align-items: stretch; flex-direction: column; gap: 12px; }
  .medication-tools .btn { align-self: flex-start; }
  .status-tabs button { padding: 10px 9px; font-size: .76rem; }
  .status-tabs button span { margin-left: 3px; }
  .status-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .status-tabs button { white-space: nowrap; flex-shrink: 0; padding: 10px 7px; font-size: .72rem; }
  .medication-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .medication-details { gap: 16px; }
  .overview-panel { padding: 20px; }
  .login-card { padding: 26px; }
}
@media print {
  .rail,.app-topbar,.data-banner,.filter-bar,.site-footer,.skip-link,.medication-tools,.status-tabs,.panel-header button,.medication-heading button { display: none !important; }
  .app-shell,.app-main-wrap,.app-content { display: block; width: 100%; max-width: none; padding: 0; background: white; }
  .medication-item { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 15px; }
  .medication-details { grid-template-columns: repeat(4,1fr); }
  body { background: white; font-size: 12px; }
}

.appointment-agenda { margin-bottom: 28px; }
.appointment-agenda .item-meta { overflow-wrap: anywhere; }
.people-page { max-width: 1180px; margin: 0 auto; padding: 36px 24px 80px; }
.people-page > .panel { margin: 24px 0; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,360px),1fr)); gap: 24px; }
.people-page h3 { margin-top: 24px; }
.people-page .item { padding: 14px; }
.people-page .item-actions { flex-wrap: wrap; }
.people-page #invite-link { display: block; width: 100%; margin: 12px 0; padding: 12px; }
.people-page .panel-header { flex-wrap: wrap; gap: 12px; }
.people-page .panel { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .people-page { padding: 20px 16px 60px; } }
@media print { .item-actions, .medication-item > button { display: none !important; } }

.review-intro { padding: 20px 24px; margin: 24px 0; background: #f5f7fc; }
.review-intro h3 { margin: 0 0 8px; }
.review-intro p { max-width: 75ch; }
#review-progress, #rx-queue-progress { color: var(--muted); font-size: .85rem; }
#rx-original, #rx-duplicates { padding: 16px; margin-bottom: 20px; background: #f5f7fc; border: 1px solid var(--border); border-radius: 8px; }
#rx-original summary { cursor: pointer; font-weight: 600; }
#rx-duplicates h3 { margin-top: 0; }
#rx-original-content p, #rx-duplicate-content p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
#rx-duplicate-content p + p { border-top: 1px solid var(--border); padding-top: 12px; }
.field input[type="checkbox"] { display: inline-block; width: 20px; min-height: 20px; height: 20px; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--accent); }
.visit-brief { max-width: 850px; margin: 36px auto 90px; padding: 32px; background: white; border: 1px solid var(--border); border-radius: 12px; }
.visit-brief h1 { font-size: 1.9rem; margin-top: 28px; }
.visit-brief h2 { font-size: 1.1rem; margin: 28px 0 10px; }
.visit-brief li { margin: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.visit-medication-review { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 20px 0; }
.visit-medication-review label { display: block; padding: 9px 0; overflow-wrap: anywhere; }
.visit-medication-review input { width: 20px; height: 20px; margin-right: 10px; vertical-align: middle; accent-color: var(--accent); }
.appointment-agenda .item > .btn { margin: 8px 8px 0 0; white-space: normal; text-align: left; }
.brief-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.care-inbox { padding: 24px; margin: 24px 0; }
.inbox-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.inbox-controls .status-tabs { margin-bottom: 0; }
.inbox-controls label { font-size: .8rem; color: var(--muted); }
.inbox-controls select { font: inherit; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: white; }
#inbox-summary { color: var(--muted); font-size: .8rem; }
#inbox-list .item { padding: 18px; }
#inbox-list .item-actions { flex-wrap: wrap; gap: 8px; }
#inbox-list .item-title { overflow-wrap: anywhere; }
.inbox-priority { font-weight: 600; color: #9a452b; }
#inbox-more { margin-top: 16px; }
#recovery-codes code { overflow-wrap: anywhere; white-space: normal; }
@media (max-width: 600px) { .care-inbox { padding: 18px; } .inbox-controls { align-items: stretch; flex-direction: column; } }
@media (max-width: 600px) { .visit-brief { margin: 16px 12px 90px; padding: 20px; } }
@media print {
  .review-intro, .brief-actions { display: none !important; }
  body.printing-visit #app-shell, body.printing-visit .modal-overlay { display: none !important; }
  .visit-brief { margin: 0; padding: 0; border: 0; max-width: none; }
  .visit-brief h2 { break-after: avoid; }
  .visit-brief li { break-inside: avoid; }
}

.family-tree-frame { width: 100%; height: 80vh; min-height: 480px; border: 1px solid var(--border, #ddd); border-radius: 12px; background: white; }
[hidden] { display: none !important; }

/* Medication display preferences share the same records, filters and actions. */
.medication-view-switch { display:flex; gap:3px; padding:4px; border:1px solid var(--border); border-radius:10px; background:#edf1f5; flex-shrink:0; }
.medication-view-switch button { font:inherit; font-size:.85rem; cursor:pointer; border:0; border-radius:7px; background:transparent; color:var(--muted); padding:9px 14px; min-height:40px; }
.medication-view-switch button[aria-pressed="true"] { background:var(--accent); color:white; }
.medication-tools { flex-wrap:wrap; }

#rx-list .medication-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,350px),1fr)); align-items:start; gap:18px; }
#rx-list .medication-cards .medication-heading { align-items:flex-start; flex-direction:column; }
#rx-list .medication-cards .medication-details { grid-template-columns:repeat(2,minmax(0,1fr)); }
#rx-list .medication-item { min-width:0; overflow-wrap:anywhere; }
.medication-table-scroll { overflow-x:auto; width:100%; border:1px solid var(--border); border-radius:8px; background:white; }
.medication-table { width:100%; min-width:1100px; border-collapse:collapse; text-align:left; font-size:.8rem; line-height:1.45; }
.medication-table-caption { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.medication-table th,.medication-table td { padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:top; }
.medication-table thead th { background:#edf1f5; color:var(--muted); font-size:.72rem; font-weight:650; white-space:nowrap; }
.medication-table tbody tr:nth-child(even) { background:#f8fafc; }
.medication-table tbody tr:hover { background:#eef4fb; }
.medication-table tbody tr:last-child > * { border-bottom:0; }
.medication-table tbody th { min-width:200px; max-width:280px; }
.medication-table td { min-width:100px; max-width:240px; overflow-wrap:anywhere; }
.medication-name-link { background:none; border:0; padding:0; text-align:left; font:inherit; font-weight:600; color:var(--accent); cursor:pointer; }
.medication-name-link:hover { text-decoration:underline; }
.medication-table-actions { white-space:nowrap; }
.medication-table-actions .btn + .btn { margin-left:6px; }
@media(max-width:600px) { .medication-view-switch { align-self:flex-start; } #rx-list .medication-badges { flex-wrap:wrap; } }
@media print { #rx-list .medication-cards { display:block; } .medication-table-scroll { overflow:visible; border:0; } .medication-table { min-width:0; font-size:9px; table-layout:fixed; } .medication-table th,.medication-table td { min-width:0; max-width:none; padding:5px; overflow-wrap:anywhere; } .medication-table thead th { white-space:normal; } .medication-table-actions,.medication-table thead th:last-child { display:none; } .medication-table tr { break-inside:avoid; } }

/* The tree owns the available viewport; the surrounding page does not scroll. */
body.tree-workspace { height:100dvh; overflow:hidden; }
.tree-workspace .app-shell { height:100dvh; min-height:0; overflow:hidden; }
.tree-workspace .rail { overflow-y:auto; }
.tree-workspace .app-main-wrap { height:100%; min-height:0; }
.tree-workspace .app-topbar { min-height:56px; padding:12px 24px; flex-shrink:0; }
.tree-workspace .app-content { max-width:none; width:100%; margin:0; padding:0; min-height:0; display:flex; }
.tree-workspace [data-view="family-tree"] { width:100%; height:100%; min-height:0; }
.tree-workspace .family-tree-frame { display:block; width:100%; height:100%; min-height:0; border:0; border-radius:0; }
.tree-workspace .site-footer { display:none; }
.tree-workspace .data-banner { bottom:4px; right:8px; padding:3px 8px; opacity:.8; }
.tree-screen-reader-title { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }

/* Keep navigation present on tablets and desktop, including shorter windows. */
@media screen { .rail { height:100dvh; overflow-y:auto; overscroll-behavior:contain; } }
@media screen and (min-width:601px) and (max-width:1000px) { :root { --rail-w:200px; } .rail { padding:20px 10px; } .rail-brand { margin-bottom:24px; } .nav-link { padding:10px; gap:8px; font-size:.83rem; } }
.care-page-shell .people-page { width:100%; }
.rail-footer a[aria-current="page"] { color:white; font-weight:700; text-decoration:underline; text-underline-offset:4px; }
@media screen and (min-width:601px) { .care-page-shell > .nav-backdrop { display:none; } }
