/* app.css: shared styling for the ApplyAI web app.
   One file, plain CSS, no framework. Readable top to bottom on purpose.

   Design tokens come from tokens.css (a copy of docs/design/tokens.css, which
   design-keeper owns; the app deploys on its own so it cannot reach into docs/).
   Use var(--...) from there. Do not add a hex value or a one-off size here.
   Product theme: light and warm, the default, so no data-theme is needed. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); }
a:hover { color: var(--color-accent-hover); }

/* One focus treatment for everything: 2px ring, 2px offset, always visible. */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* ---------- layout ---------- */

.center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.page { max-width: var(--container-app); margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-8); }

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}
@media (min-width: 40rem) {
  /* Same alignment as .mainnav: the brand sits over the page's left edge and
     Sign out over its right edge, instead of hugging the window at 1280. */
  .topbar { padding-left: max(var(--space-5), calc((100% - var(--container-app)) / 2 + var(--space-5))); padding-right: max(var(--space-5), calc((100% - var(--container-app)) / 2 + var(--space-5))); }
}
.topbar .brand {
  font-weight: var(--weight-bold); color: var(--color-text); text-decoration: none;
  display: inline-flex; align-items: center; min-height: var(--size-target);
}
.topbar .brand.mg { align-items: baseline; flex-wrap: wrap; align-content: center; } /* shared baseline for Mad and Ghost; the wrap lets the 44px row centre them */
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--color-text-muted); font-size: var(--text-sm); }
.topbar .back {
  font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: none;
  padding-left: var(--space-4); border-left: 1px solid var(--color-border);
}
.topbar .back:hover { color: var(--color-text); }

/* ---------- type ---------- */

/* Sans headline, with one italic serif phrase for the human part of it. The
   serif is for that and for reassurance lines only. */
h1 {
  font-size: var(--text-2xl); font-weight: var(--weight-medium);
  line-height: var(--leading-tight); letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}
.card h1 { font-size: var(--text-xl); }
h1 em, h2 em, .reassure {
  font-family: var(--font-serif); font-style: italic;
  font-weight: var(--weight-regular); font-size: 1.1em; letter-spacing: 0;
}

/* Section heading: weight and space carry it, not capitals. */
h2 {
  font-size: var(--text-base); font-weight: var(--weight-bold);
  color: var(--color-text); margin: var(--space-6) 0 var(--space-3);
}
.sub { color: var(--color-text-muted); font-size: var(--text-base); margin-bottom: var(--space-5); }
p { margin-bottom: var(--space-3); }
/* Reading measure. Tables and panels stay full width; running text does not. */
.sub, .page p { max-width: 65ch; }
/* Form and prose blocks keep a reading line inside the wide container. */
.page > .panel, .page > form, .page > .card { max-width: 65ch; }
@media (max-width: 39.99rem) { .page { padding-left: var(--space-4); padding-right: var(--space-4); } }

/* One h3 for every card title. A page may go larger only with a comment saying why. */
h3 { font-size: var(--text-base); font-weight: var(--weight-bold); }

/* One small label for every kicker, state and tag. Meaning never rides on it
   alone: the words are the state, the icon (below) backs them up. */
.kicker, .cv-label, .group > .gh, .note .k, .rnote .k, .places .k, .q .tag, .country .ctag {
  font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}
/* State labels are not kickers: the word is the state, and on a roles card the
   reason sentence is the most important line. Ink, bold, a step larger. The
   status icon inherits this size. */
.role .state, .verdict .label, .app .state {
  font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text);
  margin-bottom: var(--space-1);
}

/* Empty-state text in a list. */
.empty { color: var(--color-text-muted); }

/* The posting's own words, quoted: serif italic, with the left rule. */
.quote {
  border-left: 2px solid var(--color-border); padding: var(--space-1) 0 var(--space-1) var(--space-3);
  margin: var(--space-2) 0 0; font-family: var(--font-serif); font-style: italic;
  font-size: var(--text-base); color: var(--color-text);
}

