/* ==========================================================================
   Autopilot client portal stylesheet (run 325).

   Loaded ONLY by the portal base template (`portal/templates/base.html`); the
   operator console keeps `controlplane.css` unchanged (decision D14).

   Ported from the run 324 mock A design system (`mock/shared.css`) with two
   changes:
   - fonts: the mock's IBM Plex families are replaced by the fonts this app
     already serves locally from `/static/fonts/` (Schibsted Grotesk and
     JetBrains Mono, decision D13). No font CDN, no network request.
   - colour scheme: the portal stays light when the system prefers dark, as it
     did before this run; the mock's dark tokens are not carried over.

   Mock-only elements (mock banners, "Sample" tags) and per-term glossary marks
   (decision D3) are not ported. The three marked sections at the end belong to
   lanes M2 (order), M3 (hub) and M4 (usage).
   ========================================================================== */

/* ---------- Local fonts (decision D13) ---------- */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/schibsted-grotesk-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/schibsted-grotesk-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/schibsted-grotesk-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/schibsted-grotesk-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/schibsted-grotesk-800-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens and base (mock A shared.css) ---------- */

:root {
  --paper: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --ink: #17191e;
  --ink-2: #474c57;
  --ink-3: #636876;
  --line: #e0e1dc;
  --line-strong: #c9cbc5;
  --accent: #2340c4;
  --accent-hover: #1b33a3;
  --accent-ink: #ffffff;
  --accent-soft: #e9edfc;
  --mark: #b93a2e;
  --mark-soft: #fbebe8;
  --ok: #1b7348;
  --ok-soft: #e3f2e9;
  --wait: #8a5100;
  --wait-soft: #fdf0d5;
  --err: #b42318;
  --err-soft: #fdecea;
  --track: #e3e4df;
  --shadow-pop: 0 10px 30px rgba(23, 25, 30, 0.14), 0 2px 6px rgba(23, 25, 30, 0.06);
  --radius-s: 6px;
  --radius-m: 9px;
  --radius-l: 14px;
  --font-sans: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --font-jp: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --t-xs: 12px;
  --t-s: 13px;
  --t-m: 14px;
  --t-l: 16px;
  --t-xl: 20px;
  --t-2xl: 26px;
  color-scheme: light;
}


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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-m);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* The portal palette names the design-reproduction font and contrast rule
     reads (`tests/controlplane/browser/test_portal_design_reproduction.py`).
     Same values as before this run; the design tokens above are what the
     portal paints with. */
  --portal-canvas: #f4f3f0;
  --portal-surface: #fff;
  --portal-ink: #1b1a17;
  --portal-muted: #5f584c;
  --portal-primary: #2f5fd0;
}

:lang(ja), .ja { font-family: var(--font-jp); }
/* Run 330: Japanese text reads at 1.7 everywhere except on the sign-in card,
   whose line heights do not depend on the language (switching language there
   must not change the card's size). `:where` keeps this rule's specificity
   exactly that of the plain `:lang(ja)` it replaces. */
:is(:lang(ja), .ja):not(:where(.portal-auth-card, .portal-auth-card *)) { line-height: 1.7; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--t-2xl); line-height: 1.2; }
h2 { font-size: var(--t-xl); line-height: 1.3; }
h3 { font-size: var(--t-l); line-height: 1.35; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.mono { font-family: var(--font-mono); font-size: 0.93em; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
/* Run 385: counts use the face's own figures. Its tabular figures give the comma
   and the 1 a digit's width, which read "1,159" as "1 ,159". */
.num { font-variant-numeric: normal; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-s { width: 15px; height: 15px; }

/* ---------- Shell ---------- */

.portal-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; background: linear-gradient(90deg, var(--surface-2) 0 235px, var(--line) 235px 236px, transparent 236px); }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: var(--ink); font-weight: 600; font-size: var(--t-l); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 28px; display: grid; place-items: center; color: var(--ink); }
.brand-mark svg { width: 34px; height: 26px; }

.workspace {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.workspace small { display: block; color: var(--ink-3); font-size: var(--t-xs); font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-s);
  color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: var(--line); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--wait-soft); color: var(--wait); font-size: var(--t-xs); font-weight: 600; text-align: center; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-m); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font-size: var(--t-xs); font-weight: 600; flex: none; }
.me b { display: block; font-weight: 600; font-size: var(--t-s); }
.me span { color: var(--ink-3); font-size: var(--t-xs); }
.lang-switch { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.lang-switch button { border: 0; background: none; font: inherit; font-size: var(--t-xs); padding: 3px 10px; border-radius: 999px; color: var(--ink-2); cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.rail-links { display: flex; justify-content: space-between; align-items: center; padding: 0 6px; font-size: var(--t-s); }
.rail-links > a, .rail-links > button { color: var(--ink-2); background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }


.portal-shell > .main { min-width: 0; display: flex; flex-direction: column; }
.page { max-width: 1120px; padding: 26px 40px 64px; display: flex; flex-direction: column; gap: 22px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--t-s); color: var(--ink-3); margin: 0; padding: 0; list-style: none; }
.crumbs li { display: flex; align-items: center; gap: 6px; }
.crumbs li + li::before { content: "/"; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-head .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; color: var(--ink-2); font-size: var(--t-s); }
.page-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 15px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; line-height: 1.2; cursor: pointer; white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line); border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-l { min-height: 44px; padding: 10px 20px; font-size: var(--t-l); }
.btn-s { min-height: 30px; padding: 5px 10px; font-size: var(--t-s); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn .kbd { margin-left: 4px; }

.kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; font-family: var(--font-mono); font-size: 11px; line-height: 17px; text-align: center; color: var(--ink-2); background: var(--surface); }

/* ---------- Status ---------- */

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--line); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.is-ok { background: var(--ok-soft); color: var(--ok); }
.badge.is-run { background: var(--accent-soft); color: var(--accent); }
.badge.is-wait { background: var(--wait-soft); color: var(--wait); }
.badge.is-err { background: var(--err-soft); color: var(--err); }
.badge.is-run::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); font-size: var(--t-xs); color: var(--ink-2); }
.lang-code { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-3); }

.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.6s ease; }
.progress.is-ok .progress-fill { background: var(--ok); }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-s); color: var(--ink-2); }

/* ---------- Surfaces ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.panel-pad { padding: 20px 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: var(--t-l); }
.panel-body { padding: 18px 22px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title h2 { font-size: var(--t-l); }
.section-title a { font-size: var(--t-s); }

.next {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px 20px;
  padding: 18px 22px; border-radius: var(--radius-l);
  background: var(--accent-soft); border: 1px solid transparent;
}
.next .next-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.next h2 { font-size: var(--t-l); }
.next p { color: var(--ink-2); margin-top: 3px; }
.next.is-wait { background: var(--wait-soft); }
.next.is-wait .next-icon { color: var(--wait); }
.next.is-ok { background: var(--ok-soft); }
.next.is-ok .next-icon { color: var(--ok); }
.next.is-quiet { background: var(--surface); border-color: var(--line); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); font-size: var(--t-s); color: var(--ink-2); }
.notice .icon { color: var(--ink-3); margin-top: 1px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: var(--t-s); }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; color: var(--ink); }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--ink-2); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { color: var(--ink-3); font-weight: 400; }

/* ---------- Projects list ---------- */

