:root {
  --primary-color: #0d9488;
  --accent-color: #14b8a6;
  --button-bg: #0d9488;
  --primary: #0d9488;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;
  --primary-glow: rgba(13, 148, 136, 0.28);
  --accent: #14b8a6;
  --accent-dark: #115e59;
  --accent-soft: #ccfbf1;
  --chart-primary-fill: rgba(13, 148, 136, 0.14);
  --chart-primary-bar-fill: rgba(13, 148, 136, 0.78);
  --chart-accent-end: #14b8a6;

  --bg: #f6f8fb;
  --bg-deep: #eaf1f5;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #dbe5ea;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --success-border: #a7f3d0;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;
  --warning-border: #fde68a;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --danger-border: #fecaca;
  --sync-bg: #dcfce7;
  --sync-text: #166534;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 18px -8px rgba(15, 23, 42, 0.18), 0 4px 8px -4px rgba(15, 23, 42, 0.08);
  --shadow-primary: 0 6px 12px -2px rgba(13, 148, 136, 0.28);

  --radius-lg: 12px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --ease: 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(246, 248, 251, 0.94) 36%, var(--bg) 100%);
  color: var(--text-secondary);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  transition: all var(--ease);
}

button:focus-visible,
.file-import-control:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.header-content,
.container {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 0;
}

.header-main-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 1 auto;
  min-width: 0;
  gap: 10px;
}

.header-controls {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.profile-switcher {
  position: absolute;
  top: 32px;
  right: clamp(18px, 3.5vw, 64px);
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 6px;
}

.profile-menu-toggle,
.profile-new-btn {
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.profile-dropdown {
  position: relative;
}

.native-profile-selector {
  display: none !important;
}

.profile-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 172px;
  cursor: pointer;
  padding: 0 12px 0 16px;
}

.profile-menu-toggle span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  width: 220px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-hover);
  padding: 6px;
}

.profile-menu-row {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 4px;
  border-radius: 12px;
}

.profile-option-btn,
.profile-delete-btn {
  min-height: 34px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.profile-option-btn {
  overflow: hidden;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-option-btn:hover,
.profile-option-btn.is-active {
  background: var(--primary-soft);
  color: var(--text-main);
}

.profile-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #dc2626;
  font-size: 15px;
  font-weight: 900;
}

.profile-delete-btn:hover:not(:disabled) {
  background: #fee2e2;
  color: #991b1b;
}

.profile-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.profile-new-btn {
  cursor: pointer;
  width: 172px;
  padding: 0 14px;
}

.profile-new-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-deep);
  color: var(--text-main);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.profile-menu-toggle:focus-visible,
.profile-option-btn:focus-visible,
.profile-delete-btn:focus-visible,
.profile-new-btn:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-md);
}

.accent-theme-picker {
  position: relative;
}

.accent-theme-btn,
.utility-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 0 14px;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.utility-pill-btn {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.accent-theme-btn:hover,
.utility-pill-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-deep);
  color: var(--text-main);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.utility-pill-btn:hover {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #ffffff;
}

.palette-icon {
  width: 17px;
  height: 17px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background:
    conic-gradient(from 45deg, #0d9488 0 25%, #2563eb 0 50%, #7c3aed 0 75%, #475569 0 100%);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.accent-theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: flex;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  padding: 9px;
  box-shadow: var(--shadow-hover);
  backdrop-filter: blur(14px);
}

.accent-theme-menu[hidden] {
  display: none;
}

.accent-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  padding: 0;
}

.accent-swatch:hover {
  transform: translateY(-1px) scale(1.04);
}

.accent-swatch.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px var(--primary);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 260px;
  flex: 1 1 280px;
  gap: 14px;
}

.logo-badge {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-glow);
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #eefdfa);
  box-shadow: var(--shadow-md);
}

.logo-badge span {
  width: 18px;
  height: 18px;
  border: 4px solid var(--primary);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #ffffff;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 3px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.app-title {
  margin: 0;
  color: var(--text-main);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.app-subtitle {
  max-width: 520px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}

nav {
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-md);
}

nav button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 15px;
  transition: all var(--ease);
  white-space: nowrap;
}

nav button:hover {
  color: var(--text-main);
  background: var(--bg-deep);
  transform: translateY(-1px);
}

nav button.active-nav {
  color: #ffffff;
  background: var(--primary);
  box-shadow: var(--shadow-primary);
}

.container {
  padding: 34px 0 54px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  color: var(--text-main);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.08;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card h3,
.insight-panel h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.card-description {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--button-bg);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 18px;
  box-shadow: none;
  transition: all var(--ease);
}

.primary-btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

.pill-btn.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--button-bg);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  margin-top: 18px;
  padding: 12px 18px;
  box-shadow: var(--shadow-primary);
}

.pill-btn.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 9px 14px;
  text-decoration: none;
  transition: all var(--ease);
  white-space: nowrap;
}

.secondary-btn:hover,
.file-import-control:hover {
  border-color: var(--border-strong);
  background: var(--border);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 112px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 0 14px;
  box-shadow: var(--shadow-md);
  transition: all var(--ease);
  white-space: nowrap;
}

.theme-toggle-btn span {
  font-size: 15px;
  line-height: 1;
}

.theme-toggle-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-deep);
  color: var(--text-main);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.file-import-control {
  margin: 0;
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--danger-border);
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  padding: 9px 14px;
  transition: all var(--ease);
  white-space: nowrap;
}

.danger-btn:hover {
  border-color: #fb7185;
  background: #ffe4e6;
  box-shadow: 0 12px 24px -20px rgba(190, 18, 60, 0.7);
  transform: translateY(-1px);
}

