/* ============================================================
   MEDISARTHI — UNIFIED EDITORIAL MEDICAL DESIGN SYSTEM
   Optimized for: 1366 × 768 Kiosk · Vanilla CSS · Patient First
   ============================================================ */

/* ── Brand Color Palette & Design Tokens ────────────────────── */
:root {
  --bg:           #F7F4EE;
  --bg-white:     #FFFFFF;
  --bg-subtle:    #EFECE5;
  --bg-kiosk:     #F7F4EE;

  /* Indigo Blue Palette */
  --indigo-deepest:#1B2A4A;
  --indigo-deep:   #1B2A4A;
  --indigo-primary:#253B5E;
  --indigo-mid:    #2B436B;
  --indigo-light:  #64748B;
  --indigo-tint:   #EFF4F9;
  --indigo-bright: #253B5E;

  /* Aliased for full backward compatibility across all modules */
  --teal-deepest: #1B2A4A;
  --teal-deep:    #1B2A4A;
  --teal-primary: #253B5E;
  --teal-mid:     #2B436B;
  --teal-light:   #64748B;
  --teal-tint:    #EFF4F9;
  --teal-bright:  #253B5E;

  --orange:       #D96C2F;
  --orange-primary: #D96C2F;
  --orange-hover: #C45A20;
  --orange-soft:  #FDF2EA;

  --charcoal:     #1B2A4A;
  --text:         #1B2A4A;
  --text-sub:     #475569;
  --text-muted:   #64748B;

  --border:       #E2D9D0;
  --border-light: #EEE9E3;
  --border-subtle:#E2D9D0;

  --font:         'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif:   Georgia, 'Times New Roman', serif;

  --radius-lg:    8px;
  --radius:       6px;
  --radius-sm:    4px;
  --radius-xs:    3px;
  --radius-pill:  999px;

  --shadow-xs:    0 1px 2px rgba(18,59,66,0.04);
  --shadow-sm:    0 2px 6px rgba(18,59,66,0.06);
  --shadow-md:    0 4px 14px rgba(18,59,66,0.08);
  --shadow:       0 8px 24px rgba(18,59,66,0.10);

  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --fast:         0.14s;
  --med:          0.22s;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, button, select, textarea {
  font-family: inherit;
}

/* ── Layout ───────────────────────────────────────────────── */
.ms-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

@media (min-width: 961px) {
  .ms-layout {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
}

/* ── Focus-visible Accessibility ──────────────────────────── */
:focus-visible {
  outline: 2px solid var(--teal-bright) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(45, 130, 124, 0.25) !important;
}


/* ── Header ───────────────────────────────────────────────── */
.ms-header {
  height: 52px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.ms-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.ms-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ms-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--teal-deepest);
  letter-spacing: -0.02em;
}

.ms-brand-name span {
  color: var(--orange);
}

.ms-header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Refined language selector */
.ms-lang-row {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.ms-lang-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.ms-lang-btn:hover {
  color: var(--teal-primary);
  background: #fff;
}

.ms-lang-btn.active {
  color: #fff;
  background: var(--teal-deep);
}

.ms-help-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--fast);
}

.ms-help-btn:hover {
  color: var(--teal-primary);
}

/* ── Canvas Stage ─────────────────────────────────────────── */
.ms-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow-y: auto;
  position: relative;
}

/* ── Screens Container ────────────────────────────────────── */
.kiosk-screen-block {
  display: none;
  width: 100%;
  animation: fadeUp 0.24s var(--ease);
}

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

.ms-screen-narrow {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

.ms-screen-medium {
  max-width: 960px;
  width: 92%;
  margin: 0 auto;
  padding: 28px 24px;
}

.ms-screen-wide {
  max-width: 1140px;
  width: 95%;
  margin: 0 auto;
  padding: 0;
}

/* ── Split Kiosk Layout for High Touch Usability ───────────── */
.ms-kiosk-split {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 36px;
  align-items: start;
}

.ms-kiosk-left {
  padding-right: 12px;
}

.ms-kiosk-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Typography Hierarchy ─────────────────────────────────── */
.ms-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ms-headline {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--teal-deepest);
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.ms-headline-xl {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--teal-deepest);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.ms-subline {
  font-size: 0.92rem;
  color: var(--text-sub);
  line-height: 1.5;
  margin-bottom: 20px;
}

.ms-question {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--teal-deepest);
  line-height: 1.3;
  margin-bottom: 4px;
}

