/* ─────────────────────────────────────────────────────────────
   BASE
───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root{
  --bg0:#0b0d12;
  --bg1:#0f1117;
  --glass: rgba(255,255,255,0.06);
  --glass2: rgba(255,255,255,0.08);
  --stroke: rgba(255,255,255,0.10);
  --stroke2: rgba(255,255,255,0.14);
  --text:#e8eaf0;
  --muted:#a7acc2;
  --muted2:#7a7f99;
  --accent1:#6c63ff;
  --accent2:#3ecfcf;
  --danger:#f87171;
  --shadow: 0 18px 50px rgba(0,0,0,0.55);
  --radius: 16px;
  --radius2: 22px;
  --font: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

/* Light theme overrides */
body.light{
  --bg0:#f4f6fb;
  --bg1:#eef2f8;

  --glass: rgba(255,255,255,0.72);
  --glass2: rgba(255,255,255,0.82);

  --stroke: rgba(15,17,23,0.10);
  --stroke2: rgba(15,17,23,0.16);

  --text:#151a24;
  --muted:#3d465a;
  --muted2:#5a647b;

  --shadow: 0 18px 50px rgba(10,12,16,0.12);
}

body{
  font-family: var(--font);
  color: var(--text);
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;

  background:
    radial-gradient(1200px 700px at 20% 15%, rgba(108,99,255,0.14), transparent 60%),
    radial-gradient(900px 600px at 80% 30%, rgba(62,207,207,0.10), transparent 55%),
    radial-gradient(1200px 900px at 50% 110%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}
.about-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  font-weight: 600;
}

.about-btn:hover{
  background: rgba(255,255,255,0.08);
}

.persona-profile{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.persona-profile-header{
  display:flex;
  gap:18px;
  align-items:center;
}

.persona-profile-photo{
  width:84px;
  height:84px;
  border-radius:50%;
  object-fit:cover;
  flex-shrink:0;
  border:2px solid rgba(255,255,255,0.2);
}

.persona-profile-head{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.persona-profile-name{
  font-size: 1.2rem;
  font-weight: 800;
  color: rgba(255,255,255,0.96);
}

.persona-profile-role{
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.82);
}

.persona-profile-archetype{
  font-size: 0.85rem;
  color: rgba(255,255,255,0.62);
}

.persona-profile ul{
  margin: 8px 0 0 18px;
  padding: 0;
}

.persona-profile li{
  margin: 4px 0;
}

/* ABOUT MODAL */
.about-modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5,8,14,0.62);
  backdrop-filter: blur(8px);
  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.about-modal.open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.about-panel{
  width: min(680px, 100%);
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

.about-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.about-title{
  font-size: 1.15rem;
  font-weight: 800;
  color: rgba(255,255,255,0.95);
}

.about-close{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  font-size: 1rem;
}

.about-close:hover{
  background: rgba(255,255,255,0.08);
}

.about-body{
  color: rgba(255,255,255,0.88);
  font-size: 0.98rem;
  line-height: 1.65;
}

.about-body p + p{
  margin-top: 14px;
}

.about-foot{
  margin-top: 20px;
  display:flex;
  justify-content:flex-end;
}

.onboarding-actions{
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.onboarding-lead{
  font-size: 1.02rem;
  color: rgba(255,255,255,0.92);
}

.onboarding-highlights{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.onboarding-highlight{
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
}

.onboarding-highlight-title{
  font-size: 0.95rem;
  font-weight: 800;
  color: rgba(255,255,255,0.94);
  margin-bottom: 6px;
}

.onboarding-highlight p{
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.78);
}

.optional-details-panel{
  width: min(640px, 100%);
}

.optional-details-body{
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.optional-details-textarea{
  width: 100%;
  min-height: 220px;
  max-height: 52vh;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(12,16,24,0.72);
  color: rgba(255,255,255,0.92);
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}

.optional-details-textarea:focus{
  outline: none;
  border-color: rgba(62,207,207,0.55);
  box-shadow: 0 0 0 3px rgba(62,207,207,0.14);
}

.optional-details-actions{
  gap: 10px;
}

.orientation-overlay{
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5,8,14,0.86);
  backdrop-filter: blur(10px);
}

.orientation-card{
  width: min(420px, 100%);
  padding: 24px 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  text-align: center;
}

.orientation-title{
  font-size: 1.1rem;
  font-weight: 800;
  color: rgba(255,255,255,0.95);
}

.orientation-copy{
  margin: 12px 0 0;
  color: rgba(255,255,255,0.82);
  line-height: 1.6;
}

.tour-overlay{
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(7, 10, 16, 0.52);
}

.tour-spotlight{
  position: fixed;
  border-radius: 22px;
  border: 2px solid rgba(62,207,207,0.8);
  box-shadow: 0 0 0 9999px rgba(7, 10, 16, 0.48), 0 0 0 12px rgba(62,207,207,0.12);
  pointer-events: none;
  transition: all 0.2s ease;
}

.tour-card{
  position: fixed;
  width: min(360px, calc(100vw - 28px));
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16,20,30,0.94), rgba(10,14,22,0.94));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  transition: top 0.2s ease, left 0.2s ease;
}

.tour-progress{
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(62,207,207,0.88);
  margin-bottom: 8px;
}

.tour-title{
  font-size: 1.08rem;
  font-weight: 800;
  color: rgba(255,255,255,0.96);
  margin-bottom: 10px;
}

.tour-body{
  color: rgba(255,255,255,0.86);
  line-height: 1.6;
  font-size: 0.95rem;
}

.tour-tip{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.72);
  font-size: 0.88rem;
  line-height: 1.5;
}

.tour-actions{
  margin-top: 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.tour-actions-right{
  display:flex;
  gap: 10px;
}

.tour-target-active{
  position: relative;
  z-index: 10002;
}

.about-dismiss{
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(135deg, rgba(108,99,255,0.85), rgba(62,207,207,0.75));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* Light mode */
body.light .about-btn{
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(17,24,39,0.90);
}

body.light .about-modal{
  background: rgba(15,23,42,0.24);
}

body.light .about-panel{
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,23,42,0.12);
  box-shadow: 0 24px 60px rgba(10,12,16,0.18);
}

body.light .about-title{
  color: rgba(17,24,39,0.95);
}

body.light .about-body{
  color: rgba(17,24,39,0.86);
}

body.light .about-close{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(17,24,39,0.88);
}

body.light .orientation-overlay{
  background: rgba(15,23,42,0.42);
}

body.light .orientation-card{
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,23,42,0.12);
  box-shadow: 0 24px 60px rgba(10,12,16,0.18);
}

