/* Gelim Account's portal, on the Account and R2A boards of the Gelim design pack (round 2, 2 Oct
   2026) in Gelim's tokens (13 Oct): a 232 px rail and a 64 px header on wool, cards of 12 px,
   Inter, Inter Tight for the wordmark only, and JetBrains Mono for kickers, dates and figures. Every colour is a token
   (tokens.css); tests/test_design_tokens.py refuses any other. The operator panel shares the
   base rules. */

/* ---------- Base ---------- */
:root {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  color: var(--text);
}
h1 {
  font-size: var(--text-2xl);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
}
h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 var(--space-3);
}
h3 {
  font-size: var(--text-md);
  margin: 0 0 var(--space-2);
}
p {
  margin: 0 0 var(--space-2);
}
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}
.muted {
  color: var(--muted);
  font-size: var(--text-sm);
}
.eyebrow,
.kicker {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}
.money,
.amount,
.tile-value,
td {
  font-variant-numeric: tabular-nums;
}
.skip,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  width: auto;
  height: auto;
  clip: auto;
  z-index: 20;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-radius: var(--radius);
}
:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: 0 0 0 1px var(--accent);
}
.icon {
  display: block;
  flex: none;
}
main {
  overflow-x: clip;
}

/* ---------- Controls ---------- */
button,
select,
input,
textarea,
.primary,
.button-link {
  font: inherit;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  cursor: pointer;
}
button:hover {
  background: var(--hover);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.primary,
button.primary,
.button-link.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 13.5px;
  font-weight: var(--weight-strong);
  text-decoration: none;
  cursor: pointer;
}
.primary:hover,
button.primary:hover {
  background: var(--primary);
  filter: brightness(0.92);
}
.primary.small {
  min-height: 34px;
  padding: 0 14px;
}
.primary.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}
.link-button {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: var(--weight-medium);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-button:hover {
  background: none;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
}
label {
  display: block;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text);
}
input,
select,
textarea {
  max-width: 100%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}
input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: var(--input-height);
  padding: 0 12px;
}
textarea {
  padding: 10px 12px;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--input-border);
}
select {
  display: block;
  margin-top: 6px;
  min-width: 0;
}
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--indigo);
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text);
}
.switch input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--input-border);
  border: 0;
  cursor: pointer;
  flex: none;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  transition: transform 0.15s ease-out;
}
.switch input:checked {
  background: var(--indigo);
}
.switch input:checked::after {
  transform: translateX(16px);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip-choice,
.type-chips button {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
}
.chip-choice[aria-pressed="true"],
.type-chips button[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
/* A row of choices drawn as one control: periods, scopes, sorts. */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--hover);
}
.segmented button {
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.segmented button[aria-pressed="true"],
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.badge.ok {
  background: var(--highlight);
  color: var(--on-highlight);
}
.badge.warn {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ---------- Shell: rail, header, phone tab bar ---------- */
.shell {
  min-height: 100vh;
}
body.signed-in .shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
}
.column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}
/* Gelim's mark on its tile (the pack's 9 x 9 gol: madder, indigo, one wool knot) and the
   wordmark, Inter Tight 800 at -4 %. */
