/* =========================================================================
   TrueIdiom — shared design system (single source of visual truth)
   Linked by every page: landing, sign-in, workspace, review.
   Clean modern light theme. No build step; vanilla CSS custom properties.
   ========================================================================= */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Brand — indigo/violet */
  --brand-50:  #eef0ff;
  --brand-100: #e0e3ff;
  --brand-200: #c6ccff;
  --brand-300: #a5adff;
  --brand-400: #8189fb;
  --brand-500: #6366f1;
  --brand-600: #5145e0;
  --brand-700: #4335c4;
  --brand-800: #38309c;

  /* Neutrals */
  --neutral-0:   #ffffff;
  --neutral-25:  #fbfbfd;
  --neutral-50:  #f6f7fb;
  --neutral-100: #eef0f5;
  --neutral-150: #e4e7ef;
  --neutral-200: #d7dbe6;
  --neutral-300: #c1c7d6;
  --neutral-400: #9aa2b6;
  --neutral-500: #6f7891;
  --neutral-600: #545c72;
  --neutral-700: #3c4358;
  --neutral-800: #262c3c;
  --neutral-900: #161a26;

  /* Semantic */
  --success-600: #1f9d55;
  --success-bg:  #e7f6ec;
  --success-border: #b6e2c4;
  --warning-600: #b7791f;
  --warning-bg:  #fdf3df;
  --warning-border: #f3ddab;
  --danger-600:  #d64550;
  --danger-bg:   #fdebed;
  --danger-border: #f5c2c7;
  --info-600:    #1f7fd6;
  --info-bg:     #e7f1fb;
  --info-border: #bcdcf5;

  /* Surface roles */
  --bg-app:      var(--neutral-50);
  --bg-surface:  var(--neutral-0);
  --bg-subtle:   var(--neutral-25);
  --bg-muted:    var(--neutral-100);
  --border:      var(--neutral-150);
  --border-strong: var(--neutral-200);
  --text:        var(--neutral-900);
  --text-soft:   var(--neutral-700);
  --text-muted:  var(--neutral-500);
  --text-onbrand: #ffffff;

  /* Typography scale */
  --font-sans: "Inter", "Segoe UI", "SF Pro Text", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs:   0.75rem;
  --fs-sm:   0.82rem;
  --fs-base: 0.9375rem;
  --fs-md:   1.02rem;
  --fs-lg:   1.2rem;
  --fs-xl:   1.5rem;
  --fs-2xl:  2rem;
  --fs-3xl:  2.6rem;
  --fs-4xl:  3.3rem;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Radii */
  --radius-sm: 0.4rem;
  --radius-md: 0.6rem;
  --radius-lg: 0.9rem;
  --radius-xl: 1.25rem;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(22, 26, 38, 0.06);
  --shadow-sm: 0 1px 3px rgba(22, 26, 38, 0.08), 0 1px 2px rgba(22, 26, 38, 0.04);
  --shadow-md: 0 6px 18px rgba(22, 26, 38, 0.08), 0 2px 6px rgba(22, 26, 38, 0.05);
  --shadow-lg: 0 18px 42px rgba(22, 26, 38, 0.12);

  /* Focus */
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.35);

  /* Motion */
  --transition-fast: 120ms ease;
  --transition: 180ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-app:      #14151b;
    --bg-surface:  #1c1e26;
    --bg-subtle:   #191b22;
    --bg-muted:    #23262f;
    --border:      #2c2f3a;
    --border-strong: #3a3e4b;
    --text:        #f2f3f7;
    --text-soft:   #d4d8e2;
    --text-muted:  #9aa1b2;
    --neutral-100: #23262f;
    --neutral-150: #2c2f3a;
    --brand-50:    #232345;
    --success-bg:  #16321f;
    --success-border: #275f37;
    --warning-bg:  #362b12;
    --warning-border: #6a5320;
    --danger-bg:   #3a1c20;
    --danger-border: #6f3138;
    --info-bg:     #142c40;
    --info-border: #245676;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 46px rgba(0, 0, 0, 0.5);
  }
}

/* Dark-mode: lift brand-colored TEXT that sits on dark surfaces so it stays
   readable. Light mode is untouched (all rules scoped to this media query).
   Brand tokens used as button/skip-link FILLS keep their saturated value —
   only text colors are lightened here. */
@media (prefers-color-scheme: dark) {
  .hero-pill {
    color: var(--brand-200);
    border-color: color-mix(in srgb, var(--brand-500) 55%, transparent);
  }
  .eyebrow,
  .breadcrumb a:hover,
  .tab.active,
  .landing-tab.active,
  .rail-item.active,
  .playground-tabs a.active,
  .playground-tabs button.active,
  .playground-tabs button[aria-selected="true"] {
    color: var(--brand-300);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Base --------------------------------------------------------------- */
* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg-app);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg-app);
  color: var(--text);
  font: var(--fs-base)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p { margin-top: 0; }

h1 { margin-bottom: 0; font-size: var(--fs-xl); line-height: 1.15; letter-spacing: -0.02em; }
h2 { margin-bottom: 0; font-size: var(--fs-md); letter-spacing: -0.01em; }
h3 { margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
p  { margin-bottom: var(--sp-3); }

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--brand-700); text-decoration: underline; }

code, .mono { font-family: var(--font-mono); font-size: 0.86em; overflow-wrap: anywhere; }

