/* VoCo browser app.

   One structure, two themes. Light is the default; dark applies when the device asks for it
   or when the person picks it in Account (data-theme on <html>).

   Every size, gap, radius and color below comes from the tokens in the first block. There
   are no stray literals: a new value means a new token, and a new token needs a reason.

   Color has a fixed meaning everywhere:
     blue   = actions, and the AI interpreter
     orange = the professional (human) interpreter
     green  = money added, success
     red    = end call, errors

   Tokens
     space    2, 4, 8, 16, 24, 32, 48. 12 only where 8 is cramped and 16 loose (see --s-12).
     type     caption 12/16, small 14/20, body 16/24, title 20/28, page 28/36, label 11/20
              uppercase. Display sizes for three things only: call timer, balance, counter display.
              Weights 400, 600, 700.
     radius   4 badges and marks, 8 controls and cards, 12 dialogs and sheets, full for the
              switch, the avatar, dots and the call mark.
     depth    cards are flat with a hairline. One soft two-layer shadow, only on what floats.
     controls 44 px on touch (48 primary, 56 for Start call and the call controls); 36 px with a
              mouse on a wide screen (40 primary, 48 large).
     motion   150 to 200 ms, one easing, only on changes that help orientation. Off under
              reduced motion.

   No inline styles anywhere (the Content-Security-Policy forbids them). Bars and meters are
   SVG with width attributes. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The other Inter subsets hold the letters of language names in the picker (Čeština,
   Русский, Ελληνικά, Tiếng Việt). The browser downloads one only when a page shows such a letter. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304,
    U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-greek.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* ---- Tokens ---- */

:root {
  color-scheme: light;

  /* Space */
  --s-2: 2px;
  --s-4: 4px;
  --s-8: 8px;
  /* 12 is used in three places only, where 8 is cramped and 16 loose: the side padding of
     inputs, chips and table cells; the gap between a mark and its text in rows and choices;
     the padding of a tile on a phone (metric tile, quick start tile, interpreter choice). */
  --s-12: 12px;
  --s-16: 16px;
  --s-24: 24px;
  --s-32: 32px;
  --s-48: 48px;

  /* Type */
  --fs-label: 11px;
  --lh-label: 20px;
  --fs-caption: 12px;
  --lh-caption: 16px;
  --fs-small: 14px;
  --lh-small: 20px;
  --fs-body: 16px;
  --lh-body: 24px;
  --fs-title: 20px;
  --lh-title: 28px;
  --fs-page: 28px;
  --lh-page: 36px;
  /* Controls, navigation and tables: body size on touch, small with a mouse on a wide screen. */
  --fs-ui: var(--fs-body);
  --lh-ui: var(--lh-body);
  /* Display: the balance, the call timer, the counter display. Nothing else. */
  --fs-balance: 48px;
  --lh-balance: 56px;
  --fs-timer: 72px;
  --fs-counter: clamp(32px, 6vw, 96px);
  --fs-counter-small: clamp(20px, 2.2vw, 32px);
  --w-regular: 400;
  --w-semibold: 600;
  --w-bold: 700;

  /* Radius */
  --r-4: 4px;
  --r-8: 8px;
  --r-12: 12px;
  --r-full: 999px;

  /* Control sizes on touch */
  --h-control: 44px;
  --h-primary: 48px;
  --h-large: 56px;
  --h-row: 56px;
  --h-nav: 52px;
  --nav-h: 65px;
  --mark: 40px;
  --mark-small: 32px;
  --icon-box: 24px;
  --icon: 20px;
  --bw: 1px;

  /* Layout */
  --sidebar: 232px;
  --content: 1320px;
  --measure: 640px;
  --sheet: 480px;
  --chart: 180px;
  --table-max: 70vh;
  --track-tight: -0.02em;
  --track-display: -0.03em;
  --track-caps: 0.04em;

  /* Motion */
  --t: 150ms;
  --t-slow: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Neutral scale, by role */
  --surface: #ffffff;
  /* The page: the surface itself on a phone, a tinted ground behind cards on a wide screen. */
  --ground: var(--surface);
  --ground-wide: #f6f7fa;
  --container: #f5f7fb;
  --hover: #eceff6;
  --hairline: #e3e7ef;
  --line: #79829a;
  --control-line: #c8cedb;
  --text: #101526;
  --text-2: #414a60;
  --text-3: #5a6278;

  /* One accent */
  --accent: #1f5bff;
  --accent-hover: #1a4de0;
  --accent-text: #1241c7;
  --accent-tint: #f1f5ff;
  --accent-line: #1f5bff;
  --on-accent: #ffffff;

  /* Pro: the logo's own orange with white text, the owner's choice for the brand look. White on
     this orange is 2.6:1, under the 3:1 guideline for large bold text, so the label is set bold
     to help. The same in both themes, so it is set once here. */
  --pro: #fc8008;
  --pro-hover: #ee7400;
  --pro-line: #ee7400;
  --on-pro: #ffffff;

  /* The professional interpreter */
  --human-text: #b9480d;
  --human-tint: #fff0e7;
  --human-line: #b9480d;
  --human-fill: #b9480d;

  /* Meaning: a text color, a tint and a border each */
  --success-text: #0b6b3a;
  --success-tint: #e7f6ec;
  --success-line: #a9d9bc;
  --attention-text: #8a4a00;
  --attention-tint: #fff3d6;
  --attention-line: #ecd08c;
  --critical-text: #b3261e;
  --critical-tint: #fdecea;
  --critical-line: #f0bcb7;
  --critical-fill: #c62828;
  --critical-fill-hover: #a31f1f;
  --info-text: #1241c7;
  --info-tint: #f1f5ff;
  --info-line: #bfcefa;

  /* Marks in bars, meters and the chart */
  --mark-ai: #1f5bff;
  --mark-human: #d9601f;
  --mark-good: #1a8a4f;
  --track: #dfe4ee;
  --skeleton: #e6e9f1;

  --focus: #0b2a8a;
  --focus-ring: rgba(31, 91, 255, 0.3);
  --backdrop: rgba(16, 21, 38, 0.5);
  --shadow-float: 0 1px 2px rgba(16, 21, 38, 0.08), 0 12px 32px rgba(16, 21, 38, 0.08);
}

/* Direction B. Written twice because one rule cannot be both inside and outside a media query. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface: #0d111d;
    --ground-wide: #070a12;
    --container: #171c2e;
    --hover: #1f2640;
    --hairline: #262d45;
    --line: #6b7594;
    --control-line: #3b4463;
    --text: #f2f4fa;
    --text-2: #b9c1d2;
    --text-3: #9aa3b8;
    --accent: #1f5bff;
    --accent-hover: #2d63ff;
    --accent-text: #8fb0ff;
    --accent-tint: #16224a;
    --accent-line: #6c98ff;
    --human-text: #ffab78;
    --human-tint: #3a2417;
    --human-line: #ffab78;
    --human-fill: #b9480d;
    --success-text: #5fd69a;
    --success-tint: #133224;
    --success-line: #1f5a3d;
    --attention-text: #f2c46d;
    --attention-tint: #3a2c10;
    --attention-line: #6b5220;
    --critical-text: #ff9a8f;
    --critical-tint: #3a1715;
    --critical-line: #7a2c27;
    --critical-fill: #d93a3a;
    --critical-fill-hover: #c22f2f;
    --info-text: #8fb0ff;
    --info-tint: #16224a;
    --info-line: #2c4590;
    --mark-ai: #5a86f5;
    --mark-human: #dc7430;
    --mark-good: #3fb97c;
    --track: #2a3147;
    --skeleton: #1f2640;
    --focus: #b3c9ff;
    --focus-ring: rgba(108, 152, 255, 0.4);
    --backdrop: rgba(3, 5, 10, 0.7);
    --shadow-float: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #0d111d;
  --control-line: #3b4463;
  --ground-wide: #070a12;
  --container: #171c2e;
  --hover: #1f2640;
  --hairline: #262d45;
  --line: #6b7594;
  --text: #f2f4fa;
  --text-2: #b9c1d2;
  --text-3: #9aa3b8;
  --accent: #1f5bff;
  --accent-hover: #2d63ff;
  --accent-text: #8fb0ff;
  --accent-tint: #16224a;
  --accent-line: #6c98ff;
  --human-text: #ffab78;
  --human-tint: #3a2417;
  --human-line: #ffab78;
  --human-fill: #b9480d;
  --success-text: #5fd69a;
  --success-tint: #133224;
  --success-line: #1f5a3d;
  --attention-text: #f2c46d;
  --attention-tint: #3a2c10;
  --attention-line: #6b5220;
  --critical-text: #ff9a8f;
  --critical-tint: #3a1715;
  --critical-line: #7a2c27;
  --critical-fill: #d93a3a;
  --critical-fill-hover: #c22f2f;
  --info-text: #8fb0ff;
  --info-tint: #16224a;
  --info-line: #2c4590;
  --mark-ai: #5a86f5;
  --mark-human: #dc7430;
  --mark-good: #3fb97c;
  --track: #2a3147;
  --skeleton: #1f2640;
  --focus: #b3c9ff;
  --focus-ring: rgba(108, 152, 255, 0.4);
  --backdrop: rgba(3, 5, 10, 0.7);
  --shadow-float: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* A wide screen with a mouse: denser controls and 14 px for navigation, tables and controls.
   Decided by the pointer and the width, never by the browser's name. */
