:root {
  --bg-app: #F6F8FA;
  --bg-sidebar: #FFFFFF;
  --card: #FFFFFF;
  --border: #E6EAEF;
  --ink: #14202B;
  --muted: #64748B;
  --muted-2: #94A3B8;

  --mint: #0E9F86;
  --mint-dark: #0A7A68;
  --mint-tint: #E3F6F2;

  --teal: #1F6E96;
  --teal-dark: #154D68;
  --teal-tint: #E4EFF4;

  --amber: #C77D14;
  --amber-tint: #FDF1DF;
  --amber-strong: #F59E0B;

  --danger: #C0392B;
  --danger-tint: #FBEAE8;

  --radius-card: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --font-head: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-app);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
  position: relative;
}

/* ---------------- SIDEBAR ---------------- */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: none;
  flex-direction: column;
  gap: 4px;
  grid-row: 1;
  grid-column: 1;
}
.sidebar.sb-active { display: flex; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px;
}
.brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.brand span {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
}
.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--bg-app); color: var(--ink); }
.nav-item.active { background: var(--mint-tint); color: var(--mint-dark); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: var(--amber-strong);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  padding: 1px 7px;
}
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
}
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal-tint); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-footer .who { font-size: 12.5px; }
.sidebar-footer .who p { margin: 0; }
.sidebar-footer .who .name { font-weight: 600; color: var(--ink); }
.sidebar-footer .who .role { color: var(--muted-2); font-size: 11.5px; }

/* ---------------- MAIN ---------------- */
.main { padding: 28px 32px 60px; max-width: 1400px; grid-column: 2; }
.view { display: none; }
.view.active { display: block; }

/* demo-only preview switcher, visually separated from the real sidebars */
.demo-switcher {
  position: absolute; top: 16px; right: 20px;
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); padding: 6px 8px 6px 12px;
  border-radius: var(--radius-pill); z-index: 10;
}
.demo-switcher span { color: #94A3B8; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.demo-btn {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-pill); border: none;
  background: transparent; color: #CBD5E1; cursor: pointer;
}
.demo-btn.active { background: var(--mint); color: #fff; }

.topline {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px;
}
h1.page-title {
  font-family: var(--font-head);
  font-size: 25px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink);
}
.subline { color: var(--muted); font-size: 13.5px; margin: 0; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 8px 14px;
  color: var(--muted-2); font-size: 13px; min-width: 260px;
}
.search-box svg { width: 15px; height: 15px; flex-shrink: 0; }

/* --- Doctor view grid --- */
.doctor-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
}
.card-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}

.transcript-text {
  font-size: 13.5px; color: var(--ink); line-height: 1.65;
  background: var(--bg-app); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 0;
}

/* pipeline flow stepper */
.flow-card {
  margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--mint-tint);
  border: 1px solid #C6EAE1;
  border-radius: var(--radius-card);
  padding: 12px 18px;
}
.flow-steps { display: flex; align-items: center; gap: 0; }
.flow-step { display: flex; align-items: center; gap: 8px; }
.flow-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--mint); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.flow-dot svg { width: 12px; height: 12px; }
.flow-step span { font-size: 12.5px; font-weight: 600; color: var(--mint-dark); }
.flow-connector { width: 26px; height: 1px; background: #A9DDD0; margin: 0 6px; }
.flow-status {
  font-size: 12px; font-weight: 600; color: var(--mint-dark);
  background: #fff; padding: 4px 12px; border-radius: var(--radius-pill);
  display: flex; align-items: center; gap: 5px;
}

/* SOAP note card */
.soap-card { margin-top: 16px; }
.soap-card.nested { border-top: 1px solid var(--border); padding-top: 16px; }
.soap-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.soap-who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--teal-tint); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
}
.soap-who .name { font-weight: 600; font-size: 14.5px; margin: 0; color: var(--ink); }
.soap-who .meta { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.status-pill {
  font-size: 11.5px; font-weight: 600; padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--amber-tint); color: var(--amber);
}