/* One big-number block, used by roles, applied, upload and admin. */
.stats { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.stat { min-width: var(--space-8); }
.stat .n {
  display: block; font-size: var(--text-numeral); font-weight: var(--weight-light);
  line-height: var(--leading-tight); font-variant-numeric: tabular-nums; color: var(--color-text);
}
.stat .l { display: block; font-size: var(--text-xs); color: var(--color-text-muted); }
code {
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: var(--color-surface-sunk); padding: 1px var(--space-1); /* 1px: deliberate, a hairline of vertical padding */ border-radius: var(--space-1);
}

/* ---------- forms ---------- */

label {
  display: block; font-size: var(--text-sm); font-weight: var(--weight-medium);
  margin: var(--space-4) 0 var(--space-1);
}

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url] {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-control);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}
input:focus { outline: var(--focus-ring); outline-offset: var(--focus-offset); border-color: var(--color-accent); }

.row { display: flex; gap: var(--space-3); }
.row > div { flex: 1; }

/* The default button is outline (secondary). The filled accent pill is opt-in
   with .primary, and there is one per screen. Everything else is .quiet or a
   text link. */
button {
  width: 100%;
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-5);
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  font-family: inherit;
  line-height: var(--leading-body);
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
button:hover { background: var(--color-surface-sunk); border-color: var(--color-border-strong); color: var(--color-text); }
button.primary { background: var(--color-accent); color: var(--color-text-inverse); border-color: var(--color-accent); font-weight: var(--weight-bold); }
button.primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-text-inverse); }
/* Disabled and in-progress: text stays at full contrast. The state shows in the
   fill and border instead (opacity would drop the label to about 3:1). */
button:disabled, button:disabled:hover {
  background: var(--color-surface-sunk); color: var(--color-text); border-color: var(--color-border); cursor: default;
}
button.primary:disabled, button.primary:disabled:hover {
  background: var(--color-accent-soft); color: var(--color-accent-on-soft);
  border-color: var(--color-accent-soft); cursor: default;
}

/* Compact outline: buttons that sit inside a row or beside a field. */
button.quiet, button.secondary, .btn, .doc button, .entry button {
  width: auto;
  margin: 0;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
button.quiet:hover, button.secondary:hover, .btn:hover, .doc button:hover, .entry button:hover {
  background: var(--color-surface-sunk); border-color: var(--color-border-strong); color: var(--color-text);
}
button.quiet:disabled:hover, button.secondary:disabled:hover, .doc button:disabled:hover, .entry button:disabled:hover {
  background: var(--color-surface-sunk); color: var(--color-text); border-color: var(--color-border);
}
button.secondary { width: 100%; margin-top: 0; padding: var(--space-3) var(--space-5); font-size: var(--text-base); }

/* A link that looks like a button. Outline by default, .primary when it is the
   one next step on the screen. */
.btn {
  display: inline-block; text-decoration: none; border-radius: var(--radius-pill);
  white-space: nowrap; line-height: var(--leading-body);
}
.btn.primary {
  background: var(--color-accent); color: var(--color-text-inverse);
  border-color: var(--color-accent); font-weight: var(--weight-bold); font-size: var(--text-base);
  padding: var(--space-3) var(--space-5);
}
.btn.primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-text-inverse); }

.switch { margin-top: var(--space-4); text-align: center; font-size: var(--text-base); color: var(--color-text-muted); }
.switch a { cursor: pointer; font-weight: var(--weight-bold); text-decoration: none; }

/* ---------- messages ---------- */

/* No tinted blocks and no red or orange, ever. The hierarchy is carried by a
   left rule, by weight, and by an icon plus the words: something that needs
   attention gets a "!" and the ink-coloured rule and text, something that
   merely worked gets a tick and the quiet rule. Colour never carries it alone.

   Applies to every page that uses .msg, which is the point of fixing it here. */
.msg {
  margin-top: var(--space-4); padding: var(--space-3) 0 var(--space-3) var(--space-4);
  font-size: var(--text-base); display: none;
  border-left: 2px solid var(--color-border); color: var(--color-text-muted);
}
.msg.show { display: block; }
.msg.ok { border-left-color: var(--color-border); color: var(--color-text-muted); }
.msg.bad { border-left-color: var(--color-text); color: var(--color-text); }
.msg.ok::before, .msg.bad::before {
  display: inline-block; width: 1.4em; font-weight: var(--weight-bold);
}
.msg.ok::before { content: "\2713"; content: "\2713" / ""; color: var(--color-accent); }
.msg.bad::before { content: "!"; content: "!" / ""; color: var(--color-text); }