@media (min-width: 900px) and (pointer: fine) {
  :root {
    --fs-ui: var(--fs-small);
    --lh-ui: var(--lh-small);
    --h-control: 36px;
    --h-primary: 40px;
    --h-large: 48px;
    --h-row: 44px;
  }
}

@media (min-width: 900px) {
  :root {
    --ground: var(--ground-wide);
    --fs-timer: clamp(96px, 10vw, 144px);
    --sheet: 560px;
  }
}

/* ---- Base ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Keyboard focus never lands under the bottom bar or the anchored Start call. */
  scroll-padding-bottom: calc(var(--nav-h) + var(--s-48) * 3);
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-regular);
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#usage-chart:empty {
  display: none;
}

#root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-bold);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-page);
  line-height: var(--lh-page);
  letter-spacing: var(--track-tight);
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol,
dl,
dd,
figure,
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

ul {
  list-style: none;
}

legend {
  padding: 0;
}

a {
  color: var(--accent-text);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a,
label,
summary,
select {
  touch-action: manipulation;
}

/* Focus: a crisp line that meets contrast, inside a soft ring in the accent color. Never
   removed from a control. Controls that draw focus on a wrapper are listed here too. */
:focus-visible,
.search:focus-within,
.mode:has(input:focus-visible),
.segment:has(input:focus-visible),
.check input:focus-visible + .check-box {
  outline: var(--s-2) solid var(--focus);
  outline-offset: var(--s-2);
  box-shadow: 0 0 0 var(--s-4) var(--focus-ring);
}

/* The text field inside a search frame: the frame shows the focus. Headings and the main
   region receive focus from script when a screen changes; they are not controls. */
.search .search-input:focus-visible,
.screen-heading:focus,
.content-title:focus,
.room-status:focus,
.rating-thanks:focus,
main:focus {
  outline: none;
  box-shadow: none;
}

/* Selected: the same treatment for every choice. The professional interpreter sets its own color. */
.mode.is-on,
.pack.is-on,
.chip.is-on,
.segment.is-on,
.tile.is-current {
  border-color: var(--sel-line, var(--accent-line));
  background: var(--sel-tint, var(--accent-tint));
  box-shadow: 0 0 0 var(--bw) var(--sel-line, var(--accent-line));
}

/* What floats above the page, and nothing else, has a shadow. */
.modal,
.menu,
.toast {
  box-shadow: var(--shadow-float);
}

/* Read by screen readers, not shown. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: var(--s-8);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  min-height: var(--h-control);
  padding: 0 var(--s-16);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--accent-text);
  font-weight: var(--w-semibold);
}

.skip:focus {
  left: var(--s-8);
}

.icon {
  flex: none;
  display: block;
}

/* The small uppercase label, for short group labels only. */
.eyebrow {
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  font-weight: var(--w-semibold);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--text-3);
}

.lead {
  color: var(--text-2);
}

.hint,
.bad-text {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.hint,
.muted,
.optional {
  color: var(--text-3);
}

.bad-text {
  color: var(--critical-text);
  font-weight: var(--w-semibold);
}

.optional {
  font-weight: var(--w-regular);
}

.support-address {
  color: var(--text);
  font-weight: var(--w-semibold);
  overflow-wrap: anywhere;
  user-select: all;
}

.is-credit {
  color: var(--success-text);
}

/* Numbers that are compared line by line. */
.num,
.row-amount,
.mode-rate,
.check-price,
.credit-chip,
.nav-credit-amount,
.balance,
.detail-amount,
.metric-value,
.stat-value,
.timer-value,
.counter-clock,
.totals,
.summary dd,
.pack {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Logo ---- */

.logo-tile {
  display: inline-flex;
}

.logo {
  display: block;
  height: var(--s-32);
  width: auto;
}

/* ---- Buttons. Secondary is the default; a view has one primary. ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  min-height: var(--h-control);
  padding: 0 var(--s-16);
  border: var(--bw) solid var(--control-line);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  font-weight: var(--w-semibold);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}

.btn:hover {
  border-color: var(--line);
  background: var(--hover);
}

.btn-primary {
  min-height: var(--h-primary);
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

/* The Go Pro button. Second to the page's primary action in order, not in visibility. */
.btn-pro {
  min-height: var(--h-primary);
  border-color: var(--pro-line);
  background: var(--pro);
  color: var(--on-pro);
  font-weight: var(--w-bold);
}

.btn-pro:hover {
  border-color: var(--pro-line);
  background: var(--pro-hover);
}

.btn-quiet {
  padding: 0 var(--s-8);
  border-color: transparent;
  background: none;
  color: var(--accent-text);
}

.btn-danger {
  border-color: var(--critical-fill);
  background: var(--critical-fill);
  color: var(--on-accent);
}

.btn-danger:hover {
  border-color: var(--critical-fill-hover);
  background: var(--critical-fill-hover);
}

.btn-critical {
  border-color: var(--critical-text);
  color: var(--critical-text);
}

.btn-critical:hover {
  background: var(--critical-tint);
}

.btn.is-pressed {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

/* Start call and the call controls. */
.btn-lg {
  min-height: var(--h-large);
  padding: 0 var(--s-24);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-bold);
}

.btn-block {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  border-color: var(--hairline);
  background: var(--container);
  color: var(--text-3);
  cursor: not-allowed;
}

/* Shown inside a button while its request runs. It appears after a short delay, so a fast
   answer does not flash it. */
.spinner {
  flex: none;
  width: var(--s-16);
  height: var(--s-16);
  border: var(--s-2) solid currentColor;
  border-right-color: transparent;
  border-radius: var(--r-full);
  animation: spin 0.8s linear infinite, appear 0s linear 250ms both;
}

.icon-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--h-control);
  height: var(--h-control);
  border: 0;
  border-radius: var(--r-8);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--h-control);
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-4);
  background: none;
  color: var(--accent-text);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
  text-decoration: underline;
  text-underline-offset: var(--s-4);
  cursor: pointer;
}

.link:hover {
  color: var(--text);
}

/* A link inside a sentence. It keeps the line height of the text around it. */
.text-link {
  color: var(--accent-text);
  font-weight: var(--w-semibold);
  text-decoration: underline;
  text-underline-offset: var(--s-4);
}

.text-link:hover {
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
}

/* ---- Chips: small toggle buttons ---- */

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8);
}

.chips-label {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-3);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--h-control);
  padding: 0 var(--s-12);
  border: var(--bw) solid var(--control-line);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.chip:hover {
  background: var(--hover);
}

.chip-accent,
.chip.is-on {
  color: var(--accent-text);
}

/* ---- Status badges: a soft tint with a word, sentence case ---- */

.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: var(--s-4);
  padding: var(--s-2) var(--s-8);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-4);
  background: var(--container);
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: var(--w-semibold);
  white-space: nowrap;
}

.badge-success {
  border-color: var(--success-line);
  background: var(--success-tint);
  color: var(--success-text);
}

.badge-attention {
  border-color: var(--attention-line);
  background: var(--attention-tint);
  color: var(--attention-text);
}

.badge-critical {
  border-color: var(--critical-line);
  background: var(--critical-tint);
  color: var(--critical-text);
}

.badge-info {
  border-color: var(--info-line);
  background: var(--info-tint);
  color: var(--info-text);
}

/* ---- Marks: a small square that says what kind of thing a row or choice is ---- */

.glyph {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--mark);
  height: var(--mark);
  border-radius: var(--r-8);
}

.glyph-sm {
  width: var(--mark-small);
  height: var(--mark-small);
}