body.light .orientation-title{
  color: rgba(17,24,39,0.95);
}

body.light .orientation-copy{
  color: rgba(17,24,39,0.82);
}

body.light .onboarding-lead{
  color: rgba(17,24,39,0.92);
}

body.light .onboarding-highlight{
  background: rgba(248,250,252,0.98);
  border: 1px solid rgba(15,23,42,0.10);
}

body.light .onboarding-highlight-title{
  color: rgba(17,24,39,0.94);
}

body.light .onboarding-highlight p{
  color: rgba(17,24,39,0.72);
}

body.light .tour-card{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 24px 60px rgba(10,12,16,0.18);
}

body.light .tour-title{
  color: rgba(17,24,39,0.96);
}

body.light .tour-body{
  color: rgba(17,24,39,0.84);
}

body.light .tour-tip{
  background: rgba(248,250,252,0.98);
  border: 1px solid rgba(15,23,42,0.08);
  color: rgba(17,24,39,0.72);
}

body.light .optional-details-textarea{
  background: rgba(248,250,252,0.98);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(17,24,39,0.92);
}

body.light .persona-profile-name{
  color: rgba(17,24,39,0.96);
}

body.light .persona-profile-role{
  color: rgba(17,24,39,0.80);
}

body.light .persona-profile-archetype{
  color: rgba(17,24,39,0.62);
}

body.light .persona-profile-photo{
  border:2px solid rgba(0,0,0,0.08);
}

/* Responsive */


@media (max-width: 768px){
  .about-panel{
    padding: 18px;
    border-radius: 18px;
  }

  .about-title{
    font-size: 1.05rem;
  }

  .about-body{
    font-size: 0.92rem;
    line-height: 1.6;
  }
}

@media (max-width: 560px){
  .topbar-actions{
    gap: 8px;
  }

  .about-btn{
    padding: 9px 12px;
    font-size: 0.88rem;
  }

  .about-modal{
    padding: 14px;
  }

  .about-panel{
    padding: 16px;
  }

  .about-close{
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .about-dismiss{
    width: 100%;
    justify-content: center;
  }

  .about-foot{
    justify-content: stretch;
  }
}

.hidden{
  display:none !important;
}

.panel-helper{
  margin-top: 4px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.onboarding-panel{
  width: min(760px, 96vw);
  max-height: min(92vh, 860px);
  overflow: auto;
}

.onboarding-copy{
  display:flex;
  flex-direction:column;
  gap: 24px;
}

.intro-name-row{
  display:grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items:center;
}

.intro-name-label{
  font-size: 1rem;
  font-weight: 500;
}

.intro-name-input{
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.94);
  font: inherit;
}

.intro-name-input:focus{
  outline: none;
  border-color: rgba(62,207,207,0.55);
  box-shadow: 0 0 0 3px rgba(62,207,207,0.14);
}

.intro-cta{
  text-align:center;
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 6px;
}

body.light .intro-name-input{
  background: rgba(255,255,255,0.98);
  color: rgba(17,24,39,0.92);
  border: 1px solid rgba(15,23,42,0.14);
}

body.light .intro-cta,
body.light .intro-name-label{
  color: rgba(17,24,39,0.94);
}

@media (max-width: 768px){
  .onboarding-highlights{
    grid-template-columns: 1fr;
  }

  .intro-name-row{
    grid-template-columns: 1fr;
  }

  .onboarding-panel{
    width: min(96vw, 96vw);
  }

  .tour-card{
    width: min(340px, calc(100vw - 20px));
  }
}

@media (max-width: 560px){
  .onboarding-actions{
    flex-direction: column;
  }

  .tour-actions{
    flex-direction: column;
    align-items: stretch;
  }

  .tour-actions-right{
    width: 100%;
    display:grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────
   TOP BAR
───────────────────────────────────────────────────────────── */
.topbar{
  height: 64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 20px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}
.topbar-actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

.theme-btn{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.theme-btn:hover{
  background: rgba(255,255,255,0.08);
}

.theme-ic{
  font-size: 18px;
  line-height: 1;
}

.brand{ display:flex; align-items:center; gap:14px; }
.brand-badge{
  font-weight: 700;
  color: rgba(255,255,255,0.96);
  letter-spacing: 0.02em;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}
.brand-badge span{ color: #f47721; font-weight: 700; }

.brand-title{
  font-size: 1.02rem;
  color: rgba(255,255,255,0.92);
}

.exit-btn{
  display:flex; align-items:center; gap:10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
}
.exit-btn:hover{ background: rgba(255,255,255,0.08); }
.exit-icon{ opacity: 0.9; }

/* ─────────────────────────────────────────────────────────────
   LAYOUT
   Future rewrite touchpoints:
   - .grid controls the app-level two-column split
   - .left and .right own panel containment and scrolling behavior
   - Change these first when rethinking desktop/tablet layout
───────────────────────────────────────────────────────────── */
.shell{
  height: auto;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.grid{
  display:grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  align-items: stretch;
}

@media (max-width: 900px){
  .grid{ grid-template-columns: 1fr; }
}

/* glass panel */
.panel.glass{
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
  min-height: 0;
}

.panel.glass.left{
  overflow: visible;
}

/* left / right inner spacing */
.left{
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;     /* critical */
  overflow: visible !important;
  position: relative;
  z-index: 20;
}
.right{
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;   /* prevents panel from expanding */
  min-height: 0;      /* critical for internal scrolling */
  position: relative;
  z-index: 1;
}
/* ─────────────────────────────────────────────────────────────
   SESSION UPPER LAYOUT
   - logo now lives in the left sidebar
   - personas now live inside .session-main
   - remove .top-bar as a layout owner
───────────────────────────────────────────────────────────── */
.session-area {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
}
.session-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 14px;
}

.logo-area{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:14px;
  border-radius:20px;
  border:1px solid rgba(255,255,255,0.10);
  background:rgba(0,0,0,0.20);
  min-height: 140px;
}

.practice-logo{
  max-width:100%;
  max-height:96px;
  object-fit:contain;
}

.persona-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 0;
  max-width: 100%;
}

.persona-card{
  display: flex;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  align-items: stretch;
  min-width: 0;
  height: 140px;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.08),
    rgba(255,255,255,0.04)
  );
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.avatar{
  width: 96px;
  height: 96px;
  border-radius: 16px;
  flex-shrink: 0;
  align-self: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.22), transparent 55%),
    linear-gradient(135deg, rgba(108,99,255,0.35), rgba(62,207,207,0.22));
}

.avatar-photo{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.pmeta{
  display:flex;
  flex-direction:column;
  gap: 6px;
  min-width: 0;
  flex: 1;
  height: 100%;
  justify-content: flex-start;
}

.pname{
  font-size: 1.02rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  line-height: 1.2;
  min-height: 2.4em;
}

.psub{
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
}

.mini-btn{
  margin-top: auto;
  margin-bottom: 4px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  cursor:pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.mini-btn:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.96);
}

/* ─────────────────────────────────────────────────────────────
   CONTROLS
───────────────────────────────────────────────────────────── */
.controls-row{
  display:flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
@media (max-width: 980px){
  .controls-row{ flex-direction: column; }
}

.call-status{
  flex: 1;
  display:flex;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.09);
  min-height: 56px;
}

.status-text{ display:flex; flex-direction:column; justify-content:center; gap: 4px; }

.voice-label { font-size: 0.95rem; font-weight: 650; color: rgba(255,255,255,0.92); }
.voice-sub   { font-size: 0.80rem; color: rgba(255,255,255,0.55); }

.call-controls{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.09);
}