.soap-body { display: flex; flex-direction: column; gap: 14px; }
.soap-row { display: flex; gap: 12px; }
.soap-tag {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 12px;
}
.tag-s { background: #E9E7FE; color: #5A4FCF; }
.tag-o { background: #DDEFFB; color: #1D74B8; }
.tag-a { background: var(--amber-tint); color: var(--amber); }
.tag-p { background: var(--mint-tint); color: var(--mint-dark); }
.soap-row .content p.h { margin: 0 0 3px; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.soap-row .content p.b { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.soap-row .content ul { margin: 4px 0 0; padding-left: 18px; }
.soap-row .content li { font-size: 13px; color: var(--muted); line-height: 1.7; }

.soap-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* Patient queue */
.queue-card { margin-top: 16px; }
.queue-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.queue-list { display: flex; flex-direction: column; }
.queue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.queue-item:last-child { border-bottom: none; }
.q-info { flex: 1; }
.q-info .n { margin: 0; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.q-info .d { margin: 2px 0 0; font-size: 12px; color: var(--muted-2); }
.qpill { font-size: 11px; font-weight: 600; padding: 4px 11px; border-radius: var(--radius-pill); }
.qpill.waiting { background: var(--amber-tint); color: var(--amber); }
.qpill.recording { background: var(--danger-tint); color: var(--danger); }
.qpill.scheduled { background: var(--bg-app); color: var(--muted); }
.btn {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
}
.btn svg { width: 14px; height: 14px; }
.btn-ghost-group { display: flex; gap: 8px; }
.btn-primary { background: var(--mint); border-color: var(--mint); color: #fff; }
.btn-primary:hover { background: var(--mint-dark); }

/* --- Right sidebar cards --- */
.side-stack { display: flex; flex-direction: column; gap: 18px; }

.mind-card {
  background: var(--amber-tint);
  border: 1px solid #F0DCB3;
  border-radius: var(--radius-card);
  padding: 16px 18px;
}
.mind-header { display: flex; align-items: center; gap: 10px; }
.mind-icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--amber-strong);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mind-icon svg { width: 17px; height: 17px; color: #fff; }
.mind-title p.t { margin: 0; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.mind-title p.s { margin: 1px 0 0; font-size: 11.5px; color: var(--amber); }
.mind-count {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill);
}
.mind-alert {
  margin-top: 12px; background: #fff; border-radius: var(--radius-sm);
  padding: 12px 13px; font-size: 12.5px; color: var(--ink); line-height: 1.55;
}
.mind-alert b { color: var(--danger); }
.mind-link {
  display: block; margin-top: 10px; font-size: 12.5px; font-weight: 600;
  color: var(--amber); text-decoration: none;
}

.ask-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow: hidden;
}
.ask-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.ask-icon {
  width: 32px; height: 32px; border-radius: 9px; background: var(--teal);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ask-icon svg { width: 16px; height: 16px; color: #fff; }
.ask-header .t { margin: 0; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.ask-header .s {
  margin: 1px 0 0; font-size: 11px; color: var(--muted-2);
  display: flex; align-items: center; gap: 4px;
}
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); display: inline-block; }

.ask-thread { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble {
  font-size: 12.5px; line-height: 1.5; padding: 9px 12px; border-radius: 12px;
  max-width: 90%;
}
.bubble.bot { background: var(--bg-app); color: var(--ink); border-bottom-left-radius: 4px; }
.bubble.user {
  background: var(--teal); color: #fff; align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ask-input-row {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border);
}
.ask-input-row input {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 8px 14px; font-size: 12.5px; font-family: var(--font-body);
  outline: none; color: var(--ink);
}
.ask-input-row input::placeholder { color: var(--muted-2); }
.send-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--teal);
  border: none; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}
.send-btn svg { width: 15px; height: 15px; color: #fff; }

/* ---------------- PATIENT VIEW ---------------- */
.timeline-card { padding: 20px 22px 16px; }
.timeline-track {
  display: flex; align-items: flex-start; margin-top: 18px;
  overflow-x: auto; padding-bottom: 4px;
}
.tl-node { display: flex; flex-direction: column; align-items: center; min-width: 108px; }
.tl-circle {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border);
  background: #fff; display: flex; align-items: center; justify-content: center;
  color: var(--muted-2); flex-shrink: 0;
}
.tl-circle svg { width: 15px; height: 15px; }
.tl-node.selected .tl-circle { background: var(--mint); border-color: var(--mint); color: #fff; }
.tl-node .tl-date { font-size: 12px; font-weight: 600; margin-top: 8px; color: var(--ink); }
.tl-node .tl-spec { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.tl-node.selected .tl-date { color: var(--mint-dark); }
.tl-line { flex: 1; height: 2px; background: var(--border); margin-top: 17px; min-width: 30px; }

.visit-summary { margin-top: 18px; }
.vs-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.vs-head .who { display: flex; align-items: center; gap: 10px; }
.vs-head .name { font-weight: 600; font-size: 14px; margin: 0; color: var(--ink); }
.vs-head .meta { font-size: 12px; color: var(--muted-2); margin: 1px 0 0; }
.approved-pill {
  font-size: 11px; font-weight: 600; color: var(--mint-dark);
  background: var(--mint-tint); padding: 4px 10px; border-radius: var(--radius-pill);
  display: flex; align-items: center; gap: 5px;
}
.plain-summary { font-size: 13.5px; color: var(--ink); line-height: 1.7; margin: 0; }
.plain-summary + .plain-summary { margin-top: 10px; }

.patient-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-top: 20px; }
.med-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.med-item:last-child { border-bottom: none; }
.med-item .n { font-weight: 600; font-size: 13.5px; color: var(--ink); margin: 0; }
.med-item .d { font-size: 12px; color: var(--muted-2); margin: 2px 0 0; }
.pill-active {
  font-size: 11px; font-weight: 600; color: var(--mint-dark);
  background: var(--mint-tint); padding: 3px 10px; border-radius: var(--radius-pill);
}

.appt-box {
  background: var(--teal-tint); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-top: 4px;
}
.appt-box .doc { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.appt-box .doc .name { font-weight: 600; font-size: 13.5px; margin: 0; color: var(--ink); }
.appt-box .doc .spec { font-size: 11.5px; color: var(--teal-dark); margin: 1px 0 0; }
.appt-detail { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink); margin: 6px 0; }
.appt-detail svg { width: 14px; height: 14px; color: var(--teal); flex-shrink: 0; }
/* Live-wiring additions */
.record-card { margin-bottom: 16px; }
.record-row { display: flex; gap: 10px; align-items: center; }
.field-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  margin: 0 0 6px; display: block;
}
input.patient-id-input {
  flex: 1; font-family: var(--font-body); font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; background: #fff; outline: none;
}
input.patient-id-input::placeholder { color: var(--muted-2); }
.upload-btn {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  padding: 9px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #fff; color: var(--muted); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.upload-btn:hover { background: var(--bg-app); }
.upload-btn svg { width: 14px; height: 14px; }
.field-hint { font-size: 12px; color: var(--muted-2); margin: 8px 0 0; }
.flow-card.nested { margin-top: 14px; }
.transcript-section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.patient-select-wrap { text-align: right; }
select.patient-select {
  font-family: var(--font-body); font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; background: #fff; outline: none;
}
.run-btn {
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px;
  padding: 10px 20px; border-radius: var(--radius-sm); border: none;
  background: var(--mint); color: #fff; cursor: pointer; white-space: nowrap;
}
.run-btn:hover { background: var(--mint-dark); }
.run-btn:disabled { background: var(--muted-2); cursor: not-allowed; }
.flow-dot.pending { background: #fff; border: 2px solid var(--border); }
.flow-dot.pending svg { display: none; }
.flow-dot.spin { border: 2px solid var(--mint-tint); border-top-color: var(--mint); background: #fff; animation: spin 0.8s linear infinite; }
.flow-dot.spin svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { color: var(--muted-2); font-size: 13px; font-style: italic; padding: 6px 0; }
.err-banner {
  background: var(--danger-tint); color: var(--danger); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12.5px; margin-top: 10px; display: none;
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bubble.pending { color: var(--muted-2); font-style: italic; }
.tl-node { cursor: pointer; }
.status-pill.approved { background: var(--mint-tint); color: var(--mint-dark); }

/* ================= CREATIVE REDESIGN — Doctor Portal ================= */

/* --- Patient ID: separated hero section, stays above the unified box --- */
.patient-id-card {
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
  border-radius: var(--radius-card);
  padding: 18px 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.patient-id-card::before {
  content: "";
  position: absolute; top: -30%; right: -8%; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.patient-id-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
}
.patient-id-icon svg { width: 22px; height: 22px; stroke: white; }
.patient-id-body { flex: 1; }
.patient-id-body .field-label {
  color: #BEE0EC; margin: 0 0 4px; font-size: 11px; letter-spacing: 0.08em;
}
input.patient-id-input-hero {
  width: 100%; background: transparent; border: none; outline: none;
  font-family: var(--font-head); font-weight: 700; font-size: 21px; color: white;
  padding: 0;
}
input.patient-id-input-hero::placeholder { color: rgba(255,255,255,0.45); font-weight: 500; }
/*
  Defeat the browser's forced :-webkit-autofill styling: it paints an
  opaque light background and dark text over our transparent-on-gradient
  input once the field holds a remembered value. The huge inset box-shadow
  trick repaints the field transparent, the text-fill-color keeps the text
  white, and the 5000s transition parks the UA's background animation
  effectively forever.
*/
input.patient-id-input-hero:-webkit-autofill,
input.patient-id-input-hero:-webkit-autofill:hover,
input.patient-id-input-hero:-webkit-autofill:focus {
  -webkit-text-fill-color: white;
  -webkit-box-shadow: 0 0 0px 1000px transparent inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* --- ONE unified flow box: a single slot that swaps between 4 states --- */
.unified-flow-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card);
  margin-bottom: 16px; overflow: hidden;
}
.flow-section { padding: 22px; }

/*
  The single slot. Exactly one .slot-panel is mounted at any moment — the
  others are display:none, so they occupy no space and are not in the
  accessibility/hit-test tree. Panels are never stacked or revealed
  alongside one another; goToState() in app.js fades the current one out,
  unmounts it, then mounts and fades in the next, animating the slot's
  height between the two so the box morphs in place.
*/
.flow-slot { position: relative; }
.flow-slot.swapping { overflow: hidden; transition: height 0.32s cubic-bezier(.4,0,.2,1); }
.slot-panel { display: none; opacity: 0; transition: opacity 0.26s ease; }
.slot-panel.is-mounted { display: block; }
.slot-panel.is-visible { opacity: 1; }

/* The error banner sits outside the slot so it survives a state swap. */
.flow-error-wrap:not(:empty) { padding: 0 22px; }
.flow-error-wrap .err-banner { margin: 0 0 18px; }

.record-studio {
  border: 2px dashed #C9DCE4; border-radius: 14px;
  background: linear-gradient(180deg, var(--teal-tint), #FBFDFE);
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.record-studio:hover, .record-studio.dragover { border-color: var(--teal); background: linear-gradient(180deg, #D9EBF2, #FBFDFE); }
.record-studio.has-file { border-style: solid; border-color: var(--mint); background: linear-gradient(180deg, var(--mint-tint), #FBFDFE); }

.pulse-ring-wrap { position: relative; width: 76px; height: 76px; margin: 0 auto 14px; }
.pulse-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--teal); opacity: 0;
  animation: pulseRing 2.6s ease-out infinite;
}
.pulse-ring.delay1 { animation-delay: 1.3s; }
@keyframes pulseRing {
  0% { transform: scale(0.7); opacity: 0.55; }
  100% { transform: scale(1.55); opacity: 0; }
}
.record-icon-circle {
  position: absolute; inset: 10px; border-radius: 50%;
  background: var(--teal); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(31,110,150,0.3);
}
.record-icon-circle svg { width: 26px; height: 26px; stroke: white; }
.record-studio.has-file .record-icon-circle { background: var(--mint); box-shadow: 0 4px 14px rgba(14,159,134,0.3); }

.record-studio-title { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--ink); margin: 0 0 4px; }
.record-studio-sub { font-size: 12.5px; color: var(--muted-2); margin: 0 0 16px; }
.upload-btn-creative {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  padding: 9px 18px; border-radius: var(--radius-pill); border: none;
  background: white; color: var(--teal-dark); cursor: pointer;
  box-shadow: 0 1px 3px rgba(20,32,43,0.12);
}
.upload-btn-creative:hover { box-shadow: 0 2px 6px rgba(20,32,43,0.18); }
.upload-btn-creative svg { width: 14px; height: 14px; }

/* --- Pulse-line pipeline (fills the whole slot while STATE 3 is up) --- */
.pulse-pipeline-section {
  background: var(--teal-dark); position: relative; overflow: hidden;
  padding: 40px 26px 34px;
}
.pulse-pipeline-section::before {
  content: ""; position: absolute; top: -40%; left: -10%; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.pulse-track { position: relative; display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.pulse-line-bg {
  position: absolute; left: 26px; right: 26px; top: 22px; height: 3px;
  background: rgba(255,255,255,0.14); border-radius: 3px;
}
.pulse-line-fill {
  position: absolute; left: 26px; top: 22px; height: 3px;
  background: linear-gradient(90deg, var(--mint), #6EE7D0);
  border-radius: 3px; width: 0%; transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.pulse-stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: 25%; }
.pulse-node {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
}
.pulse-node svg { width: 19px; height: 19px; stroke: rgba(255,255,255,0.55); transition: stroke 0.3s; }
.pulse-stage.active .pulse-node {
  background: white; border-color: white;
  box-shadow: 0 0 0 6px rgba(255,255,255,0.14);
  animation: nodePulse 1s ease-in-out infinite;
}
.pulse-stage.active .pulse-node svg { stroke: var(--teal-dark); }
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255,255,255,0.14); }
  50% { box-shadow: 0 0 0 10px rgba(255,255,255,0.06); }
}
.pulse-stage.done .pulse-node { background: var(--mint); border-color: var(--mint); }
.pulse-stage.done .pulse-node svg { stroke: white; display: block; }
.pulse-stage.done .pulse-node .pulse-spinner { display: none; }
.pulse-node .pulse-spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(20,77,104,0.25); border-top-color: var(--teal-dark);
  animation: spin 0.7s linear infinite;
}
.pulse-stage.active .pulse-node svg { display: none; }
.pulse-stage.active .pulse-node .pulse-spinner { display: block; }
.pulse-stage.done .pulse-node .pulse-spinner { display: none; }
.pulse-stage.done .pulse-node svg { display: block; }

.pulse-label { margin-top: 10px; text-align: center; }
.pulse-label .short { font-family: var(--font-head); font-weight: 700; font-size: 11.5px; letter-spacing: 0.04em; color: rgba(255,255,255,0.5); transition: color 0.3s; }
.pulse-stage.active .pulse-label .short, .pulse-stage.done .pulse-label .short { color: white; }
.pulse-label .verb { display: block; font-size: 10.5px; color: #9FD9C8; height: 14px; margin-top: 1px; opacity: 0; transition: opacity 0.25s; }
.pulse-stage.active .pulse-label .verb { opacity: 1; }
.pulse-label .verb .dots span { animation: dotFade 1.2s infinite; opacity: 0; }
.pulse-label .verb .dots span:nth-child(2) { animation-delay: 0.2s; }
.pulse-label .verb .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotFade { 0%,100% { opacity: 0; } 50% { opacity: 1; } }

.pulse-status-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }
.pulse-status-text { font-size: 12.5px; font-weight: 600; color: #BEE0EC; }

/* --- STATE 2: nothing but the Run Visit call to action --- */
.run-stage { padding: 16px 0 4px; text-align: center; }
.run-stage-file {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted); margin: 0 0 16px;
  background: var(--mint-tint); color: var(--mint-dark); font-weight: 600;
  padding: 6px 14px; border-radius: var(--radius-pill); max-width: 100%;
}
.run-stage-file svg { width: 13px; height: 13px; flex-shrink: 0; }
.run-stage-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/*
  The play glyph is a ::before background, not a child <svg>: runVisit()
  sets btn.textContent while running, which would wipe a real child node.
*/
.run-btn-state {
  width: 100%;
  font-family: var(--font-body); font-weight: 700; font-size: 16px;
  padding: 18px 20px; border-radius: var(--radius-sm); border: none;
  background: var(--mint); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 2px 10px rgba(14,159,134,0.28);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.run-btn-state::before {
  content: ""; width: 17px; height: 17px; flex-shrink: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='5 3 19 12 5 21 5 3'/></svg>") center/contain no-repeat;
}
.run-btn-state:hover:not(:disabled) { background: var(--mint-dark); box-shadow: 0 4px 14px rgba(14,159,134,0.34); }
.run-btn-state:active:not(:disabled) { transform: scale(0.99); }
.run-btn-state:disabled { background: #E1E6EA; color: var(--muted-2); box-shadow: none; cursor: not-allowed; }
.link-btn {
  margin-top: 14px; background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600; color: var(--muted-2);
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--teal); }

/* --- STATE 4: SOAP result with the transcript directly below it --- */
.result-panel { padding: 22px; }
.transcript-section-inner { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }

/* --- Approval confirmation toast (additive UI after the real approve call) --- */
.toast {
  position: fixed; top: 22px; left: 50%;
  display: flex; align-items: center; gap: 11px;
  background: var(--card); color: var(--ink);
  border: 1px solid #C6EAE1;
  border-radius: var(--radius-pill);
  padding: 12px 20px 12px 14px;
  box-shadow: 0 10px 30px rgba(20,32,43,0.16);
  font-weight: 600; font-size: 13.5px;
  z-index: 1000; cursor: pointer;
  transform: translate(-50%, -18px) scale(0.94);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.2,.8,.25,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.toast-check {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--mint); display: flex; align-items: center; justify-content: center;
}
.toast-check svg { width: 15px; height: 15px; stroke: #fff; }
.toast.show .toast-check svg { animation: toastCheck 0.4s 0.1s cubic-bezier(.2,.8,.25,1) both; }
@keyframes toastCheck {
  0% { stroke-dasharray: 24; stroke-dashoffset: 24; }
  100% { stroke-dasharray: 24; stroke-dashoffset: 0; }
}

/* ================= CREATIVE REDESIGN — Patient Portal ================= */
/*
  Same pulse-brand language as the Doctor Portal, tuned warmer and calmer
  for a patient audience: softer surfaces, mint (not clinical teal) as the
  lead accent, gentle slow motion. Everything here is scoped to
  #view-patient so the Doctor Portal is untouched, and none of it changes
  a single real call — loadPatientTimeline still builds the line from the
  real GET /visits response, each node still calls the real
  showVisit(visitId), and Ask Nabd still posts to the real /ask_nabd.
*/

/* --- TASK 1 — Visit timeline as a real pulse-line journey --- */
.journey-card { padding: 20px 22px 22px; }
.journey-head { display: flex; align-items: flex-start; gap: 12px; }
.journey-head-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: var(--mint-tint); color: var(--mint-dark);
  display: flex; align-items: center; justify-content: center;
}
.journey-head-icon svg { width: 21px; height: 12px; }
.journey-title {
  margin: 2px 0 0; font-family: var(--font-head); font-weight: 600;
  font-size: 15px; color: var(--ink);
}
.journey-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

.journey-scroll {
  margin-top: 20px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px;
}
.journey-scroll::-webkit-scrollbar { height: 6px; }
.journey-scroll::-webkit-scrollbar-track { background: transparent; }
.journey-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.journey-row {
  position: relative; display: inline-flex; align-items: flex-start;
  padding: 10px 0 4px;
}
/* the heartbeat line that threads every visit together as "your care over time" */
.journey-line {
  position: absolute; left: 65px; right: 65px; top: 19px; height: 22px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='130' height='22' viewBox='0 0 130 22' fill='none'><path d='M0 11 H40 l4 -8 l5 15 l5 -13 l3 6 H130' stroke='%230E9F86' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") repeat-x left center;
  opacity: 0.32; pointer-events: none;
}
.jn-node {
  position: relative; z-index: 1; flex: 0 0 auto; min-width: 130px;
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); padding: 0 8px;
}
.jn-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--mint);
  box-shadow: 0 0 0 5px #fff; transition: transform 0.2s ease, border-color 0.2s ease;
}
.jn-node:hover .jn-dot { border-color: var(--mint-dark); transform: scale(1.14); }
.jn-node.selected .jn-dot {
  width: 20px; height: 20px; background: var(--mint); border-color: var(--mint);
  box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--mint-tint);
  animation: journeyPulse 2.8s ease-in-out infinite;
}
@keyframes journeyPulse {
  0%, 100% { box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--mint-tint); }
  50% { box-shadow: 0 0 0 5px #fff, 0 0 0 14px rgba(14,159,134,0.10); }
}
.jn-date {
  margin-top: 13px; font-size: 12px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.jn-node.selected .jn-date { color: var(--mint-dark); }
.jn-sub { margin-top: 2px; font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.jn-recent {
  margin-top: 7px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--mint-dark); background: var(--mint-tint);
  padding: 2px 8px; border-radius: var(--radius-pill);
}

/* --- TASK 2 — Visit summary as a message from your doctor --- */
#view-patient .visit-summary {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #F7FCFB 0%, #FFFFFF 55%);
  padding: 24px 26px 26px;
}
#view-patient .visit-summary::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--mint);
}
#view-patient .vs-head { align-items: flex-start; }
.vs-avatar {
  width: 48px; height: 48px; font-size: 16px;
  box-shadow: 0 3px 10px rgba(31,110,150,0.20);
}
.vs-spec { font-size: 12px; color: var(--teal-dark); margin: 1px 0 0; }
#view-patient .vs-head .who .name { font-size: 15px; }
#view-patient .vs-head .meta { margin: 2px 0 0; }
.vs-message { position: relative; margin-top: 18px; padding-left: 34px; }
.vs-quote {
  position: absolute; left: -2px; top: -10px;
  font-family: var(--font-head); font-weight: 700; font-size: 48px;
  color: var(--mint); opacity: 0.3; line-height: 1; user-select: none;
}
#view-patient .plain-summary {
  font-size: 16px; line-height: 1.8; color: var(--ink);
  max-width: 62ch; margin: 0; letter-spacing: 0.004em;
  /* the real patient_summary can carry paragraph breaks (\n\n) — keep them
     so a two-part note from the doctor reads as two paragraphs, not one run-on */
  white-space: pre-line;
}
.vs-signoff { margin: 16px 0 0; font-size: 13px; font-style: italic; color: var(--muted); }
.vs-message:has(.empty-state) { padding-left: 0; }
.vs-message:has(.empty-state) .vs-quote,
.vs-message:has(.empty-state) .vs-signoff { display: none; }

/* --- TASK 3 — Medications + appointment, light touches --- */
#view-patient .med-item { gap: 12px; }
#view-patient .med-item::before {
  content: ""; width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--mint-tint) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A7A68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.5 20.5 3.5 13.5a4.95 4.95 0 0 1 7-7l7 7a4.95 4.95 0 0 1-7 7Z'/><path d='m8.5 8.5 7 7'/></svg>") center/16px no-repeat;
}
#view-patient .med-item > div { flex: 1; }

#view-patient .appt-box { background: var(--mint-tint); }
#view-patient .appt-box .doc .spec { color: var(--mint-dark); }
#view-patient .appt-detail svg { color: var(--mint-dark); }
.appt-avatar-wrap { position: relative; flex-shrink: 0; line-height: 0; }
.appt-ping {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--mint); border: 2px solid var(--mint-tint);
}
.appt-ping::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--mint); opacity: 0;
  animation: apptPing 3s ease-out infinite;
}
@keyframes apptPing {
  0% { transform: scale(0.7); opacity: 0.55; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* --- TASK 4 — Ask Nabd: same component, warmer skin --- */
#view-patient .ask-card { border-radius: 16px; }
#view-patient .ask-icon { background: var(--mint); }
#view-patient .ask-header .s .dot-live { background: var(--mint); }
#view-patient .ask-thread { background: #F7FCFB; }
#view-patient .bubble.bot { background: #fff; border: 1px solid var(--border); }
#view-patient .bubble.user { background: var(--mint); }
#view-patient .bubble.intro { color: var(--muted); font-style: italic; background: var(--mint-tint); border: none; }
#view-patient .send-btn { background: var(--mint); }
#view-patient .ask-input-row input:focus { border-color: var(--mint); }

/* ================================================================
   SIDEBAR NAV PAGES — creative redesign
   Patient Search / Visit Queue / Recordings /
   My Visits / My Medications / Appointments
   Same pulse-brand language as the Dashboard: a two-column grid with
   a working left column and a side-stack of stat + info cards, plus
   pulse-line / gradient / heartbeat motifs. All data wiring unchanged.
   ================================================================ */

/* --- shared two-column page layout (the "right / left gaps") --- */
.page-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
  align-items: start;
}
@media (max-width: 1080px) {
  .page-grid { grid-template-columns: 1fr; }
  .page-grid .side-stack { flex-direction: row; flex-wrap: wrap; }
  .page-grid .side-stack > * { flex: 1 1 220px; }
}

/* --- shared side-stack building blocks --- */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px 14px; text-align: center;
}
.stat-card-wide { text-align: left; }
.stat-num {
  margin: 0; font-family: var(--font-head); font-weight: 700;
  font-size: 26px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-lbl { margin: 6px 0 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-2); }
.stat-card-teal { background: linear-gradient(135deg, var(--teal-dark), var(--teal)); border-color: transparent; }
.stat-card-teal .stat-num { color: #fff; }
.stat-card-teal .stat-lbl { color: #BEE0EC; }
.stat-card-mint .stat-num { color: var(--mint-dark); }
.stat-card-amber .stat-num { color: var(--amber); }

.info-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 16px 18px;
}
.info-card-h {
  margin: 0 0 10px; font-size: 12.5px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 7px;
}
.info-card-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); flex-shrink: 0; }
.info-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.info-card-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.info-card-list li { font-size: 12px; color: var(--muted); line-height: 1.55; padding-left: 16px; position: relative; }
.info-card-list li::before { content: ""; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.info-card-list b { color: var(--ink); font-weight: 600; }
.info-card-list .qpill { vertical-align: middle; }

.btn-block { width: 100%; justify-content: center; }
.btn-refresh { padding: 8px 14px; font-size: 12.5px; }
.btn-refresh svg { width: 13px; height: 13px; }
.card-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* honesty markers, shared */
.sample-tag { font-style: italic; font-weight: 500; font-size: 0.62em; color: var(--muted-2); letter-spacing: 0; }
h1.page-title .sample-tag { font-size: 14px; }
.sample-note { margin: 14px 0 0; font-size: 12px; font-style: italic; color: var(--muted-2); }

.dir-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--radius-pill);
}
.dir-badge-real { background: var(--mint-tint); color: var(--mint-dark); }
.dir-badge-mock { background: var(--bg-app); color: var(--muted); border: 1px dashed var(--muted-2); }

