:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-blue: #eff8ff;
  --surface-soft: #f3f8fc;
  --text: #111827;
  --text-heading: #0f172a;
  --text-label: #334155;
  --text-soft: #475569;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --border: #dbe5ee;
  --border-control: #d4e3ef;
  --border-accent: #7dd3fc;
  --border-accent-soft: #b9e4fb;
  --border-info-soft: #d8e8f3;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
  --focus-ring: rgba(14, 165, 233, 0.35);
  --focus-ring-soft: rgba(14, 165, 233, 0.13);
  --accent-shadow: rgba(14, 165, 233, 0.24);
  --urgent: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  --control-height: 52px;
  --control-radius: 10px;
  --icon-button-size: 52px;
  --chip-height: 44px;
  --font-regular: 300;
  --font-medium: 300;
  --font-semibold: 400;
  --font-bold: 400;
  --font-heavy: 400;
  --radius-card: 8px;
}

@font-face {
  font-display: block;
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 300;
  src: url("./assets/fonts/material-symbols-outlined.ttf") format("truetype");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: var(--font-regular);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

button {
  cursor: pointer;
}

.material-symbols-outlined {
  direction: ltr;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: "Material Symbols Outlined";
  font-size: 32px;
  font-style: normal;
  font-weight: 300;
  font-feature-settings: "liga";
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  overflow: hidden;
  text-transform: none;
  transition: color 120ms ease, opacity 120ms ease;
  vertical-align: middle;
  white-space: nowrap;
  width: 1em;
}

.symbols-loading .material-symbols-outlined {
  color: transparent !important;
  opacity: 0;
}

.is-hidden,
.route {
  display: none;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.is-hidden {
  display: none !important;
}

.route.is-active {
  display: block;
}

.eyebrow {
  display: none;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(3rem, 11vw, 5.2rem);
  font-weight: 200;
  letter-spacing: 0;
  line-height: 0.92;
  margin-bottom: 18px;
}

h2 {
  font-size: 2rem;
  font-weight: 200;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 0;
}

h3 {
  font-size: 1.08rem;
  font-weight: 300;
  letter-spacing: 0;
  margin-bottom: 14px;
}

h4,
strong {
  font-weight: 400;
}

.landing-view {
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 44%, #eef7ff 100%);
  min-height: 100vh;
  overflow: hidden;
}

.landing-shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: clamp(48px, 7vw, 96px) clamp(18px, 6vw, 80px) clamp(52px, 7vw, 96px);
}

.landing-hero-grid {
  align-items: center;
  display: grid;
  gap: clamp(28px, 5vw, 72px);
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.82fr);
  min-height: auto;
  padding: 0 0 clamp(36px, 6vw, 76px);
  position: relative;
}

.landing-hero-copy {
  max-width: 760px;
}

.landing-hero h1 {
  color: var(--text-heading);
  font-size: clamp(2.4rem, 6vw, 4.35rem);
  line-height: 1.02;
  max-width: 860px;
}

.landing-lede {
  color: #5f6f86;
  font-size: clamp(1.08rem, 1.8vw, 1.34rem);
  line-height: 1.58;
  margin-bottom: 30px;
  max-width: 760px;
}

.landing-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.ghost-link {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius-card);
  color: #ffffff;
  display: inline-flex;
  font-weight: var(--font-heavy);
  min-height: var(--control-height);
  padding: 0 18px;
  text-decoration: none;
}

.landing-demo-button {
  background: #ffffff;
  border-color: #dfe8f2;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.landing-visual {
  min-height: 520px;
  position: relative;
}

.landing-visual::before {
  background:
    radial-gradient(circle at 24% 82%, rgba(174, 105, 255, 0.42), transparent 30%),
    radial-gradient(circle at 82% 74%, rgba(255, 143, 87, 0.34), transparent 26%),
    linear-gradient(135deg, rgba(214, 244, 255, 0.86), rgba(255, 255, 255, 0.64));
  border-radius: 8px;
  bottom: 18px;
  content: "";
  left: 6%;
  position: absolute;
  right: 0;
  top: 92px;
}

.brain-orbit {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  left: 0;
  overflow: hidden;
  padding: 10px;
  position: absolute;
  top: 18px;
  transform: rotate(-2deg);
  width: min(72%, 360px);
  z-index: 2;
}

.brain-orbit img {
  border-radius: 6px;
  display: block;
  width: 100%;
}

.hero-ui-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 226, 239, 0.92);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.12);
  position: absolute;
  z-index: 3;
}

.hero-ui-card-main {
  bottom: 44px;
  display: grid;
  gap: 12px;
  padding: 18px;
  right: 0;
  width: min(78%, 420px);
}

.hero-ui-card-small {
  bottom: 0;
  color: var(--text-soft);
  display: grid;
  gap: 3px;
  left: 16%;
  padding: 16px;
  width: min(54%, 260px);
}

.hero-ui-card-small strong {
  color: var(--text-heading);
}

.hero-ui-card-small p {
  margin: 0;
}

.mock-window-bar {
  display: flex;
  gap: 7px;
  margin-bottom: 2px;
}

.mock-window-bar span {
  background: #d9e5f0;
  border-radius: 999px;
  height: 9px;
  width: 9px;
}

.mock-app-row {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #e4edf6;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  padding: 12px;
}

.mock-app-row p,
.mock-app-row strong {
  margin: 0;
}