.ms-question-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── BUTTON SYSTEM ────────────────────────────────────────── */
/* Primary: Orange #D96C2F */
.btn-primary,
.btn-kiosk-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 26px;
  background: var(--orange);
  color: #FFFFFF;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(217,108,47,0.18);
}

.btn-primary:hover,
.btn-kiosk-primary:hover {
  background: var(--orange-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(217,108,47,0.24);
}

.btn-primary:active,
.btn-kiosk-primary:active {
  transform: translateY(0);
}

.btn-primary-xl {
  height: 54px;
  font-size: 1rem;
  padding: 0 36px;
}

.btn-outline,
.btn-kiosk-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  background: var(--bg-white);
  color: var(--teal-deep);
  border: 1.5px solid var(--teal-deep);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
  white-space: nowrap;
}

.btn-outline:hover,
.btn-kiosk-secondary:hover {
  background: var(--teal-tint);
  border-color: var(--teal-primary);
  color: var(--teal-primary);
}

.btn-ghost,
.btn-back-flat,
.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 6px 4px;
  transition: color var(--fast);
}

.btn-ghost:hover,
.btn-back-flat:hover,
.btn-back:hover {
  color: var(--teal-deepest);
}

.btn-help-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-help-link:hover {
  color: var(--teal-primary);
}

/* ── Inputs ───────────────────────────────────────────────── */
.ms-input,
.kiosk-input,
.kiosk-input-flat {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-size: 0.94rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.ms-input:focus,
.kiosk-input:focus,
.kiosk-input-flat:focus {
  border-color: var(--teal-primary);
  box-shadow: 0 0 0 3px var(--teal-tint);
}

.ms-input::placeholder,
.kiosk-input::placeholder,
.kiosk-input-flat::placeholder {
  color: var(--text-muted);
}

.ms-input-lg {
  height: 52px;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-align: center;
}

select.ms-input,
select.kiosk-input,
select.kiosk-input-flat {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236C7E82' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ── Option Rows / Tiles (Clean Flat Look) ────────────────── */
.ms-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
  width: 100%;
  text-align: left;
}

.ms-option:hover {
  border-color: var(--teal-primary);
  background: var(--teal-tint);
}

.ms-option.selected {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.ms-option-label {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--teal-deepest);
  display: block;
}

.ms-option-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* ── Nav Footer ───────────────────────────────────────────── */
.ms-nav,
.step-nav-footer,
.canvas-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

/* ── Progress Strip ───────────────────────────────────────── */
.ms-progress-strip,
.aq-progress-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ms-step-count,
.aq-step-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ms-progress-bar,
.aq-progress-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: 6px 0 20px;
  overflow: hidden;
}

.ms-progress-fill,
.aq-progress-fill {
  height: 100%;
  background: var(--teal-primary);
  border-radius: 2px;
  transition: width 0.3s var(--ease);
}

/* ── Voice Zone ───────────────────────────────────────────── */
.ms-voice-area {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: center;
  margin-bottom: 14px;
}

.ms-mic-btn,
.voice-mic-trigger {
  width: 60px;
  height: 60px;
  background: var(--teal-deep);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--fast) var(--ease);
  margin-bottom: 8px;
}

.ms-mic-btn:hover,
.voice-mic-trigger:hover {
  background: var(--teal-primary);
  transform: scale(1.04);
}

.ms-mic-btn.listening,
.voice-mic-trigger.listening {
  background: var(--orange);
  animation: pulseMic 1.4s ease infinite;
}

@keyframes pulseMic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,108,47,0.35); }
  50%       { box-shadow: 0 0 0 12px rgba(217,108,47,0); }
}

.ms-voice-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.voice-wave-eq {
  display: flex;
  gap: 4px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}

.voice-wave-bar {
  width: 3.5px;
  background: var(--teal-primary);
  border-radius: 2px;
  animation: waveEq 0.8s ease-in-out infinite;
}

.voice-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-wave-bar:nth-child(4) { animation-delay: 0.1s; }

@keyframes waveEq {
  0%, 100% { height: 4px; }
  50%       { height: 18px; }
}