@media (max-width: 980px){
  .call-controls{ flex-wrap: wrap; justify-content: space-between; }
}

.ctl{
  display:flex; align-items:center; gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  transition: transform 0.05s ease, background 0.15s ease, opacity 0.15s ease;
}
.ctl:active{ transform: translateY(1px); }
.ctl:hover{ background: rgba(255,255,255,0.08); }
.ctl:disabled{ opacity: 0.35; cursor: not-allowed; }
#btnMute:not(:disabled):hover,
#btnEnd:not(:disabled):hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.96);
}
/* Mute visual state */
.ctl.muted{
  background: rgba(248,113,113,0.14);
  border: 1px solid rgba(248,113,113,0.30);
}
.ctl.primary{
  background: linear-gradient(135deg, rgba(108,99,255,0.85), rgba(62,207,207,0.75));
  border: 1px solid rgba(255,255,255,0.14);
}
.ctl.danger{
  background: rgba(248,113,113,0.14);
  border: 1px solid rgba(248,113,113,0.30);
}

.ctl-ic{ opacity: 0.95; }

.elapsed{
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.10);
  margin-left: 4px;
  display:flex;
  flex-direction:column;
  gap: 2px;
  min-width: 110px;
}
.elapsed-label{ font-size: 0.70rem; color: rgba(255,255,255,0.55); }
.elapsed-time{ font-size: 0.92rem; font-weight: 700; color: rgba(255,255,255,0.9); }

/* Mic level meter */
.mic-meter{
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
  overflow: hidden;
}

.mic-meter-fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(62,207,207,0.85), rgba(108,99,255,0.80));
  transition: width 80ms linear;
  will-change: width;
}

/* status dot (reused) */
.sdot{
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.20);
  flex-shrink: 0;
  margin-top: 6px;
  transition: all 0.25s;
}
.sdot.on  { background: var(--accent2); box-shadow: 0 0 10px rgba(62,207,207,0.85); }
.sdot.err { background: var(--danger);  box-shadow: 0 0 10px rgba(248,113,113,0.75); }

/* Hide legacy orb element still present in HTML so it cannot consume layout space */
.orb-wrap,
#orbWrap,
.orb-stage{
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────
   TRANSCRIPT
───────────────────────────────────────────────────────────── */
.transcript{
  margin-top: 0;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.09);

  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0.6; /* Give less flex-grow to transcript */
}

.t-head{
  display:flex;
  align-items:center;
  justify-content:flex-start;  /* was space-between */
  padding-bottom: 10px;
}
.t-title{
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,255,255,0.90);
}

.kb-indicator{
  display:flex; align-items:center; gap:10px;
}
.kb-pill{
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
}

