/* vitals.css — Vitals tracker. Local-only. Mobile-first.
   Reuses .field / .pae-form-actions / .pae-empty / .calllog-input /
   .otlist-field-row / .otlist-scan-btn / .otlist-scan-viewport /
   .otlist-scan-frame / .otlist-scan-status / .pae-custom-add /
   .pae-custom-add-btn / .pae-custom-remove from pae.css, otlist.css
   and calllog.css — only Vitals-specific rules live here. */

.vitals-tool-card { text-align: left; padding: 1.25rem 1rem; }
.vitals-tool-card h2 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; color: var(--ink); text-align: left; }
.vitals-tool-card > p { text-align: left; color: var(--muted); font-size: 0.82rem; line-height: 1.5; margin: 0.35rem 0 1rem; }

.vitals-new-btn { margin-bottom: 0.9rem; }

.vitals-form-wrap {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.vitals-form-wrap h3 { margin: 0 0 0.2rem; font-family: var(--serif); font-weight: 400; font-size: 1.1rem; color: var(--ink); }

.vitals-form-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.1rem 0;
}
.vitals-form-divider::before,
.vitals-form-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── ward groups ───────────────────────────────────────────── */

.vitals-list { display: flex; flex-direction: column; gap: 1.4rem; }
.vitals-ward-group { display: flex; flex-direction: column; gap: 0.65rem; }

.vitals-ward-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.1rem 0.5rem;
}

.vitals-ward-title { font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.vitals-copy-btn {
  flex-shrink: 0;
  background: var(--accent-soft);
  border: 1px solid rgba(170,68,101,.22);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s;
}
.vitals-copy-btn:active { transform: scale(0.96); }

/* ── patient card (mirrors .pae-case / .otlist-card) ─────────── */

.vitals-patient {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.vitals-patient-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 0.9rem; cursor: pointer; }
.vitals-patient-info { flex: 1; min-width: 0; }
.vitals-patient-name { font-size: 0.96rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vitals-patient-meta { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }

.vitals-patient-edit,
.vitals-patient-delete {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.vitals-patient-edit:active { color: var(--accent); }
.vitals-patient-delete:active { color: var(--red); }
.vitals-patient-edit svg,
.vitals-patient-delete svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.vitals-patient-chevron { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; transition: transform 0.2s; flex-shrink: 0; }
.vitals-patient.open .vitals-patient-chevron { transform: rotate(180deg); }

.vitals-patient-body { display: none; border-top: 1px solid var(--border); padding: 0.85rem 0.9rem 1rem; }
.vitals-patient.open .vitals-patient-body { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── field rows ────────────────────────────────────────────── */

.vitals-field-row {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.6rem;
  transition: background 0.4s ease;
}
.vitals-field-row.flash { background: var(--green-d); }

.vitals-field-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vitals-field-label {
  flex: 0 0 3.4rem;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.vitals-field-input,
.vitals-bp-input {
  margin: 0;
  padding: 0.55rem 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.vitals-field-input { flex: 1; min-width: 0; }
.vitals-bp-input { width: 3.6rem; flex: 0 0 3.6rem; text-align: center; }
.vitals-bp-slash { color: var(--muted); font-weight: 700; flex-shrink: 0; }

.vitals-field-add-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(170,68,101,.24);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.vitals-field-add-btn:active { transform: scale(0.94); }

.vitals-field-chevron-btn {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.vitals-field-chevron-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; transition: transform 0.2s; }
.vitals-field-chevron-btn.open svg { transform: rotate(180deg); }
.vitals-field-chevron-btn:active { color: var(--accent); }

/* history dropdown (also where a specific past time is entered) */

.vitals-history-panel {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border-strong);
}

.vitals-backfill-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.vitals-time-input { margin: 0; flex: 0 0 6.2rem; padding: 0.5rem 0.5rem; font-size: 0.82rem; }
.vitals-save-measure-btn { width: auto; flex-shrink: 0; padding: 0.55rem 0.85rem; font-size: 0.74rem; }

.vitals-history-list { display: flex; flex-direction: column; gap: 0.2rem; }

.vitals-history-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  padding: 0.3rem 0.1rem;
  border-bottom: 1px solid var(--border);
}
.vitals-history-row:last-child { border-bottom: none; }

.vitals-history-value { flex: 1; color: var(--ink); font-weight: 600; }
.vitals-history-time { font-size: 0.68rem; color: var(--muted); font-family: 'Courier New', monospace; }

.vitals-history-delete {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  font-size: 0.8rem;
}
.vitals-history-delete:active { color: var(--red); }

.vitals-history-empty { font-size: 0.76rem; color: var(--muted); font-style: italic; padding: 0.3rem 0.1rem; }

body.vitals-keyboard-open .bottom-nav {
  display: none !important;
}

/* Last reading and patient actions */
.vitals-last-recorded {
  margin: .3rem 0 .05rem 3.8rem;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.35;
}

.vitals-field-input::placeholder,
.vitals-bp-input::placeholder {
  color: #8a8790;
  opacity: 1;
  font-weight: 400;
}

.vitals-patient-actions {
  display: flex;
  gap: .55rem;
  margin: .4rem 0 .3rem;
}

.vitals-patient-actions .ob-btn {
  flex: 1;
  width: auto;
  min-width: 0;
  font-size: .75rem;
  padding: .7rem .35rem;
}

.vitals-save-all-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.vitals-date-input {
  width: 9.1rem;
  flex: 0 0 9.1rem;
  margin: 0;
  padding: .5rem;
  font-size: .82rem;
}

.vitals-history-time {
  font-family: inherit;
  text-align: right;
  white-space: nowrap;
}

/* Graph dialog */
.vitals-graph-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 18, 28, .58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .6rem;
}

.vitals-graph-sheet {
  width: min(100%, 850px);
  max-height: min(92dvh, 900px);
  background: #fff;
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2);
}

.vitals-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1rem 1rem .7rem;
  border-bottom: 1px solid var(--border);
}

.vitals-graph-header h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.vitals-graph-meta {
  color: var(--muted);
  font-size: .72rem;
}

.vitals-graph-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: .15rem .4rem;
}

.vitals-graph-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  padding: .3rem 1rem 1rem;
}

.vitals-graph-note {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.45;
}

.vitals-chart-card {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-top: .7rem;
  padding: .65rem .55rem .4rem;
}

.vitals-chart-card h4 {
  margin: 0 .3rem .3rem;
  color: var(--ink);
  font-size: .85rem;
}

.vitals-chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}

.vitals-graph-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
}

.vitals-export-pdf {
  width: 100%;
}

.vitals-export-pdf:disabled {
  opacity: .55;
}

@media (max-width: 390px) {
  .vitals-field-label {
    flex-basis: 2.75rem;
    font-size: .61rem;
  }

  .vitals-last-recorded {
    margin-left: 3.15rem;
  }

  .vitals-bp-input {
    width: 3rem;
    flex-basis: 3rem;
    padding-inline: .3rem;
  }
}
/* Larger history target and chevron at the right edge */
.vitals-field-row {
  cursor: pointer;
}

.vitals-field-row input {
  cursor: text;
}

.vitals-history-panel {
  cursor: default;
}

.vitals-field-chevron-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.vitals-bp-input {
  min-width: 0;
  flex: 0 1 3.6rem;
}

@media (max-width: 390px) {
  .vitals-bp-input {
    flex-basis: 3rem;
  }
}