/*
  Chiwara scheduling system — staff, client and interpreter pages after sign-in.
  Colours, fonts and corners come from css/tokens.css (shared with the public
  site and the app). Use the meaning-based names (--bg, --ink, --primary …),
  never raw colours: they switch to dark when the phone is in dark mode.
  Type rule (same as the app): Lora for page titles and big numbers,
  Public Sans for section and card titles.
*/

.app { background: var(--bg); color: var(--ink); min-height: 100vh; }

.app-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.app-header-inner {
  max-width: 1280px; margin-inline: auto; padding: var(--space-3) var(--space-5);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5);
}
.app-area { font-family: var(--body); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-left: var(--space-2); }
.app-nav { display: flex; flex-wrap: wrap; gap: var(--space-1); flex: 1; }
.app-nav a { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9375rem; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }
.app-nav a:hover { background: var(--sunken); color: var(--ink); }
.app-nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.btn-link { background: none; border: 0; color: var(--primary); font-weight: 700; cursor: pointer; min-height: 44px; padding: 0 var(--space-2); text-decoration: underline; text-underline-offset: 3px; }

.app-main { max-width: 1280px; margin-inline: auto; padding: var(--space-6) var(--space-5) var(--space-9); }
.app-main h1 { font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); margin-bottom: var(--space-2); }
.app-main h2 { font-size: 1.25rem; margin-bottom: var(--space-3); }
/* Section and card titles in Public Sans, like the app; page titles (h1) stay Lora. */
.app-main h2, .app-main h3 { font-family: var(--body); font-weight: 700; letter-spacing: -0.005em; line-height: 1.25; }
.app-main h3 { font-size: 1.0625rem; }
.app-sub { color: var(--muted); margin-bottom: var(--space-6); }

.app-flash { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-5); font-weight: 600; }
.app-flash a { color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.app-flash--success { background: var(--ok-soft); color: var(--ok-ink); }
.app-flash--error { background: var(--danger-soft); color: var(--danger-ink); }

.app-grid { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .app-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.app-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); }
.app-card.narrow { max-width: 28rem; margin: 8vh auto; }
.app-card h2:first-child, .app-card h3:first-child { margin-top: 0; }
.app-card + .app-card { margin-top: var(--space-5); }
.app-grid > .app-card + .app-card { margin-top: 0; } /* the grid gap already spaces them */

.stat { display: flex; flex-direction: column; gap: var(--space-1); }
.stat-num { font-family: var(--display); font-size: 2rem; font-weight: 700; color: var(--heading); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.stat-sub { font-size: 0.8125rem; color: var(--muted); }
/* Key figures: two per row on phones (like the app), four across on wide screens. */
.stat-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--space-5); }
.stat-grid > .app-card { margin: 0; padding: var(--space-4); }
.stat-grid .stat-num { font-size: 1.625rem; }
.stat-grid > .stat-wide { grid-column: 1 / -1; }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-5); } .stat-grid > .stat-wide { grid-column: auto; } }

.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-full); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.pill--available, .pill--confirmed, .pill--completed, .pill--approved, .pill--active, .pill--paid { background: var(--ok-soft); color: var(--ok-ink); }
.pill--cancelled, .pill--paused, .pill--inactive, .pill--not_a_fit, .pill--dismissed { background: var(--off-soft); color: var(--off-ink); }
.pill--unknown, .pill--offered, .pill--new, .pill--sent, .pill--draft, .pill--screening, .pill--assessment, .pill--onboarding, .pill--pending { background: var(--warn-soft); color: var(--warn-ink); }
/* Logged off (offline) is red everywhere, so nobody misses it. */
.pill--unavailable, .pill--unfilled, .pill--late_cancelled, .pill--no_show, .pill--interpreter_no_show, .pill--overdue, .pill--void { background: var(--danger-soft); color: var(--danger-ink); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data th, .data td { padding: var(--space-3); text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data th { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg); white-space: nowrap; }
.data tr:last-child td { border-bottom: 0; }
.data td.num, .data th.num { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); padding: var(--space-5); text-align: center; }

.filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin-bottom: var(--space-5); }
.filters .field { margin: 0; min-width: 11rem; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; min-height: 40px; }
@media (pointer: coarse) { .btn-sm { min-height: 44px; } } /* a full finger-sized target on touch screens */
.btn-danger { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.inline-form { display: inline; }
.muted { color: var(--muted); font-size: 0.875rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: 0; }
dl.kv dt { font-weight: 700; color: var(--muted); font-size: 0.875rem; }
dl.kv dd { margin: 0; }

/* Interpreter status switch */
.status-switch { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.status-switch button {
  min-height: 64px; border-radius: var(--radius-lg); border: 2px solid var(--line); background: var(--card);
  font-weight: 700; font-size: 1.0625rem; color: var(--ink); cursor: pointer;
}
.status-switch button[aria-pressed="true"].is-available { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-ink); }
.status-switch button[aria-pressed="true"].is-unavailable { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-ink); }
.status-note { margin-top: var(--space-3); font-size: 0.9375rem; }

.offer { border: 2px solid var(--accent); border-radius: var(--radius-lg); padding: var(--space-4); background: var(--accent-wash); }
.offer + .offer { margin-top: var(--space-3); }
.appt { padding-block: var(--space-4); border-bottom: 1px solid var(--line); }
.appt:last-child { border-bottom: 0; }
.appt-when { font-weight: 700; color: var(--heading); }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: var(--space-2); }
.check-grid label { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3); border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; background: var(--card); }
.check-grid input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }

/* Phones: brand + log out on one line, then the main tabs and "More". */
.app-nav-more { display: none; position: relative; }
@media (max-width: 899px) {
  .app-header-inner { gap: var(--space-2) var(--space-3); padding-block: var(--space-2); }
  .app-header .brand { flex: 1; }
  .app-nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--space-5) * -1); padding-inline: var(--space-5); scrollbar-width: none; overflow-y: visible; }
  .app-nav a { white-space: nowrap; padding-inline: 10px; font-size: 0.875rem; }
  .app-nav .nav-extra { display: none; }
  .app-nav-more { display: block; }
  .app-nav-more summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.875rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
  .app-nav-more summary::-webkit-details-marker { display: none; }
  .app-nav-more summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
  .app-nav-more[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .app-nav-more summary.is-current { background: var(--primary); color: var(--on-primary); }
  .app-nav-more summary:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
  .app-nav:has(.app-nav-more[open]) { overflow: visible; }
  .app-nav-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 6px; border: 1px solid var(--line);
    border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
  .app-nav-menu a { display: flex; min-height: 48px; padding: 0 14px; border-radius: var(--radius-md); font-size: 1rem; }
}

/* "Open the app" — one slim line on client and interpreter pages (phones only). */
.app-banner { display: none; }
@media (max-width: 899px) {
  .app-banner:not([hidden]) { display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: 6px var(--space-2) 6px var(--space-5); background: var(--accent-soft); color: var(--ink); font-size: 0.875rem; font-weight: 600; line-height: 1.3; }
  .app-banner-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-banner .btn { min-height: 44px; padding: 0 var(--space-4); flex-shrink: 0; }
  .app-banner-close { flex-shrink: 0; width: 44px; height: 44px; border: 0; background: none; font-size: 1.5rem; line-height: 1; color: var(--ink); cursor: pointer; border-radius: var(--radius-full); }
  .app-banner-close:focus-visible { outline: 3px solid var(--ring); }
}

