@charset "UTF-8";
@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&display=swap");

[hidden] { display: none !important; }

:root {
  --teal: #09b8b6;
  --teal-2: #5dd6d4;
  --teal-3: #09b8b6;
  --cyan: #0e2e31;
  --blue: #2b7de9;
  --green: #2cc570;
  --amber: #f0b429;
  --red: #f06060;
  --ink: #e2f0ee;
  /* WCAG AA High Contrast for elderly & respiratory patients: #b0d8d6 (11.7:1 on #07191b, 10.5:1 on #0d2427) */
  --muted: #b0d8d6;
  --bg: #07191b;
  --surface: #0d2427;
  --surface-2: #112d30;
  --line: #1e3f42;
  --shadow: 0 24px 70px rgba(0, 0, 0, .45);
  --hero-grad-1: #072628;
  --hero-grad-2: #051618;
  color-scheme: dark;
  font-family: "Cairo", "Tajawal", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

html.hv-theme-dark body,
html[data-theme="dark"] body,
[data-theme="dark"],
body.dark {
  --bg: #07191b;
  --surface: #0d2427;
  --surface-2: #112d30;
  --surface-3: #16363a;
  --line: #1e3f42;
  --line-strong: #2c595d;
  --ink: #e2f0ee;
  --ink-secondary: #c4e3e0;
  /* WCAG AA High Contrast: #b0d8d6 (11.7:1 on #07191b, 10.5:1 on #0d2427, 9.5:1 on #112d30) */
  --muted: #b0d8d6;
  --cyan: #0e2e31;
  --shadow: 0 24px 70px rgba(0, 0, 0, .45);
  --teal: #09b8b6;
  --teal-2: #5dd6d4;
  --teal-3: #09b8b6;
  --green: #2cc570;
  --amber: #f0b429;
  --red: #f06060;

  /* Tri-Color Clinical Risk System Tokens (Dark Mode - Luminous & Comfortable) */
  --triage-green: #22c55e;
  --triage-green-text: #4ade80;
  --triage-green-bg: rgba(34, 197, 94, 0.16);
  --triage-green-border: rgba(74, 222, 128, 0.40);
  --triage-amber: #f59e0b;
  --triage-amber-text: #fbbf24;
  --triage-amber-bg: rgba(245, 158, 11, 0.18);
  --triage-amber-border: rgba(251, 191, 36, 0.45);
  --triage-red: #ef4444;
  --triage-red-text: #f87171;
  --triage-red-bg: rgba(239, 68, 68, 0.20);
  --triage-red-border: rgba(248, 113, 113, 0.45);

  --hero-grad-1: #072628;
  --hero-grad-2: #051618;
  --card-bg: #0d2427;
  --input-bg: #0a1f22;
  --input-border: #1e3f42;
  --input-color: #e2f0ee;
  --focus-ring: 0 0 0 3px rgba(9, 184, 182, 0.35);
  color-scheme: dark;
}

/* WCAG AA Light Theme Tokens: High contrast (>= 8.2:1) for elderly & respiratory patients */
html.hv-theme-light body,
html[data-theme="light"] body,
[data-theme="light"],
html:not(.hv-theme-dark) body:not(.dark),
body.light {
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-elevated: #ffffff;
  --line: #cbd5e1;
  --line-strong: #94a3b8;
  --ink: #0f172a;
  --ink-secondary: #1e293b;
  --muted: #334155;
  --cyan: #e6f6f5;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
  --teal: #0f766e;
  --teal-2: #0d6e67;
  --teal-3: #0f766e;
  --green: #15803d;
  --amber: #b45309;
  --red: #dc2626;

  /* Tri-Color Clinical Risk System Tokens (Light Mode - Deep & Sharp Contrast) */
  --triage-green: #16a34a;
  --triage-green-text: #15803d;
  --triage-green-bg: rgba(22, 163, 74, 0.12);
  --triage-green-border: rgba(22, 163, 74, 0.35);
  --triage-amber: #d97706;
  --triage-amber-text: #b45309;
  --triage-amber-bg: rgba(245, 158, 11, 0.12);
  --triage-amber-border: rgba(217, 119, 6, 0.35);
  --triage-red: #dc2626;
  --triage-red-text: #b91c1c;
  --triage-red-bg: rgba(239, 68, 68, 0.12);
  --triage-red-border: rgba(220, 38, 38, 0.35);

  --hero-grad-1: #f0fdfa;
  --hero-grad-2: #e0f2fe;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-color: #0f172a;
  --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.25);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(9, 184, 182, 0.45) rgba(13, 36, 39, 0.25);
}

html.hv-theme-light *,
body.light * {
  scrollbar-color: rgba(15, 118, 110, 0.45) rgba(226, 232, 240, 0.6);
}

/* ==========================================================================
   ✨ LUXURY CLINICAL CUSTOM SCROLLBAR DESIGN SYSTEM
   Universal, sleek, dynamic glowing scrollbar for all scrollable surfaces
   ========================================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background-color: transparent;
}

::-webkit-scrollbar-track {
  background: rgba(13, 36, 39, 0.4);
  border-radius: 999px;
  margin: 3px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(30, 63, 66, 0.25);
}

html.hv-theme-light ::-webkit-scrollbar-track,
body.light ::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.65);
  border: 1px solid rgba(203, 213, 225, 0.6);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #09b8b6 0%, #0d7f82 100%);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.25);
  min-height: 36px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.hv-theme-light ::-webkit-scrollbar-thumb,
body.light ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 2px 4px rgba(15, 23, 42, 0.1);
}

/* Glowing Hover State */
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2dd4bf 0%, #09b8b6 100%);
  border: 1.5px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 10px rgba(9, 184, 182, 0.65);
}

html.hv-theme-light ::-webkit-scrollbar-thumb:hover,
body.light ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 8px rgba(15, 118, 110, 0.45);
}

/* Active Dragging State */
::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #5eead4 0%, #14b8a6 100%);
  box-shadow: 0 0 14px rgba(94, 234, 212, 0.85);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Slim Scrollbar for Internal Containers, Dropdowns, Sidebars, Modals & Textareas */
.sidebar,
.sidebar-nav,
.nav-list,
.dropdown-menu,
.hv-select-dropdown,
.modal-body,
.hv-modal-body,
.drawer-content,
.patient-timeline-list,
.queue-scroll,
.table-responsive,
.card-scrollable,
textarea {
  scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.nav-list::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar,
.hv-select-dropdown::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.hv-modal-body::-webkit-scrollbar,
.drawer-content::-webkit-scrollbar,
.patient-timeline-list::-webkit-scrollbar,
.queue-scroll::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 9%, rgba(9, 184, 182, .18), transparent 28%),
    radial-gradient(circle at 8% 26%, rgba(24, 160, 88, .10), transparent 24%),
    linear-gradient(180deg, #061517 0%, var(--bg) 100%);
}

html.hv-theme-dark body,
body.dark {
  background:
    radial-gradient(circle at 88% 9%, rgba(9, 184, 182, .18), transparent 28%),
    radial-gradient(circle at 8% 26%, rgba(24, 160, 88, .10), transparent 24%),
    linear-gradient(180deg, #061517 0%, var(--bg) 100%) !important;
}

html.hv-theme-light body,
html:not(.hv-theme-dark) body:not(.dark),
body.light {
  background:
    radial-gradient(circle at 88% 9%, rgba(15, 118, 110, .08), transparent 28%),
    radial-gradient(circle at 8% 26%, rgba(21, 128, 61, .06), transparent 24%),
    linear-gradient(180deg, #f0fdfa 0%, var(--bg) 100%) !important;
  color: var(--ink) !important;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 1000000;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 10px;
  background: #ffffff;
  color: #073537;
  border: 2px solid var(--teal-2);
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .32);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(9, 184, 182, .46);
}

:where(button, .solid-button, .outline-button, .soft-button, .google-button, .nav-item, .icon-button, .lang-toggle, .theme-fab, .banner-btn, .filter-tab, .kpi-pill-btn, .legal-tab-btn, .verify-tab, .emergency-call-btn, a.nav-item) {
  min-width: 44px;
  min-height: 44px;
}

:where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 44px;
}

:where(input[type="checkbox"], input[type="radio"]) {
  min-width: 22px;
  min-height: 22px;
}

.is-hidden {
  opacity: 0;
  transform: translateY(8px);
}

html.hv-has-session #publicSite {
  display: none !important;
}

/* Permanent dark mode styling */
:root {
  color-scheme: dark;
}

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
  background:
    radial-gradient(circle at 50% 35%, rgba(9, 184, 182, .18), transparent 45%),
    linear-gradient(135deg, #061517, #0b2226);
  transition: opacity .35s ease, visibility .35s ease;
}

body:not(.dark) .loader {
  background:
    radial-gradient(circle at 50% 35%, rgba(231, 247, 247, .92), transparent 34%),
    linear-gradient(135deg, #f8ffff, #e8f6f3);
}

.loader.is-done {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

.loader-card {
  width: min(370px, calc(100vw - 38px));
  padding: 36px 28px;
  text-align: center;
  border-radius: 34px;
  background: rgba(13, 36, 39, .88);
  border: 1px solid rgba(30, 63, 66, .9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  backdrop-filter: blur(18px);
  animation: floatIn 1.01s ease both;
}

body:not(.dark) .loader-card {
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(220, 232, 232, .9);
  box-shadow: var(--shadow);
}

.loader-card h1 {
  margin: 14px 0 6px;
  color: var(--teal-2);
  font-size: 28px;
  direction: ltr;
}

.loader-card p {
  margin: 0;
  color: var(--muted);
}

.loader-media {
  width: 220px;
  height: 220px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: visible;
  background: radial-gradient(circle, rgba(9, 184, 182, .26) 0%, rgba(9, 184, 182, .06) 60%, transparent 75%);
  border: 1px solid rgba(93, 214, 212, .24);
  box-shadow: 0 0 45px rgba(9, 184, 182, .25);
  animation: floatIn .81s ease both;
}

.loader-logo {
  width: 180px;
  height: 180px;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 2;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 24px rgba(9, 184, 182, 0.6));
  animation: logoBreath 3.24s ease-in-out infinite;
}

@keyframes logoBreath {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 20px rgba(9, 184, 182, 0.45));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 32px rgba(9, 184, 182, 0.8));
  }
}

.loader-fallback-animation {
  position: absolute;
  inset: -8px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.loader-fallback-animation span {
  position: absolute;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  border: 1px solid rgba(9, 184, 182, .28);
  animation: loaderPulse 3.24s ease-in-out infinite;
}

.loader-fallback-animation span:nth-child(2) {
  animation-delay: .61s;
}

.loader-fallback-animation span:nth-child(3) {
  animation-delay: 1.22s;
}

body:not(.dark) .loader-media {
  background: radial-gradient(circle, rgba(0, 109, 111, .15) 0%, rgba(0, 109, 111, .03) 60%, transparent 75%);
  border-color: rgba(0, 109, 111, .2);
  box-shadow: 0 0 36px rgba(3, 72, 74, .16);
}

body:not(.dark) .loader-logo {
  filter: drop-shadow(0 4px 20px rgba(0, 109, 111, 0.3));
}

.loading-bar {
  height: 8px;
  background: #112d30;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 26px;
}

body:not(.dark) .loading-bar {
  background: #e2eeee;
}

.loading-bar span {
  display: block;
  width: 54%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
  animation: load 1.69s ease-in-out infinite;
}

@keyframes load {
  0% { transform: translateX(120%); }
  100% { transform: translateX(-190%); }
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loaderPulse {
  0% { opacity: .68; transform: scale(.65); }
  72%, 100% { opacity: 0; transform: scale(1.22); }
}

.logo-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.logo-xl {
  width: 104px;
  height: 104px;
  margin: 0 auto;
}

.logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.logo-mark rect { fill: var(--teal); }
.loader .logo-mark rect { fill: url(#hvGradient); }
.logo-mark path:first-of-type {
  fill: none;
  stroke: #fff;
  stroke-width: 7;
  stroke-linecap: round;
}
.logo-mark path:nth-of-type(2) {
  fill: none;
  stroke: #d8fffb;
  stroke-width: 6;
  stroke-linecap: round;
}
.logo-mark circle { fill: #fff; }

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  opacity: 0;
  z-index: 120;
  max-width: min(92vw, 640px);
  padding: 12px 16px;
  border-radius: 999px;
  color: white;
  background: #0f766e;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
  text-align: left;
}

.brand strong {
  display: block;
  color: var(--teal-2);
  font-size: 16px;
}

body.dark .brand strong { color: var(--ink); }

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* Logo image in brand areas */
.brand-logo {
  width: 58px;
  height: 42px;
  aspect-ratio: 58 / 42;
  object-fit: contain;
  border-radius: 0;
  flex-shrink: 0;
  background: transparent;
}

.sidebar .brand-logo {
  width: 58px;
  height: 42px;
  aspect-ratio: 58 / 42;
  border-radius: 0;
}

.report-logo {
  width: 74px;
  height: 54px;
  aspect-ratio: 74 / 54;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  border: 0;
  padding: 0;
}

.hero-brand-logo {
  display: block;
  width: min(260px, 72vw);
  height: auto;
  aspect-ratio: 1 / 1;
  max-height: 132px;
  object-fit: contain;
  object-position: left center;
  margin: 0 0 14px;
  border-radius: 0;
  mix-blend-mode: screen;
}

body[dir="rtl"] .hero-brand-logo {
  object-position: right center;
}

.site-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 60px;
  transition: opacity .45s ease, transform .45s ease;
}

.site-nav {
  position: sticky;
  top: 14px;
  z-index: 20;
  min-height: 64px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(3, 72, 74, .07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-nav .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.site-nav .brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.site-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.site-links a {
  color: var(--muted);
  font-weight: 700;
  font-size: 13.5px;
  min-height: 44px;
  padding: 0 11px;
  border-radius: 12px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  transition: background .2s ease, color .2s ease;
}

.site-links a:hover {
  background: var(--cyan);
  color: var(--teal);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.nav-actions button,
.nav-actions a {
  white-space: nowrap;
}

.nav-actions .solid-button,
.nav-actions .outline-button,
.nav-actions .soft-button {
  min-height: 44px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 12px;
}

/* --- Site Navigation & Responsive Hamburger Menu --- */
.site-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.site-hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.site-hamburger-btn:hover {
  background: var(--cyan);
  border-color: var(--teal);
}

.site-hamburger-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.site-hamburger-btn .hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  transform-origin: center;
}

.site-hamburger-btn.is-active .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-hamburger-btn.is-active .hamburger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.site-hamburger-btn.is-active .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav-drawer {
  display: none;
  width: 100%;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  flex-direction: column;
  gap: 12px;
  animation: siteDrawerSlideDown 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes siteDrawerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-nav.is-open .site-nav-drawer {
  display: flex !important;
}

.site-nav-drawer .drawer-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.site-nav-drawer .drawer-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.site-nav-drawer .drawer-links a:hover,
.site-nav-drawer .drawer-links a:active {
  background: var(--cyan);
  color: var(--teal);
}

.site-nav-drawer .drawer-links a .drawer-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.site-nav-drawer .drawer-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
  width: 100%;
}

.site-nav-drawer .drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.site-nav-drawer .drawer-actions button,
.site-nav-drawer .drawer-actions .drawer-action-btn,
.site-nav-drawer .drawer-actions .drawer-lang-btn,
.site-nav-drawer .drawer-actions .drawer-app-btn {
  width: 100% !important;
  min-height: 44px !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 12px !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  box-sizing: border-box !important;
}

body.dark .site-hamburger-btn {
  background: rgba(19, 29, 45, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark .site-nav-drawer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

body.dark .site-nav-drawer .drawer-links a:hover {
  background: rgba(14, 165, 164, 0.15);
}

body.dark .site-nav-drawer .drawer-divider {
  background: rgba(255, 255, 255, 0.08);
}

.hero-actions,
.trust-row,
.top-actions,
.doctor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.solid-button,
.outline-button,
.soft-button,
.ghost-button,
.danger-button,
.logout-button,
.chip,
.icon-button {
  min-height: 44px;
  border-radius: 15px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 900;
}

.solid-button {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #159e82);
  box-shadow: 0 12px 28px rgba(0, 109, 111, .18);
}

.outline-button {
  color: var(--teal);
  background: var(--surface);
  border-color: var(--line);
}

.soft-button,
.ghost-button,
.chip,
.icon-button {
  color: var(--teal);
  background: var(--cyan);
  border-color: color-mix(in srgb, var(--teal) 12%, var(--line));
}

.danger-button {
  color: var(--red);
  background: #fdecec;
}

.large { min-height: 52px; padding: 0 20px; }
.full { width: 100%; }

.site-hero {
  padding: 74px 4px 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .74fr);
  gap: 42px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cyan) 80%, white);
  color: var(--teal);
  font-weight: 900;
  font-size: 13px;
}

#patientHeroTitle {
  color: var(--teal-2);
  font-weight: 800;
}
body.dark #patientHeroTitle {
  color: #ffffff;
}

.hv-onboarding-strip .eyebrow {
  color: var(--teal-2);
  font-weight: 800;
}
body.dark .hv-onboarding-strip .eyebrow {
  color: #ffffff;
}

.hero-copy h1,
.site-section h2,
.app-hero h1,
.center-state h1,
.result-main h1 {
  margin: 14px 0 0;
  color: var(--teal-2);
  line-height: 1.08;
  letter-spacing: 0;
}

body.dark .hero-copy h1,
body.dark .site-section h2,
body.dark .app-hero h1,
body.dark .center-state h1,
body.dark .result-main h1 {
  color: var(--ink);
}

.hero-copy h1 {
  max-width: 780px;
  font-size: clamp(38px, 6vw, 74px);
}

.hero-copy p,
.site-section p,
.app-hero p,
.center-state p,
.result-main p {
  color: var(--muted);
  line-height: 1.85;
  font-weight: 500;
}

body:not(.dark) .hero-copy p,
body:not(.dark) .site-section p,
body:not(.dark) .app-hero p,
body:not(.dark) .center-state p,
body:not(.dark) .result-main p {
  color: #2e4d50;
  font-weight: 500;
}

.hero-copy p {
  max-width: 680px;
  margin: 18px 0 0;
  font-size: 18px;
}

.hero-actions { margin-top: 26px; }

.trust-row {
  margin-top: 20px;
  color: var(--muted);
}

.trust-row span {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.hero-product-card {
  min-height: 560px;
  position: relative;
  display: grid;
  place-items: center;
}

.hero-product-card::before {
  content: "";
  position: absolute;
  inset: 30px 8px;
  border-radius: 44px;
  background:
    linear-gradient(135deg, rgba(0,109,111,.14), rgba(24,160,88,.08)),
    rgba(255,255,255,.58);
  border: 1px solid var(--line);
  transform: rotate(-4deg);
}

.phone-frame {
  width: min(330px, 92%);
  position: relative;
  z-index: 1;
  padding: 12px;
  border-radius: 36px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: 0 28px 78px rgba(3, 72, 74, .14);
}

body.dark .phone-frame {
  background: #10272a;
  border: 1px solid var(--line);
  box-shadow: 0 28px 78px rgba(3, 72, 74, .20);
}

.phone-screen {
  min-height: 590px;
  border-radius: 27px;
  background: linear-gradient(180deg, #ffffff, #f1fbf9);
  padding: 22px;
  overflow: hidden;
}

body.dark .phone-screen {
  background: linear-gradient(180deg, #0c2225, #102b2e);
}

.mini-top,
.clinical-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.mini-top b,
.clinical-top b {
  color: var(--amber);
}

.breath-orb {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  margin: 54px auto 24px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, var(--surface-2) 0 38%, transparent 39%),
    conic-gradient(var(--teal), var(--green), var(--amber), var(--teal));
  animation: slowSpin 6s linear infinite;
}

.breath-orb span {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--cyan);
}

@keyframes slowSpin { to { transform: rotate(360deg); } }

.phone-screen h3 {
  color: var(--teal-2);
  margin: 0 0 8px;
  font-size: 24px;
}

body.dark .phone-screen h3 { color: var(--ink); }

.phone-screen p {
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 22px;
}

body:not(.dark) .phone-screen p,
body:not(.dark) .mini-top,
body:not(.dark) .mini-list span {
  color: #2e4d50 !important;
  font-weight: 600;
}

body.dark .phone-screen p,
body.dark .mini-top,
body.dark .mini-list span {
  color: var(--muted) !important;
  font-weight: 500;
}

.mini-list strong {
  font-weight: 700;
  color: var(--ink);
}

body:not(.dark) .mini-list strong {
  color: #07191b;
}

/* --- Hero Respiratory Assessment Interactive Card & Tour Prompt --- */
#heroRespiratoryCard {
  cursor: pointer;
  outline: none;
  border-radius: 40px;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), filter 0.28s ease, box-shadow 0.28s ease;
}

#heroRespiratoryCard:hover {
  transform: translateY(-4px) scale(1.01);
  filter: drop-shadow(0 16px 40px rgba(9, 184, 182, 0.25));
}