.glyph-ai {
  background: var(--accent-tint);
  color: var(--accent-text);
}

.glyph-human {
  background: var(--human-tint);
  color: var(--human-text);
}

.glyph-credit,
.glyph-done {
  background: var(--success-tint);
  color: var(--success-text);
}

/* ---- Forms ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

label,
legend {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  min-height: var(--h-control);
  padding: var(--s-4) var(--s-12);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-8);
  background-color: var(--surface);
  color: var(--text);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  transition: border-color var(--t) var(--ease);
}

textarea {
  min-height: var(--s-48);
  padding: var(--s-8) var(--s-12);
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text-3);
}

input[aria-invalid="true"] {
  border-color: var(--critical-text);
}

input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.select {
  position: relative;
}

.select select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--s-32);
  text-overflow: ellipsis;
  cursor: pointer;
}

.select select:disabled {
  border-color: var(--hairline);
  background-color: var(--container);
  color: var(--text-3);
  cursor: not-allowed;
}

.select .icon {
  position: absolute;
  right: var(--s-8);
  top: 0;
  bottom: 0;
  margin: auto 0;
  color: var(--text-3);
  pointer-events: none;
}

/* A search field: icon, input, clear button in one frame. */
.search {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  min-height: var(--h-control);
  padding: 0 var(--s-4) 0 var(--s-12);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--text-3);
  transition: border-color var(--t) var(--ease);
}

.search .search-input {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

/* The clear button fills the height of the frame, so it is a full-size target. */
.search .icon-btn {
  align-self: stretch;
  width: var(--h-control);
  height: auto;
  margin: calc(var(--bw) * -1) calc(var(--s-4) * -1) calc(var(--bw) * -1) 0;
}

/* Checkbox drawn by us: the real input is kept for the keyboard and screen readers. */
.check {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-12);
  min-height: var(--h-control);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-regular);
  cursor: pointer;
}

.check input {
  position: absolute;
  opacity: 0;
  width: var(--icon-box);
  height: var(--icon-box);
  margin: 0;
}

.check-box {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--icon-box);
  height: var(--icon-box);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-4);
  background: var(--surface);
  color: transparent;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.check:hover .check-box {
  border-color: var(--text);
}

.check input:not(:checked) + .check-box > * {
  visibility: hidden;
}

.check input:checked + .check-box {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.check-label {
  flex: 1;
}

.check-price {
  color: var(--text-3);
}

/* The track is 24 px tall. The button around it is a full-size target. */
.switch {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  width: var(--s-48);
  height: var(--h-control);
  padding: 0 var(--s-2);
  border: 0;
  border-radius: var(--r-full);
  background: none;
  cursor: pointer;
}

.switch::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  height: var(--s-24);
  margin: auto 0;
  border-radius: var(--r-full);
  background: var(--line);
  transition: background-color var(--t) var(--ease);
}

.switch-thumb {
  position: relative;
  width: var(--icon);
  height: var(--icon);
  border-radius: var(--r-full);
  background: var(--on-accent);
  transition: transform var(--t) var(--ease);
}

.switch[aria-checked="true"]::before {
  background: var(--accent);
}

.switch[aria-checked="true"] .switch-thumb {
  transform: translateX(var(--s-24));
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.segmented-field {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-8);
  max-width: var(--sheet);
}

.segment {
  display: grid;
  place-items: center;
  min-height: var(--h-control);
  border: var(--bw) solid var(--control-line);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.segment:hover {
  background: var(--hover);
}

.segment.is-on {
  color: var(--accent-text);
}

/* ---- Messages that stay: notices ---- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
  padding: var(--s-8) var(--s-8) var(--s-8) var(--s-16);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
  background: var(--container);
  color: var(--text);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.notice > .icon {
  margin-top: var(--s-8);
}

.notice-text {
  flex: 1;
  min-width: 0;
  align-self: center;
  padding: var(--s-4) 0;
}

.notice-good {
  border-color: var(--success-line);
  background: var(--success-tint);
}

.notice-good > .icon {
  color: var(--success-text);
}

.notice-info {
  border-color: var(--info-line);
  background: var(--info-tint);
}

.notice-info > .icon {
  color: var(--info-text);
}

.notice-bad {
  border-color: var(--critical-line);
  background: var(--critical-tint);
}

.notice-bad > .icon {
  color: var(--critical-text);
}

/* ---- Messages that pass: a toast for a small confirmation ---- */

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + var(--s-16) + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  justify-content: center;
  padding: 0 var(--s-16);
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: var(--h-control);
  padding: var(--s-8) var(--s-16);
  border-radius: var(--r-8);
  background: var(--text);
  color: var(--surface);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
  pointer-events: auto;
  animation: rise var(--t-slow) var(--ease);
}

/* ---- Loading placeholders. They wait a moment before showing, so a fast answer does not flash. ---- */

.skeleton {
  display: block;
  border-radius: var(--r-4);
  background: var(--skeleton);
  animation: appear 0s linear 200ms both, breathe 1.2s var(--ease) 200ms infinite alternate;
}

.skeleton-line {
  height: var(--lh-caption);
  width: 100%;
}

.skeleton-short,
.skeleton-number {
  display: inline-block;
  height: var(--lh-caption);
  width: var(--s-48);
  vertical-align: middle;
}

.skeleton-short {
  width: calc(var(--s-48) * 2);
}

.skeleton-title {
  height: var(--lh-page);
  width: 60%;
}

.skeleton-block {
  height: calc(var(--s-48) * 2);
  width: 100%;
}

.skeleton-row {
  height: var(--h-row);
  width: 100%;
}

.loading-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

@keyframes appear {
  from {
    opacity: 0;
  }
}

@keyframes breathe {
  to {
    opacity: 0.5;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(var(--s-16));
  }
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateX(var(--s-16));
  }
}

/* ---- Bars and meters (SVG) ---- */

.bar,
.level {
  display: block;
}

.bar-track {
  fill: var(--track);
}

.bar-blue .bar-fill,
.level-blue .bar-fill {
  fill: var(--mark-ai);
}

.bar-orange .bar-fill,
.level-orange .bar-fill {
  fill: var(--mark-human);
}

.bar-good .bar-fill,
.level-good .bar-fill {
  fill: var(--mark-good);
}

.bar-bad .bar-fill {
  fill: var(--critical-fill);
}

/* ---- Panels. Flat; on a wide screen a card with a hairline. ---- */

.panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-16);
}

.panel-title,
.picker-title,
.sub-title {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-bold);
}

/* Nothing to show yet: what is missing, when it appears, one next step. */
.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-8);
  padding: var(--s-24) 0;
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.empty-title {
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-bold);
}

.empty .btn {
  margin-top: var(--s-8);
}

/* Metrics: a label, a value, one line of context. On a phone they are rows in one frame, so
   no line wraps; from 600 px they are tiles, at most three in a row. */
.metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
  background: var(--surface);
}

.metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--s-12);
  min-width: 0;
  padding: var(--s-8) var(--s-12);
}

.metric + .metric {
  border-top: var(--bw) solid var(--hairline);
}

.metric-label,
.metric-context {
  grid-column: 1;
}

.metric-value {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.metric-label,
.metric-context,
.stat-label,
.mode-per,
.chart-caption,
.chart-axis,
.picker-count {
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--text-3);
}

.metric-label {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.metric-value {
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: var(--w-bold);
}

/* ---- App frame ---- */

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--s-16);
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: var(--s-4) var(--s-8) calc(var(--s-8) + env(safe-area-inset-bottom, 0px));
  border-top: var(--bw) solid var(--hairline);
  background: var(--surface);
}

.nav-logo,
.nav-foot {
  display: none;
}

.nav-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--h-nav);
  border-radius: var(--r-8);
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-decoration: none;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

.nav-item:hover {
  color: var(--text);
}

.nav-item[aria-current="page"] {
  color: var(--accent-text);
  font-weight: var(--w-semibold);
}

/* A page of a section. Every section starts with the same header: title, one line, one action. */
.page {
  display: flex;
  flex-direction: column;
  gap: var(--s-24);
  padding: var(--s-24) 0 var(--s-32);
  animation: appear var(--t) var(--ease);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-8) var(--s-16);
}

.page-head-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.page-head-action {
  align-self: flex-end;
}

.page-desc {
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  overflow-wrap: anywhere;
}

/* ---- Call: the launcher ---- */

.console {
  flex: 1;
  gap: var(--s-16);
  padding-top: 0;
  padding-bottom: 0;
}

.call-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  padding-top: var(--s-16);
}