/* Tables become one card per row on phones (labels added by js/portal.js). */
@media (max-width: 640px) {
  .table-wrap:has(table.is-cards) { border: 0; background: none; overflow: visible; }
  table.data.is-cards, .data.is-cards tbody, .data.is-cards tr, .data.is-cards td { display: block; width: 100%; }
  .data.is-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .data.is-cards tr { margin-bottom: var(--space-3); padding: var(--space-2) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
  .data.is-cards td { display: block; padding: 6px 0; border: 0; text-align: right; overflow: hidden; overflow-wrap: anywhere; }
  .data.is-cards td::before { content: attr(data-label); float: left; margin-right: var(--space-4); text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
  .data.is-cards td:first-child { padding-top: var(--space-2); font-weight: 700; font-size: 1rem; text-align: left; }
  .data.is-cards td:first-child::before, .data.is-cards td[colspan]::before, .data.is-cards td:not([data-label])::before { display: none; }
  .data.is-cards td:empty { display: none; }
  .data.is-cards td.empty { text-align: center; }
}

/* Interpreter status: one tap to be Available or log off.
   Green = Available, amber = Unknown (asked to confirm), red = logged off. */
.avail-card { padding: var(--space-3); }
.avail-switch { display: flex; align-items: center; gap: var(--space-4); width: 100%; padding: var(--space-4); border: 2px solid var(--status-off-edge); border-radius: var(--radius-lg);
  background: var(--status-off-bg); color: var(--status-off-fg); font: inherit; text-align: left; cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.avail-switch:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.avail-switch.is-on { background: var(--status-on-bg); border-color: var(--status-on-edge); color: var(--status-on-fg); }
.avail-switch.is-unknown { background: var(--status-ask-bg); border-color: var(--status-ask-edge); color: var(--status-ask-fg); }
.avail-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.avail-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.avail-title { margin-top: 2px; font-size: 1.375rem; font-weight: 700; line-height: 1.2; }
.avail-sub { margin-top: 4px; font-size: 0.9375rem; opacity: 0.92; }
.avail-track { position: relative; flex-shrink: 0; width: 64px; height: 36px; border-radius: var(--radius-full); background: var(--switch-track-off); box-shadow: inset 0 0 0 2px currentColor; transition: background-color .2s ease; }
.avail-knob { position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: var(--radius-full); background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.is-on .avail-track { background: var(--switch-track-on); }
.is-on .avail-knob { transform: translateX(28px); }
.is-unknown .avail-track { background: var(--warn-edge); box-shadow: none; }
/* "Missed 1 in a row" sits inside the card, as in the app. */
.avail-chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: var(--space-2); padding: 4px 10px; border-radius: var(--radius-full);
  background: var(--card); color: var(--warn-ink); font-size: 0.8125rem; font-weight: 700; line-height: 1.3; }
.avail-chip svg { flex: none; }
@media (prefers-reduced-motion: reduce) { .avail-switch, .avail-track, .avail-knob { transition: none; } }

/* Logged off or Unknown: a red (or amber) line under the menu on every other
   interpreter page, so it's never missed. */
.status-strip { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: 4px var(--space-2) 4px var(--space-5);
  background: var(--status-off-bg); color: var(--status-off-fg); border-bottom: 2px solid var(--status-off-edge); font-size: 0.9375rem; font-weight: 700; line-height: 1.3; }
.status-strip.is-unknown { background: var(--status-ask-bg); color: var(--status-ask-fg); border-color: var(--status-ask-edge); }
.status-strip-dot { flex: none; width: 10px; height: 10px; border-radius: var(--radius-full); background: currentColor; }
.status-strip-text { flex: 1; min-width: 0; }
.status-strip form { margin: 0; flex-shrink: 0; }
.status-strip button { min-height: 44px; padding: 0 var(--space-4); border: 2px solid currentColor; border-radius: var(--radius-full); background: transparent; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.status-strip button:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* Bigger tap areas for small stand-alone links, without changing how they look. */
.app-main p > a:only-child:not(.btn), .checklist-status a, .app-main li > a:not(.btn), .client-phone a { position: relative; }
.app-main p > a:only-child:not(.btn)::after, .checklist-status a::after, .app-main li > a:not(.btn)::after { content: ""; position: absolute; inset: -12px -6px; }

/* Interpreter ID badge, onboarding checklist, weekly hours */
.id-badge { display: inline-flex; align-items: center; vertical-align: middle; margin-left: var(--space-2); padding: 2px 10px; border-radius: var(--radius-full); background: var(--feature); color: var(--accent); font-family: var(--body); font-size: 0.875rem; font-weight: 700; letter-spacing: 0.06em; }
.checklist-status { display: flex; flex-direction: column; gap: var(--space-2); }
.checklist-status li { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--sunken); }
.checklist-status li::before { content: "○"; color: var(--muted); margin-right: var(--space-2); }
.checklist-status li > span:first-child { flex: 1; }
.checklist-status li.is-done::before { content: "✓"; color: var(--ok); font-weight: 700; }
.checklist-status li.is-expiring::before { content: "!"; color: var(--warn-ink); font-weight: 700; }
.checklist-status li.is-expired::before, .checklist-status li.is-missing::before { content: "○"; }
.checklist-status li.is-expired { background: var(--danger-soft); }
.hours-grid { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2) var(--space-3); align-items: center; }
.hours-day { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: 0.9375rem; min-height: 44px; }
.hours-day input { width: 18px; height: 18px; accent-color: var(--primary); }
.checklist-item { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4) var(--space-4); }
.checklist-item legend { padding-inline: var(--space-2); font-weight: 600; }
.checklist-item.is-done { border-color: var(--ok-edge); }
.checklist-item.is-expiring { border-color: var(--warn-edge); }
.checklist-item.is-expired, .checklist-item.is-missing { border-color: var(--danger-edge); }

/* Two-factor setup */
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.recovery-codes code, .setup-key code { font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; background: var(--card); padding: 4px 8px; border-radius: var(--radius-sm); }
.setup-key { margin-block: var(--space-3); overflow-wrap: anywhere; }
.steps-list { padding-left: 1.25rem; list-style: decimal; display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-3); }