#heroRespiratoryCard:focus-visible {
  outline: 3px solid var(--teal-2);
  outline-offset: 6px;
}

.hero-tour-prompt {
  margin-top: 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(13, 148, 136, 0.24));
  border: 1.5px solid var(--teal);
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(9, 184, 182, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#heroRespiratoryCard:hover .hero-tour-prompt {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.32), rgba(13, 148, 136, 0.38));
  border-color: var(--teal-2);
  transform: scale(1.02);
}

.mini-list,
.summary-list,
.activity,
.records,
.queue,
.slot-list {
  display: grid;
  gap: 10px;
}

.mini-list div,
.summary-list div,
.clinical-row,
.report-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.mini-list span,
.summary-list span,
.clinical-row span,
.report-grid span {
  color: var(--muted);
}

.floating-card {
  position: absolute;
  z-index: 2;
  min-width: 132px;
  padding: 14px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  direction: ltr;
}

.floating-card b {
  display: block;
  color: var(--teal-2);
  font-size: 22px;
}

body.dark .floating-card b { color: var(--ink); }
.floating-card span { color: var(--muted); font-size: 12px; }
.card-a { top: 86px; right: 2px; }
.card-b { bottom: 88px; left: 0; }

.site-section {
  margin-top: 26px;
  padding: 32px;
  border-radius: 32px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 18px 45px rgba(3, 72, 74, .06);
}

.section-head h2,
.site-section h2 {
  font-size: clamp(28px, 4vw, 46px);
}

.workflow-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.workflow-grid article,
.role-stack div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-2);
}

.workflow-grid b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--teal);
  color: white;
}

.workflow-grid h3,
.panel h3 {
  color: var(--teal-2);
  margin: 12px 0 8px;
}

body.dark .workflow-grid h3,
body.dark .panel h3 {
  color: var(--ink);
}

.workflow-grid p { margin: 0; font-size: 14px; }

.split-section {
  display: grid;
  grid-template-columns: 1fr minmax(280px, .65fr);
  gap: 24px;
  align-items: center;
}

.role-stack {
  display: grid;
  gap: 10px;
}

.role-stack strong {
  display: block;
  color: var(--teal-2);
}

body.dark .role-stack strong { color: var(--ink); }
.role-stack span { color: var(--muted); }

.safety-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  background:
    linear-gradient(135deg, rgba(0,109,111,.95), rgba(24,160,88,.86)),
    var(--teal);
  color: white;
}

.safety-band h2,
.safety-band p,
.safety-band .eyebrow,
body:not(.dark) .safety-band h2,
body:not(.dark) .safety-band p,
body:not(.dark) .safety-band .eyebrow,
body.light .safety-band h2,
body.light .safety-band p,
body.light .safety-band .eyebrow {
  color: #ffffff !important;
}

.safety-band .eyebrow {
  background: rgba(255,255,255,.16);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: clamp(12px, 4vw, 24px);
  background: rgba(7, 23, 25, .36);
  backdrop-filter: blur(14px);
}

.auth-screen.open { display: grid; }

.auth-card {
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border-radius: 28px;
  padding: clamp(18px, 4vw, 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}

.close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  left: auto;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: all .2s ease;
}

.close-button:hover {
  background: var(--line);
  color: var(--ink);
}

.auth-brand { margin-bottom: 22px; }
.auth-card h2 { color: var(--teal-2); margin: 0 0 8px; font-size: 30px; }
body.dark .auth-card h2 { color: var(--ink); }
.auth-card p { color: var(--muted); line-height: 1.6; margin: 0 0 18px; }

.doctor-auth-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(9, 184, 182, 0.08);
  border: 1px solid rgba(9, 184, 182, 0.22);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

body.dark .doctor-auth-note {
  background: rgba(9, 184, 182, 0.12);
  border-color: rgba(9, 184, 182, 0.25);
  color: #cbd5e1;
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: stretch;
  gap: 5px;
  min-height: 58px;
  padding: 5px;
  border-radius: 17px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 14px;
  overflow: hidden;
}

.role-tabs button {
  min-width: 0;
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  line-height: 1;
  display: grid;
  place-items: center;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
}

.role-tabs button.active {
  background: var(--surface);
  color: var(--teal);
  box-shadow: 0 8px 20px rgba(3, 72, 74, .08);
}

.auth-mode-switch {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 14px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 800;
  font-size: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s ease;
  text-align: center;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--teal);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

body.dark .auth-tab.active {
  background: var(--surface);
  color: var(--teal);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

.auth-error-banner {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(214, 69, 69, .15);
  border: 1px solid rgba(214, 69, 69, .4);
  color: #ff6b6b;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.4;
  display: none;
}

.auth-card .form-group {
  margin-bottom: 12px;
}

.auth-card .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}

