:root {
  --bg: #ebe7de;
  --bg-deep: #f4f2ec;
  --ink: #102a28;
  --muted: #5c6b68;
  --line: rgba(11, 61, 56, 0.12);
  --panel: rgba(255, 252, 247, 0.88);
  --surface: #fffcf7;
  --input-bg: #fffcf7;
  --rail-bg: rgba(255, 252, 247, 0.72);
  --ghost-bg: rgba(11, 61, 56, 0.07);
  --hover-bg: rgba(11, 61, 56, 0.06);
  --soft-bg: rgba(255, 252, 247, 0.7);
  --badge-bg: rgba(11, 61, 56, 0.08);
  --bar-bg: rgba(11, 61, 56, 0.12);
  /* هوية عُقير — نفس صفحات العروض */
  --teal: #0b3d38;
  --teal-deep: #072e2a;
  --teal-soft: #124f48;
  --gold: #c4a35a;
  --gold-bright: #d4b56a;
  --lime: #c4a35a;
  --lime-deep: #a8883f;
  --char: #0b3d38;
  --on-accent: #072e2a;
  --nav-active-bg: #0b3d38;
  --nav-active-fg: #fffcf7;
  --glow: rgba(196, 163, 90, 0.28);
  --danger: #b42318;
  --ok: #1f7a4c;
  --warn: #9a6700;
  --shadow: 0 18px 50px rgba(7, 46, 42, 0.12);
  --radius: 18px;
  --font: "IBM Plex Sans Arabic", "Alexandria", "Segoe UI", Tahoma, sans-serif;
  --display: "IBM Plex Sans Arabic", "Alexandria", system-ui, sans-serif;
  --on-dark: #fffcf7;
  --muted-on-dark: rgba(255, 252, 247, 0.88);
  --hero-bg-1: rgba(7, 46, 42, 0.96);
  --hero-bg-2: rgba(11, 61, 56, 0.92);
}

html[lang="en"],
html[dir="ltr"] {
  --font: "Poppins", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --display: "Poppins", "IBM Plex Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(196, 163, 90, 0.16), transparent 55%),
    radial-gradient(700px 380px at -10% 20%, rgba(11, 61, 56, 0.08), transparent 50%),
    linear-gradient(180deg, #ebe7de 0%, #f4f2ec 38%, #faf8f3 100%);
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.rail {
  padding: 1.4rem 1rem 1.2rem;
  border-inline-end: 1px solid var(--line);
  background: var(--rail-bg);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand { display: flex; gap: .85rem; align-items: center; padding: .35rem .5rem; }
.brand img { border-radius: 10px; background: var(--surface); }
.brand-name { font-family: var(--display); font-weight: 700; letter-spacing: .04em; color: var(--ink); }
.brand-sub { color: var(--muted); font-size: .85rem; }

.nav { display: flex; flex-direction: column; gap: .35rem; }
.nav button {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: start;
  padding: .75rem .9rem;
  border-radius: 12px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.nav button:hover { background: var(--hover-bg); color: var(--ink); }
.nav button.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  box-shadow: var(--shadow);
}

.rail-foot { margin-top: auto; color: var(--muted); font-size: .78rem; line-height: 1.5; padding: 0 .5rem; }

.user-chip {
  display: grid;
  gap: .25rem;
  padding: .75rem .8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  font-size: .85rem;
  color: var(--ink);
}
.user-chip .btn { margin-top: .35rem; justify-self: start; }

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(196, 163, 90, 0.22), transparent 55%),
    linear-gradient(180deg, #ebe7de, #f4f2ec);
}
.login-gate[hidden] { display: none !important; }
.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: .75rem;
  padding: 1.6rem 1.5rem;
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.login-card img {
  border-radius: 12px;
  justify-self: center;
  background: var(--surface);
}
.login-card h1 {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--ink);
}
.login-card .muted { text-align: center; margin: 0; }
.login-card label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
.login-card input {
  font: inherit;
  padding: .7rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
}
.login-card .btn { width: 100%; margin-top: .25rem; }

.style-swatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}
.style-swatch {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .7rem .8rem;
  background: var(--soft-bg);
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.style-swatch.active {
  border-color: var(--lime-deep);
  background: color-mix(in srgb, var(--lime) 22%, transparent);
  box-shadow: var(--shadow);
}

.main {
  padding: 1.5rem 1.75rem 2.5rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.top h1 { margin: 0; font-size: 1.55rem; font-weight: 700; }
.top-actions { display: flex; gap: .6rem; align-items: center; }

.btn.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .65rem;
  min-width: 0;
  line-height: 1;
}
.btn.icon-btn svg { flex-shrink: 0; }
.btn.icon-btn .lang-code {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  opacity: .9;
}
.login-lang-row {
  display: flex;
  justify-content: flex-end;
  margin: -.35rem -.15rem .15rem 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: var(--ghost-bg);
  font-size: .82rem;
  color: var(--muted);
}
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: .55rem 1rem;
  font: inherit;
  cursor: pointer;
  background: var(--lime);
  color: var(--on-accent);
  font-weight: 600;
}
.btn:hover { filter: brightness(.97); }
.btn.ghost { background: var(--ghost-bg); color: var(--ink); }
.btn.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.btn.small { padding: .4rem .7rem; font-size: .85rem; }
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  white-space: nowrap;
}