img { max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem; top: -3rem;
  z-index: 100;
  background: var(--brand-600);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-weight: 650;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 0.75rem; text-decoration: none; color: #fff; }

/* Global accessible focus */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.container { width: min(1160px, 100%); margin-inline: auto; padding-inline: 1.25rem; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  --_bg: var(--bg-surface);
  --_fg: var(--text);
  --_bd: var(--border-strong);
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: 1px solid var(--_bd);
  border-radius: var(--radius-md);
  background: var(--_bg);
  color: var(--_fg);
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    box-shadow var(--transition-fast), transform var(--transition-fast);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
/* `display: inline-flex` above is an author rule, so it beats the UA's
   [hidden] { display: none } and role-gated buttons stay visible. Every
   caller that reveals a button with `el.hidden = false` — the admin-only row
   deletes in the review queue and documents table, the Security pane's
   recovery-code control — depends on this. Same fix as .rail-item[hidden]. */
.btn[hidden] { display: none !important; }

.btn-primary {
  --_bg: var(--brand-600);
  --_fg: var(--text-onbrand);
  --_bd: var(--brand-600);
  box-shadow: 0 6px 16px rgba(81, 69, 224, 0.24);
}
.btn-primary:hover { --_bg: var(--brand-700); --_bd: var(--brand-700); color: #fff; }

.btn-secondary {
  --_bg: var(--bg-surface);
  --_fg: var(--text-soft);
  --_bd: var(--border-strong);
}
.btn-secondary:hover { --_bg: var(--neutral-100); --_fg: var(--text); }

.btn-danger {
  --_bg: var(--bg-surface);
  --_fg: var(--danger-600);
  --_bd: var(--danger-border);
}
.btn-danger:hover { --_bg: var(--danger-bg); }

.btn-ghost {
  --_bg: transparent;
  --_fg: var(--text-soft);
  --_bd: transparent;
}
.btn-ghost:hover { --_bg: var(--neutral-100); --_fg: var(--text); }

.btn-block { width: 100%; }
.btn-lg { min-height: 2.9rem; padding: 0.7rem 1.5rem; font-size: var(--fs-md); }
.btn-sm { min-height: 2.1rem; padding: 0.35rem 0.8rem; font-size: var(--fs-sm); }

/* ---- Forms -------------------------------------------------------------- */
label.field,
.field {
  display: grid;
  gap: var(--sp-2);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-weight: 400;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}
input:focus-visible, textarea:focus-visible, select:focus-visible { box-shadow: var(--focus-ring); }

textarea { min-height: 10rem; resize: vertical; line-height: 1.5; }
textarea[readonly] { background: var(--bg-muted); cursor: default; }
select:disabled, input:disabled { background: var(--bg-muted); color: var(--text-muted); }

input[type="file"] { padding: 0.4rem; }
input[type="file"]::file-selector-button {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--neutral-100);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-right: 0.6rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--neutral-150); }

fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
legend { margin-bottom: var(--sp-2); color: var(--text-soft); font-size: var(--fs-sm); font-weight: 650; }

.check-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  background: var(--bg-subtle);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.check-row input { width: auto; min-height: 0; }

.form-error {
  min-height: 1.2rem;
  margin: 0;
  color: var(--danger-600);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.form-note {
  margin: 0;
  color: var(--success-600);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

/* ---- Cards / panels ----------------------------------------------------- */
.card,
.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4);
}
.panel-header h2 { margin: 0; }
.panel-body { padding: var(--sp-4); }

.eyebrow {
  margin-bottom: 0.15rem;
  color: var(--brand-600);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.6rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  font-size: var(--fs-xs);
  font-weight: 650;
}

.muted-copy { color: var(--text-muted); overflow-wrap: anywhere; }
.lead-copy { color: var(--text); font-weight: 620; }

/* ---- Badges / status pills --------------------------------------------- */
.badge,
.status-badge,
.score {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 0.12rem 0.6rem;
  background: var(--bg-muted);
  color: var(--text-soft);
  font-size: var(--fs-xs);
  font-weight: 650;
  white-space: nowrap;
}

.status-awaiting_review {
  border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-600);
}
.status-published,
.status-human_edited,
.status-approved {
  border-color: var(--success-border); background: var(--success-bg); color: var(--success-600);
}
.status-rejected,
.status-failed {
  border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-600);
}
.status-refined,
.status-translated {
  border-color: var(--info-border); background: var(--info-bg); color: var(--info-600);
}
.score {
  border-color: var(--brand-200); background: var(--brand-50); color: var(--brand-700);
}

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--text-muted);
  background: var(--bg-subtle);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td { color: var(--text-soft); font-size: var(--fs-sm); }
td.src { max-width: 34rem; color: var(--text); }
tbody tr { transition: background var(--transition-fast); }
tbody tr:hover td { background: var(--brand-50); }

/* ---- Metric strip ------------------------------------------------------- */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-3);
}
.metric {
  display: grid;
  gap: 0.25rem;
  align-content: center;
  min-height: 4.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem;
  background: var(--bg-subtle);
}
.metric span { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 650; }
.metric strong { color: var(--text); font-size: var(--fs-xl); font-weight: 720; line-height: 1; }

/* Queue summary: keep the metric strip on its own full-width row inside the
   panel header so the metrics lay out horizontally instead of stacking. */
.jobs-panel .panel-header { flex-wrap: wrap; align-items: center; }
.jobs-panel .panel-header .metric-strip {
  flex: 1 1 100%;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

/* ---- Breadcrumbs -------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 0.35rem; }
.breadcrumb li + li::before {
  content: "/";
  color: var(--neutral-300);
  font-weight: 600;
}
.breadcrumb a { color: var(--text-muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--brand-600); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 650; }

/* ---- Tabs --------------------------------------------------------------- */
.tabs {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 0.3rem 0;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }

/* The role-gated tenant-usage tab uses the hidden attribute; without this,
   the display rules above would override the UA [hidden] style and the tab
   would render for non-admins. */
.tab[hidden],
.landing-tab[hidden] { display: none !important; }

/* ---- Empty state -------------------------------------------------------- */
.empty-state {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  min-height: 11rem;
  margin: var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-muted);
}
.empty-state h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: var(--fs-md); }

/* ---- App shell (workspace + review) ------------------------------------ */
.foundry-body { min-height: 100vh; background: var(--bg-app); }
.workspace-shell { min-height: 100vh; }
.workspace-main { min-width: 0; }

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
  width: 2rem;
  height: 2rem;
  display: inline-block;
  flex: 0 0 auto;
  object-fit: contain;
}
.brand-name {
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}
/* Two-tone logotype: "True" in text color, "Idiom" in brand green. */
.brand-true { color: var(--text); }
.brand-idiom { color: #3ecc6e; }
/* Superscript trademark — subtle, muted, slightly raised. */
.brand-tm {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: super;
  margin-left: 0.08em;
  letter-spacing: 0;
}

.topbar-actions { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.7rem;
  background: var(--bg-subtle);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-chip::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--success-600);
  flex: 0 0 auto;
}

.app-header {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4) 1.25rem 0;
}
.app-header h1 { font-size: var(--fs-2xl); }

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.command-bar { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.dashboard-shell,
.review-layout { padding: var(--sp-4) 1.25rem 1.5rem; }

/* ---- Landing tabs (workspace) ------------------------------------------ */
.landing-dashboard { display: grid; gap: var(--sp-4); }
.landing-tabs { padding: 0 0.1rem; }
.landing-tab {
  min-height: 2.6rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 0.3rem 0;
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
}
.landing-tab:hover { color: var(--text); }
.landing-tab.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.landing-pane { display: none; }
.landing-pane.active { display: grid; gap: var(--sp-4); animation: pane-in 140ms ease-out; }

@keyframes pane-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Translator request pane ------------------------------------------- */
.translator-shell { overflow: hidden; }
.translator-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "main config" "footer config";
  gap: 0;
}
.translator-main-column {
  grid-area: main;
  display: grid;
  gap: var(--sp-4);
  align-content: start;
  padding: var(--sp-4);
  border-right: 1px solid var(--border);
}
.translator-main-column h5 {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-base);
  font-weight: 500;
}

.translator-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.toolbar-actions { display: inline-flex; align-items: center; gap: var(--sp-2); }