/* P6 usage-limit notice: one calm inline block. Information circle, a short
   heading, one or two plain sentences, an optional action. role="status",
   never an alert, never focus-stealing, no count or ticker, no red or orange. */
.notice {
  display: grid; grid-template-columns: auto 1fr; column-gap: var(--space-3); align-items: start;
  background: var(--color-surface-sunk); border: 1px solid var(--color-border);
  border-radius: var(--radius-card); padding: var(--space-4); margin: var(--space-4) 0;
}
.notice .ni { width: var(--size-icon); height: var(--size-icon); margin-top: var(--space-1); color: var(--color-accent); }
.notice .nh { margin: 0; font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--color-text); }
.notice .nb { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.notice .na { grid-column: 2; margin-top: var(--space-3); }
.notice .na button { width: auto; margin: 0; }

/* ---------- data display ---------- */

.panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  padding: var(--space-5); margin-bottom: var(--space-4);
}

/* Column shares of the applications table (34, 17, 9, 23, 17 percent): deliberate layout proportions, sum 100. */
table.rows col.c1 { width: 34%; } table.rows col.c2 { width: 17%; } table.rows col.c3 { width: 9%; }
table.rows col.c4 { width: 23%; } table.rows col.c5 { width: 17%; }

/* 190px: deliberate layout minimum for the label column, wide enough for the longest label. */
.kv { display: grid; grid-template-columns: 190px 1fr; gap: var(--space-2) var(--space-4); font-size: var(--text-base); }
.kv dt { color: var(--color-text-muted); }
.kv dd { color: var(--color-text); }
.kv dd.empty { color: var(--color-text-muted); }

/* The proof block is the thing a candidate reads to believe the product, and a
   tinted panel makes it look like a success toast rather than evidence. */
.proof {
  border-left: 2px solid var(--color-border); padding: var(--space-4) 0 var(--space-4) var(--space-5);
  font-size: var(--text-base); margin-bottom: var(--space-4); color: var(--color-text-muted);
}
.proof strong { color: var(--color-text); font-weight: var(--weight-bold); }

.hint { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: var(--space-2); }

/* ---------- status: an icon and words, in neutral or accent tone ---------- */
/* Shared by the role cards, the verdict card, the applied groups and the admin
   table. The word is the state; the icon backs it up; colour is only tone. */
.role .state::before, .verdict .label::before, .group > h2::before, .dot::before {
  display: inline-block; width: 1.4em; font-weight: var(--weight-bold);
}
.role.good .state::before, .verdict.good .label::before { content: "\2713"; content: "\2713" / ""; color: var(--color-accent); }
.role.warn .state::before, .verdict.warn .label::before { content: "\25CF"; content: "\25CF" / ""; color: var(--color-text); }
.role.stop .state::before, .verdict.stop .label::before { content: "\2013"; content: "\2013" / ""; color: var(--color-text-muted); }
.role.grey .state::before, .verdict.grey .label::before { content: "?"; content: "?" / ""; color: var(--color-text-muted); }

.group.needs_you > h2::before { content: "\25CF"; content: "\25CF" / ""; color: var(--color-text); }
.group.on_list > h2::before   { content: "\25CB"; content: "\25CB" / ""; color: var(--color-text-muted); }
.group.applied > h2::before   { content: "\2713"; content: "\2713" / ""; color: var(--color-accent); }
.group.closed > h2::before    { content: "\2013"; content: "\2013" / ""; color: var(--color-text-muted); }

.state-in { display: inline-flex; align-items: baseline; }
.dot.good::before     { content: "\2713"; content: "\2713" / ""; color: var(--color-accent); }
.dot.critical::before { content: "\25CF"; content: "\25CF" / ""; color: var(--color-text); }
.dot.warning::before  { content: "\25CB"; content: "\25CB" / ""; color: var(--color-text-muted); }
.dot.idle::before     { content: "\2013"; content: "\2013" / ""; color: var(--color-text-muted); }