.panel { display: none; animation: in .25s ease; min-width: 0; max-width: 100%; }
.panel.active { display: block; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero {
  margin: 0 0 1rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius, 16px);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(11, 61, 56, 0.08), rgba(196, 163, 90, 0.12)),
    var(--panel);
  box-shadow: var(--shadow);
}
.hero h2 {
  margin: 0 0 .35rem;
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--teal, #0b3d38);
}
.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: .92rem;
}

.grid { display: grid; gap: 1rem; }
.grid.kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.2fr .8fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  min-width: 0;
  max-width: 100%;
}
.block h2 { margin: 0 0 .85rem; font-size: 1.05rem; color: var(--ink); }
.block h3 { margin: 0 0 .35rem; font-size: .95rem; color: var(--ink); }
.muted { color: var(--muted); font-size: .88rem; line-height: 1.55; font-weight: 500; }
.block .muted, .form .muted, .kpi-label, .table th, .brand-sub, .rail-foot {
  color: var(--muted);
}
.kpi-val { font-family: var(--display); font-size: 2rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--muted); margin-top: .25rem; font-size: .85rem; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .65rem .4rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; font-size: .8rem; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  background: var(--badge-bg);
  color: var(--ink);
}
.badge.lime { background: color-mix(in srgb, var(--lime) 35%, transparent); color: var(--ink); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

.form { display: grid; gap: .7rem; }
.form label { display: grid; gap: .3rem; font-size: .85rem; color: var(--muted); }
.form input, .form select, .form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .65rem .75rem;
  font: inherit;
  background: var(--input-bg);
  color: var(--ink);
}
.form textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.list { display: grid; gap: .7rem; }
.lesson {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem 1rem;
  background: var(--soft-bg);
  color: var(--ink);
}
.lesson .meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .35rem; }
.lesson-actions { margin-inline-start: auto; display: inline-flex; gap: .35rem; }
.lesson-edit-form { margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); }

