/* style.css: built from docs/DESIGN.md (v1). The faces first (3.2), then the tokens (3.9),
   then the components in the order of DESIGN sections 5 and 6, then the layouts. No raw
   colour, size or duration outside the token block except 0, 100%, 1px hairlines and env()
   inside the safe-area tokens; the face rules' metrics are the fonts' own.
   The class names of the run, the ask card and the receipt are v0's (.run, .sheet, .card__*,
   .rcpt); "v0 3.10" cites docs/design_drafts/archive/DESIGN_v0.md where a v0 rule stands. */

/* ------------------------------------------------------------------ faces (3.2)
   Printed by `python scripts/fonts.py css` from server/static/fonts/fonts.json: each file
   twice by language (the ZH range leaves the full-width punctuation to the CJK font), each
   with a metric-matched fallback face, every source on this origin. */

@font-face {
  font-family: "Agencity Sans";
  src: url("/static/fonts/agencity-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans ZH";
  src: url("/static/fonts/agencity-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013, U+2022, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Roboto");
  font-weight: 400;
  font-style: normal;
  size-adjust: 107.12%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans ZH Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Roboto");
  font-weight: 400;
  font-style: normal;
  size-adjust: 107.12%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013, U+2022, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans";
  src: url("/static/fonts/agencity-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans ZH";
  src: url("/static/fonts/agencity-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013, U+2022, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("Roboto Bold");
  font-weight: 600;
  font-style: normal;
  size-adjust: 101.53%;
  ascent-override: 95.42%;
  descent-override: 23.76%;
  line-gap-override: 0%;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Sans ZH Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("Roboto Bold");
  font-weight: 600;
  font-style: normal;
  size-adjust: 101.53%;
  ascent-override: 95.42%;
  descent-override: 23.76%;
  line-gap-override: 0%;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013, U+2022, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Serif";
  src: url("/static/fonts/agencity-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Serif ZH";
  src: url("/static/fonts/agencity-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013, U+2022, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Serif Fallback";
  src: local("Georgia"), local("Times New Roman"), local("Noto Serif");
  font-weight: 400;
  font-style: normal;
  size-adjust: 96.46%;
  ascent-override: 107.41%;
  descent-override: 34.73%;
  line-gap-override: 0%;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: "Agencity Serif ZH Fallback";
  src: local("Georgia"), local("Times New Roman"), local("Noto Serif");
  font-weight: 400;
  font-style: normal;
  size-adjust: 96.46%;
  ascent-override: 107.41%;
  descent-override: 34.73%;
  line-gap-override: 0%;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013, U+2022, U+2032-2033, U+2039-203A, U+20AC, U+2122, U+2190-2193, U+2212;
}

/* ------------------------------------------------------------- tokens (3.9) */

:root {
  color-scheme: light dark;

  --bg: #FBFBF9;           --bg-side: #FAFAF9;
  --surface: #FFFFFF;      --surface-raised: #FFFFFF;   --surface-sunk: #F4F4F1;
  --hover: #F2F1EE;        --selected: #EDECE8;         --chip: #EAEAE8;
  --line: #ECECE8;         --line-card: #D4D4CF;        --line-strong: #8C8C86;
  --text: #0B0B0B;         --text-2: #4D4D49;           --text-3: #65655F;
  --primary: #0B0B0B;      --primary-press: #3A3A37;    --on-primary: #FFFFFF;
  --mark: #2D54D6;         --select: #DCE4FA;
  --danger: #B42318;       --on-danger: #FFFFFF;        --danger-bg: #FDF0EE;
  --merchant-bg: #F8F4EA;  --disabled-bg: #EDEDE9;

  --shadow-card: 0 2px 16px rgb(0 0 0 / 0.045);
  --shadow-raised: 0 12px 40px rgb(0 0 0 / 0.08), 0 2px 6px rgb(0 0 0 / 0.04);
  --shadow-pop: 0 8px 28px rgb(0 0 0 / 0.08);
  --scrim-drawer: rgb(0 0 0 / 0.24);
  --scrim-dialog: rgb(0 0 0 / 0.32);

  --ff-sans-en: "Agencity Sans", "Agencity Sans Fallback", -apple-system, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --ff-sans-zh: "Agencity Sans ZH", "Agencity Sans ZH Fallback", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-serif-en: "Agencity Serif", "Agencity Serif Fallback", Georgia,
    "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", serif;
  --ff-serif-zh: "Agencity Serif ZH", "Agencity Serif ZH Fallback", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", Georgia, serif;
  --ff-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", monospace;

  --t-hero: 40px;    --lh-hero: 48px;
  --t-display: 32px; --lh-display: 40px;
  --t-title: 24px;   --lh-title: 32px;
  --t-heading: 20px; --lh-heading: 28px;
  --t-body: 16px;    --lh-body: 24px;
  --t-ui: 15px;      --lh-ui: 24px;
  --t-meta: 13px;    --lh-meta: 20px;
  --t-code: 56px;    --lh-code: 64px;
  --w-regular: 400;  --w-strong: 600;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;  --s-5: 20px;  --s-6: 24px;
  --s-7: 32px; --s-8: 40px; --s-9: 48px; --s-10: 64px; --s-11: 96px; --s-12: 128px;

  --sidebar-w: 288px; --rail-w: 56px; --topbar-h: 56px;
  --drawer-w: min(320px, 86vw);
  --column: 672px; --measure: 640px; --panel-w: 400px;
  --gutter: 16px; --tap: 48px; --tap-fine: 36px; --chip-h: 36px;
  --btn-h: 48px; --card-btn-h: 56px; --dock-gap: 12px; --context-h: 28px;
  --icon: 20px; --mark-lockup: 24px; --mark-home: 32px; --disc: 28px; --send: 36px;
  --chev-col: 32px; --env-offset: 40px; --menu-w: 220px; --dialog-w: 400px;
  --field-max: 192px; --say-max: 96px; --json-max: 320px; --json-max-short: 160px;
  --cell: 32px; --score-w: 48px; --dt-w: 96px; --keep-visible: 96px; --hairline-2: 2px;
  --safe-top: env(safe-area-inset-top, 0px);       --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px);
  --bottom-stack: 0px;
  --pad-l: max(var(--gutter), var(--safe-left));
  --pad-r: max(var(--gutter), var(--safe-right));
  --main-l: 0px; --main-r: 0px;

  --r-xs: 4px; --r-sm: 8px; --r-btn: 10px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;

  --z-topbar: 10; --z-stop: 11; --z-dock: 20; --z-latest: 25; --z-card: 30; --z-scrim: 35;
  --z-drawer: 40; --z-menu: 45; --z-dialog: 50;

  --dur-press: 120ms; --dur-hover: 120ms; --dur-expand: 160ms; --dur-fade: 200ms; --dur-step: 240ms;
  --dur-drawer: 240ms; --dur-card-in: 280ms; --dur-card-out: 200ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1); --ease-in: cubic-bezier(0.3, 0, 1, 1);
  --rise: 4px; --rise-card: 8px;
}

/* Dark: by system preference unless the person chose Light, or by choice (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1B1A;           --bg-side: #151514;
    --surface: #252524;      --surface-raised: #2C2C2A;   --surface-sunk: #121211;
    --hover: #292927;        --selected: #30302E;         --chip: #2D2D2B;
    --line: #33332F;         --line-card: #3D3D3A;        --line-strong: #7A7A74;
    --text: #F3F3EF;         --text-2: #C9C9C3;           --text-3: #9E9E98;
    --primary: #F3F3EF;      --primary-press: #D2D2CC;    --on-primary: #111110;
    --mark: #8EA6FF;         --select: #283456;
    --danger: #F28B7D;       --on-danger: #111110;        --danger-bg: #341C19;
    --merchant-bg: #28251E;  --disabled-bg: #2E2E2C;
    --shadow-card: none; --shadow-raised: none; --shadow-pop: none;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1B1A;           --bg-side: #151514;
  --surface: #252524;      --surface-raised: #2C2C2A;   --surface-sunk: #121211;
  --hover: #292927;        --selected: #30302E;         --chip: #2D2D2B;
  --line: #33332F;         --line-card: #3D3D3A;        --line-strong: #7A7A74;
  --text: #F3F3EF;         --text-2: #C9C9C3;           --text-3: #9E9E98;
  --primary: #F3F3EF;      --primary-press: #D2D2CC;    --on-primary: #111110;
  --mark: #8EA6FF;         --select: #283456;
  --danger: #F28B7D;       --on-danger: #111110;        --danger-bg: #341C19;
  --merchant-bg: #28251E;  --disabled-bg: #2E2E2C;
  --shadow-card: none; --shadow-raised: none; --shadow-pop: none;
}
@media (min-width: 640px)  { :root { --gutter: 24px; --card-btn-h: 48px; --dock-gap: 24px; } }
@media (min-width: 960px)  { :root { --t-hero: 56px; --lh-hero: 64px; --t-display: 40px; --lh-display: 48px;
                                     --t-title: 28px; --lh-title: 36px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; --main-l: var(--sidebar-w); }
                             :root.is-rail { --main-l: var(--rail-w); } }
@media (min-width: 1200px) { :root.has-panel { --main-r: var(--panel-w); } }
@media (pointer: fine)     { :root { --btn-h: 40px; --chip-h: 32px; } }
@media (prefers-reduced-motion: reduce) {
  :root { --dur-press: 0ms; --dur-hover: 0ms; --dur-expand: 0ms; --dur-fade: 0ms; --dur-step: 0ms;
          --dur-drawer: 0ms; --dur-card-in: 0ms; --dur-card-out: 0ms; --rise: 0px; --rise-card: 0px; }
  html { scroll-behavior: auto; }
}

/* -------------------------------------------------------------- base (3.2) */

*, *::before, *::after { box-sizing: border-box; }

/* Faces by language: font-family inherits as a computed value, so every element that
   carries `lang` declares it again (DESIGN 3.2). */
:root, :lang(en) { --ff-sans: var(--ff-sans-en); --ff-serif: var(--ff-serif-en); }
:lang(zh) { --ff-sans: var(--ff-sans-zh); --ff-serif: var(--ff-serif-zh); }
body, [lang] { font-family: var(--ff-sans); }
/* Serif means title: the intent title, the ask card's title, the receipt's title, the Home
   greeting and the profile name, and nothing else (3.2, law 1). */
.serif, .serif [lang], .card__title, .rcpt__title {
  font-family: var(--ff-serif);
  font-weight: var(--w-regular);
  font-synthesis-weight: none;
}

html {
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: var(--w-regular);
  font-variant-numeric: tabular-nums lining-nums;
  font-kerning: normal;
  font-synthesis-style: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-autospace: normal;
  text-spacing-trim: normal;   /* full width at line start; adjacent pairs such as ）， share one em */
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  text-align: start;
  background: var(--bg);
  color: var(--text);
  scroll-padding-top: calc(var(--safe-top) + var(--topbar-h) + var(--s-6));
  scroll-padding-bottom: calc(var(--bottom-stack) + var(--s-6));
}
body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--select); color: var(--text); }

p, h1, h2, h3, ol, ul, dl, dd, pre { margin: 0; padding: 0; }
h1, h2, h3 { font-size: inherit; font-weight: inherit; }
ol, ul { list-style: none; }
b { font-weight: var(--w-strong); }
code, pre, .mono { font-family: var(--ff-mono); font-size: var(--t-meta); }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  padding: 0;
  margin: 0;
  text-align: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-hover) linear;
}
button:disabled { cursor: default; }
a { color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
[hidden] { display: none !important; }

.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.dim { color: var(--text-3); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i {
  width: var(--icon); height: var(--icon); flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.mark { display: block; flex: none; color: var(--mark); fill: currentColor; }

/* ---------------------------------------- mixed-language primitives (11, v0 6) */

.seg { min-width: 0; }
/* The separator is the narrow U+00B7 of Agencity Sans in both languages (11.1). */
.sep { color: var(--text-3); }
.sep.is-eol { visibility: hidden; }  /* a separator that ends a line (app.js) */
.halt { font-feature-settings: "halt"; }
.segtail, .nb, .w, .seg--nb { white-space: nowrap; }
.id, .k { font-family: var(--ff-mono); font-size: var(--t-meta); overflow-wrap: anywhere; }
/* Inside running text a mono token must not grow its line (v0 6.3). */
code.id, code.k { line-height: 0; }
.k { color: var(--text-3); }

/* ----------------------------------------------------------- buttons (6.2) */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--btn-h); height: var(--btn-h);
  padding: 0 var(--s-5);
  font-size: var(--t-body); line-height: var(--lh-body);
  white-space: nowrap;
  border-radius: var(--r-btn);
}
.btn .bz { font-weight: var(--w-strong); }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:active { background: var(--primary-press); }
.btn--outline { background: transparent; border: 1px solid var(--line-strong); color: var(--text); }
.btn--outline:active { background: var(--selected); }
.btn--primary:disabled { background: var(--disabled-bg); color: var(--text-3); }
.btn--outline:disabled { border-color: var(--line); color: var(--text-3); background: transparent; }
.btn--block {
  display: flex; width: 100%; height: auto; min-height: var(--btn-h);
  padding: var(--s-2) var(--s-4); white-space: normal; text-align: start; justify-content: flex-start;
  margin-top: var(--s-2);
}
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger-fill { background: var(--danger); color: var(--on-danger); }

/* Text button (.link): Stop, Details, Forget, Keep, Back (6.2). */
.link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: var(--tap);
  padding-inline: var(--s-3);
  font-size: var(--t-ui); line-height: var(--lh-ui);
  color: var(--text-2);
  white-space: nowrap;
  border-radius: var(--r-sm);
  text-decoration: none;
}
.link:active { background: var(--selected); }
.link:disabled, .link[aria-disabled="true"] { color: var(--text-3); background: none; }
.link--quiet { color: var(--text-3); }
.link--danger { color: var(--danger); }
.link--danger .bz { font-weight: var(--w-strong); }