.credit-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: var(--h-control);
  padding: 0 var(--s-12);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
  background: var(--container);
  color: var(--text);
  font-weight: var(--w-semibold);
  text-decoration: none;
  transition: background-color var(--t) var(--ease);
}

.credit-chip:hover {
  background: var(--hover);
}

.credit-chip .icon {
  color: var(--accent-text);
}

.launcher {
  flex: 1;
  gap: var(--s-16);
}

.quick,
.console > .ready,
.recent-calls {
  display: none;
}

.callout {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-8) var(--s-16);
  border: var(--bw) solid var(--success-line);
  border-radius: var(--r-8);
  background: var(--success-tint);
  color: var(--text);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  text-decoration: none;
}

.callout > .icon {
  color: var(--success-text);
}

.callout-link {
  color: var(--accent-text);
  font-weight: var(--w-semibold);
  text-decoration: underline;
  text-underline-offset: var(--s-4);
}

.launch-language {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.lang-field {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  width: 100%;
  min-height: var(--h-large);
  padding: var(--s-4) var(--s-16);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.lang-field:hover {
  border-color: var(--text);
  background: var(--container);
}

.lang-field > .icon {
  color: var(--text-3);
}

.lang-field-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lang-field-name,
.mode-title,
.row-title,
.option-name,
.room-mode {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-semibold);
}

.lang-field-native,
.mode-desc,
.mode-cover,
.row-detail,
.option-native,
.room-pair,
.auto-desc,
.phrase-english {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.lang-field-change {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
  color: var(--accent-text);
}

/* On a phone the recent languages stay on one line and scroll sideways inside it, so they
   never push the interpreter choice down. The page itself does not scroll sideways. */
.launch-language .chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: calc(var(--s-4) * -1) calc(var(--s-16) * -1);
  padding: var(--s-4) var(--s-16);
  scrollbar-width: none;
}

.launch-language .chips::-webkit-scrollbar {
  display: none;
}

.launch-language .chips > * {
  flex: none;
  white-space: nowrap;
}

.modes {
  display: flex;
  flex-direction: column;
}

.modes > legend {
  margin-bottom: var(--s-4);
}

.modes-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.mode {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-12) var(--s-16);
  border: var(--bw) solid var(--control-line);
  border-radius: var(--r-8);
  background: var(--surface);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-regular);
  cursor: pointer;
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}

.mode:hover {
  border-color: var(--text);
}

.mode-human {
  --sel-line: var(--human-line);
  --sel-tint: var(--human-tint);
}

.mode-ai.is-on .glyph {
  background: var(--accent);
  color: var(--on-accent);
}

.mode-human.is-on .glyph {
  background: var(--human-fill);
  color: var(--on-accent);
}

.mode.is-off {
  border-color: var(--hairline);
  background: var(--container);
  cursor: not-allowed;
}

.mode.is-off .glyph {
  opacity: 0.5;
}

.mode.is-off .mode-title,
.mode.is-off .mode-desc {
  color: var(--text-3);
}

.mode-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mode-cover.is-short {
  color: var(--critical-text);
  font-weight: var(--w-semibold);
}

.mode-price {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.mode-rate {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-bold);
}

/* The main action stays on screen above the bottom bar while the choices scroll under it. */
.dock {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding: var(--s-8) 0;
  border-top: var(--bw) solid var(--hairline);
  background: var(--ground);
}

.dock-messages {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.dock-messages:empty {
  display: none;
}

/* The messages sit in the page, right above the bar. They take the spare height with them. */
.launcher > .dock-messages {
  margin-top: auto;
}

.launcher > .dock-messages:not(:empty) + .dock {
  margin-top: 0;
}

.dock-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8) var(--s-16);
}

.dock-reminder {
  text-align: center;
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-3);
}

.dock-reminder-more {
  display: none;
}

/* ---- Dialogs. A bottom sheet on phones, a centered dialog on wider screens. ---- */

.modal {
  padding: 0;
  border: var(--bw) solid var(--hairline);
  max-width: none;
  max-height: none;
  background: var(--surface);
  color: var(--text);
  overscroll-behavior: contain;
}

.modal::backdrop {
  background: var(--backdrop);
}

.picker {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0;
  width: 100%;
  height: 88vh;
  height: 88dvh;
  border-radius: var(--r-12) var(--r-12) 0 0;
  overflow: hidden;
}

.picker[open] {
  display: flex;
  flex-direction: column;
  animation: rise var(--t-slow) var(--ease);
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  padding: var(--s-8) var(--s-8) 0 var(--s-16);
}

.picker-title:focus {
  outline: none;
}

.picker > .search {
  margin: var(--s-4) var(--s-16) 0;
}

/* "I don't know", first under the search box. */
.picker-unknown {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-16);
  padding: var(--s-8) var(--s-16) 0;
}

.picker-count {
  padding: var(--s-8) var(--s-16) var(--s-4);
}

.picker-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--s-8) var(--s-8);
}

.picker-group-name {
  padding: var(--s-8) var(--s-8) 0;
}

.option {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  min-height: var(--h-control);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-8);
  border-radius: var(--r-8);
  cursor: pointer;
  scroll-margin: var(--s-8);
  content-visibility: auto;
  contain-intrinsic-size: auto var(--h-control);
}

.option.is-active {
  background: var(--hover);
  outline: var(--s-2) solid var(--focus);
  outline-offset: calc(var(--s-2) * -1);
}

.option[aria-selected="true"] .option-name,
.option-check {
  color: var(--accent-text);
}

.option-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--s-8);
}

.option-pin {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--h-control);
  height: var(--h-control);
  border-radius: var(--r-8);
  color: var(--text-3);
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

.option-pin:hover {
  background: var(--surface);
  color: var(--text);
}

.option-pin.is-pinned {
  color: var(--accent-text);
}

.option-pin.is-pinned .icon,
.tile-pin {
  fill: currentColor;
}

.picker-empty {
  padding: var(--s-8) var(--s-16) var(--s-16);
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.picker-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-8) var(--s-16);
  padding: var(--s-8) var(--s-16) calc(var(--s-8) + env(safe-area-inset-bottom, 0px));
  border-top: var(--bw) solid var(--hairline);
}

/* ---- Lists of calls and payments ---- */

.activity {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.rows > li + li {
  border-top: var(--bw) solid var(--hairline);
}

.rows > li {
  content-visibility: auto;
  contain-intrinsic-size: auto var(--h-row);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  width: 100%;
  min-height: var(--h-row);
  padding: var(--s-8) 0;
  border: 0;
  border-radius: var(--r-8);
  background: none;
  color: var(--text);
  text-align: left;
}

.row-button {
  cursor: pointer;
  transition: background-color var(--t) var(--ease);
}

.row-button:hover {
  background: var(--container);
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.row-detail,
.option-native,
.room-pair {
  color: var(--text-3);
}

.row-amount {
  flex: none;
  font-weight: var(--w-semibold);
}

.row-chevron {
  color: var(--text-3);
}

/* ---- History ---- */

.usage-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-24);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
}

.swatch {
  width: var(--s-8);
  height: var(--s-8);
  border-radius: var(--s-2);
}

.swatch-ai {
  background: var(--mark-ai);
}

.swatch-human {
  border: var(--s-2) solid var(--mark-human);
  background: var(--surface);
}

.chart {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  min-width: 0;
}

.chart-caption,
.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: var(--s-16);
}

.chart-svg {
  display: block;
  width: 100%;
  height: var(--chart);
}

.chart-ai {
  fill: var(--mark-ai);
}

.chart-human {
  fill: var(--surface);
  stroke: var(--mark-human);
  stroke-width: var(--s-2);
}

.chart-hit {
  fill: transparent;
}

.chart-svg g:hover .chart-hit {
  fill: var(--track);
  fill-opacity: 0.4;
}

.chart-base {
  fill: var(--hairline);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.toolbar-fields {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--s-8);
}

.totals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-16);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
  white-space: normal;
}

.totals strong {
  color: var(--text);
  font-weight: var(--w-semibold);
}

.totals strong.is-credit {
  color: var(--success-text);
}

.more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-8);
}

.more-end {
  text-align: center;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
}

.table th,
.table td {
  height: var(--h-row);
  padding: var(--s-4) var(--s-12);
  text-align: left;
  vertical-align: middle;
}

/* The header stays in view while the rows scroll inside the panel. */
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: var(--h-control);
  border-bottom: var(--bw) solid var(--hairline);
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: var(--w-semibold);
  white-space: nowrap;
}

