/* ============================================================
   Tether — Clinical Handover Intelligence
   Design System v2  |  Brand tokens + full component library
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* --- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Brand palette */
  --tether-primary: #0A2540;   /* deep navy — authority        */
  --tether-accent:  #00C2A8;   /* teal — the bridge/connection */
  --tether-alert:   #E5342A;   /* urgent red                   */
  --tether-warn:    #F5A623;   /* amber — pending              */
  --tether-safe:    #00875A;   /* green — complete             */
  --tether-light:   #F0FAFA;   /* teal tint background         */
  --tether-mid:     #E6EEF4;   /* cool grey panels             */
  --tether-text:    #1C2B39;   /* near-black text              */
  --tether-muted:   #6B7E8F;   /* secondary text               */
  --tether-border:  #D0DDE8;   /* borders                      */

  /* Typography */
  --font-main: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* ── Semantic aliases (keep existing components working) ── */
  --navy:        var(--tether-primary);
  --navy-mid:    #0D3060;
  --navy-light:  #1A4A7A;
  --teal:        var(--tether-accent);
  --teal-dark:   #009E8C;
  --teal-light:  var(--tether-light);
  --white:       #FFFFFF;
  --grey-50:     #F8FAFC;
  --grey-100:    var(--tether-mid);
  --grey-200:    var(--tether-border);
  --grey-400:    #9BAEBB;
  --grey-600:    var(--tether-muted);
  --grey-800:    var(--tether-text);
  --danger:      var(--tether-alert);
  --warning:     var(--tether-warn);
  --success:     var(--tether-safe);
  --font-sans:   var(--font-main);

  /* Spacing & shape */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  /* Shadows use primary colour tint */
  --shadow-sm:  0 1px 3px  rgba(10, 37, 64, 0.08);
  --shadow-md:  0 4px 12px rgba(10, 37, 64, 0.12);
  --shadow-lg:  0 8px 28px rgba(10, 37, 64, 0.16);

  --transition: 0.2s ease;
}

/* ============================================================
   BASE
   ============================================================ */
html, body {
  height: 100%;
  font-family: var(--font-main);
  font-size: 15px;
  color: var(--tether-text);
  background: var(--tether-light);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

/* ============================================================
   LAYOUT
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 28px 24px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  /* Both sticky bars: 60px nav + 30px sub-bar */
  scroll-margin-top: 90px;
}

/* ============================================================
   NAVIGATION — Primary bar
   ============================================================ */
.nav {
  background: var(--tether-primary);
  color: var(--white);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(10,37,64,0.4);
}

/* ── Left: brand ─────────────────────────────────────────── */
.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
  flex-shrink: 0;
}

.nav__brand svg { flex-shrink: 0; }

.nav__brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}

.nav__wordmark {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 3.5px;
  color: var(--white);
}

.nav__tagline {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Centre: live status pill ────────────────────────────── */
.nav__centre {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav__status-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 99px;
  padding: 6px 18px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.nav__pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tether-accent);
  flex-shrink: 0;
  animation: navPulse 2.4s ease-in-out infinite;
}

.nav__pulse-dot--error {
  background: var(--tether-alert);
  animation: none;
}

@keyframes navPulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(0, 194, 168, 0.7); }
  50%       { box-shadow: 0 0 0 6px rgba(0, 194, 168, 0);   }
}

.nav__stat {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.75);
}

.nav__stat strong {
  color: var(--white);
  font-weight: 700;
  font-size: 0.875rem;
}

.nav__stat--urgent strong  { color: var(--tether-warn); }
.nav__stat--sync           { color: var(--tether-accent); font-weight: 600; font-size: 0.75rem; }

.nav__stat-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

/* ── Right: user + actions ───────────────────────────────── */
.nav__right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.nav__user-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1;
  margin-right: 2px;
}

.nav__user-name  { font-size: 0.85rem; font-weight: 600; color: var(--white); }
.nav__trust-name { font-size: 0.65rem; color: rgba(255, 255, 255, 0.45); white-space: nowrap; }

.nav__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tether-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--tether-primary);
  flex-shrink: 0;
}

.nav__icon-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.75);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.nav__icon-btn:hover            { background: rgba(255,255,255,0.14); color: var(--white); }
.nav__icon-btn:focus-visible    { outline: 2px solid var(--tether-accent); outline-offset: 2px; }
.nav__icon-btn--signout         { border-color: transparent; background: transparent; color: rgba(255,255,255,0.45); }
.nav__icon-btn--signout:hover   { background: rgba(229,52,42,0.18); color: var(--tether-alert); }

.nav__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--tether-alert);
  color: var(--white);
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1.5px solid var(--tether-primary);
}

/* ============================================================
   NAVIGATION — Secondary status bar
   ============================================================ */