.mock-app-row p {
  color: var(--muted);
  font-size: 0.82rem;
}

.mock-app-row em,
.meds-mock em {
  background: #eef8ff;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-style: normal;
  padding: 5px 8px;
}

.mock-icon {
  border-radius: 8px;
  height: 38px;
  width: 38px;
}

.mock-icon.medicine {
  background: linear-gradient(135deg, #7dd3fc, #a78bfa);
}

.mock-icon.symptom {
  background: linear-gradient(135deg, #fda4af, #fdba74);
}

.mock-progress,
.signal-bars {
  align-items: end;
  display: flex;
  gap: 7px;
  height: 86px;
  padding: 12px 8px 0;
}

.mock-progress span,
.signal-bars span {
  background: linear-gradient(180deg, #8b5cf6, #38bdf8);
  border-radius: 999px 999px 2px 2px;
  flex: 1;
  min-width: 8px;
}

.bento-section {
  display: grid;
  gap: 26px;
}

.bento-heading {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 0.72fr);
}

.bento-heading h2 {
  color: var(--text-heading);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
  margin: 0;
}

.bento-heading p {
  color: #65758b;
  font-size: 1.08rem;
  line-height: 1.65;
  margin: 0;
}

.bento-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.045);
  display: grid;
  gap: 22px;
  grid-column: span 4;
  min-height: 340px;
  overflow: hidden;
  padding: clamp(22px, 3vw, 34px);
  position: relative;
}

.bento-card-wide {
  grid-column: span 8;
}

.bento-card-story {
  background: linear-gradient(135deg, #ffffff 0%, #f5fbff 100%);
  grid-column: span 8;
  min-height: 300px;
}

.bento-card-story .bento-copy {
  max-width: 820px;
}

.bento-card-story .bento-copy p + p {
  margin-top: 12px;
}

.bento-card-gradient {
  background:
    radial-gradient(circle at 24% 100%, rgba(168, 85, 247, 0.34), transparent 34%),
    radial-gradient(circle at 100% 84%, rgba(251, 146, 60, 0.26), transparent 32%),
    #ffffff;
}

.bento-card-soft {
  background: linear-gradient(135deg, #ffffff 0%, #f1f8ff 100%);
}

.bento-copy {
  max-width: 620px;
}

.bento-copy h3 {
  color: var(--text-heading);
  font-size: clamp(1.45rem, 2.1vw, 2.05rem);
  line-height: 1.08;
  margin-bottom: 12px;
}

.bento-copy p {
  color: #65758b;
  font-size: 0.98rem;
  line-height: 1.62;
  margin-bottom: 0;
}

.timeline-mock,
.meds-mock,
.signal-mock,
.export-mock,
.privacy-mock {
  position: relative;
  z-index: 1;
}

.timeline-mock {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.timeline-mock div {
  background: #f8fbff;
  border: 1px solid #e4edf6;
  border-radius: 8px;
  display: grid;
  gap: 3px;
  grid-template-columns: 62px 1fr;
  padding: 13px 14px;
}

.timeline-mock span {
  color: var(--accent-strong);
  font-size: 0.82rem;
}

.timeline-mock strong,
.timeline-mock p {
  margin: 0;
}

.timeline-mock p {
  color: var(--muted);
  grid-column: 2;
}

.meds-mock {
  align-self: end;
  display: grid;
  gap: 10px;
}

.meds-mock div {
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 235, 245, 0.9);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 52px 1fr auto;
  padding: 13px;
}

.meds-mock span {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.signal-mock {
  align-self: end;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  border: 1px solid #e4edf6;
  border-radius: 8px;
  padding: 16px;
}

.signal-mock p {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 8px 0 0;
}

.export-mock {
  align-self: end;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(168, 85, 247, 0.12)),
    #ffffff;
  border: 1px solid #e4edf6;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 18px;
}

.export-mock span {
  color: var(--accent-strong);
  font-size: 0.82rem;
}

.export-mock strong {
  color: var(--text-heading);
  font-size: 2rem;
}

.export-mock p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.privacy-mock {
  align-items: center;
  align-self: end;
  background: #ffffff;
  border: 1px solid #e4edf6;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  padding: 16px;
}

.privacy-mock .material-symbols-outlined {
  background: #eef8ff;
  border-radius: 8px;
  color: var(--accent-strong);
  font-size: 28px;
  padding: 10px;
}

.privacy-mock p {
  color: var(--muted);
  line-height: 1.45;
  margin: 3px 0 0;
}

.patient-form {
  display: grid;
  gap: 16px;
}

.brain-visual-panel {
  margin: 0 0 8px;
  min-width: 0;
}

.brain-visual {
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12);
  display: block;
  height: auto;
  width: 100%;
}

label {
  color: var(--text-label);
  display: grid;
  font-size: 0.9rem;
  font-weight: var(--font-bold);
  gap: 8px;
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--text);
  height: var(--control-height);
  min-height: var(--control-height);
  outline: none;
  padding: 0 14px;
  font-weight: var(--font-regular);
  width: 100%;
}

select {
  appearance: none;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-color: var(--border-control);
  border-radius: var(--control-radius);
  font-weight: var(--font-regular);
  min-height: var(--control-height);
  padding-right: 42px;
}

