:root {
  --bg-start: #f0f7ff;
  --bg-mid: #dbeafe;
  --bg-end: #dff6f0;
  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, 0.68);
  --panel-border: rgba(255, 255, 255, 0.68);
  --panel-shadow: rgba(31, 41, 55, 0.12);
  --panel-glow: rgba(255, 255, 255, 0.52);
  --accent-cyan: #48a9ff;
  --accent-mint: #4bd7b0;
  color: var(--text-primary);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(130, 190, 255, 0.6), transparent 28%),
    radial-gradient(circle at top right, rgba(109, 224, 193, 0.46), transparent 30%),
    linear-gradient(180deg, var(--bg-start) 0%, var(--bg-mid) 56%, var(--bg-end) 100%);
  color-scheme: light;
}

:root[data-theme="seafoam"] {
  --bg-start: #ecfeff;
  --bg-mid: #d1fae5;
  --bg-end: #dbeafe;
  --text-primary: #082f49;
  --text-secondary: rgba(8, 47, 73, 0.66);
  --panel-shadow: rgba(8, 47, 73, 0.12);
  --accent-cyan: #1fbdd2;
  --accent-mint: #40c98e;
}

:root[data-theme="violet"] {
  --bg-start: #f5f3ff;
  --bg-mid: #e0e7ff;
  --bg-end: #e0f2fe;
  --text-primary: #1f2340;
  --text-secondary: rgba(31, 35, 64, 0.68);
  --panel-shadow: rgba(67, 56, 202, 0.14);
  --accent-cyan: #7c8cff;
  --accent-mint: #76d0ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--text-primary);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#root {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: 32px;
}

.hero-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-kicker {
  margin: 0 0 8px;
  color: rgba(15, 23, 42, 0.5);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-strip h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.35rem);
  line-height: 1.02;
  max-width: 14ch;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.split-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.patient-layout {
  max-width: 880px;
}

.panel {
  min-height: 68vh;
  padding: 26px;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.4)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18));
  box-shadow:
    0 24px 60px var(--panel-shadow),
    inset 0 1px 0 var(--panel-glow);
  backdrop-filter: blur(26px) saturate(160%);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.panel-clickable:hover,
.panel-clickable:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 30px 70px var(--panel-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.panel-cyan {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42)),
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-cyan) 24%, white) 0%, transparent 46%);
}

.panel-mint {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent-mint) 26%, white) 0%, transparent 46%);
}

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

.panel-eyebrow {
  margin: 0 0 10px;
  color: rgba(15, 23, 42, 0.46);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-title {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.panel-subtitle {
  margin: 0;
  max-width: 54ch;
  color: var(--text-secondary);
  line-height: 1.5;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: calc(100% - 100px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
}

.status-live {
  background: rgba(86, 229, 181, 0.18);
  color: #0f5132;
}

.status-ready {
  background: rgba(102, 170, 255, 0.15);
  color: #1d4ed8;
}

.status-idle {
  background: rgba(255, 255, 255, 0.4);
  color: rgba(15, 23, 42, 0.66);
}

.landing-block {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  font-size: 1.08rem;
  line-height: 1.6;
  color: rgba(15, 23, 42, 0.82);
}

.landing-secondary {
  justify-content: flex-start;
}

.landing-mode-card {
  min-height: 0;
}

.panel-tag-row,
.preview-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.control-button,
.copy-button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent-cyan) 58%, white),
    color-mix(in srgb, var(--accent-mint) 60%, white)
  );
  color: #083344;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.control-button-secondary {
  background: rgba(255, 255, 255, 0.34);
  color: var(--text-primary);
}

.preview-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.34);
  color: rgba(15, 23, 42, 0.74);
  font-size: 0.95rem;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.error-banner,
.patient-note {
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 0.96rem;
  border: 1px solid rgba(255, 255, 255, 0.62);
}

.error-banner {
  background: rgba(255, 224, 224, 0.8);
  color: #991b1b;
}

.patient-note {
  background: rgba(255, 255, 255, 0.34);
  color: rgba(15, 23, 42, 0.82);
}

.dual-transcript-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.transcript-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.transcript-column-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.transcript-column-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.transcript-column-head span {
  color: rgba(15, 23, 42, 0.46);
  font-size: 0.85rem;
}

.transcript-stream {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 52vh;
  padding-right: 4px;
  overflow: auto;
}

