/* ============================================================
   SwissDnaCode — V1 / MVP Prototype
   Shared design tokens + base components.
   Distinct from EMATA: warm off-white, Swiss-medical palette,
   Fraunces (display) + Inter (UI), no shared EMATA chrome.
   ============================================================ */

:root {
  /* ── Surface ───────────────────────────────────────────────── */
  --bg:          #faf8f5;   /* warm off-white, alpine calm */
  --bg-2:        #f3efe8;   /* slightly deeper surface */
  --bg-3:        #e8e3d9;   /* contrast surface */
  --paper:       #ffffff;   /* card / dialog */
  --border:      #e3ddd1;
  --border-2:    #cfc7b8;

  /* ── Type ──────────────────────────────────────────────────── */
  --text:        #1c2b3a;   /* swiss night sky */
  --text-2:      #5a6470;
  --text-3:      #98948a;

  /* ── Brand & status ────────────────────────────────────────── */
  --primary:     #1c4e6e;   /* deep ocean — Swiss medical authority */
  --primary-bg:  #eef4f8;
  --primary-bd:  #c4d8e6;
  --primary-dk:  #143a52;

  --health:      #2d6a4f;   /* sage green — OK / approved */
  --health-bg:   #eaf3ee;
  --health-bd:   #b0d2bf;

  --warn:        #b8973e;   /* amber — pending / attention */
  --warn-bg:     #fbf3e0;
  --warn-bd:     #e5d2a3;

  --danger:      #a8513a;   /* warm terracotta — block / required */
  --danger-bg:   #f8ebe5;
  --danger-bd:   #e3c0b1;

  --accent:      #5c3d7a;   /* indigo — used sparingly for AI/intelligence */
  --accent-bg:   #f0eaf6;
  --accent-bd:   #d4c3e3;

  /* ── Type tokens ───────────────────────────────────────────── */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* ── Geometry ──────────────────────────────────────────────── */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   22px;

  --shadow-1:    0 1px 2px rgba(28, 43, 58, 0.04),
                 0 2px 6px rgba(28, 43, 58, 0.04);
  --shadow-2:    0 1px 2px rgba(28, 43, 58, 0.05),
                 0 8px 24px rgba(28, 43, 58, 0.08);
  --shadow-3:    0 4px 16px rgba(28, 43, 58, 0.10),
                 0 24px 60px rgba(28, 43, 58, 0.12);

  --space-1:     4px;
  --space-2:     8px;
  --space-3:     12px;
  --space-4:     16px;
  --space-5:     24px;
  --space-6:     32px;
  --space-7:     48px;
  --space-8:     64px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* Faint paper grain — only on desktop, very subtle */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.018;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Typography helpers ────────────────────────────────────── */
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.015em; }
.display em {
  font-style: italic;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}
.muted { color: var(--text-2); }
.dim   { color: var(--text-3); }

/* ── Brand mark ────────────────────────────────────────────── */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.02em;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(28, 78, 110, 0.25);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.brand-name em { font-style: italic; color: var(--text-2); font-weight: 400; }
.brand-tagline {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.15s, color 0.15s, border-color 0.15s,
              transform 0.1s, box-shadow 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset,
              0 4px 14px rgba(28, 78, 110, 0.25);
}
.btn-primary:hover { background: var(--primary-dk); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-2);
}
.btn-ghost:hover { background: var(--bg-2); border-color: var(--text-3); }

.btn-quiet {
  background: transparent;
  color: var(--text-2);
}
.btn-quiet:hover { color: var(--text); background: var(--bg-2); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; gap: 6px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 24px; font-size: 14.5px; }

.btn .ti { font-size: 17px; }
.btn-sm .ti { font-size: 14px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}
.card-tight   { padding: 14px 16px; }
.card-spacious{ padding: 24px 28px; }

.card-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  flex: 1;
  display: inline-flex; align-items: center; gap: 8px;
}
.card-title .ti { color: var(--primary); font-size: 18px; }

/* ── Pills / chips ─────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  font-weight: 500;
  line-height: 1.4;
}
.chip .ti { font-size: 12px; }

.chip-primary { background: var(--primary-bg); border-color: var(--primary-bd); color: var(--primary); }
.chip-health  { background: var(--health-bg);  border-color: var(--health-bd);  color: var(--health); }
.chip-warn    { background: var(--warn-bg);    border-color: var(--warn-bd);    color: var(--warn); }
.chip-danger  { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger); }
.chip-accent  { background: var(--accent-bg);  border-color: var(--accent-bd);  color: var(--accent); }

/* Deactivated user row — muted appearance so admins see who is off. */
.list-row.is-deactivated { opacity: 0.55; background: var(--bg-2); }
.list-row.is-deactivated .list-name { text-decoration: line-through; color: var(--text-3); }

/* Transient save-button confirmation state (set by saveFeedback in app.js) */
.btn.is-saved {
  background: var(--health) !important;
  color: white !important;
  border-color: var(--health) !important;
  pointer-events: none;
  animation: btnSavedIn 0.2s ease;
}
@keyframes btnSavedIn { from { transform: scale(0.98); } to { transform: scale(1); } }

/* iOS-style pill switch used in client Settings > Benachrichtigungen */
.settings-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; cursor: pointer; }
.settings-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.settings-switch-track {
  position: absolute; inset: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: background 0.2s, border-color 0.2s;
}
.settings-switch-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--paper);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.settings-switch input:checked + .settings-switch-track { background: var(--health); border-color: var(--health); }
.settings-switch input:checked + .settings-switch-track::after { transform: translateX(18px); background: white; }

/* Language picker rows */
.lang-option {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lang-option:hover { background: var(--bg-2); }
.lang-option.is-active { border-color: var(--primary); background: var(--primary-bg); font-weight: 600; }

.chip-solid {
  background: var(--primary);
  color: white;
  border-color: transparent;
}

/* ── Inputs ───────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 78, 110, 0.1);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.search-wrap {
  position: relative;
  width: 100%;
}
.search-wrap .ti {
  position: absolute;
  left: 14px;
  top: 50%; transform: translateY(-50%);
  color: var(--text-3);
  font-size: 17px;
  pointer-events: none;
}
.search-wrap .input { padding-left: 40px; }

.field { display: block; }
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Demo role chip (page-flow control) ────────────────────────
   Lives in the top-right of each role surface. Positioned absolutely
   inside its host so it scrolls AWAY with the page when the user
   scrolls down — that way it never hovers over content the user is
   trying to read. Opaque background (no blur), so on first paint
   nothing ghosts through it. */
.role-chip {
  position: absolute;
  top: 14px; right: 16px;
  z-index: 50;
  display: inline-flex; align-items: center; gap: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  box-shadow: var(--shadow-2);
  font-family: var(--font-mono);
}
.role-chip .role-label {
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px 0 12px;
  border-right: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
}
.role-chip a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 99px;
  transition: color 0.15s, background 0.15s;
  font-weight: 500;
  white-space: nowrap;
}
.role-chip a:hover { color: var(--text); background: var(--bg-2); }
.role-chip a.is-active {
  background: var(--primary);
  color: white;
}
.role-chip a .ti { font-size: 12px; }