.config-toggle {
  width: 2.5rem; min-width: 2.5rem; min-height: 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-soft);
  padding: 0; position: relative; cursor: pointer;
}
.config-toggle::before {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 1.1rem; height: 1.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23545c72' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.01A1.65 1.65 0 0 0 10 3.09V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.01a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.01a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.config-toggle:hover { background: var(--neutral-100); }
.config-toggle:focus-visible { box-shadow: var(--focus-ring); }

.model-picker { position: relative; width: min(360px, 100%); }
.model-trigger {
  min-height: 2.7rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}
.model-trigger:hover { background: var(--neutral-50); }
.model-trigger:focus-visible { box-shadow: var(--focus-ring); }
.model-trigger-text { display: inline-flex; align-items: baseline; gap: 0.5rem; font-weight: 600; }
.model-chevron {
  width: 0.6rem; height: 0.6rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform var(--transition-fast);
}
.model-picker.open .model-chevron { transform: rotate(-135deg) translateY(-1px); }

.model-menu {
  position: absolute; top: calc(100% + 0.35rem); left: 0; width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 0.6rem;
  box-shadow: var(--shadow-lg);
  z-index: 20;
}
.model-menu-title { margin: 0 0 0.5rem; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }
.model-option {
  width: 100%; min-height: 2.7rem;
  display: grid; grid-template-columns: 1rem 1.1rem minmax(0, 1fr);
  align-items: center; gap: 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.2rem;
  text-align: left;
  cursor: pointer;
}
.model-option:last-child { margin-bottom: 0; }
.model-option:hover { background: var(--neutral-100); }
.model-option.selected { border-color: var(--brand-300); background: var(--brand-50); }
.model-check { width: 0.9rem; height: 0.9rem; position: relative; }
.model-option.selected .model-check::before {
  content: ""; position: absolute; left: 0.14rem; top: 0.15rem;
  width: 0.5rem; height: 0.3rem;
  border-left: 2px solid var(--brand-600);
  border-bottom: 2px solid var(--brand-600);
  transform: rotate(-45deg);
}
.model-provider { width: 1rem; height: 1rem; border-radius: 0.12rem; }
.model-provider.microsoft {
  background:
    linear-gradient(#f35325, #f35325) 0 0 / 46% 46% no-repeat,
    linear-gradient(#81bc06, #81bc06) 100% 0 / 46% 46% no-repeat,
    linear-gradient(#05a6f0, #05a6f0) 0 100% / 46% 46% no-repeat,
    linear-gradient(#ffba08, #ffba08) 100% 100% / 46% 46% no-repeat;
}
.model-provider.openai {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23545c72' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5.2' r='3.6'/%3E%3Ccircle cx='17.5' cy='8.4' r='3.6'/%3E%3Ccircle cx='17.5' cy='15.6' r='3.6'/%3E%3Ccircle cx='12' cy='18.8' r='3.6'/%3E%3Ccircle cx='6.5' cy='15.6' r='3.6'/%3E%3Ccircle cx='6.5' cy='8.4' r='3.6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.model-name { font-weight: 640; }

.translate-cta {
  width: auto; min-width: 128px;
  border-radius: var(--radius-md);
  padding: 0.55rem 1.2rem;
  background: var(--brand-600);
  border: 1px solid var(--brand-600);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(81, 69, 224, 0.24);
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.translate-cta:hover { background: var(--brand-700); transform: translateY(-1px); }
.translate-cta:focus-visible { box-shadow: var(--focus-ring); }
.translate-cta:disabled {
  background: var(--neutral-150); border-color: var(--neutral-150);
  color: var(--text-muted); box-shadow: none; cursor: not-allowed; transform: none;
}

.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
.upload-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: grid; grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.upload-card-head {
  min-height: 3.1rem;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.75rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  background: var(--bg-surface);
}
.upload-card-head h3 { margin: 0; font-size: var(--fs-md); font-weight: 650; text-transform: none; letter-spacing: 0; }
.upload-btn {
  width: auto;
  display: inline-flex; align-items: center;
  min-height: 2rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.7rem;
  background: var(--bg-surface);
  color: var(--text);
  font-size: var(--fs-sm); font-weight: 650;
  cursor: pointer;
}
.upload-btn:hover { background: var(--neutral-100); }
.upload-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.upload-preview {
  min-height: 20rem;
  margin: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: 0.75rem;
  color: var(--text-soft);
  font-size: var(--fs-base);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: auto;
}
.upload-preview.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.upload-meta {
  margin: 0 0.75rem 0.75rem;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.config-column {
  grid-area: config;
  background: var(--bg-subtle);
  padding: var(--sp-4);
  display: grid; align-content: start; gap: var(--sp-4);
  border-left: 1px solid var(--border);
}
.config-column > h3 { margin: 0; font-size: var(--fs-lg); font-weight: 700; text-transform: none; letter-spacing: 0; }
.translator-form.config-hidden { grid-template-columns: 1fr; grid-template-areas: "main" "footer"; }
.translator-form.config-hidden .config-column { display: none; }
.translator-form.config-hidden .translator-main-column { border-right: 0; }
.config-group { border: 0; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.config-group legend { color: var(--text); font-size: var(--fs-base); font-weight: 650; }
.config-group summary { cursor: pointer; color: var(--text); font-size: var(--fs-base); font-weight: 650; }
.config-group[open] summary { margin-bottom: var(--sp-2); }
.translator-footer { grid-area: footer; padding: 0 var(--sp-4) var(--sp-4); }

/* Free-trial token counter chip (translator pane). Rendered server-side only
   when billing is on and tokens remain; `.low` warns near exhaustion. */
.trial-counter {
  display: inline-flex; align-items: baseline; gap: 0.35em;
  margin: 0 0 var(--sp-2); padding: 0.25rem 0.6rem;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: var(--fs-sm); color: var(--text-muted); background: var(--surface-2);
}
.trial-counter strong { color: var(--text); font-variant-numeric: tabular-nums; }
.trial-counter.low { border-color: var(--warn, #b45309); color: var(--warn, #b45309); }
.trial-counter.low strong { color: var(--warn, #b45309); }
/* Subscriber allowance counter: the same chip, reusing `.trial-counter` for
   shape and its `.low` warning rule. Only two things differ — the exhausted
   state carries a sentence rather than a number, so it needs a wrap width,
   and its /billing link inherits the chip colour so a warning chip stays one
   colour instead of turning half brand-blue. */
.allowance-counter { max-width: 62ch; }
.allowance-counter a { color: inherit; text-decoration: underline; }

/* ---- Tenant usage dashboard -------------------------------------------- */
.tenant-admin-panel { display: grid; gap: var(--sp-4); padding-bottom: var(--sp-4); }
.tenant-admin-header { align-items: flex-start; }
.tenant-admin-subtitle { margin: 0.3rem 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.tenant-admin-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) 160px;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  align-items: end;
}
.tenant-admin-metrics { margin: 0 var(--sp-4); }
.tenant-admin-empty { text-align: center; color: var(--text-muted); padding: 0.75rem; }
.tenant-admin-panel .table-wrap { padding: 0 var(--sp-4); }
.tenant-admin-panel .form-error { padding: 0 var(--sp-4); }

@media (max-width: 920px) {
  .tenant-admin-controls { grid-template-columns: 1fr; }
}

/* ---- Review page -------------------------------------------------------- */
.detail-header { gap: var(--sp-3); }
.resource-strip { display: flex; gap: 0.4rem; flex-wrap: wrap; min-width: 0; }
.resource-strip > span {
  min-height: 1.7rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.16rem 0.55rem;
  background: var(--bg-subtle);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}
.resource-strip strong { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }

.playground-tabs {
  display: flex; gap: 1.3rem; overflow-x: auto; min-width: 0;
  border-bottom: 1px solid var(--border);
}
.playground-tabs a,
.playground-tabs button {
  min-height: 2.5rem;
  display: inline-flex; align-items: center;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--fs-sm); font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.playground-tabs a:hover,
.playground-tabs button:hover { color: var(--text); text-decoration: none; }
.playground-tabs a.active,
.playground-tabs button.active,
.playground-tabs button[aria-selected="true"] { border-bottom-color: var(--brand-600); color: var(--brand-700); }
.playground-tabs button:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Tabbed run views: one panel visible at a time (progressive enhancement —
   without JS no [hidden] is set, so every panel stays visible/stacked). */
.tab-panels { display: grid; gap: var(--sp-4); min-width: 0; }
.tab-panels > [role="tabpanel"] { min-width: 0; }
.tab-panels > [role="tabpanel"][hidden] { display: none !important; }
[role="tabpanel"]:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
}
.detail-subsection { padding: 0 var(--sp-4) var(--sp-4); }
.detail-subsection h3 { margin: var(--sp-3) 0 var(--sp-2); font-size: var(--fs-md); }

.playground-grid {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}
.review-sidebar { display: grid; gap: var(--sp-4); }
.parameters-panel { align-self: start; }
.review-main { display: grid; gap: var(--sp-4); min-width: 0; }

/* Merged Review tab: comparison candidates on top, then interrupt (if any),
   then the decision / golden panel below. Stacks cleanly on mobile. */
.review-decision-layout { display: grid; gap: var(--sp-4); min-width: 0; }

/* Parameters (run settings) now lives at the top of the Agent-log panel. */
.detail-panel > .run-summary { margin-bottom: var(--sp-4); }

.compact-heading h2 { font-size: var(--fs-md); }
.run-summary .meta-list {
  display: grid; gap: var(--sp-3); margin: 0; padding: var(--sp-4);
}
.meta-list div { display: grid; gap: 0.1rem; min-width: 0; }
.meta-list dt { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.meta-list dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.gate-card {
  display: grid; gap: 0.1rem;
  margin: 0 var(--sp-4) var(--sp-4);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  background: var(--brand-50);
}
.gate-card span, .gate-card small { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 650; }
.gate-card strong { color: var(--brand-700); font-size: var(--fs-md); }

.review-form { padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.review-form label { display: grid; gap: var(--sp-2); color: var(--text-soft); font-size: var(--fs-sm); font-weight: 600; }
#editor-status { margin: 0; }

.decision-hint {
  display: grid;
  gap: 0.3rem;
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.8rem;
  background: var(--info-bg);
  color: var(--info-600);
  font-size: var(--fs-sm);
}
.decision-hint strong { color: var(--info-600); }

.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.actions.stacked { display: grid; }
.decision-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.decision-actions .btn { width: 100%; }
.decision-actions .btn-primary { grid-column: 1 / -1; }

.interrupt { border-color: var(--warning-border); }
.interrupt > p, .interrupt > .lead-copy { margin: 0.85rem var(--sp-4); }
.interrupt .triggers { margin: 0.65rem var(--sp-4) var(--sp-4); }

.final { border-color: var(--success-border); background: var(--success-bg); }
.final .actions { padding: 0 var(--sp-4); margin-top: var(--sp-4); }
.final > pre { margin: var(--sp-4); }
.final > .muted-copy { margin: 0 var(--sp-4) var(--sp-4); }

.comparison-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); padding: var(--sp-4); }
.text-pane, .quality-block {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  background: var(--bg-subtle);
}
.text-pane h3 { color: var(--text-muted); }
.text-pane.candidate {
  border-color: var(--brand-300);
  background: var(--brand-50);
  box-shadow: 0 0 0 1px var(--brand-100);
}
.text-pane.candidate h3 { color: var(--brand-700); }

pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font: inherit; }

.quality-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); padding: var(--sp-4); }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: var(--sp-2); }
.quality-block h3 { color: var(--text-muted); }

ul.issues, ul.checks, ul.triggers, ul.signals {
  list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.45rem;
}
ul.signals { padding: var(--sp-4); margin: 0; }
ul.issues li, ul.checks li, ul.triggers li, ul.signals li {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  background: var(--bg-surface);
  font-size: var(--fs-sm);
}
ul.issues li.sev-critical, ul.triggers li.trigger-blocking { border-left-color: var(--danger-600); background: var(--danger-bg); }
ul.issues li.sev-major, ul.triggers li.trigger-warning { border-left-color: var(--warning-600); background: var(--warning-bg); }
ul.issues li.sev-minor, ul.triggers li.trigger-info { border-left-color: var(--border-strong); }
ul.checks li.check-pass, ul.signals li { border-left-color: var(--success-600); background: var(--success-bg); }
ul.checks li.check-fail { border-left-color: var(--danger-600); background: var(--danger-bg); }

.assessment-content { display: flex; flex-direction: column; gap: 0.75rem; }
.assessment-summary {
  font-size: var(--fs-base); line-height: 1.6; color: var(--text);
  padding: 0.65rem 0.75rem; border-left: 3px solid var(--brand-500);
  background: var(--brand-50); border-radius: var(--radius-sm);
}
.assessment-issues { display: flex; flex-direction: column; gap: 0.65rem; }
.assessment-issue {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem; background: var(--bg-surface);
  display: flex; flex-direction: column; gap: 0.45rem;
}
.issue-phrase, .issue-explanation, .issue-suggestion, .issue-alternative { font-size: var(--fs-base); line-height: 1.5; color: var(--text); }
.issue-phrase { font-weight: 500; border-bottom: 1px solid var(--border); padding-bottom: 0.45rem; }
.issue-explanation { color: var(--text-soft); font-style: italic; }
.issue-suggestion { color: var(--success-600); font-weight: 500; padding: 0.45rem; background: var(--success-bg); border-radius: var(--radius-sm); border-left: 2px solid var(--success-600); }
.issue-alternative { color: var(--text-muted); font-size: var(--fs-sm); padding-left: 0.65rem; border-left: 2px solid var(--border-strong); }
.assessment-overall {
  font-size: var(--fs-base); line-height: 1.6; color: var(--text-soft);
  padding: 0.65rem 0.75rem; margin-top: 0.75rem;
  border-top: 2px solid var(--border); background: var(--bg-subtle);
  border-radius: var(--radius-sm); font-style: italic;
}

ul.triggers li div { display: flex; gap: 0.5rem; align-items: baseline; justify-content: space-between; }
ul.triggers li span, ul.signals li span { color: var(--text-muted); }
ul.triggers li p, ul.signals li p { margin: 0.25rem 0 0; }

.detail-panel { padding: 0; overflow: hidden; }
details > summary { min-height: 3.1rem; display: flex; align-items: center; padding: 0 var(--sp-4); cursor: pointer; font-weight: 650; }
details[open] > summary { border-bottom: 1px solid var(--border); }
.timeline { margin: 0; padding: var(--sp-4) var(--sp-4) var(--sp-4) 2.1rem; }
.timeline > li { margin: 0.55rem 0; padding-left: 0.25rem; }
.timeline > li > div { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.timeline span { color: var(--text-muted); }
.timeline p { margin: 0.25rem 0; }
.timeline ul { margin: 0.25rem 0; padding-left: 1.2rem; color: var(--text-muted); }

/* =========================================================================
   Landing page (public marketing)
   ========================================================================= */
.marketing-body { background: var(--bg-surface); }

.site-header {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  min-height: 4rem;
}
.site-nav { display: inline-flex; align-items: center; gap: var(--sp-4); }
.site-nav a.nav-link { color: var(--text-soft); font-weight: 600; font-size: var(--fs-sm); }
.site-nav a.nav-link:hover { color: var(--text); text-decoration: none; }

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 6vw, 5rem);
  background:
    radial-gradient(1100px 480px at 80% -10%, var(--brand-50), transparent 60%),
    radial-gradient(760px 420px at 0% 10%, #f2f0ff, transparent 55%);
}
.hero .container { display: grid; gap: var(--sp-5); }
.hero-inner { max-width: 44rem; display: grid; gap: var(--sp-4); }
.hero-pill {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.85rem;
  background: var(--bg-surface);
  color: var(--brand-700);
  font-size: var(--fs-sm); font-weight: 650;
}
.hero-pill::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--brand-500); }
.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, var(--fs-4xl));
  line-height: 1.06;
  letter-spacing: -0.03em;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--brand-500), var(--brand-700));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: clamp(1rem, 2.3vw, var(--fs-lg)); color: var(--text-soft); max-width: 38rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }
.hero-trust { display: flex; flex-wrap: wrap; gap: var(--sp-4); color: var(--text-muted); font-size: var(--fs-sm); }
.hero-trust span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero-trust span::before { content: "✓"; color: var(--success-600); font-weight: 800; }

.section { padding: clamp(3rem, 6vw, 4.5rem) 0; }
.section-head { max-width: 40rem; margin-bottom: var(--sp-5); display: grid; gap: var(--sp-2); }
.section-head h2 { font-size: clamp(1.5rem, 3.5vw, var(--fs-2xl)); letter-spacing: -0.02em; }
.section-head p { color: var(--text-soft); margin: 0; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); }
.feature-card {
  display: grid; gap: var(--sp-2); align-content: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  background: var(--bg-subtle);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-200); }