.qpill { font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); text-transform: capitalize; }
.qpill.q-approved { background: var(--mint-tint); color: var(--mint-dark); }
.qpill.q-draft { background: var(--amber-tint); color: var(--amber); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

.care-team-card { padding: 16px 18px; }
.care-team-h { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); }
.care-team-list { display: flex; flex-direction: column; gap: 12px; }
.care-team-row { display: flex; align-items: center; gap: 10px; }
.care-team-name { margin: 0; font-weight: 600; font-size: 13px; color: var(--ink); }
.care-team-spec { margin: 1px 0 0; font-size: 11.5px; color: var(--muted-2); }

/* ---------------- PATIENT SEARCH ---------------- */
.search-hero {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
  border-radius: var(--radius-card); padding: 16px 22px 16px 18px;
  position: relative; overflow: hidden;
}
.search-hero::after {
  content: ""; position: absolute; top: -40%; right: -6%; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 70%); pointer-events: none;
}
.search-hero-ring { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.search-hero-pulse {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5);
  animation: pulseRing 2.6s ease-out infinite; opacity: 0;
}
.search-hero-pulse.d1 { animation-delay: 1.3s; }
.search-hero-core {
  position: absolute; inset: 6px; border-radius: 50%; background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center;
}
.search-hero-core svg { width: 20px; height: 20px; }
.search-hero-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-head); font-weight: 600; font-size: 17px; color: #fff; padding: 0;
}
.search-hero-input::placeholder { color: rgba(255,255,255,0.55); font-weight: 500; }
.search-count { margin: 12px 2px 4px; font-size: 12px; color: var(--muted-2); }