.funnel { display: grid; gap: .45rem; }
.funnel-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: .6rem; align-items: center; color: var(--ink); }
.bar { height: 10px; border-radius: 999px; background: var(--bar-bg); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--char), var(--lime-deep)); }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  background: var(--ghost-bg);
  color: var(--ink);
  padding: .75rem;
  border-radius: 12px;
  overflow: auto;
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail { border-left: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid.kpi, .grid.two, .grid.three, .form-row { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .knowledge-kpis { grid-template-columns: 1fr 1fr; }
}

/* Reports room — dark hero with guaranteed light text */
.pulse-banner, .reports-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--hero-bg-1), var(--hero-bg-2)),
    radial-gradient(600px 200px at 100% 0%, var(--glow), transparent 60%);
  color: var(--on-dark);
  box-shadow: var(--shadow);
}
.pulse-banner *,
.reports-hero * {
  color: inherit;
}
.pulse-label {
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--muted-on-dark) !important;
  opacity: 1;
}
.pulse-score, .pulse-big {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  margin: .25rem 0;
  color: var(--on-dark) !important;
}
.pulse-score span, .pulse-big small {
  font-size: 1rem;
  margin-inline-start: .2rem;
  color: var(--muted-on-dark) !important;
  opacity: 1;
}
.pulse-banner .muted,
.reports-hero .muted,
.pulse-banner .pulse-sub,
.reports-hero .pulse-sub {
  color: var(--muted-on-dark) !important;
  opacity: 1 !important;
  font-size: .92rem;
  line-height: 1.55;
  margin-top: .2rem;
  font-weight: 500;
}
.pulse-banner .btn,
.reports-hero .btn {
  background: var(--lime);
  color: var(--on-accent) !important;
  font-weight: 700;
  border: 0;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--lime) 35%, transparent);
}
.pulse-banner .btn:hover,
.reports-hero .btn:hover {
  filter: brightness(1.05);
}
.reports-title { margin: .2rem 0 .35rem; font-size: 1.35rem; color: var(--on-dark) !important; }
.kpi-hint { margin-top: .35rem; font-size: .78rem; color: var(--muted); }
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after {
  content: "";
  position: absolute;
  inset-inline-end: -20px;
  inset-block-start: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(182,230,0,.18);
}

.insight-list { margin: 0; padding: 0 1.1rem 0 0; display: grid; gap: .45rem; }
.insight-list li { color: var(--ink); font-size: .92rem; line-height: 1.5; }

.timeline {
  display: flex;
  align-items: flex-end;
  gap: .55rem;
  min-height: 100px;
  padding-top: .5rem;
}
.tl-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.tl-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--lime), var(--char));
  min-height: 8px;
}
.tl-lab { font-size: .72rem; color: var(--muted); }
.tl-n { font-size: .75rem; font-weight: 600; }

.agent-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.grade-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background:
    conic-gradient(var(--lime-deep) calc(var(--p, 70) * 1%), rgba(28,31,26,.1) 0);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.85);
}
.grade-num { font-family: var(--display); font-weight: 700; font-size: 1.05rem; line-height: 1; }
.grade-lab { font-size: .65rem; color: var(--muted); }
.insight {
  margin: .7rem 0;
  padding: .55rem .7rem;
  border-radius: 12px;
  background: rgba(182,230,0,.14);
  font-size: .88rem;
  line-height: 1.45;
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .4rem;
  margin: .6rem 0 .9rem;
}
.stat-strip > div {
  text-align: center;
  padding: .45rem .2rem;
  border-radius: 12px;
  background: rgba(28,31,26,.04);
}
.stat-strip b { display: block; font-family: var(--display); font-size: 1.05rem; }
.stat-strip span { font-size: .68rem; color: var(--muted); }
.platform-strip { grid-template-columns: repeat(6, 1fr); }
.know-block { margin-top: .35rem; }
.know-title { font-size: .82rem; color: var(--muted); margin-bottom: .45rem; }
.know-row {
  display: grid;
  grid-template-columns: 100px 1fr 28px;
  gap: .45rem;
  align-items: center;
  font-size: .78rem;
  margin-bottom: .28rem;
}
.know-n { color: var(--muted); text-align: left; direction: ltr; }
.knowledge-kpis {
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem;
}
.knowledge-kpis > div {
  padding: .7rem .8rem;
  border-radius: 14px;
  background: rgba(28,31,26,.04);
}

/* Progress standard questionnaire */
.std-form { display: grid; gap: 1rem; }
.q-block h3 { margin: 0 0 .35rem; }
.choices { display: grid; gap: .45rem; margin: .75rem 0; }
.choice {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  padding: .7rem .85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  color: var(--ink);
  cursor: pointer;
}
.choice:hover { border-color: color-mix(in srgb, var(--ink) 28%, transparent); }
.choice.on {
  border-color: color-mix(in srgb, var(--lime-deep) 70%, transparent);
  background: color-mix(in srgb, var(--lime) 18%, transparent);
}
.choice input { margin-top: .2rem; }
.note-lab { display: grid; gap: .35rem; margin-top: .35rem; font-size: .85rem; color: var(--muted); }
.note-lab textarea, .std-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .65rem .75rem;
  font: inherit;
  background: var(--input-bg);
  color: var(--ink);
}
.warn-banner {
  border-color: rgba(154,103,0,.35) !important;
  background: rgba(154,103,0,.08) !important;
}