.btn--icon {
  display: inline-grid; place-items: center; flex: none;
  width: var(--tap); height: var(--tap);
  color: var(--text-2);
  border-radius: var(--r-sm);
}
.btn--icon:active { background: var(--selected); }

@media (hover: hover) and (pointer: fine) {
  .link, .btn--icon { min-height: var(--tap-fine); min-width: var(--tap-fine); }
  .btn--icon { width: var(--tap-fine); height: var(--tap-fine); }
  .link:not(:disabled):hover, .btn--icon:hover, .row:hover:not(.is-selected),
  .menu__item:hover, .chip:not(.chip--stage):hover, .line__head:hover, .frow__btn:hover,
  .centry__btn:hover, .acct__who:hover, .side__home:hover, .side__mark:hover { background: var(--hover); }
  .btn--outline:not(:disabled):hover { background: var(--hover); }
  .btn--primary:not(:disabled):hover { background: var(--primary-press); }
  .composer__send:not(:disabled):hover { background: var(--primary-press); }
}

/* ------------------------------------------------- chips and tags (6.3) */

.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  min-height: var(--chip-h); padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: var(--chip); color: var(--text-2);
  font-size: var(--t-meta); line-height: var(--lh-meta);
  white-space: nowrap;
}
.chip:active { background: var(--selected); }
/* An interactive chip's hit area, through an inset ::after like the send button's: 48 tall on
   touch around the 36 px pill, 36 under a fine pointer around the 32 px one (6.3, A3). */