.dir-group { margin-top: 18px; }
.dir-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dir-group-hint { font-size: 11.5px; color: var(--muted-2); }
.dir-list { display: flex; flex-direction: column; gap: 8px; }

.dir-row {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; text-align: left; font-family: var(--font-body);
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.dir-row-real:hover {
  border-color: var(--mint); background: var(--mint-tint);
  transform: translateX(2px); box-shadow: -3px 0 0 0 var(--mint);
}
.dir-row-real:hover .dir-cta-arrow { transform: translateX(3px); }
.dir-cta-arrow { display: inline-block; transition: transform 0.15s; }
.dir-row-mock { cursor: pointer; }
.dir-row-mock:hover { border-color: var(--muted-2); }
.dir-row-mock.is-tapped { border-style: dashed; background: var(--amber-tint); }
.dir-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--teal-tint); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: 13px;
}
.dir-avatar-mock { background: var(--bg-app); color: var(--muted-2); }
.dir-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dir-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.dir-id { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.dir-cta { font-size: 12px; font-weight: 600; color: var(--mint-dark); white-space: nowrap; display: inline-flex; gap: 4px; }
.dir-note { font-size: 11.5px; font-style: italic; color: var(--muted-2); white-space: nowrap; }
.dir-note.dir-note-shown { color: var(--amber); font-style: normal; font-weight: 700; }

/* ---------------- VISIT QUEUE — vertical pulse-line ---------------- */
.queue-card-creative { padding: 20px 22px; }
.qt-track { position: relative; margin-top: 6px; }
.qt-node { display: flex; gap: 16px; }
.qt-rail { position: relative; width: 14px; flex-shrink: 0; display: flex; justify-content: center; }
.qt-rail::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--border);
}
.qt-node:first-child .qt-rail::before { top: 16px; }
.qt-node:last-child .qt-rail::before { bottom: calc(100% - 16px); }
.qt-dot {
  position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; margin-top: 10px;
  background: #fff; border: 2px solid var(--muted-2); box-shadow: 0 0 0 4px var(--card);
}
.qt-draft .qt-dot { border-color: var(--amber); }
.qt-approved .qt-dot { border-color: var(--mint); background: var(--mint); }
.qt-newest .qt-dot {
  width: 15px; height: 15px; margin-top: 8px;
  animation: journeyPulse 2.8s ease-in-out infinite;
}
.qt-body { flex: 1; min-width: 0; padding-bottom: 16px; }
.qt-node:last-child .qt-body { padding-bottom: 2px; }
.qt-top {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; transition: border-color 0.15s, box-shadow 0.15s;
}
.qt-node:hover .qt-top { border-color: var(--teal); box-shadow: 0 2px 10px rgba(20,32,43,0.06); }
.q-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--teal-tint); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: 12.5px;
}
.qt-who { flex: 1; min-width: 0; }
.q-name { margin: 0; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.q-pid { font-weight: 500; font-size: 11.5px; color: var(--muted-2); margin-left: 6px; }
.q-meta { margin: 2px 0 0; font-size: 11.5px; color: var(--muted-2); }

/* ---------------- RECORDINGS — waveform cards ---------------- */
.rec-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.rec-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.rec-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--muted-2);
}
.rec-card.rec-approved::before { background: var(--mint); }
.rec-card.rec-draft::before { background: var(--amber); }
.rec-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rec-wave {
  flex: 1; display: flex; align-items: center; gap: 2px; height: 30px; overflow: hidden;
}
.rec-wave span {
  flex: 1; min-width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--teal), #6EE7D0); opacity: 0.55;
}
.rec-approved .rec-wave span { background: linear-gradient(180deg, var(--mint), #6EE7D0); }
.rec-card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.rec-chip {
  font-size: 11px; font-weight: 500; color: var(--muted);
  background: var(--bg-app); padding: 3px 9px; border-radius: var(--radius-pill);
}
.rec-chip-strong { color: var(--teal-dark); background: var(--teal-tint); font-weight: 700; }
.rec-transcript {
  cursor: pointer; font-size: 13px; color: var(--ink); line-height: 1.6;
  background: var(--bg-app); border-radius: var(--radius-sm); padding: 12px 14px;
}
.rec-clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-transcript.expanded .rec-clip { -webkit-line-clamp: unset; overflow: visible; }

/* ---------------- MY VISITS — letter cards ---------------- */
.mv-list { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.mv-card {
  position: relative; background: linear-gradient(180deg, #F7FCFB 0%, #FFFFFF 46%);
  border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 18px 20px 20px 24px; overflow: hidden;
}
.mv-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--mint); }
.mv-card-latest { box-shadow: 0 6px 20px rgba(14,159,134,0.10); }
.mv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mv-date { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--ink); }
.mv-time { font-family: var(--font-body); font-weight: 500; font-size: 12px; color: var(--muted-2); margin-left: 8px; }
.mv-meta { margin: 4px 0 0; font-size: 11.5px; color: var(--muted-2); }
.mv-label {
  margin: 14px 0 4px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted-2);
}
.mv-transcript {
  position: relative; margin: 0; font-size: 13.5px; color: var(--ink); line-height: 1.7;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px 14px 30px;
}
.mv-quote {
  position: absolute; left: 8px; top: 2px; font-family: var(--font-head); font-weight: 700;
  font-size: 30px; color: var(--mint); opacity: 0.32; line-height: 1; user-select: none;
}
.mv-plan { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.65; }