/* Conversations tip (filters / archive notes) */
.cv-tip {
  padding: .75rem .8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  display: grid;
  gap: .35rem;
}
.cv-tip strong { color: var(--ink); font-size: .9rem; }
.cv-tip .btn { justify-self: start; margin-top: .15rem; }

/* Meeting hall + conversations shared */
.chat-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 140px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.chat-side {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-height: calc(100vh - 140px);
  min-width: 0;
  overflow: hidden;
}
.cv-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem;
  padding: .2rem;
  border-radius: 14px;
  background: var(--ghost-bg);
}
.cv-filter {
  appearance: none;
  border: 0;
  border-radius: 11px;
  padding: .55rem .35rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  line-height: 1.2;
}
.cv-filter:hover { color: var(--ink); background: var(--hover-bg); }
.cv-filter.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  box-shadow: var(--shadow);
}
.cv-filter .cv-count {
  font-size: .72rem;
  font-weight: 500;
  opacity: .75;
}
.cv-filter.active .cv-count { opacity: .9; }
.cv-new {
  display: grid;
  gap: .55rem;
}
.cv-new-form {
  padding: .65rem .7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  gap: .55rem;
  color: var(--ink);
}
.cv-new-form[hidden] { display: none !important; }
.cv-new-form label { font-size: .82rem; color: var(--muted); }
.cv-new-form textarea, .cv-new-form input, .cv-new-form select {
  width: 100%;
  resize: vertical;
  min-height: 2.6rem;
  font: inherit;
  background: var(--input-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem .65rem;
}
.chat-peers {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  overflow: auto;
  flex: 1;
  min-width: 0;
}
.chat-peer {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  color: var(--ink);
  border-radius: 14px;
  padding: .7rem .8rem;
  text-align: right;
  cursor: pointer;
  font: inherit;
  display: grid;
  gap: .2rem;
  min-width: 0;
  max-width: 100%;
}
.chat-peer:hover { background: color-mix(in srgb, var(--lime) 14%, transparent); }
.chat-peer.active {
  border-color: color-mix(in srgb, var(--lime-deep) 65%, transparent);
  background: color-mix(in srgb, var(--lime) 20%, transparent);
  box-shadow: var(--shadow);
}
.chat-peer .peer-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; min-width: 0; }
.chat-peer .peer-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.chat-peer .peer-prev {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .78rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.chat-main .chat-stream {
  flex: 1;
  min-height: 0;
}
.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .55rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  flex-shrink: 0;
}
.chat-head > div { min-width: 0; flex: 1; }
.chat-head h2 {
  margin: 0;
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.teaching-banner {
  flex-shrink: 0;
  margin: 0 0 .55rem;
  padding: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--lime, #b6e600) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--lime-deep, #8fb400) 28%, transparent);
  font-size: .78rem;
  line-height: 1.35;
  white-space: normal;
  max-width: 100%;
}
.teaching-banner summary {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .65rem;
  cursor: pointer;
  list-style: none;
  min-width: 0;
  user-select: none;
}
.teaching-banner summary::-webkit-details-marker { display: none; }
.teaching-banner summary::before {
  content: "▸";
  flex-shrink: 0;
  opacity: .65;
  font-size: .7rem;
}
.teaching-banner[open] summary::before { content: "▾"; }
.teaching-title {
  font-weight: 600;
  flex-shrink: 0;
  color: var(--ink);
}
.teaching-preview {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.teaching-banner[open] .teaching-preview { display: none; }
.teaching-banner ul {
  margin: 0;
  padding: .15rem .85rem .55rem 1.35rem;
  max-height: 5.5rem;
  overflow-y: auto;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.teaching-banner li {
  margin: .2rem 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.serious-select {
  max-width: 9.5rem;
  font-size: .85rem;
}
.chat-stream {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: .25rem .1rem 1rem;
  min-width: 0;
  max-width: 100%;
}
.bubble {
  max-width: min(92%, 560px);
  width: fit-content;
  padding: .7rem .85rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.bubble.manager {
  align-self: flex-start;
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  border-color: transparent;
}
.bubble.agent {
  align-self: flex-end;
  background: color-mix(in srgb, var(--lime) 22%, transparent);
  color: var(--ink);
}
.bubble.system {
  align-self: center;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--ink);
  font-size: .88rem;
  max-width: min(96%, 640px);
}
.bubble-meta { font-size: .72rem; opacity: .7; margin-bottom: .3rem; }
.bubble.manager .bubble-meta { opacity: .75; }
.bubble-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.55;
  font-size: .95rem;
  max-width: 100%;
}
.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
  align-items: end;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}
.chat-compose textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .7rem .8rem;
  font: inherit;
  resize: vertical;
  min-height: 52px;
  background: var(--input-bg);
  color: var(--ink);
}
@media (max-width: 980px) {
  .chat-shell { grid-template-columns: 1fr; min-height: auto; }
  .chat-side, .chat-main { max-height: none; min-height: 320px; }
}

.wa-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(20, 24, 18, .45);
  backdrop-filter: blur(4px);
}
.wa-modal[hidden] { display: none !important; }
.wa-modal-card {
  width: min(420px, 100%);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius, 14px);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--line);
}
.wa-modal-card h3 { margin: 0 0 .4rem; font-size: 1.1rem; color: var(--ink); }
.wa-qr-box {
  margin: 1rem auto 0;
  min-height: 240px;
  display: grid;
  place-items: center;
}
.wa-qr-box img {
  width: 240px;
  height: 240px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

/* —— Coach evaluate (admin conversations) —— */
.bubble.agent.coachable {
  position: relative;
  cursor: pointer;
}
.bubble.agent.coachable:hover .coach-hit,
.bubble.agent.coachable.dc-rated .coach-hit {
  opacity: 1;
}
.coach-hit {
  position: absolute;
  inset-inline-start: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  padding: .35rem .7rem;
  font: inherit;
  font-size: .72rem;
  font-weight: 600;
  background: rgba(28, 31, 26, .55);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  white-space: nowrap;
}
html[dir="ltr"] .coach-hit { transform: translate(-50%, -50%); }
.bubble.agent.coachable.dc-rated {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lime) 55%, transparent);
}
.coach-inline-hint { align-self: center; }