.feature-icon {
  width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 1.3rem;
}
.feature-card h3 { color: var(--text); font-size: var(--fs-md); text-transform: none; letter-spacing: 0; margin: 0; }
.feature-card p { color: var(--text-soft); margin: 0; font-size: var(--fs-sm); }

/* Pricing section (landing #pricing) — PayGo card + enterprise teaser. */
.pricing-grid {
  display: grid;
  /* Four tiers (three self-serve + enterprise). auto-fit rather than a fixed
     track count so a tier can be added or removed without touching CSS. */
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 720px) {
  .pricing-grid { grid-template-columns: 1fr; }
}
.pricing-card {
  display: grid; gap: var(--sp-3); align-content: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  background: var(--bg-subtle);
}
.pricing-featured {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
  background: var(--bg-surface);
}
.pricing-card h3.pricing-pill {
  justify-self: start;
  margin: 0;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: var(--fs-xs, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* Same dark-mode brand-text lift as .eyebrow/.hero-pill (see the block near the
   top of this file); declared here at matching specificity so it wins. */
@media (prefers-color-scheme: dark) {
  .pricing-card h3.pricing-pill { color: var(--brand-300); }
}
.price-rates { display: flex; flex-wrap: wrap; gap: var(--sp-5); }
.price-rate { display: grid; gap: 0.15rem; }
.price-amount {
  font-size: clamp(1.8rem, 4vw, var(--fs-2xl));
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}
.price-unit { color: var(--text-muted); font-size: var(--fs-sm); }
.pricing-points {
  margin: 0; padding-left: 1.15rem;
  color: var(--text-soft); font-size: var(--fs-sm); line-height: 1.55;
  display: grid; gap: var(--sp-2);
}
/* Element+class beats the base `p` rule below — keeps footnote/example
   distinct (the plain `.pricing-footnote` form loses on specificity). */
.pricing-card p { color: var(--text-soft); margin: 0; font-size: var(--fs-sm); }
.pricing-card p.pricing-example { font-size: var(--fs-md, 1rem); }
.pricing-card p.pricing-footnote { color: var(--text-muted); font-size: var(--fs-xs, 0.78rem); }
.pricing-card .btn { justify-self: start; }
.pricing-card h3 { color: var(--text); font-size: var(--fs-md); margin: 0; }
/* Section-level line under the grid: what every plan includes. Sits between
   the cards and the tax footnote, so it reads a step above the fine print. */
.pricing-note {
  margin: var(--sp-5) auto 0; max-width: 62ch; text-align: center;
  color: var(--text-soft); font-size: var(--fs-sm);
}

.flow-band { background: var(--bg-app); border-block: 1px solid var(--border); }
.flow-figure {
  margin: 0 auto var(--sp-5);
  max-width: 64rem;
  display: grid;
  gap: var(--sp-3);
  justify-items: center;
  text-align: center;
}
.flow-diagram {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1152 / 768;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  background: var(--bg-surface);
}
.flow-figure figcaption {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  max-width: 40rem;
}
.flow-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4);
  counter-reset: step;
}
.flow-step { display: grid; gap: 0.4rem; align-content: start; }
.flow-step .step-num {
  width: 2.1rem; height: 2.1rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-600); color: #fff;
  font-weight: 700;
}
.flow-step h3 { color: var(--text); font-size: var(--fs-base); text-transform: none; letter-spacing: 0; margin: 0; }
.flow-step p { color: var(--text-muted); margin: 0; font-size: var(--fs-sm); }

