/* ─── The palette ──────────────────────────────────────────────────────
 *
 * Every colour in this room has a name, and the two themes are two sets of
 * values for the same names. Nothing below this block writes a colour out
 * by hand: it used to, 361 times, and a second theme could not reach any
 * of them.
 *
 * The names are roles, not shades. `--well` is "deeper than the panel it
 * sits in", which on dark means darker and on light means greyer - so the
 * rules that use it need no opinion about which theme is on.
 *
 * Tints are mixed rather than declared. `color-mix(in srgb, var(--good)
 * 14%, var(--panel))` is the right green behind a "live" chip in both
 * themes and stays right if the green ever changes, where a hard-coded
 * #16281c was one theme's answer to a question the other theme asks
 * differently.
 *
 * THREE states, not two. An explicit choice stamps data-theme on <html>;
 * the default stamps nothing and follows the browser. So: dark here for
 * the default and for data-theme="dark", light under prefers-color-scheme
 * guarded against an explicit dark, and light again for data-theme="light"
 * so the switch wins in both directions.
 */
:root {
  /* surfaces, page inward */
  --bg: #0a0d12;        /* behind everything */
  --well: #12171f;      /* deeper than a panel: table heads, group heads */
  --panel: #161b23;     /* cards, panels, the header */
  --panel2: #1c2129;    /* a panel inside a panel; banners */
  --sunken: #0d1117;    /* inputs, bars, anything you type into */
  --raise: #1d232d;     /* buttons, filled cells */
  --hover: #1a212b;     /* a row under the pointer */
  --hover2: #262d38;    /* a button under the pointer */
  --line: #242c38;      /* every ordinary border */
  --line2: #30363d;     /* a border that has to be seen */
  --carrier-logo-ground: #ffffff; /* preserve official wordmark contrast */

  /* text, loudest first */
  --fg: #e6edf3;
  --soft: #9fb0c4;      /* a step below --fg: times, secondary facts */
  --muted: #8b98a9;
  --dim: #6e7681;

  /* the orange, and the things that go with it */
  --accent: #d98a3d;
  --accent-ink: #e8cf9a;   /* accent text on a dark ground */
  --accent-on: #1a1004;    /* text ON the accent */
  --accent-tint: #2a2417;  /* a warm ground */
  --accent-well: #1d1a12;  /* a warm field you type into */
  --accent-line: #3b3220;
  --accent-deep: #8c5a24;  /* the far end of the logo's gradient */

  /* what a thing is doing */
  --good: #3fb950; --good-ink: #7ee787;
  --bad: #f85149;  --bad-ink: #ffa198;
  --warn: #d29922; --warn-ink: #e3b341;

  /* the hues the board columns and the chips are sorted by */
  --blue: #8fb8e8; --link: #58a6ff; --teal: #82ceca; --green: #8ed3a6;
  --amber: #f0c674; --violet: #b8a5e8;

  /* The funnel's own ramp, olive through to orange: the further along a
     lead is, the warmer its column. Six colours of its own; the rest of
     the twelve stages borrow the hues above. */
  --stage-olive: #b8d182; --stage-gold: #d8c96f; --stage-honey: #e0b45f;
  --stage-amber: #e59a55; --stage-flame: #eb8f4a; --stage-ember: #ef8446;

  /* What a shadow is made of. Near-black on dark; a blue-grey on light,
     because pure black under a white card reads as dirt. */
  --shade: #000000;

  /* A card stands out by being lighter than its ground on dark, and there
     is nowhere lighter than white to go on light - so on light it rises
     instead. Declared here as nothing, so the rules can ask for it either
     way. */
  --lift: none;
  /* Glass. A card that is a solid rectangle on a solid ground is two
     solids; a card that is frosted over the page's own wash has depth
     without a drop shadow doing the work. `--glass` is the surface,
     `--frost` the blur behind it - both a token, because the mix that
     reads on near-black is not the mix that reads on near-white. */
  --glass: color-mix(in srgb, var(--panel) 86%, transparent);
  --frost: blur(16px) saturate(1.4);
  /* A shade under the page, for the two surfaces that frame it: the
     header and the left rail. They are the room's edges, and an edge that
     is the same colour as the middle is not an edge. */
  --chrome: #060910;
  /* A lit top edge on a raised surface: light falls from above, and one
     pixel of it is the difference between a card and a rectangle with a
     line round it. On light it is white; on dark it is a hint of white. */
  --edge: linear-gradient(180deg,
    color-mix(in srgb, var(--fg) 7%, transparent), transparent);
  /* The two colours of the wash behind the top of the page. A token
     apiece, because the same 15% that is a glow on near-black is invisible
     on near-white - the light theme needs about twice as much of it to
     say the same thing. */
  --wash-warm: color-mix(in srgb, var(--accent) 15%, transparent);
  --wash-cold: color-mix(in srgb, var(--blue) 13%, transparent);
  color-scheme: dark;
}