.mark-tile {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-mark-tile);
  background: var(--tile);
}
.mark {
  display: block;
}
.mark-m {
  fill: var(--madder);
}
.mark-i {
  fill: var(--indigo);
}
.mark-w {
  fill: var(--wool);
}
.wordmark-text {
  font-family: var(--font-wordmark);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.04em;
  line-height: 1;
}
.wordmark-note {
  margin-left: 2px;
  font-size: 13px;
  color: var(--subtle);
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: 30px 14px 20px;
  border-right: 1px solid var(--border);
}
.rail .brand {
  padding: 0 10px;
}
.rail nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail nav a,
.rail-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  text-decoration: none;
  width: 100%;
}
.rail nav a .icon,
.rail-link .icon {
  color: var(--muted);
}
.rail nav a:hover,
.rail-link:hover {
  background: var(--hover);
}
.rail nav a[aria-current="page"] {
  background: var(--selected);
  font-weight: var(--weight-strong);
}
.rail nav a[aria-current="page"] .icon {
  color: var(--text);
}
.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.rail-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-3) 10px 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: var(--weight-strong);
}
.rail-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.rail-words strong {
  font-size: 13px;
  font-weight: var(--weight-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-words span {
  font-size: 12px;
  color: var(--subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  margin-right: auto;
}
body.signed-in .topbar-brand {
  display: none;
}
.plan-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--selected);
  font-size: 12.5px;
}
.plan-pill strong {
  font-weight: var(--weight-strong);
}
.plan-note {
  margin-right: auto;
  font-size: 13px;
  color: var(--subtle);
}
.balance-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}
.balance-chip .kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
}
.balance-chip strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: var(--weight-display);
  letter-spacing: -0.01em;
}
.profile {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.header-link:hover {
  background: var(--hover);
}
main {
  flex: 1;
  width: 100%;
  max-width: 1208px;
  padding: 28px var(--space-6) 48px;
}
footer {
  padding: var(--space-4) var(--space-6);
  font-size: 12px;
  color: var(--subtle);
}
.tabbar {
  display: none;
}

/* ---------- Page heads ---------- */
.page-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-5);
}
.page-title h1:focus {
  outline: none;
}
.page-intro {
  flex-basis: 100%;
  margin: -6px 0 0;
  font-size: var(--text-md);
  color: var(--muted);
}
.page-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ---------- Cards ---------- */
.panel,
.tile,
.credit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.panel {
  padding: 18px;
  margin-bottom: var(--space-5);
}
.panel p {
  color: var(--muted);
}
.panel > p:last-child {
  margin-bottom: 0;
}
.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.section-title h2 {
  margin: 0;
}
.section-title a,
.section-title .link-button {
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  color: var(--text);
  text-decoration: none;
}
.section-title a:hover,
.section-title .link-button:hover {
  text-decoration: underline;
}
.small-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--weight-strong);
  margin: var(--space-3) 0 var(--space-2);
}
.section-title .small-title {
  margin: 0;
}
.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.columns > .panel {
  margin: 0;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.tile {
  padding: 18px;
}
.tile p {
  margin: 0;
}
.tile-label {
  font-size: 12.5px;
  color: var(--subtle);
}
.tile-value {
  margin: 4px 0 2px !important;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: var(--weight-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.tile-note {
  font-size: 12px;
  color: var(--subtle);
}
.credit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: 18px;
  margin-bottom: var(--space-5);
}
.credit h2 {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: var(--weight-regular);
  color: var(--subtle);
  margin: 0;
}
.amount {
  margin: 6px 0 10px;
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-display);
  letter-spacing: -0.02em;
  line-height: 1;
}
.balance-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}
.credit-details p {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.credit-details p:last-child {
  border-bottom: 0;
}
.credit-details strong {
  font-weight: var(--weight-strong);
  white-space: nowrap;
}
.alert,
.status:not(:empty) {
  margin: 0 0 var(--space-3);
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}
.alert p {
  margin: 0;
  color: inherit;
}
.alert.warning,
.status:not(:empty) {
  border-color: var(--warning);
  background: var(--warning-bg);
  color: var(--text);
}
.alert.danger {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--text);
}
.alert.ok {
  border-color: var(--green);
  background: var(--success-bg);
}
#status:not(:empty) {
  margin-bottom: var(--space-4);
}
.facts {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-4);
  color: var(--muted);
  font-size: 13px;
}
.facts li {
  overflow-wrap: anywhere;
}
.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.plain-list li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.plain-list li:first-child {
  border-top: 0;
}
.danger-zone {
  border-color: var(--danger);
}
.danger-zone h2,
.danger-zone h3 {
  color: var(--danger);
}

/* Getting started: one row of checks (AccountOverview). */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}
.step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.step a {
  color: var(--text);
  text-decoration: none;
}
.step a:hover {
  text-decoration: underline;
}
.step-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
}
.step.done .step-mark {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-primary);
}
.step.done a,
.step.done span {
  color: var(--subtle);
}
#getting-started {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  padding: 14px 18px;
}
#getting-started .section-title {
  margin: 0;
  flex: 1 1 auto;
  order: 0;
}
#getting-started h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

/* Cards whose rows run edge to edge under a header line (the boards' limits, where it went,
   recent charges, activity, members). */
.table-card {
  padding: 0;
  overflow: hidden;
}
.table-card > .section-title {
  margin: 0;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.table-card > ul,
.table-card > div:not(.section-title),
.table-card > .table-note {
  padding: 0 18px;
}
.table-card > .table-note {
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--subtle);
}
.stat-grid {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.stat-grid .tile {
  flex: 1 1 0;
  min-width: 0;
  min-height: 140px;
}
.stat-grid .tile-lead {
  flex-grow: 1.3;
}
h2.tile-label {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: var(--weight-regular);
  letter-spacing: 0;
  color: var(--subtle);
}
.tile-lead .amount {
  margin: 6px 0 12px;
}
.tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tile .link-button {
  font-size: inherit;
  color: var(--subtle);
}
.getting-started {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  padding: 15px 18px;
}
.getting-started h2 {
  margin: 0;
}
.getting-started .steps {
  flex: 1 1 auto;
}
.getting-started > .link-button {
  margin-left: auto;
  color: var(--text);
  text-decoration: none;
}
.bar-list,
.work-list {
  list-style: none;
  margin: 0;
}
.bar-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 110px;
  align-items: center;
  gap: var(--space-4);
  min-height: 46px;
  border-bottom: 1px solid var(--border);
}
.bar-row:last-child,
.work-row:last-child {
  border-bottom: 0;
}
.bar-track {
  display: block;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--hover);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  width: var(--share, 0%);
  border-radius: inherit;
  background: var(--indigo);
}
.bar-fill.over {
  background: var(--danger);
}
.bar-words {
  text-align: right;
  font-size: 12.5px;
  color: var(--subtle);
}
.work-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto 64px;
  align-items: center;
  gap: var(--space-3);
  min-height: 46px;
  border-bottom: 1px solid var(--border);
}
.work-icon {
  display: block;
  width: 18px;
  height: 18px;
}
.work-row .money {
  text-align: right;
}
.work-count {
  text-align: right;
  font-size: 12.5px;
  color: var(--subtle);
}