.cta-band { padding: clamp(3rem, 6vw, 4.5rem) 0; }
.cta-card {
  display: grid; gap: var(--sp-4); justify-items: center; text-align: center;
  border-radius: var(--radius-xl);
  padding: clamp(2.5rem, 6vw, 4rem) var(--sp-5);
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.cta-card h2 { color: #fff; font-size: clamp(1.5rem, 3.5vw, var(--fs-2xl)); letter-spacing: -0.02em; }
.cta-card p { color: rgba(255, 255, 255, 0.85); margin: 0; max-width: 34rem; }
.cta-card .btn-primary {
  --_bg: #fff; --_fg: var(--brand-700); --_bd: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}
.cta-card .btn-primary:hover { --_bg: var(--brand-50); color: var(--brand-800); }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.site-footer .container {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  flex-wrap: wrap;
  padding-block: var(--sp-5);
}
.footer-links {
  display: flex; align-items: center; gap: var(--sp-4);
  flex-wrap: wrap;
}
.footer-lang-wrap {
  display: flex; align-items: center; gap: var(--sp-2);
  flex: 0 0 auto;
}
.footer-lang-icon {
  width: 16px; height: 16px;
  flex: 0 0 auto;
}
.footer-lang {
  font: inherit;
  color: var(--text-muted);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: var(--sp-1) var(--sp-2);
  width: auto;           /* the theme's form select is 100%-wide; this one is inline chrome */
  flex: 0 0 auto;
}

/* Narrow single-column site pages (About/Contact/Privacy/Terms/Resources). */
.static-page .container {
  max-width: 720px;
  padding-block: var(--sp-7, 4rem);
}
.static-page h1 { margin-bottom: var(--sp-4); }
.static-page p { color: var(--text-muted); line-height: 1.6; margin-bottom: var(--sp-3); }

/* Legal pages (Privacy / Terms) — longer structured documents. */
.legal-page .container { max-width: 780px; }
.legal-meta {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  margin-top: calc(var(--sp-3) * -1);
  margin-bottom: var(--sp-5);
}
.legal-lead {
  color: var(--text-soft);
  font-size: var(--fs-md, 1.05rem);
  line-height: 1.65;
}
.legal-page section { margin-top: var(--sp-6, 3rem); }
.legal-page h2 {
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-3);
  scroll-margin-top: var(--sp-5);
}
.legal-page h3 {
  font-size: var(--fs-md, 1.05rem);
  color: var(--text-strong, var(--text));
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-2);
}
.legal-page ul,
.legal-page ol {
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 var(--sp-3);
  padding-left: 1.25rem;
}
.legal-page ul li,
.legal-page ol li { margin-bottom: var(--sp-2); }
.legal-page a { color: var(--brand-700); text-decoration: underline; text-underline-offset: 2px; }
.legal-page a:hover { color: var(--brand-800); }

/* In-page table of contents. */
.legal-toc {
  margin: var(--sp-5) 0;
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-subtle, var(--bg-app));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
}
.legal-toc-title { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); margin: 0 0 var(--sp-3); }
.legal-toc ol { margin: 0; padding-left: 1.25rem; color: var(--text-muted); line-height: 1.7; }
.legal-toc a { color: var(--text-muted); text-decoration: none; }
.legal-toc a:hover { color: var(--brand-700); text-decoration: underline; }

