/* One stylesheet for all five apps. Each page sets --accent (pages.ts); everything else is shared.
   System fonts only: no request leaves the page for a font, which matters to people uploading court
   hearings and therapy sessions. */

:root {
  --paper: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eef0f4;
  --line: #e2e5eb;
  --line-strong: #cdd2db;
  --ink: #12161d;
  --ink-2: #3d4553;
  --ink-3: #6b7383;
  --ok: #1f7a4d;
  --warn: #9a6100;
  --bad: #b42318;
  --accent-ink: #ffffff;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1217;
    --surface: #161a21;
    --surface-2: #1d222b;
    --line: #262c37;
    --line-strong: #353d4b;
    --ink: #eef1f5;
    --ink-2: #c3c9d3;
    --ink-3: #8c95a4;
    --ok: #5cc794;
    --warn: #e0a640;
    --bad: #f07a6e;
    --accent-ink: #0f1217;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font);
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header / footer ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { flex: none; border-radius: 7px; }
/* The name gives way before the language switch and the button do: it may shrink, and on the narrowest screens ends in an ellipsis. */
.brand-name { font-weight: 700; font-size: 17px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand-by { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-nav { display: flex; align-items: center; gap: 10px; flex: none; }
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; color: var(--ink-2); }
.lang summary::-webkit-details-marker { display: none; }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 150px; }
.lang a { display: block; padding: 6px 10px; border-radius: 4px; color: var(--ink); text-decoration: none; }
.lang a:hover, .lang a[aria-current] { background: var(--surface); }
.site-footer { border-top: 1px solid var(--line); padding: 24px clamp(16px, 4vw, 40px); color: var(--ink-3); font-size: 13px; }
.site-footer a { color: var(--ink-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer; font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.btn:hover { background: var(--surface); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface); }
.btn-danger { color: var(--bad); }
.btn-lg { padding: 12px 20px; font-size: 16px; border-radius: 8px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ---------- landing ---------- */
.landing main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.narrow { max-width: 640px; margin: 60px auto; }
.ws-main, .item-grid > div, .panel { min-width: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center; padding: clamp(36px, 7vw, 88px) 0 clamp(28px, 5vw, 56px); }
.hero h1 { font-size: clamp(32px, 4.6vw, 52px); margin: 0 0 18px; }
.lead { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); margin: 0 0 28px; max-width: 34em; }
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-note { color: var(--ink-3); font-size: 13px; }
.hero-sample { min-width: 0; }
.sample-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 0 12px 40px rgba(16, 24, 40, 0.10); overflow: hidden; }
.sample-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink-2); }
.sample-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.sample-head strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sample-tabs::-webkit-scrollbar { display: none; }
.sample-tabs span { padding: 6px 10px; font-size: 12.5px; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; }
.sample-tabs span.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.sample-body { padding: 16px 18px 20px; font-size: 14px; max-height: 380px; overflow: hidden; position: relative; }
.sample-body::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48px; background: linear-gradient(to bottom, transparent, var(--paper)); }
.sample-body h3 { font-size: 15px; margin: 0 0 6px; }
.sample-body h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin: 14px 0 6px; }
.sample-body p, .sample-body li { margin: 0 0 6px; color: var(--ink-2); }
.sample-body ul, .sample-body ol { padding-left: 18px; margin: 0 0 6px; }
.sample-body table { border-collapse: collapse; font-size: 13px; margin: 2px 0 8px; }
.sample-body th, .sample-body td { border: 1px solid var(--line); padding: 5px 7px; text-align: left; vertical-align: top; color: var(--ink-2); }
.sample-body th { color: var(--ink); font-weight: 600; white-space: nowrap; }
.sample-body td { min-width: 6.5em; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 24px 0 48px; }
.feature { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; background: var(--paper); }
.feature h2 { font-size: 17px; margin: 0 0 8px; }
.feature p { margin: 0; color: var(--ink-2); }
.steps { padding: 8px 0 48px; }
.steps h2, .faq h2 { font-size: 24px; margin: 0 0 16px; }
.steps ol { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.steps li { counter-increment: step; padding: 18px 18px 18px 58px; position: relative; background: var(--surface); border-radius: var(--radius-lg); color: var(--ink-2); }
.steps li::before { content: counter(step); position: absolute; left: 18px; top: 16px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.faq { padding: 8px 0 40px; max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--ink-2); margin: 10px 0 0; }
.closing { padding: 8px 0 64px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .brand-by { display: none; }
}
/* A phone: a smaller name and a tighter nav, so every app's full name fits beside the language switch and the button. */
@media (max-width: 480px) {
  .site-header { gap: 10px; }
  .brand { gap: 8px; }
  .brand img { width: 24px; height: 24px; }
  .brand-name { font-size: 15px; }
  .header-nav { gap: 6px; }
  .header-nav .btn { padding-left: 8px; padding-right: 8px; font-size: 13px; }
  .lang summary { padding: 5px 8px; }
}
/* The narrowest phones: the app's own word ("Meetings") rather than a cut-off "txscribe Me…"; the icon stays. */
@media (max-width: 359px) {
  .brand-maker { display: none; }
}

/* ---------- workspace layout ---------- */
.workspace main { max-width: 1240px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 32px) 64px; }
.loading { color: var(--ink-3); }
.ws { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.ws-side { position: sticky; top: 76px; }
.ws-side h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 8px; }
.project-list { list-style: none; margin: 0 0 12px; padding: 0; }
.project-list a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.project-list a:hover { background: var(--surface); }
.project-list a[aria-current] { background: var(--surface-2); font-weight: 600; }
.project-list .count { color: var(--ink-3); font-size: 12px; }
.account-box { margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; color: var(--ink-2); }
.account-box .meter { height: 6px; background: var(--surface-2); border-radius: 3px; margin: 8px 0; overflow: hidden; }
.account-box .meter span { display: block; height: 100%; background: var(--accent); }
.account-box .who { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .ws { grid-template-columns: minmax(0, 1fr); }
  .ws-side { position: static; }
}

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; overflow-wrap: anywhere; }
.page-head .sub { color: var(--ink-3); margin: 4px 0 0; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 13px; margin-bottom: 8px; display: inline-block; color: var(--ink-3); text-decoration: none; }
.crumb:hover { color: var(--accent); }