/* ---------- Lists ---------- */
.list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}
.list-tools input,
.list-tools select {
  margin: 0;
  min-width: 0;
}
.list-tools input {
  flex: 1 1 240px;
  max-width: 420px;
}
.list-tools select {
  width: auto;
}
.list-count {
  margin: 0 0 var(--space-2);
  font-size: 12.5px;
  color: var(--subtle);
}
.list-group + .list-group {
  margin-top: var(--space-4);
}
.list-group-title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: var(--space-2) 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}
.list-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row:focus {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: -2px;
}
.list-row:not(.expands) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 var(--space-3);
  align-items: start;
}
.list-row:not(.expands) > .list-details > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}
.list-row:not(.expands) > .list-details[open] {
  grid-column: 1 / -1;
}
.list-row.expands > .list-details > summary {
  list-style: none;
  cursor: pointer;
}
.list-row.expands > .list-details > summary::-webkit-details-marker {
  display: none;
}
.list-row.expands > .list-details > summary:hover {
  background: var(--hover);
}
.list-details ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2);
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.list-details li {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-tint);
}
.list-state p {
  margin: var(--space-3) 0;
}
.list-more {
  margin-top: var(--space-3);
}
.activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px var(--space-3);
  align-items: center;
}
/* The Models table (the owner's requests of 17 and 18 Oct 2026): one flat table, every
   column sortable from its head, heads on two lines at most. It fits its card at desktop
   widths; narrower, it scrolls sideways inside the card with a shadow on the side with more
   to see, the model's column staying. */
.models-card > #models-list {
  padding: 0;
}
.models-tools {
  padding: 0 18px;
}
.models-frame {
  position: relative;
  border-top: 1px solid var(--border);
}
.models-frame::before,
.models-frame::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  width: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.models-frame::before {
  left: var(--models-sticky, 0px);
  background: linear-gradient(to right, color-mix(in srgb, var(--ink) 14%, transparent), transparent);
}
.models-frame::after {
  right: 0;
  background: linear-gradient(to left, color-mix(in srgb, var(--ink) 14%, transparent), transparent);
}
.models-frame.more-left::before,
.models-frame.more-right::after {
  opacity: 1;
}
.models-scroll {
  /* Positioned, so the cells' screen-reader text is clipped with the table, not the page. */
  position: relative;
  max-width: 100%;
}
.models-scroll:focus-visible {
  outline-offset: -2px;
}
.models-table th,
.models-table td {
  padding: 8px 5px;
  vertical-align: middle;
  white-space: nowrap;
}
.models-table td:last-child {
  text-align: left;
}
.models-table tbody th {
  padding-left: 18px;
}
.models-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.models-table thead th {
  padding: 0;
  vertical-align: bottom;
  background: var(--surface);
}
.models-table thead th.group {
  padding: 8px 6px 0;
  text-align: center;
  border-bottom: 0;
  color: var(--subtle);
}
.models-table thead th.group > span {
  display: inline;
}
.models-table thead th.group > .unit {
  margin-left: 6px;
}
.models-table .sort {
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 4px 5px 7px;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
}
.models-table .sort {
  position: relative;
  /* A control's least height (the portal's tokens test): 28 px, 44 on a phone. */
  min-height: 28px;
}
/* The sort arrow takes no room: a head never widens its column when it sorts. */
.models-table .sort-mark {
  position: absolute;
  top: 4px;
  right: 1px;
  font-size: 10px;
}
.models-table th.num .sort-mark {
  right: auto;
  left: 1px;
}
.models-table th[data-sort="name"] .sort {
  padding-left: 18px;
}
.models-table .sort:hover {
  background: var(--hover);
  color: var(--text);
}
.models-table th[aria-sort] .sort {
  color: var(--text);
}
.models-table .unit {
  font-family: var(--font-sans, inherit);
  font-size: 11px;
  font-weight: var(--weight-regular);
  text-transform: none;
  letter-spacing: 0;
  color: var(--subtle);
}
.models-table .sort > .unit {
  display: block;
}
.models-table th[data-sort="name"],
.models-table tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}
.models-table tbody th {
  z-index: 1;
  white-space: normal;
  min-width: 128px;
  max-width: 220px;
}
.model-name strong {
  font-weight: var(--weight-medium);
}
.model-name .pill {
  margin-top: 2px;
}
.models-table .muted-cell,
.model-provider,
.model-abilities,
.model-when {
  color: var(--muted);
}
.model-abilities {
  white-space: nowrap;
}
.ability {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 1px;
  border-radius: 6px;
  background: var(--surface-tint);
  color: var(--muted);
  vertical-align: middle;
}
.models-card > #models-list > .list-count {
  margin: 0;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
}
.models-card > #models-list > .list-state {
  padding: 0 18px 12px;
}
.model-shown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: var(--weight-regular);
}
.pill.warn {
  background: var(--warning-bg);
  color: var(--warning);
}
.pill.new {
  background: var(--highlight);
  color: var(--on-highlight);
}
.model-name .pill.new {
  margin-left: 6px;
}
.activity-row {
  grid-template-columns: 110px minmax(0, 1fr) 150px 84px 96px 84px;
  gap: var(--space-3);
}
.activity-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--subtle);
  white-space: nowrap;
}
.activity-work {
  color: var(--muted);
}
.activity-row > .pill {
  justify-self: start;
}
.activity-row > .money {
  text-align: right;
  white-space: nowrap;
}
.activity-state {
  text-align: right;
  font-size: 12.5px;
  color: var(--subtle);
}

