:root {
  color-scheme: light;
  --symptom: #008f93;
  --symptom-strong: #006b70;
  --symptom-soft: #edf9f8;
  --symptom-action: var(--symptom);
  --symptom-action-active: var(--symptom-strong);
  --on-symptom: #fff;
  --medication: #6657a8;
  --medication-strong: #514484;
  --medication-soft: #f2eff8;
  --medication-action: var(--medication);
  --medication-action-active: var(--medication-strong);
  --on-medication: #fff;
  --ink: #121820;
  --ink-soft: #586172;
  --line: #d6dbe3;
  --paper: #fffefa;
  --paper-transparent: rgb(255 254 250 / 0%);
  --paper-muted: #f4f6f8;
  --surface: var(--paper);
  --surface-muted: var(--paper-muted);
  --input-bg: #fff;
  --input-border: #c7ccd7;
  --control-border-strong: #bcc4d0;
  --segmented-border: #bfc6d2;
  --segmented-divider: #c8ced8;
  --score-divider: #d5d9e1;
  --note-accent: #33405a;
  --note-strong: #26324e;
  --note-soft: #f3f5f8;
  --note-border: #37405a;
  --note-action: #53657a;
  --history-note: #385d9b;
  --nav-bg: rgb(255 255 255 / 96%);
  --danger-bg: #e62932;
  --danger-active-bg: #c91f29;
  --danger-soft: #fff5f5;
  --danger-text: #fff;
  --button-bg: var(--symptom-action);
  --button-hover-bg: #007e82;
  --button-active-bg: var(--symptom-strong);
  --button-text: #fff;
  --divider: var(--line);
  --focus-ring: #5ab9bb;
  --csv-disabled-border: #8bcfcf;
  --health-history-column-bg: rgb(0 143 147 / 5%);
  --health-history-column-header-bg: rgb(0 143 147 / 10%);
  --shadow: rgb(18 24 32 / 6%);
  --bg: var(--paper);
  --text: var(--ink);
  --text-muted: var(--ink-soft);
  --border: var(--line);
  --tap-size: 44px;
  --bottom-nav-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0b0f12;
    --paper-transparent: rgb(11 15 18 / 0%);
    --surface: #171d20;
    --surface-muted: #20282c;
    --ink: #e7ecef;
    --ink-soft: #a7b0b7;
    --line: #344047;
    --symptom: #55c5c7;
    --symptom-strong: #8adadd;
    --symptom-soft: #0e2b2e;
    --symptom-action: #006b70;
    --symptom-action-active: #004f53;
    --medication: #b7a9ec;
    --medication-strong: #d5ccf5;
    --medication-soft: #28223c;
    --medication-action: #6657a8;
    --medication-action-active: #514484;
    --nav-bg: rgb(11 15 18 / 96%);
    --input-bg: #111719;
    --input-border: #46535b;
    --control-border-strong: #56646d;
    --segmented-border: #56646d;
    --segmented-divider: #46535b;
    --score-divider: #3b474f;
    --note-accent: #afc2e1;
    --note-strong: #d6e0f0;
    --note-soft: #1d2530;
    --note-border: #8da0c1;
    --note-action: #53657a;
    --history-note: #9bb8e8;
    --danger-bg: #e46b70;
    --danger-active-bg: #f08287;
    --danger-soft: #2d1719;
    --danger-text: #0b0f12;
    --button-bg: var(--symptom-action);
    --button-hover-bg: #005f64;
    --button-active-bg: #004f53;
    --focus-ring: #72d3d5;
    --csv-disabled-border: #4a8f91;
    --health-history-column-bg: rgb(85 197 199 / 8%);
    --health-history-column-header-bg: rgb(85 197 199 / 12%);
    --shadow: rgb(0 0 0 / 30%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.app-header, main {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2.5vw, 0.72rem);
  padding-bottom: 0;
}

main {
  padding-top: 6px;
}

.brand-logo {
  flex: 0 0 auto;
  width: clamp(56px, 16vw, 68px);
  height: clamp(56px, 16vw, 68px);
}

.brand-logo-mark {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}


.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0 0 0.08rem;
  font-size: clamp(1.5rem, 7vw, 2.25rem);
  line-height: 1.05;
}

.brand-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(0.76rem, 3.2vw, 0.92rem);
  line-height: 1.25;
}

h1, h2, h3 { margin: 0 0 10px; }

p { margin: 0 0 10px; }

.nav-icon-sprite {
  display: none;
}

.section-title-label {
  align-items: center;
  display: inline-flex;
  gap: 0.6rem;
  min-width: 0;
  vertical-align: top;
}