.nav-sub {
  background: #071E35;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 30px;
  position: sticky;
  top: 60px;
  z-index: 99;
  font-size: 0.75rem;
  gap: 0;
  overflow: hidden;
}

.nav-sub__date {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-sub__sep {
  width: 1px;
  height: 13px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 14px;
  flex-shrink: 0;
}

.nav-sub__shift {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 9px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-sub__shift--day   { background: rgba(245,166,35,0.18);  color: var(--tether-warn);   }
.nav-sub__shift--night { background: rgba(0,194,168,0.14);   color: var(--tether-accent); }

.nav-sub__ai {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
  overflow: hidden;
  min-width: 0;
}

.nav-sub__ai span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   TABS — v2
   ============================================================ */

/* Sticky wrapper — sits below nav (60px) + sub-bar (30px) */
.tabs-bar-wrap {
  background: var(--white);
  border-bottom: 2px solid var(--tether-border);
  margin: -28px -24px 28px;   /* bleed to main-content edges  */
  padding: 0 24px;
  box-shadow: 0 2px 10px rgba(10,37,64,0.06);
}

.tabs-bar-wrap--sticky {
  position: sticky;
  top: 90px;                  /* 60px nav + 30px sub-bar      */
  z-index: 90;
}

/* Scrollable row of tab buttons */
.tabs-bar {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-bar::-webkit-scrollbar { display: none; }

/* Individual tab button */
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 14px 18px;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  background: none;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tether-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color var(--transition), border-color var(--transition),
              background var(--transition);
  flex-shrink: 0;
}

.tab:hover               { color: var(--tether-primary); }
.tab:focus-visible       { outline: 2px solid var(--tether-accent); outline-offset: -2px; }

.tab--active {
  color: var(--tether-primary);
  border-bottom-color: var(--tether-accent);
  font-weight: 700;
}

/* Action tab (+ New Summary) */
.tab--action {
  color: var(--tether-accent);
  margin-left: auto;
  font-weight: 700;
}
.tab--action:hover           { background: rgba(0,194,168,0.06); }
.tab--action.tab--active     { border-bottom-color: var(--tether-accent); }

/* Badge counts */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 5px;
  line-height: 1;
  background: rgba(0,194,168,0.14);
  color: var(--tether-accent);
  transition: background var(--transition);
}

.tab--active .tab-badge          { background: rgba(0,194,168,0.20); }

.tab-badge--urgent               { background: rgba(229,52,42,0.12); color: var(--tether-alert); }
.tab--active .tab-badge--urgent  { background: rgba(229,52,42,0.18); }

/* Panels */
.tab-panels { min-height: 200px; }
.tab-panel  { display: none; }
.tab-panel--active { display: block; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--tether-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.kpi-card__value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--tether-primary);
  line-height: 1;
}

.kpi-card__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--tether-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-card--warn  .kpi-card__value { color: var(--tether-warn);  }
.kpi-card--alert .kpi-card__value { color: var(--tether-alert); }
.kpi-card--safe  .kpi-card__value { color: var(--tether-safe);  }

/* ============================================================
   SYNC PANEL (Hospital Sync tab)
   ============================================================ */
.sync-info-list { display: flex; flex-direction: column; gap: 10px; }

.sync-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.85rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--tether-border);
}
.sync-row:last-child { border-bottom: none; padding-bottom: 0; }

.sync-log {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.9;
  color: var(--tether-muted);
}
.sync-log__line { display: flex; align-items: baseline; gap: 8px; }
.sync-log__ok   { color: var(--tether-safe);  flex-shrink: 0; }
.sync-log__warn { color: var(--tether-warn);  flex-shrink: 0; }

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr; }
  .tab { padding: 12px 14px; font-size: 0.82rem; }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  border: 1px solid var(--tether-border);
}

.card--tint {
  background: var(--tether-light);
  border-color: rgba(0, 194, 168, 0.20);
}

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

.card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tether-primary);
}

.card__subtitle {
  font-size: 0.8rem;
  color: var(--tether-muted);
  margin-top: 2px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--tether-accent); outline-offset: 2px; }

.btn--primary {
  background: var(--tether-accent);
  color: var(--tether-primary);
}
.btn--primary:hover:not(:disabled) {
  background: var(--teal-dark);
  box-shadow: 0 2px 8px rgba(0, 194, 168, 0.35);
}

.btn--navy {
  background: var(--tether-primary);
  color: var(--white);
}
.btn--navy:hover:not(:disabled) { background: var(--navy-mid); }

.btn--secondary {
  background: var(--white);
  color: var(--tether-text);
  border: 1px solid var(--tether-border);
}
.btn--secondary:hover:not(:disabled) { background: var(--tether-mid); }