.mv-summary-card {
  text-align: center; padding: 22px 18px;
  background: linear-gradient(160deg, var(--mint-tint), #fff);
}
.mv-summary-icon { color: var(--mint-dark); display: block; }
.mv-summary-icon svg { width: 68px; height: 20px; margin: 0 auto; }
.mv-summary-num {
  margin: 10px 0 0; font-family: var(--font-head); font-weight: 700; font-size: 34px;
  line-height: 1; color: var(--mint-dark);
}
.mv-summary-lbl { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.mv-summary-recent { margin: 10px 0 0; font-size: 11.5px; font-weight: 600; color: var(--mint-dark); }

/* ---------------- MY MEDICATIONS — pill cards ---------------- */
.medx-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.medx-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 14px 16px;
}
.medx-pill {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--mint-tint); color: var(--mint-dark);
  display: flex; align-items: center; justify-content: center;
}
.medx-pill svg { width: 20px; height: 20px; }
.medx-body { flex: 1; min-width: 0; }
.medx-name { margin: 0; font-weight: 600; font-size: 14px; color: var(--ink); }
.medx-dose { font-family: var(--font-body); font-weight: 500; font-size: 12px; color: var(--muted-2); margin-left: 6px; }
.medx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 5px; }
.medx-chip {
  font-size: 11px; font-weight: 500; color: var(--teal-dark);
  background: var(--teal-tint); padding: 3px 9px; border-radius: var(--radius-pill);
}
.medx-chip-muted { color: var(--muted-2); background: var(--bg-app); }
.medx-prescriber { margin: 0; font-size: 11.5px; color: var(--muted-2); }
.medx-card .pill-active { flex-shrink: 0; align-self: flex-start; }