.table tbody td,
.table tbody th {
  border-bottom: var(--bw) solid var(--hairline);
}

.table tbody tr {
  cursor: pointer;
  transition: background-color var(--t) var(--ease);
}

.table tbody tr:hover {
  background: var(--container);
}

.table tbody tr.is-open {
  background: var(--accent-tint);
}

.table .num {
  text-align: right;
}

.table .amount {
  font-weight: var(--w-semibold);
}

.table-plain tbody tr {
  cursor: default;
}

.table-plain tbody tr:hover {
  background: none;
}

.table-plain tbody th {
  font-weight: var(--w-regular);
}

.table-plain td.num {
  font-weight: var(--w-semibold);
}

/* The sort mark is always there, so choosing a column does not move anything. */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--s-24);
  margin: 0 calc(var(--s-4) * -1);
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-4);
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.th-sort:hover,
.table th[aria-sort="ascending"] .th-sort,
.table th[aria-sort="descending"] .th-sort {
  color: var(--text);
}

.th-sort .icon {
  opacity: 0.5;
}

.table th[aria-sort="ascending"] .th-sort .icon,
.table th[aria-sort="descending"] .th-sort .icon {
  opacity: 1;
}

.cell-open {
  min-height: var(--s-24);
  padding: 0;
  border: 0;
  border-radius: var(--r-4);
  background: none;
  color: var(--text);
  font-weight: var(--w-semibold);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.cell-open:hover {
  color: var(--accent-text);
}

.cell-kind {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  white-space: nowrap;
}

.cell-kind .glyph {
  width: var(--icon-box);
  height: var(--icon-box);
  border-radius: var(--r-4);
}

.cell-kind .glyph .icon {
  width: var(--s-16);
  height: var(--s-16);
}

/* The receipt: a full page on a phone, a drawer on the right on wider screens. */
.drawer {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  padding: var(--s-16);
  border-width: 0;
  overflow-y: auto;
}

.drawer[open] {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
  animation: appear var(--t-slow) var(--ease);
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: var(--s-12);
}

.drawer-title,
.content-title,
.about h2 {
  flex: 1;
  font-size: var(--fs-title);
  line-height: var(--lh-title);
}

.detail-amount {
  font-size: var(--fs-page);
  line-height: var(--lh-page);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-tight);
}

.detail-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8);
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.reference {
  overflow-wrap: anywhere;
  white-space: normal;
  user-select: all;
}

.summary,
.facts {
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
}

.summary > div,
.facts > div {
  display: flex;
  justify-content: space-between;
  gap: var(--s-16);
  padding: var(--s-8) 0;
  border-top: var(--bw) solid var(--hairline);
}

.summary > div:first-child {
  border-top: 0;
}

.summary dt,
.facts dt {
  color: var(--text-3);
}

.summary dd,
.facts dd {
  min-width: 0;
  font-weight: var(--w-semibold);
  text-align: right;
}

/* ---- Wallet ---- */

.wallet-columns,
.wallet-main,
.wallet-side {
  display: flex;
  flex-direction: column;
  gap: var(--s-24);
  min-width: 0;
}

.balance-panel {
  gap: 0;
}

.balance {
  font-size: var(--fs-balance);
  line-height: var(--lh-balance);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-display);
}

.balance .skeleton-title {
  height: var(--lh-balance);
  width: 50%;
}

.balance-none {
  font-size: var(--fs-title);
  line-height: var(--lh-balance);
  letter-spacing: 0;
  color: var(--text-3);
}

.balance-cover {
  margin-top: var(--s-4);
  color: var(--text-2);
}

.packs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-8);
}

.pack {
  min-height: var(--h-primary);
  border: var(--bw) solid var(--control-line);
  border-radius: var(--r-8);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}

.pack:hover {
  background: var(--hover);
}

.pack.is-on {
  color: var(--accent-text);
}

.pack:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.pack-note,
.trust-line,
.warn-line {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.pack-note > .icon,
.trust-line > .icon,
.warn-line > .icon {
  margin-top: var(--s-2);
}

.pack-note > .icon {
  color: var(--info-text);
}

.trust-line {
  color: var(--text-3);
}

.trust-line > .icon {
  color: var(--success-text);
}

.warn-line {
  padding: var(--s-8) var(--s-16);
  border: var(--bw) solid var(--critical-line);
  border-radius: var(--r-8);
  background: var(--critical-tint);
  color: var(--text);
  font-weight: var(--w-semibold);
}

.warn-line > .icon {
  color: var(--critical-text);
}

.card-off {
  padding: var(--s-8) var(--s-16);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
  background: var(--container);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.auto,
.free,
.rating,
.money {
  padding: var(--s-16);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
  background: var(--container);
}

.auto,
.free {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.pro {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.pro-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-8);
}

.pro-price {
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
}

.pro-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.pro-list > li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
}

.pro-list > li > .icon {
  flex: none;
  margin-top: var(--s-4);
  color: var(--success-text);
}

.auto-row {
  display: flex;
  align-items: center;
  gap: var(--s-16);
}

.auto-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.auto-setup {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
  padding-top: var(--s-16);
  border-top: var(--bw) solid var(--hairline);
}

.choice {
  display: flex;
  flex-direction: column;
}

.choice > legend,
.reasons > legend {
  margin-bottom: var(--s-8);
}

.auto-explain {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.card-brand {
  text-transform: capitalize;
}

.free {
  border-color: var(--success-line);
  background: var(--success-tint);
}

.free.is-done {
  flex-direction: row;
  align-items: center;
  gap: var(--s-8);
  font-weight: var(--w-semibold);
}

.free.is-done > .icon {
  color: var(--success-text);
}

/* ---- Account ---- */

.account-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s-24);
}

.subnav {
  display: flex;
  flex-direction: column;
}

.subnav ul > li + li {
  border-top: var(--bw) solid var(--hairline);
}

.subnav-item {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  min-height: var(--h-row);
  padding: 0 var(--s-4);
  border-radius: var(--r-8);
  color: var(--text);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  text-decoration: none;
  transition: background-color var(--t) var(--ease);
}

.subnav-item:hover {
  background: var(--container);
}

.subnav-item > .icon {
  color: var(--text-3);
}

.subnav-item > span {
  flex: 1;
}

.subnav-item.is-danger,
.subnav-item.is-danger > .icon:first-child {
  color: var(--critical-text);
}

/* On a phone the list and the open subsection are two screens. */
.account.has-sub .subnav,
.account:not(.has-sub) .account-content {
  display: none;
}

.account.has-sub .page-head-action {
  display: none;
}

/* In a subsection the page header stays for screen readers; the back link shows instead. */
.account.has-sub .page-head,
.wallet .page-head {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  align-self: flex-start;
  min-height: var(--h-control);
  color: var(--accent-text);
  font-weight: var(--w-semibold);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.account-content > p,
.account-content > ol,
.account-content .form,
.account-content .qa-list {
  max-width: var(--measure);
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.form-status {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.form-status:empty {
  display: none;
}

.sub-title {
  margin-top: var(--s-8);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding-left: var(--s-24);
  list-style: decimal;
}

.steps li::marker {
  font-weight: var(--w-semibold);
  color: var(--text-3);
}

.copy-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8) var(--s-16);
}

.links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.qa-list {
  display: flex;
  flex-direction: column;
}

.qa {
  border-top: var(--bw) solid var(--hairline);
}

.qa:last-child {
  border-bottom: var(--bw) solid var(--hairline);
}

.qa summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  min-height: var(--h-row);
  padding: var(--s-8) 0;
  border-radius: var(--r-4);
  font-weight: var(--w-semibold);
  cursor: pointer;
  list-style: none;
}

.qa summary::-webkit-details-marker {
  display: none;
}

.qa summary .icon {
  color: var(--text-3);
  transition: transform var(--t) var(--ease);
}

.qa[open] summary .icon {
  transform: rotate(180deg);
}

.qa summary:hover {
  color: var(--accent-text);
}

.qa p {
  padding-bottom: var(--s-16);
  color: var(--text-2);
}

/* The sound check inside Account: its own heading is the page's. */
.account-content .ready .panel-head {
  display: none;
}

/* ---- Ready check ---- */

.status-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.status-line {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.status-line > .icon {
  margin-top: var(--s-2);
  color: var(--text-3);
}

.status-line.is-ok > .icon {
  color: var(--success-text);
}

.status-line.is-bad {
  color: var(--text);
}

.status-line.is-bad > .icon {
  color: var(--critical-text);
}

.ready-test {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-4) var(--s-16);
}