/* reuse your existing log classes, but restyle the container */
.voice-log{
  overflow-y: auto;
  height: 100%; /* Make it fill the parent's height */

  background: rgba(10,12,16,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.log-agent  { color: rgba(167,139,250,0.95); }
.log-user   { color: rgba(62,207,207,0.95); font-weight:900 }
.log-system { color: rgba(255,255,255,0.50); font-style: italic; }


.fineprint{
  margin-top: 12px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  text-align:center;

  flex: 0 0 auto;   /* prevents it from stretching */
}

.scenario-card {
  flex-shrink: 0;
  flex: 1.4; /* Give more flex-grow to scenario card */
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.09);
  overflow-y: visible; /* Ensure no internal scrollbar */
}

/* ─────────────────────────────────────────────────────────────
   RIGHT PANEL: PRACTICE SUPPORT
───────────────────────────────────────────────────────────── */
.support-head{
  padding: 14px 16px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.support-title{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 800;
  color: rgba(255,255,255,0.90);
}
.support-sub{
  margin-top: 2px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
}

.dot{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
}

.icon-btn{
  width: 36px; height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.80);
  cursor:pointer;
}
.icon-btn:hover{ background: rgba(255,255,255,0.08); }

.support-sections{
  padding: 12px 14px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.acc{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(0,0,0,0.18);
  overflow:hidden;
}

.acc summary{
  list-style:none;
  cursor:pointer;
  padding: 12px 12px;
  font-weight: 750;
  color: rgba(255,255,255,0.85);
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.acc summary::-webkit-details-marker{ display:none; }
.acc summary::after{
  content:"▾";
  opacity:0.7;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}
.acc[open] summary::after{ transform: rotate(180deg); }

.acc-body{
  padding: 0 12px 12px 12px;
  color: rgba(255,255,255,0.68);
  font-size: 0.84rem;
  line-height: 1.55;
}
.acc-body ul{ padding-left: 18px; display:flex; flex-direction:column; gap: 6px; }

/* KB area inside right panel */
.kb-area{
  margin-top: 2px;
  display:flex;
  flex-direction:column;
  min-height: 0;
  flex: 1;
}

.kb-msgs{
  flex: 1;
  min-height: 0; 
  overflow-y:auto;
  padding: 12px 14px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

/* chat bubbles (your JS adds .bubble user/agent/loading) */
.bubble{
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  word-break: break-word;
}

.bubble.user{
  align-self:flex-end;
  background: rgba(108,99,255,0.75);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.95);
  border-bottom-right-radius: 6px;
}

.bubble.agent{
  align-self:flex-start;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.86);
  border-bottom-left-radius: 6px;
}

.blabel{
  font-size: 0.70rem;
  color: rgba(62,207,207,0.95);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.kb-answer-text {
  line-height: 1.45;
}

.kb-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.kb-sources-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
  margin-bottom: 6px;
}

.kb-sources-list {
  margin: 0;
  padding-left: 18px;
}

.kb-sources-list li {
  margin: 4px 0;
  line-height: 1.35;
  font-size: 0.92em;
  opacity: 0.92;
}

body.light .kb-sources {
  border-top: 1px solid rgba(0,0,0,0.12);
}


/* loading dots */
.bubble.loading .dots span{
  display:inline-block;
  animation: blink 1.2s infinite;
  font-size: 1.1rem;
}
.bubble.loading .dots span:nth-child(2){ animation-delay: 0.2s; }
.bubble.loading .dots span:nth-child(3){ animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:0.2}40%{opacity:1} }

.empty-kb{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  flex:1;
  color: rgba(255,255,255,0.40);
  text-align:center;
  padding: 28px 18px;
  gap: 10px;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(0,0,0,0.14);
}
.empty-kb .ei{ font-size: 34px; }
.empty-kb p{ font-size: 0.85rem; line-height: 1.65; }

/* KB input row */
.kb-input-row{
  padding: 12px 14px;
  border-top: 0;
  background: rgba(255,255,255,0.04);
  display:flex;
  gap: 10px;
  align-items:flex-end;
}
.kb-input-row textarea{
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.92);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  resize: none;
  max-height: 110px;
  font-family: inherit;
  line-height: 1.5;
}
.kb-input-row textarea:focus{
  outline:none;
  border-color: rgba(62,207,207,0.55);
  box-shadow: 0 0 0 3px rgba(62,207,207,0.12);
}
.kb-input-row textarea::placeholder{ color: rgba(255,255,255,0.35); }

.sendbtn{
  background: linear-gradient(135deg, rgba(62,207,207,0.80), rgba(108,99,255,0.78));
  border: 1px solid rgba(255,255,255,0.12);
  color:#fff;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 16px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.sendbtn:disabled{ opacity: 0.35; cursor: not-allowed; }

.support-footnote{
  padding: 10px 14px 14px;
  font-size: 0.76rem;
  color: rgba(255,255,255,0.45);
}

/* ─────────────────────────────────────────────────────────────
   LIGHT MODE (consolidated, readable, minimal overrides)
───────────────────────────────────────────────────────────── */
body.light{
  /* Core palette */
  --bg0:#f4f6fb;
  --bg1:#eef2f8;

  --text:#111827;
  --muted:#334155;
  --muted2:#64748b;

  /* Surface tokens */
  --panel-bg: rgba(255,255,255,0.92);
  --card-bg:  rgba(255,255,255,0.96);
  --well-bg:  rgba(15,23,42,0.04);

  /* Borders */
  --border: rgba(15,23,42,0.12);
  --border2: rgba(15,23,42,0.18);

  /* Keep your existing “glass” vars, but stronger for light */
  --glass: rgba(255,255,255,0.92);
  --glass2: rgba(255,255,255,0.96);
  --stroke: rgba(15,23,42,0.12);
  --stroke2: rgba(15,23,42,0.18);

  --shadow: 0 18px 50px rgba(10,12,16,0.10);
}

/* Top bar */
body.light .topbar{
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
}
body.light .brand-badge{ color: #363a95; }
body.light .brand-title{ color: rgba(17,24,39,0.88); }
body.light .theme-btn,
body.light .exit-btn{
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--border);
  color: rgba(17,24,39,0.90);
}

/* Panels */
body.light .panel.glass{
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Persona cards */
body.light .persona-card{
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(10,12,16,0.10);
}
body.light .logo-area{
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,23,42,0.12);
  box-shadow: 0 10px 26px rgba(10,12,16,0.10);
}
body.light .pname{ color: var(--text); }
body.light .psub { color: rgba(17,24,39,0.55); }

body.light .practice-logo {
  opacity: 1 !important;
  display: block !important;
}

body.light .mic-meter{
  background: rgba(54,58,149,0.14);
  border: 1px solid rgba(54,58,149,0.20);
}

body.light .mic-meter-fill{
  background: linear-gradient(90deg, rgba(244,119,33,0.92), rgba(54,58,149,0.88));
}

body.light .mini-btn{
  background: rgba(255,255,255,0.98);
  border: 1px solid var(--border);
  color: rgba(17,24,39,0.88);
}
body.light .mini-btn:hover{
  background: rgba(54,58,149,0.08);
  border-color: rgba(54,58,149,0.42);
  color: #363a95;
}

/* Status + labels */
body.light .t-title,
body.light .support-title,
body.light .call-bar-label{
  color: var(--text);
}

body.light .support-sub,
body.light .hint,
body.light .fineprint,
body.light .support-footnote,
body.light .call-bar-sub{
  color: rgba(17,24,39,0.62);
}

body.light .call-bar-time{
  color: rgba(17,24,39,0.92);
}

/* Control strips */
body.light .call-status,
body.light .call-controls{
  background: var(--card-bg);
  border: 1px solid var(--border);
}

/* Controls */
body.light .ctl{
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  color: rgba(17,24,39,0.90);
}
body.light .ctl:hover{ background: rgba(255,255,255,1); }
body.light #btnMute:not(:disabled):hover,
body.light #btnEnd:not(:disabled):hover{
  background: rgba(54,58,149,0.08);
  border-color: rgba(54,58,149,0.42);
  color: #363a95;
}

