/* copied from packages/design: edit there, then run pnpm design:sync */
/* trinex design: one look for every trinex page.
   Apple's way: the device's own typeface, grouped lists on a soft background, one blue, quiet motion.
   Pages add only their own layout on top. Everything here sits in one layer, so a page's rules always win.

   Theme: the page follows the device. theme.js pins light or dark by changing
   <meta name="color-scheme">, and the two rules under "theme" map that back to color-scheme, so every
   light-dark() colour below follows it. */

@layer trinex {

/* ── tokens ───────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;
  interpolate-size: allow-keywords;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Malayalam", "Noto Sans Tamil", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Noto Sans Mono", monospace;

  /* type: size/line-height */
  --type-large: 700 34px/41px var(--font);
  --type-title: 600 22px/28px var(--font);
  --type-headline: 600 17px/22px var(--font);
  --type-body: 400 15px/22px var(--font);
  --type-callout: 400 14px/20px var(--font);
  --type-footnote: 400 13px/18px var(--font);
  --type-caption: 400 12px/16px var(--font);

  /* colour */
  --bg: light-dark(#f5f5f7, #000);
  --card: light-dark(#fff, #1c1c1e);
  --raised: light-dark(#fff, #2c2c2e);
  --fill: light-dark(rgb(118 118 128 / 0.12), rgb(118 118 128 / 0.24));
  --fill-strong: light-dark(rgb(118 118 128 / 0.2), rgb(118 118 128 / 0.34));
  --separator: light-dark(rgb(60 60 67 / 0.18), rgb(84 84 88 / 0.6));
  --label: light-dark(#1d1d1f, #f5f5f7);
  --secondary: light-dark(#6e6e73, rgb(235 235 245 / 0.6));
  --tertiary: light-dark(rgb(60 60 67 / 0.3), rgb(235 235 245 / 0.3));
  --tint: light-dark(#0071e3, #0a84ff);
  --tint-hover: light-dark(#0077ed, #3d9bff);
  --tint-soft: light-dark(rgb(0 113 227 / 0.1), rgb(10 132 255 / 0.18));
  --tint-soft-hover: light-dark(rgb(0 113 227 / 0.15), rgb(10 132 255 / 0.25));
  --tint-faint: light-dark(rgb(0 113 227 / 0.05), rgb(10 132 255 / 0.1));
  --on-tint: #fff;
  --red: light-dark(#d70015, #ff453a);
  --red-fill: light-dark(#ff3b30, #ff453a);
  --red-soft: light-dark(rgb(255 59 48 / 0.1), rgb(255 69 58 / 0.18));
  --green: light-dark(#248a3d, #30d158);
  --green-fill: light-dark(#34c759, #30d158);
  --green-soft: light-dark(rgb(52 199 89 / 0.14), rgb(48 209 88 / 0.18));
  --orange: light-dark(#c93400, #ff9f0a);
  --orange-fill: light-dark(#ff9500, #ff9f0a);
  --orange-soft: light-dark(rgb(255 149 0 / 0.14), rgb(255 159 10 / 0.18));
  --pill: light-dark(#fff, #636366);
  --focus: light-dark(rgb(0 113 227 / 0.5), rgb(10 132 255 / 0.6));
  --bar: light-dark(rgb(245 245 247 / 0.72), rgb(22 22 23 / 0.72));
  --material: light-dark(rgb(255 255 255 / 0.82), rgb(44 44 46 / 0.82));
  --backdrop: light-dark(rgb(0 0 0 / 0.28), rgb(0 0 0 / 0.5));
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* shape */
  --r-card: 14px;
  --r-control: 10px;
  --r-pill: 980px;

  /* space */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* depth: cards lie flat; only what floats casts a shadow */
  --shadow-float: 0 10px 36px rgb(0 0 0 / 0.16), 0 1px 4px rgb(0 0 0 / 0.08);
  --shadow-sheet: 0 24px 80px rgb(0 0 0 / 0.24), 0 2px 10px rgb(0 0 0 / 0.08);
  --shadow-pill: 0 3px 8px rgb(0 0 0 / 0.12), 0 3px 1px rgb(0 0 0 / 0.04);

  /* motion: a spring that settles inside its 0.4 s, a slight overshoot; and Apple's sheet curve, which doesn't */
  --spring: linear(0, 0.076 4.5%, 0.242 9.1%, 0.431 13.6%, 0.607 18.2%, 0.751 22.7%, 0.859 27.3%, 0.934 31.8%, 0.982 36.4%, 1.009 40.9%, 1.022 45.5%, 1.025 50%, 1.024 54.5%, 1.02 59.1%, 1.015 63.6%, 1.01 68.2%, 1.007 72.7%, 1.004 77.3%, 1.002 81.8%, 1.001 86.4%, 1 90.9%, 0.999 95.5%, 1);
  --spring-time: 0.4s;
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --quick: 140ms;
}

/* theme: the <meta> theme.js sets decides; with no script the device does */
:root:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
:root:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }

/* ── base ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  font: var(--type-body);
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, pre, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font: var(--type-large); letter-spacing: -0.4px; }
h2 { font: var(--type-headline); }
h3 { font: 600 15px/22px var(--font); }
a { color: var(--tint); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
strong, b { font-weight: 600; }
code, pre, .mono { font-family: var(--font-mono); }
::selection { background: var(--tint-soft-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.footnote { font: var(--type-footnote); color: var(--secondary); }
.caption { font: var(--type-caption); color: var(--secondary); }
.secondary { color: var(--secondary); }
.num, .tile-value, .stat b, table { font-variant-numeric: tabular-nums; }
.icon { flex: none; display: block; }
.sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── page layout ──────────────────────────────────────────────────────────── */

.page { max-width: 760px; margin: 0 auto; padding: var(--s-8) var(--s-4) 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-6); }
.page-head p { margin-top: var(--s-1); font: var(--type-body); color: var(--secondary); max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.section { margin-top: var(--s-8); }
.section:first-child, .page-head + .section, .page-head + .banners:empty + .section { margin-top: 0; }
.section > h2, .section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 0 var(--s-4) var(--s-2); }
.section-foot { padding: var(--s-2) var(--s-4) 0; font: var(--type-footnote); color: var(--secondary); max-width: 70ch; }
.section-foot.bad { color: var(--red); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-4); padding-inline: var(--s-1); }

.status { font: var(--type-callout); color: var(--secondary); }
.status:empty { display: none; }
.status.good { color: var(--green); }
.status.bad, .error { color: var(--red); }
.error { font: var(--type-callout); }
.error:empty { display: none; }

/* ── the sign-in screen ───────────────────────────────────────────────────── */

.signin { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; justify-items: center; padding: var(--s-12) var(--s-4) var(--s-6); }
.signin-box { align-self: center; inline-size: min(400px, 100%); display: grid; justify-items: center; text-align: center; }
.signin-box > .app-icon { margin-bottom: var(--s-5); }
.signin-sub { margin-top: var(--s-1); color: var(--secondary); overflow-wrap: anywhere; }
.signin-box > form { inline-size: 100%; display: grid; gap: var(--s-4); margin-top: var(--s-8); text-align: start; }
.signin-box > form > .btn.plain { justify-self: center; }
.signin-note { padding: 0 var(--s-4) var(--s-2); font: var(--type-footnote); color: var(--secondary); }
.signin-box .error { text-align: center; }
.signin-foot { padding-top: var(--s-8); }


/* ── top bar ──────────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.bar-in {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 52px;
  padding: var(--s-2) var(--s-4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2) var(--s-4);
}
.bar-end { justify-self: end; display: flex; align-items: center; gap: var(--s-2); }
.brand { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font: var(--type-headline); color: var(--label); }
.brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 719px) {
  .bar-in { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-in > .segmented { grid-column: 1 / -1; grid-row: 2; }
}

/* the app's mark: three joined points, on the tint */
.app-icon { display: grid; place-items: center; inline-size: 28px; block-size: 28px; border-radius: 7px; background: var(--tint); color: var(--on-tint); flex: none; }
.app-icon.large { inline-size: 64px; block-size: 64px; border-radius: 15px; }

/* who's signed in: a round button with their initials */
.avatar {
  appearance: none;
  inline-size: 32px;
  block-size: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--tint-soft);
  color: var(--tint);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  transition: scale 0.25s var(--ease-out), background-color var(--quick);
}
.avatar:hover { background: var(--tint-soft-hover); }
.avatar:active { scale: 0.95; }

/* ── segmented control: equal segments, one pill that springs to the chosen one ── */

.segmented {
  --count: 3;
  --index: 0;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
  min-width: 0;
}
.segmented::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block: 2px;
  inset-inline-start: 2px;
  inline-size: calc((100% - 4px) / var(--count));
  border-radius: 7px;
  background: var(--pill);
  box-shadow: var(--shadow-pill);
  translate: calc(var(--index) * 100%) 0;
  transition: translate var(--spring-time) var(--spring);
}
.segmented:dir(rtl)::before { translate: calc(var(--index) * -100%) 0; }
.segmented:not(:has(> [aria-current="page"], > [aria-selected="true"], > [aria-checked="true"]))::before { opacity: 0; }
.segmented > button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 28px;
  padding: 4px 14px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--label);
  font: 500 13px/18px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: scale 0.25s var(--ease-out), color var(--quick);
}
.segmented > button > span { overflow: hidden; text-overflow: ellipsis; }
.segmented > button:active { scale: 0.97; }
.segmented > button:not([aria-current="page"], [aria-selected="true"], [aria-checked="true"]):hover { color: var(--secondary); }
.segmented > button:focus-visible { outline-offset: 0; }
.segmented:has(> button:nth-of-type(2):last-of-type) { --count: 2; }
.segmented:has(> button:nth-of-type(4):last-of-type) { --count: 4; }
.segmented:has(> button:nth-of-type(5):last-of-type) { --count: 5; }
.segmented:has(> button:nth-of-type(6):last-of-type) { --count: 6; }
.segmented:has(> :is([aria-current="page"], [aria-selected="true"], [aria-checked="true"]):nth-of-type(2)) { --index: 1; }
.segmented:has(> :is([aria-current="page"], [aria-selected="true"], [aria-checked="true"]):nth-of-type(3)) { --index: 2; }
.segmented:has(> :is([aria-current="page"], [aria-selected="true"], [aria-checked="true"]):nth-of-type(4)) { --index: 3; }
.segmented:has(> :is([aria-current="page"], [aria-selected="true"], [aria-checked="true"]):nth-of-type(5)) { --index: 4; }
.segmented:has(> :is([aria-current="page"], [aria-selected="true"], [aria-checked="true"]):nth-of-type(6)) { --index: 5; }
.segmented.compact > button { padding-inline: 10px; min-height: 26px; }
@media (max-width: 719px) {
  .segmented > button { padding-inline: 6px; }
}

/* ── controls ─────────────────────────────────────────────────────────────── */

input, select, textarea {
  font: var(--type-body);
  color: var(--label);
  min-width: 0;
}
input:not([type="checkbox"], [type="radio"]), select, textarea {
  inline-size: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-control);
  background-color: var(--fill);
}
textarea { min-height: 88px; resize: vertical; }
select { appearance: none; padding-inline-end: 30px; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; cursor: pointer; }
select:dir(rtl) { padding-inline: 12px 30px; background-position: left 10px center; }
input::placeholder, textarea::placeholder { color: var(--tertiary); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--tint); inline-size: 18px; block-size: 18px; flex: none; cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; }
input[readonly] { color: var(--secondary); }

/* ── grouped lists ────────────────────────────────────────────────────────── */

.group { background: var(--card); border-radius: var(--r-card); overflow: clip; }
.group > * { position: relative; }
.group:not(.panel) > * + *::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: var(--sep-inset, var(--s-4)) 0;
  border-top: 0.5px solid var(--separator);
  pointer-events: none;
}
.row { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 11px var(--s-4); }
.row > .grow { flex: 1; min-width: 0; }
.row .value { margin-inline-start: auto; color: var(--secondary); text-align: end; }

/* a field: its label, then the control, in one row; stacked on phones */
.field {
  display: grid;
  grid-template-columns: minmax(120px, 36%) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--s-3);
  min-height: 44px;
  padding: 0 var(--s-4);
  transition: background-color var(--quick);
}
.field:has(> .btn, > .capsule, > span > .btn) { grid-template-columns: minmax(120px, 36%) minmax(0, 1fr) auto; }
.field-label { padding-block: 11px; color: var(--label); }
.field.stack { grid-template-columns: minmax(0, 1fr); padding-block: var(--s-2) var(--s-3); }
.field.stack > .field-label { padding-block: 2px var(--s-1); font: var(--type-footnote); color: var(--secondary); }
.field:focus-within { background: var(--tint-faint); }
.field :is(input, select, textarea) {
  inline-size: 100%;
  min-height: 44px;
  padding: 11px 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  font: var(--type-body);
}
.field :is(input, select, textarea):focus-visible { outline: none; }
.field input.mono { font-family: var(--font-mono); font-size: 14px; }
.field select { padding-inline-end: 22px; background-position: right 0 center; }
.field select:dir(rtl) { padding-inline: 22px 0; background-position: left 0 center; }
.field textarea { min-height: 88px; padding: var(--s-1) 0 0; resize: vertical; font: 400 13px/20px var(--font-mono); }
.field input:autofill { -webkit-text-fill-color: var(--label); box-shadow: 0 0 0 100px var(--card) inset; }
@media (max-width: 559px) {
  .field, .field:has(> .btn, > .capsule, > span > .btn) { grid-template-columns: minmax(0, 1fr) auto; padding-block: var(--s-2) 2px; }
  .field > .field-label { grid-column: 1 / -1; padding-block: 2px 0; font: var(--type-footnote); color: var(--secondary); }
  .field :is(input, select) { min-height: 36px; padding-block: 6px 8px; }
}

/* a list item: a badge, its title and the lines under it, its actions at the end */
.item { --sep-inset: 68px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 2px var(--s-3); padding: 14px var(--s-3) 14px var(--s-4); }
.item > * { grid-column: 2; }
.item > .monogram { grid-column: 1; grid-row: 1 / span 3; }
.item > .item-end { grid-column: 3; grid-row: 1 / span 2; align-self: start; display: flex; align-items: center; gap: var(--s-1); }
.item > .item-wide { grid-column: 2 / -1; }
.item-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); min-width: 0; }
.item-title > strong { font: var(--type-headline); overflow-wrap: anywhere; }
.item-sub { font: var(--type-footnote); color: var(--secondary); overflow-wrap: anywhere; min-width: 0; }
.item-sub > strong { font-weight: 400; color: var(--label); }
a.item-sub { justify-self: start; color: var(--tint); }
.capsules { display: flex; flex-wrap: wrap; gap: var(--s-1) 6px; margin-top: var(--s-1); }
.monogram { display: grid; place-items: center; inline-size: 40px; block-size: 40px; border-radius: var(--r-control); background: var(--tint-soft); color: var(--tint); font: var(--type-headline); }
.monogram.round { border-radius: 50%; }
.row-icon { display: grid; place-items: center; inline-size: 28px; block-size: 28px; border-radius: 8px; background: var(--tint-soft); color: var(--tint); flex: none; }

/* a group inside a group, and a group holding words and buttons rather than rows */
.group .group.inset, .group.inset { background: var(--bg); }
.group.panel { display: grid; gap: var(--s-3); padding: var(--s-5); }
.group.panel > h2 { font: var(--type-title); }
.group.panel > p { color: var(--secondary); }
.group.panel > .icon { color: var(--green-fill); }


/* a row that is a choice (a checkbox and its words) */
.check { display: flex; align-items: flex-start; gap: var(--s-3); padding: 11px var(--s-4); cursor: pointer; }
.check > input { margin: 2px 0 0; }
.check > span { flex: 1; min-width: 0; }

/* ── buttons ──────────────────────────────────────────────────────────────── */

/* buttons: filled · tinted · gray (the default) · plain; any of them destructive; regular or small */
.btn {
  --btn-bg: var(--fill);
  --btn-bg-hover: var(--fill-strong);
  --btn-ink: var(--tint);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: 500 15px/20px var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--quick), scale 0.25s var(--ease-out), opacity var(--quick);
}
.btn:hover:not(:disabled) { background: var(--btn-bg-hover); text-decoration: none; }
.btn:active:not(:disabled) { scale: 0.97; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.filled { --btn-bg: var(--tint); --btn-bg-hover: var(--tint-hover); --btn-ink: var(--on-tint); }
.btn.tinted { --btn-bg: var(--tint-soft); --btn-bg-hover: var(--tint-soft-hover); }
.btn.plain { --btn-bg: transparent; --btn-bg-hover: var(--fill); padding-inline: 10px; }
.btn.destructive { --btn-ink: var(--red); }
.btn.tinted.destructive { --btn-bg: var(--red-soft); --btn-bg-hover: var(--red-soft); }
.btn.filled.destructive { --btn-bg: var(--red-fill); --btn-bg-hover: var(--red); --btn-ink: #fff; }
.btn.small { min-height: 28px; padding: 0 12px; font: 500 13px/18px var(--font); }
.btn.plain.small { padding-inline: 8px; }
.btn.block { inline-size: 100%; min-height: 44px; font: var(--type-headline); }

/* a button that is only an icon, like the "more" button on a row */
.icon-btn {
  appearance: none;
  display: grid;
  place-items: center;
  inline-size: 30px;
  block-size: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tint);
  cursor: pointer;
  flex: none;
  transition: background-color var(--quick), scale 0.25s var(--ease-out);
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--fill); }
.icon-btn:active { scale: 0.94; }
.icon-btn.destructive { color: var(--red); }