.native-select-hidden {
  height: 1px;
  left: 0;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 1px;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-button {
  align-items: center;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border-control);
  border-radius: var(--control-radius);
  color: var(--text);
  display: grid;
  font: inherit;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  height: var(--control-height);
  justify-items: start;
  line-height: 1.2;
  min-height: var(--control-height);
  outline: none;
  padding: 0 12px 0 14px;
  text-align: left;
  width: 100%;
}

.custom-select-button:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

.custom-select-button .custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-button .material-symbols-outlined {
  background: var(--surface-blue);
  border-radius: var(--radius-card);
  color: var(--text-soft);
  font-size: 24px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  transition: transform 140ms ease;
  width: 34px;
}

.custom-select.is-open .custom-select-button .material-symbols-outlined {
  transform: rotate(180deg);
}

.custom-select-menu {
  background: #ffffff;
  border: 1px solid var(--border-control);
  border-radius: var(--control-radius);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 4px;
  left: 0;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
}

.custom-select-option {
  background: transparent;
  border: 0;
  border-radius: var(--radius-card);
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
}

.custom-select-option:hover,
.custom-select-option.is-selected {
  background: var(--surface-blue);
  color: var(--text-heading);
}

.custom-select-option:disabled {
  color: var(--muted-light);
}

textarea {
  height: auto;
  min-height: 104px;
  padding: 14px;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

input[list]::-webkit-calendar-picker-indicator {
  display: none !important;
}

.search-box {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  display: flex;
  gap: 10px;
  padding-left: 12px;
}

.search-box input {
  border: 0;
  box-shadow: none;
  min-height: calc(var(--control-height) - 2px);
  padding-left: 0;
}

.search-box .material-symbols-outlined {
  color: var(--muted);
  font-size: 26px;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button,
.nav-button,
.quick-button {
  align-items: center;
  border: 0;
  border-radius: var(--radius-card);
  display: inline-flex;
  font-weight: var(--font-heavy);
  justify-content: center;
}

.primary-button {
  background: var(--accent);
  color: white;
  gap: 8px;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 18px;
  white-space: nowrap;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-label);
  gap: 8px;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 16px;
  white-space: nowrap;
}

.text-button {
  background: transparent;
  color: var(--accent-strong);
  padding: 6px 0;
}

.icon-button {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-label);
  flex: 0 0 auto;
  height: var(--icon-button-size);
  min-height: var(--icon-button-size);
  width: var(--icon-button-size);
}

.icon-button:disabled {
  color: var(--muted-light);
  cursor: wait;
}

#syncButton .material-symbols-outlined {
  transition: transform 0.2s ease;
}

#syncButton:disabled .material-symbols-outlined {
  animation: sync-spin 0.9s linear infinite;
}

@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}

.helper-text {
  color: var(--muted);
  font-size: 0.86rem;
}

.app-view {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-view.nav-collapsed {
  grid-template-columns: 84px 1fr;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.sidebar-header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.sidebar-brand {
  align-items: center;
  display: flex;
  gap: 10px;
  font-size: 1.18rem;
  min-width: 0;
}

.sidebar-brand .material-symbols-outlined {
  color: var(--accent-strong);
}

.sidebar-brand strong,
.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 140ms ease, width 180ms ease;
  white-space: nowrap;
}

.nav-toggle {
  min-height: var(--icon-button-size);
  width: var(--icon-button-size);
}

nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  background: transparent;
  color: var(--text-soft);
  gap: 10px;
  justify-content: flex-start;
  min-height: var(--control-height);
  padding: 12px 12px;
}

.nav-button .material-symbols-outlined {
  font-size: 28px;
}

.nav-button.is-active {
  background: var(--surface-blue);
  color: var(--accent-strong);
}

.app-view.nav-collapsed .sidebar {
  align-items: center;
  padding-inline: 14px;
}

.app-view.nav-collapsed .sidebar-header {
  display: grid;
  justify-items: center;
}

.app-view.nav-collapsed .sidebar-brand {
  justify-content: center;
}

.app-view.nav-collapsed .sidebar-brand strong,
.app-view.nav-collapsed .nav-label {
  opacity: 0;
  pointer-events: none;
  width: 0;
}

.app-view.nav-collapsed nav {
  width: 100%;
}

.app-view.nav-collapsed .nav-button {
  justify-content: center;
  padding-inline: 10px;
  width: var(--icon-button-size);
}

.main-shell {
  margin: 0 auto;
  max-width: 1120px;
  padding: 28px 28px 96px;
  width: 100%;
}

.topbar,
.section-heading,
.dialog-heading,
.dialog-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 26px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.topbar-save:disabled {
  background: #e2e8f0;
  color: var(--muted-light);
  cursor: default;
}

.topbar-save .material-symbols-outlined {
  font-size: 22px;
}

.quick-actions {
  margin-bottom: 18px;
}

.quick-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-button {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-heading);
  flex-direction: column;
  gap: 22px;
  min-height: 154px;
  padding: 20px;
  position: relative;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.quick-button:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.quick-button .material-symbols-outlined {
  color: var(--accent-strong);
  font-size: 50px;
}

.quick-button.wide {
  grid-column: span 2;
}

.today-meds-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.045);
  display: grid;
  gap: 16px;
  margin: 0 0 20px;
  padding: 18px;
}

.today-meds-summary {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 4px 0 0;
}

.compact-button {
  height: 44px;
  min-height: 44px;
  padding-inline: 14px;
}

.compact-button .material-symbols-outlined {
  font-size: 22px;
}

