:root {
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #18323a;
  --muted: #5f7780;
  --primary: #0f766e;
  --primary-soft: #d8f2ef;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --yes: #166534;
  --yes-soft: #dcfce7;
  --neutral: #475569;
  --neutral-soft: #e2e8f0;
  --warning: #b45309;
  --warning-soft: #ffedd5;
  --border: #d6e1e4;
  --shadow: 0 10px 30px rgba(15, 41, 51, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, "Segoe UI", sans-serif;
}

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

.topbar, .section-head, .progress-meta, .topbar-actions, .inline-actions, .footer-actions, .radio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.monitoring-timer {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbfc;
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.monitoring-timer[title] { cursor: help; }

.monitoring-timer::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 30;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #18323a;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  white-space: normal;
  text-align: start;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .15s ease, transform .15s ease;
}

.monitoring-timer:hover::after,
.monitoring-timer:focus-within::after {
  opacity: 1;
  transform: translateY(0);
}

.treatment-card p + p {
  margin-top: 18px;
}

.charcoal-max-dose {
  margin-top: 18px;
  color: var(--danger) !important;
  font-weight: 800;
  font-size: 13px;
}

.lt4-nac-protocol-btn {
  flex: 0 0 auto;
  min-width: 130px;
  margin-top: 0;
}

.lt4-transport-protocol {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.lt4-transport-protocol p {
  margin: 0;
}

@media (max-width: 640px) {
  .lt4-transport-protocol {
    flex-direction: column;
    align-items: stretch;
  }
}

.monitoring-timer strong {
  direction: ltr;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.locked-input {
  background: #eef3f4 !important;
  color: #5f7780 !important;
  border-color: #c6d4d7 !important;
  cursor: not-allowed;
  opacity: 0.9;
}

.monitoring-timer.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.monitoring-timer.active strong {
  color: var(--primary);
}

.layout {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e8eff1;
  border-radius: 999px;
  overflow: hidden;
}

#progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #14b8a6);
}

.badge {
  padding: 6px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
p { color: var(--muted); line-height: 1.6; }

.step-title { margin-bottom: 8px; }
.step-help { margin-bottom: 16px; }

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

.patient-repository-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

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

.patient-record-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
}

.patient-record-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.patient-record-main span,
.patient-record-main small {
  color: var(--muted);
  line-height: 1.5;
}

.patient-record-card button {
  flex: 0 0 auto;
}

.patient-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.patient-pagination button {
  min-width: 38px;
  padding-inline: 10px;
}

.patient-pagination button.active {
  background: var(--primary);
  color: #fff;
}

.field label, .radio-group > span {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

input, select, button {
  font: inherit;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.ghost-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

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

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

.choice {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  color: var(--text);
  text-align: start;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}


.choice:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 41, 51, 0.08);
}


.choice-yes {
  background: linear-gradient(180deg, #f5fff8 0%, var(--yes-soft) 100%);
  border-color: #86efac;
  color: var(--yes);
}

.choice-no {
  background: linear-gradient(180deg, #fff6f6 0%, var(--danger-soft) 100%);
  border-color: #fca5a5;
  color: var(--danger);
}

.choice-neutral {
  background: linear-gradient(180deg, #f8fafc 0%, var(--neutral-soft) 100%);
  border-color: #cbd5e1;
  color: var(--neutral);
}

.choice-warning {
  background: linear-gradient(180deg, #fffaf4 0%, var(--warning-soft) 100%);
  border-color: #fdba74;
  color: var(--warning);
}

.choice-amount-green {
  background: linear-gradient(135deg, #effcf2 0%, #86efac 100%);
  border-color: #22c55e;
  color: #14532d;
}

.choice-amount-yellow {
  background: linear-gradient(135deg, #fffbed 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: #713f12;
}

.choice-amount-red {
  background: linear-gradient(135deg, #fff3f3 0%, #fca5a5 100%);
  border-color: #ef4444;
  color: #7f1d1d;
}

.choice-default {
  background: linear-gradient(180deg, #f8fbfc 0%, #eef6f7 100%);
  border-color: var(--border);
}

.choice.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.choice-amount-green.active {
  background: linear-gradient(135deg, #d1fae5 0%, #4ade80 100%);
  border-color: #15803d;
  color: #14532d;
}

.choice-amount-yellow.active {
  background: linear-gradient(135deg, #fef9c3 0%, #facc15 100%);
  border-color: #a16207;
  color: #713f12;
}

.choice-amount-red.active {
  background: linear-gradient(135deg, #fee2e2 0%, #f87171 100%);
  border-color: #b91c1c;
  color: #7f1d1d;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.actions button {
  flex: 1;
}

.hint, .danger-text, .ok-text {
  font-size: 14px;
  margin-top: 6px;
}

.danger-text { color: var(--danger); }
.ok-text { color: #166534; }

.hidden { display: none !important; }

.time-picker-card {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
  box-shadow: var(--shadow);
}

.time-option-grid {
  display: block;
}

.time-wheel-wrap {
  max-width: 270px;
  margin: 0 auto;
}

.time-over-options {
  margin-top: 14px;
}

.time-preset-options {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.time-preset-toggle {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px dashed var(--border);
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.time-preset-toggle .tick-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: #fff;
  display: inline-block;
  position: relative;
  flex: none;
}

.time-preset-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.time-preset-toggle.active {
  border-style: solid;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.time-preset-toggle.active .tick-box {
  background: var(--primary);
  border-color: var(--primary);
}

.time-preset-toggle.active .tick-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.time-wheel-wrap .hour-wheel {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, #f8fbfc 0%, #ffffff 48%, #f8fbfc 100%);
  box-shadow: inset 0 12px 18px rgba(15, 41, 51, .06), inset 0 -12px 18px rgba(15, 41, 51, .06);
}

.time-wheel-wrap .wheel-item {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.time-wheel-wrap .wheel-item:hover {
  color: var(--primary);
}

.time-option {
  min-height: 48px;
  padding: 10px 8px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.time-option:hover,
.time-option.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.time-option-wide {
  grid-column: span 2;
}

.time-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.time-picker-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.time-box {
  width: 150px;
  border: 2px solid #6d28d9;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  text-align: center;
}

.time-box-minute {
  border-color: #d6d8dd;
  background: #f1f3f5;
}

.time-box input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 42px;
  line-height: 1.1;
  padding: 0;
  color: var(--text);
}

.time-box span {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.time-separator {
  font-size: 42px;
  line-height: 1;
  color: #1f2937;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.summary-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.management-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.management-glass-card {
  position: relative;
  min-height: 250px;
  padding: 34px 24px 22px;
  border: 2px solid rgba(15, 23, 42, 0.7);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(240,253,250,.42));
  box-shadow: 0 16px 35px rgba(15, 41, 51, .08), inset 0 1px 0 rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.treatment-card {
  background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(255,251,235,.55));
}

.management-card-title {
  position: absolute;
  top: -22px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  min-width: 145px;
  padding: 5px 24px 8px;
  border-radius: 18px;
  background: #ffe500;
  color: #111827;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(234,179,8,.22);
}

.management-glass-card .check-list {
  margin-top: 12px;
  width: 100%;
  text-align: start;
}

.vital-signs-card {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #b7d5d2;
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fffe 0%, #eef8f6 100%);
}

.vital-signs-title {
  margin-bottom: 12px;
  color: var(--primary);
  font-weight: 800;
  font-size: 15px;
}

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

.vitals-grid .field {
  min-width: 0;
}

.vitals-grid .field label {
  font-size: 12px;
  margin-bottom: 5px;
}

.vitals-grid input {
  padding: 10px 9px;
  font-size: 14px;
}

.footnote {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff8e1;
  color: #713f12;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 720px) {
  .management-cards { grid-template-columns: 1fr; }
  .vitals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.amount-hint-slot {
  min-height: 22px;
}

.maintenance-dose-card {
  margin: 10px 0;
  padding: 14px 16px;
  border: 1px solid #99d5cb;
  border-inline-start: 5px solid #0f766e;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fdfa 0%, #e6fffb 100%);
  text-align: start;
}

.maintenance-dose-label {
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
}

.maintenance-dose-value {
  margin-top: 3px;
  color: #064e3b;
  font-size: 23px;
  font-weight: 800;
}

.maintenance-dose-detail,
.maintenance-dose-duration {
  color: #49636c;
  font-size: 13px;
}

.check-list {
  margin: 10px 0 0;
  padding-inline-start: 18px;
}

.countdown {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.decision-box {
  margin-top: 12px;
  border-radius: 14px;
  background: #f8fbfc;
  border: 1px solid var(--border);
  padding: 14px;
}

.decision-box ul {
  margin: 8px 0 0;
  padding-inline-start: 18px;
}

.nac-protocol-card {
  margin: 8px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  list-style: none;
  text-align: start;
}

.nac-protocol-list-item {
  list-style: none;
  margin-inline-start: -18px;
}

.nac-protocol-card h3 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 16px;
}

.nac-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.nac-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
  direction: inherit;
}

.nac-table th,
.nac-table td {
  padding: 10px 8px;
  border: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.nac-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
}

.nac-table td:first-child,
.nac-table th:first-child {
  width: 10%;
  text-align: center;
}

.ltr-value {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  text-align: left;
}

.decision-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.decision-with-action .ghost-btn {
  padding: 7px 10px;
  white-space: nowrap;
}

.decision-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.decision-inline .ghost-btn {
  flex: none;
  white-space: nowrap;
}

.nomogram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.nomogram-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-line,
.legend-dot {
  display: inline-block;
  width: 18px;
  height: 3px;
  background: var(--primary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b91c1c;
}

.legend-dot-1 { background: #2563eb; }
.legend-dot-2 { background: #7c3aed; }
.legend-dot-3 { background: #b45309; }
.legend-dot-4 { background: #0891b2; }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(94vw, 760px);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 18px;
}

.close-btn {
  position: sticky;
  top: 0;
  margin-inline-start: auto;
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

canvas {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

@media (max-width: 640px) {
  .topbar, .section-head, .topbar-actions, .inline-actions, .footer-actions, .radio-row, .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .monitoring-timer { justify-content: center; }
  h1 { font-size: 20px; }
  .card { padding: 14px; }
  .time-option-grid { display: block; }
  .patient-repository-toolbar { grid-template-columns: 1fr; }
  .patient-record-card { align-items: stretch; flex-direction: column; }
  .patient-fields { grid-template-columns: 1fr; }
}

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 24px;
  margin: 0 auto;
  max-width: 320px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--text);
  color: #fff;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 41, 51, 0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 30;
  pointer-events: none;
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Collapsible card — وضعیت پرونده */
.lt4-countdown-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfc 100%);
  box-shadow: var(--shadow);
}
.lt4-countdown-card.deadline-near {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}
.lt4-countdown-card.deadline-passed {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}
.lt4-two-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.lt4-labs-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #fcfefe;
}

.collapsible-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  border: 0;
  text-align: start;
  cursor: pointer;
}
.collapsible-head h2 { flex: 1; }
.chevron {
  flex: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease;
}
.collapsible.collapsed .chevron { transform: rotate(-90deg); }
.collapsible-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.collapsible.collapsed .collapsible-body { display: none; }

/* Phase 10 — merged amount + time screen */
.section-label {
  margin: 4px 2px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: none;
}

.amount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Beautiful divider between the amount block and the time block */
.section-divider {
  margin: 24px 4px 20px;
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--border) 16%, var(--border) 84%, transparent);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-divider-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 12px;
  background: var(--card);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}
.section-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--primary);
  transform: translate(-50%, -50%);
  opacity: 0;
}

/* Hour clock — framed box, phone-timer style, easy to use */
.hour-clock-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f5fbfa 100%);
  box-shadow: var(--shadow);
  padding: 6px 8px 10px;
  overflow: hidden;
}

.wheel-caption {
  padding: 13px 8px 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
}

/* Selection band — two thin guide lines only, NO green fill, so the
   numbers above and below the selected hour stay clearly visible. */
.wheel-stage {
  position: relative;
}

.wheel-band {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 48px;
  transform: translateY(-50%);
  border-radius: 12px;
  background: transparent;
  border: 0;
  pointer-events: none;
  z-index: 2;
}
.wheel-band::before,
.wheel-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  opacity: 0.6;
}
.wheel-band::before { top: 0; }
.wheel-band::after { bottom: 0; }

.hour-wheel {
  position: relative;
  z-index: 1;
  height: 240px;            /* 5 visible rows × 48px */
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hour-wheel::-webkit-scrollbar { display: none; }

.hour-wheel::before,
.hour-wheel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 38px;
  z-index: 3;
  pointer-events: none;
}
.hour-wheel::before {
  top: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,0));
}
.hour-wheel::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(245,251,250,.96), rgba(245,251,250,0));
}

.wheel-track {
  display: flex;
  flex-direction: column;
  padding-block: 96px;      /* centers the first & last items */
}

.wheel-item {
  height: 48px;
  flex: none;
  scroll-snap-align: center;
  display: grid;
  place-items: center;
  font-size: 21px;
  color: var(--muted);
  transition: color 0.15s ease, font-size 0.15s ease;
}

.wheel-item.active {
  color: var(--primary);
  font-weight: 800;
  font-size: 30px;
}

.wheel-hint { margin-top: 12px; text-align: center; }

/* explicit − / + stepper for clarity */
.hour-stepper {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.step-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.step-btn:hover { background: var(--primary); color: #fff; }
.step-btn:active { transform: scale(0.94); }

.hour-stepper-value {
  min-width: 96px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.bucket-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bucket-preview [data-bucket-preview] {
  font-weight: 700;
  color: var(--primary);
}

/* Unknown-time toggle — single checkbox-style button below the clock */
.time-unknown-note { text-align: center; padding: 14px 0 4px; }

.time-unknown-toggle {
  margin-top: 16px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px dashed var(--border);
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.time-unknown-toggle .tick-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: #fff;
  display: inline-block;
  position: relative;
  flex: none;
}
.time-unknown-toggle:hover { border-color: var(--primary); color: var(--primary); }
.time-unknown-toggle.active {
  border-style: solid;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.time-unknown-toggle.active .tick-box {
  background: var(--primary);
  border-color: var(--primary);
}
.time-unknown-toggle.active .tick-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.reeval-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.reeval-quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.reeval-quick-actions .ghost-btn { min-width: 150px; }
.unknown-identity-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft, #f8fbfc);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.unknown-identity-toggle input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}
.unknown-identity-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.unknown-identity-details > div,
.summary-patient-grid > span {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbfc;
  overflow-wrap: anywhere;
}
.unknown-identity-details strong,
.summary-patient-grid strong { color: var(--muted); font-size: 13px; }
.summary-patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.summary-decision-stack { display: grid; gap: 10px; margin-top: 10px; }
.summary-decision-stage,
.summary-history-entry {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbfc;
}
.summary-current-decision { border-color: #9dd8d0; background: #f2fbf9; }
.summary-decision-stage > strong,
.summary-history-heading > strong { display: block; color: var(--primary); }
.summary-decision-stage ul { margin: 8px 0 0; padding-inline-start: 22px; }
.summary-decision-stage li + li { margin-top: 5px; }
.summary-history-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.summary-lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.summary-lab-grid > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow-wrap: anywhere;
}
.summary-lab-grid > span strong { color: var(--muted); font-size: 12px; }
.summary-lab-grid > span bdi { font-weight: 700; text-align: end; }
.patient-form-error { margin: 0 0 12px; }
.final-discharge-status {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 7px 16px;
  border: 1px solid #86efac;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font-size: 17px;
  font-weight: 800;
}
.final-outcome-box { font-size: 18px; line-height: 1.9; }
.final-outcome-box li + li { margin-top: 8px; }
.final-referral-card {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid #f4bd73;
  border-inline-start: 6px solid #c2410c;
  border-radius: 14px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.9;
}
.final-referral-card strong { display: block; margin-bottom: 4px; font-size: 19px; }
.final-referral-card p { margin: 0; }
.final-export-hint {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f0fdfa;
  color: #115e59;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
}
.final-case-actions { grid-template-columns: 1fr; }
.final-case-actions button { min-height: 52px; font-size: 16px; font-weight: 800; }
.reaction-actions { display: grid; gap: 8px; margin-top: 16px; }
.reaction-actions h3 { margin: 0 0 4px; }
.reaction-section-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfdfd;
}
.reaction-section-card > h3 { margin: 0 0 12px; font-size: 16px; }
.reaction-type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reaction-answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reaction-type-grid .choice, .reaction-answer-grid .choice { min-height: 50px; text-align: center; }
.reaction-emergency-card { border-color: #fca5a5; background: #fffafa; }
.reaction-followup-card { background: #f7fbff; }
.reaction-no-event {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #f1f5f9;
  color: var(--muted);
}
.reaction-validation-error { margin: 10px 0 0; }
.reaction-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-align: start;
  cursor: pointer;
}
.reaction-action.done { border-color: #16a34a; background: #f0fdf4; }
.reaction-check {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-weight: 900;
}
.reaction-action.done .reaction-check { color: #fff; border-color: #16a34a; background: #16a34a; }
.reaction-hold-clock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 2px solid #dc2626;
  border-radius: 14px;
  color: #991b1b;
  background: #fef2f2;
  animation: hold-pulse 1.4s ease-in-out infinite;
}
.reaction-hold-clock.hold-complete { animation: none; }
@keyframes hold-pulse { 50% { box-shadow: 0 0 0 6px rgb(220 38 38 / 14%); } }

@media (max-width: 640px) {
  .amount-grid { grid-template-columns: 1fr 1fr; }
  .reeval-quick-actions, .reeval-quick-actions .ghost-btn { width: 100%; }
  .unknown-identity-details { grid-template-columns: 1fr; }
  .reaction-type-grid { grid-template-columns: 1fr; }
}