.auth-submit-btn {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.reset-success-box {
  padding: 14px;
  border-radius: 14px;
  background: rgba(44, 197, 112, 0.12);
  border: 1px solid rgba(44, 197, 112, 0.35);
  color: #2cc570;
  font-size: 13.5px;
  margin-bottom: 16px;
  line-height: 1.5;
  animation: floatIn 0.3s ease both;
}

body.dark .reset-success-box {
  background: rgba(44, 197, 112, 0.1);
  border-color: rgba(44, 197, 112, 0.3);
}

.back-link-btn {
  background: transparent;
  border: 0;
  color: var(--teal);
  cursor: pointer;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.back-link-btn:hover {
  background: var(--surface-2);
  color: var(--teal-3);
}

.verification-banner {
  margin: 14px 18px 0;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  animation: floatIn 0.35s ease both;
  z-index: 5;
}

body.dark .verification-banner {
  background: rgba(240, 180, 41, 0.1);
  border-color: rgba(240, 180, 41, 0.3);
}

.verification-banner.pulse-highlight {
  animation: bannerPulse 0.8s ease 3;
  border-color: var(--amber) !important;
  box-shadow: 0 0 24px rgba(240, 180, 41, 0.45);
}

@keyframes bannerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 240px;
}

.banner-icon {
  font-size: 22px;
  line-height: 1;
}

.banner-text strong {
  display: block;
  font-size: 13.5px;
  color: var(--amber);
  margin-bottom: 2px;
}

.banner-text p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-btn {
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 0;
}

.banner-btn.primary {
  background: var(--amber);
  color: #1a1a1a;
}

.banner-btn.primary:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.banner-btn.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.banner-btn.secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

.banner-btn.secondary:hover {
  background: var(--line);
}

.verify-tab {
  transition: all 0.2s ease;
}

.verify-tab:hover:not(.active) {
  background: var(--line) !important;
  color: var(--ink) !important;
}

.verify-tab.active {
  border-color: var(--teal) !important;
  background: rgba(14, 165, 233, 0.12) !important;
  color: var(--teal-2) !important;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2cc570;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}

.google-button {
  width: 100%;
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-g {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #4285f4;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 900;
  direction: ltr;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  margin: 18px 0;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-card label,
.form-panel label,
.doctor-layout label {
  display: block;
  color: var(--teal-2);
  font-weight: 900;
  margin: 14px 0 8px;
}

body.dark .auth-card label,
body.dark .form-panel label,
body.dark .doctor-layout label {
  color: var(--ink);
}

input,
textarea,
.choice {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 15px;
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 110px;
  padding-top: 12px;
  resize: vertical;
}

.auth-options {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.auth-options label {
  margin: 0;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-options input { width: auto; min-height: auto; }
.auth-options button { border: 0; background: transparent; color: var(--teal); font-weight: 800; }
.auth-note { font-size: 12px; margin-top: 14px !important; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(240px, 282px) minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  min-width: 0;
  align-items: stretch;
  transition: opacity .45s ease, transform .45s ease;
}

.sidebar,
.workspace,
.panel,
.metric-grid article,
.report-page,
.account-card {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(3, 72, 74, .06);
}

.sidebar {
  border-radius: 30px;
  padding: 18px;
  position: sticky;
  top: 22px;
  height: 100%;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  padding-inline: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 6px;
}

/* Section divider labels */
.nav-section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px 4px;
  border-top: 0;
  margin-top: 6px;
}

.nav-section-label:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: right;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .18s ease, color .18s ease;
}

html[dir="ltr"] .nav-item {
  text-align: left;
  flex-direction: row;
}

.nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .18s ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item:hover,
.nav-item.active {
  background: var(--cyan);
  color: var(--teal);
}

/* Expandable Navigation Category Group */
.nav-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.nav-group-header {
  position: relative;
  cursor: pointer;
  user-select: none;
  justify-content: flex-start;
}

.nav-group-header .nav-label {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-group-chevron {
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease;
  margin-inline-start: auto;
  padding: 2px;
}

.nav-group-header:hover .nav-group-chevron {
  opacity: 1;
}

.nav-group-header[aria-expanded="true"] .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-group-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-inline-start: 16px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.nav-group-children[hidden] {
  display: none !important;
}

.nav-sub-item {
  font-size: 13px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  position: relative;
  color: var(--muted);
}

.nav-sub-item .nav-icon {
  font-size: 14px;
  width: 20px;
}

.nav-sub-item::before {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 2px;
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: var(--line);
  transform: translateY(-50%);
  opacity: 0.6;
  transition: background 0.18s ease, opacity 0.18s ease, height 0.18s ease;
}

.nav-sub-item:hover::before,
.nav-sub-item.active::before {
  background: var(--teal);
  opacity: 1;
  height: 18px;
}

.account-card {
  margin-top: auto;
  border-radius: 20px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
}

.account-card > div:not(.avatar) {
  min-width: 0;
  flex: 1;
}

.account-card strong,
.account-card span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card strong {
  font-size: 13.5px;
}

.account-card span {
  color: var(--muted);
  font-size: 11px;
  direction: ltr;
}

.sidebar-account-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sidebar-account-actions button {
  flex: 1;
  min-height: 44px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.switch-account-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--teal);
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
}

.switch-account-button:hover {
  background: var(--cyan);
  border-color: var(--teal);
  transform: translateY(-1px);
}

body.dark .switch-account-button {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

body.dark .switch-account-button:hover {
  background: var(--surface);
  border-color: var(--teal);
  color: var(--teal);
}

.logout-button {
  color: var(--red);
  background: #fdecec;
  flex: 1;
  cursor: pointer;
  transition: all .2s ease;
}

.sidebar-account-actions .logout-button {
  margin-top: 0;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

body.dark .logout-button {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

body.dark .logout-button:hover {
  background: rgba(239, 68, 68, 0.22);
}

.sidebar-delete-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  opacity: 0.72;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 8px;
  margin-top: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 8px;
  transition: opacity .2s ease, background .2s ease;
}

.sidebar-delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.08);
}

/* Patient Settings & Data Deletion Pathway Animations */
@keyframes pathwayFocusGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
  }
  50% {
    box-shadow: 0 0 25px 6px rgba(239, 68, 68, 0.35);
    border-color: #dc2626;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    border-color: rgba(239, 68, 68, 0.35);
  }
}

.pathway-focus-pulse {
  animation: pathwayFocusGlow 2.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.patient-settings-tabs {
  scrollbar-width: thin;
}

.patient-settings-tab {
  transition: all 0.2s ease-in-out;
  font-family: inherit;
}

.patient-settings-tab:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.patient-settings-tab:active {
  transform: translateY(0);
}

/* Saved Accounts Quick Switcher in Auth Modal */
.saved-accounts-switcher {
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}

.saved-account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  text-align: start;
  transition: all .18s ease;
}

.saved-account-chip:hover {
  border-color: var(--teal);
  background: var(--cyan);
}

body.dark .saved-account-chip {
  background: var(--surface-2);
}

body.dark .saved-account-chip:hover {
  background: color-mix(in srgb, var(--teal) 15%, var(--surface-2));
}

.saved-account-chip .chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.saved-account-chip .chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.saved-account-chip .chip-info strong {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-account-chip .chip-info span {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}

.saved-account-chip .chip-arrow {
  color: var(--muted);
  font-size: 13px;
  transition: transform .18s ease;
}

.saved-account-chip:hover .chip-arrow {
  transform: translateX(-3px);
  color: var(--teal);
}

body[dir="ltr"] .saved-account-chip:hover .chip-arrow {
  transform: translateX(3px);
}

.workspace {
  border-radius: 32px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: 0 0 auto;
  min-height: 82px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand-logo {
  width: 40px;
  height: 29px;
  aspect-ratio: 40 / 29;
  object-fit: contain;
  flex-shrink: 0;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  direction: ltr;
}

.topbar h2 {
  margin: 2px 0 0;
  color: var(--teal-2);
  font-size: 24px;
}

body.dark .topbar h2 { color: var(--ink); }

.icon-button {
  width: 44px;
  padding: 0;
  display: none;
}

.avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--cyan);
  font-weight: 900;
  overflow: hidden;
}

.screen {
  display: none;
  padding: 22px;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  animation: screenIn .34s ease both;
}

.screen.active {
  display: block;
  flex: 1 1 auto;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-panel {
  border-radius: 30px;
  padding: 30px;
  color: var(--ink);
  display: grid;
  grid-template-columns: 1.35fr minmax(260px, .65fr);
  gap: 26px;
  align-items: center;
  overflow: hidden;
}

body.dark .hero-panel {
  color: white;
}

.app-hero {
  background: linear-gradient(135deg, var(--hero-grad-1), var(--hero-grad-2));
}

.app-hero h1 {
  color: var(--ink);
  font-size: clamp(30px, 5vw, 58px);
}

body.dark .app-hero h1 {
  color: white;
}

.app-hero p {
  color: var(--muted);
  max-width: 680px;
}

body.dark .app-hero p {
  color: rgba(255,255,255,.84);
}

.clinical-card {
  border-radius: 24px;
  padding: 18px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.app-orb {
  width: 120px;
  height: 120px;
  margin: 24px auto;
}

.clinical-note {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  color: #704900;
  background: #fff9ea;
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  margin-bottom: 24px;
  min-width: 0;
}

.metric-grid article {
  border-radius: 22px;
  padding: 18px;
  min-width: 0;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-grid span,
.metric-grid small {
  display: block;
  color: var(--muted);
}

.metric-grid strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--teal-2);
  font-size: clamp(26px, 2.2vw, 32px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

body.dark .metric-grid strong { color: var(--ink); }

.content-grid,
.form-layout,
.result-layout,
.doctor-layout,
.assistant-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: 24px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h3 { margin: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

/* Core Clinical Status & Triage Pills */
.pill.ok,
.pill.success { background: #e8f8ef; color: #0d7640; border: 1px solid rgba(13, 118, 64, 0.25); }
.pill.pending,
.pill.warning,
.pill.caution { background: #fff7e4; color: #8a5b07; border: 1px solid rgba(138, 91, 7, 0.25); }
.pill.info { background: #eaf3ff; color: #1f61b5; border: 1px solid rgba(31, 97, 181, 0.25); }
.pill.danger,
.pill.critical,
.pill.emergency { background: #fdecec; color: #b43030; border: 1px solid rgba(180, 48, 48, 0.25); }

/* Clinical State Machine Badges */
.pill.draft { background: #f1f5f9; color: #475569; }
.pill.submitted { background: #e0f2fe; color: #0369a1; }
.pill.triaged { background: #ede9fe; color: #6d28d9; }
.pill.assigned { background: #e0e7ff; color: #4338ca; }
.pill.under_review { background: #fef3c7; color: #b45309; }
.pill.more_info_requested { background: #ffedd5; color: #c2410c; }
.pill.approved { background: #dcfce7; color: #15803d; }
.pill.rejected { background: #fee2e2; color: #b91c1c; }
.pill.escalated { background: #ffe4e6; color: #be123c; }
.pill.closed { background: #f1f5f9; color: #475569; }

/* Dark Mode Pill Adaptations (High-Contrast Luminous Medical Colors) */
body.dark .pill.ok,
body.dark .pill.success,
html.hv-theme-dark .pill.ok,
html.hv-theme-dark .pill.success { background: rgba(34, 197, 94, 0.18); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.38); }
body.dark .pill.pending,
body.dark .pill.warning,
body.dark .pill.caution,
html.hv-theme-dark .pill.pending,
html.hv-theme-dark .pill.warning,
html.hv-theme-dark .pill.caution { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.42); }
body.dark .pill.info,
html.hv-theme-dark .pill.info { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.35); }
body.dark .pill.danger,
body.dark .pill.critical,
body.dark .pill.emergency,
html.hv-theme-dark .pill.danger,
html.hv-theme-dark .pill.critical,
html.hv-theme-dark .pill.emergency { background: rgba(239, 68, 68, 0.20); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.45); }

body.dark .pill.draft { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
body.dark .pill.submitted { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
body.dark .pill.triaged { background: rgba(168, 85, 247, 0.18); color: #c084fc; }
body.dark .pill.assigned { background: rgba(129, 140, 248, 0.18); color: #a5b4fc; }
body.dark .pill.under_review { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
body.dark .pill.more_info_requested { background: rgba(251, 146, 60, 0.18); color: #fdba74; }
body.dark .pill.approved { background: rgba(74, 222, 128, 0.18); color: #86efac; }
body.dark .pill.rejected { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }
body.dark .pill.escalated { background: rgba(251, 113, 133, 0.18); color: #fda4af; }
body.dark .pill.closed { background: rgba(100, 116, 139, 0.18); color: #94a3b8; }

/* Doctor Queue Status Filter Tabs */
.status-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.status-filter-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.status-filter-tab:hover {
  color: var(--ink);
  border-color: var(--teal);
}

.status-filter-tab.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

/* Doctor Actions Toolbar */
.doctor-actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn-clinical {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-clinical:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn-clinical:active {
  transform: translateY(0);
}

.btn-clinical.approve {
  background: #10b981;
  color: #fff;
}

.btn-clinical.request-info {
  background: #f59e0b;
  color: #fff;
}

.btn-clinical.escalate {
  background: #ef4444;
  color: #fff;
}

.btn-clinical.reject {
  background: #64748b;
  color: #fff;
}

.btn-clinical.close {
  background: #334155;
  color: #fff;
}

.btn-clinical.resume {
  background: #0284c7;
  color: #fff;
}

body.dark .btn-clinical.close {
  background: #475569;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.step {
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.step b {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--cyan);
  color: var(--teal);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.step.done b,
.step.active b {
  background: var(--teal);
  color: white;
}

.step span {
  color: var(--muted);
  font-weight: 900;
}

.activity div,
.records button,
.queue button,
.slot-list button,
.week button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px;
  color: var(--ink);
}

.activity strong,
.records strong,
.queue strong,
.slot-list strong {
  display: block;
  color: var(--teal-2);
}

body.dark .activity strong,
body.dark .records strong,
body.dark .queue strong,
body.dark .slot-list strong {
  color: var(--ink);
}

.activity span,
.records span,
.queue span,
.slot-list span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cyan) 70%, var(--line));
  overflow: hidden;
  margin-bottom: 18px;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.choice-row.three { grid-template-columns: repeat(3, 1fr); }
.choice-row.four { grid-template-columns: repeat(4, 1fr); }

.mmrc-choice-list {
  grid-template-columns: 1fr;
}

.mmrc-choice-list .choice {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-height: 48px;
  height: auto;
  padding: 12px 14px;
  text-align: start;
  line-height: 1.55;
}

.mmrc-choice-list .mmrc-grade {
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  font-weight: 800;
}

.cough-dependent-section[hidden] {
  display: none !important;
}

.assessment-dependent-section[hidden] {
  display: none !important;
}

.choice.active {
  background: var(--cyan);
  color: var(--teal);
  font-weight: 900;
  border-color: color-mix(in srgb, var(--teal) 24%, var(--line));
}

.safety-note {
  margin: 18px 0;
  padding: 14px;
  border-radius: 16px;
  color: #704900;
  background: #fff9ea;
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
  line-height: 1.6;
}

.muted-copy {
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 16px;
}

.check-list,
.access-matrix,
.file-list,
.verification-steps,
.audit-table {
  display: grid;
  gap: 10px;
}

.check-list label,
.access-matrix div,
.file-list div,
.verification-steps div,
.audit-table div {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 14px;
}

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  line-height: 1.6;
  font-weight: 800;
}

.check-list input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
  flex: 0 0 auto;
}

.access-matrix strong,
.file-list strong,
.verification-steps strong,
.audit-table strong {
  display: block;
  color: var(--teal-2);
}

body.dark .access-matrix strong,
body.dark .file-list strong,
body.dark .verification-steps strong,
body.dark .audit-table strong {
  color: var(--ink);
}

.access-matrix span,
.file-list span,
.verification-steps span,
.audit-table span,
.audit-table em {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
  font-style: normal;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 170px;
  padding: 20px;
  border: 1px dashed color-mix(in srgb, var(--teal) 40%, var(--line));
  border-radius: 20px;
  background: var(--cyan);
  color: var(--teal-2);
  overflow: hidden;
  margin-bottom: 12px;
}

.upload-zone span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-list .medical-file-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.medical-file-meta {
  color: var(--muted);
  font-size: 12px;
}

.medical-file-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.medical-file-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 180ms ease;
}

.medical-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.medical-file-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.field-warning {
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  color: #8a5b07;
  background: #fff7e4;
  border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--line));
  line-height: 1.55;
  font-weight: 800;
}

.field-warning.urgent {
  color: #a12626;
  background: #fdecec;
  border-color: color-mix(in srgb, var(--red) 42%, var(--line));
}

body.dark .safety-note,
body.dark .clinical-note {
  background: #2a2313;
  color: #ffd47b;
}

.center-state {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
}

.review-orbit {
  width: 144px;
  height: 144px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  margin-bottom: 18px;
}

.review-orbit span {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 0 38%, transparent 39%),
    conic-gradient(var(--amber), var(--teal), var(--green), var(--amber));
  animation: slowSpin 2.4s linear infinite;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 10px;
  width: min(760px, 100%);
  margin: 28px 0;
}

.timeline div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.timeline b {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin: 0 auto 10px;
  background: var(--line);
}

.timeline .done b { background: var(--green); }
.timeline .active b { background: var(--amber); }
.timeline span { color: var(--muted); font-weight: 900; font-size: 13px; }

.result-main {
  background:
    linear-gradient(135deg, rgba(255,247,228,.92), rgba(255,255,255,.9)),
    var(--surface);
}

body.dark .result-main { background: var(--surface); }

.risk-meter {
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
  margin: 24px 0;
  position: relative;
}

.risk-meter span {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 5px solid var(--amber);
  top: -4px;
  left: 50%;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  transition: left 0.4s ease, border-color 0.4s ease;
}

/* PRD Page 11 Tri-Color Clinical Risk System */
.risk-meter.low span {
  left: 15%;
  border-color: #18a058;
}
.risk-meter.caution span {
  left: 50%;
  border-color: #d97706;
}
.risk-meter.high span {
  left: 85%;
  border-color: #dc2626;
}

.pill.risk-low, .risk-badge-low {
  background: rgba(24, 160, 88, 0.12) !important;
  color: #15803d !important;
  border: 1px solid rgba(24, 160, 88, 0.35) !important;
}

body.dark .pill.risk-low,
body.dark .risk-badge-low,
html.hv-theme-dark .pill.risk-low,
html.hv-theme-dark .risk-badge-low {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(74, 222, 128, 0.45) !important;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.15);
}

.pill.risk-caution, .risk-badge-caution {
  background: rgba(217, 119, 6, 0.12) !important;
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.35) !important;
}

body.dark .pill.risk-caution,
body.dark .risk-badge-caution,
html.hv-theme-dark .pill.risk-caution,
html.hv-theme-dark .risk-badge-caution {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(251, 191, 36, 0.45) !important;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.15);
}

.pill.risk-high, .risk-badge-high {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(220, 38, 38, 0.35) !important;
}

body.dark .pill.risk-high,
body.dark .risk-badge-high,
html.hv-theme-dark .pill.risk-high,
html.hv-theme-dark .risk-badge-high {
  background: rgba(239, 68, 68, 0.20) !important;
  color: #f87171 !important;
  border: 1px solid rgba(248, 113, 113, 0.45) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.22);
}

.recommendations {
  margin: 0;
  padding-right: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.records button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  align-items: center;
  text-align: right;
}

html[dir="ltr"] .records button,
html[dir="ltr"] .queue button {
  text-align: left;
}

.records span { grid-column: 1; }
.records em {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-style: normal;
}

.week {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.week button {
  text-align: center;
  min-height: 86px;
  color: var(--muted);
}

.week button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.queue button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  text-align: right;
  border-right-width: 5px;
}

html[dir="ltr"] .queue button {
  border-right-width: 1px;
  border-left-width: 5px;
}

html[dir="ltr"] .queue .danger { border-left-color: var(--red); }
html[dir="ltr"] .queue .pending { border-left-color: var(--amber); }
html[dir="ltr"] .queue .ok { border-left-color: var(--green); }

.queue em {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-style: normal;
  align-self: center;
  font-weight: 900;
}

.queue .danger { border-right-color: var(--red); }
.queue .pending { border-right-color: var(--amber); }
.queue .ok { border-right-color: var(--green); }

.chat-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 370px;
  overflow: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.chat-messages div {
  width: fit-content;
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.65;
}

.chat-messages .bot {
  background: var(--cyan);
  color: var(--teal-2);
}

.chat-messages .user {
  justify-self: end;
  background: var(--teal);
  color: white;
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.verification-steps div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
}

.verification-steps b {
  grid-row: 1 / span 2;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--line);
  margin-top: 4px;
}

.verification-steps .done b { background: var(--green); }
.verification-steps .active b { background: var(--amber); }

.audit-table div {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 12px;
  align-items: center;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(7, 23, 25, .42);
  backdrop-filter: blur(12px);
  overflow-y: auto;
}

.confirm-modal.open {
  display: grid;
}

.confirm-card {
  width: min(430px, 100%);
  padding: 22px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  max-height: min(92vh, 900px);
  overflow-y: auto;
}

.confirm-card h3 {
  margin: 0 0 8px;
  color: var(--teal-2);
}

body.dark .confirm-card h3 { color: var(--ink); }

.confirm-card p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 18px;
}

/* =============================================================================
   ML Clinical Processing Loading Indicator & Anti-Double-Submission (PRD Req 58)
   ============================================================================= */
.ml-processing-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(7, 23, 25, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.ml-processing-modal.open {
  display: grid;
}

.ml-processing-card {
  width: min(460px, 94vw);
  padding: 32px 24px;
  border-radius: 28px;
  background: var(--surface);
  border: 1.5px solid rgba(14, 165, 233, 0.28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.ml-processing-ambient-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 120px;
  background: radial-gradient(ellipse at center, rgba(14, 165, 233, 0.25) 0%, rgba(16, 185, 129, 0) 70%);
  pointer-events: none;
  filter: blur(20px);
}

.ml-processing-hero-icon {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ml-pulse-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(14, 165, 233, 0.5);
  animation: mlPulseRipple 2s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.ml-pulse-ripple.ring-2 {
  animation-delay: 0.8s;
  border-color: rgba(16, 185, 129, 0.4);
}

@keyframes mlPulseRipple {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.ml-pulse-core {
  position: relative;
  z-index: 2;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(16, 185, 129, 0.2));
  border: 2px solid rgba(14, 165, 233, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.25);
  animation: mlCoreBreathe 2.4s ease-in-out infinite;
}

@keyframes mlCoreBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(14, 165, 233, 0.25); }
  50% { transform: scale(1.06); box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4); }
}

.ml-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.25s ease;
}

.ml-step-item:not(:last-child) {
  border-bottom: 1px dashed rgba(14, 165, 233, 0.12);
}

.ml-step-item.done {
  color: #10b981;
  font-weight: 600;
}

.ml-step-item.current {
  color: var(--teal-2);
  font-weight: 700;
}

body.dark .ml-step-item.current {
  color: #38bdf8;
}

.ml-step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  background: rgba(14, 165, 233, 0.1);
  color: var(--teal-2);
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.ml-step-badge.done {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

.mini-spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: miniSpinAnim 0.75s linear infinite;
}

@keyframes miniSpinAnim {
  to { transform: rotate(360deg); }
}

body.dark .ml-processing-card {
  background: #0f172a;
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.report-page {
  width: min(850px, 100%);
  margin: 0 auto;
  border-radius: 20px;
  padding: 34px;
  direction: rtl;
  text-align: right;
}

html[dir="ltr"] .report-page {
  direction: ltr;
  text-align: left;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 24px;
  margin: 22px 0;
}

.report-page h3 {
  color: var(--teal-2);
  margin: 22px 0 8px;
}

body.dark .report-page h3 { color: var(--ink); }
.report-page p { color: var(--muted); line-height: 1.7; }

body.sidebar-open .sidebar { transform: translateX(0); }

@media (max-width: 1060px) {
  .site-nav { flex-wrap: wrap; gap: 12px; }
  .site-links { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .site-hero,
  .split-section,
  .hero-panel,
  .content-grid,
  .form-layout,
  .result-layout,
  .doctor-layout,
  .assistant-layout {
    grid-template-columns: 1fr;
  }
  .workflow-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }
  .icon-button { display: inline-grid; place-items: center; }
  .sidebar {
    position: fixed;
    z-index: 40;
    right: 16px;
    top: 16px;
    bottom: 16px;
    height: calc(100dvh - 32px);
    max-height: calc(100dvh - 32px);
    width: min(320px, calc(100vw - 32px));
    transform: translateX(calc(100% + 24px));
    transition: transform .28s ease;
  }
}

@media (max-width: 768px) {
  .site-shell { width: min(100% - 20px, 1220px); }
  .site-nav {
    flex-direction: column;
    padding: 10px 14px;
    gap: 0;
    border-radius: 18px;
    top: 8px;
  }
  .site-nav .site-links { display: none !important; }
  .site-nav .nav-actions { display: none !important; }
  .site-hamburger-btn { display: flex !important; }
  .site-hero { padding-top: 36px; }
  .hero-copy h1 { font-size: 38px; }
  .site-section { padding: 22px; border-radius: 24px; }
  .workflow-grid,
  .metric-grid,
  .steps,
  .timeline,
  .report-grid {
    grid-template-columns: 1fr;
  }
  .safety-band { display: block; }
  .safety-band button { margin-top: 18px; width: 100%; }
  .app-shell {
    padding: 10px;
    min-height: 100dvh;
  }
  .workspace { border-radius: 24px; }
  .topbar { padding: 14px; }
  .topbar h2 { font-size: 19px; }
  .chip { display: none; }
  .screen { padding: 14px; }
  .hero-panel { padding: 22px; border-radius: 22px; }
  .choice-row.three,
  .choice-row.four,
  .week { grid-template-columns: repeat(2, 1fr); }
  .chat-compose,
  .audit-table div { grid-template-columns: 1fr; }
  .phone-frame { width: min(300px, 94%); }
  .floating-card { display: none; }
}

@media (max-width: 375px) {
  .site-nav {
    padding: 8px 10px;
    border-radius: 16px;
  }
  .site-nav .brand-subtitle {
    display: none !important;
  }
  .site-nav .brand strong {
    font-size: 14px;
    white-space: nowrap;
  }
  .site-nav .brand-logo {
    width: 30px;
    height: 30px;
  }
  .site-hamburger-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  .site-nav-drawer .drawer-links a {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 40px;
  }
  .site-nav-drawer .drawer-actions button,
  .site-nav-drawer .drawer-actions .drawer-action-btn,
  .site-nav-drawer .drawer-actions .drawer-lang-btn {
    font-size: 13.5px !important;
    min-height: 42px !important;
    height: 42px !important;
  }
}


@media (max-width: 430px), (max-height: 680px) {
  .auth-screen {
    place-items: start center;
    overflow: auto;
  }

  .auth-card {
    margin: 8px 0;
    border-radius: 24px;
  }

  .auth-brand {
    margin-bottom: 16px;
  }

  .auth-card h2 {
    font-size: 26px;
  }

  .auth-card p {
    margin-bottom: 14px;
  }

  .role-tabs {
    min-height: 54px;
  }

  .role-tabs button {
    min-height: 42px;
    font-size: 14px;
  }
}

/* ── Language toggle ── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--teal);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
  box-shadow: 0 2px 8px rgba(0,109,111,.08);
}

.lang-toggle:hover {
  background: var(--cyan);
  border-color: var(--teal-3);
  box-shadow: 0 4px 14px rgba(0,109,111,.14);
}

.lang-globe {
  font-size: 15px;
  line-height: 1;
}

.lang-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
}

/* ── Theme toggle buttons (site nav, topbar) ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--teal);
  font-size: 18px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  box-shadow: 0 2px 8px rgba(0, 109, 111, .08);
}

.theme-toggle:hover {
  background: var(--cyan);
  border-color: var(--teal-2);
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 109, 111, .14);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon,
.theme-fab-icon {
  line-height: 1;
  display: inline-block;
  user-select: none;
}

/* ── Pitch deck nav link ── */
.pitch-link {
  color: #0369a1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.18s ease;
}
.pitch-link:hover {
  color: var(--teal);
  text-decoration: underline;
}
body.dark .pitch-link,
html.hv-theme-dark .pitch-link {
  color: #38bdf8;
}

/* ── Floating dark mode FAB ── */
.theme-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--teal-2), var(--teal));
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,109,111,.28);
  transition: transform .2s ease, box-shadow .2s ease;
}

.theme-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(0,109,111,.38);
}

.theme-fab:active {
  transform: scale(.95);
}

body.dark .theme-fab {
  background: linear-gradient(135deg, #1a4a4c, var(--teal));
}

.owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff !important;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
  vertical-align: middle;
}

body:not(.dark) .owner-badge {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35);
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: 13px;
}

.admin-users-table th {
  padding: 12px 14px;
  text-align: start;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  background: rgba(9, 184, 182, 0.05);
}

body:not(.dark) .admin-users-table th {
  background: #f0faf8;
  color: #3b5f63;
  border-bottom-color: #d1e7e5;
}

.admin-users-table td {
  padding: 13px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

body:not(.dark) .admin-users-table td {
  border-bottom-color: #e5f2f0;
}

.admin-users-table tr:hover td {
  background: rgba(9, 184, 182, 0.05);
}

body:not(.dark) .admin-users-table tr:hover td {
  background: #f7fcfb;
}

.admin-role-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

body:not(.dark) .admin-role-select {
  background: #ffffff;
  border-color: #cde4e1;
  color: #0b2226;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.admin-role-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(9, 184, 182, 0.2);
}

.doctor-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.4);
  vertical-align: middle;
}


/* Doctor Lifecycle: Application -> Verification -> Approval */
.doctor-lifecycle-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 820px) {
  .doctor-lifecycle-track {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.track-step {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 16px 18px;
  border-radius: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.track-step .step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  background: var(--line);
  color: var(--muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.track-step.done {
  border-color: rgba(24, 160, 88, 0.35);
  background: rgba(24, 160, 88, 0.06);
}

.track-step.done .step-num {
  background: #18a058;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(24, 160, 88, 0.3);
}

.track-step.active {
  border-color: var(--teal);
  background: rgba(9, 184, 182, 0.08);
  box-shadow: 0 0 0 2px rgba(9, 184, 182, 0.2);
}

.track-step.active .step-num {
  background: linear-gradient(135deg, var(--teal-2), var(--teal));
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(9, 184, 182, 0.35);
}

.track-step .step-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-step .step-info strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
}

.track-step .step-info span {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* Admin Doctor App Card */
.admin-app-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-app-card:hover {
  border-color: rgba(9, 184, 182, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

body.dark .admin-app-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Emergency Messaging & Low Oxygen Alerts System
   ========================================================================== */

@keyframes pulseRedGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    transform: scale(1);
  }
}

@keyframes pulseEmergencyCard {
  0% {
    border-color: #ef4444;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.18);
  }
  50% {
    border-color: #b91c1c;
    box-shadow: 0 6px 28px rgba(239, 68, 68, 0.35);
  }
  100% {
    border-color: #ef4444;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.18);
  }
}

/* Field Warning Override for Rich Emergency Card */
.field-warning.has-emergency-card {
  padding: 0;
  background: transparent;
  border: none;
  margin-top: 10px;
}

.emergency-alert-card {
  border-radius: 18px;
  padding: 16px 18px;
  margin-top: 6px;
  text-align: right;
  line-height: 1.6;
  transition: all 0.25s ease;
}

body[dir="ltr"] .emergency-alert-card,
[dir="ltr"] .emergency-alert-card {
  text-align: left;
}

/* Critical Oxygen Alert (< 90%) */
.emergency-alert-card.critical-oxygen {
  background: #fff5f5;
  border: 2px solid #ef4444;
  color: #7f1d1d;
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.12);
  animation: pulseEmergencyCard 3s infinite ease-in-out;
}

body.dark .emergency-alert-card.critical-oxygen {
  background: #2a1215;
  border-color: #f87171;
  color: #fecaca;
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.28);
}

/* Moderate Low Oxygen Alert (90% - 92%) */
.emergency-alert-card.warning-oxygen {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  color: #78350f;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1);
}

body.dark .emergency-alert-card.warning-oxygen {
  background: #281d0c;
  border-color: #fbbf24;
  color: #fef3c7;
}

/* Invalid Input Box (>100 or <50) */
.emergency-alert-card.invalid-reading {
  background: #fef2f2;
  border: 1.5px solid #dc2626;
  color: #991b1b;
  padding: 12px 14px;
}

body.dark .emergency-alert-card.invalid-reading {
  background: #251012;
  border-color: #ef4444;
  color: #fca5a5;
}

.emergency-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.emergency-pulsing-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  animation: pulseRedGlow 2s infinite ease-in-out;
}

.emergency-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f59e0b;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.emergency-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.emergency-lead {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 700;
}

.emergency-actions-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.emergency-actions-list li {
  position: relative;
  padding-inline-start: 22px;
  line-height: 1.5;
}

.emergency-actions-list li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 6px;
  top: -1px;
  font-size: 16px;
  font-weight: 900;
  color: #dc2626;
}

.emergency-alert-card.warning-oxygen .emergency-actions-list li::before {
  color: #d97706;
}

.emergency-action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.emergency-call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff !important;
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.emergency-call-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
  color: #ffffff !important;
}

.emergency-call-btn.secondary {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
}

.emergency-call-btn.secondary:hover {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.45);
}

.emergency-guide-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.emergency-guide-trigger-btn:hover {
  background: var(--surface-2);
  border-color: var(--teal);
}

/* ==========================================================================
   Instant Critical Symptoms Screener & Emergency Red-Flag Triage
   ========================================================================== */
.critical-screener-card {
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 12px 0 18px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.06);
}