.today-meds-list {
  display: grid;
  gap: 10px;
}

.today-med-item {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #e4edf6;
  border-radius: var(--radius-card);
  display: grid;
  gap: 14px;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  padding: 13px 14px;
}

.today-med-item.is-next {
  background: #eff8ff;
  border-color: var(--border-accent-soft);
  box-shadow: 0 0 0 4px var(--focus-ring-soft);
}

.today-med-item.is-given {
  background: #ffffff;
  color: var(--muted);
}

.today-med-time {
  color: var(--accent-strong);
  font-size: 0.9rem;
}

.today-med-body {
  min-width: 0;
}

.today-med-body h4 {
  color: var(--text-heading);
  font-size: 1rem;
  margin: 0 0 4px;
}

.today-med-body p {
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

.today-med-item.is-given .today-med-time,
.today-med-item.is-given .today-med-body h4,
.today-med-item.is-given .today-med-body p {
  color: var(--muted-light);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.today-med-status {
  border-radius: 999px;
  font-size: 0.76rem;
  padding: 6px 9px;
  white-space: nowrap;
}

.today-med-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.today-dose-button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.88rem;
  gap: 7px;
  min-height: 40px;
  padding: 0 13px;
  white-space: nowrap;
}

.today-dose-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.today-dose-button .material-symbols-outlined {
  color: currentColor;
  font-size: 20px;
}

.today-med-menu {
  position: relative;
}

.today-med-menu summary {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--text-heading);
  cursor: pointer;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  list-style: none;
  width: 40px;
}

.today-med-menu summary::-webkit-details-marker {
  display: none;
}

.today-med-menu summary .material-symbols-outlined {
  font-size: 22px;
}

.today-med-menu-popover {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 190px;
  z-index: 20;
}

.today-med-menu-popover button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--text-heading);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  text-align: left;
  width: 100%;
}

.today-med-menu-popover button:hover {
  background: #eef8ff;
}

.today-med-menu-popover .material-symbols-outlined {
  color: var(--muted);
  font-size: 20px;
}

.status-given {
  background: #f1f5f9;
  color: var(--muted);
}

.status-next {
  background: var(--accent);
  color: #ffffff;
}

.status-missed {
  background: #fff1f2;
  color: #be123c;
}

.status-later {
  background: #eef8ff;
  color: var(--accent-strong);
}

.timeline-section {
  margin-top: 24px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto 1fr auto;
  padding: 16px;
}

.timeline-icon {
  align-items: center;
  background: var(--surface-blue);
  border-radius: 8px;
  color: var(--accent-strong);
  display: flex;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.timeline-icon .material-symbols-outlined {
  font-size: 32px;
}

.timeline-body {
  min-width: 0;
}

.timeline-body h4 {
  font-size: 1rem;
  margin: 0 0 5px;
}

.timeline-body p {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.timeline-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.time-pill {
  background: var(--time-gradient, #f1f5f9);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: var(--font-medium);
  padding: 7px 10px;
  white-space: nowrap;
}

.delete-log-button {
  color: #64748b;
  height: 40px;
  min-height: 40px;
  width: 40px;
}

.delete-log-button:hover {
  border-color: #fecaca;
  color: var(--urgent);
}

.delete-log-button .material-symbols-outlined {
  font-size: 22px;
}

.time-period {
  color: var(--muted-light);
  font-weight: var(--font-regular);
}

.time-night {
  color: #f8fafc;
}

.time-night .time-period {
  color: #cbd5e1;
}

.time-clock,
.time-period {
  display: inline-block;
  line-height: 1;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed #bdd4e8;
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(320px, 1fr) minmax(170px, 210px) minmax(170px, 210px);
  margin-bottom: 18px;
}

.history-date-filter {
  gap: 6px;
}

.history-date-filter input {
  font-size: 0.95rem;
}

.export-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
}

.export-panel h3 {
  margin-bottom: 0;
}

.export-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: var(--font-semibold);
}

.sync-hint {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: var(--font-medium);
  margin: -4px 0 0;
}

.sync-hint.is-synced {
  color: var(--accent-strong);
}

.export-controls {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 280px) repeat(2, minmax(170px, 220px));
}

.export-controls > label:first-child {
  grid-column: 1;
}

.export-controls .export-date-field {
  grid-column: 2;
}

.export-controls .export-date-field + .export-date-field {
  grid-column: 3;
}

.export-actions {
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(190px, 240px));
  justify-content: start;
  min-width: 0;
}

.export-actions .ghost-button,
.export-actions .primary-button {
  inline-size: 100%;
  min-width: 0;
  white-space: nowrap;
}

.trend-panel,
.trend-insights {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.045);
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
}

.trend-heading {
  align-items: start;
  gap: 16px;
}

.trend-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 4px 0 0;
}

.trend-range-controls {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  padding: 6px;
}

.trend-range-controls .view-toggle {
  min-height: 40px;
  padding-inline: 12px;
  white-space: nowrap;
}

.trend-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trend-stat {
  background: #f8fbff;
  border: 1px solid #e4edf6;
  border-radius: var(--radius-card);
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
}

.trend-stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.trend-stat strong {
  color: var(--text-heading);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1;
}

.trend-stat p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 0;
}