.section-title-icon,
.settings-summary-icon {
  color: color-mix(in srgb, var(--text) 64%, var(--text-muted));
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-title-icon {
  height: 1.05em;
  stroke-width: 1.55;
  width: 1.05em;
}

.section-disclosure > summary .section-title-icon {
  height: 1.15em;
  width: 1.15em;
}

.settings-summary-icon {
  height: 0.95em;
  stroke-width: 1.6;
  width: 0.95em;
}

.settings-disclosure > summary .settings-summary-icon {
  height: 1.05em;
  width: 1.05em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 4px var(--shadow);
  color: var(--text);
  margin: 14px 0;
  padding: 16px;
}

.hidden { display: none; }

.setup-screen {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.setup-screen.hidden { display: none; }

.setup-card {
  display: grid;
  gap: 12px;
  margin: 0;
}

.setup-card p {
  margin-bottom: 0;
}

.setup-confirm-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
  padding: 14px;
}

.setup-restore-path {
  display: grid;
  gap: 8px;
}

.setup-restore-path .error {
  margin: 0;
}

.setup-new-path {
  display: grid;
  gap: 12px;
}

.setup-new-path > h2 {
  margin-bottom: 0;
}

.setup-confirm-section h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.setup-section-description {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 10px;
}

.setup-option-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.setup-option-list li {
  min-width: 0;
}

.setup-medication-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 0.55fr);
  align-items: end;
  gap: 8px 10px;
}

.setup-medication-item .setup-medication-field:first-child {
  grid-column: 1 / -1;
}

.setup-medication-item label {
  font-size: 0.9rem;
  margin: 0 0 4px;
}

.setup-option-list input {
  min-height: 44px;
}

.setup-pain-state-item + .setup-pain-state-item {
  margin-top: 0;
}

@media (max-width: 360px) {
  .setup-medication-item {
    grid-template-columns: 1fr;
  }

  .setup-medication-item .setup-medication-field:first-child {
    grid-column: auto;
  }
}

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

.setup-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.setup-actions button {
  margin-top: 0;
}

.setup-start-button {
  min-height: 54px;
}

.setup-restore-button {
  min-height: 50px;
}

.form-field-label {
  display: block;
  font-weight: 700;
  margin: 12px 0 6px;
}


.form-control-base {
  box-sizing: border-box;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 12px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

.form-control,
.form-control-full {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}

.form-control-compact {
  min-width: 0;
}

.checkbox-control,
.radio-control {
  box-sizing: border-box;
  display: inline-block;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

input[type="date"].form-control,
input[type="date"].form-control-full,
input[type="time"].form-control,
input[type="time"].form-control-full {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}

.form-control-base:focus, .checkbox-control:focus, .radio-control:focus, button:focus-visible, .file-action-label:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.button-base {
  align-items: center;
  border-radius: 12px;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 0.45rem;
  justify-content: center;
  min-height: 48px;
  padding: 12px 14px;
}

.button-type-icon {
  flex: 0 0 auto;
  height: 20px;
  width: 20px;
}

.record-input-section .button-type-icon {
  height: 22px;
  width: 22px;
}

.button-full {
  width: 100%;
}

.record-input-section > .button-full,
.management > .button-full,
.settings-form-actions .button-full,
.health-column-buttons .button-full,
#run-visit-summary {
  margin: 10px 0 0;
}

.button-compact {
  margin: 0;
  min-height: 40px;
  padding: 8px 12px;
  width: auto;
}

.button-icon {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  height: 2rem;
  justify-content: center;
  line-height: 1;
  margin: 0;
  min-height: 2rem;
  min-width: 2rem;
  padding: 0;
  text-align: center;
  width: 2rem;
}

.primary-button {
  background: var(--button-bg);
  border: 0;
  color: var(--button-text);
}

.primary-button:hover {
  background: var(--button-hover-bg, var(--button-bg));
}

.primary-button:disabled {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 1;
}

.primary-button:disabled:hover,
.primary-button:disabled:active {
  background: var(--surface-muted);
}

.primary-button:active { background: var(--button-active-bg); }

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

.danger:active { background: var(--danger-active-bg); }

.secondary-button {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-button:active { background: var(--surface); }

.field-row { margin-bottom: 8px; }

.record-input-section {
  margin-top: 14px;
}

.record-input-section:first-of-type {
  margin-top: 0;
}

.record-input-heading {
  font-size: 1rem;
  margin: 0 0 4px;
}

.supplemental-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 8px 0 14px;
}

.pain-input-grid {
  display: grid;
  grid-template-columns: minmax(6.5rem, 35%) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.pain-input-grid label {
  margin-top: 0;
}

.pain-input-grid .field-row {
  margin-bottom: 0;
  min-width: 0;
}

.note-save-button {
  display: inline-flex;
  margin-top: 10px;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 9rem;
  min-height: 44px;
  padding: 10px 14px;
}

@media (max-width: 360px) {
  .pain-input-grid {
    grid-template-columns: minmax(5.75rem, 34%) minmax(0, 1fr);
  }
}

hr {
  border: 0;
  border-top: 1px solid var(--divider);
  margin: 18px 0;
}

.notice {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-muted);
}

.notice p {
  margin: 0 0 0.75rem;
}

.notice p:last-child {
  margin-bottom: 0;
}

.usage-link-row {
  font-size: 0.92rem;
  margin-top: 1rem;
}

.usage-link-row a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.error { color: var(--danger-bg); font-weight: 700; }
.message { color: var(--text-muted); }

.export-status {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.export-status p { margin-bottom: 4px; }

.toast-feedback {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1000;
  width: min(calc(100% - 2rem), 420px);
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.25);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.toast-feedback[hidden] { display: none; }

.toast-undo-button {
  flex: 0 0 auto;
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: transparent;
  color: var(--button-bg);
  border: 1px solid var(--button-bg);
}

.toast-undo-button:active { background: var(--surface); }

.button-list button { margin-top: 8px; }

.event {
  align-items: flex-start;
  border-top: 1px solid color-mix(in srgb, var(--divider) 70%, transparent);
  display: grid;
  gap: 0.35rem;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  padding: 6px 0;
}

.event:first-child { border-top: 0; }

.event-time {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: nowrap;
}

.event-type {
  align-items: center;
  display: inline-flex;
  line-height: 1.5;
  min-height: 1.5em;
  white-space: nowrap;
}

.event-type-icon {
  height: 18px;
  width: 18px;
}

.event-body {
  color: var(--text);
  font-weight: 400;
  line-height: 1.5;
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-actions {
  align-self: flex-start;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.5rem;
}

.edit-event-button {
  align-self: flex-start;
  flex: 0 0 auto;
  font-size: 1.1rem;
}


.delete-event-button {
  align-self: flex-start;
  flex: 0 0 auto;
  font-size: 1.2rem;
}


.edit-event-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.38);
}

.edit-event-panel[hidden] { display: none; }

.edit-event-form {
  display: grid;
  gap: 0;
  width: min(100%, 420px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.25);
  padding: 0.8rem;
}

.edit-event-form h2 {
  margin-bottom: 0.65rem;
}

.edit-event-section {
  padding: 0;
  margin-bottom: 0.65rem;
}

.edit-event-field-area {
  margin-bottom: 0;
}

.edit-datetime-row {
  display: block;
}

.edit-datetime-field {
  margin-bottom: 0.65rem;
}

.edit-datetime-field:last-child {
  margin-bottom: 0;
}

.edit-event-form label {
  margin: 0 0 0.25rem;
}

.edit-event-form input + label,
.edit-event-form select + label,
.edit-event-form textarea + label {
  margin-top: 0.65rem;
}

.edit-event-form input,
.edit-event-form select {
  min-height: 2.6rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.edit-datetime-field input[type="date"],
.edit-datetime-field input[type="time"] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  font-size: 1rem;
}

.edit-event-form textarea {
  min-height: 4.5rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.edit-event-form .message {
  margin-bottom: 0;
}

.edit-event-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.15rem;
}

.edit-event-actions button { margin-top: 0; }

.last-medication-card {
  padding-top: 10px;
  padding-bottom: 10px;
}

.last-medication-card h2 {
  margin-bottom: 4px;
  font-size: 1.15rem;
}

.last-medication-item {
  padding: 2px 0;
}

.section-disclosure > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 0;
}