/* Public feedback form */
.rating { border: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.rating legend { font-weight: 600; margin-bottom: var(--space-2); }
.rating .rating-option { display: flex; margin: 0; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-weight: 400; color: var(--warn); cursor: pointer; background: var(--card); }
.rating .rating-option:has(input:checked) { border-color: var(--primary); background: var(--sunken); }
.rating .rating-option input { margin: 0; width: 18px; height: 18px; accent-color: var(--primary); }

/* Printable invoice */
.invoice-head { display: flex; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-5); }
.invoice-total { font-size: 1.25rem; font-weight: 700; }
@media print {
  .app-header, .app-flash, .no-print, .skip-link { display: none !important; }
  .app-main { padding: 0; max-width: none; }
  .app-card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; }
}
.app-card .hint, p.hint { font-size: 0.8125rem; color: var(--muted); }
/* Small line icon at the start of a hint (e.g. the lock on payment notes). */
.hint-icon { display: flex; gap: var(--space-2); align-items: flex-start; }
.hint-icon svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--heading); }
.app-grid > details.app-card { align-self: start; }

/* Interpreter training */
.training-list { display: flex; flex-direction: column; gap: var(--space-4); }
.training-card { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.training-card > div:first-child { flex: 1 1 22rem; }
.training-card h2 { margin-bottom: var(--space-2); }
.training-card.is-needed, .training-card.is-expired { border-left: 4px solid var(--danger); }
.training-card.is-expiring { border-left: 4px solid var(--warn); }
.training-card.is-done { border-left: 4px solid var(--ok); }
.training-state { margin-top: var(--space-2); }
.prose-training { line-height: 1.65; max-width: 48rem; }
.prose-training h3 { font-size: 1.125rem; margin: var(--space-6) 0 var(--space-2); color: var(--heading); }
.prose-training h3:first-child { margin-top: 0; }
.prose-training p, .prose-training ul { margin-bottom: var(--space-3); }
.prose-training ul { padding-left: 1.25rem; list-style: disc; }
.prose-training ul ul { margin: var(--space-2) 0 0; list-style: circle; }
.prose-training li + li { margin-top: var(--space-1); }
.prose-training ul.cols-2 { columns: 2 14rem; column-gap: var(--space-6); }
.quiz-q { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-4); margin: 0 0 var(--space-4); }
.quiz-q legend { font-weight: 700; padding-inline: var(--space-2); max-width: 100%; }
.quiz-q.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.quiz-option { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) var(--space-2); min-height: 44px; font-weight: 400; cursor: pointer; border-radius: var(--radius-sm); }
.quiz-option:hover { background: var(--sunken); }
.quiz-option input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.quiz-why { margin-top: var(--space-2); color: var(--danger-ink); font-size: 0.9375rem; }
.attest { border: 0; padding: 0; margin: 0; }
.certificate { max-width: 44rem; line-height: 1.6; }
.certificate h1 { margin-block: var(--space-2) var(--space-4); }
.certificate h2 { font-size: 1.125rem; margin-top: var(--space-5); }
.certificate ul { padding-left: 1.25rem; list-style: disc; margin-block: var(--space-2) var(--space-4); }
.certificate .signature { font-family: var(--display); font-size: 1.375rem; font-style: italic; }

/* Client portal */
.client-title { margin-bottom: var(--space-5); }
.client-login { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: var(--space-5); align-items: start; }
.signup-option + .signup-option { border-top: 1px solid var(--line); margin-top: var(--space-5); padding-top: var(--space-5); }
.signup-option h3 { margin-bottom: var(--space-2); }
.signup-option .prose-list { margin-bottom: var(--space-4); }
.client-phone { font-size: 1.75rem; font-weight: 700; margin-bottom: var(--space-3); }
.client-phone a { color: var(--heading); text-decoration: none; }

/* Browser calling */
.call-status { font-weight: 600; font-size: 1.0625rem; min-height: 1.6em; margin-block: var(--space-3); }
.call-panel .actions .btn { min-width: 8rem; }