.sample-callout {
  background: var(--amber-tint); border: 1px solid #F0DCB3; border-radius: var(--radius-card);
  padding: 16px 18px;
}
.sample-callout-icon { color: var(--amber); display: block; }
.sample-callout-icon svg { width: 22px; height: 22px; }
.sample-callout-h { margin: 8px 0 4px; font-weight: 700; font-size: 13px; color: var(--amber); }
.sample-callout-b { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

.med-spec-list { display: flex; flex-direction: column; gap: 8px; }
.med-spec-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.med-spec-n {
  font-weight: 700; font-size: 11px; color: var(--mint-dark);
  background: var(--mint-tint); padding: 2px 8px; border-radius: var(--radius-pill);
}

/* ---------------- APPOINTMENTS — featured + timeline ---------------- */
.appt-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
  border-radius: var(--radius-card); padding: 22px 24px; color: #fff; margin-top: 12px;
}
.appt-hero-glow {
  position: absolute; top: -50%; right: -8%; width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%); pointer-events: none;
}
.appt-hero-when {
  margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 18px;
  display: flex; align-items: baseline; gap: 12px;
}
.appt-hero-when span { font-size: 13px; font-weight: 500; color: #BEE0EC; }
.appt-hero-doc { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; }
.appt-hero-name { margin: 0; font-weight: 600; font-size: 14px; }
.appt-hero-spec { margin: 1px 0 0; font-size: 12px; color: #BEE0EC; }
.appt-hero-kind {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  background: rgba(255,255,255,0.16); padding: 5px 12px; border-radius: var(--radius-pill);
}
.appt-hero .appt-avatar-wrap .avatar { background: rgba(255,255,255,0.18); color: #fff; }
.appt-hero .appt-ping { background: var(--mint); border-color: var(--teal-dark); }

.appt-timeline { position: relative; margin-top: 12px; }
.appt-node { display: flex; gap: 16px; }
.appt-node-rail { position: relative; width: 12px; flex-shrink: 0; display: flex; justify-content: center; }
.appt-node-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--border); }
.appt-node:first-child .appt-node-rail::before { top: 14px; }
.appt-node:last-child .appt-node-rail::before { bottom: calc(100% - 14px); }
.appt-node-dot {
  position: relative; z-index: 1; width: 10px; height: 10px; border-radius: 50%; margin-top: 9px;
  background: #fff; border: 2px solid var(--muted-2); box-shadow: 0 0 0 4px var(--bg-app);
}
.appt-node-body { flex: 1; min-width: 0; padding-bottom: 16px; }
.appt-node:last-child .appt-node-body { padding-bottom: 0; }
.appt-node-when { margin: 4px 0 0; font-weight: 600; font-size: 13px; color: var(--ink); }
.appt-node-when span { font-weight: 500; color: var(--muted-2); }
.appt-node-doc { margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.appt-kind {
  font-size: 11px; font-weight: 600; color: var(--teal-dark);
  background: var(--teal-tint); padding: 4px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
#view-patient-appts .appt-kind { background: var(--mint-tint); color: var(--mint-dark); }

@media (max-width: 720px) {
  .dir-row { flex-wrap: wrap; }
  .stat-row, .stat-row-3 { grid-template-columns: 1fr 1fr; }
}