/* The browser's own setting, unless somebody has chosen dark here. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    /* Four tones, and they are four. The rail and the header are
       near-white, the ground they frame is a definite grey, and a
       card is white on it. Everything had drifted to one colour
       with lines drawn on it. */
    --bg: #e7ecf2; --well: #eef1f6; --panel: #ffffff; --panel2: #f4f6fa;
    --sunken: #f1f4f8; --raise: #eaeef4; --hover: #f0f3f8; --hover2: #e2e8f0;
    --line: #d4dbe4; --line2: #bcc6d2;
    --carrier-logo-ground: #ffffff;
    --fg: #1a2029; --soft: #46525f; --muted: #5b6775; --dim: #6b7682;
    --accent: #a8681a; --accent-ink: #8c5510; --accent-on: #ffffff;
    --accent-tint: #fbf1e4; --accent-well: #fdf6ec; --accent-line: #e8d3b4;
    --accent-deep: #8c5510;
    --good: #1a7f37; --good-ink: #10682a;
    --bad: #c4342b;  --bad-ink: #b02a20;
    --warn: #9a6f0c; --warn-ink: #7d5a06;
    --blue: #2f6db3; --link: #1f5fbf; --teal: #1f7f7a; --green: #2a7d4e;
    --amber: #9a6f0c; --violet: #6b4fb8;
    --stage-olive: #5a7326; --stage-gold: #7a6a12; --stage-honey: #86601a;
    --stage-amber: #8f4f16; --stage-flame: #94480f; --stage-ember: #98410c;
    --shade: #101828;
    --chrome: #fbfcfe;
    --glass: color-mix(in srgb, var(--panel) 96%, transparent);
    --frost: blur(16px) saturate(1.5);
    --lift: 0 1px 2px color-mix(in srgb, var(--shade) 5%, transparent),
            0 10px 26px -14px color-mix(in srgb, var(--shade) 26%, transparent);
    --edge: linear-gradient(180deg, rgba(255, 255, 255, .9), transparent);
    --wash-warm: color-mix(in srgb, var(--accent) 30%, transparent);
    --wash-cold: color-mix(in srgb, var(--blue) 24%, transparent);
    color-scheme: light;
  }
}