.needs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.need-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); }
.need-card .spread { align-items: flex-start; }
.need-card h3 { font-size: var(--t-m); }
.need-card p { color: var(--ink-2); font-size: var(--t-s); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--t-s); font-weight: 500; cursor: pointer; }
.filter .n { color: var(--ink-3); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter[aria-pressed="true"] .n { color: inherit; opacity: 0.7; }

.plist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.prow {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1.5fr) minmax(0, 1.2fr); align-items: center; gap: 18px;
  padding: 16px 20px; border-top: 1px solid var(--line); color: var(--ink);
}
.prow:first-child { border-top: 0; }
.prow:hover { background: var(--surface-2); text-decoration: none; }
.prow .pname { font-weight: 600; }
.prow .pmeta { color: var(--ink-3); font-size: var(--t-s); margin-top: 2px; }
.prow .langs { display: flex; flex-wrap: wrap; gap: 6px; }
.prow .nextline { font-size: var(--t-s); color: var(--ink-2); }
.prow .nextline b { color: var(--ink); font-weight: 600; }

/* ---------- Project hub ---------- */

.lang-card { display: flex; flex-direction: column; gap: 18px; }
.lang-card .lang-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lang-card .lang-head h3 { display: flex; align-items: center; gap: 8px; }

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; flex-direction: column; gap: 6px; font-size: var(--t-s); color: var(--ink-3); }
.steps li::before { content: ""; height: 4px; border-radius: 999px; background: var(--track); }
.steps li.done { color: var(--ink-2); }
.steps li.done::before { background: var(--ok); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now::before { background: var(--accent); }

.phases { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.phases li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: var(--t-s); color: var(--ink-3); }
.phases li:first-child { border-top: 0; }
.phases .dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.phases li.done { color: var(--ink-2); }
.phases li.done .dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.phases li.now { color: var(--ink); font-weight: 600; }
.phases li.now .dot { border-color: var(--accent); }
.phases li.now .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.phases .dot svg { width: 11px; height: 11px; stroke-width: 3; }

.materials { display: flex; flex-direction: column; }
.mat { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.mat:first-child { border-top: 0; padding-top: 0; }
.mat .mat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.mat b { display: block; font-weight: 500; font-size: var(--t-s); overflow-wrap: anywhere; }
.mat span { color: var(--ink-3); font-size: var(--t-xs); }

.estimate { display: flex; flex-direction: column; gap: 10px; }
.estimate .big { font-size: var(--t-xl); font-weight: 600; }

/* ---------- Bilingual specimen (signature) ---------- */

.specimen { display: flex; flex-direction: column; gap: 0; }
.pair { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.pair:first-child { border-top: 0; padding-top: 4px; }
.pair .code { padding-top: 3px; }
.pair .src { font-size: var(--t-m); color: var(--ink-2); }
.pair .tgt { font-size: var(--t-l); color: var(--ink); font-family: var(--font-jp); line-height: 1.75; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: var(--t-s); }
.field .opt { color: var(--ink-3); font-weight: 400; }
.field .chip, .field .seg label { font-weight: 500; }
.field .help { color: var(--ink-3); font-size: var(--t-xs); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink); font: inherit;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.wizard-steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: wz; }
.wizard-steps li { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: var(--t-s); color: var(--ink-3); counter-increment: wz; }
.wizard-steps li::before { content: ""; height: 4px; border-radius: 999px; background: var(--track); }
.wizard-steps li span::before { content: counter(wz) ". "; }
.wizard-steps li.done { color: var(--ink-2); }
.wizard-steps li.done::before { background: var(--ok); }
.wizard-steps li.now { color: var(--ink); font-weight: 600; }
.wizard-steps li.now::before { background: var(--accent); }


.file-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.file-row .mat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.file-row b { font-weight: 500; font-size: var(--t-s); }
.file-row .checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 3px; font-size: var(--t-xs); color: var(--ink-3); }
.file-row .checks .ok { color: var(--ok); font-weight: 600; }
.file-row .bar { height: 3px; border-radius: 999px; background: var(--track); margin-top: 7px; overflow: hidden; }
.file-row .bar span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s linear; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: var(--t-s); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .x { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.chip.is-add { border-style: dashed; color: var(--ink-2); padding-right: 11px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: var(--t-s); cursor: pointer; background: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--accent-ink); }
.seg label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.summary-list { display: flex; flex-direction: column; }
.summary-list > div { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); font-size: var(--t-s); }
.summary-list > div:first-child { border-top: 0; }
.summary-list dt, .summary-list .k { color: var(--ink-3); }
/* Run 397: step 3's handled source-check findings, one item per kind. */
.order-source-check { border-top: 1px solid var(--line); padding-top: 12px; gap: 8px; }
.order-source-check h3 { font-size: var(--t-s); color: var(--ink-3); font-weight: 400; margin: 0; }
.order-source-check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: var(--t-s); }
.order-source-check-list li > span { display: block; }

/* ---------- Review workspace ---------- */