.compact-btn {
  width: auto;
  min-height: 38px;
  border-radius: 999px;
  padding: 9px 16px;
  white-space: nowrap;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dashboard-action-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dashboard-action-group > * {
  flex: 0 0 auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.36);
  padding: 22px;
  backdrop-filter: blur(10px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
}

.modal-backdrop.is-open,
.modal-overlay.is-open {
  display: flex;
}

.cloud-modal,
.modal-card {
  width: min(100%, 680px);
  max-height: min(92vh, 820px);
  overflow: auto;
  padding: 24px;
}

.how-to-modal-card {
  width: min(100%, 620px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 28px;
  font-weight: 850;
  line-height: 1.1;
}

.modal-close-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: all var(--ease);
}

.modal-close-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
  transform: translateY(-1px);
}

.sync-status-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 16px;
  padding: 7px 11px;
  transition: all var(--ease);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-cloud {
  background: var(--sync-text);
  box-shadow: 0 0 0 4px rgba(22, 101, 52, 0.12);
}

.status-local {
  background: var(--warning-text);
  box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.12);
}

.sync-status-row:has(.status-cloud) {
  border-color: #bbf7d0;
  background: var(--sync-bg);
  color: var(--sync-text);
}

.cloud-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 18px 0;
}

.cloud-section h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 17px;
  font-weight: 850;
}

.cloud-section .card-description {
  margin-top: 5px;
}

.sync-key-row,
.link-device-row,
.cloud-export-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.cloud-export-actions {
  flex-wrap: nowrap;
}

.cloud-export-actions .secondary-btn,
.cloud-export-actions .primary-btn {
  min-width: 142px;
}

.sync-key-row code {
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 15px;
  font-weight: 850;
  padding: 9px 11px;
}

.link-device-row input {
  width: 160px;
  min-height: 38px;
  text-transform: uppercase;
}

.danger-section {
  border-bottom: 1px solid var(--border);
}

.how-to-step-list {
  display: grid;
  gap: 14px;
}

.how-to-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.how-to-step-number {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.how-to-step h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 17px;
  font-weight: 850;
}

.how-to-step p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
}

#tourBackdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(10, 15, 29, 0.28);
}

#tourBackdrop[hidden],
#tourTopBar[hidden],
.tour-callout[hidden] {
  display: none !important;
}

.tour-active-target {
  position: relative !important;
  z-index: 9995 !important;
  border-radius: 12px;
  isolation: isolate;
  background-color: var(--surface) !important;
  box-shadow: 0 0 0 4px var(--accent-color, #2563eb), 0 0 38px rgba(37, 99, 235, 0.58) !important;
  transition: all 0.3s ease-in-out;
}

.tour-active-target label,
.tour-active-target .field-helper,
.tour-active-target .card-description,
.tour-active-target .voice-intake-status,
.tour-active-target .medication-history-item p {
  color: var(--text-secondary) !important;
}

.tour-active-target h3,
.tour-active-target h4 {
  color: var(--text-main) !important;
}

.tour-active-target input[type="text"],
.tour-active-target input[type="date"],
.tour-active-target input[type="datetime-local"],
.tour-active-target textarea,
.tour-active-target select,
.tour-active-target .voice-intake-btn,
.tour-active-target .body-region-pill,
.tour-active-target .tag-item label,
.tour-active-target .medication-history-list,
.tour-active-target .medication-history-item {
  border-color: color-mix(in srgb, var(--accent-color, #2563eb) 34%, var(--border-strong) 66%) !important;
  background-color: color-mix(in srgb, var(--surface-muted) 72%, var(--surface) 28%) !important;
  color: var(--text-main) !important;
}

.tour-active-target input[type="text"]::placeholder,
.tour-active-target textarea::placeholder {
  color: color-mix(in srgb, var(--text-secondary) 78%, var(--text-main) 22%) !important;
}

.tour-active-target .body-region-pill:hover,
.tour-active-target .tag-item label:hover,
.tour-active-target .voice-intake-btn:hover {
  border-color: var(--accent-color, #2563eb) !important;
  background-color: var(--primary-soft) !important;
}

.tour-elevated-ancestor {
  position: relative !important;
  z-index: 9994 !important;
}

body.walkthrough-cloud-sync-open #cloudSyncModal.is-open {
  z-index: 9996;
  background: rgba(10, 15, 29, 0.34);
}

body.walkthrough-cloud-sync-open #cloudSyncModal .cloud-modal {
  position: relative;
  z-index: 9997;
}

#tourTopBar {
  position: fixed;
  bottom: 32px;
  left: 50%;
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 32px), 760px);
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 10px 12px 10px 18px;
  box-shadow: 0 20px 45px rgba(2, 6, 23, 0.34);
  transform: translateX(-50%);
}

.tour-top-bar-title {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tour-top-bar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.tour-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  padding: 7px 12px;
  white-space: nowrap;
}

.tour-next-btn {
  background: var(--accent-color, #2563eb);
  color: #ffffff;
}

.tour-next-btn:hover {
  background: var(--primary-dark);
}

.tour-exit-btn {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.tour-exit-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.tour-callout {
  position: fixed;
  z-index: 10000;
  width: min(340px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-secondary);
  padding: 18px;
  box-shadow: 0 22px 50px rgba(2, 6, 23, 0.34);
}

.tour-callout-location {
  margin: 0 0 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.35;
  padding-bottom: 10px;
}

.tour-callout-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  text-transform: uppercase;
}

.tour-callout h3 {
  margin: 12px 0 7px;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.2;
}

.tour-callout p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}


.stats-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-box {
  min-height: 148px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #fbfefe 100%);
  padding: 22px;
  box-shadow: var(--shadow-md);
  transition: all var(--ease);
}

.stat-box::after {
  content: none;
}