/* Disabled: don’t fade text to invisibility in light mode */
body.light .ctl:disabled{
  opacity: 1;
  background: rgba(15,23,42,0.05);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(15,23,42,0.45);
}

/* Primary enabled stays “primary” */
body.light .ctl.primary{ color:#fff; }

/* Transcript */
body.light .transcript{
  background: var(--card-bg);
  border: 1px solid var(--border);
}
body.light .voice-log{
  background: var(--well-bg);
  border: 1px solid var(--border);
  color: rgba(17,24,39,0.88);
}
body.light .log-system{ color: rgba(17,24,39,0.55); }
body.light .log-agent { color: rgba(88,54,180,0.92); }
body.light .log-user  { color: rgba(0,120,120,0.92); }

/* Practice Support head + input row */
body.light .support-head{
  background: rgba(255,255,255,0.90);
  border-bottom: 1px solid var(--border);
}
body.light .kb-input-row{
  background: rgba(255,255,255,0.92);
  border-top: 0;
}
body.light .kb-input-row textarea{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.14);
  color: rgba(17,24,39,0.92);
}
body.light .kb-input-row textarea::placeholder{
  color: rgba(17,24,39,0.45);
}

/* Empty KB state */
body.light .empty-kb{
  background: rgba(15,23,42,0.04);
  border: 1px dashed rgba(15,23,42,0.18);
  color: rgba(17,24,39,0.60);
}
body.light .empty-kb p{ color: rgba(17,24,39,0.58); }

/* Bubbles */
body.light .bubble.agent{
  background: rgba(15,23,42,0.05);
  border: 1px solid rgba(15,23,42,0.14);
  color: rgba(17,24,39,0.90);
}
body.light .blabel{ color: rgba(0,120,120,0.92); }
body.light .bubble.user{
  background: rgba(108,99,255,0.90);
  border: 1px solid rgba(108,99,255,0.22);
  color: #fff;
}

/* Start Call: keep the proven “force fix”, but only once */
body.light #btnStart{
  opacity: 1 !important;
}
body.light #btnStart:disabled{
  background: rgba(108,99,255,0.18) !important;
  border: 1px solid rgba(108,99,255,0.22) !important;
  color: rgba(17,24,39,0.65) !important;
}
body.light #btnStart:disabled .ctl-ic{
  color: rgba(17,24,39,0.65) !important;
}
body.light #btnStart:not(:disabled){
  background: linear-gradient(135deg, rgba(108,99,255,0.85), rgba(62,207,207,0.75)) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  color: rgba(255,255,255,0.96) !important;
}
body.light #btnStart:not(:disabled) .ctl-ic{
  color: rgba(255,255,255,0.96) !important;
}

/* ─────────────────────────────────────────────────────────────
   SESSION STRUCTURE
   Left column: logo + controls + scenario
   Right column: personas + transcript
───────────────────────────────────────────────────────────── */
.session-area{
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.session-sidebar{
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.control-rail{
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.review-card{
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 12px 14px 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.09);
  overflow: hidden;
}

.review-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.review-card-title{
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,255,255,0.90);
}

.review-copy-btn{
  flex-shrink: 0;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.review-copy-btn:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.96);
}

.review-card-body{
  flex: 1;
  min-height: 0;
  padding-top: 12px;
  color: rgba(255,255,255,0.74);
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-y: auto;
}

.scenario-card{
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 12px 14px 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.09);
  min-height: 0;
  overflow: visible;
  position: relative;
  z-index: 8;
}

.scenario-card-title{
  grid-column: 1 / -1;
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,255,255,0.90);
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.scenario-item{
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 6px 10px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
  position: relative;
}

.scenario-item + .scenario-item{
  border-top: 1px solid rgba(255,255,255,0.05);
}

.scenario-item:hover{
  background: rgba(255,255,255,0.05);
}

.scenario-item:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(62,207,207,0.16);
}

.scenario-item.scenario-item-collapsed{
  grid-template-columns: 150px;
}

.scenario-item.scenario-item-collapsed .scenario-value-wrap,
.scenario-item.scenario-item-collapsed .scenario-select{
  display: none !important;
}

.scenario-item.scenario-item-disabled{
  cursor: default;
}

.scenario-item.scenario-item-disabled:hover{
  background: transparent;
}

.scenario-label{
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255,255,255,0.78);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  width: 100%;
  padding: 2px 8px;
  border-radius: 0;
  background: transparent;
}

.scenario-value-wrap{
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scenario-value{
  min-width: 0;
  font-size: 0.76rem;
  line-height: 1.28;
  color: rgba(255,255,255,0.90);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.scenario-inline-icon{
  flex: 0 0 auto;
  font-size: 0.68rem;
  line-height: 1;
  color: rgba(255,255,255,0.54);
  transition: transform 0.16s ease, color 0.16s ease;
}

.scenario-item:hover .scenario-inline-icon{
  color: rgba(255,255,255,0.84);
  transform: translateY(1px);
}

.scenario-select,
.scenario-textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  color: rgba(255,255,255,0.92);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 7px 10px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.scenario-select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-height: 34px;
  padding: 9px 36px 9px 12px;
  cursor: pointer;
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5.25 7 9l4-3.75' fill='none' stroke='rgba(232,234,240,0.9)' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  background-size: auto, 14px 14px;
}

.scenario-menu{
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  left: 160px;
  z-index: 25;
  min-width: 260px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20,24,33,0.98);
  box-shadow: 0 18px 32px rgba(0,0,0,0.32);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
}

.scenario-menu-group{
  position: relative;
}

.scenario-menu-btn{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255,255,255,0.9);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.scenario-menu-btn:hover,
.scenario-menu-btn:focus-visible,
.scenario-submenu-host.is-open > .scenario-submenu-toggle{
  outline: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,1);
}

.scenario-menu-caret{
  color: rgba(255,255,255,0.5);
}

.scenario-submenu{
  position: absolute;
  top: 0;
  left: calc(100% + 6px);
  min-width: 250px;
  margin-top: 0;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20,24,33,0.98);
  box-shadow: 0 18px 32px rgba(0,0,0,0.32);
  display: none;
}