/* Small screens: drop the long label and show only icons in pills */
@media (max-width: 640px) {
  .role-chip { top: 10px; right: 12px; }
  .role-chip .role-label { display: none; }
  .role-chip a span:not(.ti) { display: none; }
  .role-chip a { padding: 6px 9px; }
  .role-chip a .ti { font-size: 14px; }
}

/* ── Variant switcher — V1 / Vision toggle (sibling of lang-chip).
   Lets you flip the same role between prototype variants without
   going through the role landing. Position is set at runtime by
   positionChips() so it never collides with role-chip / lang-chip. */
.variant-chip {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 50;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  box-shadow: var(--shadow-2);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.variant-chip .variant-label {
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px 0 12px;
  border-right: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
}
.variant-chip a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 99px;
  transition: color 0.15s, background 0.15s;
  font-weight: 600;
  white-space: nowrap;
}
.variant-chip a:hover:not(.is-active) { color: var(--text); background: var(--bg-2); }
.variant-chip a.is-active { cursor: default; }
.variant-chip a.is-active[data-variant="v1"]     { background: var(--primary); color: white; }
.variant-chip a.is-active[data-variant="vision"] { background: #b8973e;        color: white; }
.variant-chip a .ti { font-size: 12px; }
@media (max-width: 640px) {
  .variant-chip { top: 10px; padding: 2px; }
  .variant-chip .variant-label { display: none; }
  .variant-chip a { padding: 4px 7px; font-size: 0.58rem; }
}

/* ── Language switcher — DE / EN toggle, lives between the back-home
   link and the role-chip in the top strip. */
.lang-chip {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 50;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
  box-shadow: var(--shadow-2);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.lang-chip button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px;
  padding: 5px 10px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.lang-chip button:hover { color: var(--text); }
.lang-chip button.is-active { background: var(--primary); color: white; }
/* The right offset is set by positionLangChip() in app.js — it
   measures the role-chip's rendered width so the two never overlap
   regardless of how many roles are listed. */
@media (max-width: 640px) {
  .lang-chip { top: 10px; padding: 2px; }
  .lang-chip button { padding: 4px 7px; font-size: 0.58rem; min-width: 26px; }
}

/* ── Back-to-workspace link — symmetric partner of .role-chip
   on the top-left of every prototype surface. Docks into
   .workspace / .phone-stage / .landing via renderBackHome(). */
.back-home {
  position: absolute;
  top: 14px; left: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: transform 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.back-home:hover {
  color: var(--text);
  border-color: var(--text-3);
  transform: translateX(-2px);
}
.back-home .ti { font-size: 16px; }
@media (max-width: 640px) {
  .back-home { top: 10px; left: 12px; font-size: 10.5px; padding: 7px 12px 7px 9px; }
  .back-home span:not(.ti) { display: none; }      /* icon-only on tight screens */
  .back-home { padding: 7px 9px; gap: 0; }
}

/* ── Phone frame (client surface, desktop) ────────────────── */
.phone-stage {
  position: relative;             /* anchors the .role-chip */
  min-height: 100vh;
  padding: 56px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.phone-stage-label {
  text-align: center;
  max-width: 460px;
}
.phone-stage-label h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.phone-stage-label p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}
.phone {
  width: 392px;
  height: 800px;
  background: var(--paper);
  border-radius: 44px;
  padding: 12px;
  box-shadow: var(--shadow-3),
              0 0 0 1px rgba(0,0,0,0.05) inset;
  position: relative;
  flex-shrink: 0;
}
.phone-screen {
  width: 100%; height: 100%;
  background: var(--bg);
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.phone-notch {
  position: absolute;
  top: 22px; left: 50%; transform: translateX(-50%);
  width: 100px; height: 24px;
  background: #0a0a0a;
  border-radius: 99px;
  z-index: 10;
}

@media (max-width: 480px) {
  .phone-stage { padding: 0; gap: 0; }
  .phone-stage-label { display: none; }
  .phone {
    width: 100vw; height: 100vh;
    border-radius: 0; padding: 0;
    box-shadow: none;
  }
  .phone-screen { border-radius: 0; }
  .phone-notch { display: none; }
}

/* App screens stacked inside the phone */
.client-screens {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.client-screen {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 36px 18px 90px;
  display: none;
  background: var(--bg);
}
.client-screen.is-active { display: block; }

/* ── Client status bar (mocked iOS-style top status) ──────── */
.status-bar {
  height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.status-bar-right {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text);
  font-size: 12px;
}
.status-bar-right .ti { font-size: 14px; }

/* ── Client top app bar (in-screen) ─────────────────────── */
.client-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 14px;
  flex-shrink: 0;
}
.client-topbar h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  flex: 1;
  margin: 0;
}
/* Signature detail — the first name in the greeting gets a soft
   highlighter stroke and a light italic so the app feels signed,
   not template-generated. */
.client-topbar h1 .name-mark {
  font-style: italic;
  background-image: linear-gradient(180deg,
    transparent 62%,
    rgba(212, 165, 116, 0.32) 62%,
    rgba(212, 165, 116, 0.32) 92%,
    transparent 92%);
  background-repeat: no-repeat;
  padding: 0 3px;
  color: inherit;
}
.client-topbar .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
}
.client-topbar .eyebrow-mark {
  width: 14px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  display: inline-block;
}
.client-topbar .ti {
  font-size: 22px;
  color: var(--text-2);
}

/* ── Client bottom nav ──────────────────────────────────── */
.bottom-nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 76px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 5;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: var(--font-ui);
  padding-top: 8px;
  cursor: pointer;
  transition: color 0.15s;
  background: transparent;
}
.bottom-nav-item .ti { font-size: 22px; }
.bottom-nav-item:hover { color: var(--text-2); }
.bottom-nav-item.is-active { color: var(--primary); }
.bottom-nav-item.is-active .ti { color: var(--primary); }

/* ── Tiles / cells (client) ─────────────────────────────── */
.tile {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
a.tile:hover, button.tile:hover {
  box-shadow: 0 6px 20px -8px rgba(28, 78, 110, 0.18);
  border-color: var(--primary-bd);
}
.tile-row {
  display: flex; align-items: center; gap: 12px;
}
.tile-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.tile-body { flex: 1; min-width: 0; }
.tile-title {
  font-weight: 500; font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}
.tile-sub {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.tile-arrow {
  color: var(--text-3);
  font-size: 18px;
  flex-shrink: 0;
}

/* ── Chat (DNA assistant) ───────────────────────────────── */
.chat-stack {
  display: flex; flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
}
.bubble {
  max-width: 82%;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  border-radius: 16px;
  word-wrap: break-word;
}
.bubble-bot {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  align-self: flex-start;
  color: var(--text);
}
.bubble-user {
  background: var(--primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
  align-self: flex-end;
}
.bubble-meta {
  font-size: 10.5px;
  color: var(--text-3);
  align-self: flex-start;
  padding-left: 4px;
}
.bubble-user + .bubble-meta { align-self: flex-end; padding-right: 4px; padding-left: 0; }
.bubble-disclaimer {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  color: var(--warn);
  font-size: 11px;
  font-style: italic;
  padding: 4px 10px;
  border-radius: 99px;
  align-self: flex-start;
  margin-top: -6px;
}
.bubble-disclaimer .ti { font-size: 13px; }

/* Chat safety-tier UI — see chatSend in app.js for the tier logic. */
.chat-tier {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
  font-size: 10.5px; font-family: var(--font-mono); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  margin-top: 4px;
}
.chat-tier-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.chat-tier.chat-tier-green     { color: var(--health);  border-color: var(--health-bd);  background: var(--health-bg); }
.chat-tier.chat-tier-green .chat-tier-dot { background: var(--health); }
.chat-tier.chat-tier-yellow    { color: var(--warn);    border-color: var(--warn-bd);    background: var(--warn-bg); }
.chat-tier.chat-tier-yellow .chat-tier-dot { background: var(--warn); }
.chat-tier.chat-tier-red       { color: var(--accent);  border-color: var(--accent-bd);  background: var(--accent-bg); }
.chat-tier.chat-tier-red .chat-tier-dot { background: var(--accent); }
.chat-tier.chat-tier-emergency { color: var(--danger);  border-color: var(--danger-bd);  background: var(--danger-bg); animation: chatTierPulse 1.2s ease-in-out 0s 2; }
.chat-tier.chat-tier-emergency .chat-tier-dot { background: var(--danger); }
@keyframes chatTierPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.bubble.chat-tier-yellow { border-left: 3px solid var(--warn); }
.bubble.chat-tier-red    { border-left: 3px solid var(--accent); }
.bubble.bubble-emergency {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-weight: 500;
}
.bubble.bubble-emergency b { color: var(--danger); }
.bubble.chat-welcome {
  background: linear-gradient(150deg, var(--primary-bg), var(--accent-bg));
  border: 1px solid var(--primary-bd);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
  font-style: normal;
}

.memory-callout {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  color: var(--accent);
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 99px;
  align-self: center;
  margin: 4px 0;
}
.memory-callout .ti { font-size: 13px; }

.suggestions {
  display: flex; flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 8px;
}
.suggestion {
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: 99px;
  background: var(--paper);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.suggestion:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}
/* Tier-preset suggestions — coloured chips + dot so the demo viewer
   sees which safety tier a prompt will trigger. */
.suggestions-eyebrow {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 4px 2px;
}
.suggestion .suggestion-tier-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
  background: currentColor;
}
.suggestion.suggestion-green  { border-color: var(--health-bd);  color: var(--health);  background: var(--health-bg); }
.suggestion.suggestion-green:hover  { border-color: var(--health);  color: var(--health);  background: var(--health-bg); filter: brightness(0.97); }
.suggestion.suggestion-yellow { border-color: var(--warn-bd);    color: var(--warn);    background: var(--warn-bg); }
.suggestion.suggestion-yellow:hover { border-color: var(--warn);    color: var(--warn);    background: var(--warn-bg);   filter: brightness(0.97); }
.suggestion.suggestion-red    { border-color: var(--accent-bd);  color: var(--accent);  background: var(--accent-bg); }
.suggestion.suggestion-red:hover    { border-color: var(--accent);  color: var(--accent);  background: var(--accent-bg); filter: brightness(0.97); }


.chat-input {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 8px 0 4px;
  display: flex; align-items: flex-end;
  gap: 8px;
  min-width: 0;                       /* allow children to shrink below intrinsic width */
}
.chat-input .input-wrap {
  flex: 1 1 0;
  min-width: 0;                       /* KEY — lets the input pill shrink so the send button fits */
  display: flex; align-items: center;
  background: var(--paper);
  border: 1px solid var(--border-2);
  border-radius: 22px;
  padding: 6px 12px;
  gap: 6px;
}
.chat-input input {
  flex: 1 1 0;
  min-width: 0;                       /* KEY — text input has an intrinsic min-width, override */
  border: none; outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  width: 100%;
}
.chat-input .icon-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-input .send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}
.chat-input .send-btn:hover { background: var(--primary-dk); }
.chat-input .ti { font-size: 18px; }
.chat-input .icon-btn .ti { font-size: 15px; }

/* ── Onboarding (First Steps) ────────────────────────────── */
.steps {
  display: flex; flex-direction: column; gap: 14px;
}
.step {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; align-items: flex-start;
  gap: 14px;
}
.step.is-done {
  background: var(--health-bg);
  border-color: var(--health-bd);
}
.step.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 78, 110, 0.08);
}
.step-marker {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.step.is-done .step-marker { background: var(--health); color: white; }
.step.is-active .step-marker { background: var(--primary); color: white; }
.step:not(.is-done):not(.is-active) .step-marker {
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text-3);
}
/* min-width:0 prevents the flex item from blowing past its parent when
   its own children (e.g. a .row of nowrap buttons) are wider than the
   available column. Without this, .step-body forces .step wider than
   the phone screen and the content gets clipped at the rounded edge. */
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.step-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }

/* Mandatory consent statement (NOT a question — a binding statement) */
.consent {
  background: var(--paper);
  border: 1px solid var(--primary-bd);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.consent::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--health));
}
.consent-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-flex; align-items: center; gap: 8px;
}
.consent-eyebrow::before {
  content: '';
  width: 18px; height: 1px; background: var(--primary); opacity: 0.6;
}
.consent-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: -0.005em;
  margin-bottom: 10px;
}
.consent-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 14px;
}
.consent-text b { color: var(--text); font-weight: 500; }
.consent-note {
  font-size: 11.5px;
  color: var(--text-3);
  font-style: italic;
  margin-top: 4px;
}

/* ── Workspace (doctor + admin) ─────────────────────────── */
/* padding-top creates a dedicated strip above the topbar where the
   absolute-positioned .role-chip lives — it never overlaps the
   topbar's action buttons (Nutzer einladen, Termin anlegen…). */
.workspace {
  position: relative;             /* anchors the .role-chip */
  min-height: 100vh;
  padding-top: 56px;
  display: grid;
  grid-template-columns: 240px 1fr;
}
@media (max-width: 640px) {
  .workspace { padding-top: 48px; }
}
.ws-nav {
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex; flex-direction: column;
  gap: 24px;
  position: sticky; top: 0;
  height: 100vh;
}
.ws-nav-section { display: flex; flex-direction: column; gap: 2px; }
.ws-nav-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  padding: 0 8px 4px;
}
.ws-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.ws-nav-item .ti { font-size: 18px; color: var(--text-3); }
.ws-nav-item:hover { background: var(--bg-2); color: var(--text); }
.ws-nav-item.is-active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 500;
}
.ws-nav-item.is-active .ti { color: var(--primary); }