.settings-disclosure {
  margin-bottom: 14px;
}

.settings-summary-label {
  align-items: center;
  display: inline-flex;
  gap: 0.45rem;
  min-width: 0;
  vertical-align: top;
}

.settings-disclosure > summary {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  line-height: 1.35;
  padding: 12px;
  overflow-wrap: anywhere;
}

.settings-disclosure > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.settings-disclosure[open] > summary {
  margin-bottom: 14px;
}

.empty { color: var(--text-muted); }

@media (max-width: 430px) {
  .app-header, main { padding-left: 12px; padding-right: 12px; }
  .card { border-radius: 14px; padding: 14px; }
  .card.last-medication-card { padding-top: 10px; padding-bottom: 10px; }
}

.comparison-period-item {
  align-items: flex-start;
  border-top: 1px solid var(--divider);
  display: flex;
  gap: 0.75rem;
  padding: 12px 0;
}

.comparison-period-item:first-child {
  border-top: 0;
}

.comparison-period-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.field-help {
  margin: -2px 0 10px;
}


.checkbox-row {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
  margin: 12px 0 6px;
}

.checkbox-row .checkbox-control {
  flex: 0 0 auto;
  margin: 0;
}

.medication-settings-item,
.pain-state-settings-item {
  align-items: flex-start;
  border-top: 1px solid var(--divider);
  display: flex;
  gap: 0.75rem;
  padding: 12px 0;
}

.medication-settings-item:first-child,
.pain-state-settings-item:first-child {
  border-top: 0;
}

.medication-settings-content,
.pain-state-settings-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-row-actions {
  align-self: flex-start;
  display: grid;
  flex: 0 0 auto;
  gap: 0;
  grid-auto-columns: var(--tap-size);
  grid-auto-flow: column;
}

.visit-summary-card > .section-disclosure > summary {
  font-size: 1.1rem;
}

.result-actions {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 8px 0 12px;
}

.result-actions[hidden] {
  display: none;
}