/* And the switch, which wins over both. */
:root[data-theme="light"] {
  /* Four tones, and they are four. The rail and the header are
     near-white, the ground they frame is a definite grey, and a
     card is white on it. Everything had drifted to one colour
     with lines drawn on it. */
  --bg: #e7ecf2; --well: #eef1f6; --panel: #ffffff; --panel2: #f4f6fa;
  --sunken: #f1f4f8; --raise: #eaeef4; --hover: #f0f3f8; --hover2: #e2e8f0;
  --line: #d4dbe4; --line2: #bcc6d2;
  --carrier-logo-ground: #ffffff;
  --fg: #1a2029; --soft: #46525f; --muted: #5b6775; --dim: #6b7682;
  --accent: #a8681a; --accent-ink: #8c5510; --accent-on: #ffffff;
  --accent-tint: #fbf1e4; --accent-well: #fdf6ec; --accent-line: #e8d3b4;
  --accent-deep: #8c5510;
  --good: #1a7f37; --good-ink: #10682a;
  --bad: #c4342b;  --bad-ink: #b02a20;
  --warn: #9a6f0c; --warn-ink: #7d5a06;
  --blue: #2f6db3; --link: #1f5fbf; --teal: #1f7f7a; --green: #2a7d4e;
  --amber: #9a6f0c; --violet: #6b4fb8;
  --stage-olive: #5a7326; --stage-gold: #7a6a12; --stage-honey: #86601a;
  --stage-amber: #8f4f16; --stage-flame: #94480f; --stage-ember: #98410c;
  --shade: #101828;
  --chrome: #fbfcfe;
  --glass: color-mix(in srgb, var(--panel) 96%, transparent);
  --frost: blur(16px) saturate(1.5);
  --lift: 0 1px 2px color-mix(in srgb, var(--shade) 5%, transparent),
          0 10px 26px -14px color-mix(in srgb, var(--shade) 26%, transparent);
  --edge: linear-gradient(180deg, rgba(255, 255, 255, .9), transparent);
  --wash-warm: color-mix(in srgb, var(--accent) 30%, transparent);
  --wash-cold: color-mix(in srgb, var(--blue) 24%, transparent);
  color-scheme: light;
}
/* ---- The phone's shell: its palette (flag mobile_shell, web/mshell.js) ----
 *
 * html.ms is on the root whenever the flag is, on a desktop too, so every
 * rule here is inside the phone's media query: above 700px the flag changes
 * nothing. The palette is the one agreed on the mockup of 2026-09-21: a warm
 * olive black, surfaces a step lighter with no line round them, gold for the
 * words that label and the tab that is selected, and ONE pale sage for the
 * button a screen exists for - so --accent, which is what `button.primary`
 * fills with, is the sage, and --accent-ink, which is what labels and
 * selected things are written in, is the gold.
 * Three states, like the page's own: dark by default, light when the
 * browser says so and nobody chose, and either when somebody did.
 */
@media (max-width: 700px) {
  html.ms {
    --bg: #141613; --well: #1a1c18; --panel: #232520; --panel2: #2a2c26;
    --sunken: #1b1d19; --hover: #2a2c26; --line: #30332c; --line2: #3d4138;
    --fg: #f1f1ea; --muted: #a3a59b; --dim: #7c7f75;
    --accent: #d9dfcd; --accent-on: #1d2219;
    --accent-ink: #d2b26a; --accent-tint: #322c1d; --accent-line: #4a4029;
    --chrome: #141613;
  }
  html.ms[data-theme="light"] {
    --bg: #f4f3ed; --well: #eceae1; --panel: #ffffff; --panel2: #f0eee6;
    --sunken: #eceae1; --hover: #f0eee6; --line: #dddbd0; --line2: #c9c6b8;
    --fg: #1b1d19; --muted: #6a6d62; --dim: #8d9085;
    --accent: #2b3325; --accent-on: #f1f3ea;
    --accent-ink: #8a6a1f; --accent-tint: #f1e8d0; --accent-line: #e0d2ab;
    --chrome: #f9f8f3;
  }
}
@media (max-width: 700px) and (prefers-color-scheme: light) {
  html.ms:not([data-theme="dark"]) {
    --bg: #f4f3ed; --well: #eceae1; --panel: #ffffff; --panel2: #f0eee6;
    --sunken: #eceae1; --hover: #f0eee6; --line: #dddbd0; --line2: #c9c6b8;
    --fg: #1b1d19; --muted: #6a6d62; --dim: #8d9085;
    --accent: #2b3325; --accent-on: #f1f3ea;
    --accent-ink: #8a6a1f; --accent-tint: #f1e8d0; --accent-line: #e0d2ab;
    --chrome: #f9f8f3;
  }
}