.voice-confirm-banner {
  background: var(--teal-tint);
  border: 1px solid var(--teal-primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 10px;
}

.voice-confirm-heading {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--teal-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.voice-transcription-preview {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--teal-deep);
  font-weight: 600;
  margin-bottom: 10px;
}

/* ── Symptom Rows ─────────────────────────────────────────── */
.ms-symptom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.ms-symptom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.ms-symptom-row:hover {
  border-color: var(--teal-primary);
  background: var(--teal-tint);
}

.ms-symptom-icon {
  width: 32px;
  height: 32px;
  background: var(--teal-tint);
  color: var(--teal-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.ms-symptom-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--teal-deepest);
}

.ms-symptom-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Chips / Allergies ────────────────────────────────────── */
.ms-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.ms-chip,
.allergy-chip {
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--bg-white);
  color: var(--text-sub);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.ms-chip:hover,
.allergy-chip:hover {
  border-color: var(--teal-primary);
  color: var(--teal-primary);
  background: var(--teal-tint);
}

.ms-chip.selected,
.allergy-chip.selected {
  background: var(--teal-tint);
  border-color: var(--teal-primary);
  color: var(--teal-deep);
}

.ms-chip.safe.selected {
  background: #ECFDF5;
  border-color: #10B981;
  color: #065F46;
}

/* ── AQ Options ───────────────────────────────────────────── */
.options-vertical-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.option-touch-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--teal-deepest);
  text-align: left;
  transition: all var(--fast) var(--ease);
}

.option-touch-btn:hover {
  border-color: var(--teal-primary);
  background: var(--teal-tint);
}

.option-touch-btn.selected {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--teal-deep);
}

/* ── Severity Grid ────────────────────────────────────────── */
.severity-ratings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.severity-card {
  padding: 16px 12px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all var(--fast) var(--ease);
}

.severity-card h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--teal-deepest);
}

.severity-card p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

.severity-card:hover {
  border-color: var(--teal-primary);
  background: var(--teal-tint);
}

.severity-card.selected {
  border-color: var(--orange);
  background: var(--orange-soft);
}

/* ── Body Map ─────────────────────────────────────────────── */
.body-location-wrapper {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: start;
}

.body-silhouette-card {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.body-zones-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zone-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-sub);
  transition: all var(--fast) var(--ease);
  text-align: left;
}

.zone-select-btn:hover,
.zone-select-btn.active {
  border-color: var(--teal-primary);
  color: var(--teal-deep);
  background: var(--teal-tint);
}

/* ── Typography & Card Helpers ────────────────────────────── */
.kiosk-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--teal-deepest);
  margin-bottom: 6px;
  line-height: 1.25;
}

.kiosk-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.kiosk-card {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

/* ── Documents & Uploads ──────────────────────────────────── */
.ms-upload-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.ms-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-white);
  transition: all var(--fast) var(--ease);
}

.ms-upload-zone:hover {
  border-color: var(--teal-primary);
  background: var(--teal-tint);
}

.ms-doc-row,
.uploaded-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.ms-doc-row:last-child,
.uploaded-file-item:last-child {
  border-bottom: none;
}

.ms-doc-info,
.doc-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ms-doc-icon,
.doc-file-icon {
  width: 32px;
  height: 32px;
  background: var(--teal-tint);
  color: var(--teal-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.ms-doc-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal-deepest);
}

.ms-doc-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Summary & History ────────────────────────────────────── */
.summary-story-section {
  margin-bottom: 18px;
}

.summary-story-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-table-card {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.86rem;
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  margin-right: 14px;
}

.summary-val {
  font-weight: 600;
  color: var(--teal-deepest);
  text-align: right;
}

/* ── Token Issued ─────────────────────────────────────────── */
.ms-token-box {
  text-align: center;
  padding: 20px 16px 16px;
}

.ms-token-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 12px;
}

.ms-token-number {
  font-size: 4.5rem;
  font-weight: 300;
  color: var(--teal-deepest);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

/* ── Modals & Overlays ────────────────────────────────────── */
.modal-overlay,
#help-modal,
#report-preview-modal,
#conversation-modal,
#ayush-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 9950;
  align-items: center;
  justify-content: center;
}

#scan-overlay,
#medical-document-scanner {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(5px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active,
#help-modal.active,
#report-preview-modal.active,
#conversation-modal.active,
#ayush-modal.active,
#scan-overlay.active,
#medical-document-scanner.active {
  display: flex;
}

.ms-modal,
.modal-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  width: 480px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}

.ms-scan-inner {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
}

/* ── System Toast Notification (Top-Center) ───────────────── */
#app-notification {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.4;
  z-index: 9900;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
  width: max-content;
  min-width: 280px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#app-notification.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

#app-notification .notification-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notification-success .notification-icon {
  color: #22c55e;
}