.scenario-submenu-host:hover .scenario-submenu,
.scenario-submenu-host.is-open .scenario-submenu{
  display: block;
}

.scenario-select:hover{
  border-color: rgba(255,255,255,0.18);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5.25 7 9l4-3.75' fill='none' stroke='rgba(232,234,240,0.96)' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.scenario-select option{
  background: #171b24;
  color: #eef2f8;
  font-size: 0.82rem;
  font-family: inherit;
}

.scenario-textarea{
  background:#1a1f29;
  opacity:1;
  resize: vertical;
  min-height: 92px;
  line-height: 1.45;
  z-index:500;
  transform:scale(.97);
  transition:transform .12s ease, opacity .12s ease;
}

.scenario-textarea:not(.hidden){
  transform:scale(1);
}

.scenario-select:focus,
.scenario-textarea:focus{
  outline: none;
  border-color: rgba(62,207,207,0.55);
  box-shadow: 0 0 0 3px rgba(62,207,207,0.12);
}

.scenario-notes-preview{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255,255,255,0.50);
  font-style: italic;
}

body.light .scenario-card{
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,23,42,0.12);
  position: relative;
  z-index: 8;
}

body.light .review-card{
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,23,42,0.12);
}

body.light .review-card-head{
  border-bottom: 1px solid rgba(15,23,42,0.08);
}

body.light .scenario-card-title{
  color: rgba(17,24,39,0.92);
  border-bottom: 1px solid rgba(15,23,42,0.08);
}

body.light .review-card-title{
  color: rgba(17,24,39,0.92);
  border-bottom: 1px solid rgba(15,23,42,0.08);
}

body.light .review-card-body{
  color: rgba(17,24,39,0.72);
}

body.light .review-copy-btn{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(17,24,39,0.88);
}

body.light .review-copy-btn:hover{
  background: rgba(54,58,149,0.08);
  border-color: rgba(54,58,149,0.42);
  color: #363a95;
}

body.light .scenario-item + .scenario-item{
  border-top: 1px solid rgba(15,23,42,0.06);
}

body.light .scenario-item:hover{
  background: rgba(15,23,42,0.05);
}

body.light .scenario-label{
  color: rgba(37,99,235,0.82);
}

body.light .scenario-value{
  color: rgba(17,24,39,0.90);
  background: transparent;
  border: 0;
}

body.light .scenario-notes-preview{
  color: rgba(17,24,39,0.45);
}

body.light .scenario-inline-icon{
  color: rgba(17,24,39,0.44);
}

body.light .scenario-item:hover .scenario-inline-icon{
  color: rgba(17,24,39,0.74);
}

body.light .scenario-select,
body.light .scenario-textarea{
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,247,251,0.96));
  border: 1px solid rgba(15,23,42,0.14);
  color: rgba(17,24,39,0.92);
  box-shadow: 0 8px 18px rgba(10,12,16,0.08);
}

body.light .scenario-select{
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,247,251,0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5.25 7 9l4-3.75' fill='none' stroke='rgba(17,24,39,0.82)' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.light .scenario-menu,
body.light .scenario-submenu{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.12);
  box-shadow: 0 18px 32px rgba(15,23,42,0.12);
}

body.light .scenario-menu-btn{
  color: rgba(17,24,39,0.9);
}

body.light .scenario-menu-btn:hover,
body.light .scenario-menu-btn:focus-visible,
body.light .scenario-submenu-host.is-open > .scenario-submenu-toggle{
  background: rgba(15,23,42,0.06);
  color: rgba(17,24,39,1);
}

body.light .scenario-menu-caret{
  color: rgba(17,24,39,0.5);
}

body.light .scenario-select:hover{
  border-color: rgba(15,23,42,0.20);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,1), rgba(247,249,252,0.98)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5.25 7 9l4-3.75' fill='none' stroke='rgba(17,24,39,0.9)' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.light .scenario-select option{
  background: #ffffff;
  color: #111827;
}

.session-main{
  display: grid;
  grid-template-rows: auto minmax(154px, 205px) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  align-content: start;
}

.call-card{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transcript{
  margin: 0;
}

/* keep button-specific light-mode text handling with the proven start-call fix */
body.light #btnStart:disabled .ctl-ic,
body.light #btnStart:disabled .call-bar-label,
body.light #btnStart:disabled .call-bar-time{
  color: rgba(17,24,39,0.65) !important;
}

body.light #btnStart:disabled .call-bar-sub{
  color: rgba(17,24,39,0.55) !important;
}

body.light #btnStart:not(:disabled) .ctl-ic,
body.light #btnStart:not(:disabled) .call-bar-label,
body.light #btnStart:not(:disabled) .call-bar-time{
  color: rgba(255,255,255,0.96) !important;
}

body.light #btnStart:not(:disabled) .call-bar-sub{
  color: rgba(255,255,255,0.82) !important;
}

/* Responsive layout map
   1100px: app collapses from two main columns to one
   768px: tablet density pass for top bar, personas, transcript, support panel
   560px: phone density pass for controls and typography
   420px: single-column persona cards
*/
/* Tablet / small laptop */

/* Small desktop / laptop */
@media (max-width: 1100px) and (min-width: 901px){
  .shell{
    padding: 14px;
  }

  .grid{
    grid-template-columns: minmax(0, 1.72fr) minmax(320px, 0.88fr);
    gap: 14px;
    max-width: 1400px;
  }

  .logo-area{
    min-height: 118px;
  }

  .practice-logo{
    max-height: 90px;
  }

  .persona-card{
    height: 118px;
    min-height: 118px;
    padding: 12px;
    gap: 12px;
  }

  .avatar{
    width: 76px;
    height: 76px;
  }

  .pname{
    font-size: 0.84rem;
    line-height: 1.2;
  }

  .pmeta{
    gap: 4px;
  }

  .mini-btn{
    padding: 6px 10px;
    font-size: 0.74rem;
    line-height: 1.1;
  }

  .session-area{
    grid-template-columns: 184px minmax(0, 1fr);
    gap: 12px;
  }

  .support-head{
    padding: 12px 12px 10px;
  }

  .support-sub{
    font-size: 0.76rem;
  }
}