.trend-chart-shell {
  background:
    radial-gradient(circle at 88% 12%, rgba(249, 115, 22, 0.1), transparent 28%),
    radial-gradient(circle at 10% 0%, rgba(14, 165, 233, 0.12), transparent 34%),
    #ffffff;
  border: 1px solid #e4edf6;
  border-radius: var(--radius-card);
  min-height: 320px;
  overflow: hidden;
  padding: 12px;
}

.trend-chart {
  display: block;
  height: auto;
  max-height: 360px;
  width: 100%;
}

.trend-grid-line {
  stroke: #e4edf6;
  stroke-width: 1;
}

.trend-y-label,
.trend-x-label {
  fill: var(--muted);
  font-size: 12px;
}

.trend-y-label {
  dominant-baseline: middle;
  text-anchor: end;
}

.trend-x-label {
  text-anchor: middle;
}

.trend-area {
  fill: url("#fatigueTrendFill");
}

.trend-line {
  fill: none;
  stroke: #7c3aed;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.trend-point {
  fill: #ffffff;
  stroke: #7c3aed;
  stroke-width: 3;
}

.trend-summary-list {
  display: grid;
  gap: 10px;
}

.trend-summary-list article {
  align-items: start;
  background: #f8fbff;
  border: 1px solid #e4edf6;
  border-radius: var(--radius-card);
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  padding: 12px 14px;
}

.trend-summary-list .material-symbols-outlined {
  color: var(--accent-strong);
  font-size: 24px;
}

.trend-summary-list p,
.trend-ai-result p {
  color: var(--text-soft);
  line-height: 1.5;
  margin: 0;
}

.trend-ai-result {
  background: #fbf8ff;
  border: 1px solid #e9d5ff;
  border-radius: var(--radius-card);
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.trend-ai-result h4 {
  margin: 0;
}

.trend-ai-result ul {
  color: var(--text-soft);
  margin: 0;
  padding-left: 20px;
}

.pdf-dialog {
  max-width: min(1120px, calc(100% - 28px));
  width: min(1120px, calc(100% - 28px));
}

.pdf-dialog form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.export-dialog form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.dialog-subtitle {
  color: var(--muted);
  line-height: 1.45;
  margin: 6px 0 0;
}

.export-dialog-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.download-format-note {
  background: var(--surface-blue);
  border: 1px solid var(--border-info-soft);
  border-radius: var(--radius-card);
  color: var(--text-soft);
  line-height: 1.5;
  padding: 14px 16px;
}

.pdf-preview-content {
  background: #e8eef5;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding: 18px;
}

.pdf-page {
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  color: #111827;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 auto;
  min-height: 210mm;
  padding: 12mm;
  width: 297mm;
}

.pdf-header,
.pdf-footer {
  align-items: end;
  display: flex;
  justify-content: space-between;
}

.pdf-header p {
  color: var(--accent-strong);
  font-size: 9pt;
  font-weight: var(--font-heavy);
  margin-bottom: 3px;
  text-transform: uppercase;
}

.pdf-header h1 {
  font-size: 20pt;
  line-height: 1;
  margin: 0;
}

.pdf-header div:last-child {
  color: var(--text-soft);
  display: block;
  font-size: 9pt;
  min-width: 45mm;
  text-align: right;
}

.pdf-header div:last-child strong,
.pdf-header div:last-child span {
  display: block;
}

.pdf-table {
  border-collapse: collapse;
  font-size: 8.5pt;
  table-layout: fixed;
  width: 100%;
}

.pdf-table th,
.pdf-table td {
  border: 1px solid var(--border);
  padding: 6px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.pdf-table th {
  background: #eff8ff;
  color: var(--text-heading);
  font-weight: var(--font-heavy);
}

.pdf-table th:nth-child(1),
.pdf-table td:nth-child(1) {
  width: 22mm;
}

.pdf-table th:nth-child(2),
.pdf-table td:nth-child(2) {
  width: 20mm;
}

.pdf-table th:nth-child(3),
.pdf-table td:nth-child(3) {
  width: 24mm;
}

.pdf-table th:nth-child(5),
.pdf-table td:nth-child(5) {
  width: 22mm;
}

.pdf-footer {
  color: #64748b;
  font-size: 7.5pt;
  gap: 12px;
  margin-top: auto;
}

.pdf-print-area {
  display: none;
}

.patient-form,
.settings-form,
.meds-plan-shell {
  max-width: 760px;
}

.settings-form {
  display: grid;
  gap: 22px;
}

.meds-plan-shell {
  display: grid;
  gap: 18px;
}

.meds-plan-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, max-content);
  justify-content: end;
}

.meds-plan-views {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 6px;
}

.view-toggle {
  background: transparent;
  border: 0;
  border-radius: var(--radius-card);
  color: var(--text-soft);
  font-weight: var(--font-semibold);
  min-height: 42px;
}

.view-toggle.is-active {
  background: var(--surface-blue);
  color: var(--accent-strong);
}

.meds-plan-readable,
.meds-plan-editor {
  display: grid;
  gap: 12px;
}

.meds-plan-group,
.meds-plan-editor-card,
.meds-plan-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.meds-plan-group {
  overflow: hidden;
}

.meds-plan-group-heading {
  align-items: center;
  background: var(--surface-blue);
  color: var(--text-heading);
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.meds-plan-group-heading strong {
  font-size: 1.02rem;
}

.meds-plan-group-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: var(--font-semibold);
}

.meds-plan-items {
  display: grid;
}

.meds-plan-item {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}

.meds-plan-item h4,
.meds-plan-modal-item h4 {
  margin: 0 0 5px;
}