.stat-box:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.stat-box small {
  display: block;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.stat-box h2 {
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text-main);
  font-size: clamp(27px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.05;
}

.stat-box p {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.history-card,
.form-card,
.report-card,
.chart-card,
.pattern-card,
.appointment-card,
.medication-history-card,
.timeline-panel {
  padding: 24px;
}

.pattern-card {
  margin-bottom: 18px;
}

.report-pattern-card {
  max-width: 860px;
}

.chart-card {
  min-width: 0;
}

.impact-chart-card {
  margin-bottom: 18px;
}

.impact-chart-frame {
  min-height: 320px;
}

.chart-frame {
  position: relative;
  min-height: 280px;
}

.chart-frame canvas {
  width: 100% !important;
  height: 280px !important;
}

.impact-chart-frame canvas {
  height: 320px !important;
}

.compact-chart-card {
  min-height: 100%;
}

.donut-chart-frame {
  min-height: 260px;
}

.donut-chart-frame canvas {
  height: 260px !important;
}

.entry-feed {
  display: grid;
  gap: 10px;
}

.insight-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #fbfefe 100%);
  box-shadow: var(--shadow-md);
  padding: 22px;
}

.insight-panel p:not(.eyebrow) {
  margin: 12px 0 18px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}

.signal-list {
  display: grid;
  gap: 9px;
}

.signal-list span {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
}

.pattern-insights {
  display: grid;
  gap: 10px;
}

.pattern-insight {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
}

.pattern-insight p {
  margin: 5px 0 4px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.pattern-insight small {
  display: block;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 650;
}

.pattern-stat {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.pattern-icon {
  width: 30px;
  height: 30px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--primary-soft);
  position: relative;
}

.pattern-icon::before,
.pattern-icon::after {
  content: "";
  position: absolute;
  background: var(--primary);
}

.pattern-icon::before {
  width: 12px;
  height: 2px;
  top: 14px;
  left: 8px;
  transform: rotate(-35deg);
}

.pattern-icon::after {
  width: 7px;
  height: 7px;
  top: 8px;
  right: 7px;
  border-radius: 50%;
}

.pattern-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  text-transform: uppercase;
}

.pattern-urgent {
  border-left-color: var(--danger-text);
  background: var(--danger-bg);
}

.pattern-urgent .pattern-icon,
.pattern-urgent .pattern-tag {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.pattern-urgent .pattern-icon::before,
.pattern-urgent .pattern-icon::after {
  background: var(--danger-text);
}

.pattern-cluster {
  border-left-color: #0f766e;
}

.pattern-temporal {
  border-left-color: var(--warning-text);
}

.pattern-temporal .pattern-icon,
.pattern-temporal .pattern-tag {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.pattern-temporal .pattern-icon::before,
.pattern-temporal .pattern-icon::after {
  background: var(--warning-text);
}

.safety-disclaimer,
.report-disclaimer {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
  padding: 14px 16px;
}

.safety-disclaimer {
  margin-top: 22px;
}

.report-disclaimer {
  margin-top: 18px;
}

.safety-disclaimer strong,
.report-disclaimer strong {
  color: var(--text-secondary);
}

.form-card {
  width: 100%;
  max-width: 1100px;
  margin-right: auto;
  margin-left: auto;
}

#logView,
#medications-tab {
  width: min(calc(100vw - 32px), 1100px);
  margin-right: auto;
  margin-left: 50%;
  transform: translateX(-50%);
}

.intake-toggle {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface) 58%);
  margin: 0 0 22px;
  padding: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), var(--shadow-sm);
}

.intake-toggle button {
  appearance: none;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent !important;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 9px 16px;
  white-space: nowrap;
}

.intake-toggle button:hover {
  border-color: var(--border);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.62) !important;
}

.intake-toggle button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.form-group {
  margin-bottom: 22px;
}

.clinical-field-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.clinical-field-row .form-group {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.field-helper {
  max-width: 640px;
  margin: -2px 0 10px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
}

input[type="text"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 14.5px;
  font-weight: 600;
  outline: none;
  padding: 12px 14px;
  transition: all var(--ease);
}

input[type="text"]::placeholder {
  color: var(--text-faint);
  font-weight: 500;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
  min-height: 116px;
  resize: vertical;
}

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

.voice-intake-btn {
  min-width: 128px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #ffffff;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  padding: 0 14px;
  white-space: nowrap;
}

.voice-intake-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.voice-intake-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.voice-intake-btn.is-listening {
  border-color: #ef4444;
  background: #fef2f2;
  color: #991b1b;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.voice-intake-btn.has-error {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.voice-intake-icon {
  position: relative;
  width: 13px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.voice-intake-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 7px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.voice-intake-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 2px;
  height: 5px;
  background: currentColor;
  transform: translateX(-50%);
}

.voice-intake-status {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.voice-intake-status.is-listening {
  color: #991b1b;
}

.voice-intake-status.has-error {
  color: var(--warning-text);
}

.checkin-trigger-btn {
  min-width: 190px;
}

.timeline-checkin-actions {
  display: flex;
  min-width: min(100%, 280px);
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.checkin-modal-card {
  width: min(100%, 760px);
}

.checkin-close-btn {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.checkin-status-grid {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.checkin-state-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  padding: 6px 10px;
}

.checkin-state-pill.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.checkin-state-pill.is-recording::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  animation: checkinPulse 1.1s ease-out infinite;
}

@keyframes checkinPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(239, 68, 68, 0);
  }
}

.checkin-conversation-panel,
.checkin-confirmation-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 16px;
  margin-bottom: 16px;
}

.checkin-prompt {
  color: var(--text-main);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
}

.checkin-transcript {
  min-height: 28px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 650;
  padding-top: 12px;
}

.checkin-parsed-summary {
  display: grid;
  gap: 8px;
}

.checkin-parsed-summary p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 650;
}

.checkin-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.55fr);
  gap: 10px;
  margin-top: 14px;
}

.checkin-large-btn {
  min-height: 52px;
  flex: 1 1 150px;
  justify-content: center;
  text-align: center;
}