.btn--ghost {
  background: transparent;
  color: var(--tether-accent);
  border: 1px solid var(--tether-accent);
}
.btn--ghost:hover:not(:disabled) { background: rgba(0, 194, 168, 0.08); }

.btn--danger {
  background: var(--tether-alert);
  color: var(--white);
}
.btn--danger:hover:not(:disabled) { background: #C9251C; }

.btn--sm  { padding: 5px 12px; font-size: 0.8rem; }
.btn--lg  { padding: 11px 24px; font-size: 1rem; }
.btn--icon { padding: 7px; border-radius: var(--radius-sm); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Semantic status badges */
.badge--alert   { background: #FDDCDA; color: #B5150D; }
.badge--warn    { background: #FEF0D0; color: #A66200; }
.badge--safe    { background: #C6EFE1; color: #005733; }
.badge--accent  { background: #D6F5F1; color: #007A6A; }
.badge--primary { background: var(--tether-primary); color: var(--white); }
.badge--muted   { background: var(--tether-mid); color: var(--tether-muted); }

/* Legacy aliases */
.badge--teal    { background: #D6F5F1; color: #007A6A; }
.badge--navy    { background: var(--tether-primary); color: var(--white); }
.badge--success { background: #C6EFE1; color: #005733; }
.badge--warning { background: #FEF0D0; color: #A66200; }
.badge--danger  { background: #FDDCDA; color: #B5150D; }
.badge--grey    { background: var(--tether-mid); color: var(--tether-muted); }

/* ============================================================
   STATUS INDICATORS
   ============================================================ */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--alert   { background: var(--tether-alert); }
.status-dot--warn    { background: var(--tether-warn); }
.status-dot--safe    { background: var(--tether-safe); }
.status-dot--accent  { background: var(--tether-accent); }
.status-dot--muted   { background: var(--tether-muted); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--tether-muted);
  letter-spacing: 0.2px;
}

input, select, textarea {
  padding: 9px 13px;
  border: 1px solid var(--tether-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: var(--font-main);
  color: var(--tether-text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--tether-accent);
  box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.15);
}

input::placeholder, textarea::placeholder { color: var(--tether-muted); opacity: 0.65; }
textarea { resize: vertical; min-height: 88px; }
select   { cursor: pointer; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--tether-border);
}

.modal--wide { max-width: 780px; }

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

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tether-primary);
}

.modal__subtitle {
  font-size: 0.82rem;
  color: var(--tether-muted);
  margin-top: 3px;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--tether-muted);
  line-height: 1;
  flex-shrink: 0;
  padding: 0 4px;
  transition: color var(--transition);
}
.modal__close:hover { color: var(--tether-text); }

.modal__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--tether-border);
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--tether-primary);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  border-left: 4px solid var(--tether-accent);
}

.toast--success { background: var(--tether-primary); border-left-color: var(--tether-safe); }
.toast--error   { background: var(--tether-primary); border-left-color: var(--tether-alert); }
.toast--warning { background: var(--tether-primary); border-left-color: var(--tether-warn); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-header__title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--tether-primary);
  line-height: 1.2;
}

.page-header__sub {
  font-size: 0.875rem;
  color: var(--tether-muted);
  margin-top: 4px;
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--tether-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--tether-mid);
  color: var(--tether-muted);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--tether-border);
}

tbody tr {
  border-bottom: 1px solid var(--tether-border);
  transition: background var(--transition);
  cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--tether-light); }

tbody td {
  padding: 12px 16px;
  color: var(--tether-text);
  vertical-align: middle;
}

/* ============================================================
   AI PANEL
   ============================================================ */
.ai-panel {
  background: linear-gradient(135deg, var(--tether-primary) 0%, #0D3A5C 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--white);
}

.ai-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ai-panel__icon {
  width: 32px;
  height: 32px;
  background: var(--tether-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--tether-primary);
  font-weight: 700;
  flex-shrink: 0;
}

.ai-panel__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--white);
}

.ai-panel__subtitle {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
}

.ai-panel__output {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  white-space: pre-wrap;
  line-height: 1.65;
  min-height: 80px;
  border: 1px solid rgba(0, 194, 168, 0.20);
}