/* Subprocessor / data-sharing table. */
.legal-table-wrap { overflow-x: auto; margin: var(--sp-3) 0 var(--sp-4); }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.legal-table th, .legal-table td {
  text-align: left;
  vertical-align: top;
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.legal-table thead th {
  color: var(--text-soft);
  font-weight: 650;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

/* Resources (guides + FAQ) — reuse the legal-page column; these rules add
   the pieces legal pages never needed: command blocks and card links. */
.doc-code {
  margin: var(--sp-3) 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-subtle, var(--bg-app));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  overflow-x: auto;
}
.doc-code code {
  display: block;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.55;
}
.resource-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); margin-top: var(--sp-5); }
.legal-page a.resource-card { text-decoration: none; }  /* beat `.legal-page a` underline */
.resource-card {
  display: block;
  padding: var(--sp-5);
  background: var(--bg-card, var(--bg-app));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;
}
.resource-card:hover { border-color: var(--brand-500, var(--brand-700)); transform: translateY(-2px); }
.resource-card h2 { font-size: var(--fs-md, 1.05rem); color: var(--text); margin: 0 0 var(--sp-2); }
.resource-card p { color: var(--text-soft); font-size: var(--fs-sm); margin: 0; line-height: 1.55; }
.resource-card .resource-cue { display: inline-block; margin-top: var(--sp-3); color: var(--brand-700); font-size: var(--fs-sm); font-weight: 600; }

/* =========================================================================
   Sign-in page
   ========================================================================= */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5) var(--sp-4);
  background:
    radial-gradient(900px 500px at 50% -10%, var(--brand-50), transparent 60%),
    var(--bg-app);
}
.auth-shell { width: min(30rem, 100%); display: grid; gap: var(--sp-4); }
.auth-brand { justify-self: center; margin-bottom: var(--sp-1); }
.auth-card { display: grid; gap: var(--sp-4); padding: var(--sp-5); }
.auth-card h1 { font-size: var(--fs-xl); }
.auth-intro { color: var(--text-soft); margin: 0; }

.auth-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.25rem; background: var(--bg-subtle);
}
/* `display: grid` above is an author rule, so it beats the UA's
   [hidden] { display: none }. Password-reset mode hides the tab strip. */
.auth-switch[hidden] { display: none; }
.auth-switch button {
  min-height: 2.3rem;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  font: inherit; font-weight: 650; cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.auth-switch button.active { background: var(--bg-surface); color: var(--brand-700); box-shadow: var(--shadow-xs); }

.auth-form { display: grid; gap: var(--sp-3); }
.auth-form.hidden { display: none; }
.auth-form label { display: grid; gap: var(--sp-2); color: var(--text-soft); font-size: var(--fs-sm); font-weight: 600; }
/* `display: grid` above is an author rule and beats the UA's
   [hidden] { display: none } — an invite drops the tenant-name field. */
.auth-form label[hidden] { display: none; }

.auth-step {
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-md);
  background: var(--brand-50);
  padding: var(--sp-4);
  display: grid; gap: var(--sp-3);
}
.auth-step[hidden] { display: none; }
.auth-step h2 { color: var(--brand-700); }
/* Invite banner, dud-link variant. A welcome and a "that link is dead" must
   not look alike, so the brand tint gives way to the warning one. */
.auth-step.auth-step-warn {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-600);
}
#invite-banner p { margin: 0; font-weight: 600; }

/* ---- MFA enrolment + recovery codes ------------------------------------- */
/* The otpauth:// URI is long and unbreakable; without this it pushes the
   auth card wider than the viewport. */
.code-block {
  margin: 0;
  padding: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-block:empty { display: none; }

/* Recovery codes are transcribed by hand, so they get a monospace face and
   room to breathe — this is the one and only time they are ever shown. */
.recovery-code-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.recovery-code-list li {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-align: center;
}

/* Security pane button rows (/app). */
.security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-3) 0 0;
}
.security-actions[hidden] { display: none; }
#security-enroll label,
#security-recovery p,
#security-enroll p { margin: var(--sp-2) 0; }

/* Show-once links (invite links, password-reset links). Both are minted by
   an admin, handed over out of band, and never retrievable again — the
   warning tint is the affordance that says "copy this now". */
.link-once {
  display: grid;
  gap: var(--sp-2);
  margin: var(--sp-3) var(--sp-4) 0;
  padding: var(--sp-3);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
}
.link-once[hidden] { display: none; }
.link-once-warn { margin: 0; color: var(--warning-600); font-size: var(--fs-sm); font-weight: 700; }
.link-once-note { margin: 0; color: var(--text-soft); font-size: var(--fs-sm); }
.link-once input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-sm);
}
.link-once .security-actions { margin: 0; }

/* The invites panel is a bare .panel (not .tenant-admin-panel), so its own
   full-bleed children need the same gutter the form grid already carries. */
#security-invites > .tenant-admin-subtitle,
#security-invites > .form-error { padding: 0 var(--sp-4); }
.auth-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600;
}
.auth-footnote { color: var(--text-muted); font-size: var(--fs-xs); text-align: center; margin: 0; }
.auth-footnote a { font-weight: 600; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 1200px) {
  .playground-grid { grid-template-columns: 1fr; }
  .parameters-panel { position: static; }
  .translator-form { grid-template-columns: 1fr; grid-template-areas: "main" "config" "footer"; }
  .translator-main-column { border-right: 0; }
  .config-column { border-left: 0; border-top: 1px solid var(--border); }
  .upload-grid, .comparison-grid, .quality-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-header, .dashboard-shell, .review-layout { padding: var(--sp-4) 1rem; }
  .app-topbar { padding: 0.7rem 1rem; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .decision-actions { grid-template-columns: 1fr; }
  .upload-preview { min-height: 12rem; }
  .session-chip { max-width: 45vw; }
  .site-nav .nav-link { display: none; }
}

/* Workspace-wide notice banners (demo mode, billing attention). */
.workspace-banner {
  margin: 0.9rem 1.4rem 0;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.workspace-banner.banner-warn {
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-600);
}
.workspace-banner a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ---- Tenant usage chart --------------------------------------------------- */
.usage-chart-wrap {
  position: relative;
  margin: 0 1rem 1rem;
  padding: 0.75rem 0.75rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  overflow-x: auto;
}
.usage-chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
  margin: 0 0 0.5rem;
}
.usage-chart-wrap svg {
  display: block;
  width: 100%;
  min-height: 200px;
}
.usage-chart-wrap .chart-bar { fill: var(--brand-500); }
.usage-chart-wrap .chart-hover { fill: transparent; }
.usage-chart-wrap .chart-hover:hover { fill: color-mix(in srgb, var(--brand-500) 10%, transparent); }
.usage-chart-wrap .chart-grid { stroke: var(--border); stroke-width: 1; }
.usage-chart-wrap .chart-axis { stroke: var(--border-strong, var(--border)); stroke-width: 1; }
.usage-chart-wrap .chart-tick { fill: var(--text-muted); font-size: 10px; }
.usage-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius-sm, 6px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.15));
  color: var(--text);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
  z-index: 5;
}