.review { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); min-height: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.review-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.review-tools { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.search .input { padding-left: 34px; min-height: 36px; }
.strings { margin: 0; padding: 0; list-style: none; overflow-y: auto; max-height: 640px; }
.srow { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); }
.srow:first-child { border-top: 0; }
.srow:hover { background: var(--surface-2); text-decoration: none; }
.srow[aria-selected="true"] { background: var(--accent-soft); }
.srow .sid { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); padding-top: 2px; }
.srow .ssrc { font-size: var(--t-s); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.srow .stgt { font-size: var(--t-s); font-family: var(--font-jp); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.srow .sflags { display: flex; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.srow .sflags .has-note { color: var(--wait); font-weight: 600; }

.review-detail { display: flex; flex-direction: column; min-width: 0; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.detail-body { display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.text-block { display: flex; flex-direction: column; gap: 6px; }
.text-block .lbl { display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); color: var(--ink-3); }
.text-block .txt { font-size: var(--t-l); line-height: 1.6; }
.text-block .txt.ja { font-size: 17px; line-height: 1.85; }
.checks-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--ok); background: var(--ok-soft); padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.check .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.terms-table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.terms-table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: var(--t-xs); padding: 0 0 6px; }
.terms-table td { padding: 7px 0; border-top: 1px solid var(--line); }
.terms-table td:last-child { font-family: var(--font-jp); }

.thread { display: flex; flex-direction: column; gap: 10px; }
.note { padding: 10px 12px; border-radius: var(--radius-m); background: var(--mark-soft); color: var(--ink); font-size: var(--t-s); }
.note .who { font-size: var(--t-xs); color: var(--ink-3); margin-bottom: 2px; }
.note.is-pending { opacity: 0.7; }
.composer { display: flex; flex-direction: column; gap: 8px; }
.composer .row { justify-content: space-between; flex-wrap: wrap; }

.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.summary-strip > div { padding: 14px 18px; border-left: 1px solid var(--line); }
.summary-strip > div:first-child { border-left: 0; }
.summary-strip .v { font-size: var(--t-xl); font-weight: 600; }
.summary-strip .k { color: var(--ink-3); font-size: var(--t-xs); }

.table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.table th { text-align: left; font-weight: 500; font-size: var(--t-xs); color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------- Feedback ---------- */

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: var(--t-s); box-shadow: var(--shadow-pop); z-index: 50; }
.toast .icon { color: var(--ok); }
.toast { animation: toast-out 0.3s ease 2.8s forwards; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; transform: translate(-50%, 8px); } }
.skeleton { background: linear-gradient(90deg, var(--track), var(--surface-2), var(--track)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.htmx-indicator { opacity: 0; transition: opacity 0.15s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.loadbar { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: left; transform: scaleX(0); z-index: 60; }
.htmx-request .loadbar, .loadbar.is-on { animation: load 0.9s ease-out forwards; }
@keyframes load { from { transform: scaleX(0); } to { transform: scaleX(0.85); } }


/* ---------- Auth ---------- */

.auth { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.auth-card .brand { padding: 0; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.pw { position: relative; }
.pw .input { padding-right: 70px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font: inherit; font-size: var(--t-s); color: var(--ink-2); padding: 6px 8px; cursor: pointer; border-radius: 6px; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .portal-shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { display: none; }
  .rail.is-open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 70; box-shadow: var(--shadow-pop); }
  .page { padding: 18px 16px 96px; gap: 18px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .prow { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .prow .langs { grid-column: 1 / -1; order: 3; }
  .prow .nextline { grid-column: 1 / -1; order: 4; }
  .review { grid-template-columns: minmax(0, 1fr); }
  .review-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .strings { max-height: 300px; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip > div:nth-child(3) { border-left: 0; }
  .summary-strip > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .next { grid-template-columns: auto minmax(0, 1fr); }
  .next > .actions { grid-column: 1 / -1; }
  .next > .actions .btn { flex: 1; }
  .steps { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .steps li { font-size: 11px; }
  .summary-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
  .mobile-bar .btn { flex: 1; }
}
@media (min-width: 961px) { .mobile-bar { display: none; } }

.scrim { position: fixed; inset: 0; background: rgba(10, 12, 16, 0.4); z-index: 65; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Portal shell (run 325 M1): rail, top bar, notices, breadcrumbs.
   ========================================================================== */

html { background: var(--paper); }

/* htmx puts `htmx-request` on the indicator itself (`hx-indicator=".loadbar"`). */
.loadbar.htmx-request { animation: load 0.9s ease-out forwards; }

/* The icon sprite in `base.html`: SVG ignores the HTML `hidden` attribute. */
.portal-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 80; padding: 8px 14px; border-radius: var(--radius-m); background: var(--ink); color: var(--paper); font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }

.portal-shell .rail { overflow-y: auto; }
.portal-shell .rail nav { display: flex; flex-direction: column; gap: 2px; }
.nav .count { line-height: 20px; }

.portal-topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  position: sticky; top: 0; z-index: 30;
  min-height: 56px; padding: 10px 40px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.portal-topbar .topbar-brand { display: none; }
.portal-menu-toggle { display: none; }
.topbar-account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-left: auto; min-width: 0; font-size: var(--t-s); }
.topbar-workspace { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.topbar-workspace .portal-workspace-label { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.topbar-workspace small { color: var(--ink-3); font-size: var(--t-xs); }
.topbar-person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink-2); }
.topbar-person .avatar { width: 26px; height: 26px; }
.topbar-person b { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.topbar-signout { display: inline-flex; align-items: center; gap: 8px; }
.topbar-signout [role="status"]:empty { display: none; }
.topbar-signout [role="status"] { color: var(--err); font-size: var(--t-xs); }

/* Run 449: the topbar's bug report control and its dialog. Without JavaScript
   the control is a link to the dialog, which `:target` shows in place. */
.topbar-bug-report { white-space: nowrap; }
.portal-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius-l);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
.portal-dialog::backdrop { background: rgba(23, 25, 30, 0.36); }
.portal-dialog:target:not([open]) { display: block; position: fixed; inset: 16px 0 auto; margin: 0 auto; z-index: 40; }
.portal-dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.portal-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.portal-dialog-head h2 { margin: 4px 0 0; font-size: var(--t-l); }
.portal-dialog .textarea { width: 100%; min-height: 140px; }
.portal-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.portal-bug-report-status { margin: 0; font-size: var(--t-s); color: var(--ink-2); }
.portal-bug-report-status:empty { display: none; }
.portal-bug-report-status.is-ok { color: var(--ok); }
.portal-bug-report-status.is-error { color: var(--err); }

/* The language switch keeps its reviewed markup (buttons with a text
   separator); the pill look comes from here and the separator is hidden. */
.portal-language-switch { display: inline-flex; align-items: center; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.portal-language-switch > span[aria-hidden="true"] { display: none; }
.portal-language-switch button { min-height: 0; border: 0; background: none; font: inherit; font-size: var(--t-xs); padding: 3px 10px; border-radius: 999px; color: var(--ink-2); cursor: pointer; }
.portal-language-switch button:hover { background: var(--line); }
.portal-language-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.portal-language-switch button[disabled] { opacity: 0.6; cursor: progress; }

.portal-readonly { background: var(--line); color: var(--ink-2); }

.portal-shell .page { width: 100%; }
.portal-breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--t-s); color: var(--ink-3); }
.portal-breadcrumbs:empty { display: none; }
.portal-breadcrumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.portal-breadcrumbs a { color: var(--ink-2); }
.portal-breadcrumbs [aria-current] { color: var(--ink); }

#portal-notices:empty { display: none; }
#portal-notices { display: flex; flex-direction: column; gap: 10px; }
p.notice { display: block; }
.error { padding: 12px 14px; border-radius: var(--radius-m); background: var(--err-soft); border: 1px solid transparent; color: var(--err); font-size: var(--t-s); font-weight: 500; }
.error:focus { outline: 2px solid var(--err); outline-offset: 2px; }

#main:focus { outline: none; }

/* Shared page macros (`portal/templates/components/ui.html`). */
.page-subtitle { margin-top: 6px; }
.lang-chips { margin: 0; padding: 0; list-style: none; }
.lang-chips .badge { font-weight: 500; }

/* Fix of run 531: a chip or badge never runs past its row or card. A state
   longer than the room left wraps inside the pill instead of overlapping its
   neighbour or pushing the page sideways; the dot keeps its size. A language
   card's heading keeps its own width and the badge moves under it when the
   two do not fit side by side. */
.badge { max-width: 100%; white-space: normal; overflow-wrap: break-word; }
.badge::before { flex: none; }
.lang-chips > li { min-width: 0; max-width: 100%; }
.lang-card .lang-head { flex-wrap: wrap; }
.lang-card .lang-head h3 { flex: none; max-width: 100%; }
/* The language and questions addresses land below the sticky top bar, whose
   height follows the width, the language and the names in it. Each value clears
   the bar in English and Japanese: one line (64 px) above 960 px wide, 258 px at
   up to 960 px, 280 px at up to 359 px. A bar with more lines than that, from a
   long name or from wrapping just above 960 px, can reach past its value. */
.lang-card, .hub-questions { scroll-margin-top: 72px; }
@media (max-width: 960px) {
  .lang-card, .hub-questions { scroll-margin-top: 270px; }
}
@media (max-width: 359px) {
  .lang-card, .hub-questions { scroll-margin-top: 290px; }
}

@media (max-width: 960px) {
  .portal-topbar { padding: 10px 16px; }
  .portal-topbar .topbar-brand { display: flex; }
  .portal-menu-toggle { display: inline-flex; }
  .topbar-account { width: 100%; margin-left: 0; justify-content: flex-start; }
}

@media (max-width: 600px) {
  .topbar-account { gap: 8px 12px; }
  .topbar-person .avatar { display: none; }
}

/* Touch targets on phones: every link and control is at least 44 px tall, as
   the portal required before this run (`controlplane.css`, 620 px rule). */
@media (max-width: 620px) {
  /* Run 325 M1 (review blocker 5): the sign-in family keeps 44 px controls
     too. Scoped like `.portal-shell` below so it outranks the later password
     toggle (30px), `.btn-sm` (30px) and "Page fallback" (40px) rules; `.auth`
     also covers an auth page reached by a boosted swap. */
  :is(.portal-auth-page, .auth) :is(a, button, .btn, .btn-s, .btn-sm, .password-field button),
  :is(.portal-auth-page, .auth) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
  :is(.portal-auth-page, .auth) select, :is(.portal-auth-page, .auth) textarea { min-height: 44px; }
  body { overflow-x: clip; }
  :is(a, button, input, select, textarea, .btn, .btn-s, .btn-sm, .input, .select, .textarea) { min-height: 44px; }
  :is(a, button) { display: inline-flex; align-items: center; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea { min-height: 44px; }
  .portal-language-switch button { min-height: 44px; padding: 0 14px; }
  /* Run 325 M7: outrank the later "Page fallback" (40px)
     rule, which is equal or higher in specificity, so the phone rule
     holds on every screen. */
  .portal-shell input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
  .portal-shell select, .portal-shell textarea { min-height: 44px; }
}

/* ==========================================================================
   Sign-in family (run 325 M1): sign-in, workspace choice, reset, sign-up,
   verify, invitation, not-found and error pages. They keep their reviewed
   markup; the mock's auth card look is applied to it here.
   ========================================================================== */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
/* Run 330: the card sets the body's own line height, so its text inherits the
   same value in every language (its parent carries the Japanese 1.7). */
.portal-auth-card { line-height: 1.45; width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.portal-auth-card .auth-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.portal-auth-card .login-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-size: var(--t-l); }
.portal-auth-card .login-brand:hover { text-decoration: none; }
.portal-s23-auth-copy { display: flex; flex-direction: column; gap: 4px; }
.portal-s23-eyebrow { color: var(--ink-3); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.login-title { font-size: var(--t-xl); }
.login-sub, .portal-s23-field-help { color: var(--ink-2); font-size: var(--t-s); }
/* Run 330: the sign-in subtitle wraps to two lines in Japanese and one in
   English; it always holds two lines' height so the card keeps its size. */
.login-sub-two-lines { min-height: calc(2 * 1.45em); }
.portal-auth-form { display: flex; flex-direction: column; gap: 6px; }
.portal-auth-form > label { margin-top: 8px; font-weight: 600; font-size: var(--t-s); }
.portal-auth-form > label:first-of-type { margin-top: 0; }
.portal-auth-form > .btn { margin-top: 14px; }
.portal-auth-form > p { color: var(--ink-3); font-size: var(--t-xs); }
.portal-auth-form fieldset { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.portal-auth-form legend { margin-bottom: 6px; font-weight: 600; font-size: var(--t-s); }
.portal-auth-form fieldset label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-m); background: var(--surface); cursor: pointer; }
.portal-auth-form fieldset label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.password-field { position: relative; }
.password-field input { padding-right: 76px; }
.password-field button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 30px; }
.login-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: var(--t-s); color: var(--ink-3); }
.portal-auth-card .facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: var(--t-s); }
.portal-auth-card .facts dt { color: var(--ink-3); }
.portal-auth-card .facts dd { margin: 0; overflow-wrap: anywhere; }
.portal-auth-card code { font-family: var(--font-mono); }

/* ==========================================================================
   Page fallback (run 325 M1). Pages that lanes M2-M4 have not rebuilt yet
   still render legibly: bare form controls, tables, the reviewed status
   pills and small buttons get the portal look. Rebuilt pages use the design
   classes above instead.
   ========================================================================== */

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea {
  max-width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink); font: inherit;
}
/* A select is sized like the inputs, so its longest option (the sign-up's
   head-office countries) never widens the card past a phone screen. */
.portal-auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), .portal-auth-form select { width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }
table { border-collapse: collapse; }
.page table:not(.table):not(.terms-table) { width: 100%; font-size: var(--t-s); background: var(--surface); }
.page table:not(.table):not(.terms-table) th { text-align: left; font-weight: 500; font-size: var(--t-xs); color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.page table:not(.table):not(.terms-table) td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: var(--t-s); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--line); color: var(--ink-2); }
.status-running, .status-queued { background: var(--accent-soft); color: var(--accent); }
.status-completed, .status-delivered, .status-ready, .status-accepted { background: var(--ok-soft); color: var(--ok); }
.status-waiting-customer, .status-needs-resume, .status-open { background: var(--wait-soft); color: var(--wait); }
.status-failed, .status-cancelled, .status-rejected, .status-dead { background: var(--err-soft); color: var(--err); }
.portal-placeholder { color: var(--ink-3); }

/* === order === */
/* Run 325 M2: the three-step new project flow (steps, files, languages, estimate). */
.order-grid [hidden] { display: none !important; }
.order-grid h2 { font-size: var(--t-l); }
.order-formats, .order-optional { font-size: var(--t-xs); font-weight: 400; }
.order-file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* Run 576: a file box. The target label covers the whole box; the file field stays
   in the form and the tab order, out of sight; the folder label sits above the target. */
.file-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-m); background: var(--surface-2); color: var(--ink-2); text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; }
.file-box:hover { border-color: var(--accent); }
.file-box:has(.file-box-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-box.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.file-box.has-file { border-style: solid; }
.file-box-input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-box-target { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-weight: 400; }
.file-box-target::after { content: ""; position: absolute; inset: 0; }
.file-box-target .icon { width: 22px; height: 22px; color: var(--accent); }
.file-box-target b { color: var(--ink); font-size: var(--t-m); font-weight: 600; }
.file-box-help { font-size: var(--t-s); }
.file-box-name { color: var(--ink); font-size: var(--t-s); font-weight: 600; overflow-wrap: anywhere; }
.file-box-name:empty { display: none; }
.file-box-folder { position: relative; z-index: 1; font-size: var(--t-s); }
.file-box-folder label { color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 400; }
.file-box-status { color: var(--err); font-size: var(--t-s); }
.file-box-name[hidden], .file-box-status[hidden], .field[data-locale-follower][hidden] { display: none; }
.file-box.is-compact { padding: 8px 12px; min-width: 200px; flex: 1 1 200px; }
.file-box.is-compact .icon { display: none; }
.file-box.is-compact .file-box-target b { font-size: var(--t-s); font-weight: 400; }
/* Run 576: references as distinct sections, each with its own ways of adding. */
.reference-sections { display: flex; flex-direction: column; gap: 22px; }
.reference-section + .reference-section { padding-top: 22px; border-top: 1px solid var(--line); }
.reference-title { display: flex; align-items: center; gap: 8px; font-size: var(--t-m); }
.reference-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: start; }
.reference-language { max-width: 320px; }
.order-estimate-notes:empty { display: none; }
.order-target-chosen { list-style: none; margin: 0 0 4px; padding: 0; }
.order-target-chip { padding-right: 5px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* Run 576: a 24px target; its margins keep the chip about the size the 16px glyph box gave it, with the focus ring clear of the name. On a phone the 44px rule below makes it taller, the margins again taking that out of the chip. */
.order-target-chip .x { width: 24px; height: 24px; margin: -4px -4px -4px -1px; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; font: inherit; line-height: 1; }
@media (max-width: 620px) { .order-target-chip .x { margin-block: -14px; } }
.order-target-chip .x:hover, .order-target-chip .x:focus-visible { background: var(--accent-ink); color: var(--accent); }
.order-target-chip .x:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
.order-change { border: 0; background: transparent; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.order-change:hover { text-decoration: underline; }
.order-row-editor { grid-column: 1 / -1; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-2); }
.order-edit-actions { gap: 8px; }
.order-actions { justify-content: flex-end; flex-wrap: wrap; }
.order-check.ok { color: var(--ok); font-weight: 600; }
.order-check.wait { color: var(--wait); font-weight: 600; }
.order-check.err { color: var(--err); font-weight: 600; }
.order-targets, .order-category, .order-start-languages { border: 0; padding: 0; margin: 0; min-width: 0; }
.order-target-options { max-height: 280px; overflow-y: auto; padding: 2px; }
.order-target { position: relative; }
.order-target input { position: absolute; opacity: 0; pointer-events: none; }
.order-target:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.order-target:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.order-targets[aria-invalid="true"] .order-target-options { outline: 1px solid var(--err); border-radius: var(--radius-m); }
.order-select { max-width: 320px; }
.order-footnote { font-size: var(--t-xs); }
.order-grid .summary-list dd { margin: 0; }
.wizard-steps a { color: inherit; text-decoration: none; }
.wizard-steps a:hover span, .wizard-steps a:focus-visible span { text-decoration: underline; }

/* === hub === */

/* Run 325 M3: the project hub (Overview, Strings, Files & references, Report),
   its progress card and the questions pages. Only classes the hub templates
   add are styled here; the mock's shared classes live above. */
.hub-tabs { margin-top: -6px; }
.hub-language-switch { margin-top: 2px; }
.hub-card .hub-card-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hub-card form { display: inline-flex; }
/* Run 397: one line per stopped language when their outcomes differ. */
.hub-card-outcomes { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.hub-estimate { font-size: var(--t-s); color: var(--ink-2); }
/* Run 576: `dl.kv` sets these columns with the higher specificity. A long label wraps at this width rather than squeezing its value down to a few letters. */
dl.hub-kv { grid-template-columns: fit-content(55%) minmax(0, 1fr); }
.hub-kv { display: grid; gap: 6px 16px; margin: 0; font-size: var(--t-s); }
.hub-kv dt { color: var(--ink-3); }
.hub-kv dd { margin: 0; overflow-wrap: anywhere; }
.hub-section-title { font-size: var(--t-l); }
.hub-panel-title { font-size: var(--t-l); }
.hub-subtitle { font-size: var(--t-m); }
.hub-list { margin: 0; padding: 0; list-style: none; }
.hub-panel-list { padding: 4px 22px 8px; }
.hub-panel-note { padding: 0 22px 14px; }
.panel-head + .hub-panel-note { padding-top: 14px; }
.hub-notes { white-space: pre-line; overflow-wrap: anywhere; }
.hub-thread-link { font-size: var(--t-s); }
.hub-row-actions { justify-content: flex-end; flex-wrap: wrap; }
.hub-row-actions form, .hub-delivery form { display: inline-flex; }
.hub-delivery { grid-template-columns: 34px minmax(0, 1fr); }
.hub-delivery .actions { grid-column: 2 / -1; justify-content: flex-start; }
.hub-delivery-version { display: block; }
@media (min-width: 961px) {
  /* Run 576: on the Files tab's wide panel, Download sits at the row's end as on the rows around it. */
  .hub-panel-list .hub-delivery { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .hub-panel-list .hub-delivery .actions { grid-column: auto; justify-content: flex-end; }
}
/* Run 576: the half-width style guide panel has no room beside a Replace box, so the row's actions go under its name. */
.hub-files-grid .mat { grid-template-columns: 34px minmax(0, 1fr); }
.hub-files-grid .mat > .hub-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
.hub-file-name { white-space: nowrap; }
.hub-delivery .hub-ack { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: var(--t-xs); }
.hub-delivery .hub-ack .input { min-height: 32px; padding: 5px 10px; font-size: var(--t-s); max-width: 100%; }
.hub-technical { margin-top: 6px; font-size: var(--t-xs); color: var(--ink-2); }
.hub-technical summary { cursor: pointer; }
.hub-technical p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hub-delivery-notes { margin: 4px 0 0; padding-left: 16px; font-size: var(--t-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.hub-strings-notes .hub-delivery-notes { font-size: var(--t-s); margin: 0; }

/* The progress card: an outer region that stays, a body each poll replaces. */
.hub-progress { display: flex; flex-direction: column; gap: 14px; }
.hub-progress-body { display: flex; flex-direction: column; gap: 14px; }
.hub-progress-title { font-size: var(--t-m); }
.hub-progress-bar { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--track); overflow: hidden; }
.hub-progress-bar::-webkit-progress-bar { background: var(--track); border-radius: 999px; }
.hub-progress-bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width 0.6s ease; }
.hub-progress-bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.hub-stop { flex-wrap: wrap; font-size: var(--t-xs); }
.hub-stop form { display: inline-flex; }

/* Files & references. */
.hub-upload-sections { display: flex; flex-direction: column; gap: 22px; padding: 18px 22px 22px; }
.hub-upload-section + .hub-upload-section { padding-top: 22px; border-top: 1px solid var(--line); }
.hub-upload-title { font-size: var(--t-m); }
.hub-replace { flex-wrap: wrap; gap: 8px; }
.hub-files-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hub-terms td:last-child { font-family: var(--font-jp); }
/* A scrolled table keeps its visually hidden labels inside the scroll box. */
.hub-table-wrap { position: relative; }

/* Strings. */
.hub-strings-bar { flex-wrap: wrap; }
.hub-string-filters { align-items: center; }
.hub-string-filters .portal-string-mine-filter input { accent-color: var(--accent); }
.hub-string-filters .portal-string-mine-filter:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
/* Run 385: the list keeps a double space the client must see (an icon gap):
   `pre-wrap` shows the text as written and the one-line clamp keeps the row to
   one ellipsised line, where `nowrap` collapsed the gap. */
.portal-string-row-target { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; font-family: var(--font-jp); font-size: var(--t-s); color: var(--ink); overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }

/* The strings workspace (list, selected string, its comments), as mock A's
   review screen lays it out. Its markup is the reviewed one portal-strings.js
   binds to; below 960 px it shows one pane at a time. */
.portal-strings-workspace { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); min-height: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.portal-strings-workspace .portal-eyebrow { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); }
.portal-string-list-pane { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.portal-string-list-head { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.portal-string-list-head h2 { font-size: var(--t-m); }
.portal-string-list-head p { color: var(--ink-3); font-size: var(--t-xs); }
.portal-string-filters { display: flex; flex-direction: column; gap: 10px; }
.portal-string-search input { width: 100%; }
.portal-string-mine-filter input { margin: 0; }
.portal-string-list { margin: 0; padding: 0; list-style: none; overflow-y: auto; max-height: 640px; }
.portal-string-list-row a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--line); color: var(--ink); }
.portal-string-list-row:first-child a { border-top: 0; }
.portal-string-list-row a:hover { background: var(--surface-2); text-decoration: none; }
.portal-string-list-row.is-selected a, .portal-string-list-row a[aria-current] { background: var(--accent-soft); }
.portal-string-row-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.portal-string-row-copy strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; font-weight: 500; font-size: var(--t-s); color: var(--ink-2); overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-string-row-copy small { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.portal-string-row-meta { display: flex; gap: 6px; align-items: flex-start; font-size: var(--t-xs); color: var(--ok); }
.portal-string-row-status.is-undelivered { color: var(--wait); }
.portal-string-comment-pill { padding: 0 6px; border-radius: 999px; background: var(--mark-soft); color: var(--ink); }
.portal-string-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: var(--t-s); }
.portal-string-search-empty { padding: 14px; color: var(--ink-3); font-size: var(--t-s); }
.portal-string-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 0.8fr); min-width: 0; }
.portal-string-back { display: none; }
.portal-string-content { display: flex; flex-direction: column; gap: 16px; padding: 20px; min-width: 0; }
.portal-string-identifier { font-family: var(--font-mono); font-size: var(--t-m); }
/* A client key is one identifier: it never breaks mid-number, it ellipsises
   and its full text is on the title. */