button.chip { position: relative; }
button.chip::after { content: ""; position: absolute; inset: calc((var(--chip-h) - var(--tap)) / 2) 0; }
@media (pointer: fine) { button.chip::after { inset: calc((var(--chip-h) - var(--tap-fine)) / 2) 0; } }
.chip .chev { width: auto; height: auto; }
.chip .chev .i { width: var(--s-4); height: var(--s-4); }
.chip[aria-pressed="true"], .chip[aria-expanded="true"] {
  background: var(--selected); color: var(--text); box-shadow: inset 0 0 0 1px var(--text);
}
.chip[aria-pressed="true"] .bz, .chip[aria-expanded="true"] .bz { font-weight: var(--w-strong); }
.chip--stage { min-height: var(--s-6); padding: 0 var(--s-2); cursor: default; }
.stage--alert, .stage--alert .be { color: var(--text); }
.stage--alert .bz { font-weight: var(--w-strong); }

/* Outcome tags: done, stopped, failed. Failed is the only red (0.4). */
.otag {
  display: inline-flex; align-items: center;
  min-height: var(--s-6); padding: 0 var(--s-2);
  border-radius: var(--r-pill);
  background: var(--chip);
  font-size: var(--t-meta); line-height: var(--lh-meta);
  white-space: nowrap;
}
.otag--done { color: var(--text-2); }
.otag--stopped { color: var(--text-3); }
.otag--failed { color: var(--danger); background: var(--danger-bg); }
/* Dashed, "not the real thing": the Lab tag (3.5). */
.tag--dashed {
  display: inline-flex; align-items: center;
  padding: 0 var(--s-2); border-radius: var(--r-pill);
  border: 1px dashed var(--line-strong);
  font-family: inherit; font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3);
  white-space: nowrap;
}
/* A protocol word, once something is opened (type tag). */
.tag {
  font-family: var(--ff-mono); font-size: var(--t-meta); line-height: var(--lh-meta);
  color: var(--text-2); background: var(--chip);
  border-radius: var(--r-xs);
  padding: 0 var(--s-1);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.check { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); white-space: nowrap; }
.check--fail { color: var(--danger); }

.chev {
  display: inline-grid; place-items: center; flex: none;
  width: var(--icon); height: var(--lh-body);
  color: var(--text-3);
}
.chev .i { transition: transform var(--dur-expand) var(--ease-out); }
[aria-expanded="true"] > .chev { color: var(--text); }
[aria-expanded="true"] > .chev .i { transform: rotate(90deg); }
[aria-expanded="true"] > .chev--down .i { transform: rotate(180deg); }

.json {
  font-family: var(--ff-mono); font-size: var(--t-meta); line-height: var(--lh-meta);
  color: var(--text-2); background: var(--surface-sunk);
  border-radius: var(--r-md);
  padding: var(--s-3);
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: var(--json-max); overflow-y: auto;
}
.envs .json, .msgs .json { background: var(--surface); }
.json--short { max-height: var(--json-max-short); }
.jk { color: var(--text-3); }

.label {
  font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong);
  color: var(--text-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
}
.err { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--danger); margin-top: var(--s-2); }

/* -------------------------------------------------------- the shell (5) */

.shell { min-height: 100dvh; }
.main { min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }

/* The sidebar (5.1); below 1024 px it is the drawer (5.3). */
.side {
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  z-index: var(--z-drawer);
}
.side__in { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.side__head {
  display: flex; align-items: center; gap: var(--s-1);
  height: var(--topbar-h); flex: none;
  padding-inline: var(--s-2);
}
.side__home { display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: var(--s-2); margin-inline-end: auto; }
.side__mark { display: grid; place-items: center; width: var(--tap); height: var(--tap); margin-inline: auto; }
@media (hover: hover) and (pointer: fine) {
  .side__home { min-height: var(--tap-fine); }
  .side__mark { width: var(--tap-fine); height: var(--tap-fine); }
}
.side__mark .mark { width: var(--mark-lockup); height: var(--mark-lockup); }
.lockup { display: inline-flex; align-items: center; gap: var(--s-2); }
.lockup .mark { width: var(--mark-lockup); height: var(--mark-lockup); }
.lockup__word {
  font-family: var(--ff-sans-en);
  font-size: var(--t-heading); line-height: var(--lh-heading); font-weight: var(--w-strong);
  color: var(--text);
}
.side__nav { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.rows { display: flex; flex-direction: column; gap: 0; }
.row {
  display: grid; grid-template-columns: var(--icon) minmax(0, 1fr) auto; column-gap: var(--s-3);
  align-items: center;
  width: calc(100% - 2 * var(--s-2));
  min-height: var(--tap);
  margin-inline: var(--s-2);
  padding-inline: var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--t-ui); line-height: var(--lh-ui);
  color: var(--text);
  text-align: start;
}
.row .i { color: var(--text-2); }
.row:active { background: var(--selected); }
.row.is-selected { background: var(--selected); }
.row.is-selected .bz { font-weight: var(--w-strong); }
.row:focus-visible { outline-offset: -2px; }
p.row { cursor: default; }
.row__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__n { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); }
.row--recent { grid-template-columns: minmax(0, 1fr) auto; color: var(--text-2); }
.row--recent.is-selected { color: var(--text); }
.row__stage { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); white-space: nowrap; }
.side__recents { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-top: var(--s-6); }
.side__label {
  display: flex; align-items: center; min-height: var(--s-7);
  padding-inline: var(--s-4);
  font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong);
  color: var(--text-3);
}
.side__bottom { flex: none; border-top: 1px solid var(--line); padding-block: var(--s-2); }
.side__closed { padding: var(--s-2) var(--s-4); font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }

/* The account row (5.1 item 6) and its menu (6.12). */
.acct {
  position: relative; flex: none;
  display: flex; align-items: center; gap: var(--s-1);
  min-height: var(--topbar-h);
  padding-inline: var(--s-2);
  border-top: 1px solid var(--line);
}
.acct__who {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--tap);
  padding-inline: var(--s-2);
  border-radius: var(--r-sm);
}
.acct__who:active { background: var(--selected); }
.disc {
  display: grid; place-items: center; flex: none;
  width: var(--disc); height: var(--disc); border-radius: var(--r-pill);
  background: var(--chip); color: var(--text);
  font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong);
}
.acct__name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--t-ui); line-height: var(--lh-ui); font-weight: var(--w-strong); color: var(--text);
}
/* The balance follows the name as one field, " · 470 credits": its separator brings its own space. */
.acct__bal { margin-inline-start: calc(-1 * var(--s-3)); font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-3); white-space: nowrap; }
.menu {
  position: absolute; left: var(--s-2); bottom: calc(100% + var(--s-1));
  min-width: var(--menu-w);
  display: flex; flex-direction: column;
  padding: var(--s-1);
  background: var(--surface-raised);
  border: 1px solid var(--line-card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: var(--z-menu);
}
.menu__item {
  display: flex; align-items: center;
  min-height: var(--tap);
  padding-inline: var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text);
  text-decoration: none; text-align: start;
}
.menu__item:active { background: var(--selected); }
@media (pointer: fine) { .row, .menu__item, .acct__who { min-height: var(--tap-fine); } }

/* The collapsed rail (5.1, collapsed): the mark, the icons, the disc; labels become the
   accessible names. */
.side.is-rail .row__label, .side.is-rail .row__n, .side.is-rail .tag--dashed,
.side.is-rail .acct__name, .side.is-rail .acct__bal, .side.is-rail .acct__set {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.side.is-rail .row { grid-template-columns: var(--icon); justify-content: center; width: var(--tap); margin-inline: auto; padding: 0; }
.side.is-rail .acct { justify-content: center; padding: 0; }
.side.is-rail .acct__who { flex: none; padding: 0; width: var(--tap); justify-content: center; }
@media (pointer: fine) { .side.is-rail .row, .side.is-rail .acct__who { width: var(--tap-fine); } }
.side.is-rail .side__closed { display: none; }

/* ------------------------------------------------- the top bar (5.4) */

.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--bg);
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__in {
  /* The sides keep their content's width and share what is left equally, so a short centre
     sits in the middle and a long sentence takes the rest with an ellipsis. */
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
  align-items: center; column-gap: var(--s-2);
  height: var(--topbar-h);
  padding-inline: var(--pad-l) var(--pad-r);
}
.topbar__l, .topbar__r { display: flex; align-items: center; min-width: 0; gap: var(--s-1); }
.topbar__l { margin-inline-start: calc(-1 * var(--s-3)); }
.topbar__r { justify-content: flex-end; margin-inline-end: calc(-1 * var(--s-3)); }
.topbar__c { display: flex; align-items: center; justify-content: center; gap: var(--s-2); min-width: 0; }
.topbar__say {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: var(--t-ui); line-height: var(--lh-ui); font-weight: var(--w-strong); color: var(--text);
}
.topbar__practice { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); white-space: nowrap; }
.topbar__practice .bz { font-weight: var(--w-strong); }
.topbar__past { display: none; font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); white-space: nowrap; }
.topbar__lockup .lockup__word { font-size: var(--t-body); line-height: var(--lh-body); }
.topbar__lockup .mark { width: var(--icon); height: var(--icon); }
/* Room for Stop, which is rendered with its run and laid out over this slot (.runbar). */
.topbar__slot { visibility: hidden; padding-inline: var(--s-3); font-size: var(--t-ui); line-height: var(--lh-ui); white-space: nowrap; }
/* Practice: the bar is tinted and its rule dashed, "not the real thing" (5.2). */
.is-practice .topbar { background: var(--surface-sunk); border-bottom: 1px dashed var(--line-strong); }

/* The practice city's progress line at the top bar's bottom edge (5.4, v0 3.1): five steps,
   never looping, hidden from S4 on. */
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: var(--hairline-2);
  pointer-events: none;
  transition: opacity var(--dur-fade) linear;
}
.progress.is-off { opacity: 0; }
.progress i {
  display: block; height: 100%;
  background: var(--text-2);
  transform-origin: left;
  transform: scaleX(calc(var(--step, 0) / 5));
  transition: transform var(--dur-step) linear;
}
.progress.js-jump i { transition: none; }

/* Stop sits at the top bar's right for the whole intent (5.4, B5). */
.runbar {
  position: fixed; z-index: var(--z-stop);
  top: var(--safe-top);
  right: calc(var(--main-r) + var(--pad-r) - var(--s-3));
  height: var(--topbar-h);
  display: flex; align-items: center;
}
.stop--busy {
  display: inline-flex; align-items: center; min-height: var(--tap);
  padding-inline: var(--s-3);
  font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-3);
  white-space: nowrap;
}

/* ------------------------------------------- the main column (5.5) and dock */

.col--you {
  flex: 1 0 auto;
  display: flex; flex-direction: column;
  width: 100%;
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--pad-l) var(--pad-r);
}
.you { flex: 1 0 auto; padding-bottom: var(--s-6); min-width: 0; }

.dock {
  position: sticky; bottom: 0; z-index: var(--z-dock);
  padding-bottom: var(--dock-gap);
  background: var(--bg);
}
/* A 24 px fade above the dock, so lines going under it read as text going under (5.5). */
.dock::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%;
  height: var(--s-6);
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

/* The context row (6.1): the address left, credits and the world clock right. */
.context { padding-inline: var(--s-4); }
/* One row, never two: the left cell gives way, by an ellipsis in the address, so the preview
   label and the right cell (credits, clock) stay whole on a phone. */
.hdr__line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3);
  min-height: var(--context-h);
  padding-top: var(--s-1);
  font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3);
  white-space: nowrap;
}
.ctx__l { display: flex; min-width: 0; }
.hdr__addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hdr__mode { flex: none; }
.hdr__more { display: none; }
@media (min-width: 640px) { .hdr__more { display: inline; } }