.transcript-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.transcript-card p {
  margin: 0;
  line-height: 1.5;
}

.transcript-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: rgba(15, 23, 42, 0.52);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.transcript-doctor {
  border-color: rgba(126, 166, 255, 0.4);
}

.transcript-patient {
  border-color: rgba(107, 210, 169, 0.4);
}

.transcript-system {
  border-color: rgba(255, 255, 255, 0.12);
}

.transcript-empty {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 180px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  color: rgba(15, 23, 42, 0.5);
}

.invite-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.34);
}

.invite-label {
  margin: 0 0 8px;
  color: rgba(15, 23, 42, 0.5);
  text-transform: uppercase;
  font-size: 0.8rem;
}

.invite-link {
  margin-bottom: 16px;
  color: var(--text-primary);
  line-break: anywhere;
}

.invite-state {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: auto;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.3);
}

.invite-state p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.presence-indicator {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent-cyan);
  box-shadow: 0 0 0 0 rgba(72, 169, 255, 0.42);
  animation: pulse 2.4s infinite;
}

.presence-live {
  background: var(--accent-mint);
  box-shadow: 0 0 0 0 rgba(75, 215, 176, 0.4);
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(18px);
}

.theme-swatch {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
}

.theme-swatch-active {
  border-color: rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.4);
}

.theme-swatch-fill {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.theme-swatch-fill-arctic {
  background: linear-gradient(135deg, #7cc4ff, #68e4be);
}

.theme-swatch-fill-seafoam {
  background: linear-gradient(135deg, #72e0d4, #77d58f);
}

.theme-swatch-fill-violet {
  background: linear-gradient(135deg, #9a9cff, #84d8ff);
}

.offline-stack {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 18px;
}

.color-card,
.offline-checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.34);
}

.offline-checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.offline-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.54);
}

.color-picker-shell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.6);
}

.color-picker-input {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.control-button:disabled,
.copy-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(18px);
}

.confirmation-dialog {
  width: min(480px, 100%);
  padding: 26px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent-mint) 22%, white) 0%, transparent 48%);
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  color: var(--text-primary);
}

.confirmation-dialog h2 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

.confirmation-dialog p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.notes-area {
  min-height: 48vh;
  width: 100%;
  resize: vertical;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  outline: none;
  background: rgba(255, 255, 255, 0.38);
  color: var(--text-primary);
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.notes-area:focus {
  border-color: color-mix(in srgb, var(--accent-cyan) 52%, white);
}

.chat-only-layout {
  max-width: 920px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.chat-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chat-panel-head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.34);
  color: rgba(15, 23, 42, 0.62);
  font-size: 0.84rem;
}

.chat-status-ready {
  background: rgba(86, 229, 181, 0.18);
  color: #0f5132;
}

.chat-link-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.34);
}

.chat-expiry {
  margin: -6px 0 14px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
  max-height: 32vh;
  overflow: auto;
  padding-right: 4px;
}

.chat-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  color: rgba(15, 23, 42, 0.5);
}

.chat-message {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.36);
}

.chat-message-doctor {
  border-color: rgba(126, 166, 255, 0.42);
}

.chat-message-patient {
  border-color: rgba(107, 210, 169, 0.42);
}

.chat-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: rgba(15, 23, 42, 0.52);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
  line-height: 1.5;
}

.chat-file-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  line-break: anywhere;
}

.chat-file-link span {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.chat-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-compose textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  outline: none;
  background: rgba(255, 255, 255, 0.38);
  color: var(--text-primary);
  line-height: 1.45;
}

.chat-compose textarea:focus {
  border-color: color-mix(in srgb, var(--accent-mint) 54%, white);
}

.chat-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.file-drop-zone {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--accent-cyan) 44%, white);
  background: rgba(255, 255, 255, 0.34);
  color: rgba(15, 23, 42, 0.72);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.file-drop-zone input {
  display: none;
}

.file-drop-disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(85, 214, 255, 0.35);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(85, 214, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(85, 214, 255, 0);
  }
}

@media (max-width: 980px) {
  .screen {
    padding: 20px;
  }

  .hero-strip,
  .split-layout,
  .dual-transcript-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-strip {
    gap: 16px;
  }

  .panel {
    min-height: auto;
  }

  .transcript-stream {
    max-height: 36vh;
  }

  .hero-actions {
    justify-content: flex-start;
  }
}