.ws-user {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.ws-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.ws-user-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}
.ws-user-role {
  font-size: 11px;
  color: var(--text-3);
}

.ws-main {
  display: flex; flex-direction: column;
  min-width: 0;
}
.ws-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.ws-topbar h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
}
.ws-topbar-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}
.ws-body {
  padding: 28px 32px;
  flex: 1;
}

/* ── Table-ish list (patients, users) ───────────────────── */
.list {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-row {
  display: grid;
  grid-template-columns: 38px 1.5fr 1fr 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  transition: background 0.12s;
  cursor: pointer;
}
.list-row:first-child { border-top: none; }
.list-row:hover { background: var(--bg-2); }
.list-row.is-header {
  background: var(--bg-2);
  cursor: default;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.list-row.is-header:hover { background: var(--bg-2); }
.list-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 11.5px;
}
.list-name { font-weight: 500; color: var(--text); }
.list-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ── Patient detail = "one universe" ─────────────────────── */
.patient-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  margin-top: 4px;
}
@media (max-width: 1100px) {
  .patient-grid { grid-template-columns: 1fr; }
}
.patient-header {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
}
.patient-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
}
.patient-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.patient-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
}
.patient-meta .ti { font-size: 14px; vertical-align: -2px; color: var(--text-3); }

.patient-section {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.patient-section h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.patient-section h2 .ti { color: var(--primary); font-size: 18px; }

.finding {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--bg-3);
}
.finding:first-of-type { border-top: none; padding-top: 0; }
.finding-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.finding-title { font-weight: 500; font-size: 13.5px; }
.finding-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Embedded doctor bot inside patient detail */
.doctor-bot {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  height: 640px;
  position: sticky;
  top: 24px;
  overflow: hidden;
}
.doctor-bot-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.doctor-bot-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  flex: 1;
  margin: 0;
}
.doctor-bot-head .ti { color: var(--accent); font-size: 20px; }
.doctor-bot-body {
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 10px;
}
.doctor-bot-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; gap: 8px; align-items: flex-end;
}

/* ── Role-assignment matrix (admin) ─────────────────────── */
.matrix {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.matrix table {
  width: 100%;
  border-collapse: collapse;
}
.matrix th, .matrix td {
  padding: 14px 20px;
  text-align: left;
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.matrix thead th {
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  border-top: none;
}
.matrix .cell-check { color: var(--health); font-size: 18px; }
.matrix .cell-x { color: var(--text-3); font-size: 16px; }
.matrix .role-name {
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}

/* ── Footer (engagement / Swiss residency reassurance) ─── */
.brand-footer {
  text-align: center;
  padding: 28px 16px 36px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.brand-footer .residency {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: var(--health-bg);
  color: var(--health);
  border: 1px solid var(--health-bd);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}
.brand-footer .residency .ti { font-size: 13px; }

/* ── Banner (status, advisory) ─────────────────────────── */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 16px;
}
.banner .ti { font-size: 18px; flex-shrink: 0; }
.banner-info   { background: var(--primary-bg); border-color: var(--primary-bd); color: var(--primary); }
.banner-health { background: var(--health-bg);  border-color: var(--health-bd);  color: var(--health); }
.banner-warn   { background: var(--warn-bg);    border-color: var(--warn-bd);    color: var(--warn); }

/* ── Helpers ────────────────────────────────────────────── */
/* flex-wrap:wrap is defensive — most .row usages have icon + label + arrow
   that never need to wrap. But when a .row holds multiple buttons (which
   carry white-space:nowrap), wrapping prevents them from spilling out of
   the phone frame on narrow screens. */
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; }
.center { display: flex; align-items: center; justify-content: center; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }

.divider { height: 1px; background: var(--border); margin: 14px 0; }

.hide-mobile { }
@media (max-width: 640px) { .hide-mobile { display: none; } }

/* ── Modal dialog ──────────────────────────────────────────── */
.sd-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(28, 43, 58, 0.42);
  backdrop-filter: blur(4px);
  z-index: 250;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  animation: sdModalFadeIn 0.18s ease;
}
.sd-modal-backdrop.is-open { display: flex; }

/* Phone-scoped modal — used inside .phone-screen so a sheet stays
   inside the device frame rather than escaping to a desktop overlay.
   Slides up as a bottom sheet — native-mobile pattern. */
.sd-phone-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(28, 43, 58, 0.42);
  z-index: 100;
  display: none;
  align-items: flex-end; justify-content: center;
  padding: 0;
  animation: sdModalFadeIn 0.2s ease;
}
.sd-phone-modal-backdrop.is-open { display: flex; }
.sd-phone-modal-backdrop .sd-modal {
  width: 100%;
  max-width: none;
  max-height: 94%;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 28px rgba(28, 43, 58, 0.18);
  animation: sdSheetUp 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.sd-phone-modal-backdrop .sd-modal::before {
  content: '';
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 4px;
  border-radius: 99px;
  background: var(--border);
}
.sd-phone-modal-backdrop .sd-modal-head {
  padding: 22px 14px 12px;      /* extra top makes room for the drag handle */
  gap: 10px;
  min-width: 0;
}
.sd-phone-modal-backdrop .sd-modal-head > div { min-width: 0; }
.sd-phone-modal-backdrop .sd-modal-head .ti.head-icon {
  width: 32px; height: 32px;
  font-size: 16px;
  border-radius: 8px;
}
.sd-phone-modal-backdrop .sd-modal-head h2 {
  font-size: 1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.sd-phone-modal-backdrop .sd-modal-sub { font-size: 11.5px; }
.sd-phone-modal-backdrop .sd-modal-close {
  width: 36px; height: 36px;
  flex-shrink: 0;
}
.sd-phone-modal-backdrop .sd-modal-body {
  padding: 12px 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.sd-phone-modal-backdrop .sd-modal-foot {
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  flex-wrap: wrap;
  gap: 8px;
  justify-content: stretch;
}
.sd-phone-modal-backdrop .sd-modal-foot .btn {
  min-height: 40px;
  flex: 1 1 120px;
  justify-content: center;
  min-width: 0;
}
.sd-phone-modal-backdrop .sd-modal-foot > span {
  flex: 1 1 100%;
  margin: 0 !important;
  font-size: 11px;
  color: var(--text-3);
  order: -1;
}
@keyframes sdSheetUp {
  from { transform: translateY(40px); opacity: 0.6; }
  to   { transform: none; opacity: 1; }
}

@keyframes sdModalFadeIn {
  from { background: rgba(28, 43, 58, 0); backdrop-filter: blur(0); }
  to   { background: rgba(28, 43, 58, 0.42); backdrop-filter: blur(4px); }
}
.sd-modal {
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: sdModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.sd-modal.is-wide { max-width: 720px; }
.sd-modal.is-video { max-width: 760px; }
@keyframes sdModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.sd-modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
}
.sd-modal-head .ti.head-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sd-modal-head h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  flex: 1;
  margin: 0;
  line-height: 1.3;
}
.sd-modal-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.sd-modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sd-modal-close:hover { background: var(--bg-2); color: var(--text); }
.sd-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.sd-modal-foot {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  justify-content: flex-end;
}

/* Video player surface (inside modal) */
.video-stage {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}
.video-stage::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08), transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.06), transparent 50%);
}
.video-play-shell {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 32px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.video-progress {
  position: absolute;
  left: 16px; right: 16px; bottom: 16px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: hidden;
}
.video-progress > div {
  height: 100%; width: 0%;
  background: white;
  border-radius: 2px;
  transition: width 0.2s linear;
}
.video-meta {
  position: absolute;
  top: 12px; right: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0,0,0,0.45);
  color: white;
  padding: 3px 8px;
  border-radius: 6px;
}

