/* השולחן של מוטי. Tokens first; everything below derives from them. */
:root {
  --ink: #16202e;
  --ink-2: #2c3747;
  --muted: #5c6573;
  --faint: #8a919c;
  --paper: #f3f4f1;
  --card: #ffffff;
  --line: #e1e3de;
  --line-2: #d0d3cc;
  --accent: #0e5f6b;
  --accent-2: #0b4c56;
  --accent-soft: #e2efef;
  --live: #3fb3a5;
  --ok: #1d7a4f;   --ok-bg: #e5f2ea;
  --run: #2f5bd3;  --run-bg: #e7ecfa;
  --warn: #9a5b00; --warn-bg: #fbf0dc;
  --bad: #b3362b;  --bad-bg: #f9e5e2;
  --r-s: 8px; --r: 12px; --r-l: 16px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --shadow: 0 1px 0 rgba(22,32,46,.04), 0 1px 3px rgba(22,32,46,.06), 0 6px 16px -8px rgba(22,32,46,.10);
  --shadow-up: 0 1px 0 rgba(22,32,46,.05), 0 4px 10px rgba(22,32,46,.08), 0 14px 28px -12px rgba(22,32,46,.16);
  --body: "IBM Plex Sans Hebrew", "Assistant", "Segoe UI", Arial, sans-serif;
  --display: "Rubik", "IBM Plex Sans Hebrew", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --nav-w: 232px;
  --tab-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
.sprite { display: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.25; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark {
  width: 56px; height: 56px; border-radius: 16px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font: 600 1.6rem var(--display);
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .55; transform: scale(.96); } }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--nav-w) 1fr; }
.nav {
  position: sticky; top: 0; height: 100vh; background: var(--ink); color: #c9cfd8;
  display: flex; flex-direction: column; padding: var(--s5) var(--s3);
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3) var(--s5); color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: #fff1; display: grid; place-items: center; font: 600 1.1rem var(--display); }
.brand b { font: 600 1.05rem var(--display); display: block; }
.brand span { font-size: .78rem; color: #8f99a8; }
.nav a {
  display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3);
  border-radius: var(--r-s); color: inherit; text-decoration: none; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: #ffffff10; color: #fff; }
.nav a[aria-current="page"] { background: #ffffff16; color: #fff; box-shadow: inset -3px 0 0 var(--live); }
.nav .grow { flex: 1; }
.nav .who { padding: var(--s3); font-size: .85rem; color: #8f99a8; border-top: 1px solid #ffffff14; margin-top: var(--s3); }
.nav .who button { background: none; border: 0; color: #c9cfd8; padding: 0; cursor: pointer; display: inline-flex; gap: var(--s2); align-items: center; margin-top: var(--s2); }
.nav .who button:hover { color: #fff; }

main { min-width: 0; padding: var(--s6) var(--s6) var(--s7); }
.page { max-width: 1040px; margin-inline: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: var(--s1); }
.crumb { display: inline-flex; align-items: center; gap: var(--s1); color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: var(--s2); }
.crumb:hover { color: var(--ink); }

.tabbar { display: none; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); }
.card-pad { padding: var(--s5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1.02rem; }
.stack > * + * { margin-top: var(--s5); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.empty { padding: var(--s6) var(--s5); text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font: 600 1.05rem var(--display); margin-bottom: var(--s1); }
.empty .btn { margin-top: var(--s4); }

/* ---------- buttons, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 42px; padding: 0 var(--s4); border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--faint); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--paper); box-shadow: none; }
.btn.sm { min-height: 34px; padding: 0 var(--s3); font-size: .9rem; }
.btn.block { width: 100%; }
.btn .i { width: 18px; height: 18px; }
.btn.busy { pointer-events: none; opacity: .7; }

.field { display: block; }
.field + .field { margin-top: var(--s4); }
.field > span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: .84rem; margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px var(--s3); border-radius: var(--r-s);
  border: 1px solid var(--line-2); background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.ltr { direction: ltr; text-align: end; }
.input.code { font-family: var(--mono); font-size: 1.35rem; text-align: center; direction: ltr; }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.check { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-error { color: var(--bad); background: var(--bad-bg); border-radius: var(--r-s); padding: var(--s2) var(--s3); font-size: .92rem; margin-top: var(--s4); }
.form-error:empty { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 3px; background: #fff; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px var(--s3); border-radius: 6px; cursor: pointer; font-weight: 500; color: var(--muted); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- status chip ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap; background: var(--paper); color: var(--muted);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.run { background: var(--run-bg); color: var(--run); }
.chip.run::before { animation: pulse 1.2s ease-in-out infinite; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- home: the pulse strip ---------- */
.pulse { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; overflow: hidden; }
.pulse > div { padding: var(--s4) var(--s5); border-inline-start: 1px solid var(--line); min-width: 0; }
.pulse > div:first-child { border-inline-start: 0; }
.pulse .lbl { font-size: .84rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pulse .val { font: 600 1.25rem var(--display); margin-top: 2px; }
.pulse .val.num { font-family: var(--mono); font-weight: 600; }
.pulse .note { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.meter { height: 6px; background: var(--paper); border-radius: 999px; overflow: hidden; margin-top: var(--s2); }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; width: 0; transition: width .4s ease; }
.meter.warn i { background: var(--warn); }
.meter.bad i { background: var(--bad); }

.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--bad-bg); color: var(--ink); }
.alert.warning { background: var(--warn-bg); }
.alert.info { background: var(--accent-soft); }
.alert .dot { margin-top: 9px; }
.alert b { display: block; }
.alert .body { flex: 1; min-width: 0; font-size: .92rem; }
.alert + .alert { margin-top: var(--s2); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s5); min-height: 64px; color: inherit; text-decoration: none; }
a.item { transition: background .15s ease; }
a.item:hover { background: #fafbf9; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: .86rem; color: var(--muted); display: flex; gap: var(--s3); flex-wrap: wrap; }
.item .side { display: flex; align-items: center; gap: var(--s3); flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; font: 600 1rem var(--display); flex: none; }
.search { max-width: 320px; }

/* ---------- the job track (signature) ---------- */
.track { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 0; min-width: 210px; }
.track .st { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; position: relative; }
.track .ln { height: 2px; background: var(--line-2); position: relative; overflow: hidden; }
.track .st.done { border-color: var(--ink-2); background: var(--ink-2); }
.track .ln.done { background: var(--ink-2); }
.track .st.now { border-color: var(--run); background: var(--run); box-shadow: 0 0 0 4px var(--run-bg); }
.track .ln.now::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 40%;
  background: var(--run); animation: travel 1.3s ease-in-out infinite;
}
.track .st.ok { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.track .st.bad { border-color: var(--bad); background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
.track .st.wait { border-color: var(--warn); background: var(--warn-bg); }
.track-labels { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: .76rem; color: var(--faint); margin-top: 6px; }
.track-labels span:nth-child(2) { text-align: center; }
.track-labels span:last-child { text-align: end; }
@keyframes travel { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
[dir="rtl"] .track .ln.now::after { animation-name: travel-rtl; }
@keyframes travel-rtl { from { transform: translateX(100%); } to { transform: translateX(-250%); } }

.job { display: grid; grid-template-columns: 1fr auto; gap: var(--s2) var(--s4); padding: var(--s4) var(--s5); align-items: center; }
.job .title { font-weight: 600; }
.job .why { grid-column: 1 / -1; font-size: .9rem; color: var(--bad); background: var(--bad-bg); padding: var(--s2) var(--s3); border-radius: var(--r-s); display: flex; gap: var(--s3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.job .why.wait { color: var(--warn); background: var(--warn-bg); }
.job-trackcell { min-width: 230px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 76px 1fr; gap: var(--s3); padding: 6px 0; font-size: .9rem; }
.timeline time { color: var(--faint); font-family: var(--mono); font-size: .8rem; direction: ltr; text-align: end; }
.timeline .k-failed, .timeline .k-retry_scheduled, .timeline .k-lease_expired { color: var(--bad); }
.timeline .k-succeeded { color: var(--ok); font-weight: 600; }

/* ---------- files ---------- */
.drop {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-l); padding: var(--s5); text-align: center; background: #fbfbfa;
  transition: border-color .15s ease, background .15s ease;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop p { color: var(--muted); margin-top: var(--s2); }
.upbar { height: 4px; border-radius: 999px; background: var(--paper); overflow: hidden; margin-top: var(--s2); }
.upbar i { display: block; height: 100%; background: var(--accent); width: 0; }

/* ---------- vault ---------- */
.secret-val { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; color: var(--muted); letter-spacing: .08em; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side { background: var(--ink); color: #d5dae2; padding: var(--s7); display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .brand { padding: 0; }
.auth-side h1 { color: #fff; font-size: 2.1rem; max-width: 14ch; }
.auth-side p { margin-top: var(--s3); max-width: 38ch; color: #a9b2bf; }
.auth-side .facts { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); font-size: .92rem; }
.auth-side .facts li { display: flex; gap: var(--s3); align-items: center; }
.auth-side .facts .i { color: var(--live); }
.auth-main { display: grid; place-items: center; padding: var(--s6) var(--s5); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.5rem; }
.auth-card .lead { color: var(--muted); margin: var(--s2) 0 var(--s5); }
.steps { display: flex; gap: var(--s2); margin-bottom: var(--s5); }
.steps i { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.steps i.on { background: var(--accent); }
.qr { width: 196px; height: 196px; margin: var(--s4) auto; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.qr svg { width: 100%; height: 100%; display: block; }
.secret-box { font-family: var(--mono); direction: ltr; text-align: center; background: var(--paper); border-radius: var(--r-s); padding: var(--s2); font-size: .95rem; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); font-family: var(--mono); direction: ltr; margin: var(--s4) 0; }
.codes span { background: var(--paper); border-radius: var(--r-s); padding: var(--s2); text-align: center; font-size: 1rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: .92rem; }

/* ---------- dialog ---------- */
dialog { border: 0; padding: 0; border-radius: var(--r-l); box-shadow: var(--shadow-up); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 48px); color: var(--ink); }
dialog::backdrop { background: rgba(22,32,46,.42); }
dialog form { padding: var(--s5); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s4); }
dialog .dlg-foot { display: flex; gap: var(--s3); justify-content: flex-end; margin-top: var(--s5); }

/* ---------- toast ---------- */
.toast {
  position: fixed; inset-inline: 0; bottom: var(--s5); margin-inline: auto; width: max-content; max-width: calc(100vw - 32px);
  background: var(--ink); color: #fff; padding: var(--s3) var(--s4); border-radius: var(--r); box-shadow: var(--shadow-up);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 50;
}
.toast.on { opacity: 1; transform: none; }
.toast.bad { background: var(--bad); }

/* ---------- tables of facts ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); font-size: .94rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.log { font-size: .88rem; }
.log .item { min-height: 52px; padding-block: var(--s2); }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; }
  main { padding: var(--s4) var(--s4) calc(var(--tab-h) + var(--s6) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tab-h); font-size: .74rem; color: var(--muted); text-decoration: none; font-weight: 500; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar a[aria-current="page"] .i { stroke-width: 2.1; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
  h1 { font-size: 1.45rem; }
  .page-head { margin-bottom: var(--s4); align-items: flex-start; }
  .pulse { grid-template-columns: 1fr 1fr; }
  .pulse > div:nth-child(3) { border-inline-start: 0; }
  .pulse > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid-2 { grid-template-columns: 1fr; }
  .card-pad { padding: var(--s4); }
  .card-head { padding: var(--s3) var(--s4); }
  .item { padding: var(--s3) var(--s4); gap: var(--s3); }
  .item.stack { flex-wrap: wrap; }
  .item.stack .main { flex-basis: 100%; }
  .item.stack .title { white-space: normal; overflow-wrap: anywhere; }
  .item.stack .meta { gap: 2px var(--s3); }
  .item.stack .side { width: 100%; flex-wrap: wrap; }
  .job { grid-template-columns: 1fr; padding: var(--s4); }
  .job-trackcell { min-width: 0; }
  .search { max-width: none; flex: 1; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: var(--s5) var(--s4); gap: var(--s4); }
  .auth-side h1 { font-size: 1.5rem; }
  .auth-side .facts { display: none; }
  .auth-main { place-items: start center; padding: var(--s5) var(--s4); }
  .toast { bottom: calc(var(--tab-h) + var(--s4) + env(safe-area-inset-bottom)); }
  .hide-phone { display: none !important; }
}
@media (min-width: 861px) { .mobile-top { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* small layout helpers, as attributes so they never collide with a class list (CSP: no inline style) */
[style-mt] { margin-top: var(--s4); }
[style-center] { justify-content: center; }
[style-bad] { color: var(--bad); }
[style-big] { font-size: 1.5rem; font-weight: 600; }
.grow { flex: 1; }
.btn.block[style-gap] { margin-top: var(--s2); }
.auth-card form > .btn[type="submit"], dialog form > .btn[type="submit"] { margin-top: var(--s5); }
.auth-card details { margin: var(--s2) 0 var(--s4); }
.auth-card details summary { cursor: pointer; }
.auth-card .secret-box { margin-top: var(--s2); }
.i.fwd { transform: scaleX(-1); }

/* ---- intake: recording, a cut-off recording ---- */
.rec h2 { display: flex; align-items: center; gap: var(--s2); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
.rec-dot.paused { background: var(--warn); animation: none; }
.rec-time { font-size: 1.6rem; font-weight: 600; letter-spacing: .02em; }
.callout { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4); border-radius: var(--r-s); border: 1px solid var(--line-2); background: #fff; }
.callout.warn { background: var(--warn-bg); border-color: transparent; }
.callout + .callout { margin-top: var(--s3); }
#cut:empty { display: none; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: var(--s2) var(--s3); align-items: start; }
.inline-form > .btn { margin-top: 27px; }
.inline-form > .form-error { grid-column: 1 / -1; }

/* ---- transcript: one recording, its speakers and its lines ---- */
.tx-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s5); align-items: start; }
.tx-main { min-width: 0; display: grid; gap: var(--s4); }
.tx-side { position: sticky; top: var(--s5); }
.tx-player { position: sticky; top: var(--s3); z-index: 5; padding: var(--s2) var(--s3); }
.tx-player audio { display: block; width: 100%; height: 40px; }
.tx-facts { display: flex; gap: var(--s3); flex-wrap: wrap; }
.tx-facts b { color: var(--ink); font-weight: 600; }
#txstate .meter { margin-top: var(--s3); }

/* the six speaker hues: quiet, distinct, readable on white */
[data-spk="0"] { --spk: #0e5f6b; --spk-bg: #e2efef; }
[data-spk="1"] { --spk: #8a4b12; --spk-bg: #f7ece0; }
[data-spk="2"] { --spk: #4a4fb0; --spk-bg: #ebecf8; }
[data-spk="3"] { --spk: #8b2f5a; --spk-bg: #f6e6ee; }
[data-spk="4"] { --spk: #3d6b22; --spk-bg: #e8f1e1; }
[data-spk="5"] { --spk: #5c6573; --spk-bg: #eceeea; }

.tx-lines { list-style: none; margin: 0; padding: var(--s2) 0; }
.tx-lines li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--s3); padding: var(--s2) var(--s5); align-items: start; transition: background .15s ease; }
.tx-lines li:not(.cont) { margin-top: var(--s2); }
.tx-lines li:first-child { margin-top: 0; }
.tx-lines li:hover { background: #fafbf9; }
.tx-lines li.now { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent); }
.tx-time {
  border: 0; background: none; padding: 2px 0; margin-top: 1px; cursor: pointer; color: var(--faint); font-size: .8rem;
  display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; border-radius: 4px;
}
.tx-time:hover, .tx-lines li.now .tx-time { color: var(--accent); }
.tx-time .i { width: 14px; height: 14px; }
.tx-who { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--spk); background: var(--spk-bg); padding: 1px var(--s2); border-radius: 6px; margin-bottom: 2px; }
.tx-text { line-height: 1.75; overflow-wrap: anywhere; }
.tx-edited { font-size: .74rem; color: var(--warn); background: var(--warn-bg); border-radius: 4px; padding: 0 5px; margin-inline-start: 4px; white-space: nowrap; }
.tx-edit { opacity: 0; min-height: 30px; padding: 0 var(--s2); }
.tx-lines li:hover .tx-edit, .tx-edit:focus-visible { opacity: 1; }
.tx-editform { display: grid; gap: var(--s2); }
.tx-editform .form-error { margin-top: 0; }

.tx-spk { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); }
.tx-spk .main { flex: 1; min-width: 0; }
.tx-spk .title { font-weight: 600; overflow-wrap: anywhere; }
.tx-spk .title .chip { height: 22px; font-size: .74rem; margin-inline-start: 4px; vertical-align: 1px; }
.tx-spk .meta { display: flex; gap: var(--s2) var(--s3); flex-wrap: wrap; }
.tx-swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--spk); box-shadow: 0 0 0 3px var(--spk-bg); margin-top: 7px; flex: none; }
.tx-suggest { margin-top: var(--s2); padding: var(--s2) var(--s3); background: var(--paper); border-radius: var(--r-s); display: grid; gap: var(--s2); justify-items: start; }
.tx-suggest q, .tx-quote q { color: var(--muted); }
.tx-var ul { margin: var(--s2) 0; padding-inline-start: var(--s4); font-size: .92rem; }
.tx-var .linkish { font-weight: 600; }
.tx-terms { list-style: none; margin: 0 0 var(--s3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.tx-terms li { display: inline-flex; align-items: center; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding-inline: var(--s3) 2px; height: 30px; font-size: .88rem; }
.tx-terms button { border: 0; background: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--faint); }
.tx-terms button:hover { color: var(--bad); background: var(--bad-bg); }
.tx-terms .i { width: 14px; height: 14px; }
.tx-addterm > .btn { margin-top: 0; min-height: 44px; }
.tx-quote { display: flex; gap: var(--s3); align-items: baseline; background: var(--paper); border-radius: var(--r-s); padding: var(--s2) var(--s3); margin-bottom: var(--s4); font-size: .92rem; }
.tx-picks { display: grid; gap: var(--s2); }
.tx-pick { display: flex; gap: var(--s3); align-items: center; min-height: 48px; padding: var(--s2) var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-s); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.tx-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tx-pick input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.tx-pick small { display: block; color: var(--muted); font-size: .82rem; }
.tx-words { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
a.title { color: inherit; text-decoration: none; display: block; }
a.title:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 860px) {
  .tx-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .tx-side { position: static; order: -1; }
  .tx-player { top: 0; border-radius: 0 0 var(--r) var(--r); margin-inline: calc(var(--s4) * -1); border-inline: 0; }
  .tx-lines li { grid-template-columns: 52px minmax(0, 1fr); padding: var(--s2) var(--s4); gap: var(--s2); }
  .tx-edit { display: none; }
  .tx-lines li .tx-text { cursor: text; }
}