#dashen-admin-coach-tip {
  position: fixed;
  z-index: 100000;
  display: none;
  direction: rtl;
  background: #1a1f1c;
  color: #f2f5f0;
  border: 1px solid rgba(182, 230, 0, 0.45);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.55;
  max-height: 42vh;
  overflow: auto;
}
html[dir="ltr"] #dashen-admin-coach-tip { direction: ltr; }
#dashen-admin-coach-tip.is-open { display: block; }
#dashen-admin-coach-tip .dc-title {
  font-weight: 700;
  color: #b6e600;
  margin-bottom: 6px;
  font-size: 12px;
}
#dashen-admin-coach-tip .dc-reason { white-space: pre-wrap; opacity: .95; margin-top: 6px; }
#dashen-admin-coach-tip .dc-rating-summary {
  font-weight: 600;
  color: #d7f06a;
  font-size: 12.5px;
  margin-bottom: 4px;
}
#dashen-admin-coach-tip .dc-hint { margin-top: 8px; font-size: 11px; opacity: .65; }
#dashen-admin-coach-tip .dc-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

#dashen-admin-coach-modal,
#dashen-admin-rate-modal {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 12, 10, .55);
  backdrop-filter: blur(3px);
}
#dashen-admin-coach-modal.is-open,
#dashen-admin-rate-modal.is-open { display: flex; }
#dashen-admin-coach-modal .dc-card,
#dashen-admin-rate-modal .dc-card {
  width: min(440px, 100%);
  background: #1a1f1c;
  color: #f2f5f0;
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid rgba(182, 230, 0, .35);
  box-shadow: 0 22px 50px rgba(0,0,0,.4);
  font-family: var(--font);
  direction: rtl;
}
html[dir="ltr"] #dashen-admin-coach-modal .dc-card,
html[dir="ltr"] #dashen-admin-rate-modal .dc-card { direction: ltr; }
.dc-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.dc-x {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  opacity: .7;
}
.dc-muted { opacity: .75; font-size: 13px; margin: 0 0 12px; }
.dc-label { display: block; font-size: 12px; margin: 8px 0 4px; opacity: .85; }
.dc-reply-preview {
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: 12.5px;
  margin-bottom: .6rem;
  max-height: 4.5rem;
  overflow: auto;
}
.dc-card textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.25);
  color: inherit;
  font: inherit;
  padding: .55rem .65rem;
  resize: vertical;
}
.dc-card-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: .85rem;
}
.dc-status { margin-top: 10px; font-size: 13px; color: #b6e600; }
.dc-btn {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  color: #1c1f1a;
  background: #b6e600;
}
.dc-btn.dc-cancel { background: rgba(255,255,255,.12); color: #f2f5f0; font-weight: 600; }
.dc-dims { display: grid; gap: .45rem; margin: .5rem 0; }
.dc-dim { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.dc-dim-lab { font-size: 12.5px; opacity: .9; }
.dc-stars { display: flex; gap: .25rem; }
.dc-star {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #f2f5f0;
  font-size: 12px;
  cursor: pointer;
}
.dc-star.on {
  background: #b6e600;
  color: #1c1f1a;
  border-color: transparent;
  font-weight: 700;
}

/* Agent Lab */
.lab-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr;
  gap: .85rem;
  height: calc(100vh - 132px);
  max-height: calc(100vh - 132px);
  overflow: hidden;
}
.lab-side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 0;
  overflow: hidden;
}
.lab-side-head { display: flex; gap: .4rem; flex-wrap: wrap; }
.lab-scenarios {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .35rem .55rem;
  background: var(--surface);
}
.lab-scenarios summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}
.lab-scenarios-body {
  display: grid;
  gap: .4rem;
  margin-top: .45rem;
}
.lab-scenarios-body select {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: .4rem .5rem;
  font: inherit;
  background: var(--input-bg);
  color: var(--ink);
}
.lab-session-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
  min-height: 0;
}
.lab-session {
  text-align: start;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: .55rem .6rem;
  cursor: pointer;
  display: grid;
  gap: .15rem;
  font: inherit;
  color: inherit;
}
.lab-session strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lab-session.active {
  border-color: var(--lime-deep);
  box-shadow: 0 0 0 1px var(--glow);
}
.lab-main {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.lab-main-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.lab-thread {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-height: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.35), transparent);
}
.lab-turn { display: grid; gap: .4rem; }
.lab-bubble {
  max-width: min(640px, 92%);
  padding: .7rem .85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-word;
}
.lab-bubble.user {
  margin-inline-start: auto;
  background: rgba(182, 230, 0, 0.18);
}
.lab-bubble.bot { margin-inline-end: auto; }
.lab-role {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: .3rem;
  font-weight: 600;
}
.lab-issues { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.lab-issue {
  font-size: 11px;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--badge-bg);
}
.lab-issue.err { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.lab-issue.warn { background: rgba(154, 103, 0, 0.12); color: var(--warn); }
.lab-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
  padding: .75rem .9rem;
  border-top: 1px solid var(--line);
  background: var(--soft-bg);
  align-items: end;
  flex-shrink: 0;
}
.lab-composer textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: .65rem .75rem;
  font: inherit;
  resize: none;
  min-height: 48px;
  max-height: 96px;
  background: var(--input-bg);
  color: var(--ink);
}
.lab-composer .lab-send {
  min-width: 5.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.lab-empty { padding: 2rem 1rem; text-align: center; }
.danger-text { color: var(--danger) !important; }
@media (max-width: 900px) {
  .lab-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .lab-side { max-height: 220px; }
  .lab-main { min-height: 60vh; }
}