.result-actions button {
  margin: 0;
  min-height: 44px;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.result-print-action {
  grid-column: 1 / -1;
}

.print-only {
  display: none;
}

.summary-end-mode {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 12px 0 8px;
  padding: 8px 12px 10px;
}

.summary-end-mode legend {
  font-weight: 700;
  padding: 0 4px;
}

.radio-row {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
  margin: 8px 12px 0 0;
}

.radio-row .radio-control {
  flex: 0 0 auto;
  margin: 0;
}

.visit-summary-result-block {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
  padding: 12px;
}

.visit-summary-result-block h3 {
  border-top: 1px solid var(--divider);
  margin: 10px 0 0;
  padding-top: 10px;
}

.visit-summary-medication-item {
  padding: 8px 0;
}

.visit-summary-medication-item:last-child {
  padding-bottom: 0;
}

.visit-summary-metric-group {
  display: inline-flex;
  flex-wrap: wrap;
  column-gap: 0.85em;
  row-gap: 0.2em;
  align-items: baseline;
}

.visit-summary-metric {
  white-space: nowrap;
}

.visit-summary-dose-heading {
  display: block;
}

.visit-summary-notice {
  margin: 3px 0 2px;
}

.visit-summary-state-pain-item,
.visit-summary-pain-change-item {
  padding: 6px 0;
}

.visit-summary-dose-pain-item {
  padding: 8px 0;
}

.visit-summary-dose-pain-item > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 0;
}

.visit-summary-dose-pain-row {
  padding: 8px 0 8px 12px;
}


.health-history-card > .section-disclosure > summary {
  font-size: 1.1rem;
}

.health-history-card .visit-summary-result-block h3 {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.file-action-label {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  margin: 8px 0 12px;
  min-height: 44px;
  width: 100%;
}

.health-history-table-wrap {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
}

.health-history-table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  width: max-content;
}

.health-history-table th,
.health-history-table td {
  padding: 4px 6px;
  text-align: left;
  white-space: nowrap;
}

.health-history-table th {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--divider);
  font-weight: 700;
}

.health-history-table th:nth-child(even) {
  background: var(--health-history-column-header-bg);
}

.health-history-table td:nth-child(even) {
  background: var(--health-history-column-bg);
}

@media print {
  body.visit-summary-print-mode,
  body.health-history-print-mode {
    background: #fff !important;
    color: #000 !important;
  }

  body.visit-summary-print-mode .app-header,
  body.health-history-print-mode .app-header,
  body.visit-summary-print-mode #toast-feedback,
  body.health-history-print-mode #toast-feedback,
  body.visit-summary-print-mode #edit-event-panel,
  body.health-history-print-mode #edit-event-panel,
  body.visit-summary-print-mode .result-actions,
  body.health-history-print-mode .result-actions {
    display: none !important;
  }

  body.visit-summary-print-mode main,
  body.health-history-print-mode main {
    margin: 0;
    max-width: none;
    padding: 0;
  }

  body.visit-summary-print-mode .card:not(.visit-summary-card),
  body.health-history-print-mode .card:not(.health-history-card) {
    display: none !important;
  }

  body.visit-summary-print-mode .visit-summary-card,
  body.health-history-print-mode .health-history-card {
    background: #fff !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #000 !important;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  body.visit-summary-print-mode #visit-summary-details > summary,
  body.visit-summary-print-mode #summary-period-picker,
  body.visit-summary-print-mode label[for="summary-start-date"],
  body.visit-summary-print-mode #summary-start-date,
  body.visit-summary-print-mode .summary-end-mode,
  body.visit-summary-print-mode #summary-end-date,
  body.visit-summary-print-mode #run-visit-summary,
  body.visit-summary-print-mode #visit-summary-message,
  body.health-history-print-mode #health-history-details > summary,
  body.health-history-print-mode #health-history-details > p,
  body.health-history-print-mode .file-action-label,
  body.health-history-print-mode #heartwatch-csv-file,
  body.health-history-print-mode #health-history-message,
  body.health-history-print-mode #health-history-columns-panel,
  body.health-history-print-mode #health-history-result .visit-summary-notice,
  body.health-history-print-mode #health-history-result .empty {
    display: none !important;
  }

  body.visit-summary-print-mode .print-only {
    display: block;
  }

  body.visit-summary-print-mode .print-document-title,
  body.health-history-print-mode #health-history-result h3 {
    break-after: avoid;
    color: #000 !important;
  }

  body.visit-summary-print-mode #visit-summary-print-content,
  body.visit-summary-print-mode #visit-summary-result,
  body.health-history-print-mode #health-history-print-content,
  body.health-history-print-mode #health-history-result {
    background: #fff !important;
    color: #000 !important;
    display: block;
    width: 100%;
  }

  body.visit-summary-print-mode .visit-summary-result-block,
  body.health-history-print-mode .visit-summary-result-block {
    background: #fff !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #000 !important;
    margin: 0;
    padding: 0;
  }

  body.visit-summary-print-mode .visit-summary-result-block h3,
  body.visit-summary-print-mode .visit-summary-dose-pain-item > summary {
    break-after: avoid;
  }

  body.visit-summary-print-mode .visit-summary-medication-item,
  body.visit-summary-print-mode .visit-summary-state-pain-item,
  body.visit-summary-print-mode .visit-summary-pain-change-item,
  body.visit-summary-print-mode .visit-summary-dose-pain-row {
    break-inside: avoid;
  }

  body.health-history-print-mode .health-history-table-wrap {
    overflow: visible;
  }

  body.health-history-print-mode .health-history-table {
    color: #000 !important;
    width: 100%;
  }

  body.health-history-print-mode .health-history-table thead {
    display: table-header-group;
  }

  body.health-history-print-mode .health-history-table tr {
    break-inside: avoid;
  }
}