/* Q&A (Anamnese) block — used in patient detail */
.qa-list { display: flex; flex-direction: column; gap: 14px; }
.qa-row {
  padding: 10px 0;
  border-top: 1px solid var(--bg-3);
}
.qa-row:first-child { border-top: none; padding-top: 0; }
.qa-q {
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.qa-a { font-size: 13.5px; color: var(--text); line-height: 1.55; }

/* Doctor's private notes */
.note-thread { display: flex; flex-direction: column; gap: 12px; }
.note-card {
  background: linear-gradient(180deg, #fefcf6 0%, #fbf6e8 100%);
  border: 1px solid #ebdca6;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: #5a4a1f;
  line-height: 1.55;
}
.note-card-meta {
  display: flex; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #997a2a;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.note-input {
  background: var(--bg-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-end;
}
.note-input textarea {
  flex: 1;
  border: none; outline: none;
  background: transparent;
  font-family: inherit; font-size: 13px;
  resize: vertical; min-height: 40px;
  color: var(--text);
}

/* Conversation history chips (client DNA-Assistent) */
.conv-cat {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
}
.conv-cat.sleep      { background: #eef0fb; color: #4a4f8a; }
.conv-cat.nutrition  { background: #eaf3ee; color: #2d6a4f; }
.conv-cat.fitness    { background: #f8ebe5; color: #a8513a; }
.conv-cat.stress     { background: #fbf3e0; color: #b8973e; }

.conv-toggle {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: 99px;
  padding: 3px;
  font-family: var(--font-mono);
  margin-bottom: 12px;
}
.conv-toggle button {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 99px;
  color: var(--text-3);
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.conv-toggle button.is-active { background: var(--primary); color: white; }

/* ── Academy · Memberspot video library (V1 Super-Admin) ────
   Grid of ~10 curated explainer videos with thumbnail + duration
   badge + featured tag + preview action. Adjusts from 3 → 2 → 1
   column across common breakpoints. */
.academy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.academy-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.academy-card:hover {
  border-color: var(--primary-bd);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.academy-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  overflow: hidden;
}
.academy-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
.academy-num {
  position: absolute;
  top: 8px; left: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.28);
  padding: 3px 8px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
}
.academy-duration {
  position: absolute;
  bottom: 8px; right: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: white;
  background: rgba(0,0,0,0.55);
  padding: 3px 7px;
  border-radius: 4px;
}
.academy-featured {
  position: absolute;
  top: 8px; right: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: white;
  border: 1px solid var(--primary-bd);
  padding: 3px 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.academy-featured .ti { font-size: 11px; }
.academy-play {
  position: relative;
  z-index: 1;
  font-size: 46px;
  color: white;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
  opacity: 0.9;
  transition: transform 0.2s, opacity 0.2s;
}
.academy-card:hover .academy-play { transform: scale(1.06); opacity: 1; }
.academy-body {
  padding: 12px 14px 10px;
  flex: 1;
}
.academy-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 3px;
}
.academy-sub {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}
.academy-status {
  font-size: 10.5px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}
.academy-status .ti { font-size: 11px; }
.academy-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.academy-card.is-hidden { display: none; }

/* ── Academy admin — stats + filter chips + video table ──── */
.academy-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.academy-stat-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-height: 90px;
}
.academy-stat-label {
  font-size: 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  margin-bottom: 8px;
}
.academy-stat-label .ti { font-size: 14px; color: var(--text-3); }
.academy-stat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
}
.academy-stat-num.academy-stat-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  padding-top: 4px;
}
.academy-stat-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}
.academy-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.academy-filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-2);
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.academy-filter-chip:hover:not(.is-active) { color: var(--text); background: var(--bg-2); }
.academy-filter-chip.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.academy-table-wrap {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.academy-table-head,
.academy-row {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(120px, 1fr) 90px 90px 90px 128px;
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
}
.academy-table-head {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.academy-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.academy-row:hover { background: var(--bg-2); }
.academy-row:last-child { border-bottom: none; }
.academy-row-video {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.academy-row-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  position: relative;
}
.academy-row-star {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--warn);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.academy-row-star .ti { font-size: 9px; }
.academy-row-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.academy-row-presenter {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.academy-row-cell {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.academy-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.academy-icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.academy-icon-btn:hover { background: var(--bg-2); }
.academy-icon-btn.preview:hover { color: var(--accent); border-color: var(--accent); }
.academy-icon-btn.edit:hover  { color: var(--primary); border-color: var(--primary); }
.academy-icon-btn.delete { color: var(--danger); border-color: rgba(168,81,58,0.35); }
.academy-icon-btn.delete:hover { background: rgba(168,81,58,0.08); border-color: var(--danger); }

/* Meta tiles inside the desktop preview modal */
.video-meta-tile {
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: var(--radius);
  min-width: 0;
}
.video-meta-tile-label {
  font-size: 10.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 4px;
}
.video-meta-tile-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* Desktop preview reuses .video-detail-thumb from client — copy here so admin.html can use it too */
.sd-modal-head .video-detail-thumb {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sd-modal-head .video-detail-emoji { font-size: 22px; }
.academy-empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}
@media (max-width: 900px) {
  .academy-table-head { display: none; }
  .academy-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "video actions"
      "meta  meta";
    gap: 10px 12px;
    padding: 14px 16px;
  }
  .academy-row > *:nth-child(1) { grid-area: video; }
  .academy-row > *:nth-child(6) { grid-area: actions; align-self: start; }
  .academy-row > *:nth-child(2),
  .academy-row > *:nth-child(3),
  .academy-row > *:nth-child(4),
  .academy-row > *:nth-child(5) {
    grid-area: meta;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-3);
  }
  .academy-row > *:nth-child(2),
  .academy-row > *:nth-child(5) {
    display: inline-flex;
  }
  .academy-row .academy-row-cell::before {
    content: attr(data-label);
    color: var(--text-3);
    margin-right: 4px;
  }
}

/* ── Client Academy (phone-scoped) — reads the same store the admin writes to. */
.client-academy-filter {
  display: flex;
  flex-wrap: wrap;                    /* all categories visible; no hidden horizontal scroll */
  gap: 6px 6px;
  margin-bottom: 12px;
}
.client-academy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border: 1px solid var(--primary-bd);
  background: var(--primary-bg);          /* soft primary tint — reads on the phone bg */
  color: var(--primary);                  /* full-contrast primary text */
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.client-academy-chip:hover:not(.is-active) {
  background: var(--paper);
  border-color: var(--primary);
}
.client-academy-chip.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.client-academy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.client-academy-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}
.client-academy-item:hover, .client-academy-item:active {
  border-color: var(--primary-bd);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.client-academy-thumb {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.client-academy-emoji { font-size: 26px; }
.client-academy-duration {
  position: absolute;
  bottom: 3px; right: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 1px 4px;
  border-radius: 3px;
}
.client-academy-featured {
  position: absolute;
  top: -4px; right: -4px;
  width: 18px; height: 18px;
  background: var(--warn);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.client-academy-featured .ti { font-size: 10px; }
.client-academy-body {
  flex: 1;
  min-width: 0;
}
.client-academy-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.client-academy-meta {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.client-academy-arrow {
  color: var(--text-3);
  font-size: 18px;
  flex-shrink: 0;
}

/* Video-detail modal head — emoji thumbnail matches list style */
.sd-phone-modal-backdrop .video-detail-thumb {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sd-phone-modal-backdrop .video-detail-emoji { font-size: 22px; }

/* ══════════════════════════════════════════════════════════════════
   Onboarding wizard — swissDNAcode profile setup (client)
   Phone-scoped multi-block form: progress bar, block dots, chip-
   selects, freetext with dictate button, scale sliders, consent
   cards, dashboard unlock hero.
   ══════════════════════════════════════════════════════════════════ */
.ob-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 20px;
}
.ob-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.ob-progress-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  min-width: 88px;
}
.ob-progress-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.ob-progress-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
/* Wizard sticky head — progress row + step dots pin to the top of
   the scroll area while the block content scrolls beneath. Breaks
   out of the .client-screen's 18px horizontal padding via negative
   margin so the stuck bar spans the full phone width. */
.ob-sticky-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  margin: 0 -18px;
  padding: 10px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 8px -6px rgba(0, 0, 0, 0.08);
}

/* ══════════════════════════════════════════════════════════════════
   Post-100 % Profile view — read-only summary + per-section edit.
   ══════════════════════════════════════════════════════════════════ */
.ob-profile { display: flex; flex-direction: column; gap: 14px; padding-bottom: 24px; }
.ob-profile-head { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.ob-profile-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ob-profile-title h2 { margin: 0; font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.ob-profile-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
}
.ob-profile-status.is-complete { background: var(--health-bg); color: var(--health); }
.ob-profile-status.is-partial  { background: var(--warn-bg);   color: var(--warn); }
.ob-profile-status .ti { font-size: 13px; }
.ob-profile-updated { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

.ob-profile-sections { display: flex; flex-direction: column; gap: 8px; }
.ob-profile-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--paper);
  overflow: hidden;
  transition: box-shadow 0.15s, opacity 0.15s;
}
.ob-profile-section.is-dimmed { opacity: 0.45; pointer-events: none; }
.ob-profile-section.is-editing {
  border-color: var(--primary);
  box-shadow: 0 2px 12px -6px var(--primary);
}
.ob-profile-section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px;
  cursor: pointer;
  user-select: none;
}
.ob-profile-section.is-editing .ob-profile-section-head { cursor: default; }
.ob-profile-section-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--bg-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ob-profile-section-icon .ti { font-size: 18px; }
.ob-profile-section-title { flex: 1; min-width: 0; }
.ob-profile-section-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.ob-profile-section-preview {
  font-size: 11px; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ob-profile-warn {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--warn-bg); color: var(--warn);
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
}
.ob-profile-warn .ti { font-size: 11px; }
.ob-profile-edit {
  border: none; background: var(--bg-2); color: var(--text-2);
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.ob-profile-edit:hover:not([disabled]) { background: var(--primary); color: white; }
.ob-profile-edit[disabled] { opacity: 0.35; cursor: not-allowed; }
.ob-profile-edit .ti { font-size: 15px; }
.ob-profile-chev { color: var(--text-3); font-size: 18px; flex-shrink: 0; }

.ob-profile-body {
  padding: 4px 14px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.ob-profile-field { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.ob-profile-field-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.ob-profile-field-value { font-size: 13px; color: var(--text); word-break: break-word; }
.ob-profile-field.is-missing .ob-profile-field-value { color: var(--warn); }
.ob-profile-empty { color: var(--text-3); font-style: italic; }

.ob-profile-consent-warn {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: var(--warn-bg); color: var(--warn);
  border-radius: 10px; font-size: 12px; line-height: 1.4;
  margin-top: 8px;
}
.ob-profile-consent-warn .ti { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.ob-profile-edit-foot {
  position: sticky; bottom: 0;
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 0 4px 0;
  margin-top: 6px;
  background: linear-gradient(to bottom, transparent, var(--paper) 40%);
}
.ob-profile-edit-foot .btn { flex: 1; justify-content: center; }

.ob-profile-foot { display: flex; justify-content: center; padding-top: 12px; }

/* One-time celebration overlay — shown after first-time 100 % completion. */
.ob-celebrate-backdrop {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 500;
  animation: obCelebFade 0.35s ease;
}
@keyframes obCelebFade { from { opacity: 0; } to { opacity: 1; } }
.ob-celebrate {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
  color: white;
  max-width: 300px;
}
.ob-celebrate-ring {
  width: 92px; height: 92px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 3px solid rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  animation: obCelebPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ob-celebrate-ring .ti { font-size: 46px; color: white; }
@keyframes obCelebPop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ob-celebrate-eyebrow { font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.85; }
.ob-celebrate-num { font-family: var(--font-serif); font-size: 48px; font-weight: 700; line-height: 1; }
.ob-celebrate-sub { font-size: 13px; line-height: 1.5; opacity: 0.9; }
.ob-celebrate .btn { background: white; color: var(--primary); font-weight: 700; margin-top: 8px; }
.ob-celebrate .btn:hover { background: rgba(255,255,255,0.9); }

/* Dashboard tile progress bar — used by DNA-Profil vervollständigen */
.tile-progress-card { display: block; }
.tile-progress-card .tile-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px 12px 12px;
}
.tile-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-2);
  border-radius: 99px;
  overflow: hidden;
}
.tile-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 0.35s ease;
}
.tile-progress-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  min-width: 34px;
  text-align: right;
}
.tile-progress-card.is-complete .tile-progress-num { color: var(--health); }
.tile-progress-card.is-complete .tile-progress-fill { background: var(--health); }

.ob-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-2);
  border-radius: 99px;
  overflow: hidden;
}
.ob-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.ob-progress-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  min-width: 32px;
  text-align: right;
}
.ob-dots-row {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  padding: 4px;
  background: var(--bg-2);
  border-radius: 99px;
}
.ob-dot {
  flex: 1;
  min-width: 0;
  padding: 5px 4px;
  border: none;
  background: transparent;
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.ob-dot:hover { color: var(--text); }
.ob-dot.is-done { color: var(--health); }
.ob-dot.is-active {
  background: var(--primary);
  color: white;
}
.ob-block-head {
  padding: 8px 4px 4px;
}
.ob-block-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 6px;
}
.ob-eyebrow-mand {
  color: var(--health);
  background: var(--health-bg);
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 2px;
}
.ob-block-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}
.ob-block-sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.5;
}
.ob-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ob-group {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.ob-group:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.ob-group-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.ob-field {
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ob-field.is-answered {
  border-color: var(--health-bd);
  background: linear-gradient(180deg, var(--paper) 0%, rgba(74, 125, 90, 0.03) 100%);
}
/* Required + still empty — subtle warning tint + red dot on the label */
.ob-field.is-missing {
  border-color: var(--warn-bd);
  background: linear-gradient(180deg, var(--paper) 0%, var(--warn-bg) 100%);
}
.ob-field.is-missing .ob-field-label::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warn);
  margin-left: 6px;
  vertical-align: middle;
}
/* Brief highlight when a field is jumped to from the summary card */
.ob-field.is-jump-target {
  animation: obJump 1.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.28);
}
@keyframes obJump {
  0%   { box-shadow: 0 0 0 0 rgba(214, 158, 46, 0.65); }
  30%  { box-shadow: 0 0 0 8px rgba(214, 158, 46, 0.35); }
  100% { box-shadow: 0 0 0 3px rgba(214, 158, 46, 0);   }
}