@media (max-width: 900px){
  .shell{ padding: 14px; }
  .grid{ grid-template-columns: 1fr; max-width: 100%; gap: 14px; }
  .left,
  .right{ min-height: 0; }
  .left{ min-height: 68vh; }
  .right{ min-height: 32vh; }
  .session-area{ grid-template-columns: 1fr; gap: 12px; }
  .session-main{ grid-template-rows: auto minmax(166px, 205px) minmax(0, 1fr); }
  .call-bar{ min-height: 60px; padding: 13px 14px; }
  .secondary-controls .rail-btn{ min-height: 52px; justify-content: center; }
  .transcript{ min-height: 260px; }
  .voice-log{ min-height: 180px; }
  .kb-area{ min-height: 280px; }
  .kb-msgs{ min-height: 160px; }
}

@media (max-width: 768px){
  .topbar{
    height: auto;
    padding: 12px 14px;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .brand{
    min-width: 0;
    gap: 10px;
    flex: 1;
  }

  .brand-title{
    font-size: 0.9rem;
  }

  .topbar-actions{
    width: auto;
    justify-content: flex-end;
    flex-shrink: 0;
  }

  .shell{
    height: auto;
    min-height: calc(100vh - 64px);
    overflow: visible;
    padding: 12px;
  }

  .grid{
    height: auto;
    gap: 12px;
  }

  .panel.glass{
    border-radius: 18px;
  }

  .left{
    padding: 12px;
  }
  .session-area{
    grid-template-columns: 188px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 6px 12px;
    align-items: start;
  }

   .session-main{
    display: contents;
    order: 0;
  }

  .session-sidebar{
    display: contents;
  }

  .logo-area{
    grid-column: 1;
    grid-row: 1;
    min-height: 118px;
  }

  .control-rail{
    grid-column: 1;
    grid-row: 2 / span 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    margin-top: 0;
  }

  .call-card{
    margin: 0;
  }

  .secondary-controls{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }


  .persona-row{
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
  }

  .transcript{
    grid-column: 2;
    grid-row: 2;
  }

  .scenario-card{
    grid-column: 2;
    grid-row: 3;
  }

  .persona-card{
    height: 118px;
    min-height: 118px;
    padding: 12px;
    gap: 12px;
    border-radius: 16px;
  }

  .avatar{
    width: 76px;
    height: 76px;
    border-radius: 12px;
  }

.pmeta{
  gap: 4px;
}

  .pname{
    font-size: 0.84rem;
    line-height: 1.2;
  }

  .psub{
    font-size: 0.72rem;
  }

  .mini-btn{
    padding: 6px 10px;
    font-size: 0.74rem;
    border-radius: 10px;
  }

  .rail-btn{
    width: 100%;
    font-size: 0.9rem;
  }

  .call-bar{
    min-height: 64px;
    padding: 12px 14px;
    row-gap: 3px;
  }

  .call-bar-label{
    font-size: 0.95rem;
  }

  .call-bar-sub{
    font-size: 0.72rem;
  }

  .call-bar-time{
    font-size: 0.92rem;
  }

  .secondary-controls .rail-btn{
    min-height: 50px;
  }

  .transcript{
    padding: 10px;
    min-height: 240px;
  }

  .voice-log{
    padding: 10px 12px;
    font-size: 0.82rem;
    min-height: 170px;
  }

  .fineprint{
    margin-top: 10px;
    font-size: 0.68rem;
  }

  .support-head{
    padding: 12px;
  }

  .support-title{
    font-size: 0.95rem;
  }

  .support-sub{
    font-size: 0.74rem;
  }

  .kb-msgs{
    padding: 10px 12px;
  }

  .bubble{
    max-width: 100%;
    font-size: 0.84rem;
  }

  .kb-input-row{
    padding: 10px 12px;
  }

  .kb-input-row textarea{
    font-size: 0.86rem;
  }

  .sendbtn{
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .scenario-card{
    grid-template-columns: 1fr;
    gap: 0;
    padding: 10px 10px 8px;
  }

  .scenario-item{
    position: relative;
    z-index: 1;
    padding: 5px 8px;
  }

  .scenario-menu{
    left: 118px;
    min-width: 220px;
  }

  .scenario-submenu{
    left: calc(100% + 6px);
    top: 0;
  }

  .scenario-label{
    font-size: 0.5rem;
    padding: 4px 7px;
  }

  .scenario-value{
    font-size: 0.72rem;
    line-height: 1.24;
  }

  .scenario-inline-icon{
    font-size: 0.72rem;
  }

  aside.panel.right {
    display: none;
  }

  .grid{
    grid-template-columns: 1fr;
  }

  .left{
    min-height: auto;
  }
}

@media (max-width: 560px){
  body{
    overflow-y: auto;
  }

  .topbar{
    padding: 10px 12px;
  }

  .brand-title{
    display: none;
  }

  .brand-badge{
    padding: 7px 10px;
    font-size: 0.9rem;
  }

  .theme-btn,
  .exit-btn{
    height: 40px;
  }

  .exit-btn{
    padding: 9px 12px;
    gap: 8px;
    font-size: 0.88rem;
  }

  .shell{
    padding: 10px;
  }

  .left{
    padding: 10px;
  }

  .session-area{
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 8px;
    align-items: start;
  }

  .logo-area{
    grid-column: 1;
    grid-row: 1;
    min-height: 98px;
    padding: 8px;
  }

  .control-rail{
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px;
    grid-template-rows: auto auto;
    gap: 6px 8px;
    align-items: stretch;
  }

  .call-card{
    display: contents;
  }

  .persona-row{
    grid-column: 2;
    grid-row: 1 / span 2;
    grid-template-columns: 1fr;
    margin-bottom: 0;
    gap: 8px;
  }

  .transcript{
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
  }

  .scenario-card{
    grid-column: 1 / -1;
    grid-row: 4;
    width: 100%;
  }

  .persona-card{
    height: 104px;
    min-height: 104px;
    padding: 9px 10px;
    gap: 8px;
  }

  .avatar{
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }

  .pmeta{
    gap: 4px;
  }

  .pname{
    font-size: 0.84rem;
    line-height: 1.15;
  }

  .psub{
    font-size: 0.68rem;
  }

  .mini-btn{
    padding: 4px 8px;
    font-size: 0.68rem;
    border-radius: 10px;
  }

  .ctl{
    padding: 10px 12px;
    gap: 7px;
    font-size: 0.88rem;
  }

  .control-rail .call-bar{
    grid-column: 1;
    grid-row: 1;
    min-height: 56px;
    padding: 7px 8px;
    column-gap: 6px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .control-rail .call-bar-left{
    grid-column: 1;
    grid-row: 1;
    align-items: start;
    gap: 7px;
  }

  .control-rail .call-bar-text{
    gap: 2px;
  }

  .control-rail .call-bar-label{
    font-size: 0.86rem;
  }

  .control-rail .call-bar-sub{
    font-size: 0.64rem;
  }

  .control-rail .call-bar-time{
    font-size: 0.72rem;
    line-height: 1;
  }

  .control-rail .call-bar-right{
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    align-self: start;
    padding-left: 19px;
  }

  .control-rail .secondary-controls{
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    gap: 6px;
    align-self: start;
  }

  .control-rail .secondary-controls .rail-btn{
    min-height: 24px;
    height: 24px;
    padding: 0 4px;
    font-size: 0.68rem;
    line-height: 1.05;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
  }

  .control-rail .secondary-controls .ctl-ic{
    display: none;
  }

  #muteText{
    font-size: 0;
  }

  #muteText::after{
    content: "Mute";
    font-size: 0.68rem;
    line-height: 1.05;
  }

  #btnEnd{
    font-size: 0;
  }

  #btnEnd::after{
    content: "End";
    font-size: 0.68rem;
    line-height: 1.05;
  }

  .mic-meter{
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 4px;
    height: 6px;
    width: 100%;
  }

  #btnEnd{
    order: 2;
  }

  #btnMute{
    order: 1;
  }

  .transcript{
    min-height: 260px;
  }

  .voice-log{
    min-height: 190px;
    line-height: 1.5;
  }

  .t-title{
    font-size: 0.95rem;
  }

  .hint{
    font-size: 0.74rem;
  }

  .fineprint{
    font-size: 0.64rem;
  }

  .support-head{
    padding: 10px;
  }

  .kb-msgs{
    min-height: 140px;
  }

  .kb-input-row{
    padding: 10px;
    gap: 8px;
  }

  .kb-input-row textarea{
    padding: 9px 10px;
    border-radius: 12px;
  }

  .sendbtn{
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .support-footnote{
    padding: 8px 10px 10px;
    font-size: 0.7rem;
  }

  .kb-composer{
    padding: 10px;
    gap: 8px;
  }

  .context-btn{
    width: 100%;
    justify-content: center;
    border-radius: 12px;
    min-height: 38px;
  }
}