/* ---------- foldable sections ---------- */
/*
 * A section you check once should not be the longest thing on a screen you
 * visit to check something else. Native <details>, so it works with no script,
 * is reachable from the keyboard, and reads correctly to a screen reader.
 *
 * The heading stays exactly as it was. The only addition is the marker, which
 * is the state, read from a shape rather than from a colour.
 */
.fold { margin: 0; }
.fold > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { display: inline; }
.fold > summary::after {
  content: 'show';
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity var(--motion-fast);
}
.fold > summary:hover::after,
.fold > summary:focus-visible::after { opacity: 1; }
.fold[open] > summary::after { content: 'hide'; }
.fold > summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 4px solid var(--color-text-muted);
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transform: translateY(-1px);
}
.fold[open] > summary::before {
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid var(--color-text-muted);
  border-bottom: 0;
}

/* ---------- phone widths ---------- */

/* Touch targets: --size-target minimum on controls. Text-link buttons get the height
   without a visible box. */
@media (max-width: 40rem) {
  .actions a, button, .btn, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url],
  select { min-height: var(--size-target); }
  .actions a, .btn, .cta { display: inline-flex; align-items: center; justify-content: center; min-height: var(--size-target); }
  button.link { min-height: var(--size-target); display: inline-flex; align-items: center; }
  input[type=checkbox], input[type=radio] { min-width: var(--space-5); min-height: var(--space-5); }
  /* The box stays small; its label is the full-size hit area. */
  label:has(> input[type=checkbox]), label:has(> input[type=radio]), input[type=checkbox] + label, input[type=radio] + label {
    display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--size-target); }

  /* Topbar: wrapped links lose their divider, and the address truncates. */
  .topbar { gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); }
  .topbar .back { border-left: 0; padding-left: 0; }
  .topbar .who { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  h1 { font-size: var(--text-xl); }
  .center { padding: var(--space-4); }
  .card { padding: var(--space-5); }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: var(--space-3); }
  .kv dt:first-child { margin-top: 0; }
  /* Tables scroll inside their panel rather than the page. */
  .panel:has(table) { overflow-x: auto; }
}

/* The fold summary's keyboard ring, stated explicitly (same as the global ring). */
.fold > summary:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

/* ---------- main navigation (brief.md P7) ---------- */
/* Four text links, the current page marked by an underline as well as colour.
   Two rows below 40rem (name and Sign out, then the links), the email hidden
   until 60rem. 40rem and 60rem are written out because custom properties
   cannot be used in a media query. Not sticky. */
.mainnav {
  background: var(--color-bg); border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-4);
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--space-2);
}
.mainnav .name { font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--color-text); margin-right: var(--space-3); }
.mainnav a.name { text-decoration: none; display: inline-flex; align-items: center; min-height: var(--size-target); }
.mainnav .links { display: flex; order: 3; flex-basis: 100%; }
.mainnav .links a {
  display: inline-flex; align-items: center; min-height: var(--size-target);
  padding: 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--color-text-muted); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.mainnav .links a:hover { color: var(--color-text); border-bottom-color: var(--color-border-strong); }
.mainnav .links a[aria-current="page"] { color: var(--color-text); border-bottom: 2px solid var(--color-text); }
.mainnav .spacer { flex: 1; }
.mainnav .who { display: none; font-size: var(--text-sm); color: var(--color-text-muted); }
.mainnav button.signout {
  width: auto; margin: 0; min-height: var(--size-target); padding: 0 var(--space-2);
  background: transparent; border: 0; border-radius: 0; color: var(--color-text);
  font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: underline;
}
.mainnav button.signout:hover { background: transparent; color: var(--color-accent); }
@media (min-width: 40rem) {
  /* The inner row lines up with the centred page content (container plus its
     own side padding), so the name sits over the page's left edge above 72rem. */
  .mainnav { padding: 0 max(var(--space-5), calc((100% - var(--container-app)) / 2 + var(--space-5))); }
  .mainnav .links { order: 0; flex-basis: auto; }
  .mainnav .links a { font-size: var(--text-base); padding: 0 var(--space-3); }
}
@media (min-width: 60rem) {
  .mainnav .who { display: inline; margin-right: var(--space-3); }
}