.portal-string-identifier, .portal-string-context dd, .portal-string-row-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.portal-string-fields { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.portal-string-fields dt { font-size: var(--t-xs); color: var(--ink-3); }
.portal-string-fields dd { margin: 4px 0 0; font-size: var(--t-l); line-height: 1.6; overflow-wrap: anywhere; }
.portal-strings-workspace .text-cell { white-space: pre-wrap; }
/* Run 385: "Sending…" beside a reply's Send while it is on its way. */
.portal-comment-sending { color: var(--ink-3); font-size: var(--t-s); }
.portal-comment-sending:empty { display: none; }
.portal-string-form-tabs[hidden] { display: none; }
.portal-string-comments { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 20px; border-left: 1px solid var(--line); background: var(--surface-2); }
.portal-thread-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.portal-thread-message { padding: 10px 12px; border-radius: var(--radius-m); background: var(--surface); font-size: var(--t-s); overflow-wrap: anywhere; }
.portal-thread-meta, .portal-thread-status, .portal-string-no-comments { font-size: var(--t-xs); color: var(--ink-3); }
.portal-string-list-region { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.portal-string-content { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
/* D-PF-1: the thread LIST scrolls, so the composer under it stays in view. */
.portal-string-comments { overflow: hidden; min-height: 0; }
.portal-string-comments .portal-string-pane-heading { flex: none; }
.portal-string-comments .portal-thread-list { flex: 1 1 auto; align-content: start; min-height: 9rem; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
/* D-CRP-2: the composer grows only within the pane: a column capped at 40% of
   it, so a textarea dragged past the cap shrinks back and Send stays inside. */
.portal-comment-form { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
.portal-string-comments .portal-comment-form { flex: 0 0 auto; min-height: 0; max-height: 40%; }
.portal-comment-form .portal-comment-actions { display: flex; flex: none; justify-content: flex-end; align-items: center; gap: 8px; }
/* D-CRP-7: one line when idle, taller on focus and typing; the drag handle stays
   and its range stops at 40% of the viewport, past which the box scrolls. */
.portal-comment-textarea { box-sizing: border-box; width: 100%; min-height: 0; height: 2.6em; max-height: 40vh; flex: 0 1 auto; resize: vertical; overflow-y: auto; line-height: 1.45; }
.portal-comment-form.is-expanded .portal-comment-textarea { min-height: 4.6em; }

/* D-CRP-3: on a wide screen the strings editor fills the viewport: the shell is
   one viewport tall, the page region under the top bar takes what is left with
   a modest gutter, and each pane scrolls inside itself. The layout keys on the
   shell CONTAINING the workspace, not on a body class: a boosted navigation
   swaps the body's children but keeps the body element, so a body class would
   neither arrive with the Strings tab nor leave with it. */
@media (min-width: 961px) {
  .portal-shell:has(.portal-strings-workspace) { height: 100vh; min-height: 100vh; overflow: hidden; }
  .portal-shell:has(.portal-strings-workspace) .rail { overflow-y: auto; }
  .portal-shell:has(.portal-strings-workspace) .main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }
  .portal-shell:has(.portal-strings-workspace) .page { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; gap: 12px; padding: 16px 20px; overflow-y: auto; }
  .portal-shell:has(.portal-strings-workspace) .page > *:not(.portal-strings-workspace) { flex: none; width: 100%; max-width: 1120px; }
  .page > .portal-strings-workspace { flex: 1 1 auto; min-height: 420px; }
  .page > .portal-strings-workspace .portal-string-list-pane, .page > .portal-strings-workspace .portal-string-detail { min-height: 0; }
  .page > .portal-strings-workspace .portal-string-list { flex: 1 1 auto; min-height: 0; max-height: none; }
}

@media (max-width: 960px) {
  .portal-strings-workspace { display: block; min-height: 0; }
  .portal-string-list-pane { border-right: 0; }
  .portal-string-list { max-height: 60vh; }
  .portal-string-detail { display: none; }
  .portal-strings-workspace.is-detail-open .portal-string-list-pane { display: none; }
  .portal-strings-workspace.is-detail-open .portal-string-detail { display: grid; grid-template-columns: minmax(0, 1fr); }
  .portal-strings-workspace.is-detail-open .portal-string-back { display: inline-flex; margin: 12px 12px 0; }
  .portal-string-comments { border-left: 0; border-top: 1px solid var(--line); }
}

/* Report. */
.hub-summary { margin: 0; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.hub-summary > div { display: flex; flex-direction: column-reverse; }
.hub-summary dd { margin: 0; }
.hub-checks { margin: 0; }
.hub-share-table .r { text-align: right; }
.hub-details summary { cursor: pointer; font-size: var(--t-s); color: var(--ink-2); }
.hub-details[open] summary { margin-bottom: 10px; }
.hub-link-list { margin: 0; padding-left: 18px; font-size: var(--t-s); }

/* Questions. */
.hub-question-head { align-items: flex-start; flex-wrap: wrap; }
.hub-choices { margin: 0; padding: 0; border: 0; }
.hub-choice { grid-template-columns: auto minmax(0, 1fr) auto; cursor: pointer; }
.hub-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.hub-choice-detail { display: block; font-size: var(--t-xs); }
.hub-send { justify-content: flex-end; flex-wrap: wrap; }
.hub-examples .pair { grid-template-columns: max-content minmax(0, 1fr); }
/* A suspected row is the client's own text, verbatim: kept whitespace, and one
   long unbroken token wraps instead of pushing the page sideways. */
.hub-examples .pair .src, .hub-examples .pair .tgt { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 960px) {
  /* At most two tracks, the layout `.summary-strip`'s narrow borders draw. */
  .hub-summary { grid-template-columns: repeat(auto-fit, minmax(34%, 1fr)); }
  .hub-row-actions { justify-content: flex-start; }
  .hub-delivery { grid-template-columns: 34px minmax(0, 1fr); }
  .hub-delivery .actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 620px) {
  .hub-files-grid { grid-template-columns: minmax(0, 1fr); }
  .hub-panel-list .mat, .hub-files-grid .mat, .hub-delivery { grid-template-columns: 34px minmax(0, 1fr); }
  .hub-panel-list .mat > .hub-row-actions, .hub-files-grid .mat > .hub-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .hub-replace, .hub-row-actions form { min-width: 0; max-width: 100%; }
  .table-wrap .table th, .table-wrap .table td { padding: 10px 12px; }
  /* Fix of run 531: on a phone the Files tab's source table reads one file
     per block, each value under its column's name, so no state or action
     sits past the panel's edge. */
  .hub-source-table, .hub-source-table tbody, .hub-source-table tr { display: block; }
  .hub-source-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hub-source-table tr { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .hub-source-table tr:last-child { border-bottom: 0; }
  .table-wrap .hub-source-table td { display: block; padding: 3px 0; border: 0; text-align: left; }
  .table-wrap .hub-source-table td[data-label] { display: grid; grid-template-columns: minmax(5.5rem, 0.4fr) minmax(0, 1fr); gap: 8px; align-items: center; }
  .hub-source-table td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: var(--t-xs); }
  .table-wrap .hub-source-table td:empty { display: none; }
  .hub-source-table .hub-file-name { white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
  .hub-source-table .hub-row-actions { justify-content: flex-start; }
}

/* === usage === */

/* Run 325 M4: the projects home (mock A `home`) and Usage & team (mock A
   `usage`). Everything else these pages use is the shared mock A system. */

.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.home-controls { flex-wrap: wrap; align-items: center; }
.view-switch { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.view-switch button { border: 0; background: none; font: inherit; font-size: var(--t-s); padding: 4px 12px; border-radius: 999px; color: var(--ink-2); cursor: pointer; }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.plist[hidden], .prow[hidden], .pcard[hidden] { display: none; }
.prow .pmeta { display: flex; flex-wrap: wrap; gap: 0 6px; }
.prow .pmeta > span + span::before, .pcard .pmeta > span + span::before { content: "·"; margin-right: 6px; color: var(--ink-3); }
.pboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pboard[hidden] { display: none; }
.pcard { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.pcard:hover { border-color: var(--line-strong); text-decoration: none; }
.pcard .spread { align-items: flex-start; }
.pcard .pname { font-weight: 600; }
.pcard .pmeta { display: flex; flex-wrap: wrap; gap: 0 6px; color: var(--ink-3); font-size: var(--t-s); }
.pcard .nextline { font-size: var(--t-s); color: var(--ink-2); }
.pcard .nextline b { color: var(--ink); font-weight: 600; }
.home-needs .need-card .lang-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.home-empty, .home-filter-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 24px 22px; color: var(--ink-2); }
.home-empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.home-empty[hidden], .home-filter-empty[hidden] { display: none; }
.home-empty h3, .home-filter-empty h3 { color: var(--ink); font-size: var(--t-m); }
.pboard > .home-filter-empty { grid-column: 1 / -1; }

.usage-allowance-head { align-items: flex-end; flex-wrap: wrap; }
.usage-allowance h2 { font-size: var(--t-l); }
.usage-allowance .estimate { margin: 6px 0 0; }
.usage-allowance .big { font-size: var(--t-2xl); font-variant-numeric: normal; }
.usage-meter { display: block; width: 100%; height: 12px; }
.usage-note { font-size: var(--t-xs); }
.usage-runs td a { font-weight: 500; }
/* Run 385: the string-replies row reads as a row of the table, not a header. */
.usage-runs tbody th[scope="row"] { font-size: var(--t-s); color: var(--ink-2); font-weight: 400; }
.usage-runs tbody tr:last-child th { border-bottom: 0; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; align-items: start; }
.usage-members { list-style: none; margin: 0; padding: 0; }
/* Run 347 copy review: the badges and the Remove button sit under the name and
   address at every width, so the address has the row's whole text column; an
   address breaks only where the browser allows (after a hyphen), and inside a
   run of letters only when one run is longer than the whole line. */
.usage-members .mat { grid-template-columns: 34px minmax(0, 1fr); }
.usage-members .mat > div { display: flex; flex-direction: column; min-width: 0; }
.usage-members .mat > div b { overflow-wrap: break-word; }
.usage-members .mat > div span { color: var(--ink-3); font-size: var(--t-s); overflow-wrap: break-word; }
.usage-member-badges { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 2; justify-content: flex-start; }

@media (max-width: 620px) {
  .usage-runs th, .usage-runs td { padding: 10px 10px; }
}

/* ---------- Run 377: the source file check, one card per decision ---------- */

#inspection-main { display: flex; flex-direction: column; gap: 14px; }
.inspection-eyebrow { font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.02em; }
.inspection-head-top { align-items: flex-start; flex-wrap: wrap; }
.inspection-file-name { font-size: var(--t-xl); font-weight: 600; overflow-wrap: anywhere; margin-top: 2px; }
.inspection-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--t-s); }
.inspection-status { font-weight: 600; font-size: var(--t-m); }
.inspection-status.is-open { color: var(--wait); }
.inspection-status.is-clear { color: var(--ok); }
.inspection-card { overflow: hidden; }
.inspection-card-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 16px 22px; cursor: pointer; list-style: none; }
.inspection-card-summary::-webkit-details-marker { display: none; }
.inspection-card-summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform 0.15s ease; flex: none; }
.inspection-card[open] > .inspection-card-summary::before { transform: rotate(45deg); }
.inspection-card-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.inspection-card-title { font-weight: 600; font-size: var(--t-l); flex: 1 1 260px; min-width: 0; }
.inspection-card-count { font-size: var(--t-s); }
/* Run 397: what was done to a handled card's strings, on its own line. */
.inspection-card-handled { flex: 1 0 100%; font-size: var(--t-s); padding-left: 19px; }
.inspection-card-body { padding: 0 22px 20px; }
.inspection-explanation { color: var(--ink-2); max-width: 72ch; }
.inspection-samples, .inspection-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inspection-sample, .inspection-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-2); min-width: 0; }
.inspection-key { font-size: var(--t-xs); }
.inspection-key code { font-family: var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.inspection-source { margin: 4px 0 0; font-family: var(--font-mono); font-size: var(--t-s); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
/* Run 541: the kept-string list's client values (key, file, both translations)
   break anywhere inside their container, so a long unbroken one never runs past
   a phone's viewport, where the body clips horizontal overflow. */
.portal-kept-list { min-width: 0; overflow-wrap: anywhere; }
.inspection-source mark { background: var(--mark-soft); color: var(--mark); font-weight: 600; padding: 0 2px; border-radius: 3px; box-shadow: inset 0 -2px 0 var(--mark); }
.inspection-note { font-size: var(--t-s); margin-top: 4px; }
.inspection-actions { flex-wrap: wrap; }
.inspection-all > summary { list-style: none; display: inline-flex; }
.inspection-all > summary::-webkit-details-marker { display: none; }
.inspection-all[open] > summary { margin-bottom: 8px; }
.inspection-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; }
.inspection-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.inspection-run-actions { flex-wrap: wrap; }
.inspection-replace { background: var(--surface-2); }
.inspection-replace-title { font-size: var(--t-m); }
.inspection-replace-zone > summary { list-style: none; display: inline-flex; }
.inspection-replace-zone > summary::-webkit-details-marker { display: none; }
.inspection-replace-zone[open] > summary { margin-bottom: 10px; }
@media (max-width: 620px) {
  .inspection-card-summary { padding: 14px 16px; }
  .inspection-card-body { padding: 0 16px 16px; }
  .inspection-row { grid-template-columns: minmax(0, 1fr); }
  .inspection-row-actions { justify-content: flex-start; }
}
.inspection-run { padding-top: 14px; border-top: 1px solid var(--line); }
.inspection-run h2 { font-size: var(--t-m); }

/* ---------- Run 544: components the stylesheet split left unstyled ----------
   These components were drawn only by `.portal-page` rules in `controlplane.css`,
   which the portal no longer loads (run 325, D14). Each rule below is that
   design rewritten in this file's tokens, scale and breakpoints. Where a later
   portal design already draws a component (the run 377 check page, the run 325
   usage and sign-in pages), its class keeps no rule of its own; so does a
   class only templates no page shows use (`projects/language.html`,
   `projects/_project_assets*.html`). Those classes and their reasons are
   listed in `tests/controlplane/test_portal_classes_styled_544.py`. */

/* The label over a heading on the update confirmation and the upload page's
   state banners. */
:is(.portal-confirmation-card, .portal-state-banner) .portal-eyebrow { margin: 0 0 4px; color: var(--ink-3); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

/* The update confirmation: one card, its facts two by two, the mode's notice. */
.portal-confirmation-wrap { width: 100%; max-width: 680px; margin: 16px auto 0; }
.portal-confirmation-card { display: flex; flex-direction: column; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.portal-flow-subtitle { margin-top: 5px; color: var(--ink-2); }
.portal-confirmation-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0 0; }
.portal-confirmation-facts > div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-2); }
.portal-confirmation-facts dt { margin-bottom: 4px; color: var(--ink-3); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.portal-confirmation-facts dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.portal-file-name, .portal-file-name a { overflow-wrap: break-word; word-break: normal; }
.portal-confirmation-notice { margin-top: 16px; padding: 13px 15px; border-radius: var(--radius-m); background: var(--accent-soft); }
.portal-confirmation-notice p { margin-top: 4px; color: var(--ink-2); }
.portal-confirmation-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.portal-quiet-action { padding: 8px 10px; color: var(--ink-2); font-weight: 600; }

/* The upload page: an update offer and its modes, the updates already made,
   the corrected file's drop zone and the banner a file that was not inspected
   shows instead of its check. */
.portal-offer { display: flex; flex-direction: column; gap: 4px; }
.portal-offer + .portal-offer { padding-top: 16px; border-top: 1px solid var(--line); }
.portal-offer > p { margin-bottom: 6px; color: var(--ink-2); }
.portal-mode-list { display: grid; gap: 8px; }
.portal-mode-list a { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); color: var(--ink); }
.portal-mode-list a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.portal-mode-list span { color: var(--ink-2); font-size: var(--t-s); }
.portal-history-list { display: flex; flex-direction: column; }
.portal-history-list article { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.portal-history-list article:first-child { padding-top: 0; border-top: 0; }
.portal-history-list article > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.portal-history-list article > div span { color: var(--ink-3); font-size: var(--t-s); }
.portal-history-list article > ul { margin: 0; padding-left: 18px; }
.portal-state-banner { padding: 17px 20px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.portal-state-banner.is-success { border-color: transparent; background: var(--ok-soft); }
.portal-state-banner.is-warning { border-color: transparent; background: var(--wait-soft); }
.portal-state-banner.is-danger { border-color: transparent; background: var(--err-soft); }
.portal-state-banner.is-neutral { background: var(--surface-2); }
.portal-state-banner h2 { margin-bottom: 4px; font-size: var(--t-l); }
.portal-state-banner p { color: var(--ink-2); }

/* A delivery's Strings page: its notices, empty states, plural forms and pager. */
.portal-info-banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-m); background: var(--accent-soft); color: var(--accent); font-size: var(--t-s); }
.portal-info-banner span { color: var(--ink); }
.portal-flow-empty { display: flex; flex-direction: column; gap: 4px; padding: 24px 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius-l); background: var(--surface); }
.portal-flow-empty h2 { font-size: var(--t-l); }
.portal-flow-empty p { color: var(--ink-2); }
.portal-string-empty { grid-column: 1 / -1; align-self: center; justify-self: center; display: flex; flex-direction: column; gap: 6px; max-width: 340px; padding: 24px; text-align: center; }
.portal-string-empty h2 { font-size: var(--t-l); }
.portal-string-empty p { color: var(--ink-2); }
.portal-string-row-forms { white-space: nowrap; }
.portal-string-pager-label { flex: 0 1 auto; min-width: 0; color: var(--ink-2); text-align: center; white-space: nowrap; }
.portal-string-pager-label:focus { outline: none; }
.portal-string-pager-spacer { min-width: 64px; }
/* D-203-4: portal-strings.js unhides the tab strip and marks the forms
   enhanced; with no script every form is read stacked under its label. */
