/* AISupport design system ("datasheet" style).
 *
 * Tokens live on :root. Bootstrap 5.3 is kept for the grid, forms (crispy),
 * collapse and alerts; its CSS variables are re-pointed at our tokens so the
 * components pick up the palette and type without per-component overrides.
 *
 * The web-chat widget (web_chat/templates, web_chat static) has its own
 * styles and is intentionally NOT affected by this file.
 */

:root {
  --ink: #1c1f24;
  --muted: #5f6670;
  --bg: #f5f6f7;
  --paper: #ffffff;
  --line: #d5d9de;
  --line-strong: #b9bfc7;
  --accent: #0e6b66;
  --accent-soft: #dfeeec;
  --ok: #2c7a4b;
  --warn: #a1601a;
  --danger: #a12d2d;
  --danger-soft: #f6e3e3;

  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --maxw: 1180px;
  --radius: 4px;

  /* Bootstrap re-pointing */
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: 1.0625rem;
  --bs-body-line-height: 1.6;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-heading-color: var(--ink);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 14, 107, 102;
  --bs-link-hover-color: var(--accent);
  --bs-link-hover-color-rgb: 14, 107, 102;
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius);
  --bs-primary: var(--ink);
  --bs-primary-rgb: 28, 31, 36;
  --bs-secondary-color: var(--muted);
  --bs-secondary-rgb: 95, 102, 112;
  --bs-danger: var(--danger);
  --bs-danger-rgb: 161, 45, 45;
  --bs-success: var(--ok);
  --bs-success-rgb: 44, 122, 75;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3, h4, .h1, .h2, .h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
h1, .h1 { font-size: clamp(28px, 3.4vw, 38px); line-height: 1.15; margin: 0 0 0.5rem; }
h2, .h2 { font-size: 26px; line-height: 1.2; margin: 0 0 1rem; }
h3, .h3 { font-size: 19px; line-height: 1.3; margin: 0 0 0.5rem; }
h4 { font-size: 17px; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
code { font-size: 0.9em; color: var(--ink); background: var(--accent-soft); padding: 1px 5px; border-radius: 3px; }

.text-muted, .muted { color: var(--muted) !important; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Header ------------------------------------------------------------------ */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
}
.site-header .brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 21px;
  color: var(--ink);
  margin-right: 20px;
  white-space: nowrap;
}
.site-header .brand { display: inline-flex; align-items: center; gap: 9px; }
.site-header .brand:hover { text-decoration: none; }
.site-header .brand-icon { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted);
  font-size: 15px;
  padding: 6px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; background: var(--bg); }
.site-nav a.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.site-header .spacer { flex: 1; }
.site-actions { display: flex; align-items: center; gap: 8px; }
.site-actions .btn { height: 34px; padding: 0 14px; font-size: 14px; }

.lang-switch { display: flex; gap: 2px; margin-right: 6px; }
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  width: 38px;
  height: 34px;
  padding: 0;
  cursor: pointer;
}
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--ink); margin: 3px auto; }

@media (max-width: 860px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .site-header .brand { margin-right: auto; }
  .site-header .spacer { display: none; }
  .lang-switch { order: 1; }
  /* The action buttons become direct flex items: the primary one stays in the
     header row, the ghost ones drop into the collapsible menu below the nav. */
  .site-actions { display: contents; }
  .site-actions .btn-primary { order: 2; }
  .nav-toggle { display: block; order: 3; }
  .site-nav {
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--line);
  }
  .site-nav:empty { display: none; }
  .site-nav a { padding: 10px 4px; font-size: 16px; border-radius: 0; }
  .site-nav a.active { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
  .site-actions .btn-ghost { order: 5; flex-basis: 100%; height: 40px; margin-top: 8px; }
  .site-header:not(.open) .site-nav,
  .site-header:not(.open) .site-actions .btn-ghost { display: none; }
}

/* Messages (toasts) ------------------------------------------------------------- */