/* ------------------------------------------------------- the composer (6.1) */

.composer {
  background: var(--surface);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: var(--s-4) var(--s-4) var(--s-3);
  transition: border-color var(--dur-hover) linear;
}
.composer:focus-within { border-color: var(--line-strong); }
.composer__field {
  display: block; width: 100%;
  font: inherit; font-size: var(--t-body); line-height: var(--lh-body); color: var(--text);
  background: transparent;
  border: 0; border-radius: 0;
  padding: 0;
  resize: none;
  min-height: var(--s-9);
  max-height: var(--field-max);
}
.composer__field:focus, .composer__field:focus-visible { outline: none; }
.composer__field::placeholder { color: var(--text-3); opacity: 1; }
.composer--intent .composer__field::placeholder { color: var(--text-2); }
.composer__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; margin-top: var(--s-2); }
.composer__tools { display: flex; gap: var(--s-1); }
.composer__send {
  grid-column: 3;
  position: relative;
  display: grid; place-items: center;
  width: var(--send); height: var(--send);
  border-radius: var(--r-btn);
  background: var(--primary); color: var(--on-primary);
}
/* A 48 px hit area around the 36 px button. */
.composer__send::after { content: ""; position: absolute; inset: calc((var(--send) - var(--tap)) / 2); }
.composer__send:active { background: var(--primary-press); }
.composer__send:disabled { background: var(--chip); color: var(--text-3); }
.composer__err { margin: var(--s-2) var(--s-4) 0; }

/* ------------------------------------------------------- Home (8.3) */

.home { display: flex; flex-direction: column; align-items: center; row-gap: var(--s-3); padding-block: var(--s-8); }
.home__status { max-width: var(--measure); font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); text-align: center; text-wrap: balance; }
.home__title {
  display: flex; align-items: center; gap: var(--s-3);
  font-size: var(--t-display); line-height: var(--lh-display);
  color: var(--text);
  text-wrap: balance;
}
.home__mark { width: var(--mark-home); height: var(--mark-home); }
.is-home .you { display: flex; flex-direction: column; justify-content: center; }

/* ---------------------------------------------------- Your profile (8.8) */

.profile { padding-top: var(--s-8); padding-bottom: var(--s-6); }
.profile__label { font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong); color: var(--text-3); }
.profile__name { margin-top: var(--s-2); font-size: var(--t-display); line-height: var(--lh-display); color: var(--text); }
.profile__meta { margin-top: var(--s-1); font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.decl__dl {
  display: grid; grid-template-columns: var(--dt-w) minmax(0, 1fr);
  column-gap: var(--s-3); row-gap: var(--s-3);
  align-items: baseline;
  margin-top: var(--s-6); padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.decl__dl dt { font-family: var(--ff-mono); font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); overflow-wrap: anywhere; }
.decl__dl dd { margin: 0; font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); min-width: 0; }
.decl__p { display: block; }
.decl__dl dd:lang(en), .decl__p:lang(en) { text-wrap: pretty; }
.decl__foot { margin-top: var(--s-6); font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }

/* -------------------------------------------------------- an intent (6.4) */

.run { max-width: var(--column); }
.say--title {
  font-size: var(--t-title); line-height: var(--lh-title);
  color: var(--text);
  text-wrap: balance;
  margin-top: var(--s-8);
}
.byline {
  display: flex; flex-wrap: wrap; align-items: center;
  column-gap: var(--s-2); row-gap: var(--s-1);
  min-height: var(--s-7);
  margin-top: var(--s-2);
}
.byline__time, .byline__done { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); white-space: nowrap; }
.byline__arm { display: inline-flex; }
/* Forget and Keep are text buttons: 48 tall on touch, 36 under a fine pointer (6.2, A3). */
.byline__err { margin-top: 0; }

/* 往来 Messages: this run's envelopes, in place under the byline (6.4). */
.msgs {
  margin-top: var(--s-2);
  padding: var(--s-1) var(--s-1) var(--s-3);
  background: var(--surface-sunk);
  border-radius: var(--r-md);
  animation: fade var(--dur-expand) var(--ease-out) both;
}
.msgs .feed__cap { text-align: end; padding: var(--s-2) var(--s-3) var(--s-1); }
.msgs .frow__btn, .msgs .frow__more, .msgs .trace { padding-inline: var(--s-3); }
.msgs .frow:last-child { border-bottom: 0; }

/* The person's later words (v0 3.5): 600, with their label. */
.say--note, .say--change { display: flex; flex-direction: column; margin: var(--s-3) 0; }
.say__label { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.say__text {
  font-size: var(--t-body); line-height: var(--lh-body); font-weight: var(--w-strong);
  color: var(--text); white-space: pre-wrap;
}
.say--confirmed {
  font-size: var(--t-body); line-height: var(--lh-body); font-weight: var(--w-strong);
  color: var(--text); margin: var(--s-3) 0;
}

/* Agent lines (6.5): no box; the head is a full-width button whose hover and press fill a
   soft band; the chevron sits in a 32 px column, top-aligned with the first line. */
.lines { margin-top: var(--s-2); }
.line__head {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--chev-col);
  align-items: start;
  width: calc(100% + 2 * var(--s-3));
  margin-inline: calc(-1 * var(--s-3));
  padding: var(--s-3);
  border-radius: var(--r-sm);
  text-align: start;
}
.line__head:active { background: var(--selected); }
.line__head:focus-visible { outline-offset: -2px; }
.line__head .chev { justify-self: end; }
.line__text {
  font-size: var(--t-body); line-height: var(--lh-body);
  color: var(--text-2);
  text-wrap: pretty;
  min-width: 0;
  max-width: var(--measure);
}
/* Chinese lines fill greedily, as Chinese is set; render.js keeps the last few characters
   together so no line ends on an orphan (v0 6.5). */
.run:lang(zh-Hans) .line__text, .run:lang(zh-Hans) .sub,
.sheet:lang(zh-Hans) .card__where, .sheet:lang(zh-Hans) .card__money, .sheet:lang(zh-Hans) .card__who { text-wrap: wrap; }
.line__plain { padding-block: var(--s-3); padding-inline-end: var(--chev-col); }
.line__text--segs .seg { white-space: nowrap; }
.line--latest .line__text { color: var(--text); }
/* While a run is live, settled lines step back to --text-3 so the newest line is the only
   one in --text (B1, B6); its sub-lines keep the name --text and the reply --text-2. */
.run.is-live .line:not(.line--latest) .line__text { color: var(--text-3); }
.run.is-live .line:not(.line--latest) .sub__who,
.run.is-live .line:not(.line--latest) .sub__said { color: var(--text-3); }
/* After the run the receipt carries the weight: lines --text-2, names --text-2, replies one
   step below their line. */