/* P13 company mark, shared by the roles cards and the applications table.
   Monogram by default; a logo only when a row carries employer_logo_url from our own origin. */
.mk { flex: none; width: var(--size-target); height: var(--size-target); box-sizing: border-box; border-radius: var(--radius-control);
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden; line-height: 1;
  background: var(--color-accent-soft); color: var(--color-accent-on-soft); font-size: var(--text-base); font-weight: var(--weight-bold); }
.mk.has-logo { background: var(--color-surface); border: 1px solid var(--color-border); padding: var(--space-2); }
.mk img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mk.closed { background: var(--color-surface-sunk); color: var(--color-text-muted); }

/* ---------- the agreement pop-up (agreement.js) ----------
   A calm centred card over a scrim. The scrim is the ink colour at 45%, so it
   follows the theme. One filled button, which is the one thing to do. */
.agree-scrim { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center;
  background: color-mix(in srgb, var(--color-text) 45%, transparent); overflow-y: auto; padding: var(--space-4); }
@media (min-width: 40rem) { .agree-scrim { align-items: center; } }
.agree { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); width: 100%; max-width: var(--container-text); padding: var(--space-5); margin: auto 0; }
.agree h2 { margin: 0 0 var(--space-3); font-size: var(--text-xl); font-weight: var(--weight-medium); }
.agree p { margin: 0 0 var(--space-3); font-size: var(--text-base); color: var(--color-text); max-width: none; }
.agree a { color: var(--color-accent); text-decoration: underline; display: inline-flex; align-items: center; min-height: var(--size-target); }
.agree label { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-base); margin: var(--space-3) 0 0; cursor: pointer; }
.agree input[type=checkbox] { flex: none; width: var(--space-5); height: var(--space-5); margin: var(--space-1) 0 0; accent-color: var(--color-accent); }
.agree .agree-err { font-size: var(--text-sm); color: var(--color-text); margin: var(--space-3) 0 0; }
.agree .agree-err:empty { display: none; }
.agree .agree-hint { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-2) 0 0; }
.agree .agree-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.agree button.agree-out { background: transparent; border: 0; color: var(--color-text-muted); text-decoration: underline; font-size: var(--text-sm); font-weight: var(--weight-regular); width: auto; margin: var(--space-3) 0 0; padding: 0 var(--space-2); min-height: var(--size-target); }
.agree button.agree-out:hover { background: transparent; color: var(--color-text); }
.agree .agree-actions { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.agree .agree-actions button { margin: 0; width: 100%; min-height: var(--size-target); }
@media (min-width: 40rem) { .agree .agree-actions { flex-direction: row-reverse; justify-content: flex-start; } .agree .agree-actions button { width: auto; } }
.agree :focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.agree-doc { max-width: var(--container-text); }
.agree-doc h1 { font-size: var(--text-2xl); }
.agree-doc h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); margin: var(--space-5) 0 var(--space-2); }
.agree-doc p, .agree-doc li { font-size: var(--text-base); max-width: none; }
.agree-doc ul { padding-left: var(--space-5); }
.agree-doc li + li { margin-top: var(--space-2); }

/* Wordmark as the head of an entry page (login, tester agreement). Text-size
   scale from tokens. */
.mg-head { font-size: var(--text-xl); margin: 0 0 var(--space-4); line-height: var(--leading-tight); }
.mg-wrap { padding-bottom: 0; }
.mg-wrap .mg-head { margin: 0; }

/* ==========================================================================
   The monthly plan (plan.html) and "Your plan" (dashboard #plan).
   Spec: docs/design/plan-page-2026-10-12.md. Existing tokens only. One text
   column, no card, no box, no shadow. Money is never lime, never red, and
   never amber: a payment problem is a calm P6 notice.
   ========================================================================== */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Stripe-bound controls: the padlock follows the words, --space-2 away. A
   different shape from the new-tab arrow, so the two meanings never blur. */
.lock { flex: none; width: var(--size-icon); height: var(--size-icon); margin-left: var(--space-2); vertical-align: -0.125em; }