/* ── Missing-required summary card — shown at top of wizard when
   the user is close to unlock (>=80 %) with a few open questions. */
.ob-missing-summary {
  background: linear-gradient(150deg, var(--warn-bg) 0%, var(--paper) 100%);
  border: 1px solid var(--warn-bd);
  border-left: 4px solid var(--warn);
  border-radius: 12px;
  padding: 14px 14px 10px;
  margin-bottom: 6px;
}
.ob-missing-summary.is-almost {
  background: linear-gradient(150deg, var(--accent-bg) 0%, var(--paper) 100%);
  border-color: var(--accent-bd, var(--accent));
  border-left-color: var(--accent);
}
.ob-missing-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.ob-missing-head > .ti {
  color: var(--warn);
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.ob-missing-summary.is-almost .ob-missing-head > .ti { color: var(--accent); }
.ob-missing-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  line-height: 1.25;
}
.ob-missing-sub {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 3px;
}
.ob-missing-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ob-missing-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.ob-missing-item:hover, .ob-missing-item:active {
  border-color: var(--warn);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px -6px rgba(214, 158, 46, 0.35);
}
.ob-missing-block {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-bg);
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ob-missing-label {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.ob-missing-item .ti { color: var(--text-3); font-size: 14px; }
.ob-missing-more {
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 12px;
}
.ob-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.ob-req {
  color: var(--danger);
  margin-left: 2px;
  font-weight: 700;
}
.ob-field-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
  line-height: 1.4;
}
.ob-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ob-field input[type="text"],
.ob-field input[type="email"],
.ob-field input[type="tel"],
.ob-field input[type="date"],
.ob-field input[type="time"],
.ob-field input[type="number"],
.ob-field select {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--paper);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.ob-field input:focus,
.ob-field select:focus,
.ob-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,58,138,0.10);
}
.ob-unit {
  position: absolute;
  right: 12px;
  color: var(--text-3);
  font-size: 12px;
  font-family: var(--font-mono);
  pointer-events: none;
}
.ob-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ob-choice {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-2);
  border-radius: 99px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.ob-choice:hover { border-color: var(--primary-bd); color: var(--text); }