.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 40px 24px; text-align: center; color: var(--ink-2); }
.empty h2 { color: var(--ink); font-size: 20px; margin: 0 0 8px; }
.new-project { display: flex; gap: 8px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }
.field { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); min-width: 0; }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.new-project .field { width: min(360px, 100%); }

/* drop zone */
.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 22px; display: grid; gap: 12px;
  background: var(--surface); transition: border-color 0.15s, background 0.15s;
}
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); }
.drop-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.drop strong { font-size: 16px; }
.drop p { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.drop-opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.drop-opts label { display: inline-flex; align-items: center; gap: 6px; }
.links-box { display: flex; gap: 8px; }
.links-box textarea { flex: 1; min-height: 44px; resize: vertical; }

/* tables */
.items { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; }
.items th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.items td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.items tr:hover td { background: var(--surface); }
.items .name a { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.items .name a:hover { color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; color: var(--ink-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status.done::before { background: var(--ok); }
/* A failure carries txscribe's message, which can be long: it wraps instead of widening the table past a phone's screen. */
.status.failed { color: var(--bad); white-space: normal; }
.status.failed::before { background: var(--bad); }
.status.busy::before { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.status.skipped::before { background: var(--warn); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 5px; width: 120px; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.dots { display: flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.dots i.done { background: var(--accent); border-color: var(--accent); }
.dots i.running { background: color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.dots i.failed { background: var(--bad); border-color: var(--bad); }
@media (max-width: 720px) {
  .items .col-dur, .items .col-out { display: none; }
}

/* project outputs */
.section { margin-top: 32px; }
.section > h2 { font-size: 18px; margin: 0 0 4px; }
.section > p.hint { margin: 0 0 12px; color: var(--ink-3); font-size: 14px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.out-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; display: grid; gap: 8px; align-content: start; }
.out-card h3 { margin: 0; font-size: 15px; }
.out-card p { margin: 0; color: var(--ink-3); font-size: 13px; }
.out-card .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* item view */
.item-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
@media (max-width: 1180px) { .item-grid { grid-template-columns: minmax(0, 1fr); } .item-grid > aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; } .item-grid > aside .side-box { margin: 0; } }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; cursor: pointer; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.tabs button .mark { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-left: 6px; vertical-align: middle; background: var(--line-strong); }
.tabs button .mark.done { background: var(--ok); }
.tabs button .mark.running { background: var(--accent); }
.panel { min-height: 200px; }
.panel-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-tools .hint { color: var(--ink-3); font-size: 13px; margin: 0; }
.disclaimer { font-size: 12.5px; color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 14px; }

.transcript { display: grid; gap: 2px; }
.turn { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 8px 6px; border-radius: var(--radius); }
.turn:hover { background: var(--surface); }
.turn time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 3px; font-variant-numeric: tabular-nums; }
.turn .who { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.turn p { margin: 0; overflow-wrap: anywhere; }
.spk-0 { color: #2457d6; } .spk-1 { color: #b5480f; } .spk-2 { color: #23845c; } .spk-3 { color: #8a3fb0; }
.spk-4 { color: #a8336a; } .spk-5 { color: #2b7a8a; } .spk-6 { color: #7a6a12; } .spk-7 { color: #5a5f6b; }
@media (prefers-color-scheme: dark) {
  .spk-0 { color: #8fb0ff; } .spk-1 { color: #ffa36b; } .spk-2 { color: #6fd6a3; } .spk-3 { color: #d3a4f0; }
  .spk-4 { color: #f59ac3; } .spk-5 { color: #7dd3e0; } .spk-6 { color: #e3d070; } .spk-7 { color: #b6bcc8; }
}

.doc h2 { font-size: 17px; margin: 22px 0 8px; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 15px; margin: 16px 0 6px; }
.doc p, .doc li { color: var(--ink); }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 3px 0; }
.doc blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--accent); color: var(--ink-2); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 16px; }
/* Whole words in cells: a table too wide for a phone scrolls sideways in its wrapper rather than breaking words letter by letter. */
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; overflow-wrap: break-word; }
.doc th { background: var(--surface); }

.flashcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.flashcard { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; min-height: 120px; cursor: pointer; display: grid; align-content: space-between; gap: 10px; background: var(--paper); text-align: left; }
.flashcard:hover { border-color: var(--accent); }
.flashcard .front { font-weight: 600; }
.flashcard .back { color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 8px; }
.flashcard .flip { font-size: 12px; color: var(--ink-3); }

.quiz { display: grid; gap: 14px; counter-reset: q; }
.question { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.question legend, .question .q { font-weight: 600; counter-increment: q; }
.question .q::before { content: counter(q) ". "; color: var(--ink-3); }
.question ol { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.question button.opt { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; }
.question button.opt:hover { border-color: var(--line-strong); }
.question button.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.question button.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.question .why { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; }

.side-box { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 14px; }
.side-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin: 0 0 10px; }
.speaker-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 10px; }
.speaker-row label { font-size: 12.5px; font-weight: 700; }
.speaker-row .pair { display: flex; gap: 6px; }
.speaker-row .field { flex: 1; padding: 6px 8px; font-size: 13px; }
.speaker-row select.field { flex: 0 0 auto; max-width: 48%; }
.meta-list { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 13px; }
.meta-list dt { color: var(--ink-3); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.export-list { display: grid; gap: 6px; }

.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 14px; margin: 12px 0; }
.notice.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad); }
.notice.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.signin { max-width: 420px; margin: 56px auto; text-align: center; }
.signin h1 { font-size: 26px; margin: 0 0 10px; }
.signin p { color: var(--ink-2); }
.signin .stack { display: grid; gap: 10px; margin-top: 22px; }
.signin .or { color: var(--ink-3); font-size: 13px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px); }