:root { --nav-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; }
/* Which way the line runs, for what a property cannot turn: a knob or a
   panel that slides by a transform multiplies by it (web/i18n.css). */
:root { --dir: 1; }
:root[dir="rtl"] { --dir: -1; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
}
/* A link in prose. Nothing styled the bare <a>, so every link that was
   not a button, a chip or a tab came out in the browser's own blue, and
   purple once followed - the two colours the palette has no name for, on
   pages that have a name for exactly this. The accent ink is that name;
   the underline is drawn faint and only comes up on hover, the way the
   route links do. Anything that sets its own colour still wins, as
   before: this is what an anchor inherits when nobody said otherwise. */
a { color: var(--accent-ink); text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent-ink) 45%, transparent); }
a:hover { text-decoration-color: var(--accent-ink); }
/* Weather. A flat fill lit evenly from nowhere is what makes a dashboard
   look like a spreadsheet, so the top of the page has a direction to it:
   the brand's warm on one side, a cold blue on the other, blurred into
   each other and pinned to the viewport. Faint on purpose - somebody
   reads this screen for eight hours, and it is not a poster. Behind
   everything and reachable by nothing. */
body::before {
  content: ""; position: fixed; inset: -20vh -10vw auto -10vw; height: 70vh;
  z-index: -1; pointer-events: none;
  background:
    radial-gradient(48% 55% at 20% 26%, var(--wash-warm), transparent 70%),
    radial-gradient(42% 48% at 84% 6%, var(--wash-cold), transparent 70%);
  filter: blur(38px);
}