.plan-page { max-width: var(--container-text); }
.plan-page [hidden] { display: none !important; }
.plan-page h1 {
  font-size: var(--text-xl); font-weight: var(--weight-bold); line-height: var(--leading-tight);
  color: var(--color-text); margin: 0 0 var(--space-5);
}
.plan-page .price { display: flex; align-items: baseline; gap: var(--space-2); margin: 0 0 var(--space-5); color: var(--color-text); }
.plan-page .price .num { font-size: var(--text-numeral); font-weight: var(--weight-light); line-height: var(--leading-tight); }
.plan-page .price .per { font-size: var(--text-base); color: var(--color-text-muted); }
.plan-page #included { margin: 0 0 var(--space-3); line-height: var(--leading-body); }
.plan-page #carries {
  font-family: var(--font-serif); font-style: italic; font-weight: var(--weight-regular);
  color: var(--color-text-muted); margin: 0 0 var(--space-5);
}
.plan-page #status { color: var(--color-text-muted); }
.plan-page #context, .plan-page #region { color: var(--color-text); margin: 0 0 var(--space-5); }

/* The result of a press or a return from Stripe: one sentence at --text-lg,
   a quieter line or two under it. Nothing moves. */
.plan-page #outcome { margin: 0 0 var(--space-5); }
.plan-page #outcomeTitle {
  font-size: var(--text-lg); font-weight: var(--weight-medium); color: var(--color-text);
  margin: 0 0 var(--space-2); line-height: var(--leading-tight);
}
.plan-page #outcomeTitle:focus { outline: none; }
.plan-page #outcomeTitle:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.plan-page[data-state="done"] #outcomeTitle { font-weight: var(--weight-bold); }
.plan-page[data-state="done"] #outcomeTitle::before {
  content: ""; display: inline-block; width: var(--size-icon); height: var(--size-icon); margin-right: var(--space-2);
  background-color: var(--color-status-sent); vertical-align: -0.1em;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.5l3 3 6-7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.5l3 3 6-7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.plan-page #outcomeBody, .plan-page #outcomeMore, .plan-page #outcomeHelp { margin: 0 0 var(--space-2); color: var(--color-text); }
.plan-page #outcomeBody { font-family: var(--font-serif); font-style: italic; color: var(--color-text-muted); }
.plan-page #outcomeMore { color: var(--color-text-muted); }
.plan-page #outcomeHelp a { display: inline-flex; align-items: center; min-height: var(--size-target); font-weight: var(--weight-medium); }

/* The billing disclosure: legal needs it visibly set off from the sentences
   around it, body size, no box. A short heading, bullets, bold first line. */
.plan-page #disclosure { margin: 0 0 var(--space-4); }
.plan-page #discHead {
  font-size: var(--text-base); font-weight: var(--weight-bold); line-height: var(--leading-tight);
  color: var(--color-text); margin: 0 0 var(--space-2);
}
.plan-page #discItems { list-style: disc; padding-left: var(--space-5); max-width: 65ch; }
.plan-page #discItems li {
  font-size: var(--text-base); font-weight: var(--weight-regular); line-height: var(--leading-body);
  color: var(--color-text); margin: 0 0 var(--space-2);
}
.plan-page #discItems li:first-child strong { font-weight: var(--weight-bold); }