.ready-test .btn {
  white-space: nowrap;
}

.ready-meter {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

/* ---- Full-window screens: sign in, microphone step, failures, summary ---- */

.full {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.full-top {
  display: flex;
  justify-content: center;
  padding: var(--s-24) var(--s-16) 0;
}

.full-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--s-24) var(--s-16) var(--s-32);
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
  width: 100%;
  max-width: var(--sheet);
}

.sheet .actions {
  margin-top: var(--s-8);
}

.sheet .actions .btn {
  flex: 1 1 calc(var(--s-48) * 3);
}

.mark {
  display: grid;
  place-items: center;
  width: var(--h-large);
  height: var(--h-large);
  border-radius: var(--r-8);
}

.mark-ai {
  background: var(--accent-tint);
  color: var(--accent-text);
}

.mark-human {
  background: var(--human-tint);
  color: var(--human-text);
}

.mark-done {
  background: var(--success-tint);
  color: var(--success-text);
}

.mark-bad {
  background: var(--critical-tint);
  color: var(--critical-text);
}

.rating {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.rating-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
}

.rating-thanks {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  font-weight: var(--w-semibold);
}

.rating-thanks .icon {
  color: var(--success-text);
}

.thumbs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-8);
}

.rating-more {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-16);
}

.rating-more .field {
  width: 100%;
}

.reasons {
  display: flex;
  flex-direction: column;
}

/* Sign in */
.auth-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s-32);
  width: 100%;
  max-width: var(--sheet);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.auth-card .notice {
  margin: 0;
}

.pw-toggle {
  align-self: flex-start;
}

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-8);
}

.auth-new {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  width: 100%;
  padding-top: var(--s-16);
  border-top: var(--bw) solid var(--hairline);
}

.about {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
  padding: var(--s-24);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
  background: var(--container);
}

.about-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.about-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
}

.about-list .icon {
  margin-top: var(--s-2);
  color: var(--accent-text);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 var(--s-24);
  width: 100%;
  margin-top: var(--s-24);
  color: var(--text-3);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.foot > a {
  display: inline-flex;
  align-items: center;
  min-height: var(--h-control);
}

/* ---- The call room ---- */

.room {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
}

.room-main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--s-16) var(--s-16) 0;
}

/* On a phone the two areas dissolve into one column, ordered as in the drawing. */
.room-stage,
.room-side {
  display: contents;
}

.room-who {
  order: 0;
  display: flex;
  align-items: center;
  gap: var(--s-12);
  min-height: var(--h-control);
}

.room-who-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* The state. A page title in the middle while the call is being set up, a badge once connected. */
.room-status {
  order: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  text-align: center;
}

.room-status .dot {
  display: none;
}

.dot {
  flex: none;
  width: var(--s-8);
  height: var(--s-8);
  border-radius: var(--r-full);
  background: currentColor;
}

.room-connected .room-status {
  position: absolute;
  top: var(--s-24);
  right: var(--s-16);
  padding: var(--s-4) var(--s-8);
  border: var(--bw) solid var(--success-line);
  border-radius: var(--r-4);
  background: var(--success-tint);
  color: var(--success-text);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
  letter-spacing: 0;
}

.room-connected .room-status .dot {
  display: block;
}

.room-connected .room-who {
  padding-right: calc(var(--s-48) * 2 + var(--s-24));
}

.room-lost .room-status {
  border-color: var(--critical-line);
  background: var(--critical-tint);
  color: var(--critical-text);
}

/* The call mark: a ring that breathes while the call is being set up. This product's own sign. */
.room-pending {
  order: 1;
  display: grid;
  place-items: center;
  min-height: calc(var(--s-48) * 2);
  margin-top: var(--s-48);
}

.pulse {
  width: var(--h-large);
  height: var(--h-large);
  border: var(--s-2) solid var(--accent-line);
  border-radius: var(--r-full);
  background: var(--accent-tint);
  animation: pulse 1.8s ease-in-out infinite;
}

.room-human .pulse {
  border-color: var(--human-line);
  background: var(--human-tint);
}

.room-lost .pulse {
  border-color: var(--critical-text);
  background: var(--critical-tint);
}

@keyframes pulse {
  50% {
    transform: scale(0.82);
    opacity: 0.6;
  }
}

.room-detail {
  order: 3;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  text-align: center;
  color: var(--text-2);
}

.room-connected .room-detail {
  display: none;
}

.timer {
  order: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: var(--s-8);
}

.timer-value {
  font-size: var(--fs-timer);
  line-height: 1;
  font-weight: var(--w-bold);
  letter-spacing: var(--track-display);
}

.meters {
  order: 4;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.meter-row {
  display: grid;
  grid-template-columns: calc(var(--s-48) * 2) minmax(0, 1fr);
  align-items: center;
  gap: var(--s-8);
}

/* Who is making sound right now. One line; the dot takes the color of the speaker's meter. */
.activity-line {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  min-height: var(--lh-body);
  font-weight: var(--w-semibold);
  color: var(--text);
}

.activity-line .dot {
  flex: none;
  width: var(--s-8);
  height: var(--s-8);
  border-radius: var(--r-full);
  background: var(--track);
  transition: background-color var(--t) var(--ease);
}

.activity-idle {
  color: var(--text-2);
}

.activity-you .dot {
  background: var(--mark-good);
}

.activity-interpreter .dot {
  background: var(--mark-ai);
}

.activity-interpreter.activity-human .dot {
  background: var(--mark-human);
}

.meter-label {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
  color: var(--text-2);
}

.money {
  order: 5;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.money.is-low {
  border-color: var(--critical-text);
  background: var(--critical-tint);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-8);
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--w-bold);
}

.money-line {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  color: var(--text-2);
}

.money.is-low .money-line {
  color: var(--text);
  font-weight: var(--w-semibold);
}

.money.is-low .money-line .icon {
  margin-top: var(--s-2);
  color: var(--critical-text);
}

.phrase {
  order: 6;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-16);
  border: var(--bw) solid var(--hairline);
  border-radius: var(--r-8);
}

.phrase-text {
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: var(--w-semibold);
}

.phrase-english {
  color: var(--text-3);
}

.room-tools {
  order: 7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8) var(--s-16);
}

.room-tools > .hint {
  flex: 1;
  min-width: calc(var(--s-48) * 3);
}

/* Keyboard shortcuts are for the desktop room. */
.keys {
  display: none;
}

.muted-flag {
  order: 8;
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  padding: var(--s-8) var(--s-16);
  border-radius: var(--r-8);
  background: var(--text);
  color: var(--surface);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: var(--w-semibold);
}

.muted-flag .icon {
  margin-top: var(--s-2);
}

/* Mute on the left, End call on the right, well apart. Always on screen. */
.controls {
  order: 9;
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  padding: var(--s-8) 0 calc(var(--s-16) + env(safe-area-inset-bottom, 0px));
  background: var(--ground);
}

/* The view that faces the other person. */
.counter {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: var(--s-24);
  padding: clamp(var(--s-16), 4vw, var(--s-48));
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
  animation: appear var(--t-slow) var(--ease);
}

.counter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-8) var(--s-24);
}

.counter-state {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  font-size: var(--fs-counter-small);
  line-height: 1.25;
  font-weight: var(--w-semibold);
  color: var(--text-2);
}

.counter-state.is-live {
  color: var(--success-text);
}

.counter-clock {
  font-size: var(--fs-counter);
  line-height: 1;
  font-weight: var(--w-bold);
  letter-spacing: var(--track-display);
}

.counter-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-24);
  max-width: var(--content);
}

.counter-phrase {
  font-size: var(--fs-counter);
  line-height: 1.1;
  font-weight: var(--w-bold);
  letter-spacing: var(--track-tight);
  text-wrap: balance;
}

.counter-english,
.counter-muted {
  font-size: var(--fs-counter-small);
  line-height: 1.25;
  color: var(--text-3);
}

.counter-muted {
  font-weight: var(--w-semibold);
  color: var(--critical-text);
}

.counter-back {
  align-self: flex-start;
}

/* ---- First paint before the app starts (also what a reader without JavaScript gets) ---- */

.shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--s-32) var(--s-16);
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
}

.shell ul {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-left: var(--s-24);
  list-style: disc;
}

/* ---- Small phones: tighter, so more of the launcher is on the first screen ---- */