.ai-panel__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 194, 168, 0.3);
  border-top-color: var(--tether-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

/* ============================================================
   ALERT BANNERS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border-left: 4px solid;
}

.alert--alert   { background: #FFF0EF; border-color: var(--tether-alert); color: #8B1B16; }
.alert--warn    { background: #FFFBF0; border-color: var(--tether-warn);  color: #7A4800; }
.alert--safe    { background: #F0FBF6; border-color: var(--tether-safe);  color: #00542E; }
.alert--info    { background: var(--tether-light); border-color: var(--tether-accent); color: var(--tether-primary); }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-1           { gap: 4px; }
.gap-2           { gap: 8px; }
.gap-3           { gap: 12px; }
.gap-4           { gap: 16px; }
.gap-6           { gap: 24px; }
.mt-2            { margin-top: 8px; }
.mt-4            { margin-top: 16px; }
.mt-6            { margin-top: 24px; }
.mb-2            { margin-bottom: 8px; }
.mb-4            { margin-bottom: 16px; }
.text-xs         { font-size: 0.75rem; }
.text-sm         { font-size: 0.85rem; }
.text-lg         { font-size: 1.1rem; }
.text-muted      { color: var(--tether-muted); }
.text-accent     { color: var(--tether-accent); }
.text-alert      { color: var(--tether-alert); }
.text-safe       { color: var(--tether-safe); }
.font-bold       { font-weight: 700; }
.font-mono       { font-family: var(--font-mono); }
.w-full          { width: 100%; }
.truncate        { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider         { border: none; border-top: 1px solid var(--tether-border); margin: 20px 0; }
.grid-2          { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3          { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4          { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .nav { padding: 0 16px; gap: 12px; }
}

/* ============================================================
   LIVE DASHBOARD — Step 5
   ============================================================ */
.kpi-card--teal .kpi-card__value { color: var(--tether-accent); }

.kpi-card__trend {
  font-size: 0.72rem; font-weight: 600; margin-top: 5px;
  display: flex; align-items: center; gap: 3px;
}
.kpi-card__trend--up   { color: var(--tether-safe);  }
.kpi-card__trend--down { color: var(--tether-alert); }
.kpi-card__trend--flat { color: var(--tether-muted); }

@keyframes urgentPulse {
  0%,100% { opacity: 1;   }
  50%      { opacity: 0.5; }
}
.kpi-card__value--pulse { animation: urgentPulse 1.8s ease-in-out infinite; }

.dashboard-body {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1060px) { .dashboard-body { grid-template-columns: 1fr; } }

.risk-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; flex-shrink: 0;
}
.risk-dot--red   { background: var(--tether-alert); box-shadow: 0 0 5px rgba(229,52,42,0.55); }
.risk-dot--amber { background: var(--tether-warn);  }
.risk-dot--green { background: var(--tether-safe);  }

.sidebar-panel__head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  border-bottom: 1px solid var(--tether-border);
}
.sidebar-panel__head--urgent { background: rgba(229,52,42,0.06); color: var(--tether-alert); border-left: 3px solid var(--tether-alert); }
.sidebar-panel__head--amber  { background: rgba(245,166,35,0.06); color: #A66200;             border-left: 3px solid var(--tether-warn);  }
.sidebar-panel__head--sync   { background: rgba(0,194,168,0.06);  color: var(--tether-accent);border-left: 3px solid var(--tether-accent); }
.sidebar-panel__body { padding: 12px 14px; }

.sidebar-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--tether-border); font-size: 0.82rem;
}
.sidebar-item:last-child   { border-bottom: none; padding-bottom: 0; }
.sidebar-item__name        { font-weight: 600; color: var(--tether-primary); line-height: 1.3; }
.sidebar-item__detail      { color: var(--tether-muted); font-size: 0.74rem; margin-top: 2px; }

/* ── Step 7: Pending Results ────────────────────────────────── */
.result-card {
  border: 1px solid var(--tether-border);
  border-left: 3px solid var(--tether-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--white);
  transition: box-shadow var(--transition), border-left-color var(--transition);
}
.result-card:last-child { margin-bottom: 0; }
.result-card:hover { box-shadow: var(--shadow-md); }
.result-card--critical { border-left-color: var(--tether-alert); background: rgba(229,52,42,0.018); }
.result-card--owned    { border-left-color: var(--tether-accent); }

.result-card__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.result-card__test-name { font-size: 1rem; font-weight: 700; color: var(--tether-primary); }
.result-card__meta {
  display: flex; flex-wrap: wrap; gap: 6px 20px;
  font-size: 0.82rem; color: var(--tether-muted);
  margin-bottom: 10px;
}
.result-card__meta strong { color: var(--tether-primary); font-weight: 600; }
.result-card__note {
  font-size: 0.82rem; color: var(--tether-muted);
  padding: 7px 10px; background: var(--tether-surface);
  border-radius: 4px; margin-bottom: 12px;
  border-left: 2px solid var(--tether-border);
}
.result-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