.notification-warning .notification-icon {
  color: #f59e0b;
}

.notification-info .notification-icon {
  color: #3b82f6;
}

.notification-error .notification-icon {
  color: #ef4444;
}

/* ── Medical Document Camera Scanner ────────────────────── */
.med-scanner-card {
  background: var(--bg-white, #ffffff);
  border-radius: var(--radius-lg, 16px);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.1));
  overflow: hidden;
}

.med-scanner-header {
  padding: 16px 20px;
  background: var(--teal-deepest, #0f172a);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.med-scanner-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.med-scanner-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  background: var(--bg-kiosk, #f8fafc);
}

.med-camera-viewport {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 4 / 3;
  background: #000000;
  border-radius: var(--radius, 12px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--teal-deep, #1e293b);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.med-camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.med-camera-frame {
  position: absolute;
  inset: 20px;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.med-camera-guide-line {
  width: 100%;
  height: 2px;
  background: var(--orange-primary, #d96c2f);
  box-shadow: 0 0 10px var(--orange-primary, #d96c2f);
  animation: medLaserSweep 2s infinite alternate ease-in-out;
}

@keyframes medLaserSweep {
  0% { transform: translateY(-60px); }
  100% { transform: translateY(60px); }
}

.med-camera-instructions {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
  text-align: center;
}

.med-preview-container {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.med-preview-img-wrapper {
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius, 12px);
  overflow: hidden;
  border: 1px solid var(--border, #cbd5e1);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.1));
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.med-preview-img-wrapper img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.med-scanner-footer {
  padding: 16px 20px;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── AI Safety Alert ──────────────────────────────────────── */
.ai-safety-alert {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.8rem;
  color: #92400E;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}

/* ── Form & Profile Helpers ───────────────────────────────── */
.ms-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gender-btn {
  padding: 9px 18px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-sub);
  transition: all var(--fast);
}

.gender-btn.active {
  background: var(--teal-tint);
  border-color: var(--teal-primary);
  color: var(--teal-deep);
}

.ms-retrieved-card {
  background: var(--teal-tint);
  border: 1.5px solid var(--teal-primary);
  border-radius: var(--radius);
  padding: 16px 20px;
}

@keyframes laserSweep {
  from { transform: translateY(-70px); }
  to   { transform: translateY(70px); }
}

/* ─────────────────────────────────────────────────────────── */
/*  DOCTOR CLINICAL WORKSTATION STYLES                        */
/* ─────────────────────────────────────────────────────────── */

.doctor-header {
  background: var(--teal-deepest);
  color: #fff;
  padding: 0 28px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.doctor-header h1 {
  font-size: 1.05rem;
  font-weight: 700;
}

.doc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #FFFFFF;
}

#doctor-dashboard-main {
  display: none;
  min-height: 100vh;
  background: var(--bg);
}

.doctor-layout-grid,
.doc-main-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 108px);
  gap: 0;
}

.patient-queue-panel,
.doc-queue-panel {
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
}

.doc-consult-main,
.doc-detail-panel {
  overflow-y: auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.doc-queue-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--teal-deepest);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.doc-queue-count {
  background: var(--orange);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

#doc-queue-list {
  padding: 4px 0;
}

.queue-patient-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 6px;
  transition: all var(--fast);
  border: 1px solid var(--border-light);
  background: var(--bg-white);
}

.queue-patient-card:hover,
.queue-patient-card.active {
  background: var(--teal-tint);
  border-color: var(--teal-primary);
}

.doc-section-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.doc-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-primary);
  margin-bottom: 12px;
}

.doc-stats-row {
  display: flex;
  gap: 14px;
  padding: 12px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.doc-stat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  min-width: 100px;
}

.doc-stat-item {
  text-align: center;
  min-width: 60px;
}

.doc-stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--teal-deep);
}

.doc-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.table-responsive {
  overflow-x: auto;
}