@media (max-width: 380px), (max-height: 700px) {
  :root {
    --fs-page: var(--fs-title);
    --lh-page: var(--lh-title);
    --fs-timer: var(--fs-balance);
  }

  .launcher,
  .console {
    gap: var(--s-8);
  }

  .call-top {
    padding-top: var(--s-8);
  }

  .mode {
    padding: var(--s-8) var(--s-12);
  }
}

/* ---- From 600 px: dialogs are centered, the receipt is a drawer ---- */

@media (min-width: 600px) {
  .main,
  .room-main {
    padding-left: var(--s-24);
    padding-right: var(--s-24);
  }

  .picker {
    inset: 0;
    margin: auto;
    width: var(--sheet);
    height: min(var(--measure), calc(100vh - var(--s-48)));
    border-radius: var(--r-12);
  }

  .picker[open] {
    animation: appear var(--t-slow) var(--ease);
  }

  .drawer {
    inset: 0 0 0 auto;
    width: calc(var(--sheet) - var(--s-48));
    padding: var(--s-24);
    border-width: 0 0 0 var(--bw);
    border-radius: var(--r-12) 0 0 var(--r-12);
  }

  .drawer[open] {
    animation: slide var(--t-slow) var(--ease);
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-8);
    border: 0;
    border-radius: 0;
    background: none;
  }

  .metrics-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics > .metric {
    display: flex;
    flex-direction: column;
    padding: var(--s-12);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-8);
    background: var(--surface);
  }

  .toolbar-fields {
    grid-template-columns: repeat(2, calc(var(--sidebar) - var(--s-16)));
  }

  .toast-host {
    bottom: calc(var(--nav-h) + var(--s-24));
  }

  .room-connected .room-status {
    right: var(--s-24);
  }
}

/* ---- Desktop: a real application frame ---- */

@media (min-width: 900px) {
  html {
    scroll-padding-bottom: var(--s-24);
  }

  .app {
    flex-direction: row;
    padding-bottom: 0;
  }

  .nav {
    position: sticky;
    top: 0;
    flex: none;
    display: flex;
    flex-direction: column;
    width: var(--sidebar);
    height: 100vh;
    height: 100dvh;
    padding: var(--s-24) var(--s-16) var(--s-16);
    border-top: 0;
    border-right: var(--bw) solid var(--hairline);
    overflow-y: auto;
  }

  .nav-logo {
    display: block;
    align-self: flex-start;
    margin: 0 var(--s-8) var(--s-24);
    border-radius: var(--r-8);
  }

  .nav-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--s-12);
    min-height: var(--h-control);
    padding: 0 var(--s-8);
    color: var(--text-2);
    font-size: var(--fs-ui);
    line-height: var(--lh-ui);
  }

  .nav-item .icon {
    width: var(--icon);
    height: var(--icon);
  }

  .nav-item:hover {
    background: var(--container);
  }

  .nav-item[aria-current="page"] {
    background: var(--accent-tint);
  }

  .nav-foot {
    display: flex;
    flex-direction: column;
    gap: var(--s-8);
    margin-top: auto;
    padding-top: var(--s-16);
  }

  .nav-credit {
    display: flex;
    flex-direction: column;
    padding: var(--s-16);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-8);
  }

  .nav-credit-amount {
    font-size: var(--fs-title);
    line-height: var(--lh-title);
    font-weight: var(--w-bold);
  }

  .nav-credit .btn {
    margin-top: var(--s-8);
  }

  .account-menu {
    position: relative;
  }

  .account-button {
    display: flex;
    align-items: center;
    gap: var(--s-8);
    width: 100%;
    min-height: var(--h-control);
    padding: var(--s-4) var(--s-8);
    border: 0;
    border-radius: var(--r-8);
    background: none;
    color: var(--text);
    font-size: var(--fs-ui);
    line-height: var(--lh-ui);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--t) var(--ease);
  }

  .account-button:hover,
  .account-button[aria-expanded="true"] {
    background: var(--container);
  }

  .avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: var(--icon-box);
    height: var(--icon-box);
    border-radius: var(--r-full);
    background: var(--accent-tint);
    color: var(--accent-text);
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: var(--w-bold);
  }

  .account-email {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-button > .icon {
    color: var(--text-3);
  }

  .menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + var(--s-4));
    z-index: 30;
    display: flex;
    flex-direction: column;
    padding: var(--s-4);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-8);
    background: var(--surface);
    animation: appear var(--t) var(--ease);
  }

  .menu-item {
    display: flex;
    align-items: center;
    gap: var(--s-8);
    width: 100%;
    min-height: var(--h-control);
    padding: 0 var(--s-8);
    border: 0;
    border-radius: var(--r-4);
    background: none;
    color: var(--text);
    font-size: var(--fs-ui);
    line-height: var(--lh-ui);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }

  .menu-item:hover {
    background: var(--container);
  }

  .menu-item .icon {
    color: var(--text-3);
  }

  .main {
    min-width: 0;
    max-width: calc(var(--content) + var(--s-32) * 2);
    padding: 0 var(--s-32);
  }

  /* The same top spacing and header in every section. */
  .page {
    gap: var(--s-24);
    padding: var(--s-32) 0;
  }

  .toast-host {
    left: var(--sidebar);
    bottom: var(--s-24);
  }

  .panel {
    padding: var(--s-24);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-8);
    background: var(--surface);
  }

  /* A panel inside a panel keeps no second frame. */
  .panel .panel,
  .auth-card {
    padding: 0;
    border: 0;
    background: none;
  }

  .metrics {
    gap: var(--s-16);
  }

  .metrics > .metric {
    padding: var(--s-16);
  }

  /* Call: the console. A first-time user sees the launcher and the ready check only. Quick
     start and recent calls appear once there is something to show. */
  .console {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-content: start;
    gap: var(--s-24);
    padding: var(--s-32) 0;
  }

  .console > .page-head,
  .console > .notice,
  .recent-calls {
    grid-column: 1 / -1;
  }

  .call-top {
    display: none;
  }

  .launcher {
    grid-column: 1 / span 7;
    grid-row: 2 / span 2;
    justify-content: space-between;
    gap: var(--s-24);
  }

  .quick {
    display: flex;
    grid-column: 8 / span 5;
    grid-row: 2;
  }

  .console > .ready {
    display: flex;
    grid-column: 8 / span 5;
    grid-row: 3;
    align-self: start;
  }

  .console.is-first > .ready {
    grid-row: 2 / span 2;
  }

  .recent-calls {
    display: flex;
  }

  .chip-recent {
    display: none;
  }

  .launch-language .chips {
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .modes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-16);
  }

  .mode {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--s-16);
  }

  .mode-price {
    flex-direction: row;
    align-items: baseline;
    gap: var(--s-4);
    min-height: var(--lh-title);
  }

  .mode-rate {
    font-size: var(--fs-title);
    line-height: var(--lh-title);
  }

  .dock {
    position: static;
    margin-top: 0;
    padding: 0;
    border-top: 0;
    background: none;
  }

  .dock-reminder-more {
    display: inline;
  }

  .tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-8);
  }

  .tile {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: var(--h-primary);
    border: var(--bw) solid var(--control-line);
    border-radius: var(--r-8);
    background: var(--surface);
    transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
  }

  .tile:hover {
    border-color: var(--text);
  }

  .tile-main {
    flex: 1;
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--s-4) var(--s-4) var(--s-4) var(--s-12);
    border: 0;
    border-radius: var(--r-8) 0 0 var(--r-8);
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
  }

  .tile-name {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    min-width: 0;
    font-size: var(--fs-small);
    line-height: var(--lh-small);
    font-weight: var(--w-semibold);
  }

  .tile-label,
  .tile-native {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .tile-pin {
    color: var(--text-3);
  }

  .tile-native {
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    color: var(--text-3);
  }

  /* A quiet action: Start call is the one filled button on this screen. */
  .tile-go {
    margin-right: var(--s-4);
    min-height: var(--s-32);
  }

  .tile-go-human {
    color: var(--human-text);
  }

  .ready {
    gap: var(--s-16);
  }

  .recent-calls .rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--s-32);
  }

  .recent-calls .rows > li + li {
    border-top: 0;
  }

  .recent-calls .rows > li:nth-child(n + 3) {
    border-top: var(--bw) solid var(--hairline);
  }

  .recent-calls .row-chevron {
    display: none;
  }

  /* History */
  .ledger {
    gap: var(--s-16);
  }

  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .table-wrap {
    max-height: var(--table-max);
    margin: 0 calc(var(--s-12) * -1);
  }

  /* Wallet */
  .wallet .page-head {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .wallet-columns {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: start;
    gap: var(--s-24);
  }

  /* Account */
  .account-layout {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    align-items: start;
    gap: var(--s-24);
  }

  .account.has-sub .subnav,
  .account:not(.has-sub) .account-content {
    display: flex;
  }

  .account.has-sub .page-head {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .account.has-sub .page-head-action {
    display: block;
  }

  .subnav.panel {
    padding: var(--s-8);
  }

  .subnav ul {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
  }

  .subnav ul > li + li {
    border-top: 0;
  }

  .subnav-item {
    min-height: var(--h-control);
    padding: 0 var(--s-8);
  }

  .subnav-item .icon {
    width: var(--icon);
    height: var(--icon);
  }

  .subnav-item[aria-current="page"] {
    background: var(--accent-tint);
    color: var(--accent-text);
    font-weight: var(--w-semibold);
  }

  .subnav-item[aria-current="page"] > .icon:first-child {
    color: var(--accent-text);
  }

  .subnav-chevron,
  .back-link {
    display: none;
  }

  /* Full-window screens */
  .full-main {
    padding: var(--s-32);
  }

  .sheet {
    padding: var(--s-32);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-12);
    background: var(--surface);
  }

  .auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    max-width: calc(var(--sheet) * 2 - var(--s-48) * 2);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-12);
    background: var(--surface);
    overflow: hidden;
  }

  .auth-card {
    padding: var(--s-48) var(--s-32);
    justify-content: center;
  }

  .about {
    order: -1;
    justify-content: center;
    padding: var(--s-48) var(--s-32);
    border-width: 0 var(--bw) 0 0;
    border-radius: 0;
  }

  .about h2 {
    flex: none;
    font-size: var(--fs-page);
    line-height: var(--lh-page);
    letter-spacing: var(--track-tight);
  }

  .about-list {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
  }

  .about-list .icon {
    margin-top: var(--s-4);
  }

  /* The call room: a stage on the left, the money and the controls on the right. */
  .room-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) calc(var(--sidebar) + var(--s-48) * 3);
    gap: var(--s-24);
    max-width: calc(var(--content) + var(--sidebar));
    padding: var(--s-24);
  }

  .room-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s-24);
    min-height: calc(100vh - var(--s-48));
    min-height: calc(100dvh - var(--s-48));
    padding: var(--s-32);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-12);
    background: var(--surface);
  }

  .room-side {
    display: flex;
    flex-direction: column;
    gap: var(--s-16);
  }

  /* The stage keeps the phone order (mark, state, words). The side column follows the markup. */
  .money,
  .controls,
  .room-tools {
    order: 0;
  }

  /* Last in the column, so Mute, End call and the tools stay where they are when it shows. */
  .muted-flag {
    order: 1;
  }

  .phrase {
    order: 5;
    flex: none;
    padding: var(--s-24);
  }

  .phrase-text {
    font-size: var(--fs-page);
    line-height: var(--lh-page);
    letter-spacing: var(--track-tight);
  }

  .room-connected .room-status {
    top: var(--s-32);
    right: var(--s-32);
  }

  .room-pending {
    margin-top: auto;
  }

  .room-detail {
    margin-bottom: auto;
  }

  .room-connected .room-detail {
    display: flex;
    margin-bottom: 0;
  }

  .timer {
    margin-top: auto;
    padding: 0;
  }

  .meters {
    width: 100%;
    max-width: var(--sheet);
    margin: 0 auto auto;
    padding: var(--s-16);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-8);
    background: var(--container);
  }

  .room-waiting .meters,
  .room-lost .meters {
    margin-top: 0;
  }

  .money,
  .controls,
  .room-tools {
    padding: var(--s-16);
    border: var(--bw) solid var(--hairline);
    border-radius: var(--r-8);
    background: var(--surface);
  }

  .money {
    gap: var(--s-16);
  }

  .money.is-low {
    border-color: var(--critical-text);
    background: var(--critical-tint);
  }

  .stat-value {
    font-size: var(--fs-title);
    line-height: var(--lh-title);
  }

  .controls {
    position: static;
    margin-top: 0;
  }

  .room-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .room-tools > .hint {
    flex: none;
    min-width: 0;
  }

  .keys {
    display: flex;
    flex-direction: column;
    gap: var(--s-8);
    padding-top: var(--s-8);
    border-top: var(--bw) solid var(--hairline);
  }

  .keys-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-16);
  }

  .keys-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-8);
    font-size: var(--fs-small);
    line-height: var(--lh-small);
    color: var(--text-2);
  }

  kbd {
    display: inline-grid;
    place-items: center;
    min-width: var(--icon-box);
    height: var(--icon-box);
    margin-right: var(--s-8);
    padding: 0 var(--s-4);
    border: var(--bw) solid var(--control-line);
    border-radius: var(--r-4);
    background: var(--container);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-caption);
    line-height: var(--lh-caption);
    font-weight: var(--w-semibold);
  }
}