/* ---- Typed-or-uploaded inputs (translator) --------------------------------- */
textarea.upload-input {
  display: block;
  width: calc(100% - 1.5rem);
  font: inherit;
  resize: vertical;
}
textarea.upload-input.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
textarea.upload-input:read-only {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: default;
}
.model-trigger.model-static { cursor: default; }

/* ---- Workspace left rail + tenant switcher (/app) ------------------------ */
/* The workspace shell becomes a rail + main-column flex row. Other pages
   (landing, review, signin) keep the plain .workspace-shell block layout. */
.rail-shell { display: flex; min-height: 100vh; }
.rail-shell .workspace-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.side-rail {
  width: 236px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.6rem;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--transition);
  /* Pin to the viewport so the rail (and its collapse control) stays put
     while the main column scrolls. */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.5rem 0.75rem;
  white-space: nowrap;
  text-decoration: none;
}
.side-rail .rail-group-label {
  margin: 0;
  padding: 0.8rem 0.6rem 0.3rem;
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.rail-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.rail-item:hover { background: var(--bg-muted); color: var(--text); }
.rail-item.active { background: var(--brand-50); color: var(--brand-700); }
.rail-item[hidden] { display: none !important; }
.rail-item svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rail-count {
  margin-left: auto;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning-600);
  font-size: var(--fs-xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.rail-spacer { flex: 1; }
.rail-collapse {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
}
.rail-collapse:hover { background: var(--bg-muted); color: var(--text); }
.rail-collapse svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--transition);
}

/* Collapsed state: icon-only rail. .rail-label spans hide, counts hide. */
.rail-collapsed .side-rail { width: 58px; padding-left: 0.45rem; padding-right: 0.45rem; }
.rail-collapsed .side-rail .rail-label,
.rail-collapsed .side-rail .rail-count { display: none; }
.rail-collapsed .side-rail .rail-group-label { padding: 0.4rem 0; }
.rail-collapsed .rail-collapse svg { transform: rotate(180deg); }

/* Topbar variant used with the rail: breadcrumb left, session chrome right. */
.rail-topbar { justify-content: flex-start; }
.rail-topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.rail-breadcrumb { flex-wrap: nowrap; }

/* Tenant switcher (breadcrumb) */
.tenant-wrap { position: relative; }
.tenant-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.tenant-btn:hover { border-color: var(--border-strong); background: var(--bg-muted); }
.tenant-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tenant-btn .tenant-caret { width: 11px; height: 11px; }
.tenant-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 280px;
  padding: 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.tenant-menu[hidden] { display: none; }
.tenant-menu-label {
  margin: 0;
  padding: 0.4rem 0.6rem 0.2rem;
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tenant-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tenant-option:hover { background: var(--bg-muted); }
.tenant-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: var(--text-onbrand);
  font-size: 0.68rem;
  font-weight: 700;
}
.tenant-option-meta { min-width: 0; display: grid; }
.tenant-option-meta strong { font-size: var(--fs-sm); }
.tenant-option-meta span { font-size: var(--fs-xs); color: var(--text-muted); }
.tenant-check { margin-left: auto; color: var(--brand-500); font-weight: 700; visibility: hidden; }
.tenant-option[aria-selected="true"] .tenant-check { visibility: visible; }
.tenant-note {
  margin: 0.3rem 0 0;
  padding: 0.5rem 0.6rem 0.25rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.45;
}

/* Document job status pills (pending/queued/extracted reuse the info hue;
   translated/failed already have rules above). */
.status-pending,
.status-queued,
.status-extracted {
  border-color: var(--info-border); background: var(--info-bg); color: var(--info-600);
}

/* =========================================================================
   Document review drawer (app-documents-review.js)
   Right-hand overlay panel for correcting + approving one document job. All
   colors come from the theme tokens so light/dark both hold.
   ========================================================================= */
.doc-review-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  /* Neutral scrim — intentionally dark in both themes. */
  background: rgba(14, 16, 22, 0.5);
}
.doc-review-overlay[hidden] { display: none; }
body.doc-review-open { overflow: hidden; }

.doc-review-drawer {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: 100%;
  border-radius: 0;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.doc-review-header { flex: 0 0 auto; align-items: flex-start; }
.doc-review-meta,
.doc-review-approval {
  margin: 0.2rem 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.doc-review-approval { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.doc-review-body { flex: 1 1 auto; overflow-y: auto; display: grid; gap: var(--sp-4); align-content: start; }
.doc-review-body > .form-error:empty { display: none; }

.doc-review-notice {
  font-size: var(--fs-sm);
  color: var(--text-soft);
}
.doc-review-notice:empty { display: none; }
.doc-review-notice:not(:empty) {
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  background: var(--info-bg);
  padding: var(--sp-3);
}
.doc-review-notice-list { margin: 0.4rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; }

.doc-review-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.doc-review-metrics > div { display: grid; gap: 0.1rem; }
.doc-review-metrics span { font-size: var(--fs-xs); color: var(--text-muted); }
.doc-review-metrics strong { font-size: var(--fs-md); }
.doc-review-findings {
  margin: var(--sp-3) 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.3rem;
  font-size: var(--fs-sm);
  color: var(--text-soft);
}
.doc-review-findings code { margin-right: 0.4rem; font-size: var(--fs-xs); }
.doc-review-findings em { display: block; color: var(--text-muted); font-size: var(--fs-xs); }

.doc-review-controls { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.doc-review-controls label { flex: 1 1 220px; display: grid; gap: 0.25rem; font-size: var(--fs-sm); }
.doc-review-hint { font-size: var(--fs-xs); color: var(--text-muted); }
/* Effective reviewer echoed back by the server — the authoritative audit name. */
.doc-review-identity { margin: 0; font-size: var(--fs-sm); color: var(--text-soft); }
.doc-review-identity:empty { display: none; }

/* Segment pager: flagged filter, position readout, prev/next. */
.doc-review-segments-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: var(--fs-sm);
}
.doc-review-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  cursor: pointer;
}
.doc-review-toggle input { width: auto; margin: 0; cursor: pointer; }
.doc-review-position { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted); }

.doc-review-segments { display: grid; gap: var(--sp-3); }
.doc-segment {
  display: grid;
  gap: 0.4rem;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}
.doc-segment-flagged { border-left-color: var(--warning-600); background: var(--warning-bg); }
.doc-segment-edited { border-left-color: var(--brand-500); }
.doc-segment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.doc-segment-page { font-size: var(--fs-xs); font-weight: 650; color: var(--text-muted); }
.doc-segment-source,
.doc-segment-current { margin: 0; font-size: var(--fs-sm); white-space: pre-wrap; }
.doc-segment-source { color: var(--text); }
.doc-segment-current { color: var(--text-muted); }
.doc-segment-edit { display: grid; gap: 0.2rem; }
.doc-segment-edit > span { font-size: var(--fs-xs); color: var(--text-muted); }
/* Override the 10rem global textarea floor — a segment editor is 2-3 lines. */
.doc-segment-edit textarea {
  width: 100%;
  min-height: 3.4rem;
  resize: vertical;
  font: inherit;
  font-size: var(--fs-sm);
}

.doc-flag-warn { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-600); }
.doc-flag-info { border-color: var(--info-border); background: var(--info-bg); color: var(--info-600); }
.doc-flag-ok { border-color: var(--success-border); background: var(--success-bg); color: var(--success-600); }
.doc-flag-muted { border-color: var(--border); background: var(--bg-muted); color: var(--text-muted); }