.prescription-input-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.prescription-input-table th,
.prescription-input-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.prescription-input-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--teal-deepest);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-waiting    { background: #FEF3C7; color: #92400E; }
.status-consulting { background: #DBEAFE; color: #1E40AF; }
.status-done       { background: #D1FAE5; color: #065F46; }

/* ── Doctor Login ─────────────────────────────────────────── */
.ms-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.ms-login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 400px;
  max-width: 92vw;
}
#doctor-login-card { }
/* ============================================================
   MEDISARTHI — SIGNATURE HOMEPAGE (FITS INSIDE 1366 × 768)
   ============================================================ */

.ms-home-screen {
  max-width: none !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide top white navigation header bar on Screen 1 (Homepage) and Screen 2 (Language Selection) */
.ms-layout:has(#step-1:not([style*="none"])) .ms-header,
body:has(#step-1:not([style*="none"])) .ms-header,
.ms-layout:has(#step-2:not([style*="none"])) .ms-header,
body:has(#step-2:not([style*="none"])) .ms-header {
  display: none !important;
}



.ms-home {
  position: relative;
  width: 100%;
  background: var(--bg);
  color: var(--teal-deepest);
}

@media (min-width: 961px) {
  .ms-home {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .ms-home-brand {
    position: absolute;
    top: 20px;
    left: 48px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 10;
  }

  .ms-home-topline {
    position: absolute;
    top: 26px;
    right: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--teal-primary);
    z-index: 10;
  }

  .ms-home-content {
    position: absolute;
    left: 0;
    right: 0;
    width: min(1200px, calc(100% - clamp(48px, 6vw, 96px)));
    margin: 0 auto;
    top: clamp(64px, 9vh, 88px);
    bottom: clamp(60px, 8vh, 76px);
    transform: none;

    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: clamp(24px, 4vw, 48px);
    z-index: 5;
  }
}

/* ---------- LEFT COPY ---------- */
.ms-home-copy {
  position: relative;
  z-index: 5;
  padding-left: 0;
  align-self: center;
  margin-bottom: 0;
}

.ms-home-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--teal-primary);
}

.ms-home-kicker::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--teal-primary);
}

.ms-home-copy h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(38px, 4.2vw, 62px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--teal-deepest);
}

.ms-home-copy h1 span {
  color: var(--orange);
}

.ms-home-copy p {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-sub);
}

/* ---------- GET STARTED BUTTON ---------- */
.ms-home-start {
  margin-top: 24px;
  width: 290px;
  height: 54px;

  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--orange);
  color: #FFFFFF;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;

  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;

  /* Tactile, non-cliché solid subtle drop */
  box-shadow: 0 2px 6px rgba(18, 59, 66, 0.12);
  transition: all var(--fast) var(--ease);
}

.ms-home-start i {
  font-size: 14px;
  transition: transform var(--fast) var(--ease);
}

.ms-home-start:hover {
  background: var(--orange-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(18, 59, 66, 0.16);
}

.ms-home-start:hover i {
  transform: translateX(4px);
}

.ms-home-start:active {
  transform: translateY(0);
}

/* ---------- INPUT CHANNELS: SPEAK / TYPE / CHOOSE ---------- */
.ms-home-inputs {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--teal-deepest);
}

.ms-home-inputs > div:not(.ms-home-divider) {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.ms-home-inputs i {
  font-size: 14px;
  color: var(--teal-primary);
}

.ms-home-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

/* ---------- MEDICAL VISUAL (HUMAN-DESIGNED CLINICAL KIOSK CARD) ---------- */
.ms-medical-glow {
  display: none;
}

.ms-medical-arch {
  position: relative;
  width: 380px;
  height: 420px;
  border-radius: 12px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(18, 59, 66, 0.05);
}

.ms-medical-arch::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--teal-deepest);
}

.ms-medical-arch::after {
  display: none;
}

.ms-medical-cross {
  position: absolute;
  z-index: 4;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
}

.ms-medical-cross span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--teal-deepest);
  border-radius: 2px;
}

.ms-medical-cross span:first-child {
  width: 72px;
  height: 22px;
}

.ms-medical-cross span:last-child {
  width: 22px;
  height: 72px;
}

.ms-medical-cross::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  background: var(--orange);
  border-radius: 2px;
}

.ms-medical-floor {
  display: none;
}

.ms-medical-ecg {
  position: absolute;
  z-index: 5;
  left: 36px;
  right: 36px;
  bottom: 140px;
  height: 48px;
  opacity: 0.85;
}

.ms-medical-ecg svg {
  width: 100%;
  height: 100%;
}