.history-day-summary {
  border-top: 1px solid var(--divider);
  padding: 14px 0;
}

.history-day-summary:first-child {
  border-top: 0;
  padding-top: 2px;
}

.history-day-summary:last-child {
  padding-bottom: 0;
}

.history-day-header {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 6px;
}

.history-day-title {
  font-size: 1.05rem;
  line-height: 1.3;
  margin: 0;
}

.history-detail-button {
  flex: 0 0 auto;
}

.history-summary-row {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 4px 0;
  min-width: 0;
}

.history-summary-icon {
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.history-summary-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-day-detail {
  margin-top: 10px;
}


.history-range-label {
  color: #5f6f89;
  font-size: 0.92rem;
  margin: 0;
}

.history-navigation {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.history-copy-button-row {
  display: flex;
  justify-content: flex-end;
}

.history-copy-button {
  flex: 0 0 auto;
}

.history-navigation-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-nav-button {
  align-self: flex-start;
}

.health-history-columns-panel {
  margin: 12px 0;
}

.health-history-columns-panel > summary {
  min-height: 44px;
}


.health-history-columns-panel[open] > summary {
  margin-bottom: 12px;
}

.health-history-columns-panel details > summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 36px;
  padding: 8px 0;
}

.column-selected-row {
  display: grid;
  gap: 4px;
  padding: 4px 0;
}

.column-selected-row + .column-selected-row {
  margin-top: 3px;
}

.column-selected-name {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.column-selected-controls {
  align-items: center;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.column-short-label {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex: 1 1 auto;
  font-size: 0.78rem;
  font-weight: 400;
  gap: 5px;
  line-height: 1.2;
  margin: 0;
  min-height: 30px;
  min-width: 0;
  white-space: nowrap;
}

.column-short-label input {
  color: var(--text);
  flex: 1 1 5.5em;
  font-size: 0.95rem;
  font-weight: 500;
  max-width: 7em;
  min-height: 30px;
  min-width: 0;
  padding: 4px 6px;
}

.column-selected-actions {
  align-items: center;
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  grid-template-columns: repeat(3, 2rem);
}

.column-reorder-button,
.column-remove-button.delete-event-button {
  font-size: 1rem;
}


.fixed-date-column {
  background: transparent;
  border-radius: 0;
  font-weight: 700;
  margin: 4px 0 5px;
  padding: 0;
}

.health-column-add-section {
  border-top: 1px solid var(--divider);
  margin-top: 12px;
  padding-top: 12px;
}

.health-column-add-section h4 {
  margin-top: 0;
}

.health-column-checks {
  display: grid;
  gap: 3px;
  margin: 5px 0 9px;
}

.health-column-check {
  align-items: center;
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  column-gap: 8px;
  font-weight: 400;
  line-height: 1.25;
  margin: 0;
  min-height: 32px;
  padding: 2px 0;
  width: 100%;
}

.health-column-check .checkbox-control {
  height: 1.25rem;
  margin: 0;
  max-width: 1.25rem;
  min-width: 1.25rem;
  width: 1.25rem;
}

.health-column-check span {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.state-column-group {
  display: grid;
  gap: 3px;
  margin: 5px 0 8px;
}

.state-column-name {
  font-weight: 700;
  line-height: 1.25;
}

.state-column-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.state-column-checks .health-column-check {
  min-height: 28px;
  padding: 0;
  width: auto;
}

.health-column-buttons {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

@media (min-width: 520px) {
  .health-column-buttons {
    grid-template-columns: max-content max-content;
  }
}

.settings-list-title {
  margin-top: 14px;
}

.settings-list-block {
  margin-bottom: 10px;
}

.settings-add-button {
  margin: 10px 0 0;
}

.settings-form-panel {
  border-top: 1px solid var(--divider);
  margin-top: 14px;
  padding-top: 12px;
}

.settings-form-panel[hidden],
.settings-add-button[hidden] {
  display: none;
}

.settings-form-title {
  font-size: 1rem;
  margin: 0 0 10px;
}

.settings-form-actions {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

/* Four-screen redesign */

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100%;
}

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

[hidden] {
  display: none !important;
}

.app-header,
main {
  margin: 0 auto;
  padding-left: 18px;
  padding-right: 18px;
  width: min(100%, 720px);
}

.app-header {
  gap: 8px;
  min-height: 54px;
  padding-bottom: 8px;
  padding-top: 14px;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  height: 28px;
  width: 28px;
}

.brand-wordmark {
  color: var(--symptom-strong);
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 0;
}

main {
  padding-bottom: calc(var(--bottom-nav-height) + 24px + env(safe-area-inset-bottom));
  padding-top: 0;
}

#app-screen {
  min-height: calc(100svh - 54px);
}

.app-view {
  animation: app-view-in 140ms ease-out;
  min-width: 0;
}

@keyframes app-view-in {
  from { opacity: 0.4; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-title {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 1.62rem;
  font-weight: 800;
  gap: 10px;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 8px 0 12px;
}

.screen-title-icon {
  color: var(--symptom);
  fill: none;
  flex: 0 0 auto;
  height: 32px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
  width: 32px;
}

.screen-heading-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.screen-heading-row .screen-title {
  margin: 0;
}

.last-medication-section {
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  margin: 0 -18px 12px;
  min-height: 70px;
  padding-left: 18px;
}

.last-medication-section h2 {
  align-content: center;
  display: grid;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
  margin: 0;
  padding-right: 10px;
}

.last-medication-section h2 span,
.last-medication-section h2 strong {
  display: block;
}

.last-medication-section h2 strong {
  font-size: 1rem;
}

.last-medication-shell {
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.last-medication-list {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.last-medication-list::-webkit-scrollbar {
  display: none;
}

.last-medication-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  flex: 0 0 154px;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) var(--tap-size);
  min-height: 68px;
  padding: 5px 7px 5px 10px;
  scroll-snap-align: start;
  text-align: left;
}

.last-medication-item:active {
  background: var(--medication-soft);
}

.last-medication-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.last-medication-copy strong,
.last-medication-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-medication-copy strong {
  font-size: 0.92rem;
}

.last-medication-copy span {
  font-size: 0.8rem;
}

.last-medication-action-icon {
  background: var(--medication-action);
  border: 1px solid var(--medication-action);
  border-radius: 5px;
  color: var(--on-medication);
  height: 36px;
  padding: 6px;
  width: 36px;
}

.last-medication-fade {
  background: linear-gradient(90deg, var(--paper-transparent), var(--paper) 78%);
  bottom: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  transition: opacity 120ms ease;
  width: 42px;
}

.last-medication-shell.is-overflowing .last-medication-fade {
  opacity: 1;
}

.record-entry {
  margin-bottom: 20px;
}

.record-entry-toggle {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--control-border-strong);
  border-radius: 5px;
  color: var(--note-strong);
  display: inline-flex;
  height: var(--tap-size);
  justify-content: center;
  min-height: var(--tap-size);
  min-width: var(--tap-size);
  padding: 0;
  width: var(--tap-size);
}

.record-entry-toggle-mark {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  transform: translateY(1px);
}

.segmented-tabs {
  border: 1px solid var(--segmented-border);
  border-radius: 5px;
  display: grid;
  overflow: hidden;
}

.record-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.segmented-tab {
  align-items: center;
  background: var(--paper);
  border: 0;
  border-left: 1px solid var(--segmented-divider);
  color: var(--ink);
  display: inline-flex;
  font-weight: 500;
  gap: 7px;
  justify-content: center;
  min-height: 48px;
  min-width: 0;
  padding: 8px 6px;
}

.segmented-tab:first-child {
  border-left: 0;
}

.segmented-tab svg {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  width: 22px;
}

.segmented-tab[aria-selected="true"] {
  background: var(--symptom-soft);
  box-shadow: inset 0 0 0 1px var(--symptom);
  color: var(--symptom-strong);
  font-weight: 700;
}

.record-tabs .pain-tab[aria-selected="true"] {
  background: var(--symptom-soft);
  box-shadow: inset 0 0 0 1px var(--symptom);
  color: var(--symptom-strong);
}

.record-tabs [data-record-tab="medication"][aria-selected="true"] {
  background: var(--medication-soft);
  box-shadow: inset 0 0 0 1px var(--medication);
  color: var(--medication-strong);
}

.record-tabs [data-record-tab="note"][aria-selected="true"] {
  background: var(--note-soft);
  box-shadow: inset 0 0 0 1px var(--note-border);
  color: var(--note-strong);
}

.record-form-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.record-form-layout > [data-record-panel] {
  order: 1;
}

.shared-record-memo {
  order: 2;
}

.record-submit-actions {
  order: 3;
}

.record-form-layout[data-active-record-tab="medication"] .shared-record-memo,
.record-form-layout[data-active-record-tab="note"] .shared-record-memo {
  order: 1;
}

.record-form-layout[data-active-record-tab="medication"] .medication-record-panel {
  order: 2;
}

.record-form-layout[data-active-record-tab="note"] .record-submit-actions {
  order: 2;
}

.record-tab-panel {
  min-width: 0;
}

.form-control-base {
  background: var(--input-bg);
  border-color: var(--input-border);
  border-radius: 5px;
  min-height: 48px;
  padding: 11px 12px;
}

.form-field-label {
  font-size: 0.9rem;
  margin: 0 0 7px;
}

.pain-score-field {
  margin-bottom: 10px;
}

.pain-state-field {
  margin-bottom: 0;
}

.pain-score-buttons {
  border: 1px solid var(--input-border);
  border-radius: 5px;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  overflow: hidden;
}

.pain-score-button {
  background: var(--input-bg);
  border: 0;
  border-left: 1px solid var(--score-divider);
  color: var(--ink);
  font-size: 0.9rem;
  min-height: 44px;
  min-width: 0;
  padding: 0;
}

.pain-score-button:first-child {
  border-left: 0;
}

.pain-score-button[aria-pressed="true"] {
  background: var(--symptom-action);
  color: var(--on-symptom);
  font-weight: 700;
}

.shared-record-memo textarea {
  min-height: 90px;
  resize: vertical;
}

.button-base {
  border-radius: 5px;
  min-height: 48px;
}

.primary-button {
  background: var(--symptom-action);
}

.pain-primary-button {
  background: var(--symptom-action);
  min-height: 52px;
}

.pain-primary-button:hover,
.pain-primary-button:active {
  background: var(--symptom-action-active);
}

.pain-primary-button:disabled,
.pain-primary-button:disabled:hover,
.pain-primary-button:disabled:active {
  background: var(--surface-muted);
  border: 1px solid var(--control-border-strong);
  color: var(--text-muted);
  cursor: not-allowed;
}

#export-csv:disabled {
  background: var(--symptom-soft);
  border: 1px solid var(--csv-disabled-border);
  color: var(--symptom-strong);
}

#export-csv:disabled:hover,
#export-csv:disabled:active {
  background: var(--symptom-soft);
}

.note-primary-button {
  background: var(--note-action);
  border: 0;
  color: var(--button-text);
  min-height: 52px;
}

.medication-record-buttons {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.medication-record-buttons button {
  background: var(--medication-action);
  border: 1px solid transparent;
  border-color: var(--medication-action);
  color: var(--on-medication);
  margin: 0;
  min-height: 58px;
  padding: 8px;
}

.medication-record-buttons button:active {
  background: var(--medication-action-active);
}

.medication-record-buttons .button-type-icon {
  height: 28px;
  width: 28px;
}

.record-message {
  margin: 8px 0 0;
}

.today-records {
  border: 0;
  margin: 0;
  padding: 0;
}

.today-records > h2 {
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.event {
  align-items: start;
  border-top: 0;
  display: grid;
  gap: 1px 6px;
  grid-template-columns: 38px 50px minmax(0, 1fr) 88px;
  min-height: 66px;
  padding: 8px 0;
  position: relative;
}

.event:not(:first-child)::before {
  background: var(--line);
  content: "";
  height: 1px;
  left: 38px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
}

.event-type {
  align-items: flex-start;
  grid-column: 1;
  grid-row: 1 / span 2;
  justify-content: center;
  min-height: var(--tap-size);
  padding-top: 1px;
}

.event.timeline-has-next .event-type {
  align-self: stretch;
  position: relative;
}

.event.timeline-has-next .event-type::after {
  background: var(--line);
  bottom: -18px;
  content: "";
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 33px;
  transform: translateX(-50%);
  width: 1px;
}

.event-time {
  color: var(--note-accent);
  font-size: 0.9rem;
  grid-column: 2;
  grid-row: 1 / span 2;
  padding-top: 4px;
}

.event-body {
  font-size: 0.9rem;
  grid-column: 3;
  grid-row: 1 / span 2;
  line-height: 1.45;
  padding-top: 2px;
}

.event-summary {
  display: block;
  font-weight: 700;
}

.event-note {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  margin-top: 2px;
}

.event-type-icon {
  border: 1px solid currentColor;
  border-radius: 999px;
  height: 32px;
  padding: 6px;
  width: 32px;
}

.event-pain .event-type-icon {
  color: var(--symptom);
}

.event-medication .event-type-icon {
  color: var(--medication);
}

.event-note-record .event-type-icon {
  color: var(--note-accent);
}

.event-actions {
  align-self: start;
  display: grid;
  gap: 0;
  grid-column: 4;
  grid-row: 1 / span 2;
  grid-template-columns: repeat(2, var(--tap-size));
}

.record-action-button {
  background: transparent;
  border: 0;
  color: var(--ink);
  height: var(--tap-size);
  min-height: var(--tap-size);
  min-width: var(--tap-size);
  padding: 10px;
  width: var(--tap-size);
}

.record-action-button:active {
  background: var(--symptom-soft);
}

.record-action-icon {
  height: 22px;
  width: 22px;
}

.toast-feedback {
  bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom));
}

.bottom-nav {
  background: var(--nav-bg);
  border-top: 1px solid var(--line);
  bottom: 0;
  left: 0;
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  position: fixed;
  right: 0;
  z-index: 900;
}

.bottom-nav-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: var(--bottom-nav-height);
  margin: 0 auto;
  max-width: 720px;
}

.bottom-nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  gap: 2px;
  justify-content: flex-end;
  min-height: var(--bottom-nav-height);
  min-width: var(--tap-size);
  padding: 6px 4px 6px;
  position: relative;
}

.bottom-nav-item svg {
  fill: none;
  height: 26px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  width: 26px;
}

.bottom-nav-item[aria-current="page"] {
  color: var(--symptom-strong);
}

.bottom-nav-item[aria-current="page"]::before {
  background: var(--symptom);
  content: "";
  height: 3px;
  left: 10%;
  position: absolute;
  right: 10%;
  top: 0;
}

.history-view,
.summary-view,
.management {
  padding-top: 2px;
}

.history-navigation {
  gap: 8px;
  margin: 0 0 12px;
}

.history-navigation:has(.history-copy-button-row) {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.history-range-label {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0;
}

.history-copy-button-row {
  grid-column: 2;
  grid-row: 1;
}

.history-copy-button,
.history-detail-button,
.history-nav-button,
.text-action-button {
  background: transparent;
  border: 0;
  color: var(--symptom-strong);
  font-weight: 500;
  min-height: var(--tap-size);
  padding: 6px 4px;
}

.history-copy-icon {
  height: 20px;
  width: 20px;
}

.history-navigation-buttons {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.history-day-summary {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.history-day-summary:first-of-type {
  padding-top: 4px;
}

.history-day-title {
  font-size: 1rem;
  font-weight: 500;
}

.history-summary-row {
  font-size: 0.94rem;
  gap: 10px;
  margin: 4px 0;
}

.history-summary-row.timeline-has-next {
  position: relative;
}

.history-summary-row.timeline-has-next::after {
  background: var(--line);
  bottom: -8px;
  content: "";
  left: 10px;
  pointer-events: none;
  position: absolute;
  top: 20px;
  transform: translateX(-50%);
  width: 1px;
}

.history-summary-icon {
  height: 20px;
  width: 20px;
}

.history-summary-pain .history-summary-icon {
  color: var(--symptom);
}

.history-summary-medication .history-summary-icon {
  color: var(--medication);
}

.history-summary-note .history-summary-icon {
  color: var(--history-note);
}

.summary-tab-panel > p:first-of-type {
  margin-bottom: 14px;
}

.summary-period-select {
  margin-bottom: 12px;
}

.summary-end-mode {
  border: 0;
  margin: 14px 0 8px;
  padding: 0;
}

.summary-end-mode legend {
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-result-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  justify-content: flex-end;
  margin: 8px 0 14px;
}

.summary-result-actions .button-base {
  margin: 0;
  width: auto;
}

.visit-summary-result-block {
  border-top: 0;
}

.visit-summary-result-block h3 {
  font-size: 1.12rem;
  margin-top: 20px;
}

.visit-summary-result-block h4 {
  border-top: 1px solid var(--line);
  font-size: 1rem;
  margin-top: 14px;
  padding-top: 12px;
}

.health-history-columns-panel {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  margin: 18px 0 22px;
}

.health-history-columns-panel > summary {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: flex;
  justify-content: space-between;
  min-height: 52px;
  padding: 10px 2px;
}

.management {
  background: var(--paper);
}

.management-group {
  border-bottom: 1px solid var(--line);
  padding: 0 0 18px;
}

.management-group + .management-group {
  padding-top: 18px;
}

.management-group h3 {
  font-size: 1.08rem;
  margin: 0 0 10px;
}

.management-description,
.export-status {
  color: var(--ink);
  font-size: 0.86rem;
  margin: 0 0 8px;
}

.export-status p {
  margin: 0;
}

.management-group > .button-full {
  margin-top: 10px;
}

.settings-group {
  padding-bottom: 0;
}

.settings-disclosure {
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.settings-disclosure > summary {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: flex;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 4px;
}

.settings-disclosure > summary::after {
  color: var(--ink);
  content: "›";
  font-size: 1.7rem;
  font-weight: 300;
  line-height: 1;
}

.settings-disclosure[open] > summary::after {
  transform: rotate(90deg);
}

.settings-disclosure[open] > summary {
  margin-bottom: 12px;
}

.settings-summary-icon {
  color: var(--symptom);
  height: 24px;
  width: 24px;
}

.settings-group > hr {
  display: none;
}

.management-link-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: 58px;
  padding: 8px 4px;
  text-decoration: none;
}

.management-link-row svg {
  color: var(--symptom);
  fill: none;
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 24px;
}

.danger-outline {
  background: var(--paper);
  border: 1px solid var(--danger-bg);
  color: var(--danger-bg);
  margin-top: 18px;
}

.danger-outline:active {
  background: var(--danger-soft);
}

.setup-screen {
  margin-top: 0;
}

.setup-card,
.setup-confirm-section {
  border-radius: 8px;
}

@media (max-width: 430px) {
  .app-header,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .card {
    border-radius: 8px;
  }
}

@media (max-width: 360px) {
  .app-header,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .last-medication-section {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
  }

  .last-medication-item {
    flex-basis: 144px;
  }

  .event {
    grid-template-columns: 34px 44px minmax(0, 1fr) 80px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .app-view {
    animation: none;
  }

  .last-medication-fade {
    transition: none;
  }
}

@media print {
  .bottom-nav {
    display: none !important;
  }

  body.visit-summary-print-mode [data-app-screen="summary"],
  body.health-history-print-mode [data-app-screen="summary"],
  body.visit-summary-print-mode #visit-summary-details,
  body.health-history-print-mode #health-history-details {
    display: block !important;
  }

  body.visit-summary-print-mode .summary-tabs,
  body.health-history-print-mode .summary-tabs,
  body.visit-summary-print-mode .summary-view > .screen-title,
  body.health-history-print-mode .summary-view > .screen-title {
    display: none !important;
  }
}