.hidden-model strong {
  color: var(--subtle);
}
.usage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0 var(--space-4);
  align-items: baseline;
}
.usage-row .usage-name {
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}
.usage-row > .muted:not(.usage-share) {
  grid-column: 1;
  grid-row: 2;
  font-size: 12px;
  color: var(--subtle);
}
.usage-share {
  grid-column: 3;
  grid-row: 1;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--subtle);
}
.usage-row .money {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}
.month-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}
.month-row .money {
  font-variant-numeric: tabular-nums;
}
.app-last {
  font-size: 12px;
  color: var(--subtle);
  font-weight: var(--weight-regular);
}
.member-row,
.purchase-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
}
.member-name {
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-left: auto;
}
.purchase-row .purchase-amount {
  font-weight: var(--weight-strong);
}
.purchase-row a {
  margin-left: auto;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}
/* A column's head is a kicker; a row's head is its name, in the row's own type. */
thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}
tbody th {
  font-weight: var(--weight-medium);
}
th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
td:last-child {
  text-align: right;
}
.plan-table td:last-child {
  text-align: left;
}

/* The list component: its rows, then its count and its state, as the boards place them. */
.list {
  display: flex;
  flex-direction: column;
}
.list > .list-tools {
  order: 0;
}
.list > .list-body {
  order: 1;
}
.list > .list-count {
  order: 2;
  margin: 0;
  padding: 10px 0 12px;
}
.table-card .list > .list-count {
  margin: 0 -18px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
}
.list > .list-state {
  order: 3;
}
.list > .list-more {
  order: 4;
  align-self: flex-start;
  margin-bottom: var(--space-3);
}
.list-short > .list-tools:not(:has(select)) {
  display: none;
}
.list-short > .list-tools input[type="search"] {
  display: none;
}
.table-card .list-tools {
  margin: 12px 0 4px;
}
.usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
}
.usage-grid > .panel {
  margin: 0;
}
#usage-tabs .tabs,
.segmented-tabs .tabs {
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: var(--radius);
  background: var(--hover);
}
#usage-tabs .tabs [role="tab"],
.segmented-tabs .tabs [role="tab"] {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}
#usage-tabs .tabs [role="tab"][aria-selected="true"],
.segmented-tabs .tabs [role="tab"][aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.page-title h1:focus-visible {
  outline: none;
  box-shadow: none;
}

.models-card .list-tools {
  margin: 12px 0;
}

/* ---------- Charts ---------- */
.chart-figure {
  margin: 0;
}
.chart-caption {
  margin-bottom: var(--space-2);
  font-size: 12.5px;
  color: var(--subtle);
}
.chart-svg {
  display: block;
  width: 100%;
  height: 220px;
}
.chart-axis {
  stroke: var(--border);
  vector-effect: non-scaling-stroke;
}
.chart-bar.chart-text {
  fill: var(--chart-text);
}
.chart-bar.chart-image {
  fill: var(--chart-image);
}
.chart-bar.chart-video {
  fill: var(--chart-video);
}
.chart-bar.chart-audio {
  fill: var(--chart-audio);
}
.chart-bar.chart-none {
  fill: var(--chart-none);
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-data summary {
  margin-top: var(--space-2);
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text);
  cursor: pointer;
}
.share-bar {
  display: block;
  width: 100%;
  height: 8px;
  margin: var(--space-2) 0;
}
.share-track {
  fill: var(--hover);
}

/* ---------- Apps ---------- */
.app-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.app-tile {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.app-icon {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  object-fit: contain;
  background: var(--tile);
}
.app-tile-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-tile-words .muted {
  font-size: 12px;
}
.app-cards {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: grid;
  gap: var(--space-4);
}
.app-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: var(--space-3) var(--space-5);
  align-items: start;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.app-card .app-icon {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  padding: 10px;
}
.app-card h3 {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
  font-size: 19px;
  letter-spacing: -0.02em;
}
.app-card p {
  margin: 0 0 var(--space-1);
  color: var(--muted);
}
.app-line {
  color: var(--subtle);
}
.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  font-size: 13.5px;
}
.app-card {
  grid-template-columns: 56px minmax(0, 1fr) auto;
}
.app-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-bottom: 6px;
}
.app-card-head h3 {
  margin: 0;
}
.app-card-head .app-line {
  font-size: 13px;
}
.app-devices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 13.5px;
}
.app-devices li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--green);
  color: var(--on-primary);
  font-size: 11px;
  line-height: 1;
}
.app-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.danger-text {
  color: var(--danger);
  text-decoration: none;
}
.app-note {
  font-size: 12.5px;
  color: var(--subtle);
}