.ob-choice.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
/* Locked when a "none/no" answer is selected — mutually exclusive with the rest */
.ob-choice.is-locked {
  opacity: 0.38;
  pointer-events: none;
  text-decoration: line-through;
}
.ob-freetext-wrap {
  position: relative;
  margin-top: 8px;
}
.ob-freetext {
  width: 100%;
  padding: 8px 40px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-2);
  resize: vertical;
  min-height: 48px;
  box-sizing: border-box;
}
.ob-mic {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--paper);
  border-radius: 50%;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ob-mic:hover { background: var(--primary); color: white; }
.ob-scale, .ob-scale-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ob-scale-row {
  padding: 4px 0;
}
.ob-scale-row > span:first-child {
  min-width: 100px;
  font-size: 12px;
  color: var(--text-2);
}
.ob-scale input[type="range"],
.ob-scale-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}
.ob-scale-val {
  min-width: 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.ob-consent {
  padding: 0;
  overflow: hidden;
}
.ob-consent > label {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.ob-consent input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--primary);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.ob-consent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 6px;
}
.ob-consent-text {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.55;
}
.ob-consent-warn {
  border-color: var(--warn-bd);
  background: linear-gradient(180deg, var(--paper) 0%, var(--warn-bg) 100%);
}
.ob-consent-warn .ob-consent-title { color: var(--warn); }
.ob-unlock {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ob-unlock-hero {
  text-align: center;
  padding: 22px 16px;
  background: linear-gradient(150deg, var(--primary-bg) 0%, var(--accent-bg) 100%);
  border: 1px solid var(--primary-bd);
  border-radius: 12px;
}
.ob-unlock-hero .ti {
  font-size: 42px;
  color: var(--primary);
  margin-bottom: 8px;
  display: inline-block;
}
.ob-unlock-hero h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--text);
  margin: 0 0 4px;
}
.ob-unlock-hero p {
  font-size: 12.5px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.55;
}
.ob-unlock-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.ob-unlock-tile {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  min-width: 0;
}
.ob-unlock-tile > div:last-child { min-width: 0; overflow-wrap: anywhere; }
.ob-unlock-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ob-unlock-desc {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.4;
}
.ob-unlock-hint {
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.5;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.ob-unlock-hint .ti { color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.ob-nav {
  position: sticky;
  bottom: 0;
  padding: 14px 4px 6px;
  margin-top: 8px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}
/* Soft fade above the nav so scrolling content dissolves cleanly
   instead of clipping abruptly at the sticky edge. */
.ob-nav::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -20px;
  height: 20px;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
}
.ob-nav-side { display: flex; justify-content: center; }
.ob-nav-side .btn {
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border: none;
  gap: 5px;
}
.ob-nav-side .btn:hover { color: var(--text); background: var(--bg-2); }
.ob-nav-side .btn .ti { font-size: 13px; opacity: 0.7; }
.ob-nav-row { display: flex; gap: 8px; align-items: center; }
.ob-nav-row .btn { flex: 1; justify-content: center; min-width: 0; }
.ob-nav-row .btn:first-child { flex: 0 0 auto; }

/* ══════════════════════════════════════════════════════════════════
   Boot screens — login + DNA-upload intro, shown before the wizard.
   Fill the phone-screen; the bottom nav is hidden while active.
   ══════════════════════════════════════════════════════════════════ */
.boot-screen {
  padding: 24px 18px 20px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.boot-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 20px 0 8px;
}
.boot-brand-sm {
  flex-direction: row;
  text-align: left;
  padding: 0 0 8px;
  gap: 12px;
}
.boot-brand-sm > div { text-align: left; }
.boot-brand-mark {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 6px 20px -8px rgba(30, 58, 138, 0.4);
}
.boot-brand-sm .boot-brand-mark { width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }
.boot-brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.boot-brand-name em { font-style: italic; color: var(--primary); font-weight: 500; }
.boot-brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.boot-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.boot-field { display: flex; flex-direction: column; gap: 5px; }
.boot-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.boot-field input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--paper);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.boot-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}
.boot-primary {
  margin-top: 6px;
  padding: 12px 16px;
  justify-content: center;
  font-size: 14px;
}
.boot-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.boot-row a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.boot-row a:hover { text-decoration: underline; }
.boot-legal {
  margin-top: auto;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.boot-legal .ti { color: var(--health); flex-shrink: 0; margin-top: 1px; }
.boot-intro {
  padding: 4px 0;
}
.boot-intro h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 6px;
}
.boot-intro p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}
.boot-upload-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.boot-option {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.boot-option:hover, .boot-option:active {
  border-color: var(--primary-bd);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -8px rgba(30, 58, 138, 0.2);
}
.boot-option-quiet { background: var(--bg-2); }
.boot-option-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.boot-option-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}
.boot-option-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
  line-height: 1.4;
}
.boot-option > .ti { color: var(--text-3); }