header {
  /* Over the wash rather than on top of it: the header is where the
     colour is, and a solid fill here would hide the only place it shows.
     Darker than the page and blurred harder than glass usually is, so the
     wash reads as weather behind it rather than as a stain on it. */
  background: color-mix(in srgb, var(--chrome) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  /* The blur above is why these two lines have to be here. A
     backdrop-filter makes the element a stacking context, so a z-index
     inside the header - the account menu's 45 - orders it against its
     brothers in here and against nothing outside. And a stacking context
     that is not positioned is painted with the z-index:auto group in TREE
     order: the header is the first child of the body, so every room's
     positioned content (a rail button, a card, the greeting's own wrapper)
     is painted after it, on top of the menu hanging below the header.
     Visibly nothing was wrong - the page has no background there - but
     the clicks landed on the room, so the menu items did nothing. This is
     what that cost: two days of blaming a cache.
     46 clears the rooms' own layers (dropdowns stop at 40; the CRM drawer
     is the exception, at 47, because it starts at the top of the window
     and its own head would otherwise be under this one; a card's team
     chat opens beside or over it, at 48, teamchat.css) and
     stays under everything that is meant to cover the header: the ERP
     overlay at 50, the mail room's file viewer at 51, the AI panel at
     55, the ask bar at 58, the dock and the
     toasts at 60, the palette at 70. Native order-action popovers use the
     browser's top layer above z-index, so their Escape priority is 80;
     the panel of a stage's calling rule is a popover too, at 79, and
     the feedback letters' rule on the deals board at 78.
     This ladder is also the order Escape closes things in - the same
     numbers, registered with floatLayer() in monitor.js, because "draws
     on top" and "closes first" are one order and one number for both is
     a number that cannot disagree with itself. Move a layer here and
     move it there. */
  position: relative; z-index: 46;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 11px; }
/* Both marks are sized before their bytes arrive: the height is set and
   the ratio is the file's, so the box is the box from the first paint.
   Without it the alt text stood in for the picture for a moment - wider
   than the mark - and everything after it on the line, and the line
   itself, moved when the picture came. The alt stays for a reader; the
   ink is the ground's, so nobody sees the word. `auto` before the ratio:
   once the picture has arrived its own ratio holds, which is the file's
   for the shipped letters and the name's width for the wordmark a
   prepared workspace draws from its name (server/brand.py), so the
   DESK box beside it follows the name. */
.wordmark { height: 19px; width: auto; aspect-ratio: auto 966 / 94; color: transparent;
  display: block; align-self: center; }
/* The mark on its own, for the narrow header. One file for both themes:
   the A is orange and the ground behind it is the header's either way.
   Shown by the step under 1280 in monitor.css, and nowhere else. */
.markmini { height: 22px; width: auto; aspect-ratio: 1; color: transparent;
  display: none; align-self: center; }
/* DESK in a small box beside the wordmark: the Desk header, the sign-in
   box and the locked page, in every workspace. From 2026-10-23 it was the
   TERRAMINE DESK badge below; Andrey had the box back on 2026-10-25. */
.wordtag {
  margin-inline-start: 9px; padding-block: 1px; padding-inline: 7px 5px;
  font: 600 10px/1.5 ui-monospace, monospace; letter-spacing: .2em;
  color: var(--muted); border: 1px solid var(--line2); border-radius: 3px;
}
/* The TERRAMINE DESK badge in the "Runs on" line under the sign-in box
   and the customer portal (ATTRIBUTION, 2026-10-23). The accent on its
   tint, so it reads on both grounds and in every workspace's own
   colours. */
.desk-brand {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  font: 600 10px/1.5 ui-monospace, monospace; letter-spacing: .08em;
  color: var(--accent-ink); background: var(--accent-tint); white-space: nowrap;
}
.runs-on {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0; font-size: 12px; color: var(--muted);
}
/* One of the two is always hidden. Which one is a fact about the theme,
   so the theme decides it rather than a script that has to be told. */
.wordmark.on-dark { display: none; }
:root[data-theme="dark"] .wordmark { display: none; }
:root[data-theme="dark"] .wordmark.on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wordmark { display: none; }
  :root:not([data-theme="light"]) .wordmark.on-dark { display: block; }
}
h1 { font-size: 17px; margin: 0; letter-spacing: .2px; }
.sub { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }
.statusbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
/* The status is the last thing on the header's line and it changes width
   as it speaks - "connecting…" at the first paint, "live" a moment later,
   "reconnecting…" when the socket drops, the Working chip beside it on
   every write - and the name box arrives when /api/me answers. On a
   window near the line's end that flipped the header between one row and
   two, and every room under it, the right rail included, jumped with it
   on every reload (Dmitrii, 2026-10-05). So above the phone the two boxes
   keep their room from the first paint: the status box is as wide as its
   longest ordinary word beside the chip, a longer line is cut rather than
   wrapped, and the name box stands invisible until the name comes. */