.meds-plan-item p,
.meds-plan-modal-item p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.meds-plan-form {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

.meds-plan-editor-card {
  display: grid;
  overflow: hidden;
}

.meds-plan-card-summary {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) max-content;
  padding: 14px;
}

.meds-plan-summary-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.meds-plan-icon-action {
  height: 44px;
  min-height: 44px;
  width: 44px;
}

.meds-plan-icon-action .material-symbols-outlined {
  font-size: 22px;
}

.meds-plan-icon-action.danger:hover {
  border-color: #fecaca;
  color: var(--urgent);
}

.meds-plan-card-copy {
  min-width: 0;
}

.meds-plan-card-copy h4 {
  margin: 0 0 5px;
}

.meds-plan-card-copy p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.meds-plan-editor-card.is-expanded .meds-plan-card-summary {
  background: var(--surface-blue);
  border-bottom: 1px solid var(--border);
}

.meds-plan-editor-row {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  padding: 14px;
}

.meds-plan-editor-row > label {
  min-width: 0;
}

.meds-plan-notes-field {
  grid-column: span 2;
}

.meds-plan-active-field {
  min-width: 120px;
}

.meds-plan-card-actions {
  align-items: end;
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: space-between;
  min-width: 0;
  width: 100%;
}

.meds-plan-remove {
  align-self: end;
  justify-self: start;
  padding-inline: 20px;
}

.meds-plan-save-item {
  margin-left: auto;
}

.meds-plan-remove .material-symbols-outlined {
  font-size: 22px;
}

.control-icon-field {
  align-items: center;
  display: block;
  position: relative;
}

.control-icon-field input {
  padding-right: 56px;
}

.control-icon-field > .material-symbols-outlined {
  align-items: center;
  background: var(--surface-blue);
  border-radius: var(--radius-card);
  color: var(--text-heading);
  display: inline-flex;
  font-size: 22px;
  height: 34px;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
}

.dropdown-icon-field > .material-symbols-outlined {
  color: var(--text-soft);
}

.meds-plan-accordion {
  padding: 0;
}

.meds-plan-accordion summary {
  align-items: center;
  color: var(--text-label);
  cursor: pointer;
  display: flex;
  font-weight: var(--font-semibold);
  gap: 10px;
  list-style: none;
  padding: 14px 16px;
}

.meds-plan-accordion summary::-webkit-details-marker {
  display: none;
}

.meds-plan-accordion summary .material-symbols-outlined {
  color: var(--accent-strong);
  font-size: 26px;
}

.meds-plan-modal-list {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.meds-plan-modal-group {
  display: grid;
  gap: 8px;
}

.meds-plan-modal-group > strong {
  color: var(--accent-strong);
  font-size: 0.86rem;
}

.meds-plan-modal-item {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border-info-soft);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.settings-panel {
  display: grid;
  gap: 12px;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-row {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  padding: 14px;
}

.settings-row .ghost-button {
  height: var(--control-height);
  min-height: var(--control-height);
}

.settings-row.caregiver-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.settings-row.sheet-settings-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.settings-row.ai-settings-row {
  grid-template-columns: minmax(0, 1fr);
}

.settings-action {
  align-self: end;
  padding-inline: 14px;
  white-space: nowrap;
}

.settings-action .material-symbols-outlined {
  font-size: 22px;
}

.settings-save {
  background: var(--surface-blue);
  border-color: #9bd7f7;
  color: var(--accent-strong);
}

dialog {
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-width: 680px;
  padding: 0;
  width: calc(100% - 28px);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

#entryForm {
  display: grid;
  gap: 22px;
  padding: 28px;
  position: relative;
}

.field-row {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dose-stepper {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: var(--control-height) minmax(0, 1fr) var(--control-height);
}

.dose-stepper input {
  text-align: left;
}

.dose-step-button {
  align-items: center;
  background: var(--surface-blue);
  border: 1px solid #cce8f8;
  border-radius: var(--control-radius);
  color: var(--accent-strong);
  display: inline-flex;
  height: var(--control-height);
  justify-content: center;
  min-height: var(--control-height);
  padding: 0;
  width: var(--control-height);
}

.dose-step-button:hover {
  border-color: var(--accent);
}

.dose-step-button .material-symbols-outlined {
  font-size: 24px;
}

.select-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.inline-add-fields {
  background: var(--surface-soft);
  border: 1px solid #cce8f8;
  border-radius: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.inline-add-fields[data-add-fields="givenBy"] {
  grid-template-columns: 1fr;
}

.subtle-button {
  background: var(--surface-blue);
  border-color: #cce8f8;
  color: var(--accent-strong);
  width: var(--icon-button-size);
}

.subtle-button .material-symbols-outlined {
  font-size: 24px;
}

.date-time-row {
  gap: 24px;
}

.picker-field {
  color: var(--text-label);
  display: grid;
  font-size: 1rem;
  font-weight: var(--font-bold);
  gap: 12px;
  position: relative;
}

.picker-control {
  align-items: center;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border-control);
  border-radius: var(--control-radius);
  color: var(--text);
  display: flex;
  font-size: 1.05rem;
  font-weight: var(--font-medium);
  justify-content: space-between;
  min-height: var(--control-height);
  padding: 11px 14px 11px 16px;
  text-align: left;
  width: 100%;
}

.picker-control .time-period {
  font-size: 0.82em;
  margin-left: 4px;
}

.picker-field [data-picker="time"] {
  background: var(--time-gradient, linear-gradient(180deg, #ffffff 0%, #fbfdff 100%));
}

.picker-control.time-night {
  border-color: var(--text-label);
  color: #f8fafc;
}

.picker-control .material-symbols-outlined {
  align-items: center;
  background: var(--surface-blue);
  border-radius: 8px;
  color: #1e293b;
  display: flex;
  font-size: 24px;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.picker-control.time-night .material-symbols-outlined {
  background: rgba(248, 250, 252, 0.12);
  color: #f8fafc;
}

.picker-control:hover {
  border-color: #9bd7f7;
}

.picker-popover {
  background: var(--surface);
  border: 1px solid var(--border-control);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  display: grid;
  gap: 14px;
  max-width: 430px;
  padding: 16px;
  position: absolute;
  top: 234px;
  width: 100%;
  z-index: 3;
}

#datePicker {
  left: 28px;
}

#timePicker {
  left: 28px;
  max-width: none;
  right: 28px;
  width: auto;
}

.picker-popover.is-hidden {
  display: none;
}

.picker-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.picker-header strong {
  font-size: 0.98rem;
}

.picker-nav {
  display: flex;
  gap: 8px;
}

.picker-nav button,
.date-grid button,
.time-grid button {
  align-items: center;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-label);
  display: inline-flex;
  font-weight: var(--font-medium);
  justify-content: center;
  min-height: var(--chip-height);
}

.picker-nav button {
  width: var(--chip-height);
}

.picker-weekdays,
.date-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.picker-weekdays span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: var(--font-semibold);
  text-align: center;
}

.date-grid button {
  min-height: 42px;
}

.date-grid button:hover,
.time-grid button:hover,
.picker-nav button:hover {
  background: var(--surface-blue);
  border-color: var(--border-accent-soft);
  color: var(--accent-strong);
}

.date-grid button.is-muted {
  color: var(--muted-light);
}

.date-grid button.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.time-grid button.is-selected {
  background: var(--time-gradient, var(--surface-blue));
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring-soft);
  color: var(--text-heading);
}

.time-grid button.time-night {
  border-color: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.time-grid button.time-night:hover,
.time-grid button.time-night.is-selected {
  background: var(--time-gradient);
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.2);
  color: #ffffff;
}

.time-popover {
  max-height: 330px;
  overflow: hidden;
}

.time-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(78px, 1fr));
  max-height: 238px;
  overflow: auto;
  padding-right: 4px;
}