/* ---------- Credit ---------- */
.amount-chips {
  border: 0;
  margin: 0 0 var(--space-3);
  padding: 0;
}
.amount-chips legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}
#topup {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}
#topup label {
  width: 100%;
}
#topup select {
  margin-top: 0;
}
.credit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.credit-grid > .panel {
  margin: 0;
}
.credit-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.amount-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0;
}
.amount-line .amount {
  margin: 0;
  font-size: 40px;
}
.credit-add .section-title {
  margin-bottom: var(--space-2);
}
.credit-add .section-title h2 {
  margin: 0;
}
.limit-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 6px var(--space-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
/* The name and the choice on one line, what the month used below them. */
.limit-words {
  display: contents;
}
.limit-row strong {
  grid-column: 1;
  grid-row: 1;
}
.limit-row .limit-state {
  grid-column: 1 / -1;
  grid-row: 2;
}
.limit-row .limit-edit {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-end;
}
.reply-limit .limit-edit select {
  width: 100%;
  max-width: 300px;
}
.limit-row .segmented button {
  min-height: 30px;
}
.limit-row:last-child {
  border-bottom: 0;
}
.limit-row strong {
  font-weight: var(--weight-medium);
}
.limit-row .limit-state {
  font-size: 12.5px;
  color: var(--subtle);
}
.limit-row .limit-over {
  color: var(--danger);
}
.limit-row .limit-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.limit-row select,
.limit-row input {
  margin: 0;
}
.limit-row input {
  width: 96px;
}
.limit-row input:disabled {
  opacity: 0.5;
}
.reply-limit {
  border-bottom: 0;
}
#limits-save {
  margin-top: var(--space-2);
}

/* ---------- Usage ---------- */
.usage-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.usage-controls label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.usage-controls select,
.usage-custom input {
  margin: 0;
}
.usage-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
}
.usage-csv {
  margin-left: auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: var(--weight-strong);
  font-size: 13.5px;
  text-decoration: none;
}

/* ---------- Teams ---------- */
/* The team page on the boards (AccountTeam, R2ATeamInvitations, R2ATeamApps,
   AccountTeamBilling, AccountTeamSignIn, R2ATeamSettings): the team's name and facts as the
   page's title, its tabs under them, and each tab's parts in cards. */