.ms-medical-ecg path {
  fill: none;
  stroke: var(--teal-primary);
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.ms-medical-panel {
  position: absolute;
  z-index: 6;
  left: 28px;
  right: 28px;
  bottom: 28px;
  height: 90px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ms-panel-line {
  height: 3px;
  width: 80%;
  background: var(--teal-deepest);
  margin-bottom: 10px;
  opacity: 0.7;
  border-radius: 1px;
}

.ms-panel-line.short {
  width: 45%;
  background: var(--orange);
  margin-bottom: 10px;
  opacity: 0.9;
}

.ms-medical-accent {
  display: none;
}

/* ---------- DOCTOR HERO IMAGE & BACKGROUND ARCS ---------- */
.ms-medical-visual {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.ms-visual-bg,
.ms-bg-arcs {
  display: none;
}

.ms-medical-hero-image {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  max-height: min(100%, 84vh);
  max-width: 100%;
  object-fit: contain;
  object-position: bottom center;
  z-index: 5;
  border: none;
  background: transparent;
  box-shadow: none;
}

/* Gradient edge fades */
.ms-visual-fade-l,
.ms-visual-fade-b,
.ms-visual-fade-t {
  display: none !important;
}

.ms-home-trust {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--teal-deep);
  opacity: 0.75;
}

.ms-trust-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal-primary);
}

/* ---------- INTEGRATED HOMEPAGE BENEFITS ---------- */
.ms-home-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  height: auto;
  max-width: 1200px;
  width: calc(100% - 96px);
  margin: 0 auto;

  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  z-index: 20;
}

.ms-benefit {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.ms-benefit strong {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-deepest);
  letter-spacing: -0.01em;
}
.ms-benefit span {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-sub);
}

