/* src/app/app.css — Arty coaching app */

:root {
  --bg:        #f5f4f0;
  --surface:   #ffffff;
  --sunken:    #eeede8;
  --ink:       #151a23;
  --ink-2:     #3d4654;
  --muted:     #6b7482;
  --line:      #e3e1da;
  --line-2:    #d3d0c7;

  --brand:     #1d4ed8;
  --brand-dk:  #173ea8;
  --brand-bg:  #eaf0fe;

  --navy:      #0e1524;
  --navy-2:    #18223a;
  --navy-line: #263354;
  --navy-text: #aab4c8;

  --green:     #17754a;  --green-bg:  #e6f4ec;
  --amber:     #a85a08;  --amber-bg:  #fdf1dd;
  --red:       #b3261e;  --red-bg:    #fdecea;
  --violet:    #5b3cc4;  --violet-bg: #efeafc;

  --radius:    10px;
  --radius-lg: 14px;
  --shadow:    0 1px 2px rgba(20, 24, 35, .05), 0 4px 16px rgba(20, 24, 35, .06);
  --sidebar-w: 264px;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
.ico { flex-shrink: 0; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--sunken); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #8f1d17; }
.btn-warn { color: var(--red); }
.btn-warn:hover { background: var(--red-bg); border-color: #f0b8b3; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunken); }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.icon-btn { display: inline-flex; padding: 6px; border: 0; background: none; border-radius: 8px; color: inherit; }
.icon-btn:hover { background: rgba(127, 127, 127, .15); }

/* ── Fields ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 4px; }
.field small { font-size: .78rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
textarea { resize: vertical; line-height: 1.5; }
.error  { color: var(--red); font-size: .875rem; }
.notice { background: var(--amber-bg); color: #7a4206; border-radius: 9px; padding: 10px 12px; font-size: .875rem; }

/* ── Sign in ─────────────────────────────────────────────────────────────── */
.brand { font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; }
.brand::after { content: '.'; color: #6c9bff; }
.brand-lg { font-size: 1.6rem; }

.auth { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-pitch {
  background: var(--navy); color: #fff; padding: 56px clamp(28px, 6vw, 88px);
  display: flex; flex-direction: column; justify-content: center; gap: 28px;
}
.auth-pitch h1 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.12; letter-spacing: -.03em; max-width: 14ch; }
.pitch-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; max-width: 46ch; color: var(--navy-text); }
.pitch-list li { padding-left: 18px; border-left: 2px solid var(--navy-line); }
.pitch-list strong { color: #fff; display: block; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--sunken); border-radius: 10px; padding: 4px; }
.auth-tab { border: 0; background: none; padding: 8px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.auth-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ── Shell ───────────────────────────────────────────────────────────────── */
.app { height: 100%; display: flex; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 14px; }
.sidebar-close { display: none; }

.nav { display: grid; gap: 2px; padding: 0 10px 14px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: var(--navy-text); text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: var(--navy-2); color: #fff; }
.nav-item.is-active { background: var(--brand); color: #fff; }

.history { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--navy-line); }
.history-label { padding: 14px 20px 6px; font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #6f7c96; }
.history-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.history-empty { padding: 4px 10px; font-size: .82rem; color: #6f7c96; }
.history-item {
  position: relative; display: flex; gap: 9px; align-items: flex-start; padding: 7px 10px; border-radius: 8px;
  color: var(--navy-text); text-decoration: none;
}
.history-item .ico { margin-top: 3px; opacity: .7; }
.history-item:hover, .history-item.is-active { background: var(--navy-2); color: #fff; }
.history-text { min-width: 0; flex: 1; display: grid; }
.history-topic { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-date { font-size: .72rem; color: #6f7c96; }
.history-del { display: none; border: 0; background: none; color: #8996b0; padding: 3px; border-radius: 6px; }
.history-item:hover .history-del { display: inline-flex; }
.history-del:hover { color: #ff9c94; background: rgba(255, 255, 255, .08); }

.sidebar-foot { border-top: 1px solid var(--navy-line); padding: 10px; }
.account { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; border-radius: 9px; color: #fff; text-align: left; }
.account:hover { background: var(--navy-2); }
.account-text { min-width: 0; display: grid; }
.account-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-org { font-size: .75rem; color: #8090ad; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 8px 2px; }
.foot-links a, .foot-links button { font-size: .78rem; color: #8090ad; background: none; border: 0; padding: 0; text-decoration: none; }
.foot-links a:hover, .foot-links button:hover { color: #fff; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700;
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-arty { background: var(--navy); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scrim { display: none; }

/* ── Pages (practice, live setup, admin) ─────────────────────────────────── */
.view-page { overflow-y: auto; }
.page { width: 100%; max-width: 920px; margin: 0 auto; padding: 44px 32px 64px; display: grid; gap: 28px; align-content: start; }
.page-narrow { max-width: 720px; }
.page-wide { max-width: 1180px; }
.page-head h1 { font-size: 1.75rem; letter-spacing: -.025em; }
.page-head p { margin-top: 8px; color: var(--ink-2); max-width: 68ch; }

/* ── Conversation ────────────────────────────────────────────────────────── */
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 60px;
}
.chat-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-title h1 { font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; gap: 8px; flex-shrink: 0; }
.badge { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; flex-shrink: 0; }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-green  { background: var(--green-bg);  color: var(--green); }

.thread { flex: 1; overflow-y: auto; padding: 28px max(24px, calc((100% - 800px) / 2)) 16px; display: flex; flex-direction: column; gap: 20px; }
.thread-loading { color: var(--muted); margin: auto; }

.welcome { margin: auto 0; display: grid; gap: 14px; padding: 12px 0 24px; }
.welcome h1 { font-size: 1.9rem; letter-spacing: -.03em; }
.welcome > p { color: var(--ink-2); }
.welcome-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.card-btn {
  display: grid; gap: 6px; align-content: start; text-align: left; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.card-btn:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-btn .ico { color: var(--brand); margin-bottom: 4px; }
.card-btn span { font-size: .86rem; color: var(--muted); line-height: 1.45; }
.starters { display: grid; gap: 6px; margin-top: 14px; }
.starters-label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.starter { text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 2px; color: var(--ink-2); font-size: .92rem; }
.starter:hover { color: var(--brand); }

.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg-user { justify-content: flex-end; }
.msg-body { min-width: 0; max-width: 100%; }
.bubble { border-radius: var(--radius-lg); }
.msg-user .bubble { background: var(--brand); color: #fff; padding: 10px 15px; max-width: min(620px, 82%); border-bottom-right-radius: 4px; }
.msg-assistant .bubble { background: var(--surface); border: 1px solid var(--line); padding: 14px 18px; border-top-left-radius: 4px; }
.msg-tools { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .12s; }
.msg:hover .msg-tools, .msg:last-child .msg-tools { opacity: 1; }
.msg-tools button { border: 0; background: none; padding: 5px; border-radius: 6px; color: var(--muted); display: inline-flex; }
.msg-tools button:hover { background: var(--sunken); color: var(--ink); }
.msg-tools button.is-on { color: var(--brand); }
.msg-error { display: inline-flex; gap: 7px; align-items: center; color: var(--red); }
.note { align-self: center; font-size: .78rem; color: var(--muted); background: var(--sunken); padding: 4px 12px; border-radius: 999px; }

.transcript-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.transcript-block summary { display: flex; align-items: center; gap: 8px; padding: 11px 15px; cursor: pointer; font-weight: 600; font-size: .9rem; list-style: none; }
.transcript-block summary::-webkit-details-marker { display: none; }
.transcript-block summary span { font-weight: 400; color: var(--muted); font-size: .8rem; }
.transcript-block[open] summary span { display: none; }
.transcript-block pre { margin: 0; padding: 4px 15px 15px; white-space: pre-wrap; font: inherit; font-size: .86rem; color: var(--ink-2); max-height: 380px; overflow-y: auto; }

.typing, .thinking { display: inline-flex; gap: 4px; align-items: center; height: 1.4em; }
.typing i, .thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2), .thinking i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3), .thinking i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }

/* Arty's formatted answers */
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 10px; }
.prose h2, .prose h3, .prose h4 { margin: 18px 0 6px; font-size: 1rem; line-height: 1.3; }
.prose h2 { font-size: 1.08rem; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 1.3em; }
.prose li { margin-bottom: 4px; }
.prose code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--sunken); padding: 12px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0 0 10px; padding: 8px 14px; border-left: 3px solid var(--brand); background: var(--brand-bg); border-radius: 0 8px 8px 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.table-wrap { overflow-x: auto; margin-bottom: 10px; }
.prose table { border-collapse: collapse; font-size: .88rem; min-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--sunken); font-weight: 600; }

.composer { padding: 8px max(24px, calc((100% - 800px) / 2)) 22px; }
.composer-box { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 10px 8px 14px; box-shadow: var(--shadow); transition: border-color .12s; }
.composer-box:focus-within { border-color: var(--brand); }
.composer textarea { border: 0; outline: none; padding: 4px 0; resize: none; box-shadow: none !important; background: transparent; max-height: 200px; display: block; }
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.composer-row .btn-ghost { margin-left: -8px; }
.composer-hint { margin-left: auto; font-size: .74rem; color: var(--muted); }
.composer-row .btn-icon { border-radius: 11px; }
.composer-row [hidden] + .composer-hint { margin-left: auto; }

/* ── Talk mode ───────────────────────────────────────────────────────────── */
.talk-btn.is-on { background: var(--brand-bg); border-color: var(--brand); color: var(--brand); }
.talk-btn.is-listening { background: var(--red-bg); border-color: var(--red); color: var(--red); animation: pulse 1.4s infinite; }
.how { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-weight: 600; font-size: .92rem; }
.seg { display: inline-flex; background: var(--sunken); border-radius: 10px; padding: 4px; }
.seg button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 7px 14px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* ── Practice ────────────────────────────────────────────────────────────── */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.persona {
  display: grid; gap: 8px; align-content: start; text-align: left; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  transition: border-color .12s, box-shadow .12s;
}
.persona:hover { border-color: var(--violet); box-shadow: var(--shadow); }
.persona span { font-size: .86rem; color: var(--muted); line-height: 1.5; }
.persona em { font-style: normal; font-size: .82rem; font-weight: 600; color: var(--violet); display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.custom-persona { display: grid; gap: 10px; justify-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.custom-persona h2 { font-size: 1.05rem; }
.custom-persona p { color: var(--muted); font-size: .9rem; margin-top: -6px; }

/* ── Live call: setup ────────────────────────────────────────────────────── */
.setup { display: grid; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; }
.choice + .choice { margin-top: 4px; }
.choice { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-bg); }
.choice input { margin-top: 4px; accent-color: var(--brand); }
.choice strong { display: flex; align-items: center; gap: 8px; }
.choice p { font-size: .87rem; color: var(--ink-2); margin-top: 4px; }
.notice-ok { background: var(--green-bg); color: var(--green); }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; color: var(--ink-2); }
.steps-title { font-size: 1rem; margin-bottom: 10px; }
.fine-print { display: flex; gap: 8px; font-size: .82rem; color: var(--muted); }
.fine-print .ico { margin-top: 3px; }
.setup-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Live call: in progress ──────────────────────────────────────────────── */
.view-live { background: var(--bg); }
.live-bar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, .5); } 60% { box-shadow: 0 0 0 7px rgba(179, 38, 30, 0); } }
.live-word { color: var(--red); text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }
.live-clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.live-type { color: var(--muted); font-size: .88rem; }
.live-chips { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.chip { font-size: .8rem; background: var(--sunken); color: var(--ink-2); padding: 4px 10px; border-radius: 999px; }
.call-map { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.call-map:empty { display: none; }
.step { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; padding: 3px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.step.is-done { background: var(--green-bg); color: var(--green); }
.step.is-next { background: var(--brand); color: #fff; font-weight: 600; }
.meters { display: inline-flex; gap: 12px; align-items: center; }
.meter { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); }
.meter i { font-style: normal; }
.meter b { display: block; width: 46px; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.meter u { display: block; height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .08s linear; }
.live-deaf { background: var(--red-bg); color: #7d1a14; font-size: .92rem; padding: 12px 24px; }
.live-status { background: var(--amber-bg); color: #7a4206; padding: 8px 24px; font-size: .86rem; }

.live-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.live-coach, .live-transcript { display: flex; flex-direction: column; min-height: 0; }
.live-coach { border-right: 1px solid var(--line); }
.live-transcript { background: var(--surface); }
.live-col-head { display: flex; align-items: center; gap: 10px; padding: 14px 24px 10px; }
.live-col-head h2 { font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.live-col-head .btn { margin-left: auto; }

.ratio { padding: 0 24px 12px; }
.ratio-label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-bottom: 5px; }
.ratio-label .is-high { color: var(--amber); font-weight: 600; }
.ratio-bar { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.ratio-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s; }
.ratio-bar.is-high i { background: var(--amber); }

.cues { flex: 1; overflow-y: auto; padding: 4px 24px 24px; display: grid; gap: 12px; align-content: start; }
.cues-empty { margin: 12vh auto 0; text-align: center; color: var(--muted); max-width: 34ch; display: grid; gap: 12px; justify-items: center; }
.cues-empty strong { color: var(--ink); }
.cue { --c: var(--brand); --c-bg: var(--brand-bg); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius); padding: 12px 16px; opacity: .62; }
.cue header { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--c); }
.cue header span { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.cue header b { color: var(--ink-2); font-weight: 600; }
.cue header time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.cue p { margin-top: 6px; font-size: 1rem; line-height: 1.45; }
.cue.is-latest { opacity: 1; background: var(--c-bg); border-color: var(--c); box-shadow: var(--shadow); }
.cue.is-latest p { font-size: 1.3rem; font-weight: 500; letter-spacing: -.01em; }
.cue.is-fresh { animation: cue-in .35s ease-out; }
@keyframes cue-in { from { transform: translateY(-8px); opacity: 0; } }
.cue-ask        { --c: var(--violet); --c-bg: var(--violet-bg); }
.cue-objection  { --c: #a3195b; --c-bg: #fce9f2; }
.cue-deescalate { --c: #0f5fa8; --c-bg: #e6f1fb; }
.cue-insight    { --c: #0b6e7a; --c-bg: #e3f4f6; }
.cue-caution    { --c: var(--amber);  --c-bg: var(--amber-bg); }
.cue-compliance { --c: var(--red);    --c-bg: var(--red-bg); }
.cue-praise     { --c: var(--green);  --c-bg: var(--green-bg); }

.lines { flex: 1; overflow-y: auto; padding: 4px 24px 24px; }
.lines-empty { color: var(--muted); font-style: italic; }
.line { margin-bottom: 10px; font-size: .92rem; color: var(--ink-2); }
.line b { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.line-lo b { color: var(--brand); }
.line-interim { color: var(--muted); font-style: italic; }

/* ── Admin ───────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: grid; }
.stat b { font-size: 1.6rem; letter-spacing: -.02em; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat-link { font: inherit; color: inherit; text-align: left; cursor: pointer; }
.stat-link:hover { border-color: var(--brand); }
.link-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--brand); text-decoration: underline; }
.back-link { margin: 0 0 8px -8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; }
.panel-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-tools select, .panel-tools input { width: auto; padding: 6px 10px; font-size: .86rem; }
.panel .table-wrap { margin: 0; }
table.grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.grid th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 9px 20px; background: var(--bg); border-block: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 11px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td { white-space: nowrap; }
table.grid td small { display: block; color: var(--muted); font-size: .8rem; }
table.grid tr.is-off td:not(.row-actions) { opacity: .55; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 6px; }
.code { display: inline-flex; align-items: center; gap: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; background: var(--sunken); border: 0; padding: 4px 9px; border-radius: 6px; }
.code:hover { background: var(--brand-bg); color: var(--brand); }
.pill { font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pill-on  { background: var(--green-bg); color: var(--green); }
.pill-off { background: var(--red-bg);   color: var(--red); }
.empty { padding: 8px 20px 22px; color: var(--muted); }

/* ── Impersonation banner + coaching viewer ──────────────────────────────── */
.imp-banner { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px; background: var(--amber-bg); color: #7a4206; font-size: .88rem; border-bottom: 1px solid #f1d9ae; }
.row-actions .you { margin-left: 10px; }
.viewer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.viewer-list { display: grid; gap: 6px; margin-top: 8px; }
.viewer-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 11px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.viewer-item:hover { border-color: var(--brand); background: var(--brand-bg); }
.viewer-item .ico { margin-top: 3px; color: var(--muted); }
.viewer-item span { display: grid; min-width: 0; }
.viewer-item small { color: var(--muted); font-size: .8rem; }
.viewer-thread { display: grid; gap: 14px; margin-top: 16px; }
.viewer-msg > small { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.viewer-user > div { background: var(--brand-bg); border-radius: var(--radius); padding: 10px 14px; }
.viewer-arty > div { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }

/* ── Modal + toast ───────────────────────────────────────────────────────── */
.modal-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(14, 21, 36, .5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; padding: 26px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto; box-shadow: 0 24px 64px rgba(0, 0, 0, .25); }
.modal-wide { max-width: 760px; }
.modal h2 { font-size: 1.2rem; letter-spacing: -.015em; }
.modal-sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.checks { justify-content: flex-end; gap: 4px; font-size: .88rem; }
.checks label, .check-row { display: flex; align-items: center; gap: 8px; flex-direction: row; font-size: .88rem; }
.checks input, .check-row input { accent-color: var(--brand); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); z-index: 60;
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: .9rem;
  max-width: min(520px, calc(100vw - 32px)); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── Small screens ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-pitch { padding: 36px 24px; }
  .pitch-list { display: none; }

  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: min(var(--sidebar-w), 86vw); }
  .sidebar-close { display: inline-flex; }
  .menu-open .sidebar { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(14, 21, 36, .45); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--navy); color: #fff; }

  .page { padding: 28px 18px 48px; }
  .chat-head { padding: 12px 16px; }
  .thread { padding: 20px 16px 12px; }
  .composer { padding: 6px 12px 14px; }
  .composer-hint { display: none; }
  .composer-row .btn-icon { margin-left: auto; }
  .welcome-cards { grid-template-columns: 1fr; }
  .welcome h1 { font-size: 1.5rem; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }

  .live-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr); }
  .live-coach { border-right: 0; border-bottom: 1px solid var(--line); }
  .live-bar { padding: 10px 14px; }
  .live-col-head, .ratio, .cues, .lines { padding-inline: 16px; }
  .cue.is-latest p { font-size: 1.12rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Teaching Arty ───────────────────────────────────────────────────────── */
/* The leader's page (train.html): one conversation filling the window. */
.train { height: 100%; display: flex; flex-direction: column; }
.train .chat-title .brand { margin-right: 4px; }
.train-stop { margin: auto; text-align: center; display: grid; gap: 8px; max-width: 44ch; }
.train-stop h1 { font-size: 1.4rem; letter-spacing: -.02em; }
.train-stop p { color: var(--ink-2); }
.train-saved { display: inline-flex; gap: 8px; align-items: flex-start; border-radius: var(--radius); padding: 10px 14px; max-width: 60ch; background: var(--green-bg); color: var(--green); font-size: .86rem; }
.train-saved .ico { margin-top: 3px; }

/* The admin's review screen. */
.pill-new { background: var(--brand-bg); color: var(--brand); margin-left: 6px; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; padding: 4px 20px 20px; }
.lesson { display: grid; gap: 8px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.lesson-flag { border-color: #eccb93; }
.lesson-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .8rem; }
.lesson h3 { font-size: .98rem; line-height: 1.35; }
.lesson p { color: var(--ink-2); font-size: .92rem; }
.lesson blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--brand); background: var(--brand-bg); border-radius: 0 8px 8px 0; font-size: .92rem; }
.lesson-warning { display: flex; gap: 8px; align-items: flex-start; background: var(--amber-bg); color: #7a4206 !important; border-radius: 8px; padding: 8px 10px; font-size: .84rem !important; }
.lesson-warning .ico { margin-top: 2px; }
.lesson-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 900px) {
  .train .chat-title h1 { display: none; }
  .lessons { grid-template-columns: 1fr; padding-inline: 14px; }
}