/* status capsules */
.capsule {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--secondary);
  font: 500 12px/16px var(--font);
  white-space: nowrap;
  vertical-align: middle;
}
.capsule.green { background: var(--green-soft); color: var(--green); }
.capsule.tint { background: var(--tint-soft); color: var(--tint); }
.capsule.red { background: var(--red-soft); color: var(--red); }
.capsule.orange { background: var(--orange-soft); color: var(--orange); }
.capsule.green::before, .capsule.red::before, .capsule.orange::before { content: ""; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }

.spinner {
  display: inline-block;
  inline-size: 11px;
  block-size: 11px;
  border-radius: 50%;
  border: 1.6px solid currentColor;
  border-inline-end-color: transparent;
  animation: trinex-spin 0.8s linear infinite;
  flex: none;
}
@keyframes trinex-spin { to { rotate: 1turn; } }

/* an indeterminate progress line */
.progress { block-size: 4px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.progress::before { content: ""; display: block; block-size: 100%; inline-size: 35%; border-radius: inherit; background: var(--tint); animation: trinex-progress 1.3s var(--ease-out) infinite; }
@keyframes trinex-progress { from { translate: -100% 0; } to { translate: 290% 0; } }

/* something to know first */
.banner { display: flex; align-items: flex-start; gap: var(--s-3); padding: 14px var(--s-4); border-radius: var(--r-card); background: var(--card); }
.banner > .icon { color: var(--orange-fill); margin-top: 1px; }
.banner.bad > .icon { color: var(--red-fill); }
.banner > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.banner > div > span { color: var(--secondary); font: var(--type-callout); }
.banner > .btn { align-self: center; }
.banners { display: grid; gap: var(--s-2); }
.banners:not(:empty) { margin-bottom: var(--s-6); }

/* nothing here yet: what to do */
.empty { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-10) var(--s-6); text-align: center; }
.empty > .icon { color: var(--tertiary); margin-bottom: var(--s-2); }
.empty > h2 { font: var(--type-title); }
.empty > p { color: var(--secondary); max-width: 42ch; }
.empty > .btn { margin-top: var(--s-3); }
.empty.small { padding: var(--s-6) var(--s-4); }
.empty.small > h2 { font: var(--type-headline); }