.run:not(.is-live) .sub__who { color: var(--text-2); }
.run:not(.is-live) .sub__said { color: var(--text-3); }

.subs { margin: calc(-1 * var(--s-1)) 0 var(--s-3); padding-left: var(--s-4); max-width: var(--measure); }
.sub { font-size: var(--t-ui); line-height: var(--lh-ui); text-wrap: pretty; }
.sub__who { color: var(--text); }
.sub__said { color: var(--text-2); }
.sub__wait { color: var(--text-3); }

/* S7b: a section head, flush left; not the centred date divider of chat logs. */
.break {
  display: block;
  margin: var(--s-9) 0 var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3);
}
.break__label { color: var(--text-2); font-weight: var(--w-strong); }
.break--clock { margin: var(--s-6) 0 0; padding-bottom: var(--s-3); }

/* The inspector (6.5): one sunk panel; envelopes are offset blocks with a rule, never bubbles. */
.envs {
  display: flex; flex-direction: column; gap: var(--s-4);
  margin: var(--s-1) 0 var(--s-4);
  padding: var(--s-4);
  background: var(--surface-sunk);
  border-radius: var(--r-md);
  max-width: var(--measure);
  animation: fade var(--dur-expand) var(--ease-out) both;
}
.envs__group { display: flex; flex-direction: column; gap: var(--s-4); }
.envs__who { font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong); color: var(--text-3); }
.envs__meta, .envs__foot { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.env { display: flex; flex-direction: column; min-width: 0; }
.env--mine { margin-left: var(--env-offset); border-right: var(--hairline-2) solid var(--text-3); padding: 0 var(--s-3) 0 0; }
.env--theirs { margin-right: var(--env-offset); border-left: 1px solid var(--line-strong); padding: 0 0 0 var(--s-3); }
.env__sum { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); }
.env__reason, .frow__reason { display: block; font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); }
.cw { font-family: var(--ff-mono); font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); overflow-wrap: anywhere; }
.note-label { display: block; font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-top: var(--s-2); }
.env__note { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); white-space: pre-wrap; }
.env__sig { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-top: var(--s-1); overflow-wrap: anywhere; }
.env--mine .env__sig { text-align: end; }

.dir, .rank { display: flex; flex-direction: column; }
.dentry {
  display: grid; grid-template-columns: var(--s-6) minmax(0, 1fr); column-gap: var(--s-2);
  align-items: baseline;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
}
.dentry:first-child { border-top: 0; }
.dentry__n { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.dentry__body { min-width: 0; }
.dentry__name { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); }
.dentry__addr { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); overflow-wrap: anywhere; }
.dentry__row { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); }
.rank__row { padding: var(--s-3) 0; border-top: 1px solid var(--line); }
.rank__row:first-child { border-top: 0; }
.rank__top { display: grid; grid-template-columns: minmax(0, 1fr) var(--score-w); font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); }
.rank__score { text-align: end; }
.rank__why { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); }
.rank__meta { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.rank__split { font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong); color: var(--text-3); margin-top: var(--s-4); }

/* ----------------------------------------------------- the ask card (6.7) */

.sheet-host { display: contents; }
.sheet {
  position: relative; z-index: var(--z-card);
  display: flex; flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-raised);
  padding: var(--s-5);
  /* At least 96 px of the intent stays visible under the top bar. */
  max-height: calc(100dvh - var(--safe-top) - var(--topbar-h) - var(--keep-visible) - var(--dock-gap) - var(--safe-bottom));
}
.sheet.js-enter { animation: card-in var(--dur-card-in) var(--ease-out) both; }
.sheet.js-leave { animation: fadeout var(--dur-card-out) var(--ease-in) both; pointer-events: none; }
.sheet__body {
  overflow-y: auto; overscroll-behavior: contain; min-height: 0;
  margin-inline: calc(-1 * var(--s-3));
  padding-inline: var(--s-3);
}
.sheet__body.js-refresh { animation: fade var(--dur-fade) var(--ease-out) both; }
.card__updated {
  display: inline-flex; align-items: center;
  min-height: var(--s-6); padding: 0 var(--s-2); margin-bottom: var(--s-2);
  border-radius: var(--r-pill);
  background: var(--chip); color: var(--text);
  font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong);
}
.card__updated .be { font-weight: var(--w-strong); }
.card__title { font-size: var(--t-title); line-height: var(--lh-title); color: var(--text); text-wrap: balance; }
.card__title:focus { outline: none; }
.card__when { font-size: var(--t-heading); line-height: var(--lh-heading); color: var(--text); margin-top: var(--s-1); }
.card__where { font-size: var(--t-body); line-height: var(--lh-body); color: var(--text); margin-top: var(--s-4); text-wrap: pretty; }
.card__topic { font-size: var(--t-body); line-height: var(--lh-body); color: var(--text); }
.card__rule { border-top: 1px solid var(--line); margin: var(--s-4) 0; }
.card__money { font-size: var(--t-body); line-height: var(--lh-body); color: var(--text); text-wrap: pretty; }
.card__who { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); margin-top: var(--s-2); text-wrap: pretty; }
.card__status {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  min-height: var(--tap); margin-top: var(--s-1);
}
.card__st { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.card__dlink { font-size: var(--t-meta); line-height: var(--lh-meta); margin-inline-end: calc(-1 * var(--s-3)); gap: var(--s-1); }
.card__details { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-bottom: var(--s-2); }
.card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-4); }
.card__actions .btn { width: 100%; height: var(--card-btn-h); min-width: 0; }
.card__note { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); margin-top: var(--s-2); }
/* A row that changed after a refresh: a 2 px mark in the left padding (v0 3.10). */
.is-changed { position: relative; }
.is-changed::before {
  content: ""; position: absolute;
  left: calc(-1 * var(--s-3)); top: var(--s-1); bottom: var(--s-1);
  width: var(--hairline-2); background: var(--text);
}
/* The say field, Change (6.8). */
.card__ask { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); margin-top: var(--s-4); }
.card__field {
  display: block; width: 100%;
  font: inherit; font-size: var(--t-body); line-height: var(--lh-body); color: var(--text);
  background: var(--surface-sunk);
  border: 1px solid transparent; border-radius: var(--r-btn);
  padding: var(--s-3); margin-top: var(--s-2);
  resize: none;
  max-height: calc(var(--say-max) + 2 * var(--s-3) + 2px);
}
.card__field:focus, .card__field:focus-visible { outline: none; border-color: var(--line-strong); }
.card__left { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-top: var(--s-2); }

/* ------------------------------------------- the receipt card (6.9) */