/* Interpreter Co-Pilot (portal/copilot.php, admin/glossary.php) */
.cp-form .cp-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-3); }
.cp-words { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.cp-words li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.cp-word { font-size: 1.25rem; font-weight: 700; }
.cp-plain { background: var(--feature); color: var(--on-feature); border-radius: var(--radius-lg); padding: var(--space-4); }
.cp-plain p { margin: 0 0 var(--space-2); color: inherit; }
.cp-plain .cp-label { font-size: 0.75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.cp-meaning { border-top: 1px solid var(--line); padding-top: var(--space-3); margin-top: var(--space-3); }
.cp-meaning:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.cp-meaning p { white-space: pre-line; margin: var(--space-1) 0; }
.cp-credit { font-size: 0.8125rem; color: var(--muted); }
.cp-disclaimer { font-size: 0.875rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: var(--space-3); }
.cp-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.cp-chips a { display: inline-flex; min-height: 40px; align-items: center; padding: 0 var(--space-3); border: 2px solid var(--line); border-radius: var(--radius-full); font-weight: 600; }

/* ---------- Co-Pilot tab (every interpreter page) ---------- */
/* Low on the right edge, in thumb reach. It slides to a thin glowing strip
   while you scroll, and whenever it would sit on top of text or a button
   (js/copilot-fab.js checks), so it never hides anything. */
.cpfab-tab {
  position: fixed; right: env(safe-area-inset-right, 0px); top: 80%; transform: translateY(-50%); z-index: 30;
  width: 46px; padding: 10px 0 12px; border: 0; border-radius: var(--radius-lg) 0 0 var(--radius-lg); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--navy-950); font: 700 0.8125rem/1 var(--body); letter-spacing: 0.03em;
  background: linear-gradient(135deg, var(--orb-mint), var(--orb-sky) 40%, var(--orb-violet) 70%, var(--orb-mint)); background-size: 300% 300%;
  animation: cpfab-flow 9s ease-in-out infinite, cpfab-glow 3.6s ease-in-out infinite;
  box-shadow: -3px 4px 16px rgba(14, 22, 38, 0.22); touch-action: none; user-select: none; -webkit-user-select: none;
}
.cpfab-tab .cpfab-label { writing-mode: vertical-rl; transform: rotate(180deg); }
.cpfab-orb { position: relative; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-full); color: var(--navy-900);
  background: radial-gradient(circle, rgba(255, 255, 255, .85) 0 55%, transparent 56%), conic-gradient(var(--orb-mint), var(--orb-sky), var(--orb-violet), var(--orb-gold), var(--orb-mint)); }