@keyframes flashRed {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
.badge--flash { animation: flashRed 1.1s ease-in-out infinite; }

/* ── Step 6: Discharge Summaries ──────────────────────────── */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 14px; border-radius: 99px;
  border: 1px solid var(--tether-border); background: var(--white);
  font-family: var(--font-main); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; color: var(--tether-muted);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.filter-btn:hover   { border-color: var(--tether-accent); color: var(--tether-primary); }
.filter-btn--active { background: var(--tether-primary); color: var(--white); border-color: var(--tether-primary); }

.summary-row--acknowledged { box-shadow: inset 3px 0 0 var(--tether-safe);   }
.summary-row--pending      { box-shadow: inset 3px 0 0 var(--tether-warn);   }
.summary-row--sent         { box-shadow: inset 3px 0 0 var(--tether-accent); }
.summary-row--draft        { box-shadow: inset 3px 0 0 var(--tether-border); }

@keyframes amberPulse {
  0%,100% { box-shadow: 0 0 0 0   rgba(245,166,35,0.7); }
  50%      { box-shadow: 0 0 0 4px rgba(245,166,35,0);   }
}
.pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--tether-warn); flex-shrink: 0;
  animation: amberPulse 1.8s ease-in-out infinite;
}
/* ── Step 8: AI / New Summary ───────────────────────────── */
.ns-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 700px) { .ns-grid { grid-template-columns: 1fr; } }
.ai-output-textarea {
  width: 100%; box-sizing: border-box; min-height: 220px; padding: 12px 14px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; line-height: 1.6;
  border: 1px solid var(--tether-border); border-radius: var(--radius-md);
  resize: vertical; background: var(--white); color: var(--tether-text);
  transition: border-color var(--transition);
}
.ai-output-textarea:focus { outline: none; border-color: var(--tether-accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
.ai-spinner--dark { border-color: var(--tether-border); border-top-color: var(--tether-accent); }
.gp-suggestion {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid var(--tether-border); border-radius: var(--radius-md);
  background: var(--white); cursor: pointer;
  font-size: 0.82rem; color: var(--tether-text);
  transition: border-color var(--transition), background var(--transition);
}
.gp-suggestion:hover { border-color: var(--tether-accent); background: rgba(0,194,168,0.04); }
.gp-suggestion__num { font-weight: 700; color: var(--tether-accent); flex-shrink: 0; min-width: 18px; }
.gp-suggestion--added { border-color: var(--tether-safe); background: rgba(0,135,90,0.04); opacity: 0.65; pointer-events: none; }
.gp-suggestion--added .gp-suggestion__num { color: var(--tether-safe); }

/* ── Step 9: Patient Modal ───────────────────────────────── */
.pm-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(10,37,64,0.55); backdrop-filter: blur(3px);
  display: flex; align-items: stretch; justify-content: flex-end;
  animation: pmFadeIn 0.18s ease;
}
@keyframes pmFadeIn { from { opacity:0 } to { opacity:1 } }
.pm-modal {
  display: flex; flex-direction: column;
  width: 860px; max-width: 100%; height: 100%;
  background: var(--tether-bg); box-shadow: -4px 0 32px rgba(0,0,0,0.18);
  animation: pmSlideIn 0.2s ease;
}
@keyframes pmSlideIn { from { transform:translateX(40px);opacity:0 } to { transform:translateX(0);opacity:1 } }
.pm-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 18px; background: var(--tether-primary); flex-shrink: 0;
}
.pm-header__left { flex: 1; min-width: 0; }
.pm-name  { font-size: 1.35rem; font-weight: 700; color: #fff; line-height: 1.2; }
.pm-nhs   { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; color: rgba(255,255,255,0.7); margin-top: 3px; }
.pm-trust { font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-top: 2px; }
.pm-header__right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: 16px; }
.pm-risk-badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 20px; text-transform: uppercase;
}
.pm-risk-badge--critical { background: var(--tether-alert); color: #fff; }
.pm-risk-badge--atrisk   { background: var(--tether-warn);  color: #fff; }
.pm-risk-badge--safe     { background: var(--tether-safe);  color: #fff; }
.pm-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.7); font-size: 1.2rem; line-height: 1;
  padding: 4px 6px; border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.pm-close:hover { color: #fff; background: rgba(255,255,255,0.12); }
.pm-tabs {
  display: flex; overflow-x: auto; flex-shrink: 0;
  background: var(--tether-primary); padding: 0 16px;
  border-bottom: 2px solid rgba(255,255,255,0.12);
  scrollbar-width: none;
}
.pm-tabs::-webkit-scrollbar { display: none; }
.pm-tab {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.6); font-size: 0.78rem; font-weight: 500;
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.pm-tab:hover { color: rgba(255,255,255,0.9); }
.pm-tab--active { color: var(--tether-accent); border-bottom-color: var(--tether-accent); }
.pm-body  { flex: 1; overflow-y: auto; padding: 24px; }
.pm-panel { display: none; }
.pm-panel--active { display: block; }
.pm-footer {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--tether-border);
  background: var(--white); flex-shrink: 0;
}
.pm-footer__spacer { flex: 1; }
.pm-timeline { position: relative; padding-left: 22px; }
.pm-timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--tether-border);
}
.pm-tl-item { position: relative; padding: 0 0 18px 18px; }
.pm-tl-item::before {
  content: ''; position: absolute; left: -16px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--tether-border); background: var(--white);
}
.pm-tl-item--admission::before { background: var(--tether-accent); border-color: var(--tether-accent); }
.pm-tl-item--event::before     { background: var(--tether-warn);   border-color: var(--tether-warn);   }
.pm-tl-item--discharge::before { background: var(--tether-safe);   border-color: var(--tether-safe);   }
.pm-tl-item__date  { font-size: 0.72rem; color: var(--text-muted); font-family: 'IBM Plex Mono', monospace; }
.pm-tl-item__label { font-size: 0.85rem; font-weight: 600; margin-top: 1px; }
.pm-tl-item__note  { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.pm-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-bottom: 18px; }
.pm-info-item__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.pm-info-item__value { font-size: 0.88rem; }
.pm-fhir-code {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem;
  background: #f4f6f9; padding: 14px 16px; border-radius: var(--radius-md);
  overflow-x: auto; white-space: pre; color: var(--tether-text);
  border: 1px solid var(--tether-border); line-height: 1.6; margin: 0;
}
.pm-ai-textarea {
  width: 100%; box-sizing: border-box; min-height: 260px; padding: 14px;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; line-height: 1.6;
  border: 1px solid var(--tether-border); border-radius: var(--radius-md);
  resize: vertical; background: var(--white); color: var(--tether-text);
  transition: border-color var(--transition);
}
.pm-ai-textarea:focus { outline: none; border-color: var(--tether-accent); }
@media (max-width: 768px) {
  .pm-modal { width: 100%; }
  .pm-overlay { align-items: flex-end; }
  .pm-info-grid { grid-template-columns: 1fr; }
}