.rcpt {
  margin-top: var(--s-6);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.rcpt__tag { margin-bottom: var(--s-3); }
.rcpt__title { font-size: var(--t-title); line-height: var(--lh-title); color: var(--text); }
.rcpt__when { font-size: var(--t-body); line-height: var(--lh-body); color: var(--text); margin-top: var(--s-1); }
.rcpt__paid { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); margin-top: var(--s-2); }
.rcpt__paid .id { color: var(--text-2); }
.rcpt__rule { border-top: 1px solid var(--line); margin: var(--s-3) 0; }
.rcpt__rawlabel { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-top: var(--s-2); }
.rcpt__money { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2); padding-block: var(--s-1); }
.party {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3);
  align-items: baseline;
  padding-block: var(--s-1);
  font-size: var(--t-ui); line-height: var(--lh-ui);
}
.party--one { grid-template-columns: minmax(0, 1fr); }
.party__who { color: var(--text); min-width: 0; }
.party.dim .party__who { color: var(--text-3); }
.party__st { color: var(--text-2); text-align: end; white-space: nowrap; }
.rcpt__stat { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
/* The model-spend rows sit after a hairline: a $ figure never shares a line with the rest (6.9). */
.rcpt__rule + .rcpt__stat + .rcpt__stat { margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--line); }
.rcpt__jump { margin-top: var(--s-4); }
/* Remembered facts, the card's last section (6.9). */
.chips { margin-top: var(--s-3); border-top: 1px solid var(--line); }
.fact {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3);
  align-items: center;
  min-height: var(--tap);
}
.fact + .fact { border-top: 1px solid var(--line); }
.fact__text { padding: var(--s-2) 0; font-size: var(--t-ui); line-height: var(--lh-ui); min-width: 0; }
.fact__pre { color: var(--text-3); }
.fact__body { color: var(--text-2); }
.fact.is-busy .fact__body { color: var(--text-3); }
.fact__cell { display: flex; justify-content: flex-end; margin-inline-end: calc(-1 * var(--s-3)); }
.fact__arm { display: flex; }
.fact.is-leaving { animation: fadeout var(--dur-fade) var(--ease-in) both; }
.fact__err { grid-column: 1 / -1; margin: 0 0 var(--s-2); }

/* ---------------------------------- World and City panels, lab only (5.6) */

.panel { background: var(--bg-side); min-width: 0; }
.feed, .city { padding: 0 var(--s-4) var(--s-6); }
.feed__top { position: sticky; top: 0; z-index: var(--z-topbar); background: var(--bg-side); margin-inline: calc(-1 * var(--s-4)); padding-inline: var(--s-4); }
/* A 12 px fade under the sticky head, so a row going under it reads as text going under. */
.feed__top::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%;
  height: var(--s-3);
  background: linear-gradient(var(--bg-side), transparent);
  pointer-events: none;
}
/* The panel's head (5.6): 世界 World or 城市 City and the close button, then the filters. */
.feed__head { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s-2); min-height: var(--topbar-h); }
.feed__title { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); white-space: nowrap; }
.feed__title .bz, .feed__title .be { font-weight: var(--w-strong); }
.feed__close { margin-inline-start: auto; margin-inline-end: calc(-1 * var(--s-2)); }
.feed__filters { order: 3; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: var(--s-2); padding-bottom: var(--s-2); }
.feed__cap { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); text-align: end; padding-bottom: var(--s-1); }
.feed__top .feed__cap { border-bottom: 1px solid var(--line); }
.feed__group { font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong); color: var(--text-2); padding: var(--s-4) 0 var(--s-2); }
.feed__none { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-3); padding: var(--s-3) 0; }
.trace { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); padding-block: var(--s-2); }
.trace__field {
  min-width: 0; height: var(--btn-h);
  font-family: var(--ff-mono); font-size: var(--t-meta); line-height: var(--lh-meta);
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--line-card); border-radius: var(--r-btn);
  padding: 0 var(--s-3);
  user-select: all; -webkit-user-select: all;
  direction: rtl; text-align: left;   /* when it does not fit, the run id and /trace stay in view */
}
.trace__field:focus { direction: ltr; }
.trace__copy { padding-inline: var(--s-4); }
.frow { border-bottom: 1px solid var(--line); }
.feed .frow { margin-inline: calc(-1 * var(--s-4)); }
.frow__btn { display: block; width: 100%; padding: var(--s-3) 0; border-radius: 0; text-align: start; }
.feed .frow__btn { padding-inline: var(--s-4); }
.frow__btn:active { background: var(--selected); }
.frow__btn:focus-visible { outline-offset: -2px; }
.frow__meta {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3);
  font-size: var(--t-meta); line-height: var(--lh-meta);
}
.frow__who { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.frow__time { color: var(--text-3); }
.arrow { color: var(--text-3); }
.frow__sum { display: block; font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); margin-top: var(--s-1); }
.frow__nlabel { display: block; font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-top: var(--s-1); }
.frow__note {
  font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.frow__llm { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); }
.frow__soft { color: var(--text-2); }
.frow__strong { color: var(--text); font-weight: var(--w-strong); }
.frow__danger { color: var(--danger); }
.frow__danger .bz { font-weight: var(--w-strong); }
.frow__more { padding: 0 0 var(--s-3); }
.feed .frow__more { padding-inline: var(--s-4); }
.frow__badge { margin-bottom: var(--s-2); }
.frow--reg .frow__who, .frow--reg .frow__sum, .frow--reg .frow__time, .frow--reg .arrow, .frow--reg .tag { color: var(--text-3); }
.frow--merchant { background: var(--merchant-bg); }
.frow--rejected { background: var(--danger-bg); box-shadow: inset var(--hairline-2) 0 0 var(--danger); }
.frow--principal { box-shadow: inset var(--hairline-2) 0 0 var(--text); }
.frow--state .frow__who { color: var(--text-3); }
.envs--world { padding-top: 0; }