/* A narrow desktop: a small laptop, a tablet on its side, half a window. The launcher takes
   the full width, with quick start and the ready check side by side under it. */
@media (min-width: 900px) and (max-width: 1199px) {
  .launcher {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .quick {
    grid-column: 1 / span 6;
    grid-row: auto;
  }

  .console > .ready {
    grid-column: 7 / span 6;
    grid-row: auto;
    align-self: stretch;
  }

  .console.is-first > .ready,
  .console:not(:has(.quick)) > .ready {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .tiles,
  .ready-test {
    grid-template-columns: minmax(0, 1fr);
  }

  .console.is-first .ready-test,
  .console:not(:has(.quick)) .ready-test {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

/* A tablet held upright: Start call follows the choices instead of sitting at the far bottom. */
@media (min-width: 600px) and (max-width: 899px) and (min-height: 700px) {
  .dock {
    position: static;
    margin-top: var(--s-8);
    border-top: 0;
  }
}

/* Wide desktop: the three areas of the console side by side. */
@media (min-width: 1500px) {
  .launcher {
    grid-column: 1 / span 6;
    grid-row: 2;
  }

  .quick {
    grid-column: 7 / span 3;
    grid-row: 2;
  }

  .console > .ready {
    grid-column: 10 / span 3;
    grid-row: 2;
    align-self: stretch;
  }

  .console.is-first > .launcher {
    grid-column: 1 / span 7;
  }

  .console.is-first > .ready {
    grid-column: 8 / span 5;
    grid-row: 2;
    align-self: start;
  }

  .tiles,
  .ready-test {
    grid-template-columns: minmax(0, 1fr);
  }

  .console.is-first .ready-test {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

/* Very wide: the page uses more of the screen. Text columns keep their own measure. */
@media (min-width: 1800px) {
  :root {
    --content: 1560px;
  }
}

/* ---- Short screens: a phone on its side, a small phone with the keyboard up, or a page
   zoomed to 400%. Nothing stays fixed over the choices (WCAG 1.4.10 and 2.4.11). ---- */
@media (max-width: 899px) and (max-height: 560px) {
  .dock {
    position: static;
    margin-top: var(--s-8);
  }

  /* The language list takes the whole screen and scrolls as one piece, so the rows are never
     squeezed into a strip between the search box and the footer. */
  .picker {
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    overflow-y: auto;
  }

  .picker[open] {
    display: block;
  }

  .picker-list {
    overflow: visible;
  }
}

/* ---- Windows high-contrast mode: states are drawn with the system colors ---- */
@media (forced-colors: active) {
  .switch::before {
    border: var(--bw) solid ButtonText;
    background: Canvas;
  }

  .switch-thumb {
    background: ButtonText;
  }

  .switch[aria-checked="true"]::before {
    background: Highlight;
  }

  .switch[aria-checked="true"] .switch-thumb {
    background: HighlightText;
  }

  .mode.is-on,
  .pack.is-on,
  .chip.is-on,
  .segment.is-on,
  .tile.is-current,
  .btn.is-pressed,
  .option[aria-selected="true"] {
    outline: var(--s-2) solid Highlight;
    outline-offset: calc(var(--s-2) * -1);
  }

  .check input:checked + .check-box {
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Pro: how to change or cancel ---- */

.pro-sub {
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  font-weight: var(--w-semibold);
}

.pro-how {
  margin: 0;
  padding-left: var(--s-16);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* ---- The plan box: Free with the Pro offer under it ---- */

.pro-offer {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin-top: var(--s-8);
  padding-top: var(--s-16);
  border-top: var(--bw) solid var(--hairline);
}