/* ─────────────────────────────────────────────────────────── */
/*  RESPONSIVE SAFETY & CROSS-DEVICE ADAPTATION                */
/* ─────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .ms-home {
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .ms-home-brand {
    position: relative;
    top: auto;
    left: auto;
    padding: clamp(16px, 3vh, 24px) clamp(16px, 4vw, 32px) 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 12px;
    z-index: 10;
  }

  .ms-home-brand-name,
  .ms-home-brand-sub {
    text-align: left;
  }

  .ms-home-topline {
    display: none !important;
  }

  .ms-home-content {
    position: relative;
    top: auto;
    bottom: auto;
    transform: none;
    width: calc(100% - 48px);
    max-width: 540px;
    margin: 16px auto 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    gap: 18px;
    flex: 1;
    box-sizing: border-box;
  }

  .ms-home-copy {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    margin: 0;
  }

  .ms-home-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 10px;
    text-align: center;
  }

  .ms-home-kicker::before {
    display: inline-block;
  }

  .ms-home-copy h1 {
    text-align: center;
    font-size: clamp(30px, 6.5vw, 44px);
    line-height: 1.08;
    margin: 0 auto;
    width: 100%;
    word-break: break-word;
  }

  .ms-home-copy p {
    text-align: center;
    margin: 12px auto 0;
    font-size: clamp(14px, 3.5vw, 16px);
    max-width: 440px;
    line-height: 1.45;
  }

  .ms-home-start {
    margin: 20px auto 0;
    width: 100%;
    max-width: 290px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    box-sizing: border-box;
  }

  .ms-home-inputs {
    margin: 16px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
  }

  .ms-home-trust {
    margin: 16px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
  }

  .ms-medical-visual {
    height: clamp(240px, 36vh, 340px);
    width: 100%;
    max-width: 480px;
    margin: 14px auto 0;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: visible;
  }

  .ms-medical-hero-image {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    right: auto;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: bottom center;
  }

  .ms-home-footer {
    position: relative;
    bottom: auto;
    left: 0;
    right: 0;
    height: auto;
    width: calc(100% - 48px);
    max-width: 580px;
    margin: 22px auto 16px;
    padding: 0;
    background: transparent !important;
    border: none !important;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 16px;
    box-sizing: border-box;
  }

  .ms-benefit {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    white-space: normal;
  }

  /* Doctor Portal Grid Stack */
  .doctor-layout-grid,
  .doc-main-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }

  .patient-queue-panel,
  .doc-queue-panel {
    max-height: 300px;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .ms-kiosk-split {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .ms-kiosk-left {
    padding-right: 0 !important;
  }
}

@media (max-width: 840px) {
  .doc-consult-main,
  .doc-detail-panel {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 16px !important;
  }
}

@media (max-width: 768px) {
  .ms-header {
    padding: 8px 16px !important;
    height: auto !important;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .doctor-header {
    padding: 8px 16px !important;
    height: auto !important;
    min-height: 54px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .option-grid,
  .ms-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .gender-btn,
  .ms-chip,
  .kiosk-chip {
    min-height: 40px;
  }
}

@media (max-width: 640px) {
  .ms-home {
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
  }

  .ms-home-brand {
    position: relative;
    top: auto;
    left: auto;
    padding: 14px 16px 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 10px;
  }

  .ms-home-topline {
    display: none !important;
  }

  .ms-home-logo-wrap svg {
    width: 34px;
    height: 34px;
  }

  .ms-home-brand-name {
    font-size: 20px;
    text-align: left;
  }

  .ms-home-brand-sub {
    font-size: 9px;
    text-align: left;
  }

  .ms-home-content {
    position: relative;
    top: auto;
    transform: none;
    width: calc(100% - 32px);
    max-width: 100%;
    padding: 0;
    margin: 12px auto 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    box-sizing: border-box;
  }

  .ms-home-copy {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .ms-home-kicker {
    justify-content: center;
    margin-bottom: 6px;
  }

  .ms-home-copy h1 {
    font-size: clamp(26px, 7.5vw, 36px);
    line-height: 1.06;
    text-align: center;
  }

  .ms-home-copy p {
    font-size: 13.5px;
    margin-top: 8px;
    line-height: 1.4;
    text-align: center;
  }

  .ms-home-start {
    width: 100%;
    max-width: 280px;
    height: 48px;
    font-size: 14px;
    margin: 16px auto 0;
    justify-content: center;
    align-self: center;
    box-sizing: border-box;
  }

  .ms-home-inputs {
    margin-top: 12px;
    gap: 8px 12px;
    justify-content: center;
    width: 100%;
  }

  .ms-home-inputs > div:not(.ms-home-divider) {
    font-size: 12px;
  }

  .ms-home-trust {
    margin-top: 12px;
    gap: 6px 10px;
    font-size: 10px;
    justify-content: center;
    width: 100%;
  }

  .ms-medical-visual {
    height: clamp(210px, 32vh, 280px);
    width: 100%;
    margin-top: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }

  .ms-medical-hero-image {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    height: 100%;
    max-width: 95%;
  }

  .summary-grid,
  .ms-form-grid {
    grid-template-columns: 1fr !important;
  }

  .doc-stats-row {
    padding: 10px 14px !important;
    gap: 8px !important;
  }

  .doc-stat-card {
    flex: 1 1 calc(50% - 8px);
    min-width: 110px;
  }

  .ms-home-footer {
    position: relative;
    bottom: auto;
    left: 0;
    right: 0;
    height: auto;
    margin-top: 18px;
    margin-bottom: 14px;
    padding: 0;
    width: calc(100% - 32px);
    background: transparent !important;
    border: none !important;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 12px;
    box-sizing: border-box;
  }

  .ms-benefit {
    white-space: normal;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
  }

  .ms-benefit strong {
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
  }

  .ms-benefit span {
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .option-grid,
  .ms-cards-grid {
    grid-template-columns: 1fr !important;
  }

  .ms-search-box {
    grid-template-columns: 1fr !important;
  }

  .ms-header-controls {
    width: auto;
    gap: 6px;
  }

  .ms-lang-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    padding: 2px !important;
  }

  .ms-lang-btn {
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
    min-height: 32px !important;
    flex: 1 1 auto !important;
    text-align: center !important;
  }

  .ms-modal {
    width: 92vw !important;
    max-width: 520px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 20px 16px !important;
  }

  .ms-screen-medium,
  .ms-screen-narrow {
    padding: 16px 12px !important;
    width: 100% !important;
  }

  .ms-headline {
    font-size: 1.45rem !important;
  }

  .ms-headline-xl {
    font-size: 1.8rem !important;
  }
}

/* =========================================================
   MEDISARTHI CLINICAL QUESTIONNAIRE DESIGN SYSTEM (POST-LANG)
   ========================================================= */

.ms-questionnaire-screen {
  max-width: 1240px;
  width: 94%;
  margin: 0 auto;
  padding: 32px 0;
  box-sizing: border-box;
}

/* Stage Alignment for Full-Screen Feel */
.ms-stage:has(.ms-questionnaire-screen:not([style*="display: none"])) {
  align-items: flex-start;
  padding: 24px 0;
}

/* Split Kiosk Grid Expansion */
.ms-questionnaire-screen .ms-kiosk-split {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 48px;
  align-items: stretch;
  min-height: clamp(440px, 58vh, 680px);
}

.ms-questionnaire-screen .ms-kiosk-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 12px;
}

.ms-questionnaire-screen .ms-kiosk-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

/* Headline & Subline Typography System (Max 2 Lines Constraint) */
.ms-questionnaire-screen .ms-headline {
  font-size: clamp(1.55rem, 2.2vw, 2.15rem) !important;
  font-weight: 700 !important;
  color: var(--teal-deepest) !important;
  line-height: 1.25 !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 10px !important;
  max-width: 100% !important;
}

.ms-questionnaire-screen .ms-subline {
  font-size: clamp(0.92rem, 1.15vw, 1.05rem) !important;
  color: var(--text-sub) !important;
  line-height: 1.5 !important;
  margin-bottom: 24px !important;
}

/* Questionnaire Inputs & Buttons Touch Sizing */
.ms-questionnaire-screen .ms-input,
.ms-questionnaire-screen .kiosk-input {
  height: 52px;
  font-size: 1rem;
  padding: 0 18px;
  border-radius: var(--radius-sm);
}

.ms-questionnaire-screen .ms-input-lg {
  height: 58px;
  font-size: 1.25rem;
  letter-spacing: 0.1em;
}

.ms-questionnaire-screen .btn-primary,
.ms-questionnaire-screen .btn-kiosk-primary,
.ms-questionnaire-screen .btn-outline,
.ms-questionnaire-screen .btn-kiosk-secondary {
  height: 52px;
  font-size: 0.96rem;
  border-radius: var(--radius-sm);
}

/* Questionnaire Option Rows & Touch Tiles Sizing */
.ms-questionnaire-screen .ms-option {
  padding: clamp(14px, 2vw, 22px) clamp(16px, 2.5vw, 24px);
  min-height: auto;
  border-radius: var(--radius);
}

/* Symptom Row Touch Cards */
.ms-questionnaire-screen .ms-symptom-row {
  padding: clamp(12px, 2vw, 18px) clamp(14px, 2.5vw, 20px);
  min-height: auto;
  border-radius: var(--radius);
}

.ms-questionnaire-screen .ms-symptom-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--teal-deepest);
}

.ms-questionnaire-screen .ms-symptom-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Summary Containers Expansion */
#dynamic-summary-container,
#ayush-summary-container,
#aq-container,
#ayush-container {
  width: 100%;
}