.tabs {
  display: flex;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs [role="tab"] {
  min-height: 40px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  white-space: nowrap;
}
.tabs [role="tab"][aria-selected="true"] {
  border-bottom-color: var(--text);
  font-weight: var(--weight-medium);
}
[role="tabpanel"]:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.team-bar {
  align-items: center;
}
.team-bar .team-pick {
  font-size: 13.5px;
}
.team-bar select {
  margin: 0;
  min-width: 160px;
  min-height: 34px;
}
.icon-button {
  width: 38px;
  padding: 0;
  color: var(--muted);
}
.team-create {
  margin-bottom: var(--space-4);
}
.team-create summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: var(--weight-medium);
}
.team-create[open] summary {
  margin-bottom: var(--space-3);
}
#team-plan {
  margin-bottom: var(--space-4);
}
#team-status:empty {
  display: none;
}
.team-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}
.team-cards > .panel {
  margin: 0;
}
#teams .panel h3,
#teams .panel h4,
#team-billing .panel h3 {
  margin-top: 0;
}
#teams .actions,
#team-billing .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
#teams input:not([type="checkbox"]):not([type="radio"]),
#teams select,
#team-billing input {
  width: 100%;
  margin: 6px 0 var(--space-3);
}
#teams label,
#team-billing label {
  margin-top: var(--space-2);
}
#teams label.switch,
#teams label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-weight: var(--weight-regular);
}
#teams label > input[type="checkbox"] {
  flex: none;
  margin-top: 2px;
}
#teams .team-bar select {
  width: auto;
  margin: 0;
}
#team-manual-link {
  overflow-wrap: anywhere;
}
.field-hint {
  display: block;
  margin: -6px 0 var(--space-3);
  font-size: 12px;
  color: var(--subtle);
}

/* Members: one table, the role its column; a member's Manage opens under their row. */
.member-head,
.invite-head {
  display: grid;
  gap: var(--space-3);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}
.member-head {
  grid-template-columns: 30px minmax(0, 1.4fr) minmax(0, 1fr) 72px;
}
.member-head > span:first-child {
  grid-column: 1 / 3;
}
.list > .member-head,
.list > .invite-head {
  order: 0;
  margin: 0 -18px;
}
.members-card .list-tools,
.invitations-card .list-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: 12px 0;
}
#teams .list-tools select,
#teams .list-tools input {
  width: auto;
  min-height: 34px;
  margin: 0;
}
.members-card .list-row:not(.expands),
.invitations-card .list-row:not(.expands) {
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  margin: 0 -18px;
  padding: 12px 18px;
}
.members-card .list-row:not(.expands) > .list-details,
.invitations-card .list-row:not(.expands) > .list-details {
  display: contents;
}
.members-card .list-row:not(.expands) > .list-details::details-content,
.invitations-card .list-row:not(.expands) > .list-details::details-content {
  grid-column: 1 / -1;
}
.members-card .list-row > .list-details > summary,
.invitations-card .list-row > .list-details > summary {
  justify-self: end;
  color: var(--text);
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  list-style: none;
}
.members-card .list-details > summary::-webkit-details-marker,
.invitations-card .list-details > summary::-webkit-details-marker {
  display: none;
}
.member-line {
  display: grid;
  grid-template-columns: 30px minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
}
.member-avatar {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text);
  font-size: 11px;
}
.member-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.member-who .member-name {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
}
.member-email {
  font-size: 12.5px;
  color: var(--subtle);
  overflow-wrap: anywhere;
}
.member-role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
}
.pill.you {
  font-size: 11.5px;
}
.member-manage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  margin: var(--space-3) 0 var(--space-2) 42px;
}
.member-manage-main > .member-form {
  display: block;
  margin: 0;
}
.member-manage-aside {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-tint);
  font-size: 13px;
}
.member-manage-aside .facts {
  display: block;
  margin: 0 0 var(--space-2);
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
  font-size: 13px;
}
.member-manage-aside .facts li {
  padding: 0;
  border-radius: 0;
  background: none;
}
.member-manage-aside p {
  margin: 0;
}
.member-manage .danger-text,
#team-seats-cancel {
  border: 0;
  background: none;
  padding: 0 4px;
}
.team-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}
.team-note .link-button {
  font-size: 12.5px;
  color: var(--text);
}

/* Invitations: the invite form, then the table (R2ATeamInvitations). */
.invite-card form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 var(--space-2);
  align-items: end;
  margin: 0;
}
.invite-card form > label,
.invite-card form > p {
  grid-column: 1 / -1;
}
.invite-card #team-email {
  margin-bottom: 0;
}
.invite-card #team-invite-help {
  margin: var(--space-2) 0 0;
  font-size: 12.5px;
}
.invite-head {
  grid-template-columns: minmax(0, 1.4fr) 110px 120px minmax(0, 1fr) 72px;
}
.invite-line {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 110px 120px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
}
.invite-sent {
  font-size: 13px;
  color: var(--subtle);
}
.invite-line .pill {
  justify-self: start;
}
.invite-line .row-actions {
  justify-content: flex-end;
  gap: var(--space-4);
}
.link-button.quiet {
  color: var(--text);
  text-decoration: none;
}
.link-button.danger-text {
  color: var(--danger);
  text-decoration: none;
}