.checkin-main-voice-btn.is-recording {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.checkin-voice-select-control {
  min-height: 52px;
  display: grid;
  gap: 4px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 7px 10px;
}

.checkin-voice-select-control span {
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.checkin-voice-select-control select {
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 800;
  padding: 0;
}

.checkin-voice-select-control select:focus {
  box-shadow: none;
}

.checkin-good-day-btn {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.checkin-good-day-btn:hover {
  border-color: #34d399;
  background: #d1fae5;
  color: #064e3b;
}

.checkin-fallback-field {
  margin-bottom: 14px;
}

.checkin-privacy-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 650;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.slider-header label {
  margin-bottom: 0;
}

.severity-badge {
  flex: 0 0 auto;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 11px;
}

.high-severity-advisory {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
  color: #7f1d1d;
  box-shadow: 0 12px 28px -24px rgba(127, 29, 29, 0.45);
}

.high-severity-advisory[hidden] {
  display: none !important;
}

.high-severity-advisory-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  font-size: 1rem;
  line-height: 1;
}

.high-severity-advisory-content {
  min-width: 0;
  flex: 1;
}

.high-severity-advisory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.high-severity-advisory strong {
  color: #dc2626;
  font-size: 0.88rem;
  letter-spacing: 0;
}

.high-severity-advisory p {
  margin: 0;
  color: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
}

.high-severity-ack-btn {
  border: 1px solid rgba(220, 38, 38, 0.34);
  background: rgba(255, 255, 255, 0.76);
  color: #991b1b;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.high-severity-ack-btn:hover {
  background: rgba(254, 226, 226, 0.94);
}

input[type="range"] {
  width: 100%;
  height: 8px;
  margin: 8px 0 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, #bfdbfe, var(--primary));
  cursor: pointer;
}

input[type="range"]:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  appearance: none;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.34);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.34);
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.body-region-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.body-region-pill {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  padding: 8px 13px;
  transition: all var(--ease);
}

.body-region-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-muted);
  transform: translateY(-1px);
}

.body-region-pill.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 8px 18px -15px var(--primary);
}

.body-region-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.relief-grid {
  margin-bottom: 10px;
}

.field-subheading {
  margin: 0;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 850;
}

.inline-note-input {
  margin-top: 2px;
}

.tag-item {
  position: relative;
}

.tag-item input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tag-item label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  padding: 8px 13px;
  user-select: none;
  transition: all var(--ease);
}

.tag-item label:hover {
  border-color: var(--border-strong);
  background: var(--surface-muted);
  transform: translateY(-1px);
}

.tag-item input[type="checkbox"]:checked + label {
  border-color: #93c5fd;
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 8px 18px -15px rgba(37, 99, 235, 0.8);
}

.tag-item input[type="checkbox"]:focus-visible + label {
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.entry-item {
  display: grid;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  padding: 16px;
  transition: all var(--ease);
}

.entry-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.entry-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.log-type-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 1;
  margin-right: 7px;
  padding: 4px 7px;
  text-transform: uppercase;
  vertical-align: middle;
}

.source-log-type-tag {
  margin-left: -2px;
}

.log-type-symptom,
.log-type-injury {
  border-color: #fed7aa;
  background: #ffedd5;
  color: #9a3412;
}

.log-type-medication {
  border-color: #a5f3fc;
  background: #cffafe;
  color: #155e75;
}

.log-type-check-in {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.entry-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.delete-entry-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  transition: all var(--ease);
}

.delete-entry-btn:hover,
.delete-entry-btn:focus-visible {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  outline: none;
}

.entry-meta {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 650;
}

.entry-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tab-view {
  display: none;
}

.tab-view.active-view {
  display: block;
}

.timeline-heading {
  margin-bottom: 20px;
}

.appointment-card {
  display: grid;
  gap: 22px;
  margin-bottom: 22px;
}

.appointment-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: start;
}

.appointment-active-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--primary-glow);
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--text-secondary);
  padding: 16px;
}

.appointment-active-card[hidden] {
  display: none;
}

.appointment-active-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.appointment-provider {
  margin: 0;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.25;
}

.appointment-date {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.appointment-focus {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  padding: 5px 10px;
  white-space: nowrap;
}

.appointment-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1fr) minmax(240px, 1.45fr) auto;
  gap: 14px;
  align-items: end;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.appointment-form .form-group {
  margin-bottom: 0;
}

.timeline-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.timeline-stream-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.timeline-stream-header h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 19px;
  font-weight: 850;
  line-height: 1.2;
}

.timeline-stream {
  position: relative;
  display: grid;
  gap: 16px;
}

.timeline-stream.has-items::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 13px;
  width: 2px;
  background: var(--border-strong);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 16px;
}

.timeline-node {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border: 5px solid #ffffff;
  border-radius: 50%;
  background: var(--timeline-color, var(--severity-color));
  box-shadow: 0 0 0 1px var(--border-strong);
}

.timeline-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.timeline-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.timeline-time {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 750;
  white-space: nowrap;
}

.timeline-symptom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.25;
}

.timeline-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.checkin-confirm-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  font-weight: 800;
}

.checkin-confirm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.checkin-confirm-btn:focus-visible,
.checkin-main-voice-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}

.checkin-review-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.timeline-heading-group {
  min-width: 0;
}

.timeline-card .log-type-tag {
  margin: 0 0 8px;
}