.cpfab-tab:hover { filter: brightness(1.05); }
@keyframes cpfab-flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes cpfab-glow { 0%, 100% { box-shadow: -3px 4px 16px rgba(14, 22, 38, .22); } 50% { box-shadow: -3px 4px 16px rgba(14, 22, 38, .22), 0 0 22px 6px rgba(127, 212, 255, .55); } }
.cpfab-tab:active { transform: translate(2px, -50%); }
.cpfab-tab:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.cpfab.is-tucked .cpfab-tab { transform: translate(32px, -50%); }
/* Tucked, the strip still answers taps a little to its left (the empty page margin). */
.cpfab.is-tucked .cpfab-tab::before { content: ""; position: absolute; top: 0; bottom: 0; left: -14px; width: 14px; }
.cpfab-tab { transition: transform .22s cubic-bezier(.22, 1, .36, 1); }
.cpfab-dialog {
  width: min(100% - 2rem, 34rem); max-height: min(88vh, 52rem); margin: auto; padding: var(--space-5);
  border: 0; border-radius: var(--radius-xl); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg);
}
.cpfab-dialog::backdrop { background: var(--scrim); }
@media (max-width: 600px) {
  .cpfab-dialog { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: var(--space-4) var(--space-4) max(var(--space-5), env(safe-area-inset-bottom, 0px)); }
}
.cpfab-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.cpfab-head h2 { font-family: var(--display); font-size: 1.5rem; margin: 0; }
.cpfab-head p { margin: var(--space-1) 0 0; color: var(--muted); }
.cpfab-close { flex-shrink: 0; width: 44px; height: 44px; margin: -6px -10px 0 0; border: 0; border-radius: var(--radius-full); background: none; font-size: 1.75rem; line-height: 1; color: var(--muted); cursor: pointer; }
.cpfab-close:hover { background: var(--sunken); }
.cpfab-form { display: flex; gap: var(--space-2); }
.cpfab-form input { flex: 1; min-width: 0; min-height: 48px; padding: 0 var(--space-4); border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--card); color: var(--ink); font: inherit; font-size: 1rem; }
.cpfab-form input:focus { outline: none; border-color: var(--primary); }
.cpfab-form input[aria-invalid="true"] { border-color: var(--danger); }
.cpfab-dir { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: var(--space-3); border-radius: var(--radius-lg); background: var(--sunken); }
.cpfab-dir button { min-height: 44px; border: 0; border-radius: var(--radius-md); background: none; font: 700 0.9375rem var(--body); color: var(--muted); cursor: pointer; }
.cpfab-dir button[aria-checked="true"] { background: var(--card); color: var(--heading); box-shadow: var(--shadow-sm); }
.cpfab-dir button:focus-visible, .cpfab-mic:focus-visible, .cpfab-recent-word:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.cpfab-lang { width: 100%; min-height: 44px; margin-bottom: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 var(--space-3); font: 600 0.9375rem var(--body); background: var(--card); color: var(--ink); }
.cpfab-field { position: relative; flex: 1; min-width: 0; display: flex; }
.cpfab-field input { width: 100%; }
.cpfab-field input:has(+ .cpfab-mic:not([hidden])) { padding-right: 52px; }
.cpfab-mic { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: var(--radius-full); background: none; color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cpfab-mic.is-on { background: var(--ok); color: var(--on-ok); }
.cpfab-listening { margin: var(--space-2) 0 0; color: var(--ok-ink); font-weight: 600; }
.cpfab-recent { margin-top: var(--space-4); }
.cpfab-recent-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.cpfab-recent-word { min-height: 44px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-full); background: var(--card); font: 600 0.9375rem var(--body); color: var(--ink); cursor: pointer; }
.cpfab-error, .cpfab-error-inline { color: var(--danger-ink); font-weight: 600; margin: var(--space-3) 0 0; }
.cpfab-result { display: grid; gap: var(--space-3); margin-top: var(--space-4); }
.cpfab-result:empty { display: none; }
.cpfab-headline { background: var(--feature); color: var(--on-feature); border-radius: var(--radius-lg); padding: var(--space-4); }
.cpfab-headline p { color: var(--on-feature); }
.cpfab-kicker { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.cpfab-sentence { margin: var(--space-2) 0 0; font-size: 1.1875rem; font-weight: 600; line-height: 1.35; }
.cpfab-from { margin: var(--space-2) 0 0; font-size: 0.8125rem; opacity: 0.85; }
.cpfab-none { margin: var(--space-2) 0 0; }
.cpfab-dialog .cpfab-label { margin: var(--space-2) 0 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cpfab-langs { display: grid; gap: var(--space-2); }
.cpfab-lang-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-2) var(--space-3); }
.cpfab-say { width: 100%; min-height: 44px; display: flex; justify-content: space-between; align-items: center; border: 0; background: none; font: 700 1rem var(--body); color: var(--heading); cursor: pointer; text-align: left; }
.cpfab-arrow { font-size: 1.25rem; }
.cpfab-busy, .cpfab-note { margin: var(--space-2) 0; color: var(--muted); font-size: 0.9375rem; }
.cpfab-lang-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-1); }
.cpfab-lang-name { margin: 0; font-weight: 700; }
.cpfab-translation { margin: var(--space-2) 0 var(--space-1); font-size: 1.0625rem; line-height: 1.4; color: var(--ink); }
.cpfab-pill { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); }
.cpfab-pill--check { background: var(--warn-soft); color: var(--warn-ink); }
.cpfab-pill--ok { background: var(--ok-soft); color: var(--ok-ink); }
.cpfab-words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cpfab-words li { background: var(--sunken); border-radius: var(--radius-full); padding: 6px 12px; font-weight: 600; }
.cpfab-badge { font-weight: 400; font-size: 0.8125rem; color: var(--muted); }
.cpfab-more summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--primary); cursor: pointer; }
.cpfab-meaning { border-top: 1px solid var(--line); padding-top: var(--space-3); margin-top: var(--space-3); }
.cpfab-meaning-title { margin: 0; font-weight: 700; }
.cpfab-meaning-title span { font-weight: 600; color: var(--muted); font-size: 0.875rem; }
.cpfab-meaning-text { margin: var(--space-1) 0; white-space: pre-line; }
.cpfab-credit { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.cpfab-credit a { font-weight: 600; color: var(--primary); }
.cpfab-disclaimer { margin: 0; border-left: 3px solid var(--line); padding-left: var(--space-3); font-size: 0.8125rem; color: var(--muted); }
.cpfab-tools { display: inline-flex; min-height: 44px; align-items: center; margin-top: var(--space-3); font-weight: 700; color: var(--primary); }
@media (prefers-reduced-motion: reduce) { .cpfab-tab:active { transform: translateY(-50%); } .cpfab-tab { transition: none; animation: none; } }

/* ---------- Phone bridge (Call client) ---------- */
.call-box { display: grid; gap: var(--space-2); margin: var(--space-2) 0; }
.call-box form { margin: 0; }
.call-timed { margin: 0; font-weight: 700; color: var(--ok-ink); }
.call-state { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }
.call-state.is-live { background: var(--ok-soft); color: var(--ok-ink); }
.small { font-size: 0.875rem; }
.break { word-break: break-all; }

/* ---------- Payments by bank ---------- */
.plain-list { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.pay-note { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }
.pay-note.is-ok { background: var(--ok-soft); color: var(--ok-ink); }
.pay-note.is-bad { background: var(--danger-soft); color: var(--danger-ink); }
.pay-note p { margin: 0; }
.pay-note p + p { margin-top: var(--space-1); font-weight: 400; }
.bank-numbers { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
@media (min-width: 641px) { .payout-form-cell { min-width: 26rem; } }

/* Translation jobs: progress steps, file lists, option fieldsets */
fieldset.field { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
fieldset.field legend { font-weight: 700; margin-bottom: var(--space-2); padding: 0; }
.check-grid input[type="radio"] { border-radius: 50%; }
.steps { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0 0 var(--space-5); counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: var(--space-2); padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--line); font-size: 0.75rem; }
.steps li.done { background: var(--ok-soft); color: var(--ok-ink); }
.steps li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.steps li.now { background: var(--primary); color: var(--on-primary); }
.steps li.now::before { color: var(--ink); }
.file-list { list-style: none; padding: 0; margin: 0 0 var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }
.file-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.job-price { font-family: var(--display); font-size: 2.25rem; font-weight: 700; color: var(--heading); margin: var(--space-2) 0; font-variant-numeric: tabular-nums; }

/* Agreements: readable text and the signing box */
.agreement-text { max-width: 48rem; line-height: 1.65; }
.agreement-text h2 { font-size: 1.0625rem; margin-top: var(--space-5); }
.agreement-text ul { padding-left: 1.25rem; list-style: disc; margin-block: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.agreement-text p + p { margin-top: var(--space-3); }
.sign-card { max-width: 48rem; border: 2px solid var(--primary); }
.agreement-doc h2 { font-size: 1.0625rem; }

/* ---- Insights (admin/insights.php) --------------------------------------
   Chart colours from the dataviz reference palette (one series = blue,
   sequential blue ramp for the heatmap), validated on our card surfaces;
   dark mode has its own steps, not a flip. Text always uses text tokens. */
:root { --viz-series: #2a78d6; --viz-axis: #c3c2b7; --viz-heat-1: #cde2fb; --viz-heat-2: #9ec5f4; --viz-heat-3: #6da7ec; --viz-heat-4: #3987e5; --viz-heat-5: #1c5cab; }
@media (prefers-color-scheme: dark) {
  :root.theme-auto:not([data-theme="light"]) { --viz-series: #3987e5; --viz-axis: #3a4a6b; --viz-heat-1: #104281; --viz-heat-2: #1c5cab; --viz-heat-3: #2a78d6; --viz-heat-4: #5598e7; --viz-heat-5: #9ec5f4; }
}
:root[data-theme="dark"] { --viz-series: #3987e5; --viz-axis: #3a4a6b; --viz-heat-1: #104281; --viz-heat-2: #1c5cab; --viz-heat-3: #2a78d6; --viz-heat-4: #5598e7; --viz-heat-5: #9ec5f4; }

.ins-filters .field { min-width: 9rem; flex: 1 1 9rem; }
.ins-tabs { display: flex; gap: var(--space-1); overflow-x: auto; margin: 0 0 var(--space-5); padding-bottom: 2px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.ins-tabs a { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); color: var(--muted); font-weight: 700; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.ins-tabs a[aria-current="page"] { color: var(--heading); border-bottom-color: var(--primary); }
.ins-tiles { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); }
.ins-tiles > .ins-tile { margin: 0; }
.ins-tile { margin: 0; padding: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.ins-tile-label { color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.ins-tile-value { font-family: var(--display); font-size: clamp(1.375rem, 5vw, 1.75rem); font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.15; }
.ins-tile-sub { color: var(--muted); font-size: 0.8125rem; }
.ins-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8125rem; font-weight: 700; }
.ins-delta.is-good { color: var(--ok-ink); }
.ins-delta.is-bad { color: var(--danger-ink); }
.ins-delta.is-flat { color: var(--muted); }
.ins-bars { list-style: none; margin: var(--space-3) 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ins-bars li { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr auto; align-items: center; gap: var(--space-2); min-height: 28px; cursor: default; }
.ins-bar-name { font-size: 0.875rem; color: var(--ink); overflow-wrap: anywhere; }
.ins-bar-track { height: 16px; display: block; }
.ins-bar { display: block; height: 100%; background: var(--viz-series); border-radius: 0 4px 4px 0; min-width: 2px; }
.ins-bars li:hover .ins-bar { filter: brightness(1.12); }
.ins-bar-val { font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 3.5rem; }
.ins-cols { margin-top: var(--space-3); }
.ins-cols-plot { position: relative; height: 180px; margin-left: 2.75rem; }
.ins-cols-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.ins-cols-line.is-base { border-top-color: var(--viz-axis); }
.ins-cols-line .ins-tick { position: absolute; right: calc(100% + 6px); top: -0.6em; }
.ins-cols-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.ins-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.ins-colbar { display: block; width: min(24px, 60%); background: var(--viz-series); border-radius: 4px 4px 0 0; }
.ins-col:hover .ins-colbar { filter: brightness(1.12); }
.ins-cols-labels { display: flex; margin: 6px 0 0 2.75rem; }
.ins-cols-labels .ins-tick { flex: 1 1 0; text-align: center; }
.ins-tick { font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ins-chart-note { margin: var(--space-2) 0 0; font-size: 0.875rem; color: var(--muted); }
.ins-heat { display: grid; grid-template-columns: 2.5rem repeat(24, minmax(0, 1fr)); gap: 2px; margin-top: var(--space-3); }
.ins-heat-day, .ins-heat-hour { font-size: 0.75rem; color: var(--muted); }
.ins-heat-day { align-self: center; }
.ins-cell { display: block; height: clamp(8px, 2.4vw, 22px); border-radius: 2px; background: var(--sunken); }
.ins-cell.q1 { background: var(--viz-heat-1); } .ins-cell.q2 { background: var(--viz-heat-2); } .ins-cell.q3 { background: var(--viz-heat-3); }
.ins-cell.q4 { background: var(--viz-heat-4); } .ins-cell.q5 { background: var(--viz-heat-5); }
.ins-heat-key { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: var(--space-2); font-size: 0.75rem; color: var(--muted); }
.ins-heat-key .ins-cell { width: 14px; height: 14px; }
.ins-heat-key span:first-child { margin-right: 4px; } .ins-heat-key span:last-child { margin-left: 4px; }
@media (min-width: 641px) { .ins-table td, .ins-table th { white-space: nowrap; } }
.ins-csv { margin: var(--space-2) 0 var(--space-4); font-size: 0.875rem; }
.ins-csv a { display: inline-flex; align-items: center; min-height: 44px; }
.ins-tip { position: fixed; z-index: 60; pointer-events: none; max-width: 18rem; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--ink); color: var(--card); font-size: 0.8125rem; font-weight: 600; box-shadow: var(--shadow-md); }
@media (max-width: 640px) { .ins-cols-labels.is-dense .ins-tick:nth-child(odd) { visibility: hidden; } .ins-heat { grid-template-columns: 2rem repeat(24, minmax(0, 1fr)); gap: 1px; } .ins-cell { height: 9px; border-radius: 1px; } .ins-bars li { grid-template-columns: minmax(5rem, 38%) 1fr auto; } }
.client-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--space-3); }
.client-figures .stat-num { font-size: 1.5rem; }

/* HIPAA page, video rooms and the interpreter line */
.form-grid { display: grid; gap: 0 var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hipaa-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.hipaa-check { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: var(--space-3); align-items: start; }
.hipaa-check .pill { justify-self: start; }
.video-stage { position: relative; width: 100%; height: min(78vh, 760px); min-height: 420px; border-radius: var(--radius-md); overflow: hidden; background: #0b1220; border: 1px solid var(--line); }
.video-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.copy-field { display: flex; gap: var(--space-2); align-items: stretch; }
.copy-field .input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; }
.line-codes { columns: 2 12rem; column-gap: var(--space-5); margin: 0; padding: 0; list-style: none; }
.line-codes li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 6px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.line-codes .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