/* Apps: one row per app, its switch at the end (R2ATeamApps). */
.team-apps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.team-apps-card > .team-apps {
  padding: 0;
}
.member-row.team-app {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.member-row.team-app:last-child {
  border-bottom: 0;
}
.team-app-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.team-app-words .member-name {
  font-size: var(--text-md);
}
.team-app-words .muted {
  font-size: 12.5px;
}
.app-icon.small {
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 11px;
}
#teams .team-app .switch,
.app-card-actions .switch {
  align-items: center;
  margin: 0;
}
/* The team's seats on Billing (the owner's decision of 3 Oct 2026), between credit and activity. */
#team-billing {
  margin-bottom: var(--space-4);
}
.team-app-state {
  font-size: 13px;
  color: var(--muted);
}
#team-apps-status:empty {
  display: none;
}
#team-apps-status {
  margin: 12px 18px 0;
}

/* Billing and sign-in: their parts side by side. */
.team-purchases-card .section-title :is(h3, h4) {
  margin: 0;
  font-size: var(--text-md);
}
.sso-card details {
  margin-top: var(--space-4);
}
.sso-card details > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: var(--weight-medium);
}
.sso-card form {
  display: block;
  margin: var(--space-3) 0 0;
}
.sso-card code {
  overflow-wrap: anywhere;
}
#team-tab-signin #team-sso {
  margin: 0;
}
#teams .danger-zone h3 {
  color: var(--danger);
}
#team-close-form,
#team-leave {
  display: block;
  margin: var(--space-3) 0 0;
}
#team-close-form button,
#team-leave button {
  margin-top: var(--space-2);
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-danger);
}
#team-create-box,
#team-sso:not([hidden]) > .panel {
  padding: 16px 18px;
}

/* ---------- Settings ---------- */
.profile-facts {
  display: grid;
  margin: 0 0 var(--space-3);
}
.profile-facts > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.profile-facts > div:last-child {
  border-bottom: 0;
}
.plan-compare summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: var(--weight-medium);
}
.plan-compare[open] summary {
  margin-bottom: var(--space-2);
}
#devices-body .member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px var(--space-3);
}
#devices-body .member-row > .muted {
  grid-column: 1;
  font-size: 12.5px;
  color: var(--subtle);
}
#devices-body .member-row > button {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.profile-facts dt {
  color: var(--subtle);
}
.profile-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.security-block {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.security-block .section-title,
[data-page="settings"] .section-title {
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.security-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.security-row:last-child {
  border-bottom: 0;
}
.security-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 240px;
}
.security-words .muted {
  font-size: 12.5px;
  color: var(--subtle);
  overflow-wrap: anywhere;
}
#delete-account {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-3);
}
#delete-account label {
  flex: 1 0 100%;
}
#delete-account input {
  flex: 1 1 240px;
  max-width: 320px;
  margin: 0;
  font-family: var(--font-mono);
}
.more-list {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.more-list a,
.more-list .link-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  gap: 12px;
  min-height: 50px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: var(--weight-regular);
  text-align: left;
  text-decoration: none;
}
.more-list > :last-child {
  border-bottom: 0;
}
.danger-link {
  justify-content: flex-start;
  width: 100%;
  min-height: 50px;
  border-radius: var(--radius-card);
  color: var(--danger);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-4);
}
.settings-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.settings-column > .panel {
  margin: 0;
}
.plan-compact table {
  font-size: 12.5px;
}

/* ---------- Dialogs, the help drawer and toasts ---------- */
.modal {
  width: calc(100% - 32px);
  max-width: 460px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-dialog);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-dialog);
}
.modal::backdrop,
.drawer::backdrop {
  background: var(--backdrop);
}
.modal h2 {
  margin: 0 0 var(--space-2);
  font-size: 17px;
}
.modal p {
  color: var(--muted);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.drawer {
  height: 100vh;
  max-height: 100vh;
  width: min(440px, 100%);
  max-width: 100%;
  margin: 0 0 0 auto;
  padding: 22px 20px;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-dialog);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.drawer-head h2 {
  margin: 0;
  font-size: 17px;
}
.drawer-close {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  font-size: 20px;
  line-height: 1;
}
.guide-list {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: grid;
  gap: var(--space-2);
}
.guide-list button,
.guide-list a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 0;
  padding: 11px 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-tint);
  color: var(--text);
  text-align: left;
  text-decoration: none;
}
.guide-list button strong {
  font-weight: var(--weight-medium);
}
.guide-list button span {
  font-size: 12.5px;
  font-weight: var(--weight-regular);
  color: var(--subtle);
}
.help-search {
  width: 100%;
  margin-bottom: var(--space-4);
}
.drawer .kicker {
  margin: 0 0 var(--space-2);
}
.guide p {
  color: var(--text);
  line-height: 1.6;
}
.guide .muted {
  color: var(--muted);
}
.guide .link-button {
  margin-bottom: var(--space-3);
}
.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow-dialog);
  font-size: 13.5px;
}
.toast-close {
  min-height: 0;
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font-size: var(--text-lg);
  line-height: 1;
}