/* numbers */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-3); }
.tile { display: grid; gap: 2px; padding: 14px var(--s-4); border-radius: var(--r-card); background: var(--card); min-width: 0; }
.tile-value { font: var(--type-title); overflow: hidden; text-overflow: ellipsis; }
.tile-label { font: var(--type-footnote); color: var(--secondary); }
/* on a phone, numbers read as one list: label, then its value at the end */
@media (max-width: 559px) {
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 0; border-radius: var(--r-card); background: var(--card); overflow: clip; }
  .tile { position: relative; display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: baseline; gap: var(--s-3); min-height: 44px; padding: 11px var(--s-4); border-radius: 0; background: none; }
  .tile + .tile::before { content: ""; position: absolute; top: 0; inset-inline: var(--s-4) 0; border-top: 0.5px solid var(--separator); }
  .tile-value { font: var(--type-headline); }
  .tile-label { font: var(--type-body); color: var(--label); }
}
.stats { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); font: var(--type-footnote); color: var(--secondary); }
.stat b { font: 600 15px/20px var(--font); color: var(--label); margin-inline-end: 3px; }

/* words to copy, with their button */
.copy { display: grid; gap: var(--s-2); }
.copy > pre {
  margin: 0;
  padding: var(--s-3) 14px;
  border-radius: var(--r-control);
  background: var(--fill);
  font: 400 13px/20px var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
  max-block-size: 260px;
  overflow: auto;
}
.copy > div { display: flex; gap: var(--s-2); }