body.dark .critical-screener-card {
  background: rgba(30, 20, 22, 0.6);
  border-color: rgba(239, 68, 68, 0.4);
}

.critical-screener-card:hover {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.12);
}

.critical-screener-head {
  margin-bottom: 12px;
}

.critical-screener-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  margin-bottom: 6px;
}

body.dark .critical-screener-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.critical-screener-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.critical-symptoms-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.critical-symptom-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: start;
  user-select: none;
}

.critical-symptom-chip:hover {
  background: var(--surface-2);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.critical-symptom-chip .chip-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.critical-symptom-chip .chip-label {
  flex: 1;
}

.critical-symptom-chip.active {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #b91c1c;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
  transform: scale(1.02);
}

.critical-symptom-chip.active .chip-icon {
  animation: pulseRedGlow 1.8s infinite ease-in-out;
}

/* Critical Emergency Banner */
.critical-emergency-banner {
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  animation: pulseEmergencyCard 2s infinite ease-in-out;
}

.critical-emergency-banner.is-active {
  display: block !important;
}

.critical-detected-items {
  margin: 12px 0 16px;
}

.critical-detected-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 6px;
  line-height: 1.45;
}

body.dark .critical-detected-item {
  color: #fca5a5;
}

.critical-detected-item:last-child {
  margin-bottom: 0;
}

.critical-detected-item .item-badge {
  display: inline-block;
  padding: 2px 6px;
  background: #ef4444;
  color: #fff;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Patient Emergency Quickbar */
.patient-emergency-quickbar {
  transition: all 0.25s ease;
}

.patient-emergency-quickbar:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.55);
}

/* ==========================================================================
   BUOY HEALTH BENCHMARK: PERSISTENT EMERGENCY TOP BAR & QUICK ACTIONS (#80)
   ========================================================================== */
.buoy-emergency-sticky-bar {
  width: 100%;
  margin: 0 0 18px 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(254, 226, 226, 0.85));
  border: 2px solid #ef4444;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.16);
  padding: 14px 18px;
  position: relative;
  z-index: 10;
  animation: pulseEmergencyCard 3.5s infinite ease-in-out;
}

body.dark .buoy-emergency-sticky-bar,
html.hv-theme-dark .buoy-emergency-sticky-bar {
  background: linear-gradient(135deg, rgba(43, 18, 22, 0.95), rgba(30, 11, 13, 0.90));
  border-color: #f87171;
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.28);
}

.buoy-emergency-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.buoy-emergency-text {
  flex: 1 1 320px;
}

.buoy-emergency-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.buoy-emergency-badge strong {
  font-size: 15px;
  font-weight: 800;
  color: #b91c1c;
}

body.dark .buoy-emergency-badge strong,
html.hv-theme-dark .buoy-emergency-badge strong {
  color: #fca5a5;
}

.buoy-emergency-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #7f1d1d;
  font-weight: 600;
}

body.dark .buoy-emergency-text p,
html.hv-theme-dark .buoy-emergency-text p {
  color: #fecaca;
}

.buoy-emergency-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.buoy-emergency-actions .emergency-direct-call-btn {
  background: #dc2626;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.buoy-emergency-actions .emergency-direct-call-btn:hover {
  background: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.55);
}

/* Persistent Topbar Emergency Quick Button (Across All Screens) */
.topbar-emergency-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  color: #dc2626 !important;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

body.dark .topbar-emergency-btn,
html.hv-theme-dark .topbar-emergency-btn {
  background: rgba(239, 68, 68, 0.22);
  border-color: #f87171;
  color: #fca5a5 !important;
}

.topbar-emergency-btn:hover {
  background: #dc2626;
  color: #ffffff !important;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.topbar-emergency-btn .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  box-shadow: 0 0 8px #dc2626;
  animation: pulseRedGlow 1.8s infinite ease-in-out;
}

body.dark .topbar-emergency-btn .pulse-dot {
  background: #f87171;
  box-shadow: 0 0 8px #f87171;
}


