:root {
  --bg: #0e1620;
  --panel: #16212e;
  --panel-2: #1d2b3a;
  --panel-3: #22344a;
  --text: #e6edf3;
  --muted: #92a2b3;
  --accent: #4b9fe1;
  --accent-2: #2f6f9f;
  --user: #23384d;
  --assistant: #1b2a38;
  --line: #24344a;
  --line-2: #2b3e55;
  --warn-bg: #3a2417;
  --warn-border: #b5651d;
  --crisis-bg: #3a1720;
  --crisis-border: #d64b63;
  --ok: #5bbd7b;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; line-height: 1.5;
}
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.muted { color: var(--muted); font-size: .84rem; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Buttons ---------- */
.primary { background: var(--accent); color: #06131f; border: none; padding: .55rem 1rem;
  border-radius: 9px; font-weight: 600; cursor: pointer; font: inherit; font-weight: 600; }
.primary:hover { background: #62b0ee; }
.primary:disabled { opacity: .5; cursor: default; }
.primary.block { display: block; width: 100%; margin-top: .4rem; }
.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2);
  padding: .5rem .9rem; border-radius: 9px; cursor: pointer; font: inherit; }
.ghost:hover { border-color: var(--accent); }
.ghost.danger { color: #f0899d; }
.ghost.danger:hover { border-color: var(--crisis-border); }
.link { background: none; border: none; color: var(--accent); font-size: .8rem; cursor: pointer;
  padding: 0; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link.danger { color: #f0899d; }

/* ---------- Onboarding gate ---------- */
.onboarding-gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.ob-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.8rem; width: min(440px, 100%); }
.ob-brand { font-size: 1.5rem; margin-bottom: .6rem; }
.ob-card h2 { margin: .2rem 0 .6rem; }
.ob-lang { display: flex; align-items: center; gap: .5rem; margin: 1rem 0; font-size: .88rem; }
.ob-name { margin: 1rem 0; font-size: .88rem; }
.ob-name label { display: block; margin-bottom: .35rem; color: var(--muted); }
.ob-name input { width: 100%; }
.ob-login { display: block; margin: .8rem auto 0; font-size: .85rem; }
.ob-crisis { text-align: center; margin: 1.2rem 0 0; font-size: .74rem; }
.switch-row { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; font-size: .88rem; color: var(--muted); }
.switch-row input { margin-top: .25rem; }
.switch-row.inline { margin: .5rem 0; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line);
  padding: 1rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.side-brand { padding: .3rem .6rem 1rem; }
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px;
  background: none; border: none; color: #c3d0dc; font: inherit; font-size: .92rem; cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--user); color: #fff; }
.side-foot { margin-top: auto; padding: .8rem .6rem .2rem; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .5rem; }
.side-legal { display: flex; flex-direction: column; gap: .1rem; }
.side-legal a { color: #c3d0dc; text-decoration: none; font-size: .8rem; padding: .35rem .5rem;
  border-radius: 8px; transition: background .12s ease, color .12s ease; }
.side-legal a:hover { background: var(--panel-2); color: var(--text); }
.side-tag { font-size: .78rem; font-weight: 600; color: var(--text); padding: 0 .5rem; }
.side-crisis { font-size: .72rem; line-height: 1.5; padding: 0 .5rem; }
.side-crisis strong { color: var(--text); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.1rem;
  background: #111c27; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: .2rem; }
.view-title { font-size: 1.02rem; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.usage-chip { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: .15rem .6rem; }
.tier-badge { font-size: .68rem; background: #21402c; color: var(--ok); border: 1px solid #2f6f4a;
  padding: .12rem .55rem; border-radius: 999px; }
.tier-badge.pro { background: #2b2340; color: #b9a8ee; border-color: #4b3f74; }
.tier-badge.lg { font-size: .8rem; padding: .3rem .8rem; }
.account-chip { display: flex; align-items: center; gap: .45rem; background: var(--panel-2);
  border: 1px solid var(--line-2); color: var(--text); border-radius: 999px; padding: .3rem .75rem;
  font: inherit; font-size: .8rem; cursor: pointer; }
.account-chip:hover { border-color: var(--accent); }
.account-chip .ic { width: 15px; height: 15px; }
.lang-select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 7px; padding: .2rem .4rem; font-size: .76rem; }

.content { flex: 1; padding: 1.1rem; max-width: 1120px; width: 100%; margin: 0 auto; }
.view-chat { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; align-items: start; }
.view-narrow { max-width: 720px; display: flex; flex-direction: column; gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.card h4 { margin: .9rem 0 .3rem; font-size: .92rem; }
@media (max-width: 900px) { .view-chat { grid-template-columns: 1fr; } }
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; z-index: 40; transform: translateX(-100%);
    transition: transform .18s ease; }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(3,8,14,.55); }
  .menu-btn { display: block; }
}

/* ---------- Chat ---------- */
.chat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; min-height: 68vh; }
.messages { flex: 1; display: flex; flex-direction: column; gap: .6rem; overflow-y: auto;
  max-height: 66vh; padding-right: .3rem; }
.msg { padding: .6rem .85rem; border-radius: 12px; max-width: 85%; white-space: pre-wrap; }
.msg.user { background: var(--user); align-self: flex-end; }
.msg.assistant { background: var(--assistant); align-self: flex-start; border: 1px solid var(--line); }
.msg.assistant.crisis { background: var(--crisis-bg); border-color: var(--crisis-border); }
.msg .meta { display: block; margin-top: .35rem; font-size: .68rem; color: var(--muted); }
.resource-card { align-self: flex-start; max-width: 85%; background: var(--crisis-bg); border: 1px solid var(--crisis-border);
  border-left: 3px solid #f0899d; border-radius: 10px; padding: .55rem .8rem; }
.resource-card .rc-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #f0899d; margin-bottom: .35rem; }
.resource-card .rc-row { font-size: .85rem; margin: .2rem 0; }
.resource-card a { color: var(--accent); font-weight: 600; text-decoration: none; }
.resource-card a:hover { text-decoration: underline; }
.composer { display: flex; gap: .5rem; margin-top: .7rem; }
.composer textarea { flex: 1; resize: vertical; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 9px; padding: .55rem; font: inherit; }
.mic { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; font-size: 1.1rem; cursor: pointer; padding: 0 .7rem; }
.mic.listening { background: var(--crisis-bg); border-color: var(--crisis-border); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.voice-row { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; font-size: .78rem; color: var(--muted); }
.account-nudge { display: flex; align-items: center; gap: .5rem; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 9px; padding: .4rem .6rem; margin-bottom: .5rem; font-size: .8rem; color: var(--muted); }
.account-nudge span { flex: 1; }
.account-nudge .link { white-space: nowrap; }
.account-nudge .nudge-x { background: none; border: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }

/* ---------- Model panel ---------- */
.model-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; position: sticky; top: 4.5rem; }
.mp-head { display: flex; align-items: center; justify-content: space-between; }
.mp-head h3 { margin: 0; font-size: .95rem; }
.mp-toggle { font-size: 1.1rem; line-height: 1; }
.model-panel h4 { margin: 1rem 0 .4rem; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.themes .theme { background: var(--panel-2); border-left: 3px solid var(--accent); padding: .5rem .6rem; border-radius: 6px; margin-bottom: .5rem; font-size: .9rem; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: .25rem .6rem; font-size: .8rem; }
.chips.clickable li, .chips li.clickable-chip { cursor: pointer; }
.chips.clickable li:hover, .chips li.clickable-chip:hover { border-color: var(--accent); }
.chips li.clickable-chip::before { content: "▷ "; color: var(--accent); }
.dims .dim { margin-bottom: .45rem; font-size: .78rem; }
.dims .bar { height: 7px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: .15rem; }
.dims .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.empty { color: var(--muted); font-size: .82rem; font-style: italic; }

/* ---------- Progress / review ---------- */
#progressBody h4 { margin: .9rem 0 .3rem; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prog-dim { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; font-size: .85rem; }
.prog-dim .lbl { flex: 1; }
.prog-dim .val { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.prog-dim .arrow { font-weight: 700; width: 1em; text-align: center; }
.prog-dim .arrow.good { color: var(--ok); }
.prog-dim .arrow.warn { color: #e0a86a; }
.prog-dim .arrow.flat { color: var(--muted); }
.spark { display: inline-flex; align-items: flex-end; gap: 1px; height: 22px; }
.spark i { width: 4px; background: var(--accent-2); border-radius: 1px; display: block; }
.prog-stats { margin-top: .4rem; }
.prog-stats .pill, .review-facts .fact { display: inline-block; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 999px; padding: .1rem .5rem; margin: .15rem .2rem 0 0; font-size: .76rem; }
.review-facts { margin: .8rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.review-facts .fact { border-radius: 8px; }
.review-facts .fact b { color: var(--text); }

/* ---------- Goals ---------- */
.goal-add { display: flex; gap: .4rem; margin: .6rem 0; }
.goal-add input { flex: 1; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; padding: .5rem .6rem; font: inherit; }
.goals-list { margin-top: .4rem; }
.goal-item { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--line-2); border-radius: 9px; margin-bottom: .4rem; background: var(--panel-2); font-size: .9rem; }
.goal-item .goal-text { flex: 1; }
.goal-item.done .goal-text, .goal-item.dropped .goal-text { color: var(--muted); text-decoration: line-through; }
.goal-btn { background: none; border: 1px solid var(--line-2); color: var(--text); border-radius: 7px; width: 1.9rem; height: 1.7rem; cursor: pointer; }
.goal-btn.done:hover { border-color: var(--ok); color: var(--ok); }
.goal-btn.drop:hover { border-color: #e0708a; color: #e0708a; }
.goal-status { font-size: .72rem; color: var(--muted); }

/* ---------- Library ---------- */
.lib-list { margin: .5rem 0 0; }
.lib-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border: 1px solid var(--line-2); border-radius: 9px; margin-bottom: .4rem; background: var(--panel-2); }
.lib-info { flex: 1; }
.lib-goal { font-size: .9rem; }
.lib-meta { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.lib-start { padding: .35rem .8rem; font-size: .82rem; white-space: nowrap; }

/* ---------- Channels ---------- */
.channels-list { margin: .8rem 0; display: flex; flex-direction: column; gap: .5rem; }
.channels-list .ch { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; padding: .5rem .6rem; font-size: .84rem; }
.channels-list .ch .ch-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.channels-list .ch .ch-verify { display: flex; gap: .4rem; margin-top: .4rem; }
.channels-list input, .ch-add input, .ch-add select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: .45rem; font: inherit; font-size: .82rem; }
.ch-add { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.ch-add input { flex: 1; }
.tg-link { margin: .6rem 0; }
.tg-link .note { font-size: .74rem; }
.tg-link code { background: var(--panel-3); padding: .1rem .4rem; border-radius: 5px; font-family: var(--mono); font-size: .8rem; }

/* ---------- Account ---------- */
.tier-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
#tierCard .tier-badge.lg { align-self: center; }
.view-account input { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; padding: .55rem .6rem; font: inherit; }
.view-account .row { margin: .4rem 0; }
.view-account h4 { margin: .6rem 0 .2rem; }
.view-account .note { font-size: .74rem; margin-top: .4rem; }
.data-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .3rem; }
.uid-row { margin: .6rem 0 0; font-size: .74rem; }
.uid { font-family: var(--mono); font-size: .72rem; opacity: .8; }
hr.sep { border: none; border-top: 1px solid var(--line-2); margin: 1rem 0; }
#resetDetails { margin-top: .8rem; }
#resetDetails summary { cursor: pointer; color: var(--accent); font-size: .84rem; margin-bottom: .4rem; }
.seg { display: flex; gap: .3rem; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: .25rem; margin: .3rem 0 1rem; }
.seg-btn { flex: 1; background: none; border: none; color: var(--muted); font: inherit;
  font-size: .9rem; padding: .5rem; border-radius: 8px; cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #06131f; font-weight: 600; }
.oauth { display: flex; flex-direction: column; gap: .5rem; margin: 1rem 0 .2rem; }
.oauth-sep { display: flex; align-items: center; gap: .6rem; color: var(--muted);
  font-size: .74rem; margin: .2rem 0; }
.oauth-sep::before, .oauth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.btn-oauth { display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 9px; padding: .6rem; font: inherit; font-size: .9rem; cursor: pointer; }
.btn-oauth:hover { border-color: var(--accent); }
.btn-oauth svg { width: 18px; height: 18px; }
.conn-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .6rem .7rem; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 9px; margin: .2rem 0 .8rem; }
.conn-name { font-weight: 600; font-size: .92rem; }
.conn-state { font-size: .78rem; display: inline-flex; align-items: center; gap: .35rem; }
.conn-state.on { color: var(--ok); }
.conn-state.off { color: var(--muted); }
.conn-state .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.acct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.acct-head h3 { margin: 0 0 .2rem; }
.plan-line { margin: .1rem 0 1rem; }
.ghost.block { display: block; width: 100%; }
.card details { margin-top: .8rem; }
.card details > summary { cursor: pointer; color: var(--accent); font-size: .86rem; list-style: none;
  padding: .35rem 0; user-select: none; }
.card details > summary::-webkit-details-marker { display: none; }
.card details > summary::before { content: "▸ "; font-size: .7em; }
.card details[open] > summary::before { content: "▾ "; }
#accountPassword details { border-top: 1px solid var(--line-2); padding-top: .4rem; }

/* ---------- Questionnaire ---------- */
.qn-item { margin: 1.1rem 0; }
.qn-item .qn-text { font-size: .92rem; margin-bottom: .4rem; }
.qn-item input[type=range] { width: 100%; }
.qn-item .qn-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }
.qn-item .qn-scale b { color: var(--text); font-size: .95rem; }
.qn-goal { display: flex; flex-direction: column; gap: .4rem; margin-top: .4rem; }
.qn-goal label { display: flex; gap: .5rem; align-items: center; font-size: .9rem; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: .5rem .6rem; cursor: pointer; }
#qnSkip { display: block; margin-top: .8rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .66rem; padding: .05rem .4rem; border-radius: 6px; margin-right: .3rem; }
.badge.s0 { background: #21402c; color: var(--ok); }
.badge.s1, .badge.s2 { background: var(--warn-bg); color: #e0a86a; border: 1px solid var(--warn-border); }
.badge.s3, .badge.s4 { background: var(--crisis-bg); color: #f0899d; border: 1px solid var(--crisis-border); }
.badge.fallback { background: #402a1a; color: #e0a86a; }

/* ---------- Overlays (questionnaire + intervention) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(3, 8, 14, .72); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.iv-card { position: relative; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.4rem; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; }
.iv-close { position: absolute; top: .6rem; right: .8rem; background: none; border: none; color: var(--muted); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.iv-card h3 { margin: 0 .5rem .2rem 0; }
.iv-safety { background: var(--warn-bg); border: 1px solid var(--warn-border); color: #e0a86a; padding: .5rem .6rem; border-radius: 8px; font-size: .8rem; }
.iv-stage { margin-top: 1rem; }
.iv-stage input[type=range] { width: 100%; }
.range-label { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-bottom: 1rem; }
.range-label b { color: var(--text); font-size: 1rem; }
.iv-stepcount { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.iv-steptext { background: var(--panel-2); border-left: 3px solid var(--accent); padding: .9rem 1rem; border-radius: 8px; font-size: 1rem; min-height: 3.5rem; }
.iv-nav { display: flex; justify-content: space-between; margin-top: 1rem; }
.iv-nav button { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: .5rem 1rem; cursor: pointer; }
.iv-nav button.primary { background: var(--accent); color: #06131f; border: none; }
.iv-result { background: var(--panel-2); border-radius: 8px; padding: 1rem; font-size: .95rem; line-height: 1.6; }
.iv-result .up { color: var(--ok); font-weight: 600; }
.msg { font-size: .82rem; }
#chMsg, #accountMsg { color: var(--muted); }

/* ---------- Admin page ---------- */
.admin { max-width: 1000px; margin: 1rem auto; padding: 1rem; }
.topbar-admin { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; max-width: 380px; }
.login-card input { display: block; width: 100%; margin: .5rem 0; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: .55rem; font: inherit; }
.login-card .row { display: flex; gap: .6rem; align-items: center; margin-top: .5rem; }
.admin-bar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; font-size: .85rem; color: var(--muted); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.admin-table th, .admin-table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); text-transform: uppercase; font-size: .68rem; letter-spacing: .04em; }
.admin-table td .actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.admin-table td input.notes { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; padding: .25rem .4rem; font: inherit; font-size: .75rem; width: 130px; }
.btn-sm { border: none; border-radius: 6px; padding: .25rem .5rem; font-size: .72rem; cursor: pointer; }
.btn-approve { background: #21402c; color: var(--ok); }
.btn-changes { background: #402a1a; color: #e0a86a; }
.btn-reject { background: var(--crisis-bg); color: #f0899d; }
.status-approved { color: var(--ok); }
.status-rejected { color: #f0899d; }
.status-changes_requested { color: #e0a86a; }
.monitor-chat { margin-top: .8rem; display: flex; flex-direction: column; gap: .4rem; max-height: 50vh; overflow-y: auto; }
.monitor-chat .m { padding: .4rem .6rem; border-radius: 8px; font-size: .82rem; max-width: 85%; white-space: pre-wrap; }
.monitor-chat .m.user { background: var(--user); align-self: flex-end; }
.monitor-chat .m.assistant { background: var(--assistant); border: 1px solid var(--line); align-self: flex-start; }
.monitor-chat .m .t { display: block; font-size: .66rem; color: var(--muted); margin-top: .2rem; }
.monitor-chat .m .empty { color: var(--muted); font-style: italic; }
.admin-table .role-sel { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; padding: .15rem; font-size: .75rem; }
.detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .6rem; }
@media (max-width: 800px) { .detail-cols { grid-template-columns: 1fr; } }
.analysis { font-size: .8rem; display: flex; flex-direction: column; gap: .8rem; max-height: 50vh; overflow-y: auto; }
.analysis h5 { margin: 0 0 .3rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.analysis .hyp { display: flex; justify-content: space-between; gap: .5rem; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: .35rem .5rem; margin-bottom: .3rem; }
.analysis .hyp .conf { color: var(--accent); font-variant-numeric: tabular-nums; }
.analysis .hyp.inactive { opacity: .55; }
.analysis .dim { margin-bottom: .35rem; }
.analysis .dim .bar { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: .15rem; }
.analysis .dim .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.analysis .pill { display: inline-block; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: .1rem .5rem; margin: .15rem .2rem 0 0; font-size: .74rem; }
.analysis .empty { color: var(--muted); font-style: italic; }
.analysis .notif { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent-2); border-radius: 6px; padding: .35rem .5rem; margin-bottom: .3rem; line-height: 1.35; }
.analysis .notif.sensitive { border-left-color: #e0703a; }
.analysis .notif .t { display: block; color: var(--muted); font-size: .68rem; margin-top: .2rem; }
#monitorSection, #rolesSection { margin-top: 1.6rem; }
#rolesSection .row { display: flex; gap: .5rem; align-items: center; }
#rolesSection input, #rolesSection select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: .5rem; font: inherit; }

/* --- Feedback: floating launcher + modal bits ------------------------------ */
.fab-feedback {
  position: fixed; bottom: 1.1rem; right: 1.1rem; z-index: 40;
  display: flex; align-items: center; gap: .45rem;
  background: var(--accent); color: #06131f; border: none;
  border-radius: 999px; padding: .6rem 1rem; font: inherit; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 20px rgba(3, 8, 14, .45);
}
.fab-feedback:hover { background: #62b0ee; }
.fab-feedback .ic { width: 18px; height: 18px; fill: none; stroke: #06131f; stroke-width: 2; }
.fb-rate-label { margin: .6rem 0 .3rem; font-size: .82rem; }
.fb-stars { display: flex; gap: .25rem; margin-bottom: .8rem; }
.fb-star {
  background: none; border: none; cursor: pointer; padding: 0 .1rem;
  font-size: 1.7rem; line-height: 1; color: var(--line-2); transition: color .12s;
}
.fb-star:hover, .fb-star.on { color: #f2c14e; }
.fb-cats { margin-bottom: .7rem; flex-wrap: wrap; }
#fbMessage {
  width: 100%; box-sizing: border-box; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  color: var(--text); font: inherit; padding: .6rem .7rem; resize: vertical;
}
.fb-thanks { text-align: center; padding: 1rem .5rem; font-size: 1.02rem; }

@media (max-width: 780px) {
  /* Keep the chat "Senden" button (bottom-right) clear on phones. */
  .fab-feedback { left: 1rem; right: auto; bottom: .9rem; padding: .55rem .8rem; }
}

/* --- Beta survey items ------------------------------------------------------ */
.sv-item { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.sv-item:last-of-type { border-bottom: none; }
.sv-q { margin-bottom: .35rem; font-size: .9rem; }
.sv-c {
  width: 100%; box-sizing: border-box; margin-top: .4rem; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  color: var(--text); font: inherit; padding: .45rem .6rem; resize: vertical;
}
#betaBadge { background: var(--accent); color: #06131f; }