/* Responsive Viewport Overrides */
@media (max-width: 1024px) {
  .ms-questionnaire-screen {
    max-width: 960px;
    width: 94%;
    padding: 24px 0;
  }
  .ms-questionnaire-screen .ms-kiosk-split {
    gap: 36px;
    min-height: auto;
  }
}

@media (max-width: 899px) {
  .ms-questionnaire-screen {
    width: 100% !important;
    padding: 20px 18px 32px !important;
  }

  .ms-questionnaire-screen .ms-kiosk-split {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    min-height: auto !important;
  }

  .ms-questionnaire-screen .ms-kiosk-left {
    padding-right: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .ms-questionnaire-screen .ms-kiosk-left .ms-nav {
    order: 3;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
  }

  .ms-questionnaire-screen .ms-kiosk-right {
    order: 2;
  }
}

@media (max-width: 640px) {
  .ms-questionnaire-screen {
    padding: 16px 14px 24px !important;
  }

  .ms-questionnaire-screen .ms-headline {
    font-size: 1.4rem !important;
    line-height: 1.25 !important;
    margin-bottom: 8px !important;
  }

  .ms-questionnaire-screen .ms-subline {
    font-size: 0.88rem !important;
    line-height: 1.45 !important;
    margin-bottom: 16px !important;
  }

  .ms-questionnaire-screen .ms-input,
  .ms-questionnaire-screen .kiosk-input {
    height: 48px;
    font-size: 0.95rem;
  }

  .ms-questionnaire-screen .ms-input-lg {
    height: 52px;
    font-size: 1.1rem;
  }

  .ms-questionnaire-screen .btn-primary,
  .ms-questionnaire-screen .btn-kiosk-primary,
  .ms-questionnaire-screen .btn-outline,
  .ms-questionnaire-screen .btn-kiosk-secondary {
    height: 48px;
    font-size: 0.92rem;
  }
}

@media (max-width: 380px) {
  .ms-questionnaire-screen {
    padding: 12px 10px 20px !important;
  }

  .ms-questionnaire-screen .ms-headline {
    font-size: 1.28rem !important;
  }

  .ms-questionnaire-screen .ms-subline {
    font-size: 0.84rem !important;
  }
}