/* ==========================================================================
   Screen-Pending Emergency Banner
   ========================================================================== */
.emergency-pending-banner {
  width: min(560px, 100%);
  margin: 16px auto 20px;
  border-radius: 20px;
  padding: 18px 20px;
  text-align: right;
  transition: all 0.3s ease;
}

body[dir="ltr"] .emergency-pending-banner,
[dir="ltr"] .emergency-pending-banner {
  text-align: left;
}

.emergency-pending-banner.critical {
  background: #fef2f2;
  border: 2px solid #ef4444;
  color: #7f1d1d;
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.22);
  animation: pulseEmergencyCard 2.5s infinite ease-in-out;
}

body.dark .emergency-pending-banner.critical {
  background: #2b1216;
  border-color: #f87171;
  color: #fecaca;
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.35);
}

.emergency-pending-banner.warning {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  color: #78350f;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.16);
}

body.dark .emergency-pending-banner.warning {
  background: #261b0a;
  border-color: #fbbf24;
  color: #fef3c7;
}

.emergency-banner-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.emergency-pulsing-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  animation: pulseRedGlow 1.8s infinite ease-in-out;
}

.emergency-banner-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

.emergency-banner-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.emergency-banner-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(239, 68, 68, 0.2);
}

.emergency-pending-banner.warning .emergency-banner-footer {
  border-top-color: rgba(245, 158, 11, 0.2);
}

.emergency-big-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
  transition: all 0.2s ease;
  cursor: pointer;
}

.emergency-big-call-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(220, 38, 38, 0.5);
  color: #ffffff !important;
}

.emergency-big-call-btn.warning-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.3);
}

.emergency-big-call-btn.warning-btn:hover {
  box-shadow: 0 6px 22px rgba(217, 119, 6, 0.45);
}

.emergency-banner-guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.emergency-banner-guide-btn:hover {
  background: var(--surface-2);
  border-color: var(--teal);
}

/* ==========================================================================
   Emergency Guide Modal
   ========================================================================== */
.emergency-guide-card {
  width: min(540px, 100%) !important;
  max-height: 85vh;
  overflow-y: auto;
  text-align: right;
}

body[dir="ltr"] .emergency-guide-card,
[dir="ltr"] .emergency-guide-card {
  text-align: left;
}

.emergency-guide-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  color: #dc2626 !important;
}

body.dark .emergency-guide-card h3 {
  color: #f87171 !important;
}

.guide-step-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.guide-step-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--teal-2);
}

body.dark .guide-step-card strong {
  color: #38bdf8;
}

.guide-step-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

.hotlines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.hotline-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.hotline-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.hotline-item strong {
  display: block;
  font-size: 18px;
  color: #dc2626;
  font-family: inherit;
  margin-top: 2px;
}

/* ==========================================================================
   Doctor Queue & Review Emergency Indicators
   ========================================================================== */
.doctor-emergency-pill {
  background: #ef4444 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 11px !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  animation: pulseRedGlow 1.8s infinite ease-in-out;
}

.doctor-emergency-alert-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fef2f2;
  border: 2px solid #ef4444;
  color: #7f1d1d;
  margin-bottom: 16px;
  text-align: right;
  animation: pulseEmergencyCard 3s infinite ease-in-out;
}

body[dir="ltr"] .doctor-emergency-alert-banner,
[dir="ltr"] .doctor-emergency-alert-banner {
  text-align: left;
}

body.dark .doctor-emergency-alert-banner {
  background: #2b1216;
  border-color: #f87171;
  color: #fecaca;
}

.doctor-emergency-alert-banner .icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.doctor-emergency-alert-banner strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
  color: #b91c1c;
}

body.dark .doctor-emergency-alert-banner strong {
  color: #fca5a5;
}

.doctor-emergency-alert-banner p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ==========================================================================
   Status History & Clinical Audit Trail Timeline
   ========================================================================== */
.status-history-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.status-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-entry {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  position: relative;
}

.timeline-entry .bullet {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--surface);
}

.timeline-entry .card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  width: 100%;
}

.timeline-entry .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.timeline-entry .header strong {
  font-size: 13px;
}

.timeline-entry .header small {
  color: var(--muted);
  font-size: 11px;
}

.timeline-entry .note {
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.45;
}

.timeline-entry .author {
  color: var(--muted);
  font-size: 11px;
  display: block;
  margin-top: 4px;
}

/* ==========================================================================
   Report Locked & Certified Approval System
   ========================================================================== */
.report-empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  max-width: 640px;
  margin: 20px auto;
}

.report-empty-state .empty-icon {
  font-size: 54px;
  margin-bottom: 12px;
}

.report-locked-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 28px;
  max-width: 760px;
  margin: 16px auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.06);
}

body.dark .report-locked-card {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.locked-badge-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.lock-shield-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15), rgba(234, 88, 12, 0.15));
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.lock-shield-icon .shield-glyph {
  font-size: 32px;
}

.lock-shield-icon .padlock-glyph {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 16px;
}

.locked-title-box h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  color: var(--ink);
}

.safety-lock-subtext {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.locked-case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 26px;
}

.locked-case-meta .meta-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.locked-case-meta .meta-row .label {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
}

.locked-case-meta .meta-row .val {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
}

.clinical-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