/* ─────────────────────────────────────────────────────────────
   CALL BAR — SOURCE OF TRUTH
   Future rewrite touchpoints:
   - .call-bar defines active call status layout and timer placement
   - .secondary-controls defines mute/end action layout
   - Keep call states here as the single source of truth
───────────────────────────────────────────────────────────── */
.call-card{
  gap: 8px;
}

.call-bar{
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: start;
  padding: 12px 14px;
}

.call-bar-left{
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.call-bar-text{
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  min-width: 0;
}

.call-bar-label{
  font-size: 1rem;
  line-height: 1.05;
}

.call-bar-sub{
  display: block;
  font-size: 0.76rem;
  line-height: 1.3;
  max-width: 100%;
  white-space: normal;
}

.call-bar-right{
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  justify-self: end;
  min-width: 0;
}

.call-bar-time{
  display: block;
  font-size: 0.95rem;
  line-height: 1;
}

.call-bar .sdot{
  margin-top: 4px;
}

.secondary-controls{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary-controls .rail-btn{
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.secondary-controls .ctl-ic{
  font-size: 0.9rem;
}

@media (max-width: 1100px){
  .call-bar{
    min-height: 72px;
  }
}

/* Keep the combined call bar readable while disabled during active states */
#btnStart.call-bar:disabled{
  opacity: 1;
  color: rgba(255,255,255,0.96);
}

#btnStart.call-bar:disabled .call-bar-label{
  color: rgba(255,255,255,0.96);
}

#btnStart.call-bar:disabled .call-bar-sub{
  color: rgba(255,255,255,0.82);
}

#btnStart.call-bar:disabled .call-bar-time{
  color: rgba(255,255,255,0.92);
}

#btnStart.call-bar:disabled .sdot{
  opacity: 1;
}
.kb-composer{
  padding: 12px 14px 12px;
  border-top: 0;
  background: rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kb-composer-tools{
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.context-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.context-btn:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.96);
}

.context-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}

.context-btn:disabled:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.78);
}

.context-btn:active{
  transform: translateY(0);
}

.context-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(62,207,207,0.16);
}

.context-btn-ic{
  font-size: 0.9rem;
  line-height: 1;
}

.context-btn-text{
  white-space: nowrap;
}

.kb-composer .kb-input-row{
  padding: 0;
  border-top: 0;
  background: transparent;
}


@keyframes kbPulse {
  0% {
    box-shadow:
      0 8px 18px rgba(0,0,0,0.24),
      0 0 0 0 rgba(62,207,207,0.55);
  }
  70% {
    box-shadow:
      0 10px 22px rgba(0,0,0,0.28),
      0 0 0 12px rgba(62,207,207,0);
  }
  100% {
    box-shadow:
      0 8px 18px rgba(0,0,0,0.24),
      0 0 0 0 rgba(62,207,207,0);
  }
}

.kb-pulse {
  animation: kbPulse 1.6s infinite;
}

body.light .kb-composer{
  background: rgba(255,255,255,0.92);
  border-top: 0;
}

body.light .context-btn{
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(17,24,39,0.88);
}

body.light .context-btn:hover{
  background: rgba(54,58,149,0.08);
  border-color: rgba(54,58,149,0.42);
  color: #363a95;
}

body.light .context-btn:disabled{
  opacity: 1;
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.10);
  color: rgba(17,24,39,0.42);
}

body.light .context-btn:disabled:hover{
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.10);
  color: rgba(17,24,39,0.42);
}