.timeline-card .timeline-symptom {
  display: block;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.timeline-card > .severity-pill {
  justify-self: start;
}

.timeline-checkin-item .timeline-card {
  border-left: 3px solid var(--primary);
}

.medication-clinical-entry {
  border-left: 3px solid #06b6d4;
}

.medication-clinical-entry .timeline-metadata,
.medication-clinical-entry .timeline-notes-block {
  margin-top: 12px;
}

.timeline-metadata {
  display: grid;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.timeline-metadata > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.timeline-metadata dt,
.timeline-field-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.timeline-metadata dd {
  flex: 1 1 140px;
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.timeline-notes-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-muted);
}

.timeline-notes-body {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline-notes {
  margin: 0;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  padding-top: 11px;
}

.severity-pill,
.factor-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
}

.severity-pill {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 850;
  padding: 4px 10px;
}

.severity-low {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.severity-resolved {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.severity-medication {
  border-color: #a5f3fc;
  background: #cffafe;
  color: #155e75;
}

.severity-mid {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.severity-high {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.factor-badge {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

.empty-state {
  margin: 0;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 650;
  padding: 26px 18px;
  text-align: center;
}

.empty-state.compact {
  padding: 18px;
}

.report-card {
  max-width: none;
}

#reportOutput {
  color: var(--text-secondary);
  font-size: 14px;
}

#reportOutput h4 {
  letter-spacing: 0;
}

#reportOutput strong {
  color: var(--text-main);
}

#reportOutput em {
  color: var(--primary);
  font-style: normal;
  font-weight: 800;
}

.clinical-brief {
  display: grid;
  gap: 14px;
}

.brief-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 14px;
}

.brief-header h4 {
  margin: 0;
  color: var(--text-main);
  font-size: 21px;
  font-weight: 850;
  line-height: 1.2;
}

.brief-period {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.brief-print-btn {
  width: auto;
  min-width: 220px;
}

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

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

.brief-metadata-grid div {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  padding: 9px 12px;
}

.brief-metadata-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.brief-metadata-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.brief-metric {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 14px;
}

.brief-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brief-metric strong {
  display: block;
  margin-top: 7px;
  color: var(--text-main);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.1;
}

.brief-metric small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.brief-key-card,
.brief-hpi-card,
.brief-summary-card,
.brief-episodes {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  padding: 16px;
}

.brief-hpi-card {
  border-color: var(--border-strong);
  border-left: 5px solid var(--text-main);
  background: #f8fafc;
}

.brief-key-card {
  border-left: 4px solid var(--primary);
  background: #ffffff;
}

.brief-correlation-card {
  border-left-color: var(--primary);
}

.brief-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.brief-section-title {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brief-hpi-card h5 {
  margin: 0 0 12px;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.2;
}

.brief-hpi-card p,
.brief-summary-card p {
  margin: 0;
  line-height: 1.6;
}

.brief-hpi-card p + p {
  margin-top: 12px;
}

.brief-key-list,
.brief-episode-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.temporal-pattern-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 850;
  padding: 5px 10px;
  white-space: nowrap;
}

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

.correlation-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.correlation-insight-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.correlation-insight-card h4 {
  margin: 5px 0 0;
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.25;
}

.correlation-insight-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.correlation-insight-tag {
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.temporal-insight-card {
  border-left: 4px solid var(--primary);
}

.medication-response-card {
  border-left: 4px solid #06b6d4;
}

.medications-layout {
  display: grid;
  grid-template-columns: minmax(0, 1100px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

#medications-tab .form-card,
.medication-history-card {
  width: 100%;
  max-width: 1100px;
  margin-right: auto;
  margin-left: auto;
}

.medication-history-list {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 20px;
}

.medication-history-card .card-header {
  margin-bottom: 24px;
}

.medication-history-card .card-description {
  margin-top: 9px;
}

.medication-history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.medication-history-main {
  min-width: 0;
}

.medication-history-item h4 {
  margin: 0;
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.25;
}

.medication-history-item p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.medication-history-notes {
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
  line-height: 1.45;
}

.medication-history-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding-left: 8px;
}

.medication-link-chip {
  background: rgba(6, 182, 212, 0.1);
  color: #0891b2;
}

.medication-delete-btn {
  border: 0;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 2px;
}

.medication-delete-btn:hover,
.medication-delete-btn:focus-visible {
  opacity: 0.78;
  text-decoration: underline;
}

.timeline-medication-item .timeline-card {
  border-left: 4px solid #06b6d4;
}

.brief-table-wrap {
  overflow-x: auto;
}

.brief-correlation-table,
.brief-episode-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.35;
}

.brief-correlation-table th,
.brief-correlation-table td,
.brief-episode-table th,
.brief-episode-table td {
  border: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.brief-correlation-table th,
.brief-episode-table th {
  background: var(--surface-muted);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-correlation-table td:first-child,
.brief-episode-table td:nth-child(2) {
  color: var(--text-main);
  font-weight: 800;
}

.brief-episode-table td:first-child {
  min-width: 96px;
  color: var(--text-main);
  font-weight: 850;
  white-space: nowrap;
}

.brief-episode-table td:first-child span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 750;
}

.brief-episode-table .severity-pill {
  justify-content: center;
  min-width: 52px;
}

.compact-correlation-table {
  font-size: 12px;
}

.brief-key-list li,
.brief-episode-list li {
  border-bottom: 1px dashed var(--border);
  padding-bottom: 10px;
}

.brief-key-list li:last-child,
.brief-episode-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.brief-key-list strong,
.brief-episode-list strong {
  display: block;
  margin-bottom: 3px;
}

.brief-key-list span,
.brief-episode-list span {
  display: block;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.45;
}

.brief-signoff {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 4px;
  border-top: 1px solid var(--border-strong);
  color: var(--text-secondary);
  opacity: 1;
  font-size: 12px;
  font-weight: 700;
  padding-top: 10px;
}

.brief-signoff span {
  flex: 1 1 0;
}

body.dark-theme {
  --bg: #0b0f19;
  --bg-deep: #0f172a;
  --surface: #1e293b;
  --surface-muted: #0f172a;
  --border: #334155;
  --border-strong: #475569;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 14px 24px -12px rgba(0, 0, 0, 0.55), 0 6px 10px -6px rgba(0, 0, 0, 0.42);

  background: linear-gradient(180deg, #101827 0%, #0b0f19 100%);
  color: var(--text-secondary);
}

body.dark-theme .app-header {
  border-bottom-color: var(--border);
  background: rgba(30, 41, 59, 0.92);
}

body.dark-theme nav,
body.dark-theme .card,
body.dark-theme .cloud-modal,
body.dark-theme .stat-box,
body.dark-theme .insight-panel,
body.dark-theme .entry-item,
body.dark-theme .timeline-panel,
body.dark-theme .timeline-card,
body.dark-theme .medication-history-item,
body.dark-theme .brief-key-card,
body.dark-theme .brief-hpi-card,
body.dark-theme .brief-summary-card,
body.dark-theme .brief-episodes,
body.dark-theme .brief-metric,
body.dark-theme .correlation-insight-card,
body.dark-theme .safety-disclaimer,
body.dark-theme .report-disclaimer,
body.dark-theme .pattern-insight,
body.dark-theme .logo-badge {
  border-color: var(--border);
  background: #1e293b;
  box-shadow: var(--shadow-md);
}

body.dark-theme .secondary-btn,
body.dark-theme .accent-theme-btn,
body.dark-theme .profile-menu-toggle,
body.dark-theme .profile-new-btn,
body.dark-theme .theme-toggle-btn {
  border-color: #475569;
  background: #334155;
  color: #f8fafc;
}

body.dark-theme .secondary-btn:hover,
body.dark-theme .accent-theme-btn:hover,
body.dark-theme .profile-menu-toggle:hover,
body.dark-theme .profile-new-btn:hover,
body.dark-theme .theme-toggle-btn:hover,
body.dark-theme .file-import-control:hover {
  border-color: #64748b;
  background: #475569;
  color: #ffffff;
}

body.dark-theme .profile-menu {
  border-color: #475569;
  background: rgba(30, 41, 59, 0.98);
}

body.dark-theme .profile-option-btn {
  color: #e2e8f0;
}

body.dark-theme .profile-option-btn:hover,
body.dark-theme .profile-option-btn.is-active {
  background: rgba(59, 130, 246, 0.24);
  color: #ffffff;
}

body.dark-theme .profile-delete-btn:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.2);
  color: #fecaca;
}

body.dark-theme .utility-pill-btn {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

body.dark-theme .utility-pill-btn:hover {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #ffffff;
}

body.dark-theme .intake-toggle {
  border-color: color-mix(in srgb, var(--primary) 48%, #475569 52%);
  background: color-mix(in srgb, var(--primary-soft) 30%, #0f172a 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow-md);
}

body.dark-theme .intake-toggle button {
  color: var(--text-secondary);
}

body.dark-theme .intake-toggle button:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, #475569 50%);
  background: rgba(15, 23, 42, 0.72) !important;
  color: #ffffff;
}

body.dark-theme .intake-toggle button.is-active {
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  color: #ffffff;
}

body.dark-theme .accent-theme-menu {
  border-color: var(--border);
  background: rgba(15, 23, 42, 0.96);
}

body.dark-theme input[type="text"],
body.dark-theme input[type="date"],
body.dark-theme input[type="datetime-local"],
body.dark-theme textarea,
body.dark-theme select {
  border-color: #334155;
  background: #0f172a;
  color: #f8fafc;
}

body.dark-theme input[type="text"]::placeholder,
body.dark-theme textarea::placeholder {
  color: #64748b;
}

body.dark-theme .high-severity-advisory {
  border-color: rgba(248, 113, 113, 0.46);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  box-shadow: 0 18px 42px -28px rgba(248, 113, 113, 0.48);
}

body.dark-theme .high-severity-advisory-icon {
  background: rgba(248, 113, 113, 0.16);
}

body.dark-theme .high-severity-advisory strong {
  color: #fca5a5;
}

body.dark-theme .high-severity-ack-btn {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(15, 23, 42, 0.72);
  color: #fee2e2;
}

body.dark-theme .high-severity-ack-btn:hover {
  background: rgba(127, 29, 29, 0.42);
}

body.dark-theme input[type="text"]:focus,
body.dark-theme input[type="date"]:focus,
body.dark-theme textarea:focus,
body.dark-theme select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

body.dark-theme .voice-intake-btn {
  border-color: #334155;
  background: #0f172a;
  color: var(--accent-color);
}

body.dark-theme .voice-intake-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: #f8fafc;
}

body.dark-theme .voice-intake-btn.is-listening {
  border-color: rgba(248, 113, 113, 0.62);
  background: rgba(127, 29, 29, 0.34);
  color: #fecaca;
}

body.dark-theme .voice-intake-btn.has-error {
  border-color: rgba(251, 191, 36, 0.48);
  background: rgba(146, 64, 14, 0.22);
  color: #fde68a;
}

body.dark-theme .voice-intake-status.has-error {
  color: #fde68a;
}

body.dark-theme .checkin-state-pill,
body.dark-theme .checkin-conversation-panel,
body.dark-theme .checkin-confirmation-panel {
  border-color: var(--border);
  background: #0f172a;
}

body.dark-theme .checkin-state-pill {
  color: var(--text-secondary);
}

body.dark-theme .checkin-state-pill.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: #f8fafc;
}

body.dark-theme .checkin-prompt {
  color: #f8fafc;
}

body.dark-theme .checkin-transcript {
  border-color: var(--border);
  color: #cbd5e1;
}

body.dark-theme .checkin-parsed-summary p,
body.dark-theme .checkin-privacy-note {
  color: #cbd5e1;
}

body.dark-theme .checkin-voice-select-control {
  border-color: var(--border);
  background: #0f172a;
  color: #cbd5e1;
}

body.dark-theme .checkin-voice-select-control select {
  background: #0f172a;
  color: #f8fafc;
}

body.dark-theme .checkin-good-day-btn {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(6, 95, 70, 0.24);
  color: #bbf7d0;
}

body.dark-theme .checkin-good-day-btn:hover {
  background: rgba(6, 95, 70, 0.36);
  color: #dcfce7;
}

body.dark-theme .severity-resolved {
  border-color: rgba(74, 222, 128, 0.48);
  background: rgba(22, 101, 52, 0.34);
  color: #bbf7d0;
}

body.dark-theme .severity-medication {
  border-color: rgba(34, 211, 238, 0.44);
  background: rgba(8, 145, 178, 0.22);
  color: #a5f3fc;
}

body.dark-theme .log-type-symptom,
body.dark-theme .log-type-injury {
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(146, 64, 14, 0.28);
  color: #fde68a;
}

body.dark-theme .log-type-medication {
  border-color: rgba(34, 211, 238, 0.44);
  background: rgba(8, 145, 178, 0.22);
  color: #a5f3fc;
}

body.dark-theme .log-type-check-in {
  border-color: rgba(74, 222, 128, 0.48);
  background: rgba(22, 101, 52, 0.34);
  color: #bbf7d0;
}

body.dark-theme .tag-item label,
body.dark-theme .body-region-pill,
body.dark-theme .factor-badge,
body.dark-theme .log-type-tag,
body.dark-theme .signal-list span,
body.dark-theme .empty-state,
body.dark-theme .countdown-badge {
  border-color: var(--border);
  background: #0f172a;
  color: var(--text-secondary);
}

body.dark-theme .medication-history-list {
  border-color: var(--border);
  background: #0f172a;
}

body.dark-theme .medication-link-chip {
  border-color: rgba(34, 211, 238, 0.44);
  background: rgba(8, 145, 178, 0.22);
  color: #a5f3fc;
}

body.dark-theme .tag-item label:hover {
  border-color: var(--border-strong);
  background: #1e293b;
}

body.dark-theme .log-type-tag.log-type-symptom,
body.dark-theme .log-type-tag.log-type-injury {
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(146, 64, 14, 0.28);
  color: #fde68a;
}

body.dark-theme .log-type-tag.log-type-medication {
  border-color: rgba(34, 211, 238, 0.44);
  background: rgba(8, 145, 178, 0.22);
  color: #a5f3fc;
}

body.dark-theme .log-type-tag.log-type-check-in {
  border-color: rgba(74, 222, 128, 0.48);
  background: rgba(22, 101, 52, 0.34);
  color: #bbf7d0;
}

body.dark-theme .body-region-pill:hover {
  border-color: var(--border-strong);
  background: #1e293b;
}

body.dark-theme .tag-item input[type="checkbox"]:checked + label,
body.dark-theme .body-region-pill.is-selected,
body.dark-theme .severity-badge,
body.dark-theme .pattern-icon,
body.dark-theme .pattern-tag,
body.dark-theme .sync-key-row code {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: #f8fafc;
}

body.dark-theme .brief-key-card,
body.dark-theme .brief-correlation-table th,
body.dark-theme .brief-episode-table th,
body.dark-theme .temporal-pattern-tag {
  background: #0f172a;
}

body.dark-theme .brief-correlation-table th,
body.dark-theme .brief-correlation-table td,
body.dark-theme .brief-episode-table th,
body.dark-theme .brief-episode-table td {
  border-color: var(--border);
}

body.dark-theme .modal-close-btn {
  border-color: var(--border);
  background: #0f172a;
  color: var(--text-muted);
}

body.dark-theme .modal-close-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
}

body.dark-theme .tour-callout {
  border-color: rgba(148, 163, 184, 0.24);
  background: #111827;
  color: #cbd5e1;
}

body.dark-theme .tour-callout h3 {
  color: #f8fafc;
}

body.dark-theme .tour-callout-location {
  border-color: var(--border);
  color: #f8fafc;
}

body.dark-theme .tour-callout p {
  color: #cbd5e1;
}

body.dark-theme .tour-callout-badge {
  background: var(--primary-soft);
  color: var(--accent-color);
}

body.dark-theme .sync-status-row {
  border-color: #475569;
  background: #334155;
  color: #f8fafc;
}

body.dark-theme .sync-status-row:has(.status-cloud) {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
}

body.dark-theme .appointment-active-card {
  border-color: var(--primary);
  background: var(--primary-soft);
}

body.dark-theme .timeline-node {
  border-color: #1e293b;
  box-shadow: 0 0 0 1px #475569;
}

body.dark-theme .pattern-urgent {
  border-color: var(--danger-border);
  border-left-color: var(--danger-text);
  background: var(--danger-bg);
}

body.dark-theme #reportOutput div[style*="background: #f8fafc"] {
  background: #0f172a !important;
  border-color: #334155 !important;
}

.page-view {
  display: none;
}

.page-view.active-view {
  display: block;
}

@media (max-width: 1180px) {
  .header-main-actions {
    order: 3;
    width: 100%;
    flex: 1 1 100%;
  }

  nav {
    flex: 1 1 auto;
    overflow-x: auto;
  }

  nav button {
    flex: 1 0 auto;
  }

  .header-controls {
    margin-left: auto;
  }

  .profile-switcher {
    top: 18px;
  }
}

@media (max-width: 820px) {
  .header-content {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .header-main-actions {
    align-items: stretch;
  }

  .profile-switcher {
    position: static;
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .profile-dropdown,
  .profile-menu-toggle,
  .profile-new-btn {
    width: 100%;
  }

  #tourTopBar {
    align-items: stretch;
    flex-direction: column;
    border-radius: 16px;
    padding: 12px;
  }

  .tour-top-bar-title {
    white-space: normal;
  }

  .tour-top-bar-actions {
    justify-content: stretch;
  }

  .tour-control-btn {
    flex: 1;
  }

  .brand-lockup {
    padding-right: 0;
  }

  nav button {
    flex: 1;
    padding-inline: 10px;
  }

  .stats-container,
  .analytics-grid,
  .dashboard-grid,
  .appointment-summary,
  .appointment-form,
  .clinical-field-row,
  .medications-layout,
  .brief-metadata-grid,
  .brief-metrics-grid {
    grid-template-columns: 1fr;
  }

  .medication-history-item {
    flex-direction: column;
  }

  .medication-history-actions {
    justify-content: flex-start;
    padding-left: 0;
  }

  .brief-card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .temporal-pattern-tag {
    white-space: normal;
  }

  .brief-header {
    flex-direction: column;
  }

  .appointment-form .compact-btn {
    width: 100%;
  }

  .checkin-status-grid {
    grid-template-columns: 1fr;
  }

  .insight-panel {
    order: -1;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .app-header {
    position: sticky;
    top: 0;
    max-height: none;
    overflow: visible;
  }

  .header-content,
  .container {
    width: min(100% - 18px, 1040px);
  }

  .header-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 0 10px;
  }

  .header-main-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .brand-lockup {
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
    flex: none;
    padding-right: 0;
  }

  .logo-badge {
    width: 42px;
    height: 42px;
  }

  .brand-kicker {
    font-size: 10px;
  }

  .app-title {
    font-size: 22px;
  }

  .app-subtitle {
    max-width: 32ch;
    font-size: 12px;
  }

  .header-controls {
    position: static;
    align-items: stretch;
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .accent-theme-btn,
  .utility-pill-btn,
  .theme-toggle-btn {
    width: 100%;
    min-height: 36px;
    height: 36px;
    flex: none;
    min-width: 0;
    gap: 5px;
    padding: 0 7px;
    font-size: 11px;
    box-shadow: none;
  }

  .palette-icon {
    width: 14px;
    height: 14px;
    border-width: 1px;
  }

  .theme-toggle-btn span {
    font-size: 13px;
  }

  .accent-theme-menu {
    left: 0;
    right: auto;
    border-radius: 14px;
  }

  nav {
    display: grid;
    width: 100%;
    grid-auto-columns: minmax(118px, 1fr);
    grid-auto-flow: column;
    gap: 4px;
    overflow-x: auto;
    border-radius: 16px;
    padding: 4px;
    scrollbar-width: thin;
  }

  .profile-switcher {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .profile-dropdown,
  .profile-menu-toggle,
  .profile-new-btn {
    width: 100%;
    min-height: 36px;
    height: 36px;
    min-width: 0;
    padding: 0 7px;
    font-size: 11px;
    box-shadow: none;
  }

  .profile-menu-toggle {
    max-width: none;
  }

  .profile-menu {
    left: 0;
    right: 0;
    width: 100%;
  }

  nav button {
    min-height: 40px;
    flex: 0 0 auto;
    border-radius: 12px;
    font-size: 12px;
    padding: 8px 11px;
    white-space: nowrap;
  }

  .container {
    padding-top: 18px;
    padding-bottom: 24px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }

  .section-heading h2 {
    font-size: 24px;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .dashboard-actions,
  .dashboard-action-group {
    justify-content: stretch;
    width: 100%;
  }

  .dashboard-action-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .dashboard-actions .secondary-btn,
  .dashboard-actions .file-import-control,
  .dashboard-actions .primary-btn {
    width: 100%;
    min-height: 42px;
    flex: none;
    border-radius: 14px;
    font-size: 12px;
    padding: 9px 10px;
  }

  .stats-container {
    gap: 10px;
    margin-bottom: 12px;
  }

  .stat-box {
    min-height: 112px;
  }

  .stat-box h2 {
    font-size: 25px;
  }

  .analytics-grid,
  .dashboard-grid {
    gap: 12px;
  }

  .intake-toggle {
    display: flex;
    width: 100%;
  }

  .intake-toggle button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 10px;
  }

  .voice-input-row {
    grid-template-columns: 1fr;
  }

  .voice-intake-btn {
    width: 100%;
  }

  .body-region-grid,
  .tag-grid,
  .relief-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  input[type="text"],
  input[type="date"],
  input[type="datetime-local"],
  textarea,
  select {
    min-height: 52px;
    font-size: 16px;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-card,
  .cloud-modal {
    width: 100%;
    max-height: 88vh;
    border-radius: 14px 14px 10px 10px;
  }

  .modal-header h2 {
    font-size: 24px;
  }

  .cloud-modal {
    padding: 18px;
  }

  .cloud-section {
    grid-template-columns: 1fr;
  }

  .sync-key-row,
  .link-device-row,
  .cloud-export-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .link-device-row input,
  .sync-key-row .secondary-btn,
  .cloud-section .secondary-btn,
  .cloud-export-actions .primary-btn,
  .cloud-section .danger-btn {
    width: 100%;
  }

  .compact-btn {
    width: 100%;
  }

  .checkin-action-row {
    flex-direction: column;
  }

  .checkin-large-btn,
  .checkin-trigger-btn {
    width: 100%;
  }

  .high-severity-advisory {
    padding: 12px;
  }

  .high-severity-advisory-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-card,
  .form-card,
  .report-card,
  .chart-card,
  .pattern-card,
  .appointment-card,
  .timeline-panel,
  .insight-panel,
  .stat-box {
    padding: 18px;
  }

  .chart-frame,
  .chart-frame canvas {
    height: 220px !important;
    min-height: 220px;
  }

  .donut-chart-frame,
  .donut-chart-frame canvas {
    height: 230px !important;
    min-height: 230px;
  }

  .impact-chart-frame,
  .impact-chart-frame canvas {
    height: 260px !important;
    min-height: 260px;
  }

  .entry-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .appointment-active-main,
  .timeline-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-time {
    white-space: normal;
  }

  .entry-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .entry-item,
  .timeline-card {
    border-radius: 10px;
    padding: 14px;
  }

  .entry-title,
  .timeline-symptom {
    font-size: 15px;
    line-height: 1.4;
  }

  .timeline-stream {
    padding-left: 14px;
  }

  .timeline-card {
    margin-left: 10px;
  }

  .tour-top-bar-actions,
  .checkin-action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  #tourTopBar {
    left: 10px;
    right: 10px;
    bottom: 12px;
    width: auto;
    transform: none;
  }

  .tour-callout {
    width: calc(100vw - 20px);
    max-height: 58vh;
    overflow: auto;
  }
}

@media (max-width: 390px) {
  .header-content,
  .container {
    width: min(100% - 14px, 1040px);
  }

  .app-title {
    font-size: 20px;
  }

  .app-subtitle {
    display: none;
  }

  nav {
    grid-auto-columns: minmax(104px, 1fr);
  }

  nav button,
  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .file-import-control {
    font-size: 12px;
  }

  .history-card,
  .form-card,
  .report-card,
  .chart-card,
  .pattern-card,
  .appointment-card,
  .timeline-panel,
  .insight-panel,
  .stat-box {
    padding: 14px;
  }

  .header-controls {
    grid-template-columns: 1fr;
  }

  .accent-theme-btn,
  .utility-pill-btn,
  .profile-menu-toggle,
  .profile-new-btn,
  .theme-toggle-btn {
    min-height: 34px;
  }

  .dashboard-action-group {
    grid-template-columns: 1fr;
  }
}