.time-grid button {
  background: var(--time-gradient, var(--surface));
  border-color: #dbeafe;
  font-size: 0.92rem;
  min-height: var(--chip-height);
  padding: 8px 10px;
  white-space: nowrap;
}

.time-grid button .time-period {
  font-size: 0.72em;
  margin-left: 2px;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  color: var(--text-label);
  font-size: 1rem;
  font-weight: var(--font-bold);
  margin-bottom: 12px;
}

.choice-grid input {
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.choice-grid label {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-label);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.94rem;
  font-weight: var(--font-medium);
  min-height: var(--chip-height);
  padding: 10px 16px;
}

.choice-grid input:checked + span {
  color: var(--accent-strong);
}

.choice-grid label:has(input:checked) {
  background: var(--surface-blue);
  border-color: var(--border-accent);
}

.severity-slider-field {
  background: linear-gradient(180deg, #ffffff 0%, #f8fcff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.severity-value {
  align-items: baseline;
  color: var(--muted-light);
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  justify-content: center;
  line-height: 1;
  margin: 4px 0 16px;
}

.severity-value strong {
  color: var(--accent-strong);
  font-size: clamp(4rem, 18vw, 6.4rem);
  font-weight: var(--font-bold);
  letter-spacing: 0;
}

.severity-value span {
  font-size: 1.4rem;
  font-weight: var(--font-regular);
}

.severity-value em {
  color: var(--text);
  flex-basis: 100%;
  font-size: 1.05rem;
  font-style: normal;
  font-weight: var(--font-medium);
  margin-top: 8px;
  text-align: center;
  text-transform: capitalize;
}

.severity-slider {
  appearance: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  height: 48px;
  min-height: 48px;
  padding: 0;
}

.severity-slider:focus {
  box-shadow: none;
}

.severity-slider:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
}

.severity-slider::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #bae6fd 0%, #0ea5e9 100%);
  border-radius: 999px;
  height: 10px;
}

.severity-slider::-moz-range-track {
  background: linear-gradient(90deg, #bae6fd 0%, #0ea5e9 100%);
  border-radius: 999px;
  height: 10px;
}

.severity-slider::-webkit-slider-thumb {
  appearance: none;
  background: #ffffff;
  border: 4px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 8px 22px var(--accent-shadow);
  height: 36px;
  margin-top: -13px;
  width: 36px;
}

.severity-slider::-moz-range-thumb {
  background: #ffffff;
  border: 4px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 8px 22px var(--accent-shadow);
  height: 28px;
  width: 28px;
}

.severity-scale {
  color: var(--muted);
  display: flex;
  font-size: 0.84rem;
  font-weight: var(--font-medium);
  justify-content: space-between;
  margin-top: 4px;
}

.dynamic-fields {
  display: grid;
  gap: 20px;
}

.bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  .landing-hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing-visual {
    margin-inline: auto;
    max-width: 680px;
    width: 100%;
  }

  .bento-card,
  .bento-card-wide,
  .bento-card-story {
    grid-column: span 6;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .export-controls {
    grid-template-columns: minmax(220px, 280px) repeat(2, minmax(150px, 1fr));
  }

  .export-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    justify-content: start;
  }
}