/* The one filled pill on the page. */
.plan-page #pay {
  display: inline-flex; align-items: center; justify-content: center; gap: 0;
  min-height: var(--size-target); padding: 0 var(--space-6); margin: 0;
  background: var(--color-accent); color: var(--color-text-inverse); border: 1px solid var(--color-accent);
  border-radius: var(--radius-pill); font-size: var(--text-base); font-weight: var(--weight-medium);
}
.plan-page #pay:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-text-inverse); }
.plan-page #pay:disabled, .plan-page #pay:disabled:hover {
  background: var(--color-accent-soft); color: var(--color-accent-on-soft); border-color: var(--color-accent-soft);
}
.plan-page #stripeNote { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-2) 0 var(--space-4); }
@media (max-width: 39.99rem) { .plan-page #pay { width: 100%; } }

/* Links under the button: text links, 44px targets. */
.plan-page #back, .plan-page #next {
  display: inline-flex; align-items: center; min-height: var(--size-target);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-accent);
}
.plan-page #next { font-size: var(--text-base); }
/* Back to your dashboard is the only action in these states: an outline pill. */
.plan-page[data-state="closed"] #back, .plan-page[data-state="couldnt_load"] #back,
.plan-page[data-state="refunded_region"] #back, .plan-page[data-state="operator"] #back {
  padding: 0 var(--space-5); border: 1px solid var(--color-accent); border-radius: var(--radius-pill);
  text-decoration: none; font-size: var(--text-base);
}
.plan-page[data-state="closed"] #back:hover, .plan-page[data-state="couldnt_load"] #back:hover,
.plan-page[data-state="refunded_region"] #back:hover, .plan-page[data-state="operator"] #back:hover {
  background: var(--color-surface-sunk);
}
/* Back to your roles after paying: the filled pill (the pay button is hidden then). */
.plan-page[data-state="done"] #next {
  padding: 0 var(--space-6); background: var(--color-accent); color: var(--color-text-inverse);
  border-radius: var(--radius-pill); text-decoration: none; font-weight: var(--weight-medium);
}
.plan-page[data-state="done"] #next:hover { background: var(--color-accent-hover); color: var(--color-text-inverse); }

/* P6 neutral line (Couldn't open Checkout; a portal that would not open). */
.pnote {
  display: flex; align-items: flex-start; gap: var(--space-3);
  font-size: var(--text-sm); color: var(--color-text); margin: var(--space-3) 0; max-width: 65ch;
}
.pnote[hidden] { display: none; }
.pnote .ni { flex: none; width: var(--size-icon); height: var(--size-icon); margin-top: var(--space-1); color: var(--color-accent); }
.plan-page #failed { font-size: var(--text-base); margin: 0 0 var(--space-4); }

/* Notices that carry a link in their sentence (roles.html free-week line). */
.notice .nb a { font-weight: var(--weight-medium); }