.portal-string-form-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.portal-string-form-tab { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--t-xs); font-weight: 600; cursor: pointer; }
.portal-string-form-tab.is-active { border-color: var(--ink); color: var(--ink); }
.portal-string-form-label { margin-bottom: 4px; color: var(--ink-3); font-size: var(--t-xs); font-weight: 600; }
.portal-string-forms.is-enhanced .portal-string-form-label { display: none; }
.portal-string-forms:not(.is-enhanced) .portal-string-form + .portal-string-form { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.portal-string-form .text-cell { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
/* A form the file carries empty, and a string the delivery does not carry,
   say so in a muted tone so they never read as the translation itself. */
.portal-string-form-empty, .portal-string-undelivered { color: var(--ink-3); font-style: italic; }

/* The comment thread (D-PF-1, D-CRP-1, D-CRP-4): each message is its author's
   initial beside a bubble; an answer sits nested under the comment it answers. */
.portal-thread-exchange { display: grid; align-content: start; gap: 9px; padding-top: 13px; border-top: 1px solid var(--line); }
.portal-thread-exchange:first-child { padding-top: 0; border-top: 0; }
.portal-string-comments .portal-thread-message { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 0; background: none; }
.portal-string-comments .portal-thread-message.is-nested { position: relative; margin-left: 22px; }
.portal-string-comments .portal-thread-message.is-nested::before { content: ""; position: absolute; top: -9px; bottom: 16px; left: -12px; width: 1px; background: var(--line-strong); pointer-events: none; }
.portal-thread-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 600; }
.portal-thread-message.is-reply .portal-thread-avatar { background: var(--accent); color: var(--accent-ink); }
.portal-thread-body { min-width: 0; padding: 10px 12px; border-radius: var(--radius-m); background: var(--surface); }
.portal-thread-message.is-reply .portal-thread-body { background: var(--accent-soft); }
.portal-thread-resolved { margin-bottom: 4px; color: var(--ink-3); font-size: var(--t-xs); font-weight: 600; }
.portal-thread-state { display: grid; justify-items: start; gap: 4px; margin-bottom: 6px; }
.portal-thread-state-detail { color: var(--ink-3); font-size: var(--t-xs); line-height: 1.45; }
.portal-thread-author { margin-bottom: 2px; font-size: var(--t-xs); font-weight: 600; }
/* A pipeline question on the string: its options, then the answer form. */
.portal-thread-options { margin: 6px 0; padding-left: 18px; }
.portal-thread-answer-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.portal-thread-answer-form fieldset { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.portal-thread-answer-form legend { margin-bottom: 4px; padding: 0; font-size: var(--t-xs); font-weight: 600; }
.portal-thread-answer-form fieldset label { display: flex; align-items: center; gap: 8px; }
.portal-thread-answer-form > label { font-size: var(--t-xs); font-weight: 600; }
.portal-thread-answer-form textarea { width: 100%; }

@media (max-width: 620px) {
  .portal-confirmation-facts { grid-template-columns: minmax(0, 1fr); }
  .portal-confirmation-actions > :is(a, button) { width: 100%; justify-content: center; }
}