@media (min-width: 881px) {
  .statusbox { min-width: 150px; justify-content: flex-end; }
  #status { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* A host that holds a capability back says so on <html> before any
   script runs (server/cloud_desk.py, data-unavailable-features), and
   what hangs on it comes off at the first paint, not when a script gets
   round to it. The tabs of the rooms a workspace has no provider for
   were hidden only once /api/me had answered (applySections,
   monitor.js): on terramine-qa the header showed Calls, Inbox and ERP
   for the seconds the page took to load, then took them away (seen on
   2026-10-31). The live light has nothing to report on without a socket
   (connect, monitor.js). */
html[data-unavailable-features~="calls"] #tabCalls,
html[data-unavailable-features~="mail"] #tabEmail,
html[data-unavailable-features~="erp"] #tabErp,
html[data-unavailable-features~="drive"] #tabDrive,
html[data-unavailable-features~="live_updates"] .statusbox .dot,
html[data-unavailable-features~="live_updates"] #status { display: none; }
html[data-hosted-voice="1"] #tabCalls { display: revert; }
html[data-hosted-voice="1"] #viewCalls > :not(#hostedVoice) { display: none; }
html[data-hosted-voice="1"] #hostedVoice { grid-column: 1 / -1; }
#hostedVoice .controls { flex-wrap: wrap; }
#hostedVoice pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#hostedVoice .dlabel { display: block; margin-top: 12px; }
#hostedVoice input, #hostedVoice select { width: 100%; margin: 4px 0; }
/* And a module switched off in Admin -> Apps, which the page carries too
   (data-off-routes, server/main.py _page). Drive ships off, and its tab
   showed for as long as /api/me took and then went. loadMe writes the
   attribute again from /api/me, so a module switched on while the page
   is open gets its tab back without a reload. */
html[data-off-routes~="/api/drive"] #tabDrive { display: none; }

/* ---- the system is working ----
   A chip beside the connection status while a write is in flight, and a
   hairline that runs under the header's edge - the hairline is for the
   phone, where the header is folded and the chip may be off-screen. The
   orbit is the same one a button holds while its own work runs.
   By its id, never by the class: `working` is also the class the page
   puts on <html> while a write is in flight, and `.working` there made
   the whole document an inline-flex, nowrap row for the length of every
   write - labels jumped beside their fields and the page slid sideways. */
#working {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  color: var(--accent-ink); padding-block: 3px; padding-inline: 7px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  white-space: nowrap;
  /* Taller than the status line it sits in; the negative margins keep it
     from growing the header, which pushed every room down on each write. */
  margin-block: -4px; margin-inline: 0 6px;
  /* "Reading <file name>…" is as long as the file's name. On a phone the
     status box is pinned right and given what is left of the line, and a
     chip that would not shrink ran out of its left side, over the wordmark
     and off the screen. It shrinks now, and cuts its words. */
  min-width: 0; max-width: 100%;
}
#working[hidden] { display: none; }
#workingWord { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Above the phone the status box is not given a width, so the chip is not
   cut by it: as wide as the status beside it may be, and the header keeps
   to one row (the note above .statusbox says why that matters). */
@media (min-width: 881px) {
  #working { max-width: 240px; }
}
.orbit {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; animation: orbit .8s linear infinite;
  flex: none; vertical-align: -2px;
}
@keyframes orbit { to { transform: rotate(360deg); } }
html.working header::after {
  content: ""; position: absolute; inset-inline-start: 0; inset-inline-end: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 30% 100%; background-repeat: no-repeat;
  animation: hairline 1.2s ease-in-out infinite; pointer-events: none;
}
@keyframes hairline { from { background-position: -30% 0; } to { background-position: 130% 0; } }
button[aria-busy="true"] { cursor: progress; opacity: .85; }
button[aria-busy="true"] .orbit { margin-inline-end: 2px; }
@media (prefers-reduced-motion: reduce) {
  .orbit { animation-duration: 3s; }
  html.working header::after { animation-duration: 3s; }
}
.dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--muted);
  /* A circle, however full the line: on a phone's header it was squeezed
     into a 3px bar beside the Working chip. */
  flex: none;
}
.dot.good { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
.dot.bad  { background: var(--bad); }
.dot.warn { background: var(--warn); }
/* "A deploy changed the front end under this tab." Quiet on purpose: it
   is an offer that waits for a good moment, not an alarm - the page goes
   on working, and the press is theirs to make when nothing is half-typed. */
.newbuild {
  font: inherit; font-size: 12px; line-height: 1; white-space: nowrap;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  color: var(--accent-ink); background: var(--accent-tint);
  border: 1px solid var(--accent-line);
}
.newbuild:hover { border-color: var(--accent); }
/* On a phone the whole sentence cost the header a row of its own (126px
   against 94): the mark and one word fit beside the live light. */
.newbuild .nbshort { display: none; }
@media (max-width: 880px) {
  .newbuild { padding: 5px 8px; }
  .newbuild .nblong { display: none; }
  .newbuild .nbshort { display: inline; }
}

main {
  display: grid; grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px; padding: 18px 24px; align-items: start;
}
@media (max-width: 880px) { main { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px;
  /* On light there is nowhere lighter than white to go, so a panel rises
     off the page instead of glowing on it. --lift is `none` on dark. */
  box-shadow: var(--lift);
}
.panel.wide { margin: 0 24px 28px; }
h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin: 0 0 10px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.lat { font-family: ui-monospace, monospace; text-transform: none;
       letter-spacing: 0; color: var(--accent); }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }

textarea {
  width: 100%; background: var(--sunken); color: var(--fg);
  border: 1px solid var(--line); border-radius: 7px; padding: 10px;
  font: 13px/1.5 ui-monospace, monospace; resize: vertical;
}
.controls { display: flex; gap: 10px; margin: 12px 0; }
button {
  flex: 1; padding: 10px 14px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--raise); color: var(--fg);
  font-size: 14px; font-weight: 500;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
button:disabled { opacity: .45; cursor: not-allowed; }

.mic { margin-top: 12px; }
.mic label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }
.bar { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--good); transition: width .07s; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.warn-box {
  margin: 14px 0 0; padding: 9px 11px; border-radius: 7px; font-size: 12.5px;
  background: color-mix(in srgb, var(--warn) 9%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: var(--accent-ink);
}

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  background: var(--raise); border: 1px solid var(--line);
}
.badge.good { background: color-mix(in srgb, var(--good) 15%, transparent); border-color: var(--good); color: var(--good-ink); }
.badge.bad  { background: color-mix(in srgb, var(--bad) 15%, transparent); border-color: var(--bad); color: var(--bad-ink); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); border-color: var(--warn); color: var(--warn-ink); }