/* tables (inside a group) */
.table-scroll { overflow-x: auto; }
.table { inline-size: 100%; border-collapse: collapse; font: var(--type-callout); }
.table th { padding: 10px var(--s-4) 6px; text-align: start; font: 500 12px/16px var(--font); color: var(--secondary); white-space: nowrap; }
.table td { padding: 10px var(--s-4); border-top: 0.5px solid var(--separator); vertical-align: middle; }
.table :is(th, td).num { text-align: end; }
.table tfoot td { font-weight: 600; }
.table input:not([type="checkbox"]) { min-height: 32px; padding: 5px 8px; inline-size: 88px; text-align: end; border-radius: 8px; }

/* a disclosure: a row that opens what's under it */
.disclosure > summary { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 11px var(--s-4); cursor: pointer; list-style: none; color: var(--label); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary > .icon:last-child { margin-inline-start: auto; color: var(--tertiary); transition: rotate 0.3s var(--ease-out); }
.disclosure[open] > summary > .icon:last-child { rotate: 90deg; }
.disclosure > summary > .summary-value { margin-inline-start: auto; font: var(--type-footnote); color: var(--secondary); }
.disclosure > summary > .summary-value + .icon { margin-inline-start: 0; }
.disclosure > summary:hover { background: var(--tint-faint); }
.disclosure > summary:focus-visible { outline-offset: -3px; }
.disclosure::details-content { block-size: 0; overflow: clip; transition: block-size 0.35s var(--ease-out), content-visibility 0.35s allow-discrete; }
.disclosure[open]::details-content { block-size: auto; }
.disclosure-body { padding: 0 var(--s-4) var(--s-4); }

/* ── menus (popover) ──────────────────────────────────────────────────────── */

.menu {
  /* without anchor positioning, ui.js places it from these */
  position: fixed;
  inset: auto;
  margin: 0;
  min-inline-size: 220px;
  max-inline-size: min(320px, calc(100vw - 16px));
  padding: 5px;
  border: 0;
  border-radius: 12px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow-float), 0 0 0 0.5px var(--separator);
  color: var(--label);
  font: var(--type-callout);
}
@supports (position-area: block-end) {
  .menu { position-area: block-end span-inline-start; position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline; margin-block: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  /* closing: this holds once :popover-open goes */
  .menu {
    opacity: 0;
    translate: 0 -4px;
    transition: opacity, translate, display, overlay;
    transition-duration: 0.15s;
    transition-timing-function: ease-out;
    transition-behavior: allow-discrete;
  }
  /* opening: quicker */
  .menu:popover-open {
    opacity: 1;
    translate: 0 0;
    transition-duration: 0.1s;
  }
  @starting-style { .menu:popover-open { opacity: 0; translate: 0 -4px; } }
}
.menu :is(button, a) {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  inline-size: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.menu :is(button, a) > .icon { color: var(--secondary); }
.menu :is(button, a):is(:hover, :focus-visible):not(:disabled) { background: var(--fill); outline: none; }
.menu .destructive, .menu .destructive > .icon { color: var(--red); }
.menu button:disabled { opacity: 0.4; cursor: default; }
.menu hr { margin: 5px 10px; border: 0; border-top: 0.5px solid var(--separator); }
.menu-head { display: grid; gap: 1px; padding: 8px 10px 6px; }
.menu-head > :first-child { font: 600 14px/20px var(--font); }
.menu-head > :not(:first-child) { font: var(--type-footnote); color: var(--secondary); overflow-wrap: anywhere; }

/* ── sheets (dialog): centred on wide screens, rising from the bottom on phones ── */

.sheet {
  inline-size: min(440px, calc(100vw - 32px));
  max-inline-size: none;
  max-block-size: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--raised);
  color: var(--label);
  box-shadow: var(--shadow-sheet);
  overflow: auto;
  opacity: 0;
  translate: 0 10px;
  scale: 0.96;
  transition: opacity 0.18s ease-in, translate 0.2s ease-in, scale 0.2s ease-in, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}
.sheet:modal { overscroll-behavior: contain; }
.sheet[open] {
  opacity: 1;
  translate: 0 0;
  scale: 1;
  transition: opacity 0.22s ease-out, translate var(--spring-time) var(--spring), scale var(--spring-time) var(--spring), display var(--spring-time) allow-discrete, overlay var(--spring-time) allow-discrete;
}
@starting-style { .sheet[open] { opacity: 0; translate: 0 10px; scale: 0.96; } }
.sheet::backdrop {
  background: var(--backdrop);
  opacity: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  transition: opacity 0.2s ease, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}
.sheet[open]::backdrop { opacity: 1; }
@starting-style { .sheet[open]::backdrop { opacity: 0; } }
.sheet-content { display: grid; gap: var(--s-4); padding: var(--s-6); }
.sheet-content > h2 { font: var(--type-title); }
.sheet-content > p:not(.error) { color: var(--secondary); }
.sheet-content > p strong { color: var(--label); }
.sheet-field { display: grid; gap: 6px; font: var(--type-footnote); color: var(--secondary); }
.sheet-field > span:has(> .btn) { display: flex; gap: var(--s-2); }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-2); }
.sheet-actions > .btn { min-width: 96px; }
.sheet-content.swap { animation: trinex-fade 0.25s ease-out; }
@keyframes trinex-fade { from { opacity: 0; } }
@media (max-width: 559px) {
  .sheet {
    inline-size: 100%;
    max-block-size: calc(100dvh - 24px);
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    translate: 0 100%;
    scale: 1;
    transition: opacity 0.2s ease-in, translate 0.28s ease-in, display 0.28s allow-discrete, overlay 0.28s allow-discrete;
  }
  .sheet[open] { translate: 0 0; transition: opacity 0.2s ease-out, translate var(--spring-time) var(--ease-sheet), display var(--spring-time) allow-discrete, overlay var(--spring-time) allow-discrete; }
  @starting-style { .sheet[open] { translate: 0 100%; } }
  .sheet-actions { flex-direction: column-reverse; }
  .sheet-actions > .btn { inline-size: 100%; min-height: 44px; font: var(--type-headline); }
}