/* ---------- dashboard "Your plan" ---------- */
#plan-sec { scroll-margin-top: var(--space-5); }
.plan-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); padding-block: var(--space-3); border-bottom: 1px solid var(--color-border); }
.plan-rows dt { font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--color-text); }
.plan-rows dd { margin: 0; min-width: 0; }
.plan-rows dd > .muted { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 65ch; margin: 0 0 var(--space-2); }
.plan-rows .notice { margin: var(--space-3) 0; max-width: 65ch; }
.plan-rows .pacts p { margin: 0; max-width: none; }
.plan-rows .pacts a:not(.btn), .plan-rows .pacts button.tbtn {
  display: inline-flex; align-items: center; min-height: var(--size-target); font-size: var(--text-sm); font-weight: var(--weight-medium);
}
.plan-rows .pacts .btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--size-target);
  font-size: var(--text-base); padding: 0 var(--space-5); border-color: var(--color-accent); color: var(--color-accent);
}
.plan-rows .pacts .btn:hover { background: var(--color-surface-sunk); color: var(--color-accent-hover); }
.plan-rows .pacts .btn.primary { background: var(--color-accent); color: var(--color-text-inverse); }
.plan-rows .pacts .btn.primary:hover { background: var(--color-accent-hover); color: var(--color-text-inverse); }
.plan-rows .pacts .detail { display: block; font-size: var(--text-sm); max-width: 65ch; margin-top: var(--space-2); }
/* Tester, paused: two equal choices, the filled one first. Stacked on phones. */
.plan-rows .choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); margin-top: var(--space-3); }
.plan-rows .choices .btn { width: 100%; }
@media (min-width: 40rem) { .plan-rows .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
/* While the free-week choice is the filled button, the page keeps one filled pill. */
body:has(.plan-rows .choices .btn.primary) .setup .btn.primary {
  background: transparent; color: var(--color-accent); border-color: var(--color-accent);
}

/* ---------- P24 searchable list field (tester feedback, 18 Oct) ----------
   docs/design/tester-feedback-2026-10-18.md. Tokens only. The popup max-height
   and the 24rem field width are component dimensions written once, as the spec
   says. No red, no lime. State is a word or a shape, never colour alone. */
.combo { position: relative; width: 100%; }
@media (min-width: 40rem) { .combo { max-width: 24rem; } }
div.combo > input[role="combobox"] {
  min-height: var(--size-target); padding: var(--space-2) calc(var(--space-4) + var(--size-icon) + var(--space-3)) var(--space-2) var(--space-4);
  border-radius: var(--radius-control); scroll-margin-top: var(--space-5);
}
div.combo > input[role="combobox"]::placeholder { color: var(--color-text-muted); opacity: 1; }
div.combo > input[role="combobox"]:hover { background: var(--color-surface-sunk); }
div.combo > input[role="combobox"]:focus { background: var(--color-surface); }
.combo-chev { position: absolute; right: var(--space-4); top: 0; height: var(--size-target); display: flex; align-items: center; color: var(--color-text-muted); pointer-events: none; }
.combo-chev svg, .combo-added svg { width: var(--size-icon); height: var(--size-icon); fill: none; stroke: currentColor; flex: none; }
.combo > input[aria-expanded="true"] ~ .combo-chev svg { transform: rotate(180deg); }
.combo-list {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + var(--space-1)); margin: 0; padding: var(--space-1);
  list-style: none; background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-control);
  overflow-y: auto; overscroll-behavior: contain; max-height: min(15.5rem, 40dvh);
}
@media (min-width: 40rem) { .combo-list { max-height: 22rem; } }
.combo-list[hidden] { display: none; }
.combo-opt, .combo-none {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: var(--size-target); padding: var(--space-2) var(--space-3);
  font-size: var(--text-base); color: var(--color-text); border-radius: var(--radius-control); cursor: pointer;
}
.combo-opt b { font-weight: var(--weight-bold); }
.combo-opt:hover { background: var(--color-surface-sunk); }
/* Active by keyboard: the sunk fill is only 1.1:1 on white, so the inset ring is what shows it. */
.combo-opt.active { background: var(--color-surface-sunk); outline: var(--focus-ring); outline-offset: calc(-1 * var(--focus-offset)); }
.combo-opt[aria-disabled="true"] { color: var(--color-text-muted); cursor: default; }
.combo-opt[aria-disabled="true"]:hover { background: transparent; }
.combo-added { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); white-space: nowrap; }
.combo-none { display: block; min-height: 0; font-size: var(--text-sm); padding: var(--space-3); cursor: default; }
.combo-none:hover { background: transparent; }

/* Words-and-icon line under a field: a dot, then the words (P11 pattern, no red). */
.hint.unmatched { display: flex; align-items: baseline; gap: var(--space-2); color: var(--color-text); }
.hint.unmatched::before { content: ""; flex: none; width: var(--space-2); height: var(--space-2); border-radius: 50%; background: currentColor; }
.hint.unmatched.stored { color: var(--color-text-muted); }

/* Several choices: the chosen list above the field. */
ul.items { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
ul.items li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); align-items: center; min-height: var(--size-target); }
ul.items li + li { border-top: 1px solid var(--color-border); }
ul.items li > button { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
ul.items li > .hint { grid-column: 1; grid-row: 2; margin: 0 0 var(--space-2); }
ul.items .alt { font-size: var(--text-sm); color: var(--color-text-muted); }
ul.items button.quiet, ul.items button.tbtn {
  width: auto; min-height: var(--size-target); min-width: var(--size-target); padding: 0 var(--space-2); background: transparent; border: 0; border-radius: var(--radius-control);
  color: var(--color-accent); font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: underline;
}
ul.items button.quiet:hover, ul.items button.tbtn:hover { background: var(--color-surface-sunk); color: var(--color-accent-hover); }

/* Native select as the field: own chevron from two gradient halves, platform picker kept. */
select {
  appearance: none; -webkit-appearance: none; min-height: var(--size-target); border-radius: var(--radius-control);
  padding-right: var(--space-6);
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%), linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
  background-position: calc(100% - var(--space-5)) 50%, calc(100% - var(--space-5) + var(--space-2)) 50%;
  background-size: var(--space-2) var(--space-2); background-repeat: no-repeat;
}
select:hover { background-color: var(--color-surface-sunk); }
.hint.unmatched[hidden] { display: none; }
.open .adder .combo { flex: 1 1 auto; }