/* The lab banner, first in each panel (5.6, v0 3.20). */
.banner {
  margin: var(--s-3) 0;
  padding: var(--s-2) var(--s-3);
  background: var(--surface-sunk); color: var(--text);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--t-meta); line-height: var(--lh-meta);
}
.banner__strong { font-weight: var(--w-strong); }
.cityblock { margin-top: var(--s-6); }
.city__note { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); padding: var(--s-2) 0; }
.city__clock { font-size: var(--t-body); line-height: var(--lh-body); padding: var(--s-2) 0; }
.merchant { padding: var(--s-2) 0; }
.merchant__name { font-size: var(--t-ui); line-height: var(--lh-ui); font-weight: var(--w-strong); }
.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, var(--cell))); gap: var(--s-1); margin-top: var(--s-1); }
.cell {
  aspect-ratio: 1; border-radius: var(--r-xs);
  display: grid; place-items: center;
  font-size: var(--t-meta); line-height: var(--lh-meta);
  border: 1px solid var(--line-strong); color: var(--text-2);
}
.cell--held { background: repeating-linear-gradient(135deg, var(--line-strong) 0 1px, transparent 1px 6px); color: var(--text); font-weight: var(--w-strong); }
.cell--booked { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: var(--w-strong); }
.cell--sample { display: inline-block; width: var(--s-3); height: var(--s-3); vertical-align: middle; }
.legend { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); margin-top: var(--s-2); }
.wallet { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3); align-items: baseline; padding-block: var(--s-1); }
.wallet__addr { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); overflow-wrap: anywhere; }
.wallet__n { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); }
.wallet--none { margin-top: var(--s-2); }
.wallet--none .wallet__addr { color: var(--text-3); grid-column: 1 / -1; }
.cityhead { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0; }
.cityhead__all { margin-block: calc(-1 * var(--s-3)); margin-inline-end: calc(-1 * var(--s-3)); }
.centry { padding: 0 0 var(--s-3); border-top: 1px solid var(--line); }
.centry:first-of-type { border-top: 0; }
.centry__btn {
  display: flex; align-items: center; justify-content: space-between; column-gap: var(--s-2);
  width: 100%; min-height: var(--tap); padding: var(--s-1) 0;
  text-align: start;
}
.centry__name { font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text); overflow-wrap: anywhere; }
.centry__addr { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); overflow-wrap: anywhere; }
.centry__row { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-2); overflow-wrap: anywhere; }
.centry__more { margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px dashed var(--line); }
.cal { padding: var(--s-2) 0; border-top: 1px solid var(--line); }
.cal:first-of-type { border-top: 0; }
.cal__who { font-size: var(--t-ui); line-height: var(--lh-ui); font-weight: var(--w-strong); color: var(--text); }
.crun { padding: var(--s-3) 0 0; border-top: 1px solid var(--line); }
.crun:first-of-type { border-top: 0; }
.crun__text {
  font-size: var(--t-ui); line-height: var(--lh-ui); color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.crun__meta { font-size: var(--t-meta); line-height: var(--lh-meta); color: var(--text-3); }
.crun__link { margin-left: calc(-1 * var(--s-3)); }

/* The dialog, the lab's Reset only (6.12). */
.dialog {
  background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--line-card); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: var(--s-6); max-width: var(--dialog-w);
}
.dialog::backdrop { background: var(--scrim-dialog); }
.dialog__text { font-size: var(--t-body); line-height: var(--lh-body); }
.dialog__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-6); }

/* ------------------------------------------------------ Latest (6.13) */

.latest {
  position: fixed; z-index: var(--z-latest);
  left: calc(var(--main-l) + (100% - var(--main-l) - var(--main-r)) / 2);
  bottom: calc(var(--bottom-stack) + var(--s-3));
  transform: translateX(-50%);
  min-height: var(--tap-fine); padding: 0 var(--s-4);
  font-size: var(--t-meta); line-height: var(--lh-meta); font-weight: var(--w-strong);
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--line-card);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-pop);
}
.latest .be { font-weight: var(--w-strong); }
.latest::after { content: ""; position: absolute; inset: calc((var(--tap-fine) - var(--tap)) / 2) 0; }
@media (pointer: fine) { .latest::after { content: none; } }
.latest:active { background: var(--selected); }

/* ------------------------------------------------------------ motion (3.6) */

@keyframes rise { from { opacity: 0; transform: translateY(var(--rise)); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(var(--rise-card)); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }

.is-new { animation: rise var(--dur-fade) var(--ease-out) both; }
.rcpt.is-new, .rcpt__jump.is-new { animation-name: card-in; animation-duration: var(--dur-card-in); }
.sub__said.is-new, .frow.is-new { animation-name: fade; }
.is-new.after-sheet { animation-delay: var(--dur-card-out); }

/* --------------------------------------------------------------- layouts */

/* Phone, below 640 px: the dock is fixed, 12 px from each edge, and the document scrolls
   under it (6.1). The ask card floats in it with margins on every side (6.7). */
@media (max-width: 639.98px) {
  .dock {
    position: fixed; left: 0; right: 0; bottom: 0;
    padding: 0 max(var(--dock-gap), var(--safe-right)) calc(var(--dock-gap) + var(--safe-bottom)) max(var(--dock-gap), var(--safe-left));
  }
  .you { padding-bottom: calc(var(--bottom-stack) + var(--s-6)); }
  .kb-up .dock { padding-bottom: var(--dock-gap); }
  .kb-up .context { display: none; }
}
@media (min-width: 640px) {
  .sheet { padding: var(--s-6); }
  .rcpt { padding: var(--s-6); }
}

/* Below 1024 px the sidebar is a drawer over the page with a scrim (5.3). */
@media (max-width: 1023.98px) {
  .side {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: var(--drawer-w);
    padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); padding-left: var(--safe-left);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--dur-drawer) var(--ease-out), visibility 0s linear var(--dur-drawer);
  }
  .side.is-open {
    transform: none; visibility: visible;
    transition: transform var(--dur-drawer) var(--ease-out), visibility 0s;
  }
  .scrim {
    position: fixed; inset: 0; z-index: var(--z-scrim);
    background: var(--scrim-drawer);
    animation: fade var(--dur-fade) linear both;
  }
  .side__collapse { display: none; }
  .row, .menu__item, .acct__who { min-height: var(--tap); }
  .side__close { width: var(--tap); height: var(--tap); }
}

/* 1024 and up: the sidebar is open beside the main area (5.1), or collapsed to the rail. */
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--main-l) minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100dvh; align-self: start; }
  .side__close, .topbar__menu, .scrim { display: none; }
  .topbar__in { grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar__l { margin-inline-start: 0; }
  .topbar__c { justify-content: flex-start; }
  .topbar__past { display: inline; }
  .is-home .topbar__lockup { display: none; }
}

/* 960 and up, Home: the greeting group (mark and greeting, 32 px, the card, the context row)
   is centred, its centre at about 42 % of the main area's height (8.3). */
@media (min-width: 960px) {
  .is-home .col--you::before { content: ""; flex: 42 1 0; }
  .is-home .col--you::after { content: ""; flex: 58 1 0; }
  .is-home .you { flex: 0 0 auto; padding-bottom: var(--s-7); }
  .is-home .home { padding-block: 0; }
  .is-home .dock { position: static; padding-bottom: 0; }
  .is-home .dock::before { content: none; }
}

/* The lab's panel (5.6): beside the main area from 1200 px, a full view in its place below. */
.has-panel .shell .panel { display: block; }
@media (max-width: 1199.98px) {
  .has-panel .shell .main { display: none; }
  .panel { min-height: 100dvh; padding-top: var(--safe-top); }
}
@media (min-width: 1200px) {
  .has-panel .shell { grid-template-columns: var(--main-l) minmax(0, 1fr) var(--panel-w); }
  .panel {
    position: sticky; top: 0; height: 100dvh; align-self: start;
    overflow-y: auto; overscroll-behavior: contain;
    border-left: 1px solid var(--line);
  }
}