/* ══════════════════════════════════════════════════════════════════
   Feature gates — locked state on dashboard tiles + bottom nav.
   Applied via data-gate="<feature>" + .is-locked from sddApplyFeatureGates().
   ══════════════════════════════════════════════════════════════════ */
.tile-lock {
  display: none;
  font-size: 16px;
  color: var(--text-3);
  margin-left: 4px;
}
.tile[data-gate].is-locked {
  cursor: not-allowed;
  background: linear-gradient(180deg, var(--paper) 0%, var(--bg-2) 100%);
  border-color: var(--border);
}
.tile[data-gate].is-locked .tile-icon {
  filter: grayscale(0.6);
  opacity: 0.65;
}
.tile[data-gate].is-locked .tile-title,
.tile[data-gate].is-locked .tile-sub {
  color: var(--text-3);
}
.tile[data-gate].is-locked .tile-arrow { display: none; }
.tile[data-gate].is-locked .tile-lock { display: inline-block; color: var(--text-3); }
/* Bottom-nav locked state — dimmed; click interception handles the toast */
.bottom-nav-item[data-gate].is-locked {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════════
   Autocomplete typeahead — used for Geburtsort, Geburtsland, Beruf.
   Text input + a dropdown list that appears below the input when
   focused / while typing, with match highlighting via <mark>.
   ══════════════════════════════════════════════════════════════════ */
.ob-autocomplete { position: relative; }
.ob-autocomplete input {
  padding-left: 36px !important;    /* room for the search icon */
}
.ob-ac-search {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
}
.ob-ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px -8px rgba(28, 43, 58, 0.18);
  max-height: 220px;
  overflow-y: auto;
  z-index: 30;
  padding: 4px;
  display: none;
}
.ob-ac-list.is-open { display: block; }
.ob-ac-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ob-ac-item:hover { background: var(--primary-bg); color: var(--primary); }
.ob-ac-item mark {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
}

/* Add-finding modal — kind selector chips */
.af-kind-chip {
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-2);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.af-kind-chip:hover:not(.is-active) { color: var(--text); background: var(--bg-2); }
.af-kind-chip.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.af-kind-chip.is-active .ti { color: white; }

/* ══════════════════════════════════════════════════════════════════
   Doc detail — kind-specific content shown when the user hits Öffnen
   on a preview. Lives inside the same modal (phone-scoped or desktop).
   ══════════════════════════════════════════════════════════════════ */
.doc-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--primary);
  font-weight: 500;
  padding: 4px 10px;
}
.doc-detail-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--paper);
  margin-bottom: 10px;
}
.doc-detail-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.doc-detail-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}
.doc-snp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-2);
  font-size: 13px;
  color: var(--text);
}
.doc-snp:last-child { border-bottom: none; }
.doc-snp b { font-weight: 600; }
.doc-snp-tag {
  padding: 2px 8px;
  background: var(--bg-2);
  border-radius: 99px;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
.doc-blood {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.doc-blood td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--bg-2);
  color: var(--text);
}
.doc-blood tr:last-child td { border-bottom: none; }
.doc-blood-val { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.doc-blood-ref { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.doc-kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bg-2);
  font-size: 13px;
}
.doc-kv:last-child { border-bottom: none; }
.doc-kv > span:first-child {
  color: var(--text-3);
  font-size: 12px;
}
.doc-kv b { color: var(--text); font-weight: 500; }
.doc-plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
}
.doc-plan-item .ti { color: var(--health); font-size: 15px; }

/* ===== Patient-file tabs (doctor view · per patient) ===== */
.ptab-bar {
  display: flex; gap: 2px; flex-wrap: wrap;
  margin-bottom: 18px; border-bottom: 1px solid var(--border);
}
.ptab {
  appearance: none; background: transparent; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 9px 15px; font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 8px 8px 0 0; transition: color .15s, background .15s, border-color .15s;
}
.ptab i { font-size: 15px; }
.ptab:hover { color: var(--text); background: var(--bg-2); }
.ptab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.ptab-panel { display: none; }
.ptab-panel.active { display: block; animation: sdRowIn .22s cubic-bezier(0.16,1,0.3,1); }
@media (max-width: 640px) {
  .ptab-bar { gap: 0; }
  .ptab { padding: 8px 11px; font-size: 12.5px; }
}