/* ── Step 10: Hospital Sync ──────────────────────────────── */
.hs-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 60px 24px; min-height: 400px;
}
.hs-empty__icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(0,194,168,0.1); display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}
.hs-empty__title { font-size: 1.25rem; font-weight: 700; color: var(--tether-text); margin-bottom: 8px; }
.hs-empty__sub { font-size: 0.88rem; color: var(--text-muted); max-width: 380px; margin-bottom: 28px; line-height: 1.6; }
.hs-identity-card {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  padding: 20px 24px; border-radius: var(--radius-lg); background: var(--white);
  border: 1px solid var(--tether-border); margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.hs-identity-card__main { flex: 1; min-width: 0; }
.hs-identity-card__name { font-size: 1.15rem; font-weight: 700; margin-bottom: 5px; }
.hs-identity-card__meta { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; color: var(--text-muted); }
.hs-identity-card__right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hs-identity-card__source { font-size: 0.78rem; color: var(--text-muted); text-align: right; }
.hs-identity-card__ts { font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; color: var(--text-muted); }
.hs-cards-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .hs-cards-row { grid-template-columns: 1fr; } }
.hs-clinical-card { background: var(--white); border: 1px solid var(--tether-border); border-radius: var(--radius-lg); padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.hs-clinical-card__title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--tether-accent); margin-bottom: 3px; }
.hs-clinical-card__source { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 14px; }
.hs-narrative { font-size: 0.82rem; line-height: 1.65; color: var(--tether-text); margin-bottom: 14px; }
.hs-followup-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.hs-followup-step { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--tether-border); }
.hs-followup-step__num { font-weight: 700; color: var(--tether-accent); flex-shrink: 0; min-width: 16px; font-size: 0.8rem; }
.hs-followup-step__label { font-size: 0.82rem; font-weight: 600; }
.hs-followup-step__date { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; font-family: 'IBM Plex Mono', monospace; }
.hs-med-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--tether-border); }
.hs-med-row:last-child { border-bottom: none; }
.hs-med-row__name { font-size: 0.83rem; font-weight: 600; }
.hs-med-row__dose { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.hs-result-row { padding: 9px 0; border-bottom: 1px solid var(--tether-border); }
.hs-result-row:last-child { border-bottom: none; }
.hs-result-row__head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.hs-result-row__test { flex: 1; font-size: 0.82rem; font-weight: 600; }
.hs-result-row__body { font-size: 0.75rem; color: var(--text-muted); }

/* ── Step 12: Compose / New Summary ────────────────────── */
.compose { max-width: 900px; margin: 0 auto; padding-bottom: 48px; }

.compose-progress {
  display: flex; align-items: flex-start;
  padding: 18px 24px; background: #fff;
  border: 1px solid var(--tether-border); border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.compose-progress__step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative;
}
.compose-progress__step:not(:last-child)::after {
  content: ''; position: absolute; top: 13px; left: calc(50% + 16px);
  width: calc(100% - 32px); height: 2px;
  background: var(--tether-border); z-index: 0;
}
.compose-progress__step--done:not(:last-child)::after { background: var(--tether-safe); }
.compose-progress__dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; z-index: 1;
  border: 2px solid var(--tether-border); background: #fff; color: var(--text-muted);
  transition: var(--transition);
}
.compose-progress__step--active .compose-progress__dot {
  border-color: var(--tether-accent); background: var(--tether-accent); color: #fff;
}
.compose-progress__step--done .compose-progress__dot {
  border-color: var(--tether-safe); background: var(--tether-safe); color: #fff;
}
.compose-progress__label {
  font-size: 0.67rem; color: var(--text-muted); margin-top: 6px;
  text-align: center; white-space: nowrap;
}
.compose-progress__step--active .compose-progress__label { color: var(--tether-accent); font-weight: 600; }
.compose-progress__step--done   .compose-progress__label { color: var(--tether-safe);   font-weight: 600; }