@media (max-width: 600px) {
  .clinical-stepper {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

.step-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
}

.step-col .circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.step-col.done .circle {
  background: #16a34a;
  color: #ffffff;
}

.step-col.active {
  border-color: var(--teal);
  background: rgba(9, 184, 182, 0.08);
}

.step-col.active .circle {
  background: #f59e0b;
  color: #ffffff;
  animation: pulseAmber 1.8s infinite;
}

.step-col.locked .circle {
  background: var(--line);
  color: var(--muted);
}

.step-col strong {
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 2px;
}

.step-col span {
  font-size: 11px;
  color: var(--muted);
}

.locked-footer-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Official certified report styling */
.report-page.official-certified-report {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  max-width: 800px;
  margin: 10px auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   DYNAMIC MEDICAL REPORT BUILDER & CERTIFIED REPORT STYLES
   ========================================================================== */
.doctor-report-builder-card {
  transition: border-color .2s ease;
}

.doctor-report-builder-card:focus-within {
  border-color: var(--teal) !important;
}

.doctor-report-builder-card textarea:focus,
.doctor-report-builder-card input:focus {
  outline: none;
  border-color: var(--teal) !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.report-prescription-section .prescriptions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-page.official-certified-report {
  width: min(880px, 100%);
  margin: 0 auto;
  border-radius: 20px;
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}

body.dark .report-page.official-certified-report {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.doctor-preview-banner {
  animation: fadeIn 0.3s ease;
}

.official-clinical-seal {
  transition: transform 0.2s ease;
}

.official-clinical-seal:hover {
  transform: rotate(0deg) scale(1.05);
}

/* PRINT MEDIA QUERY FOR CLEAN MEDICAL REPORTS */
@media print {
  @page {
    size: A4;
    margin: 12mm 15mm;
  }
  
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  /* Hide everything on the page except the active report */
  .site-shell,
  .site-nav,
  .topbar,
  .account-card,
  .toast,
  .no-print,
  .report-actions-toolbar,
  .doctor-preview-banner,
  aside.sidebar,
  #menuToggle,
  #loader,
  #emailVerificationBanner,
  #verifyRequiredModal,
  #confirmModal,
  #confirmAssessmentModal,
  .theme-fab,
  .screen:not(#screen-report) {
    display: none !important;
    visibility: hidden !important;
  }

  #app,
  .workspace,
  #screen-report,
  #screen-report.active,
  #reportContainer {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .report-page.official-certified-report {
    border: 1.5px solid #333333 !important;
    box-shadow: none !important;
    padding: 24px !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 4px !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  .report-page.official-certified-report .report-header,
  .report-page.official-certified-report .report-grid,
  .report-page.official-certified-report .report-vitals-box,
  .report-page.official-certified-report .report-diagnosis-section,
  .report-page.official-certified-report .report-prescription-section,
  .report-page.official-certified-report .report-signature-block,
  .report-page.official-certified-report .safety-note,
  .report-page.official-certified-report .report-badge {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 14px !important;
  }

  .report-page.official-certified-report .report-header {
    border-bottom: 2px solid #000000 !important;
  }

  .report-page.official-certified-report strong,
  .report-page.official-certified-report span,
  .report-page.official-certified-report p,
  .report-page.official-certified-report div {
    color: #000000 !important;
  }

  .report-page.official-certified-report .pill {
    border: 1px solid #000000 !important;
    background: #f3f4f6 !important;
    color: #000000 !important;
  }

  .official-clinical-seal {
    border: 2px solid #16a34a !important;
    background: #f0fdf4 !important;
  }

  .qr-verify-box svg {
    display: block !important;
  }

  /* Bilingual typography for clinical PDF printing */
  body.print-lang-ar,
  body.print-lang-ar * {
    font-family: 'Cairo', 'Tajawal', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif !important;
  }
  body.print-lang-en,
  body.print-lang-en * {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
  }

  .print-pagination {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    font-size: 8.5pt !important;
    color: #555555 !important;
    border-top: 1px solid #cccccc !important;
    padding-top: 8px !important;
    margin-top: 20px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-page-break {
    page-break-after: always !important;
    break-after: page !important;
  }
}

.print-pagination {
  display: none;
}

/* ==========================================================================
   📐 CLINICAL RULES & VERSIONING GOVERNANCE STYLES
   ========================================================================== */
.rules-governance-card {
  width: min(720px, 96vw) !important;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
}

.doctor-rules-card {
  transition: all 0.2s ease-in-out;
}

.doctor-rules-card:hover {
  border-color: var(--teal);
}

.rules-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 10px;
}

.rules-spec-table th,
.rules-spec-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: start;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .loader-logo,
  .loader-fallback-animation span,
  .breath-orb,
  .emergency-pulsing-badge {
    animation: none !important;
  }
}

.rules-spec-table th {
  background: var(--surface-2);
  color: var(--teal-2);
  font-weight: 700;
}

body.dark .rules-spec-table th {
  color: var(--ink);
}

.rules-spec-table tr:hover td {
  background: var(--surface-2);
}


/* ── Legal & Compliance Styles ── */
.legal-modal-card {
  width: min(720px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  font-family: inherit;
  box-sizing: border-box;
}

[dir="rtl"] .legal-modal-card {
  text-align: right;
  direction: rtl;
}

[dir="ltr"] .legal-modal-card {
  text-align: left;
  direction: ltr;
}

.legal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.legal-tab-btn {
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.legal-tab-btn:hover {
  color: var(--ink);
  border-color: var(--teal);
}

.legal-tab-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.legal-tab-btn.danger-tab.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.legal-content-body {
  overflow-y: auto;
  padding-right: 8px;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink);
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] .legal-content-body {
  text-align: right;
  direction: rtl;
}

[dir="ltr"] .legal-content-body {
  text-align: left;
  direction: ltr;
}

.legal-content-body h4 {
  color: var(--teal-2);
  margin: 16px 0 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

body.dark .legal-content-body h4 {
  color: #2dd4bf;
}

.legal-content-body p, .legal-content-body ul {
  margin-bottom: 12px;
  color: var(--muted);
}

.legal-content-body ul {
  padding-inline-start: 20px;
}

.legal-content-body li {
  margin-bottom: 6px;
}

.site-footer {
  margin-top: 48px;
  padding: 24px 0 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer-links button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.site-footer-links button:hover {
  color: var(--teal);
}

/* ========================================================================= */
/* 🎨 UI STATES: SKELETON LOADERS, EMPTY STATES & ERROR CARDS */
/* ========================================================================= */

@keyframes hvShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.hv-skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: hvShimmer 1.5s infinite;
  border-radius: 8px;
}

.hv-state-card {
  padding: 36px 20px;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 16px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hv-state-card .state-icon {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 4px;
}

.hv-state-card h4 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}

.hv-state-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 440px;
  line-height: 1.55;
}

.hv-state-card.error-card {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}

.hv-state-card.error-card h4 {
  color: #ef4444;
}

.hv-state-card.success-card {
  border-color: rgba(22, 163, 74, 0.4);
  background: rgba(22, 163, 74, 0.04);
}

.hv-state-card.success-card h4 {
  color: #16a34a;
}

.hv-state-card[data-state="offline"] {
  border-style: solid;
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.34);
}

.hv-state-card .solid-button {
  margin-top: 2px;
  padding: 8px 16px;
  font-size: 13px;
}

.hv-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12.5px;
}

.hv-breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.hv-breadcrumb strong {
  color: var(--ink);
  font-weight: 700;
}

.hv-onboarding-strip {
  margin: 18px 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.4fr);
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.hv-onboarding-strip h2 {
  margin: 4px 0 6px;
  font-size: 19px;
  line-height: 1.25;
  color: var(--ink);
}

.hv-onboarding-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.hv-onboarding-strip ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hv-onboarding-strip li {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.hv-onboarding-strip strong,
.hv-onboarding-strip span {
  display: block;
}

.hv-onboarding-strip strong {
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 5px;
}

.hv-onboarding-strip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .hv-onboarding-strip,
  .hv-onboarding-strip ol {
    grid-template-columns: 1fr;
  }
}

/* ── Clinical Appointments Booking ── */
.week {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
}

.week button {
  cursor: pointer;
  transition: all 0.2s ease;
}

.appt-type-btn {
  transition: all 0.2s ease;
}

.appt-type-btn.active {
  background: var(--teal) !important;
  border-color: var(--teal) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.appt-type-btn.active strong,
.appt-type-btn.active span {
  color: #ffffff !important;
}

.slot-list button {
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: right;
}

html[dir="ltr"] .slot-list button {
  text-align: left;
}

.slot-list button.active {
  background: var(--teal) !important;
  border-color: var(--teal) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.slot-list button.active strong,
.slot-list button.active span {
  color: #ffffff !important;
}

.slot-list button.is-booked,
.slot-list button:disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
  background: var(--surface-3) !important;
  border-color: var(--line) !important;
  pointer-events: none;
}

.slot-list button.is-booked strong {
  color: var(--muted) !important;
  text-decoration: line-through;
}

.slot-list button.is-booked span {
  color: #ef4444 !important;
  font-weight: 600;
}

.appointment-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

@media (max-width: 640px) {
  .appointment-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================================================================= */
/* ⭐ CLINICAL & PATIENT FEEDBACK STYLES                                     */
/* ========================================================================= */
.star-rating-widget .star-item,
#modalStarRating .m-star {
  transition: transform 0.15s ease, color 0.15s ease;
  user-select: none;
  display: inline-block;
}

.star-rating-widget .star-item:hover,
#modalStarRating .m-star:hover {
  transform: scale(1.22);
}

.feedback-item-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.feedback-item-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.feedback-badge-role {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feedback-badge-role.doctor {
  background: rgba(14, 165, 233, 0.12);
  color: var(--teal-2);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.feedback-badge-role.patient {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   23. KPI DASHBOARD (Completion Rate, Response Time, Report Turnaround)
   ========================================================================== */

.kpi-dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.kpi-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 20px;
}

.kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

body.dark .kpi-card {
  background: linear-gradient(135deg, rgba(17, 45, 48, 0.85) 0%, rgba(13, 36, 39, 0.95) 100%);
  border-color: rgba(9, 184, 182, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  box-shadow: 0 18px 45px rgba(9, 184, 182, 0.16);
}

.kpi-card-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.15;
  pointer-events: none;
}

.kpi-card-glow.teal { background: #09b8b6; }
.kpi-card-glow.blue { background: #2b7de9; }
.kpi-card-glow.emerald { background: #10b981; }
.kpi-card-glow.amber { background: #f59e0b; }

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-icon-bubble.teal {
  background: rgba(9, 184, 182, 0.15);
  color: var(--teal);
  border: 1px solid rgba(9, 184, 182, 0.3);
}

.kpi-icon-bubble.blue {
  background: rgba(43, 125, 233, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(43, 125, 233, 0.3);
}

.kpi-icon-bubble.emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.kpi-card-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-hero-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 6px;
}

.kpi-hero-number {
  font-size: 38px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.kpi-hero-unit {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.kpi-badge-sla {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.kpi-badge-sla.optimal {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.kpi-badge-sla.good {
  background: rgba(9, 184, 182, 0.14);
  color: var(--teal);
  border: 1px solid rgba(9, 184, 182, 0.35);
}

.kpi-badge-sla.warning {
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.kpi-progress-bar-container {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 14px 0 10px;
}

body.dark .kpi-progress-bar-container {
  background: rgba(255, 255, 255, 0.08);
}

.kpi-progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-submetrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px dashed var(--line);
}

.kpi-submetric-item {
  display: flex;
  flex-direction: column;
}

.kpi-submetric-label {
  font-size: 11px;
  color: var(--muted);
}

.kpi-submetric-value {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

/* Time range pills */
.kpi-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 18px;
  border-radius: 14px;
}

body.dark .kpi-filter-bar {
  background: rgba(17, 45, 48, 0.65);
  border-color: rgba(9, 184, 182, 0.2);
  backdrop-filter: blur(8px);
}

.kpi-pill-group {
  display: flex;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.kpi-pill-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.kpi-pill-btn.active {
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(9, 184, 182, 0.35);
}

/* Waterfall Stages Pipeline */
.kpi-waterfall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.kpi-stage-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-stage-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.kpi-stage-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(9, 184, 182, 0.12);
  color: var(--teal);
}

.kpi-stage-time {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin: 8px 0 4px;
}

.kpi-stage-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* SLA Table */
.kpi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.kpi-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

[dir="ltr"] .kpi-table th {
  text-align: left;
}

.kpi-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.kpi-table tr:hover td {
  background: rgba(9, 184, 182, 0.04);
}

.kpi-banner-cta {
  background: linear-gradient(135deg, rgba(9, 184, 182, 0.12) 0%, rgba(43, 125, 233, 0.08) 100%);
  border: 1px solid rgba(9, 184, 182, 0.35);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

/* ========================================================================= */
/* 24. MOBILE UX ENHANCEMENTS & RESPONSIVE POLISH                           */
/* ========================================================================= */

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* Smooth touch feedback for interactive elements */
button, .nav-item, .mobile-nav-btn, .status-filter-tab, .kpi-pill-btn, .pill, a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:active:not(:disabled), .nav-item:active, .mobile-nav-btn:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 36;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + var(--sab));
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.06);
}

body.dark .mobile-bottom-nav {
  background: rgba(13, 36, 39, 0.94);
  border-top-color: rgba(9, 184, 182, 0.22);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 5px 8px;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 56px;
  position: relative;
}

.mobile-nav-icon {
  font-size: 21px;
  line-height: 1;
  margin-bottom: 3px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: color 0.2s ease;
}

.mobile-nav-btn.active {
  color: var(--teal);
}

.mobile-nav-btn.active .mobile-nav-icon {
  transform: scale(1.15) translateY(-2px);
}

.mobile-nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  width: 16px;
  height: 3px;
  background: var(--teal);
  border-radius: 999px;
}

/* Tablet & Mobile Breakpoint (max-width: 1060px) */
@media (max-width: 1060px) {
  .sidebar {
    z-index: 45 !important;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
    border-radius: 20px 0 0 20px;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: min(310px, 85vw) !important;
    transform: translateX(100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
  }
}

/* Smartphone Breakpoint (max-width: 768px) */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }

  .workspace {
    padding-bottom: calc(76px + var(--sab)) !important;
    margin-bottom: 0 !important;
  }

  /* Prevent iOS auto-zoom on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Elevate floating theme toggle above mobile bottom nav */
  .theme-fab {
    bottom: calc(78px + var(--sab)) !important;
    right: 16px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
  }

  /* Mobile Topbar */
  .topbar {
    padding: 12px 14px;
    position: sticky;
    top: 0;
    z-index: 25;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }

  body.dark .topbar {
    background: rgba(13, 36, 39, 0.88);
    border-bottom-color: rgba(9, 184, 182, 0.18);
  }

  .topbar h2 {
    font-size: 17px;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .screen {
    padding: 14px 12px;
  }

  /* Hero panel adjustments on mobile */
  .hero-panel.app-hero {
    padding: 18px 16px;
    gap: 16px;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .hero-actions button {
    width: 100%;
    justify-content: center;
    min-height: 46px;
  }

  /* Panels and cards padding */
  .panel {
    padding: 16px 14px;
    border-radius: 16px;
  }

  /* Choice rows and options on phone */
  .choice-row.three,
  .choice-row.four {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .choice {
    min-height: 44px;
    font-size: 13.5px;
  }

  /* KPI cards spacing on mobile */
  .kpi-hero-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .kpi-card {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .kpi-hero-number {
    font-size: 32px;
  }

  /* Responsive tables with smooth momentum touch scrolling */
  .table-responsive-wrapper,
  #adminUsersTableContainer,
  .kpi-dashboard-wrapper div[style*="overflow-x: auto"] {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    border-radius: 12px;
  }

  /* Mobile Bottom Sheet for Modals */
  .confirm-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .confirm-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 24px 24px 0 0 !important;
    padding: 20px 18px calc(24px + var(--sab)) !important;
    animation: mobileSheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .confirm-card::before {
    content: '';
    display: block;
    width: 42px;
    height: 5px;
    background: var(--muted);
    opacity: 0.3;
    border-radius: 999px;
    margin: 0 auto 14px;
  }

  /* Toast adjustments */
  .toast {
    width: min(calc(100vw - 28px), 420px);
    top: calc(14px + var(--sat));
    font-size: 13px;
    text-align: center;
    justify-content: center;
  }

  /* Status filter tabs on mobile */
  .status-filter-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 6px;
  }

  .status-filter-tab {
    flex-shrink: 0;
    min-height: 38px;
    font-size: 12.5px;
  }
}

@keyframes mobileSheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ==========================================================================
   Unified Clinical Patient Timeline & History Styles
   ========================================================================== */
.timeline-filters-toolbar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.timeline-filter-btn {
  background: var(--surface-3, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.timeline-filter-btn:hover {
  background: var(--surface-hover, rgba(9, 184, 182, 0.12));
  color: var(--ink);
  border-color: var(--teal);
}

.timeline-filter-btn.active {
  background: var(--teal, #09b8b6);
  color: #ffffff;
  border-color: var(--teal, #09b8b6);
  box-shadow: 0 2px 8px rgba(9, 184, 182, 0.3);
}

.unified-timeline-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
}

.unified-timeline-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  border-color: rgba(9, 184, 182, 0.35);
}

.unified-timeline-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
}

[dir="rtl"] .unified-timeline-card::before { right: 0; }
[dir="ltr"] .unified-timeline-card::before { left: 0; }

.timeline-cat-assessment::before { background: #09b8b6; }
.timeline-cat-report::before { background: #3b82f6; }
.timeline-cat-appointment::before { background: #8b5cf6; }
.timeline-cat-attachment::before { background: #10b981; }
.timeline-cat-medication::before { background: #f97316; }
.timeline-cat-condition::before { background: #ec4899; }
.timeline-cat-doctor_note::before { background: #eab308; }
.timeline-cat-internal_note::before { background: #ef4444; }

/* ==========================================================================
   25. UI SYSTEM COMPLETION: TOKENS, STATES, ROLES & RESPONSIVE QA
   ========================================================================== */
:root {
  --font-sans: "Cairo", "Tajawal", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --surface-3: #17383c;
  --surface-hover: rgba(9, 184, 182, 0.12);
  --focus-ring: 0 0 0 4px rgba(93, 214, 212, 0.28);
  --state-info: #38bdf8;
  --state-success: var(--green);
  --state-warning: var(--amber);
  --state-danger: #f87171;
  --role-patient: #10b981;
  --role-doctor: #38bdf8;
  --role-admin: #f59e0b;
}

body {
  font-family: var(--font-sans);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

:where(.solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn, .filter-tab, .status-filter-tab, .kpi-pill-btn, .legal-tab-btn, .verify-tab, .emergency-call-btn, .emergency-big-call-btn, .emergency-banner-guide-btn, .emergency-guide-trigger-btn, .timeline-filter-btn, .btn-clinical, .slot-list button, .mobile-nav-btn, .icon-button, .hv-btn) {
  border-radius: var(--radius-sm);
  font-weight: 800;
  letter-spacing: 0;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}

/* ==========================================================================
   DOCTOLIB-GRADE MEDICAL DESIGN SYSTEM: UNIFIED BUTTONS & BADGES (#78)
   ========================================================================== */
.hv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hv-btn:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--teal);
}

/* Primary CTA: Medical Teal */
.hv-btn-primary {
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--teal), #004d4f);
  box-shadow: 0 6px 16px rgba(0, 109, 111, 0.24);
  border-color: transparent;
}
.hv-btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 109, 111, 0.32);
}
.hv-btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 109, 111, 0.2);
}

/* Secondary CTA: Medical Blue for Telehealth & Scheduling */
.hv-btn-secondary {
  color: #ffffff !important;
  background: var(--blue, #2b7de9);
  box-shadow: 0 6px 16px rgba(43, 125, 233, 0.24);
  border-color: transparent;
}
.hv-btn-secondary:hover:not(:disabled) {
  background: #1e67c9;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(43, 125, 233, 0.32);
}
.hv-btn-secondary:active:not(:disabled) {
  transform: translateY(0);
}

/* Outline CTA: Neutral Bordered */
.hv-btn-outline {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
.hv-btn-outline:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}

/* Soft CTA: Tinted Cyan */
.hv-btn-soft {
  color: var(--teal);
  background: var(--cyan);
  border-color: color-mix(in srgb, var(--teal) 18%, transparent);
}
.hv-btn-soft:hover:not(:disabled) {
  background: color-mix(in srgb, var(--cyan) 85%, var(--teal));
  border-color: var(--teal);
  transform: translateY(-1px);
}

/* Danger / Emergency CTA */
.hv-btn-danger {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
}
.hv-btn-danger:hover:not(:disabled) {
  background: var(--red);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.28);
}

/* Button Size Modifiers */
.hv-btn-sm {
  min-height: 36px;
  min-width: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}
.hv-btn-md {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14.5px;
  border-radius: 12px;
}
.hv-btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 16px;
  border-radius: 14px;
}
.hv-btn-block {
  width: 100%;
  display: flex;
}

/* Universal Clinical Badges & Status Chips */
.hv-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.hv-badge-success {
  background: var(--triage-green-bg, rgba(34, 197, 94, 0.14));
  color: var(--triage-green-text, #16a34a);
  border: 1px solid var(--triage-green-border, rgba(34, 197, 94, 0.35));
}
.hv-badge-warning {
  background: var(--triage-amber-bg, rgba(245, 158, 11, 0.14));
  color: var(--triage-amber-text, #d97706);
  border: 1px solid var(--triage-amber-border, rgba(245, 158, 11, 0.35));
}
.hv-badge-danger {
  background: var(--triage-red-bg, rgba(239, 68, 68, 0.14));
  color: var(--triage-red-text, #dc2626);
  border: 1px solid var(--triage-red-border, rgba(239, 68, 68, 0.35));
}
.hv-badge-info {
  background: rgba(43, 125, 233, 0.14);
  color: #2b7de9;
  border: 1px solid rgba(43, 125, 233, 0.35);
}

/* Typography Hierarchy Utility Classes */
.hv-text-hero {
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
}
.hv-text-title {
  font-size: clamp(22px, 3.2vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
.hv-text-subtitle {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}
.hv-text-body {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
}
.hv-text-caption {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
}
.hv-text-disclaimer {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}

:where(.solid-button, .auth-submit-btn, .banner-btn.primary):hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 14px 32px rgba(9, 184, 182, 0.24);
}

:where(.outline-button, .soft-button, .google-button, .filter-tab, .status-filter-tab, .timeline-filter-btn, .verify-tab, .legal-tab-btn):hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
  color: var(--ink);
}

:where(button, .solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn, .slot-list button):disabled,
:where(button, .solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn, .slot-list button)[aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: .58;
  filter: grayscale(.25);
  transform: none !important;
  box-shadow: none !important;
}

:where(button, .solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn).is-loading,
:where(button, .solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn)[aria-busy="true"] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

:where(button, .solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn).is-loading::after,
:where(button, .solid-button, .outline-button, .soft-button, .danger-button, .google-button, .auth-submit-btn, .banner-btn)[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: hvSpin .72s linear infinite;
}

@keyframes hvSpin {
  to { transform: rotate(360deg); }
}

:where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea, .admin-role-select) {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  padding: 11px 13px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

:where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea, .admin-role-select):hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--teal) 35%, var(--line));
}

:where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea, .admin-role-select):focus,
:where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea, .admin-role-select):focus-visible {
  outline: 0;
  border-color: var(--teal-2);
  box-shadow: var(--focus-ring);
}

:where(input, select, textarea)::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

:where(input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: .62;
  background: color-mix(in srgb, var(--surface-2) 72%, #000);
}

.role-stack div,
.feedback-badge-role,
.doctor-badge,
.pill.patient,
.pill.doctor,
.pill.admin,
[data-role="patient"],
[data-role="doctor"],
[data-role="admin"] {
  border-radius: var(--radius-sm);
}

.role-stack div:nth-child(1),
.feedback-badge-role.patient,
.pill.patient,
[data-role="patient"] {
  border-color: color-mix(in srgb, var(--role-patient) 38%, var(--line));
}

.role-stack div:nth-child(2),
.feedback-badge-role.doctor,
.doctor-badge,
.pill.doctor,
[data-role="doctor"] {
  border-color: color-mix(in srgb, var(--role-doctor) 42%, var(--line));
}

.role-stack div:nth-child(3),
.pill.admin,
[data-role="admin"] {
  border-color: color-mix(in srgb, var(--role-admin) 42%, var(--line));
}

.role-stack div:nth-child(1)::before,
.role-stack div:nth-child(2)::before,
.role-stack div:nth-child(3)::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-inline-end: 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.role-stack div:nth-child(1)::before { background: var(--role-patient); }
.role-stack div:nth-child(2)::before { background: var(--role-doctor); }
.role-stack div:nth-child(3)::before { background: var(--role-admin); }

.pill,
.status-filter-tab,
.timeline-filter-btn {
  white-space: nowrap;
}

.pill.danger,
.pill.escalated,
.pill.rejected,
.field-warning.urgent,
.doctor-emergency-pill {
  font-weight: 900;
}

.emergency-alert-card,
.emergency-pending-banner,
.doctor-emergency-alert-banner {
  border-radius: var(--radius-md);
  text-wrap: pretty;
}

.emergency-alert-card strong,
.emergency-pending-banner strong,
.doctor-emergency-alert-banner strong {
  display: inline;
}

.field-warning.urgent::before,
.emergency-pending-banner.critical .emergency-banner-title::before,
.doctor-emergency-alert-banner strong::before {
  content: "Urgent: ";
  font-weight: 900;
}

[dir="rtl"] .field-warning.urgent::before,
[dir="rtl"] .emergency-pending-banner.critical .emergency-banner-title::before,
[dir="rtl"] .doctor-emergency-alert-banner strong::before {
  content: "عاجل: ";
}

.table-responsive-wrapper,
#adminUsersTableContainer,
.kpi-dashboard-wrapper,
.audit-table,
.rules-spec-table {
  max-width: 100%;
}

#adminUsersTableContainer,
.table-responsive-wrapper,
.kpi-dashboard-wrapper div[style*="overflow-x: auto"] {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.admin-users-table,
.kpi-table,
.rules-spec-table {
  min-width: 680px;
}

.admin-users-table th,
.admin-users-table td,
.kpi-table th,
.kpi-table td,
.rules-spec-table th,
.rules-spec-table td {
  vertical-align: top;
  line-height: 1.45;
}

.confirm-modal,
.auth-screen,
.modal-overlay {
  padding: clamp(14px, 3vw, 28px);
}

.confirm-card,
.auth-card,
.legal-modal-card,
.modal-content {
  max-height: min(88dvh, 920px);
  overflow: auto;
  overscroll-behavior: contain;
}

.site-hero,
.split-section,
.content-grid,
.doctor-layout,
.metric-grid,
.workflow-grid,
.kpi-hero-grid {
  min-width: 0;
}

.panel,
.hero-panel,
.admin-app-card,
.unified-timeline-card,
.kpi-card,
.doctor-rules-card,
.doctor-report-builder-card {
  border-radius: var(--radius-md);
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

@media (max-width: 1060px) {
  .site-nav,
  .site-hero,
  .split-section,
  .doctor-layout,
  .content-grid {
    grid-template-columns: 1fr !important;
  }

  .site-nav {
    gap: var(--space-4);
  }

  .site-links,
  .nav-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  :root {
    --shadow: 0 18px 46px rgba(0, 0, 0, .38);
  }

  .site-shell,
  .app-shell {
    width: 100%;
  }

  .site-hero,
  .site-section,
  .safety-band,
  #clinicsTeaser {
    padding-inline: 16px !important;
  }

  .site-hero h1,
  .hero-copy h1 {
    font-size: clamp(28px, 9vw, 42px);
    line-height: 1.08;
  }

  .trust-row,
  .hero-actions,
  .emergency-action-buttons,
  .emergency-banner-footer,
  .kpi-banner-cta,
  .doctor-actions-toolbar {
    align-items: stretch;
  }

  .trust-row span,
  .hero-actions > *,
  .emergency-action-buttons > *,
  .emergency-banner-footer > *,
  .kpi-banner-cta > *,
  .doctor-actions-toolbar > * {
    width: 100%;
    justify-content: center;
  }

  .admin-users-table,
  .kpi-table,
  .rules-spec-table {
    min-width: 620px;
    font-size: 12.5px;
  }

  .legal-modal-card,
  .auth-card {
    width: 100%;
    border-radius: 18px;
  }

  .emergency-alert-card,
  .emergency-pending-banner,
  .doctor-emergency-alert-banner {
    padding: 14px !important;
  }

  .role-stack div,
  .panel,
  .admin-app-card,
  .unified-timeline-card {
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .choice-row.three,
  .choice-row.four,
  .metric-grid,
  .workflow-grid {
    grid-template-columns: 1fr !important;
  }

  .brand,
  .auth-brand {
    min-width: 0;
  }

  .brand strong,
  .brand span,
  .topbar h2,
  .mobile-nav-label {
    overflow-wrap: anywhere;
  }

  .mobile-nav-btn {
    min-width: 48px;
    padding-inline: 5px;
  }
}

/* ==========================================================================
   DOCTOR REVIEW INTERFACE: PERSISTENT HEADER, STALE BANNER & DIFF MODAL
   ========================================================================== */

/* 1. Persistent Compact Patient & Case Identity Header */
.doctor-identity-header.sticky-header {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

body.dark .doctor-identity-header.sticky-header {
  background: rgba(19, 29, 45, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.identity-header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.identity-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.identity-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(14, 165, 164, 0.12);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.identity-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.identity-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.identity-name {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.identity-demographics {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 6px;
}

.identity-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.identity-code {
  font-family: monospace;
  font-size: 11px;
  color: var(--teal);
}

.identity-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.identity-case-pill,
.identity-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 8px;
}

.identity-status-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.doctor-draft-notice {
  margin-top: 8px;
  padding: 3px 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px dashed rgba(16, 185, 129, 0.4);
  border-radius: 6px;
  font-size: 11.5px;
  color: #059669;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body.dark .doctor-draft-notice {
  color: #34d399;
}

/* 2. Stale Revision "New Information Received" Banner */
.doctor-stale-revision-banner {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.14) 0%, rgba(245, 158, 11, 0.08) 100%);
  border: 2px solid #f59e0b;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pulseSubtleBorder 3s infinite alternate;
}

@keyframes pulseSubtleBorder {
  0% { border-color: #f59e0b; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.2); }
  100% { border-color: #ea580c; box-shadow: 0 0 12px 2px rgba(245, 158, 11, 0.18); }
}

.stale-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.stale-banner-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.stale-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-stale-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-stale-action.compare {
  background: var(--surface);
  border: 1.5px solid #d97706;
  color: #b45309;
}

.btn-stale-action.compare:hover {
  background: #fef3c7;
  color: #78350f;
}

.btn-stale-action.acknowledge {
  background: #10b981;
  color: #fff;
  border: 1.5px solid #059669;
}

.btn-stale-action.acknowledge:hover {
  background: #059669;
}

.btn-clinical.locked {
  background: #64748b !important;
  opacity: 0.65;
  cursor: not-allowed !important;
}

.btn-clinical.locked:hover {
  transform: none !important;
}

/* 3. Field-Level Comparison Modal */
.doctor-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.doctor-modal-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  max-width: 860px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

body.dark .doctor-modal-dialog {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.12);
}

.modal-dialog-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-close-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.modal-close-btn:hover {
  color: var(--ink);
  background: var(--line);
}

.modal-dialog-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.doctor-diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: start;
}

.doctor-diff-table th {
  background: var(--surface-2);
  color: var(--muted);
  padding: 10px 14px;
  font-weight: 800;
  border-bottom: 1.5px solid var(--line);
  text-align: start;
}

.doctor-diff-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.diff-row:hover {
  background: rgba(14, 165, 164, 0.04);
}

.diff-val-cell .val-text {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
}

.diff-val-cell .val-text.highlight-change {
  color: #059669;
}

body.dark .diff-val-cell .val-text.highlight-change {
  color: #34d399;
}

.diff-val-cell .meta-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.modal-dialog-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-discard-draft {
  background: transparent;
  border: none;
  color: #059669;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 11px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-discard-draft:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

body.dark .btn-discard-draft {
  color: #34d399;
}

body.dark .btn-discard-draft:hover {
  color: #ef4444;
}

/* Mobile Diff Cards Container (Hidden on Desktop) */
.doctor-diff-cards-container {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.doctor-diff-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  transition: all 0.18s ease;
}

.doctor-diff-card.changed {
  border-inline-start: 4px solid var(--teal);
  background: rgba(14, 165, 164, 0.04);
}

.doctor-diff-card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.diff-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}

.diff-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.diff-card-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diff-col-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.diff-card-col .val-text {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--ink);
}

.diff-card-col .val-text.highlight-change {
  color: #059669;
}

body.dark .diff-card-col .val-text.highlight-change {
  color: #34d399;
}

.diff-verification-box label:hover {
  color: var(--teal);
}

/* Accessible Keyboard Focus Rings */
.btn-stale-action:focus-visible,
.btn-clinical:focus-visible,
.modal-close-btn:focus-visible,
.diff-row:focus-visible,
.identity-case-pill:focus-visible,
.identity-date-pill:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Mobile Layout Responsive Adaptations */
@media (max-width: 768px) {
  .doctor-identity-header.sticky-header {
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .identity-header-main {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .identity-block {
    justify-content: space-between;
    width: 100%;
  }

  .identity-block.case-block {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .identity-badge-group {
    justify-content: flex-start;
  }

  .identity-status-group {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .doctor-stale-revision-banner {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .stale-banner-content {
    flex-direction: column;
    gap: 8px;
  }

  .stale-banner-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-stale-action {
    justify-content: center;
    width: 100%;
    min-height: 44px;
  }

  /* Switch diff table to cards on mobile */
  .doctor-diff-table-container {
    display: none;
  }

  .doctor-diff-cards-container {
    display: flex;
  }

  .doctor-modal-dialog {
    max-height: 94vh;
    border-radius: 16px;
  }

  .modal-dialog-header {
    padding: 14px 16px;
  }

  .modal-dialog-body {
    padding: 14px 16px;
  }

  .modal-dialog-footer {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .modal-dialog-footer button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .identity-sub-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .diff-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .identity-date-pill strong {
    display: none;
  }
}

/* ==========================================================================
   DOCTOR WORKSPACE REDESIGN: SPLIT LAYOUT, GROUPED SECTIONS, TABS & ACTION DOCK
   ========================================================================== */

/* 1. Wide Screen Split Layout (Master-Detail Workspace) */
@media (min-width: 1061px) {
  .doctor-layout {
    display: grid !important;
    grid-template-columns: minmax(340px, 390px) minmax(0, 1fr) !important;
    gap: 22px;
    align-items: start;
  }

  .doctor-queue-panel {
    display: flex !important;
    flex-direction: column;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: hidden;
  }

  .doctor-queue-panel .queue {
    overflow-y: auto;
    flex: 1;
    max-height: calc(100vh - 270px);
    padding-inline-end: 4px;
  }

  .doctor-review-panel {
    display: block !important;
    min-width: 0;
  }

  .doc-mobile-nav-bar {
    display: none !important;
  }
}

/* 2. Mobile Workspace Navigation (Queue Mode vs Review Mode) */
@media (max-width: 1060px) {
  .doctor-layout {
    display: block !important;
  }

  .doctor-layout.view-queue .doctor-review-panel {
    display: none !important;
  }

  .doctor-layout.view-queue .doctor-queue-panel {
    display: block !important;
    width: 100%;
  }

  .doctor-layout.view-review .doctor-queue-panel {
    display: none !important;
  }

  .doctor-layout.view-review .doctor-review-panel {
    display: block !important;
    width: 100%;
  }

  .doc-mobile-nav-bar {
    display: block;
    margin-bottom: 12px;
  }

  /* When on mobile, toggle active section display by active review tab */
  .doctor-review-panel #docSection-inputs,
  .doctor-review-panel #docSection-clarifications,
  .doctor-review-panel #docSection-notes,
  .doctor-review-panel #docSection-timeline {
    display: none;
  }

  .doctor-review-panel.tab-active-inputs #docSection-inputs { display: block; }
  .doctor-review-panel.tab-active-clarifications #docSection-clarifications { display: block; }
  .doctor-review-panel.tab-active-notes #docSection-notes { display: block; }
  .doctor-review-panel.tab-active-timeline #docSection-timeline { display: block; }
  .doctor-review-panel.tab-active-all #docSection-inputs,
  .doctor-review-panel.tab-active-all #docSection-clarifications,
  .doctor-review-panel.tab-active-all #docSection-notes,
  .doctor-review-panel.tab-active-all #docSection-timeline { display: block; }
}

/* Mobile Back to Patient Queue Button */
.btn-back-to-queue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1.5px solid var(--teal);
  border-radius: 12px;
  color: var(--teal);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(14, 165, 164, 0.1);
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-back-to-queue:hover {
  background: rgba(14, 165, 164, 0.08);
}

.btn-back-to-queue .back-arrow {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.btn-back-to-queue .queue-count-pill {
  margin-inline-start: auto;
  font-size: 11px;
  padding: 2px 8px;
}

/* 3. Accessible Review Workspace Section Tabs */
.doctor-review-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 16px;
  padding-bottom: 4px;
}

.doc-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 40px;
  font-family: inherit;
  position: relative;
}

.doc-tab-btn:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--teal);
}

.doc-tab-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(14, 165, 164, 0.3);
}

.doc-tab-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.tab-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
}

.tab-badge-dot.ok {
  background: #10b981;
}

.tab-badge-dot.info {
  background: #3b82f6;
}

/* 4. Clearly Grouped Clinical Sections (Cards) */
.clinical-group-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
  transition: all 0.2s ease;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.dark .clinical-group-card {
  background: rgba(23, 37, 56, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

.clinical-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1.5px solid var(--line);
}

.clinical-group-header .group-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clinical-group-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.clinical-group-header .group-icon {
  font-size: 18px;
  line-height: 1;
}

/* 5. Top Quick Review Actions Toolbar */
.doctor-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 12px 0 14px;
}

/* 6. Bottom Docked Actions Toolbar & Virtual Keyboard Safety */
.doctor-docked-actions {
  position: sticky;
  bottom: 0;
  z-index: 15;
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1.5px solid var(--line);
  border-radius: 0 0 16px 16px;
  padding: 14px 18px;
  margin-top: 20px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
}

body.dark .doctor-docked-actions {
  background: rgba(19, 29, 45, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
}

/* Ensure Virtual Keyboard NEVER covers textareas */
.doctor-report-builder-card textarea,
.clinical-group-card textarea {
  scroll-margin-bottom: 110px;
}

/* Safety for Enlarged Text & Long Records */
.summary-list strong,
.summary-list span,
.identity-meta h3,
.identity-meta span,
.diff-val-cell .val-text,
.doctor-diff-card .val-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ==========================================================================
   STRUCTURED CLINICAL CLARIFICATION THREAD STYLES
   ========================================================================== */

.clarification-thread-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.clarification-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--line);
}

.clarification-cycle-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

body.dark .clarification-cycle-card {
  background: rgba(23, 37, 56, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.clarification-cycle-card.state-unanswered {
  border-color: #f97316;
  background: color-mix(in srgb, #f97316 3%, var(--surface));
}

.clarification-cycle-card.state-submitted {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 3%, var(--surface));
}

.clarification-cycle-card.state-reviewed {
  border-color: #10b981;
}

.cycle-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.cycle-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cycle-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

/* Thread Messages */
.thread-message {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  line-height: 1.6;
  font-size: 13.5px;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: all 0.2s ease;
}

.thread-message.doctor-request {
  background: rgba(249, 115, 22, 0.06);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: var(--ink);
}

body.dark .thread-message.doctor-request {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
}

.thread-message.patient-response {
  background: rgba(14, 165, 164, 0.08);
  border: 1.5px solid var(--teal);
  color: var(--ink);
}

body.dark .thread-message.patient-response {
  background: rgba(14, 165, 164, 0.14);
  border-color: rgba(14, 165, 164, 0.5);
}

.message-meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.message-author-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.message-timestamp {
  font-size: 11.5px;
  color: var(--muted);
}

.message-body-text {
  margin: 0;
  line-height: 1.65;
  color: var(--ink);
}

/* Measurements Grid */
.thread-measurements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.measurement-chip {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark .measurement-chip {
  background: var(--surface-2);
}

.measurement-chip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.measurement-chip-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--teal);
}

.measurement-chip-unit {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

/* Permitted Attachments Notice & Attachment Chips */
.permitted-attachments-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.thread-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.thread-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
}

.thread-attachment-chip:hover {
  border-color: var(--teal);
  background: var(--cyan);
}

.thread-attachment-chip .file-size {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Direct Action Card to Answer Outstanding Request */
.thread-direct-action-card {
  background: color-mix(in srgb, #f97316 6%, var(--surface));
  border: 1.5px solid #f97316;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.08);
}

body.dark .thread-direct-action-card {
  background: rgba(249, 115, 22, 0.12);
  border-color: #fb923c;
}

.thread-action-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(249, 115, 22, 0.3);
}

.thread-action-header .action-icon {
  font-size: 20px;
  line-height: 1;
}

.thread-reply-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  box-sizing: border-box;
  scroll-margin-bottom: 120px;
  transition: border-color 0.2s ease;
}

.thread-reply-textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.15);
}

.thread-direct-action-card input {
  scroll-margin-bottom: 120px;
}

/* Stored Event Audit Footer */
.thread-audit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dotted var(--line);
}

.thread-audit-provenance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: monospace;
}

/* =============================================================================
   PATIENT BLOOD PRESSURE HISTORY & TREND VIEW
   ============================================================================= */

.patient-bp-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease-out;
}

.bp-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.bp-metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.bp-metric-card:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
}

.bp-clinical-disclaimer-banner {
  background: rgba(9, 184, 182, 0.08);
  border: 1px solid var(--teal);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.bp-chart-card-wrapper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

/* Insufficient Data State Card (When < 2 measurements) */
.bp-insufficient-data-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 20px;
  background: var(--surface-2);
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  text-align: start;
}

.bp-insufficient-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.bp-insufficient-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
}

.bp-insufficient-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 12px;
}

.bp-insufficient-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bp-count-pill,
.bp-unit-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

/* Chart SVG Styles */
.bp-trend-svg {
  overflow: visible;
  touch-action: pan-x pan-y;
}

.chart-dot {
  cursor: pointer;
  transition: r 0.2s ease, stroke-width 0.2s ease;
}

.chart-point-group:hover .chart-dot,
.chart-point-group:focus .chart-dot {
  r: 6.5;
  stroke: #ffffff;
  stroke-width: 2.5;
  outline: none;
}

/* Timeline Cards */
.bp-timeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.bp-timeline-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.bp-timeline-card.bp-card-incomplete {
  border-color: var(--amber);
  background: rgba(240, 180, 41, 0.03);
}

.bp-source-badge.badge-bt {
  border-color: rgba(9, 184, 182, 0.3);
  color: var(--teal);
}

.bp-source-badge.badge-clinic {
  border-color: rgba(44, 197, 112, 0.3);
  color: var(--green);
}

.bp-source-badge.badge-manual {
  border-color: rgba(129, 140, 248, 0.3);
  color: #818cf8;
}

.bp-source-badge.badge-ocr {
  border-color: rgba(240, 180, 41, 0.3);
  color: var(--amber);
}

.bp-source-badge.badge-auto {
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.bp-gap-alert-card {
  animation: pulseSlow 3s infinite ease-in-out;
}

/* Responsive Breakpoints */
@media (max-width: 640px) {
  .bp-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .bp-view-header {
    flex-direction: column;
    align-items: stretch;
  }

  .bp-header-actions {
    justify-content: flex-start;
  }

  .bp-insufficient-data-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .bp-pressure-reading {
    font-size: 20px !important;
  }
}

/* =============================================================================
 * 🚨 PRD Section 18: Prominent & Permanent Clinical Medical Disclaimer
 * ============================================================================= */
.prd-medical-disclaimer-box {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.08);
}

.prd-medical-disclaimer-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.14);
}

@media (max-width: 640px) {
  .prd-medical-disclaimer-box {
    padding: 14px 14px !important;
    gap: 10px !important;
  }
}

/* =============================================================================
 * 🩺 PRD Req 39: Complete Medical Profile Setup Screen Styling
 * ============================================================================= */
.cmp-container {
  max-width: 900px;
  margin: 0 auto;
}

.cmp-panel {
  border-top: 4px solid var(--teal, #0ea5a4) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
  padding: 24px !important;
  background: var(--surface) !important;
}

.cmp-progress-container {
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 20px;
}

.cmp-progress-track {
  background: var(--surface-2, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

.cmp-progress-fill {
  background: linear-gradient(90deg, var(--teal, #0ea5a4), #10b981);
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(14, 165, 164, 0.4);
}

.cmp-section-card {
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cmp-section-card:hover {
  border-color: rgba(14, 165, 164, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.cmp-section-card:focus-within {
  border-color: var(--teal, #0ea5a4);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.15);
}

.cmp-sex-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.cmp-sex-label:hover {
  border-color: var(--teal, #0ea5a4);
  background: rgba(14, 165, 164, 0.04);
  transform: translateY(-1px);
}

.cmp-sex-label:has(input:checked) {
  border-color: var(--teal, #0ea5a4);
  background: rgba(14, 165, 164, 0.12);
  box-shadow: 0 0 0 2px rgba(14, 165, 164, 0.25);
}

.cmp-chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cmp-chip {
  font-size: 11.5px !important;
  padding: 5px 12px !important;
  border-radius: 20px !important;
  transition: all 0.2s ease !important;
}

.cmp-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.cmp-chip:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .cmp-panel {
    padding: 16px !important;
    border-radius: 12px !important;
  }
}

/* =============================================================================
 * 🫁 PRD Req 40: Patient Home Dashboard (Modules, Status, Appointments, Alerts)
 * ============================================================================= */
.patient-dashboard-v2 {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.patient-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.patient-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.patient-section-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ── Available Clinical Modules Grid ── */
.patient-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.patient-module-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.patient-module-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal, #0ea5a4);
  box-shadow: 0 12px 30px rgba(14, 165, 164, 0.12);
}

.patient-module-card.flagship {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px solid var(--teal, #0ea5a4);
  box-shadow: 0 8px 30px rgba(14, 165, 164, 0.12);
}

body.dark .patient-module-card.flagship {
  background: linear-gradient(135deg, rgba(14, 165, 164, 0.08) 0%, rgba(15, 23, 42, 0.8) 100%);
  border-color: rgba(14, 165, 164, 0.5);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.patient-module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.patient-module-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(14, 165, 164, 0.12);
  color: var(--teal, #0ea5a4);
  flex-shrink: 0;
}

.patient-module-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.patient-module-badge.active {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.patient-module-badge.flagship {
  background: rgba(14, 165, 164, 0.15);
  color: var(--teal, #0ea5a4);
  border: 1px solid rgba(14, 165, 164, 0.4);
}

.patient-module-badge.coming-soon {
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
  border: 1px solid var(--line);
}

.patient-module-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 16px;
}

.patient-module-chip {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
}

/* ── Latest Assessment & Upcoming Appointment Dual Grid ── */
.patient-dual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.patient-status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.patient-status-card.approved {
  border-top: 4px solid #16a34a;
}

.patient-status-card.pending {
  border-top: 4px solid #f59e0b;
}

.patient-status-card.needs-followup {
  border-top: 4px solid #ea580c;
}

.patient-status-card.escalated {
  border-top: 4px solid #ef4444;
}

.patient-status-vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0;
}

.patient-vital-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.patient-vital-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.patient-vital-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.patient-status-banner {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.patient-status-banner.approved {
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.3);
  color: #15803d;
}

body.dark .patient-status-banner.approved {
  color: #4ade80;
}

.patient-status-banner.pending {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #b45309;
}

body.dark .patient-status-banner.pending {
  color: #fbbf24;
}

.patient-status-banner.needs-followup {
  background: rgba(234, 88, 12, 0.1);
  border: 1px solid rgba(234, 88, 12, 0.3);
  color: #c2410c;
}

body.dark .patient-status-banner.needs-followup {
  color: #fb923c;
}

.patient-status-banner.escalated {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #b91c1c;
}

body.dark .patient-status-banner.escalated {
  color: #f87171;
}

.patient-status-banner.ready {
  background: rgba(14, 165, 164, 0.08);
  border: 1px solid rgba(14, 165, 164, 0.25);
  color: var(--teal, #0ea5a4);
}

/* ── Upcoming Appointment Card ── */
.patient-appt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 4px solid var(--teal, #0ea5a4);
}

.patient-appt-body {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.patient-appt-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.patient-appt-doc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

/* ── Alerts & Notifications Feed ── */
.patient-alerts-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

@media (max-width: 640px) {
  .patient-dual-grid {
    grid-template-columns: 1fr;
  }
  .patient-modules-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
 * 🩺 PRD Req 41: Verified Doctor Screen Workspace (Tabs, Patients, Queue, Reports)
 * ============================================================================= */
.doctor-workspace-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.doctor-workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  transition: all 0.25s ease;
  user-select: none;
}

.doctor-workspace-tab:hover {
  background: rgba(14, 165, 164, 0.08);
  border-color: var(--teal, #0ea5a4);
  color: var(--teal, #0ea5a4);
  transform: translateY(-1px);
}

.doctor-workspace-tab.active {
  background: var(--teal, #0ea5a4) !important;
  border-color: var(--teal, #0ea5a4) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(14, 165, 164, 0.3);
}

.doctor-workspace-tab.active .pill {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

/* ── Assigned Patients Directory Cards ── */
.doctor-patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.doctor-assigned-patient-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.doctor-assigned-patient-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal, #0ea5a4);
  box-shadow: 0 8px 24px rgba(14, 165, 164, 0.1);
}

.doctor-patient-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.doctor-patient-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(14, 165, 164, 0.12);
  color: var(--teal, #0ea5a4);
  flex-shrink: 0;
}

.doctor-patient-metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
  text-align: center;
}

.doctor-patient-metric-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doctor-patient-metric-box small {
  font-size: 10.5px;
  color: var(--muted);
}

.doctor-patient-metric-box strong {
  font-size: 13px;
  color: var(--ink);
}

/* ── Approved Reports Ledger Cards ── */
.doctor-reports-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.doctor-approved-report-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid #16a34a;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[dir="rtl"] .doctor-approved-report-card {
  border-left: 1px solid var(--line);
  border-right: 4px solid #16a34a;
}

.doctor-approved-report-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.12);
}

@media (max-width: 768px) {
  .doctor-approved-report-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ══════════════════════════════════════════════════════════════
   ADMIN WORKSPACE & AI QUALITY BENCHMARK STYLES (Req 42)
   ══════════════════════════════════════════════════════════════ */
.admin-workspace-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.admin-workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  transition: all 0.25s ease;
  user-select: none;
}

.admin-workspace-tab:hover {
  background: rgba(14, 165, 164, 0.08);
  border-color: var(--teal, #0ea5a4);
  color: var(--teal, #0ea5a4);
  transform: translateY(-1px);
}

.admin-workspace-tab.active {
  background: var(--teal, #0ea5a4) !important;
  border-color: var(--teal, #0ea5a4) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(14, 165, 164, 0.3);
}

.admin-workspace-tab.active .pill {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

/* AI Quality & Performance Metric Cards */
.admin-ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.admin-ai-metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-ai-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.admin-ai-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.admin-ai-metric-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  line-height: 1.1;
  margin-bottom: 4px;
}

.admin-benchmark-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-benchmark-matrix th,
.admin-benchmark-matrix td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: start;
}

.admin-benchmark-matrix th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-benchmark-matrix tr:last-child td {
  border-bottom: none;
}





/* ==========================================================================
   ROLOGY CLINICAL APPROVAL & REVIEW COCKPIT (UNIFIED WORKSTATION)
   Benchmark: Rology (Single-Screen Teleradiology / Clinical Verification)
   ========================================================================== */

.rology-cockpit-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  animation: fadeInCockpit 0.25s ease-out;
}

@keyframes fadeInCockpit {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 1. Cockpit Patient Header */
.cockpit-patient-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

body.dark .cockpit-patient-header {
  background: rgba(23, 37, 56, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.cockpit-patient-header .header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.patient-avatar-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(14, 165, 233, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.patient-main-meta .title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.patient-main-meta .patient-name {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.sub-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.meta-separator {
  color: var(--line);
}

.doctor-linkage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--ink);
}

.doctor-name-tag {
  color: #10b981;
  font-weight: 700;
}

/* 2. Cockpit Action Buttons */
.header-actions,
.bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-cockpit {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-cockpit:hover {
  transform: translateY(-1.5px);
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-cockpit:active {
  transform: translateY(0);
}

.btn-cockpit.approve {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.btn-cockpit.modify-approve {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
}

.btn-cockpit.reject {
  background: #f1f5f9;
  color: #dc2626;
  border: 1.5px solid rgba(220, 38, 38, 0.3);
}

body.dark .btn-cockpit.reject {
  background: rgba(220, 38, 38, 0.12);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

.btn-cockpit.request-followup {
  background: #fff7ed;
  color: #ea580c;
  border: 1.5px solid rgba(234, 88, 12, 0.35);
}

body.dark .btn-cockpit.request-followup {
  background: rgba(234, 88, 12, 0.12);
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.35);
}

/* Emergency banner */
.cockpit-emergency-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.08));
  border: 2px solid #ef4444;
  border-radius: 14px;
  color: #dc2626;
  animation: pulseEmergency 2s infinite ease-in-out;
}

body.dark .cockpit-emergency-banner {
  color: #fca5a5;
}

@keyframes pulseEmergency {
  0%, 100% { border-color: #ef4444; box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
  50% { border-color: #b91c1c; box-shadow: 0 0 16px rgba(239, 68, 68, 0.3); }
}

.cockpit-emergency-banner .banner-icon {
  font-size: 28px;
}

.cockpit-emergency-banner p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
}

/* 3. Unified 2-Column Ergonomic Grid */
.cockpit-unified-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 1100px) {
  .cockpit-unified-grid {
    grid-template-columns: 1fr;
  }
}

.cockpit-col-inputs,
.cockpit-col-decision {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 4. Cockpit Cards */
.cockpit-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

body.dark .cockpit-card {
  background: rgba(23, 37, 56, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

.cockpit-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-group h4 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
}

/* History Content */
.history-content-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.block-label {
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
}

.block-value {
  color: var(--ink);
  font-weight: 600;
}

.tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.chip-condition {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.chip-condition.active.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

body.dark .chip-condition.active.danger {
  color: #f87171;
}

.allergy-val.alert {
  color: #dc2626;
  font-weight: 800;
}

.allergy-val.safe {
  color: #10b981;
}

/* Vitals Matrix */
.vitals-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.vital-tile {
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
}

.vital-tile.critical {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.vital-tile.warning {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.vital-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.vital-num {
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  font-family: var(--font-mono, monospace);
}

.vital-tile.critical .vital-num {
  color: #dc2626;
}

.vital-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

/* Complaint Box */
.complaint-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.complaint-row {
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.5;
}

.complaint-label {
  color: var(--teal);
}

.complaint-text {
  color: var(--ink);
  font-weight: 600;
}

.complaint-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

/* Attached Diagnostics Gallery */
.cockpit-attachments-preview {
  margin-top: 10px;
}

.att-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.att-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.att-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.18s ease;
}

.att-card:hover {
  background: var(--surface);
  border-color: var(--teal);
  transform: translateY(-1px);
}

.att-thumb {
  font-size: 26px;
}

.att-info {
  display: flex;
  flex-direction: column;
}

.att-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.att-info small {
  font-size: 11px;
  color: var(--muted);
}

/* 5. AI Diagnostic Outputs Card */
.ai-prediction-box {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(16, 185, 129, 0.1));
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.pred-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.pred-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.35;
}

/* Confidence Gauge */
.ai-confidence-container {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.gauge-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}

.confidence-circle {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}

.circle-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  transition: stroke-dashoffset 0.8s ease-out;
}

.gauge-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pct-num {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-mono, monospace);
}

.pct-sub {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.confidence-details {
  flex: 1;
  min-width: 180px;
}

.conf-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* AI Evidence List */
.ai-evidence-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.evidence-title {
  font-size: 12.5px;
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.evidence-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evidence-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.evidence-list li:last-child {
  border-bottom: none;
}

.ai-regulatory-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(14, 165, 233, 0.06);
  border-radius: 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.ai-regulatory-notice p {
  margin: 0;
}

/* Protocol Text Preview */
.regimen-preview-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.regimen-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.5;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed var(--line);
}

/* 6. Bottom Sticky Action Bar */
.cockpit-bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

body.dark .cockpit-bottom-bar {
  background: rgba(19, 29, 45, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

.bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* 7. Modal Dialogs */
.cockpit-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cockpit-modal-dialog {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

body.dark .cockpit-modal-dialog {
  background: #131d2d;
  border-color: rgba(255, 255, 255, 0.12);
}

.cockpit-modal-dialog.radiology-dialog {
  max-width: 720px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1.5px solid var(--line);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.modal-body {
  padding: 20px;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1.5px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}

/* 🛡️ Docus AI Benchmark (Req #61): Clinical Override & Rejection Audit */
.docus-override-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(14, 165, 233, 0.08);
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
}

body.dark .docus-override-notice {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
}

.docus-override-notice.rejection {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.35);
}

body.dark .docus-override-notice.rejection {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
}

.override-validation-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.override-validation-badge.invalid {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

body.dark .override-validation-badge.invalid {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
}

.override-validation-badge.valid {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

body.dark .override-validation-badge.valid {
  background: rgba(22, 163, 74, 0.15);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.3);
}

.mandatory-override-box {
  background: var(--surface-2);
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
}

.mandatory-override-box.highlight-required {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

body.dark .mandatory-override-box.highlight-required {
  border-color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
}