/* ---------- Signed out ---------- */
/* The short sign-in card (D15 dropped the signed-out page): after a sign-out, or when a
   sign-in came back without a session. */
#signin {
  max-width: 420px;
  margin: 72px auto 100px;
  padding: 28px;
}
#signin h1 {
  margin: 0 0 var(--space-2);
  font-size: 22px;
  letter-spacing: -0.02em;
}
#signin .intro {
  margin-bottom: var(--space-5);
  font-size: var(--text-md);
}
#signin .primary {
  width: 100%;
  min-height: var(--touch);
}
.intro {
  max-width: 520px;
  margin-bottom: 28px;
  font-size: 17px;
  color: var(--muted);
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 16px;
}
.overview-grid,
.month-columns {
  margin: 0;
}

/* ---------- Phone ---------- */
@media (max-width: 700px) {
  :root {
    --space-6: 20px;
  }
  body.signed-in .shell {
    grid-template-columns: 1fr;
  }
  .rail {
    display: none !important;
  }
  body.signed-in .topbar-brand {
    display: inline-flex;
    margin-right: 0;
  }
  .topbar {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 10px var(--space-6);
  }
  .plan-note,
  .topbar .primary.small,
  .profile,
  .balance-chip .kicker {
    display: none;
  }
  .balance-chip {
    margin-left: auto;
  }
  main {
    padding: 18px var(--space-6) 96px;
  }
  footer {
    display: none;
  }
  body.signed-in .tabbar:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 8px 0 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: var(--touch);
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
  }
  .tabbar a .icon {
    width: 22px;
    height: 22px;
  }
  .tabbar a[aria-current="page"] {
    color: var(--text);
    font-weight: var(--weight-strong);
  }
  /* Every control takes the tokens' touch size on a phone (44 px; AX-PORT-29), the boards'
     compact chips, segments and tabs included. */
  :is(button, select, .primary, .button-link, input:not([type="checkbox"]):not([type="radio"])):not(.link-button),
  #usage-tabs .tabs [role="tab"],
  .segmented-tabs .tabs [role="tab"],
  .tabs [role="tab"] {
    min-height: var(--touch);
  }
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-grid {
    flex-wrap: wrap;
  }
  .stat-grid .tile {
    flex-basis: calc(50% - var(--space-4));
    min-height: 0;
  }
  .stat-grid .tile-lead {
    flex-basis: 100%;
  }
  .bar-row {
    grid-template-columns: 70px minmax(0, 1fr) auto;
  }
  .columns,
  .credit,
  .usage-grid,
  .credit-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .limit-row {
    grid-template-columns: 1fr;
  }
  .limit-row .limit-edit {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
  }
  .limit-row .limit-state {
    grid-row: 3;
  }
  .usage-csv {
    margin-left: 0;
  }
  .activity-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px var(--space-3);
  }
  .activity-row > .activity-what {
    grid-column: 1;
    grid-row: 1;
  }
  .activity-row > .activity-time {
    grid-column: 1;
    grid-row: 2;
  }
  .activity-row > .money {
    grid-column: 2;
    grid-row: 1;
  }
  .activity-work,
  .activity-row > .pill,
  .activity-state {
    display: none;
  }
  .models-tools input {
    flex-basis: 100%;
    max-width: none;
  }
  .models-tools select {
    flex: 1 1 140px;
  }
  .models-table tbody th {
    min-width: 120px;
    max-width: 150px;
  }
  .models-table .sort {
    min-height: 44px;
  }
  .amount {
    font-size: 32px;
  }
  #signin {
    margin: 24px 0 96px;
  }
  .toasts {
    left: var(--space-4);
    bottom: 88px;
  }
  .profile-facts > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .app-card {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: var(--space-3);
  }
  .app-card-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
  }
  .app-card .app-icon {
    width: 44px;
    height: 44px;
    padding: 7px;
  }
  .team-cards,
  .member-manage {
    grid-template-columns: 1fr;
  }
  .member-manage {
    margin-left: 0;
  }
  .member-head,
  .invite-head {
    display: none;
  }
  .member-line {
    grid-template-columns: 30px minmax(0, 1fr);
    row-gap: 2px;
  }
  .member-line > .member-role {
    grid-column: 2;
    font-size: 12.5px;
    color: var(--muted);
  }
  .invite-line {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: var(--space-1);
  }
  .invite-line .invite-sent {
    grid-column: 1;
  }
  .invite-line .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .team-bar select {
    min-width: 0;
  }
  #teams .list-tools select,
  #teams .list-tools input {
    min-height: var(--touch);
  }
  .invite-card form {
    grid-template-columns: 1fr;
  }
}