.prose { margin: 0 0 10px; }
.action {
  margin: 0 0 14px; padding: 9px 11px; border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-inline-start: 3px solid var(--accent);
}
#summaryBox h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 14px 0 5px;
}
#summaryBox ul { margin: 0; padding-inline-start: 18px; }
#summaryBox li { margin: 3px 0; }
#summaryBox dl {
  display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 0;
}
#summaryBox dt { color: var(--muted); font-size: 12.5px; }
#summaryBox dd { margin: 0; }
.muted { color: var(--muted); }
details { margin-top: 14px; }
summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
pre {
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
  padding: 11px; overflow-x: auto; font: 12px/1.5 ui-monospace, monospace;
  white-space: pre-wrap;
}

/* ---- call cost table ---- */
.scrollx { overflow-x: auto; }
#summaryBox table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#summaryBox th, #summaryBox td {
  padding: 5px 8px; text-align: start; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
#summaryBox th {
  color: var(--muted); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
}
.total-line { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.total-line strong { color: var(--fg); }

/* ---- header ---- */
.headleft { display: flex; align-items: center; gap: 10px 22px; flex-wrap: wrap; }

/* The switch. Three buttons in the header, beside the connection dot,
   because that is where somebody notices they want it. */
.themepick { display: flex; border: 1px solid var(--line); border-radius: 7px;
  overflow: hidden; flex: none; }
.themepick button { border: 0; border-inline-end: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font: inherit;
  font-size: 12px; padding: 5px 9px; cursor: pointer; line-height: 1.4; }
.themepick button:last-child { border-inline-end: 0; }
.themepick button:hover { color: var(--fg); background: var(--hover); }
.themepick button.on { background: var(--raise); color: var(--fg); }
.themepick button:focus-visible { outline: 2px solid var(--accent);
  outline-offset: -2px; }
/* The switch folded into one button: the same three states, one at a
   time, for a line that cannot spare 106px for three. Sized like the
   palette button beside it so the row keeps its rhythm. */
.themecycle {
  display: none; flex: none; width: 34px; height: 29px; padding: 0;
  align-items: center; justify-content: center; font-size: 14px;
  font-family: inherit; line-height: 1; cursor: pointer;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: 7px;
}
.themecycle:hover { color: var(--fg); border-color: var(--line2); }
.themecycle:focus-visible { outline: 2px solid var(--accent);
  outline-offset: -2px; }