/* ── the toast: a short word after something worked ───────────────────────── */

.toast {
  position: fixed;
  inset: auto 0 max(24px, env(safe-area-inset-bottom)) 0;
  margin: 0 auto;
  inline-size: fit-content;
  max-inline-size: calc(100vw - 32px);
  align-items: center;
  gap: var(--s-2);
  padding: 10px 18px 10px 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow-float), 0 0 0 0.5px var(--separator);
  color: var(--label);
  font: 500 14px/20px var(--font);
  opacity: 0;
  translate: 0 12px;
  scale: 0.96;
  transition: opacity 0.2s ease, translate 0.2s ease, scale 0.2s ease, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}
.toast:popover-open { display: flex; opacity: 1; translate: 0 0; scale: 1; transition: opacity 0.2s ease-out, translate var(--spring-time) var(--spring), scale var(--spring-time) var(--spring), display var(--spring-time) allow-discrete, overlay var(--spring-time) allow-discrete; }
@starting-style { .toast:popover-open { opacity: 0; translate: 0 12px; scale: 0.96; } }
.toast > .icon { color: var(--green-fill); }
.toast.bad > .icon { color: var(--red-fill); }

/* ── reduced motion: fades only ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .segmented::before, .disclosure::details-content, .disclosure > summary > .icon:last-child { transition: none; }
  .btn:active:not(:disabled), .segmented > button:active, .avatar:active, .icon-btn:active { scale: none; }
  .sheet, .sheet[open], .toast, .toast:popover-open { translate: none; scale: none; }
  @starting-style {
    .sheet[open], .toast:popover-open { translate: none; scale: none; }
  }
  .spinner { animation-duration: 2.4s; }
  .progress::before { animation: none; inline-size: 100%; opacity: 0.5; }
}

}