.doc-review-footer {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  border-top: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
}
.doc-review-footer .panel-tag { margin-right: auto; }

@media (max-width: 900px) {
  /* Narrow screens: rail drops to icon-only regardless of the toggle. */
  .side-rail { width: 58px; padding-left: 0.45rem; padding-right: 0.45rem; }
  .side-rail .rail-label,
  .side-rail .rail-count { display: none; }
  .side-rail .rail-group-label { padding: 0.4rem 0; }
  .rail-breadcrumb { flex-wrap: wrap; }
}


/* Realized margin & repair-rate panel (workspace → Usage & billing).
   Repair rate is a margin input since billing moved to source characters. */
.margin-panel {
  display: grid; gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}
.margin-panel h3 { margin: 0; }
.margin-note { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); max-width: 78ch; }
.margin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
}
.margin-stat { display: grid; gap: 0.15rem; }
.margin-stat-value { font-size: var(--fs-xl, 1.5rem); font-weight: 600; }
.margin-stat-label { color: var(--text-muted); font-size: var(--fs-sm); }
/* Warnings carry the actionable content — a crossed threshold, a thin pair, a
   sample too small to trust. Styled to be read, not skimmed past. */
.margin-warnings { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; }
.margin-warnings:empty { display: none; }
.margin-warnings li {
  color: var(--warning-600);
  font-size: var(--fs-sm);
}
/* Below the confidence sample size: shown, but visibly not actionable. */
.margin-row-unconfident { opacity: 0.55; }

/* Paste-time billing disclosure under the source textarea. Amber only when a
   dense-script multiplier applies — a neutral character count should not read
   as a warning. */
.billing-preview { margin-top: 0.25rem; }
.billing-preview:not(:empty) { color: var(--text-muted); }

/* =========================================================================
   Destructive-action confirmation modal (app-confirm.js)
   Centered consequence-naming dialog shared by every hard delete. All colors
   come from theme tokens so light/dark both hold.
   ========================================================================= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 95; /* above the document-review drawer (90) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  /* Neutral scrim — intentionally dark in both themes, like the drawer's. */
  background: rgba(14, 16, 22, 0.5);
}
.confirm-overlay[hidden] { display: none; }
body.confirm-open { overflow: hidden; }

.confirm-dialog {
  width: min(460px, 100%);
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
}
.confirm-dialog h2 { margin: 0; font-size: var(--fs-lg); letter-spacing: -0.01em; }
.confirm-body { color: var(--text-soft); }
.confirm-body p { margin: 0; }
.confirm-body ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.confirm-dialog .form-error:empty { display: none; }
.confirm-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-2); }

/* =========================================================================
   Public REST API reference (/resources/api/*)
   Everything here is scoped to .docs-nav / .docs-page, so no existing page
   changes. These pages are far denser than the guides: a guard matrix wider
   than any reading column we have, and many multi-line curl blocks. Both
   scroll inside their own box — the page itself never scrolls sideways.
   ========================================================================= */

/* Section subnav, repeated at the top of every reference page (_docs_nav.html). */
.docs-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.docs-nav-label {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* Two classes deep on purpose: these pages may also carry .legal-page, whose
   `a` rule would otherwise underline the subnav (same trick as
   `.legal-page a.resource-card`). */
.docs-nav .docs-nav-link {
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.docs-nav .docs-nav-link:hover {
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
}
.docs-nav .docs-nav-link[aria-current="page"] {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
}

/* Reference-page content. A slightly wider column than the guides (780px) —
   the code blocks and tables here are wider than the prose. */
.docs-page .container { max-width: 880px; }

/* Anchor offset: .site-header is sticky and 4rem tall, so a deep link would
   otherwise land its heading underneath it. */
.docs-page h2,
.docs-page h3,
.docs-page h4 { scroll-margin-top: calc(4rem + var(--sp-4)); }
.docs-page h2 {
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}
.docs-page h3 {
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-2);
  color: var(--text);
  font-size: var(--fs-md);
}
.docs-page h4 {
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-2);
  color: var(--text-soft);
  font-size: var(--fs-base);
  font-weight: 700;
}
.docs-page ul,
.docs-page ol {
  margin: 0 0 var(--sp-3);
  padding-left: 1.25rem;
  line-height: 1.6;
}

/* Command blocks. `white-space: pre` beats the global `pre` rule's pre-wrap:
   a wrapped curl continuation is unreadable, so long lines scroll instead. */
.docs-page pre {
  margin: var(--sp-3) 0 var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.docs-page pre code {
  display: block;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  overflow-wrap: normal;  /* the global `code` rule breaks anywhere; not in here */
}
/* Inline code only — `> code` keeps the chip off the block above. */
.docs-page :not(pre) > code {
  padding: 0.12em 0.35em;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

/* The guard matrix is wider than any column we have: size the table to its
   content and scroll it inside its own box. `min-width: 0` undoes the global
   720px table floor, which would otherwise push past the container. */
.docs-page table {
  display: block;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  margin: var(--sp-3) 0 var(--sp-5);
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.docs-page th,
.docs-page td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.docs-page thead th {
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border-strong);
  color: var(--text-soft);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.docs-page tbody tr:nth-child(even) td { background: var(--bg-subtle); }
/* Same specificity as the zebra rule above, so hover still wins on even rows. */
.docs-page tbody tr:hover td { background: var(--brand-50); }

.docs-page hr {
  height: 1px;
  margin: var(--sp-6) 0;
  border: 0;
  background: var(--border);
}

.docs-page blockquote {
  margin: var(--sp-4) 0;
  padding: var(--sp-1) 0 var(--sp-1) var(--sp-4);
  border-left: 3px solid var(--brand-200);
  color: var(--text-soft);
}
.docs-page blockquote p:last-child { margin-bottom: 0; }

/* Dark-mode: same brand-text lift the landing page gets near the top of this
   file. --brand-700 is a light-theme link color and goes muddy on a dark
   surface; these pages are long and link-dense enough to be worth the rule.
   Scoped to the reference section only. */
@media (prefers-color-scheme: dark) {
  .docs-page .container a { color: var(--brand-300); }
  .docs-page .container a:hover { color: var(--brand-200); }
  /* The subnav usually sits inside .container too — match the rule above's
     specificity (two classes + an element) so these still win. */
  .docs-nav a.docs-nav-link { color: var(--text-muted); }
  .docs-nav a.docs-nav-link:hover { color: var(--text); }
  .docs-nav a.docs-nav-link[aria-current="page"] { color: var(--brand-200); }
}