@media (max-width: 840px) {
  .landing-shell {
    padding: 34px 16px 48px;
  }

  .landing-hero-grid {
    gap: 28px;
    padding-bottom: 42px;
  }

  .landing-visual {
    min-height: 430px;
  }

  .brain-orbit {
    width: min(76%, 320px);
  }

  .hero-ui-card-main {
    width: min(82%, 390px);
  }

  .hero-ui-card-small {
    left: 6%;
    width: min(58%, 250px);
  }

  .bento-heading {
    grid-template-columns: 1fr;
  }

  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bento-card,
  .bento-card-wide,
  .bento-card-story {
    grid-column: span 2;
    min-height: 0;
  }

  .app-view {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-shell {
    padding: 22px 16px 104px;
  }

  .filters,
  .export-controls {
    grid-template-columns: 1fr;
  }

  .trend-heading,
  .trend-insights .section-heading {
    align-items: stretch;
    display: grid;
    gap: 14px;
  }

  .trend-range-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .trend-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .export-controls > label:first-child,
  .export-controls .export-date-field,
  .export-controls .export-date-field + .export-date-field,
  .export-actions {
    grid-column: 1;
  }

  .export-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-button {
    gap: 14px;
    justify-content: space-between;
    min-height: clamp(128px, 31vw, 168px);
    padding: 18px;
  }

  .quick-button.wide {
    grid-column: span 2;
    min-height: 104px;
  }

  .quick-button .material-symbols-outlined {
    font-size: 44px;
  }

  .quick-button strong {
    font-size: 1.02rem;
  }

  .today-meds-card .section-heading {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }

  .timeline-item {
    grid-template-columns: auto 1fr;
  }

  .timeline-actions {
    grid-column: 2;
    justify-self: start;
  }

  .bottom-nav {
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--border);
    bottom: 0;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(7, 1fr);
    left: 0;
    padding: 8px;
    position: fixed;
    right: 0;
  }

  .bottom-nav .nav-button {
    align-items: center;
    flex-direction: column;
    font-size: 0.6rem;
    gap: 2px;
    justify-content: center;
    min-height: var(--control-height);
    min-width: 0;
    overflow: hidden;
    padding: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav .nav-button .material-symbols-outlined {
    font-size: 24px;
  }
}

@media (max-width: 520px) {
  .landing-hero h1 {
    font-size: clamp(2.35rem, 13vw, 3.35rem);
  }

  .landing-lede {
    font-size: 1.02rem;
  }

  .landing-actions {
    align-items: stretch;
    display: grid;
  }

  .landing-actions .primary-button,
  .landing-actions .ghost-button {
    justify-content: center;
    width: 100%;
  }

  .landing-visual {
    min-height: 360px;
  }

  .landing-visual::before {
    top: 64px;
  }

  .hero-ui-card-main {
    bottom: 34px;
    padding: 14px;
    width: 90%;
  }

  .hero-ui-card-small {
    display: none;
  }

  .mock-app-row {
    grid-template-columns: auto 1fr;
  }

  .mock-app-row em {
    grid-column: 2;
    justify-self: start;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-card,
  .bento-card-wide,
  .bento-card-story {
    grid-column: 1;
    padding: 22px;
  }

  .bento-card-story {
    background: linear-gradient(135deg, #ffffff 0%, #f5fbff 100%);
  }

  .timeline-mock div,
  .meds-mock div,
  .today-med-item {
    grid-template-columns: 1fr;
  }

  .trend-panel,
  .trend-insights {
    padding: 14px;
  }

  .trend-range-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-stats {
    grid-template-columns: 1fr;
  }

  .trend-chart-shell {
    min-height: 250px;
    padding: 8px;
  }

  .today-med-status {
    justify-self: start;
  }

  .today-med-actions {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .today-dose-button {
    justify-content: center;
    width: 100%;
  }

  .today-med-menu-popover {
    left: 0;
    right: auto;
  }

  .field-row,
  .export-dialog-grid,
  .inline-add-fields,
  .meds-plan-editor-row,
  .settings-row,
  .settings-row.caregiver-row,
  .settings-row.sheet-settings-row,
  .settings-row.ai-settings-row {
    grid-template-columns: 1fr;
  }

  .meds-plan-actions,
  .meds-plan-card-actions,
  .meds-plan-card-summary,
  .meds-plan-summary-actions,
  .meds-plan-group-heading,
  .meds-plan-modal-item {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .meds-plan-summary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meds-plan-notes-field {
    grid-column: 1;
  }

  .picker-popover,
  #datePicker,
  #timePicker {
    left: 18px;
    max-width: none;
    right: 18px;
    top: 250px;
    width: auto;
  }

  .topbar {
    align-items: flex-start;
  }

  h2 {
    font-size: 1.72rem;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: #ffffff;
  }

  body > *:not(.pdf-print-area),
  .pdf-dialog {
    display: none !important;
  }

  .pdf-print-area {
    display: block;
  }

  .pdf-page {
    box-shadow: none;
    margin: 0;
    min-height: auto;
    padding: 0;
    width: auto;
  }
}