.toasts {
  position: fixed;
  z-index: 1060;
  top: 76px; /* just below the 60px header, clear of its buttons */
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  padding: 10px 12px 10px 14px;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(28, 31, 46, 0.18);
  animation: toast-in 0.2s ease-out;
}
.toast-msg::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: #9aa3b5;
}
.toast-msg.success::before { background: #5fd1a5; }
.toast-msg.info::before { background: #6ec3bd; }
.toast-msg.warning::before { background: #f0b25a; }
.toast-msg.error::before, .toast-msg.danger::before { background: #f08a8a; }
.toast-text { flex: 1; }
.toast-close {
  border: 0;
  background: transparent;
  color: #b9bfd6;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  flex: none;
}
.toast-close:hover { color: #fff; }
.toast-msg.is-hiding { opacity: 0; transition: opacity 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast-msg { animation: none; } }
@media (max-width: 600px) {
  /* On phones the header wraps to two rows, so the toast goes to the bottom edge. */
  .toasts { top: auto; bottom: 16px; right: 12px; left: 12px; max-width: none; }
}

/* Page shell ---------------------------------------------------------------- */

main.site-main { flex: 1; }
.page { padding-top: 40px; padding-bottom: 72px; }
.page-header { margin-bottom: 28px; max-width: 46em; }
.page-header p { color: var(--muted); margin: 6px 0 0; }
.page-header .back { display: inline-block; font-size: 15px; margin-bottom: 10px; }
.page-narrow { max-width: 480px; }
.page-narrow h1 { font-size: 30px; }

.section { padding-top: 6px; border-top: 2px solid var(--ink); margin-top: 48px; }
.section > h2 { margin-bottom: 20px; }
.section:first-child { margin-top: 0; }

/* Rail layout (home page, categories) ----------------------------------------- */

.layout-rail {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.rail {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  /* Before any scrolling the rail starts below the header (60px) and the page
     padding (40px), so its height must leave room for that offset too. */
  max-height: calc(100vh - 100px - 24px);
}
.rail ol, .rail ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
/* A long category list scrolls inside the rail instead of pushing the buttons
   below the fold (the page itself may be much taller than the list). */
.rail ul { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding-right: 12px; overscroll-behavior: contain; scrollbar-width: thin; }
.rail li { border-bottom: 1px solid var(--line); }
.rail li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 15px;
}
.rail li a:hover { color: var(--ink); text-decoration: none; }
.rail li.current a, .rail li a.current {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 12px;
}
.rail .rail-select { display: none; }
.rail .rail-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.rail .rail-head .count { color: var(--muted); font-size: 14px; }
.rail .rail-foot { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.rail .rail-foot .btn { width: 100%; }
.content { min-width: 0; max-width: 720px; }

@media (max-width: 860px) {
  .layout-rail { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .rail { position: static; max-height: none; display: block; }
  .rail ol, .rail ul {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border: 0;
    padding-right: 0;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .rail li { border: 0; flex: none; }
  .rail li a, .rail li.current a, .rail li a.current {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: none;
    font-size: 14px;
    background: var(--paper);
  }
  .rail li.current a, .rail li a.current { border-color: var(--ink); }
  /* Long category names do not work as chips on a phone: use a native picker. */
  .rail ul { display: none; }
  .rail .rail-select { display: block; width: 100%; margin-bottom: 4px; }
  .rail .rail-foot { flex-direction: row; flex-wrap: wrap; }
  .rail .rail-foot .btn { width: auto; }
}

/* Facts / definition list ------------------------------------------------------- */

dl.facts {
  margin: 0;
  border-top: 1px solid var(--line-strong);
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 32px;
}
dl.facts dt, dl.facts dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
dl.facts dt { color: var(--muted); font-size: 15px; font-weight: 400; }
dl.facts dd { font-size: 16px; }
@media (max-width: 520px) {
  dl.facts { grid-template-columns: minmax(0, 1fr); }
  dl.facts dt { padding-bottom: 2px; border: 0; }
  dl.facts dd { padding-top: 0; }
}

/* Row list (label + description) ------------------------------------------------ */

table.rows { width: 100%; border-collapse: collapse; }
table.rows th, table.rows td { text-align: left; vertical-align: top; padding: 16px 0; border-bottom: 1px solid var(--line); }
table.rows th { width: 36%; padding-right: 24px; font-family: var(--font-serif); font-weight: 600; font-size: 18px; line-height: 1.3; }
table.rows td { color: var(--muted); font-size: 16px; }
table.rows td small { display: block; margin-top: 6px; font-size: 14px; color: var(--accent); }
@media (max-width: 520px) {
  table.rows, table.rows tbody, table.rows tr { display: block; }
  table.rows tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  table.rows th, table.rows td { display: block; width: auto; padding: 0; border: 0; }
  table.rows td { margin-top: 4px; }
}

/* Numbered steps ----------------------------------------------------------------- */

ol.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
ol.steps li {
  counter-increment: s;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
ol.steps li::before {
  content: counter(s);
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1;
  color: var(--accent);
  font-weight: 500;
}
ol.steps h3 { margin-bottom: 4px; }
ol.steps p { color: var(--muted); font-size: 16px; margin: 0; }

/* Tiles (KPI, screens) ------------------------------------------------------------ */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.tiles-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.tile { background: var(--paper); padding: 18px 20px; min-width: 0; }
.tile .label { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.tile .value { font-family: var(--font-serif); font-size: 32px; line-height: 1.1; font-weight: 600; margin: 0; }
.tile .hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.tile .path { font-size: 13px; color: var(--accent); margin: 0 0 6px; }
.tile h3 { margin-bottom: 4px; }
.tile p:last-child { margin-bottom: 0; }
.tile h3 a { color: inherit; text-decoration: none; }
.tile h3 a:hover, .tile h3 a:focus-visible { color: var(--accent); text-decoration: underline; }
.subhead { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.snippet { margin-top: 12px; }
.snippet summary { font-size: 14px; color: var(--accent); cursor: pointer; }
.snippet pre { margin: 8px 0 0; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; overflow-x: auto; }
.snippet pre code { background: none; padding: 0; }

/* Panels (charts, boxed notes) --------------------------------------------------- */

.panel { background: var(--paper); border: 1px solid var(--line); padding: 20px 22px; }
.panel h3, .panel h4 { font-family: var(--font-sans); font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.panel.clickable { cursor: pointer; }
.panel.clickable:hover { border-color: var(--line-strong); }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.example { border: 1px solid var(--line); background: var(--paper); padding: 20px 22px; font-size: 15px; }
.example .q { font-weight: 600; margin-bottom: 8px; }
.example .a { color: var(--muted); margin-bottom: 12px; }
.example .score { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; margin: 0; }
.example .score b { color: var(--ok); font-weight: 600; }

/* Buttons ------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  white-space: nowrap;
  transition: none;
}
.btn:hover, .btn:focus { color: #fff; background: var(--ink); border-color: var(--ink); text-decoration: none; }
.btn-primary, .btn-primary:disabled { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff; }
.btn-secondary, .btn-ghost, .btn-light, .btn-outline-secondary { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn-danger { background: var(--paper); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover, .btn-danger:focus { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-link { border: 0; background: transparent; color: var(--accent); padding: 0; height: auto; font-weight: 400; }
.btn-link:hover { background: transparent; color: var(--accent); text-decoration: underline; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: none; }
.btn-check:focus + .btn, .btn:focus { box-shadow: none; }
.btn .img-icon { height: 18px; width: auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 24px; }

/* Forms --------------------------------------------------------------------------- */

label, .form-label { font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--ink); }
.form-control, .form-select, input[type="date"], input[type="text"], input[type="email"], input[type="password"], select, textarea {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background-color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  line-height: 1.4;
}
/* Every <select> shows a chevron so it reads as a drop-down (Bootstrap only
   does this for .form-select; DataTables' page-length select has no class). */
select, .form-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%235f6670' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}
select:hover, .form-select:hover { border-color: var(--ink); }
.form-control:focus, .form-select:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
textarea.form-control, textarea { min-height: 160px; }
.form-text, .form-control + small, #hint_id_password1 { color: var(--muted); font-size: 14px; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invalid-feedback, .errorlist { color: var(--danger); }
.mb-3 { margin-bottom: 1.1rem !important; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 28px;
}
.filters .field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters .field label { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0; }
.filters .field .form-control, .filters .field .form-select, .filters .field input, .filters .field select { height: 38px; padding: 4px 10px; font-size: 15px; }
/* Keep the room for the chevron that the shorthand padding above takes away. */
.filters .field .form-select, .filters .field select { padding-right: 34px; }
.filters .checks { display: flex; gap: 14px; flex-wrap: wrap; padding-bottom: 6px; }
.filters .checks label { font-weight: 400; font-size: 15px; display: flex; gap: 6px; align-items: center; margin: 0; }
.filters .btn { height: 38px; }
@media (max-width: 600px) {
  .filters { padding: 14px; }
  .filters .field { flex: 1 1 100%; }
  .filters .btn { width: 100%; }
}

/* Tables & DataTables ---------------------------------------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data, table.display, .table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: var(--paper);
  margin: 0;
  --bs-table-bg: var(--paper);
  --bs-table-striped-bg: var(--paper);
  --bs-table-color: var(--ink);
}
table.data th, table.display th, .table th,
table.data td, table.display td, .table td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.data thead th, table.display thead th, .table thead th {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.display.dataTable thead th, table.display.dataTable thead td { border-bottom: 1px solid var(--line-strong); }
table.display.dataTable tbody td { border-bottom: 1px solid var(--line); }
table.dataTable.no-footer { border-bottom: 0; }
table.dataTable tbody tr { background: var(--paper); }
table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd { background: var(--paper); }
table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover { background: var(--bg); }
table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.display tbody tr.even > .sorting_1,
table.dataTable.order-column tbody tr > .sorting_1 { background: transparent; }
table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc { background-position: right 4px center; }
table.dataTable td.dt-num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wrap-text, table.display td.wrap-text { word-break: break-word; white-space: normal; min-width: 260px; }
table.data tr.is-hidden td, table.display tr.is-hidden td { opacity: 0.5; }

.dataTables_wrapper { border: 1px solid var(--line); background: var(--paper); padding: 10px 12px 6px; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { font-size: 14px; color: var(--muted); padding-top: 8px; }
.dataTables_wrapper .dataTables_length select, .dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-size: 14px;
  margin-left: 6px;
  background-color: var(--paper);
}
.dataTables_wrapper .dataTables_length select { padding-right: 30px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid transparent !important;
  border-radius: var(--radius);
  color: var(--ink) !important;
  background: transparent !important;
  padding: 3px 9px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { border-color: var(--line-strong) !important; color: var(--ink) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { color: var(--line-strong) !important; }
.dataTables_wrapper .dataTables_processing { background: var(--paper); color: var(--muted); }
@media (max-width: 720px) {
  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { float: none; text-align: left; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; margin: 4px 0 0; }
  .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { float: none; text-align: left; }
}

/* Badges & pills ------------------------------------------------------------------------ */

.badge, .pill {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}
.badge.bg-secondary, .pill.muted { background: var(--bg) !important; color: var(--muted) !important; border: 1px solid var(--line); }
.pill.ok { background: #e4f3ec; color: var(--ok); }
.pill.warn { background: #fbeedd; color: var(--warn); }
.mark-yes { color: var(--ok); }
.mark-no { color: var(--line-strong); }

/* Inline notices: stay on the page, unlike the toasts ------------------------------------- */

.notice { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; margin: 18px 0; max-width: 46em; }
.notice.warn { border-left-color: var(--warn); background: #fbeedd; }
.notice.error { border-left-color: var(--danger); background: var(--danger-soft); }
.notice p:last-child { margin-bottom: 0; }
/* Wide enough to read a source name; on a phone the table scrolls sideways instead. */
table.connections select { min-width: 220px; max-width: 100%; }
table.connections td.check, table.connections th.check { text-align: center; }

/* Category instructions block ------------------------------------------------------------ */

.instructions { border: 1px solid var(--line); background: var(--paper); padding: 18px 22px; }
.instructions p:last-child { margin-bottom: 0; }
.empty { border: 1px dashed var(--line-strong); padding: 28px 22px; color: var(--muted); text-align: center; }
.empty .btn { margin-top: 14px; }

/* Account pages ----------------------------------------------------------------------------- */

.email-list { list-style: none; padding: 0; margin: 0 0 20px; border-top: 1px solid var(--line); }
.email-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.email-list label { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: 0; flex-wrap: wrap; }

/* Chart modal (statistics) --------------------------------------------------------------- */

.chart-modal {
  position: fixed;
  z-index: 1050;
  inset: 0;
  background: rgba(28, 31, 36, 0.6);
}
.chart-modal-content {
  background: var(--paper);
  margin: 2vh auto;
  width: 94%;
  max-width: 1200px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
}
.chart-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chart-modal-header h3 { margin: 0; font-family: var(--font-serif); font-size: 20px; }
.chart-modal-close { font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; background: none; border: 0; }
.chart-modal-close:hover { color: var(--ink); }
.chart-modal-body { flex: 1; padding: 20px; position: relative; min-height: 0; }
.chart-modal-footer { padding: 10px 20px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); }
#expandedChart { width: 100% !important; height: 100% !important; }

/* Footer ---------------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 24px 0;
  font-size: 14px;
  color: var(--muted);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer b { color: var(--ink); font-weight: 600; }

/* Home page ------------------------------------------------------------------------------- */

.home h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.15; max-width: 18em; margin-bottom: 0; }
.home .lead { font-size: 20px; line-height: 1.5; color: var(--muted); margin: 24px 0 0; max-width: 30em; }
.home .actions { margin-top: 28px; }
.home dl.facts { margin-top: 44px; }
.home .section { margin-top: 56px; }
.home .example { margin-top: 36px; }
.home .access p { color: var(--muted); max-width: 32em; }
@media (max-width: 860px) {
  /* The section index adds nothing on a phone: the page is one scroll anyway. */
  .home .rail { display: none; }
  .home .section { margin-top: 40px; }
  .home .lead { font-size: 18px; }
}

/* Model lab (superuser-only, /lab/) --------------------------------------------------------
 * One deliberate element: the comparison matrix. Each run column opens with a small
 * spec sheet; each answer cell carries the judge's score as a serif numeral on a band
 * bar (bad <=4, mid 5-7, good >=8). Everything else reuses the datasheet components. */

.lab {
  --band-bad: var(--danger);
  --band-bad-soft: var(--danger-soft);
  --band-mid: var(--warn);
  --band-mid-soft: #fbeedd;
  --band-good: var(--ok);
  --band-good-soft: #e4f3ec;
}
.lab .num, .lab-cell-meta, .lab-score, .lab-big { font-variant-numeric: tabular-nums; }
.lab-sub { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; }
.lab-note { font-size: 14px; color: var(--muted); max-width: 52em; margin: 0 0 16px; }
.lab-warn, .lab-err { color: var(--danger); }
.lab-warn { font-size: 13px; }
.lab-banner {
  border-left: 3px solid var(--warn);
  background: var(--band-mid-soft);
  padding: 10px 14px;
  font-size: 15px;
  margin-bottom: 24px;
}
.lab-toolbar { margin: -8px 0 8px; }
.lab-disclosure { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.lab-disclosure > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.lab-disclosure[open] > summary { margin-bottom: 14px; }
.lab-form { max-width: 720px; }
.lab-form textarea { min-height: 90px; }
.lab-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.lab-field > label:not(.lab-check) { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.lab-field select, .lab-field input[type="text"], .lab-field input[type="number"], .lab-field textarea { width: 100%; }
.lab-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400 !important; }
.lab-check input { margin-top: 5px; }
.lab-danger-zone { margin-top: 28px; }
.lab-must { font-size: 14px; color: var(--accent); margin: 4px 0 0; }

/* Matrix */
.lab-matrix-frame {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  background: var(--paper);
}
.lab-matrix-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* With the pinned bar active the frame's own bar would only repeat it. */
.lab-matrix-wrap.has-hscroll .lab-matrix-frame { scrollbar-width: none; }
.lab-matrix-wrap.has-hscroll .lab-matrix-frame::-webkit-scrollbar { display: none; }
.lab-hscroll {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 0;
  box-shadow: 0 -1px 0 var(--line);
}
.lab-hscroll[hidden] { display: none; }
.lab-hscroll-btn {
  flex: none;
  width: 36px;
  height: 30px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.lab-hscroll-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.lab-hscroll-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lab-hscroll-btn:disabled { opacity: .35; cursor: default; }
/* Our own bar, not the browser's: always visible and thick enough to grab
   (system scrollbars are often thin and hidden until hovered). */
.lab-hscroll-track {
  flex: 1;
  position: relative;
  height: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.lab-hscroll-thumb {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  min-width: 40px;
  background: var(--line-strong);
  border-radius: 9px;
  cursor: grab;
  touch-action: none;
}
.lab-hscroll-thumb:hover { background: var(--muted); }
.lab-hscroll-track.is-dragging .lab-hscroll-thumb { background: var(--accent); cursor: grabbing; }
.lab-matrix { border-collapse: separate; border-spacing: 0; font-size: 15px; }
.lab-matrix th, .lab-matrix td { border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.lab-matrix .lab-qcol {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--paper);
  width: 300px;
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  border-right: 1px solid var(--line-strong);
  font-weight: 400;
}
.lab-matrix thead .lab-corner { border-bottom: 1px solid var(--line); }
.lab-matrix tbody .lab-qcol a { color: var(--ink); }
.lab-matrix tbody .lab-qcol a:hover { color: var(--accent); }

/* Model header: one column per run. */
.lab-run {
  position: relative;
  min-width: 210px;
  width: 250px;
  padding: 16px 16px 10px;
  border-left: 1px solid var(--line);
  font-weight: 400;
  vertical-align: bottom !important;
  background: var(--paper);
}
.lab-tag {
  position: absolute;
  top: -1px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
}
.lab-run-name { font-family: var(--font-serif); font-size: 19px; font-weight: 600; line-height: 1.2; word-break: break-word; }
.lab-run-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.lab-run-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.lab-run-badges:empty { display: none; }

/* Figures: one row per measure, its label once in the sticky left column. */
/* Whole-pixel line heights: fractional row heights let the sticky label
   cells hide every other row line. */
.lab-matrix .lab-stat-label { padding: 7px 16px; font-size: 13px; line-height: 20px; color: var(--muted); font-weight: 400; vertical-align: middle; }
.lab-stat { padding: 7px 16px; border-left: 1px solid var(--line); font-size: 14px; line-height: 20px; vertical-align: middle !important; background: var(--paper); }
.lab-stat.lab-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lab-stat.is-bad { color: var(--danger); font-weight: 600; }
.lab-stat-row.is-key .lab-stat { font-weight: 600; }
.lab-stat-row.is-key .lab-stat-label { color: var(--ink); }
/* The recommended run stays marked down its whole column. */
.lab-run.is-recommended, .lab-stat.is-recommended { background: #f4faf9; }
.lab-run.is-recommended { box-shadow: inset 0 3px 0 var(--accent); }
.lab-big { font-family: var(--font-serif); font-size: 36px; line-height: 40px; font-weight: 600; }
.lab-big.is-best { color: var(--accent); }
.lab-stat .lab-big + .lab-sub { display: block; }
.lab-mark { color: var(--warn); font-weight: 600; margin-left: 1px; }
.lab-more-toggle { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.lab-more-toggle::before { content: "▸ "; }
.lab-more-toggle.is-open::before { content: "▾ "; }
.lab-more-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lab-more-toggle-row .lab-stat { padding: 4px 16px; }
.lab-actions-row .lab-stat, .lab-actions-row .lab-stat-label { vertical-align: top !important; padding-top: 12px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.lab-section-row th, .lab-section-row td { background: var(--bg); font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 16px; }
.lab-corner { background: var(--paper); }
/* Cost against the company's current model. */
.lab-compare { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px;
  border-left: 3px solid var(--line-strong); background: var(--bg); }
.lab-compare .lab-sub { font-size: 12px; line-height: 16px; font-weight: 400; }
.lab-compare-main { font-size: 15px; font-weight: 600; line-height: 20px; }
.lab-compare.is-cheaper { border-left-color: var(--ok); }
.lab-compare.is-cheaper .lab-compare-main { color: var(--ok); }
.lab-compare.is-dearer { border-left-color: var(--warn); }
.lab-compare.is-dearer .lab-compare-main { color: var(--warn); }
.lab-compare.is-baseline { border-left-color: var(--accent); }
.lab-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0; }
.lab-status { font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.lab-bar { flex: 1 1 80px; height: 4px; background: var(--line); }
.lab-bar > span { display: block; height: 100%; background: var(--accent); transition: width 0.4s; }
@media (prefers-reduced-motion: reduce) { .lab-bar > span { transition: none; } }
.lab-run-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lab-run-actions form { margin: 0; }
/* Above the table: one line, the details folded; footnotes below it. */
.lab-compare-line { margin-bottom: 4px; }
.lab-howto { margin: 0 0 14px; font-size: 14px; color: var(--muted); max-width: 760px; }
.lab-howto > summary { cursor: pointer; color: var(--accent); width: max-content; }
.lab-howto > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lab-howto ul { margin: 8px 0 0; padding-left: 20px; }
.lab-howto li { margin: 4px 0; }
.lab-footnotes { margin: 10px 0 0; font-size: 13px; color: var(--muted); max-width: 760px; }
.lab-footnotes p { margin: 2px 0; }
.lab-resume { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.lab-resume input { width: 96px; height: 32px; padding: 2px 6px; font-size: 14px; }

.lab-cell { border-left: 1px solid var(--line); padding: 0; min-width: 150px; }
.lab-cell-link {
  display: block;
  height: 100%;
  padding: 10px 14px 12px;
  color: var(--ink);
  border-left: 4px solid transparent;
}
.lab-cell-link:hover { text-decoration: none; background: var(--bg); color: var(--ink); }
.lab-cell.band-bad .lab-cell-link { border-left-color: var(--band-bad); }
.lab-cell.band-mid .lab-cell-link { border-left-color: var(--band-mid); }
.lab-cell.band-good .lab-cell-link { border-left-color: var(--band-good); }
.lab-score { font-family: var(--font-serif); font-size: 26px; font-weight: 600; line-height: 1.1; display: block; }
.band-bad .lab-score { color: var(--band-bad); }
.lab-cell-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.lab-flag {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
  background: var(--band-bad-soft);
  padding: 1px 6px;
}
.lab-mini { display: inline-block; margin-top: 6px; margin-right: 6px; font-size: 12px; color: var(--muted); }
.lab-pending { display: block; padding: 12px 14px; color: var(--muted); font-size: 13px; }
.lab-cell > .lab-err { padding: 12px 14px; }

/* Questions list */
.lab-questions { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lab-questions li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.lab-questions a { color: var(--ink); }

/* Question page */
.lab-question-text { font-size: clamp(22px, 2.6vw, 30px); max-width: 32em; }
.lab-history { list-style: none; margin: 0; padding: 0; max-width: 46em; }
.lab-history li { padding: 8px 12px; margin-bottom: 6px; background: var(--paper); border: 1px solid var(--line); font-size: 15px; }
.lab-history li.is-user { margin-right: 15%; }
.lab-history li.is-assistant { margin-left: 15%; background: var(--bg); }
.lab-answers { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 1fr); gap: 20px; overflow-x: auto; padding-bottom: 8px; }
.lab-answer-col h3 { font-family: var(--font-serif); margin: 0; }
.lab-answer { border: 1px solid var(--line); border-top: 4px solid var(--line-strong); background: var(--paper); padding: 14px 16px; margin-top: 12px; font-size: 15px; }
.lab-answer.band-bad { border-top-color: var(--band-bad); }
.lab-answer.band-mid { border-top-color: var(--band-mid); }
.lab-answer.band-good { border-top-color: var(--band-good); }
.lab-answer-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.lab-answer-meta .lab-score { display: inline; font-size: 24px; color: var(--ink); }
.lab-answer-text p:last-child { margin-bottom: 0; }
.lab-judge { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 14px; }
.lab-judge p { margin-bottom: 6px; }
.lab-judge ul { margin: 0; padding-left: 18px; color: var(--danger); }
.lab-retry { margin-top: 10px; font-size: 14px; color: var(--muted); }
.lab-retry summary { cursor: pointer; }
.lab-error-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }

/* Topics (popular questions) */
.lab-topics { list-style: none; margin: 0 0 16px; padding: 0; border-top: 1px solid var(--line); }
.lab-topics li { border-bottom: 1px solid var(--line); }
.lab-topic { display: grid; grid-template-columns: auto 64px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; font-weight: 400; margin: 0; cursor: pointer; }
.lab-topic input { margin-top: 8px; }
.lab-topic-count { font-family: var(--font-serif); font-size: 26px; line-height: 1.1; color: var(--accent); text-align: right; }
.lab-topic-body { display: flex; flex-direction: column; gap: 2px; }
.lab-topic-q { color: var(--ink); }
.lab-wait-block { padding: 18px 20px; border: 1px dashed var(--line-strong); color: var(--muted); }

/* Run confirmation and apply */
.lab-estimate { margin: 0 0 24px; }
.lab-estimate .tile { margin: 0; }
.lab-estimate dd { margin: 0; }
.lab-apply th[scope="row"] { color: var(--muted); font-weight: 400; }
.lab-delta { font-family: var(--font-serif); font-size: 20px; margin: 16px 0; }

@media (max-width: 720px) {
  .lab-matrix .lab-qcol { width: 160px; min-width: 150px; padding: 10px; font-size: 14px; }
  .lab-run { min-width: 190px; padding: 14px 12px 10px; }
  .lab-stat, .lab-matrix .lab-stat-label { padding: 6px 10px; }
  .lab-big { font-size: 30px; }
  .lab-answers { grid-auto-columns: minmax(260px, 86vw); }
  .lab-history li.is-user, .lab-history li.is-assistant { margin-left: 0; margin-right: 0; }
}