.compose-section {
  background: #fff; border: 1px solid var(--tether-border);
  border-radius: var(--radius-md); margin-bottom: 16px; overflow: hidden;
}
.compose-section__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; background: var(--tether-surface);
  border-bottom: 1px solid var(--tether-border);
}
.compose-section__title    { font-size: 0.9rem; font-weight: 700; color: var(--tether-primary); }
.compose-section__subtitle { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.compose-section__body     { padding: 20px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.dyn-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.dyn-row {
  display: grid; gap: 8px; align-items: center;
  padding: 10px 12px; background: var(--tether-surface);
  border: 1px solid var(--tether-border); border-radius: var(--radius-sm);
}
.dyn-row--med { grid-template-columns: 2fr 1.2fr 1fr 2fr 28px; }
.dyn-row--inv { grid-template-columns: 2fr 1.2fr 1.8fr 28px; }
.dyn-row--gp  { grid-template-columns: 3fr 1.4fr 28px; }
.dyn-row input, .dyn-row select {
  font-size: 0.81rem; padding: 6px 8px;
  border: 1px solid var(--tether-border); border-radius: var(--radius-sm);
  background: #fff; color: var(--tether-primary); width: 100%; box-sizing: border-box;
}
.dyn-row input:focus, .dyn-row select:focus {
  outline: none; border-color: var(--tether-accent);
  box-shadow: 0 0 0 3px rgba(0,194,168,0.15);
}
.dyn-row__del {
  width: 28px; height: 28px; border: none; background: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: var(--transition); padding: 0;
}
.dyn-row__del:hover { background: #fde8e8; color: var(--tether-alert); }
.dyn-add {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.8rem; color: var(--tether-accent); font-weight: 600;
  cursor: pointer; border: none; background: none; padding: 4px 0;
}
.dyn-add:hover { color: var(--tether-primary); }

.compose-ai-strip {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--tether-border);
}
.compose-ai-result { font-size: 0.78rem; color: var(--text-muted); font-style: italic; flex: 1; }

.ns-draft-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.ns-draft-header-label { font-size: 0.78rem; font-weight: 600; color: var(--tether-primary); flex: 1; }
#ns-draft-textarea {
  width: 100%; min-height: 180px; resize: vertical; box-sizing: border-box;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.79rem; line-height: 1.55;
  border: 1px solid var(--tether-border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--tether-surface); color: var(--tether-primary);
}

.compose-validation   { font-size: 0.8rem; color: var(--tether-alert); margin-bottom: 10px; }
.compose-send-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ── Step 13: Mobile Responsiveness ─────────────────────── */
.nav__hamburger { display: none; }
.nav-drawer     { display: none; }

@media (max-width: 1060px) {
  .dashboard-body { grid-template-columns: 1fr; }
  .dashboard-sidebar {
    display: flex !important; flex-direction: row !important;
    overflow-x: auto; gap: 12px; padding: 0 4px 10px;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  }
  .dashboard-sidebar > * { min-width: 265px; max-width: 310px; flex-shrink: 0; scroll-snap-align: start; }
}

@media (max-width: 768px) {
  .main-content { padding: 16px; }
  .tabs-bar-wrap { margin: -16px -16px 16px; }
  .table-wrap { border: none; border-radius: 0; background: transparent; overflow-x: visible; }
  .table-wrap table { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: flex; flex-direction: column; gap: 10px; }
  .table-wrap tbody tr {
    display: block; background: var(--white);
    border: 1px solid var(--tether-border); border-radius: var(--radius-md);
    padding: 12px 14px; cursor: pointer;
    box-shadow: 0 1px 4px rgba(10,37,64,0.05);
    transition: box-shadow var(--transition);
  }
  .table-wrap tbody tr:hover { box-shadow: 0 3px 10px rgba(10,37,64,0.10); }
  .table-wrap tbody td {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 5px 0; border-bottom: 1px solid var(--tether-light); font-size: 0.83rem;
  }
  .table-wrap tbody td:last-child { border-bottom: none; }
  .table-wrap tbody td:empty  { display: none; }
  .table-wrap tbody td::before {
    content: attr(data-label);
    font-size: 0.68rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    min-width: 90px; flex-shrink: 0; padding-top: 2px;
  }
  .table-wrap tbody td:not([data-label])::before { display: none; }
  .card { padding: 16px; }
  .card__header { flex-wrap: wrap; }
  .kpi-row { gap: 10px; }
  .hs-cards-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .dyn-row--med, .dyn-row--inv, .dyn-row--gp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .dyn-row--med .med-drug, .dyn-row--inv .inv-test, .dyn-row--gp .gp-task { flex: 1 1 100%; }
  .dyn-row--med .med-change, .dyn-row--med .med-dose { flex: 1 1 calc(50% - 8px); }
  .dyn-row--med .med-reason { flex: 1 1 100%; }
  .dyn-row--inv .inv-date, .dyn-row--inv .inv-party { flex: 1 1 calc(50% - 8px); }
  .dyn-row--gp .gp-due { flex: 1 1 120px; }
  .dyn-row .dyn-row__del { flex: 0 0 28px; }
  .pm-overlay { align-items: stretch; }
  .pm-modal   { width: 100%; height: 100%; max-height: 100%; border-radius: 0; max-width: 100%; }
  .pm-header  { padding: 14px 16px; }
  .pm-body    { padding: 16px; -webkit-overflow-scrolling: touch; }
  .pm-info-grid { grid-template-columns: 1fr; }
  .pm-footer  { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .pm-footer .btn { flex: 1 1 auto; min-width: 100px; justify-content: center; }
  .btn { min-height: 44px; }
  .btn--sm { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
  .tab { min-height: 44px; display: flex; align-items: center; }
  .pm-tab { min-height: 44px; }
  .filter-btn { min-height: 38px; }
  .nav__icon-btn { width: 44px; height: 44px; }
  .dyn-row__del  { width: 36px; height: 36px; }
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 88vh; padding: 24px 16px; max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .nav { grid-template-columns: auto 1fr auto; padding: 0 12px; }
  .nav__centre    { display: none; }
  .nav__user-block { display: none; }
  .nav__icon-btn  { display: none; }
  .nav__hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; background: none; border: none;
    cursor: pointer; color: var(--white); font-size: 1.4rem;
    padding: 0; flex-shrink: 0; border-radius: var(--radius-sm);
    transition: background var(--transition);
  }
  .nav__hamburger:hover { background: rgba(255,255,255,0.08); }
  .nav-drawer {
    position: fixed; top: 90px; left: 0; right: 0; z-index: 98;
    background: var(--tether-primary);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  }
  .nav-drawer--open { display: flex; animation: drawer-in 0.22s ease; }
  .nav-drawer__status { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 16px 8px; }
  .nav-drawer__pill {
    font-size: 0.74rem; font-weight: 700; padding: 4px 10px;
    border-radius: 99px; background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.8);
  }
  .nav-drawer__pill--urgent { background: rgba(229,52,42,0.25); color: #ff8080; }
  .nav-drawer__pill--sync   { background: rgba(0,194,168,0.20);  color: var(--tether-accent); }
  .nav-drawer__user {
    padding: 8px 16px 14px; font-size: 0.84rem; color: rgba(255,255,255,0.65);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .nav-drawer__user strong { display: block; color: var(--white); font-size: 0.9rem; margin-bottom: 2px; }
  .nav-drawer__link {
    display: block; padding: 13px 16px; font-size: 0.88rem;
    color: rgba(255,255,255,0.75); background: none; border: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-align: left; width: 100%; cursor: pointer; font-family: inherit;
    transition: background 0.15s; min-height: 44px;
  }
  .nav-drawer__link:hover  { background: rgba(255,255,255,0.05); color: var(--white); }
  .nav-drawer__link--danger { color: #ff8080; }
  .nav-sub { padding: 0 12px; }
  .nav-sub__ai { display: none; }
  .main-content { padding: 12px; }
  .tabs-bar-wrap { margin: -12px -12px 12px; }
  .tab { padding: 10px 12px; font-size: 0.78rem; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .compose-progress { padding: 12px 10px; }
  .compose-progress__label { font-size: 0.58rem; }
  .modal { max-height: 95vh; }
  #toast-root { bottom: 12px; right: 12px; left: 12px; }
}

@keyframes drawer-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── App Footer ──────────────────────────────────────────── */
.app-footer {
  background: var(--tether-primary);
  color: rgba(255,255,255,0.35);
  font-size: 0.70rem;
  text-align: center;
  padding: 13px 24px;
  letter-spacing: 0.3px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-family: var(--font-main);
}
