/* design/auth.css */
/* Sign in / Create account (views/auth-page.mjs).

   Design baseline: "Matrix 登录与注册页面优化方案 v1.0" — near-black page, dark
   card 440px wide (32px padding on desktop, 16px page margin on phones), 48px
   inputs and primary button, 8px radius, brand blue as the one primary colour.

   Colours are LITERAL and scoped to .mx-auth, never var(--mx-*): the page must
   read the same under every theme (the t45u toast regression was exactly a
   theme token resolving to dark-on-dark). test/auth-contrast-guard.test.mjs
   parses the --auth-* tokens below and fails the build if a text/background
   pair drops under WCAG AA (4.5:1 text, 3:1 control borders and focus ring).
   If it fails, fix the colours, not the test. */

.mx-auth {
  --auth-bg: #0C1118;
  --auth-card: #151C25;
  --auth-field: #0C1118;
  --auth-ink: #F0F4FA;
  --auth-muted: #A9B6C9;
  --auth-brand: #347CF0;
  --auth-brand-hover: #5B97F5;
  --auth-on-brand: #0C1118;
  --auth-link: #6FA6FF;
  --auth-border: #6B7B92;
  --auth-divider: #38475A;
  --auth-focus: #8DB8FF;
  --auth-error: #FFB4B4;
  --auth-error-border: #FF8A8A;
  --auth-ok: #7DDBA3;
  --auth-secondary: #212B38;
  --auth-secondary-hover: #2B3747;

  box-sizing: border-box;
  max-width: none;
  margin: 0;
  padding: 40px 16px 64px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--auth-bg);
  color: var(--auth-ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
}
.mx-auth *, .mx-auth *::before, .mx-auth *::after { box-sizing: border-box; }

.mx-auth .mx-auth__card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
  background: var(--auth-card);
  border: 1px solid var(--auth-divider);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

.mx-auth .mx-auth__head { display: block; margin: 0 0 24px; }
.mx-auth .mx-auth__title {
  margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.01em; font-weight: 650; color: var(--auth-ink);
}
.mx-auth .mx-auth__sub { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--auth-muted); }

.mx-auth .mx-auth__form { display: block; margin: 0; }
.mx-auth .mx-auth__field { margin: 0 0 16px; }
.mx-auth .mx-auth__label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--auth-ink); }
.mx-auth .mx-auth__control { position: relative; display: flex; gap: 8px; }

.mx-auth .mx-auth__input {
  display: block; flex: 1 1 auto; width: 100%; min-width: 0; height: 48px; margin: 0; padding: 0 14px;
  font: inherit; font-size: 15px; color: var(--auth-ink); background: var(--auth-field);
  border: 1px solid var(--auth-border); border-radius: 8px; outline: none; box-shadow: none;
}
.mx-auth .mx-auth__input::placeholder { color: #8A99AF; -webkit-text-fill-color: #8A99AF; opacity: 1; }
.mx-auth .mx-auth__input:hover { border-color: #8696AD; }
.mx-auth .mx-auth__input:focus-visible,
.mx-auth .mx-auth__input:focus { border-color: var(--auth-focus); box-shadow: 0 0 0 3px rgba(141, 184, 255, .35); }
.mx-auth .mx-auth__input[aria-invalid="true"] { border-color: var(--auth-error-border); }
.mx-auth .mx-auth__input:-webkit-autofill {
  -webkit-text-fill-color: var(--auth-ink); caret-color: var(--auth-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--auth-field) inset;
}
.mx-auth .mx-auth__control--toggle .mx-auth__input { padding-right: 72px; }
.mx-auth .mx-auth__control--send .mx-auth__input { letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.mx-auth .mx-auth__control--send .mx-auth__input::placeholder { letter-spacing: normal; }

.mx-auth .mx-auth__toggle {
  position: absolute; top: 4px; right: 4px; height: 40px; min-width: 56px; padding: 0 12px; margin: 0;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--auth-link); background: transparent;
  border: 0; border-radius: 6px; cursor: pointer;
}
.mx-auth .mx-auth__toggle:hover { background: var(--auth-secondary); }

.mx-auth .mx-auth__send {
  flex: 0 0 auto; min-width: 116px; height: 48px; margin: 0; padding: 0 14px; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--auth-ink); background: var(--auth-secondary); border: 1px solid var(--auth-border); border-radius: 8px; cursor: pointer;
  white-space: nowrap;
}
.mx-auth .mx-auth__send:hover:not(:disabled) { background: var(--auth-secondary-hover); }
.mx-auth .mx-auth__send:disabled { color: var(--auth-muted); cursor: not-allowed; opacity: 1; }

.mx-auth .mx-auth__hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--auth-muted); }
.mx-auth .mx-auth__error {
  margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--auth-error);
}
.mx-auth .mx-auth__error[hidden] { display: none; }
/* The glyph + words carry the error; the red tint is only reinforcement. */
.mx-auth .mx-auth__error::before { content: "! "; font-weight: 800; }

.mx-auth .mx-auth__aux { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin: -4px 0 16px; }
.mx-auth .mx-auth__aux--end { justify-content: flex-end; }
.mx-auth .mx-auth__textlink, .mx-auth .mx-auth__link {
  display: inline; margin: 0; padding: 4px 0; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--auth-link);
  background: none; border: 0; border-radius: 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.mx-auth .mx-auth__textlink:hover, .mx-auth .mx-auth__link:hover { color: #A8C8FF; }

.mx-auth .mx-auth__status { margin: 0 0 16px; font-size: 13.5px; line-height: 1.45; color: var(--auth-muted); }
.mx-auth .mx-auth__status:empty { display: none; }
.mx-auth .mx-auth__status[data-state="ok"] { color: var(--auth-ok); }
.mx-auth .mx-auth__status[data-state="error"] {
  padding: 10px 12px; color: var(--auth-error); background: rgba(255, 138, 138, .1);
  border: 1px solid var(--auth-error-border); border-radius: 8px;
}
.mx-auth .mx-auth__status[data-state="error"]::before { content: "! "; font-weight: 800; }

.mx-auth .mx-auth__primary,
.mx-auth .mx-auth__google,
.mx-auth .mx-auth__secondary {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 48px; margin: 0; padding: 0 16px;
  font: inherit; font-size: 15px; font-weight: 650; border-radius: 8px; cursor: pointer;
}
.mx-auth .mx-auth__primary { color: var(--auth-on-brand); background: var(--auth-brand); border: 1px solid var(--auth-brand); }
.mx-auth .mx-auth__primary:hover:not(:disabled) { background: var(--auth-brand-hover); border-color: var(--auth-brand-hover); }
.mx-auth .mx-auth__primary:disabled { cursor: progress; opacity: 1; }
.mx-auth .mx-auth__google,
.mx-auth .mx-auth__secondary { color: var(--auth-ink); background: var(--auth-secondary); border: 1px solid var(--auth-border); }
.mx-auth .mx-auth__google:hover:not(:disabled),
.mx-auth .mx-auth__secondary:hover:not(:disabled) { background: var(--auth-secondary-hover); }
.mx-auth .mx-auth__google:disabled { cursor: progress; }
.mx-auth .mx-auth__secondary { margin-top: 10px; }

.mx-auth :is(button, a, input, [tabindex]):focus-visible { outline: 3px solid var(--auth-focus); outline-offset: 2px; }
.mx-auth .mx-auth__input:focus-visible { outline-offset: 0; }

.mx-auth .mx-auth__divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--auth-muted); font-size: 13px; }
.mx-auth .mx-auth__divider::before, .mx-auth .mx-auth__divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--auth-divider); }

.mx-auth .mx-auth__switch { margin: 24px 0 0; text-align: center; font-size: 14px; color: var(--auth-muted); }
.mx-auth .mx-auth__switch[hidden] { display: none; }
.mx-auth .mx-auth__legal { margin: 20px 0 0; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--auth-muted); }
.mx-auth .mx-auth__legal-name { color: var(--auth-ink); }
/* Sign-up already names the terms in its consent line; the footer would repeat them. */
.mx-auth__card:has([data-auth-signup-panel]:not([hidden])) [data-auth-legal] { display: none; }

.mx-auth .mx-auth__field--check { margin-bottom: 16px; }
.mx-auth .mx-auth__check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.45; color: var(--auth-ink); cursor: pointer; }
.mx-auth .mx-auth__check input {
  flex: 0 0 auto; appearance: none; -webkit-appearance: none; display: grid; place-content: center; width: 20px; height: 20px; margin: 1px 0 0;
  background: var(--auth-field); border: 1px solid var(--auth-border); border-radius: 4px; cursor: pointer;
}
.mx-auth .mx-auth__check input:checked { background: var(--auth-brand); border-color: var(--auth-brand); }
.mx-auth .mx-auth__check input:checked::after { content: ""; width: 5px; height: 10px; margin-top: -2px; border: solid var(--auth-on-brand); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.mx-auth .mx-auth__check input[aria-invalid="true"] { border-color: var(--auth-error-border); }
.mx-auth .mx-auth__empty { padding: 16px; color: var(--auth-muted); border: 1px dashed var(--auth-border); border-radius: 8px; }

/* The sign-in view is one dark surface edge to edge, not a card on a light page. */
html[data-theme] .page:has(> .mx-auth) { background: #0C1118; padding: 0; }

/* Forgot password, in place of the sign-in form (A4). */
.mx-auth [data-auth-root][hidden], .mx-auth [data-auth-head][hidden], .mx-auth [data-auth-forgot-panel][hidden] { display: none; }
.mx-auth .mx-auth__forgot .mx-auth__title { margin: 0; }
.mx-auth .mx-auth__forgot .mx-auth__forgot-sub { margin: 8px 0 24px; }

@media (max-width: 480px) {
  .mx-auth { padding: 16px 16px 40px; }
  .mx-auth .mx-auth__card { padding: 24px 20px; }
  .mx-auth .mx-auth__control--send { flex-wrap: wrap; }
  .mx-auth .mx-auth__send { min-width: 0; flex: 0 0 auto; }
  .mx-auth .mx-auth__control--send .mx-auth__input { flex: 1 1 120px; }
}
@media (prefers-reduced-motion: no-preference) {
  .mx-auth .mx-auth__input, .mx-auth .mx-auth__primary, .mx-auth .mx-auth__send { transition: border-color .12s, box-shadow .12s, background-color .12s; }
}

/* Main-flows redesign A1/A2 (2026-10-31): Google first, then "or use email";
   the terms are a passive line under Create account (no checkbox, D-F1). */
.mx-auth .mx-auth__google + .mx-auth__divider { margin-top: 20px; }
.mx-auth .mx-auth__terms { margin-top: 12px; text-align: center; }
.mx-auth [data-auth-signup-code-panel][hidden] { display: none; }

/* Standalone pages in the same card (main-flows redesign A4 and F4,
   2026-11-01): /reset-password.html and /join.html load this file and use
   the sign-in card instead of their own light/blue page styles. */
html.mx-auth-html, html.mx-auth-html body { margin: 0; min-height: 100%; background: #0C1118; color-scheme: dark; }
.mx-auth.mx-auth--page { min-height: 100vh; justify-content: center; }
.mx-auth .mx-auth__brand { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; font-weight: 650; color: var(--auth-ink); }
.mx-auth .mx-auth__badge {
  display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--auth-divider); border-radius: 8px;
  background: var(--auth-field); color: var(--auth-link); font: 700 13px/1 ui-monospace, monospace;
}
.mx-auth .mx-auth__eyebrow { margin: 0 0 8px; font-size: 13px; color: var(--auth-muted); }
.mx-auth .mx-auth__who {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 12px;
  border: 1px solid var(--auth-divider); border-radius: 8px; font-size: 14px; color: var(--auth-ink);
}
.mx-auth .mx-auth__who > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mx-auth .mx-auth__who small { display: block; font-size: 13px; color: var(--auth-muted); }
.mx-auth .mx-auth__callout {
  margin: 0 0 16px; padding: 12px 14px; font-size: 14px; line-height: 1.5; color: var(--auth-ink);
  background: var(--auth-secondary); border: 1px solid var(--auth-divider); border-radius: 8px;
}
.mx-auth .mx-auth__callout:empty { display: none; }
.mx-auth .mx-auth__notice { display: block; margin-top: 8px; max-height: 140px; overflow: auto; }
.mx-auth .mx-auth__who .mx-auth__link { flex: 0 0 auto; white-space: nowrap; }
.mx-auth .mx-auth__primary + .mx-auth__hint, .mx-auth .msg + .mx-auth__hint { text-align: center; margin-top: 12px; }
.mx-auth a.mx-auth__primary, .mx-auth a.mx-auth__secondary { text-decoration: none; }
.mx-auth .mx-auth__primary[disabled] { cursor: not-allowed; color: var(--auth-muted); background: var(--auth-secondary); border-color: var(--auth-border); }
.mx-auth .msg { display: none; margin: 16px 0 0; font-size: 13.5px; line-height: 1.45; }
.mx-auth .msg.err { display: block; padding: 10px 12px; color: var(--auth-error); background: rgba(255, 138, 138, .1); border: 1px solid var(--auth-error-border); border-radius: 8px; }
.mx-auth .msg.err::before { content: "! "; font-weight: 800; }
.mx-auth .msg.ok { display: block; color: var(--auth-ok); }
.mx-auth .mx-auth__foot { margin: 20px 0 0; text-align: center; font-size: 12.5px; color: var(--auth-muted); }
.mx-auth details.mx-auth__res { margin: 0 0 16px; font-size: 13px; color: var(--auth-muted); }
.mx-auth details.mx-auth__res summary { cursor: pointer; color: var(--auth-ink); }

/* design/task-page-layout.css */
/* Task page layout (founder 2026-11-09). Loaded after every other sheet.

   The DAG canvas is the page: it opens at 100 % on the running node and gets
   all the height that is left. Above it there are at most two rows:

     1. Task header — ☰ · title · status · goal (one line) · Overview ·
        Rounds · Usage and cost · Flow/Team/Results · ⋯ · run control.
     2. Run strip (task-runtime.mjs .runtime-head) — Workers · progress ·
        elapsed · cost · DAG layers (one scrolling line) · Locate · View ·
        Pause/Stop · ⋯.

   Overview, Rounds and Usage are header entries whose content opens as a
   popover; notices about the canvas (freshness, control receipts) float on
   the canvas instead of taking rows. The "Work / Task" title row and the
   page-wide Remote Hand activity row are gone (the latter lives under the
   selected Device). The Assistant floats over the page (assistant-drag.mjs). */

/* ---- 1. Task header: one line ------------------------------------------- */
.task-page--spa .task-detail__head {
  position: relative;
  z-index: 20;
  flex-wrap: nowrap;
  min-height: 40px;
  gap: 8px;
  padding: 4px 10px;
}
.task-page--spa .task-detail__head > * { flex-shrink: 0; }
.task-page--spa .task-detail__head .task-detail__title { flex: 0 1 auto; min-width: 48px; max-width: 26%; }
/* The title shrinks inside its 26% box: an unshrinkable h2 (vlc-skin's
   `flex: none`) painted a long title over the status and the entries after it. */
.task-page--spa .task-detail__head .task-detail__title h2 {
  flex: 0 1 auto; min-width: 0;
  max-width: none; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 600;
}
.task-page--spa .task-detail__head > .task-detail__goal {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px;
  min-height: 0; margin: 0; padding: 0 0 0 10px;
  border: 0; border-left: 1px solid var(--mx-line, #30363d); border-radius: 0; background: transparent;
}
/* No "Goal" label: the one line after the status can only be the goal. */
.task-page--spa .task-detail__head > .task-detail__goal b { display: none; }
.task-page--spa .task-detail__head > .task-detail__goal span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--mx-dim, #8b949e); font-size: 12px; line-height: 1.4;
}
.task-page--spa .task-detail__head .task-detail__actions { margin-left: 0; flex-wrap: nowrap; }

/* ---- Header entries: Overview · Rounds · Usage and cost ------------------- */
.task-page--spa .task-detail__head > .task-detail__info { flex: 0 1 auto; min-width: 0; }
.task-detail__info { display: flex; align-items: center; gap: 4px; }
.task-detail__info > div { position: relative; flex: 0 1 auto; min-width: 0; margin: 0; padding: 0; border: 0; background: none; }
.task-detail__info > .task-detail__overview { max-width: 300px; }
.task-detail__info .task-overview,
.task-detail__info .task-iter,
.task-detail__info .task-iter__entry { display: block; min-width: 0; max-width: 100%; }
.task-detail__info > div:empty { display: none; }
.task-detail__info .task-overview,
.task-detail__info .task-iter { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; gap: 0; }
/* One chip look for the three entries. */
.task-detail__info .task-overview > summary,
.task-detail__info .task-iter__entry > summary,
.task-detail__info .task-detail__usage > button {
  display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; height: 26px; max-width: 100%; margin: 0;
  padding: 0 10px; border: 1px solid var(--mx-line, #30363d); border-radius: 999px;
  background: transparent; color: var(--mx-dim, #8b949e); font: 500 11.5px/1 var(--font, system-ui);
  white-space: nowrap; overflow: hidden; cursor: pointer; list-style: none; box-shadow: none;
}
.task-detail__info .task-overview > summary::-webkit-details-marker,
.task-detail__info .task-iter__entry > summary::-webkit-details-marker { display: none; }
.task-detail__info .task-overview > summary:hover,
.task-detail__info .task-iter__entry > summary:hover,
.task-detail__info .task-detail__usage > button:hover,
.task-detail__info details[open] > summary,
.task-detail__info .task-detail__usage > button[aria-expanded="true"] { border-color: var(--vl-primary, #58a6ff); color: var(--mx-ink, #e6edf3); }
.task-detail__info .task-overview > summary b { color: var(--mx-ink, #e6edf3); font-weight: 600; }
.task-detail__info .task-overview > summary .task-overview__summary-action { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.task-detail__info .task-overview > summary .task-overview__summary-action b { font-weight: 500; color: inherit; }
.task-detail__info summary .mx-tag { padding: 0 6px; font-size: 10px; line-height: 16px; }
.task-detail__info .task-detail__bill [data-bill-total] { color: var(--mx-ink, #e6edf3); }
.task-detail__bill-warn { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-left: 2px; border-radius: 50%; background: var(--vl-warning, #d29922); color: #0d1117; font: 700 10px/1 var(--font, system-ui); }
/* Their content opens as a popover over the canvas. */
.task-detail__info .task-overview[open] > :not(summary),
.task-detail__info .task-iter__entry[open] > :not(summary),
.task-detail__info .task-detail__usage > [data-bill-detail] {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  box-sizing: border-box; width: 460px; max-width: calc(100vw - 32px); max-height: min(70vh, 640px); overflow: auto;
  margin: 0; padding: 12px; border: 1px solid var(--mx-line-strong, #3d444d); border-radius: 10px;
  background: var(--mx-panel, #161b22); box-shadow: 0 16px 40px rgba(1, 4, 9, .55);
  font-size: 12px; line-height: 1.5; color: var(--mx-ink, #e6edf3);
}
/* The entries sit right of centre: the later ones open leftwards. */
.task-detail__info .task-iter__entry[open] > :not(summary),
.task-detail__info .task-detail__usage > [data-bill-detail] { left: auto; right: 0; }
.task-detail__info .task-iter__entry[open] > .task-iter__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.task-detail__info .task-iter__pop.mx-panel { display: flex; flex-direction: column; gap: 8px; width: 520px; }
.task-detail__info .task-iter__pop .task-iter__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.task-detail__info .task-detail__usage > [data-bill-detail] details.task-bill > summary { list-style: none; }

/* ---- 2. Run strip: one line — task-controls.css (".task-runtime--inline
   run strip"), so every host of the inline runtime gets it. -------------- */

/* ---- 3. The canvas takes the rest ---------------------------------------- */
.task-page--spa .task-detail__body { padding: 0; overflow: hidden; }
.task-page--spa .task-detail__runtime { position: relative; }
.task-page--spa .task-detail__dag { flex: 1 1 auto; min-height: 320px; }
/* Canvas notices float on the canvas, under the run strip. */
.task-page--spa .task-detail__notes {
  position: absolute; z-index: 7; top: 48px; left: 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  max-width: min(60%, 560px); pointer-events: none;
}
.task-page--spa .task-detail__notes > * {
  margin: 0; padding: 3px 9px; border: 1px solid var(--mx-line, #30363d); border-radius: 6px;
  background: rgba(13, 17, 23, .9); font-size: 11px; line-height: 1.45; pointer-events: auto;
}
.task-page--spa .task-detail__notes > [hidden] { display: none; }
.task-page--spa .task-detail__notes > .task-detail__dag-note { border-color: #593037; }

/* ---- Page frame: no title row -------------------------------------------- */
/* The page is exactly the viewport under the top bar: the frame's own top
   padding moves into the Task page, so nothing scrolls off the bottom. */
.page:has(.task-page--spa) { padding-top: 0; padding-bottom: 0; }
.mx-next .mx-page.task-page--spa { box-sizing: border-box; padding-top: 8px; }
.task-page--spa .task-device-bar:empty { display: none; }

/* ---- Remote Hand activity: a compact entry under the selected Device ------ */
.task-tree__device-children .task-hand-activity { margin: 4px 0 6px; padding: 0; border-radius: 8px; }
.task-tree__device-children .task-hand-activity > summary { padding: 5px 9px; font-size: 11.5px; color: var(--mx-dim, #8b949e); cursor: pointer; }
.task-tree__device-children .task-hand-activity__body { max-height: min(30vh, 260px); overflow-y: auto; font-size: 11px; }

@media (max-width: 1100px) {
  .task-page--spa .task-detail__head > .task-detail__goal { display: none; }
  .task-page--spa .task-runtime--inline .runtime-head { flex-wrap: wrap; }
}

/* Narrow windows: the Overview chip gives up its text first, so Rounds and
   Usage and cost stay whole instead of being cut ("Rou", "用量与费") at 1024 px
   (multi-OS UI check, 2026-11-14: macOS fonts are wider than Linux). */
.task-detail__info > div:not(.task-detail__overview) { flex-shrink: 0; }
@media (max-width: 1100px) {
  .task-detail__info > .task-detail__overview { max-width: 180px; }
}

/* ---- Phone width: the Task header wraps, the canvas gets the screen ------- */
/* Hicode's phone check of a production Task (2026-11-14, 390 px): the header
   stayed on one line, the facts chips painted over the view tabs and
   「文件与预览」 sat past the right edge, so the files and the preview of the
   Task could not be reached. Here the header wraps: the facts and the view
   tabs each take a full row that scrolls sideways, and the canvas below them
   is tall enough to read a file or a preview. */
@media (max-width: 560px) {
  .task-page--spa .task-detail__head { flex-wrap: wrap; row-gap: 6px; }
  .task-page--spa .task-detail__head .task-detail__title { flex: 1 1 0; max-width: none; }
  .task-page--spa .task-detail__head > .task-detail__info,
  .task-page--spa .task-detail__head > .task-detail__views {
    order: 10; flex: 1 1 100%; min-width: 0; max-width: 100%;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  }
  .task-page--spa .task-detail__head > .task-detail__views { order: 11; }
  .task-page--spa .task-detail__head > .task-detail__info:empty { display: none; }
  .task-page--spa .task-detail__views .task-canvas-switch { flex: none; }
  .task-page--spa .task-detail { overflow: visible; }
  .task-page--spa .task-detail__dag { min-height: 72vh; }
  /* The canvas stays the screen's width: its run strip, layer path and plan
     line wrap or scroll inside it instead of widening the page, which then
     shifted sideways and cut off the left edge when a file was opened. */
  .task-page--spa .task-detail,
  .task-page--spa .task-detail__dag { min-width: 0; max-width: 100%; }
  .task-page--spa .task-detail__dag .runtime-head { flex-wrap: wrap; min-width: 0; }
  .task-page--spa .task-detail__dag .runtime-viewing { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .task-page--spa .task-detail__dag .runtime-authority { flex-wrap: wrap; min-width: 0; }
  .task-page--spa .task-detail__dag .runtime-authority > * { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .task-page--spa .task-detail__dag .runtime-team { min-width: 0; max-width: 100%; flex-wrap: wrap; }
}

/* design/readable.css */
/* Readable layer (UI cleanup PR 1, 2026-10-30; proposal:
   docs/ui-audit/2026-10/UI-CLEANUP-PROPOSAL.md).

   Loaded after the layout sheets and before polish.css. It adds the type scale
   (12 px floor, 14 px body on settings-style pages), raises the dim/faint text
   colours so help text is readable (ratios in the proposal, all >= 5.2:1 on
   every surface), and provides three shared patterns the page PRs use:
   status chips, the "Advanced" disclosure and the page-level save bar.
   Visual only: no selector here hides, moves or removes a control. */

.mx-next {
  --mx-fs-caption: 12px;
  --mx-fs-label: 13px;
  --mx-fs-body: 14px;
  --mx-fs-section: 16px;
  --mx-fs-title: 22px;
  --mx-lh-caption: 18px;
  --mx-lh-body: 22px;
  --mx-space-card: 20px;
  --mx-space-gap: 16px;
  --mx-row-h: 48px;
  /* #9198a1 / #848d97 were 5.9 / 5.1:1 on surface, but at 9.5 px they read as
     disabled. One step lighter keeps the hierarchy and passes at any size. */
  --mx-dim: #b7bfc8;
  --mx-faint: #9198a1;
}

/* Help and explanation text: 12 px, dim (was 9.5 px). */
.mx-next :is(.mx-help, .mx-hint, .mx-callout p) {
  font-size: var(--mx-fs-caption);
  line-height: var(--mx-lh-caption);
  color: var(--mx-dim);
}

/* Settings-style pages read at 14 px body. */
.mx-next .mx-page { font-size: var(--mx-fs-body); line-height: var(--mx-lh-body); }
.mx-next .mx-page h1 { font-size: var(--mx-fs-title); }

/* IDs in prose were painted near the background (1.4:1). */
.mx-next .mx-page code { color: var(--mx-dim); font-size: var(--mx-fs-caption); }

/* Status chips: tinted background, leading dot, AA text (7.0 / 7.0 / 5.8 / 6.9 / 8.2:1). */
.mx-next .mx-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: var(--mx-fs-caption); line-height: 20px; font-weight: 500; white-space: nowrap;
  color: var(--mx-dim); background: var(--mx-panel-2);
}
.mx-next .mx-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mx-next .mx-status--ok { color: #56d364; background: rgba(63, 185, 80, .15); }
.mx-next .mx-status--warn { color: #e3b341; background: rgba(210, 153, 34, .16); }
.mx-next .mx-status--danger { color: #ff7b72; background: rgba(248, 81, 73, .15); }
.mx-next .mx-status--info { color: #79c0ff; background: rgba(88, 166, 255, .15); }

/* "Advanced" disclosure: closed by default, says what is inside. */
.mx-next details.mx-advanced { border-top: 1px dashed var(--mx-line-strong); margin-top: 16px; padding-top: 12px; }
.mx-next details.mx-advanced > summary {
  cursor: pointer; list-style: none;
  color: var(--mx-dim); font-size: var(--mx-fs-label); font-weight: 600;
}
.mx-next details.mx-advanced > summary::-webkit-details-marker { display: none; }
.mx-next details.mx-advanced > summary::before { content: "▸ "; }
.mx-next details.mx-advanced[open] > summary::before { content: "▾ "; }
.mx-next details.mx-advanced > summary .mx-advanced__what { font-weight: 400; color: var(--mx-faint); }
.mx-next details.mx-advanced > .mx-advanced__body { margin-top: 12px; display: grid; gap: 12px; }

/* Page-level save bar: the page's only primary button, shown when dirty. */
.mx-next .mx-savebar {
  position: sticky; bottom: 0; z-index: 5; margin-top: 16px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--mx-line-strong); border-radius: var(--mx-radius);
  background: rgba(22, 27, 34, .97); box-shadow: 0 -8px 24px -16px rgba(0, 0, 0, .7);
}
.mx-next .mx-savebar[hidden] { display: none !important; }
.mx-next .mx-savebar__text { flex: 1; color: var(--mx-ink); font-size: var(--mx-fs-body); }
.mx-next .mx-savebar__text::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--mx-warn); margin-right: 8px;
}
.mx-next .mx-savebar__status { color: var(--mx-dim); font-size: var(--mx-fs-caption); }

/* An offline Device keeps a readable name: its status chip already says
   "offline", so the row is dimmed by colour (5.9:1), not by opacity (2.3:1). */
.mx-next .set-device--offline > .set-row:first-child { color: var(--mx-faint); }
.mx-next .set-device--offline > .set-row:first-child .set-row__title { opacity: 1; color: var(--mx-dim); }

/* MoneyAmount (main-flows redesign F0, PRD §12.3.1): one dollar figure, and a
   source tag beside any Credits-sourced amount. Tags: gift 9.6:1, test 7.6:1. */
.mx-next .mx-money { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.mx-next .mx-money > b { font-weight: 600; font-variant-numeric: tabular-nums; }
.mx-next .mx-money--pending > b { font-weight: 500; color: var(--mx-dim); }
.mx-next .mx-src {
  display: inline-block; padding: 0 6px; border-radius: 4px;
  font-size: var(--mx-fs-caption); line-height: var(--mx-lh-caption); font-weight: 500;
}
.mx-next .mx-src--gift { color: #f2c65a; background: rgba(242, 198, 90, .14); }
.mx-next .mx-src--test { color: #79c0ff; background: rgba(88, 166, 255, .15); }
.mx-next .mx-src--credits { color: #f2c65a; background: rgba(242, 198, 90, .14); }

/* PickerChip: a default choice shown as its value in words; opens the existing selector. */
.mx-next .mx-pick {
  display: inline-flex; align-items: center; gap: 6px; max-width: 230px; height: 30px; padding: 0 10px;
  border: 1px solid rgba(240, 246, 252, .2); border-radius: 999px; background: transparent; color: inherit;
  font: inherit; font-size: var(--mx-fs-label); white-space: nowrap; cursor: pointer;
}
.mx-next .mx-pick__k { color: var(--mx-dim); }
.mx-next .mx-pick__v { overflow: hidden; text-overflow: ellipsis; }
.mx-next .mx-pick::after { content: "▾"; color: var(--mx-dim); font-size: var(--mx-fs-caption); }
.mx-next .mx-pick:focus-visible { outline: 2px solid #1f6feb; outline-offset: 2px; }
.mx-next .mx-pick[disabled] { cursor: default; }
.mx-next .mx-pick[disabled]::after { content: none; }

/* VerdictChip: how the input will be handled, with one switch (7.4:1; was about 1.5:1). */
.mx-next .mx-verdict {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: var(--mx-fs-label); color: #b4bdff; background: rgba(125, 141, 255, .12); border: 1px solid rgba(125, 141, 255, .45);
}
.mx-next .mx-verdict--danger { color: #ff7b72; background: rgba(248, 81, 73, .12); border-color: rgba(248, 81, 73, .45); }
.mx-next .mx-verdict__switch {
  padding: 0; border: 0; background: none; color: #e6edf3; font: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}

/* Chinese has no letter case. An uppercase label on a Chinese page only turns
   the product words inside it into HAND / BRAIN / WORKSPACE / HAND KEY, which
   the rest of the page writes as Hand / Brain / Workspace (multi-OS UI check,
   2026-11-14). One rule for every uppercase label instead of one per sheet. */
:lang(zh) * { text-transform: none !important; }

/* design/polish.css */
/* Visual polish pass, 2026-10 (baseline: docs/ui-audit/2026-10, PR #440).

   Loaded after every other product stylesheet, so a fix here wins without
   touching the layout files the UX threads are changing. Values only come
   from the shared design system (vl-design.css): one primary colour, one
   button shape, a visible keyboard focus on every control. Visual only: no
   selector here hides, moves or adds a control. */

/* 1. Keyboard focus on every control, not only buttons and links. */
.mx-next :is(input, select, textarea, summary, [role="tab"], [role="menuitem"]):focus-visible,
.mx-modal :is(button, a, input, select, textarea, summary):focus-visible,
#agent-chat-mount :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--vl-focus, #58a6ff);
  outline-offset: 2px;
}

/* 2. One primary colour. "Send and start" and the decision confirm were the
   only green fills in the product (audit 01 §13); they are the main action of
   their area, so they take the shared primary. */
#agent-chat-mount.mx-task-draft-open .send-btn[data-draft-send="true"],
.task-ai-echo__btn--primary {
  background: var(--vl-primary, #1f6feb);
  border-color: var(--vl-primary, #1f6feb);
  color: var(--vl-on-primary, #fff);
}
#agent-chat-mount.mx-task-draft-open .send-btn[data-draft-send="true"]:hover:not(:disabled),
.task-ai-echo__btn--primary:hover:not(:disabled) {
  background: var(--vl-primary-hover, #1a62d6);
  border-color: var(--vl-primary-hover, #1a62d6);
}

/* 3. Dialogs. components.css paints every `button[type=submit]` in a modal as a
   secondary button at a higher specificity than `.mx-btn--primary`, so the
   main action of every dialog ("Create Task Line", "Use this folder", ...)
   looked like Cancel (audit 01 §14-15). The submit keeps primary unless it is
   explicitly ghost or danger; modal buttons use the product button radius. */
html[data-theme] .mx-modal .mx-modal__foot button.mx-btn--primary[type="submit"],
.mx-modal .mx-modal__foot button.mx-btn--primary[type="submit"] {
  background: var(--vl-primary, #1f6feb) !important;
  border-color: var(--vl-primary, #1f6feb) !important;
  color: var(--vl-on-primary, #fff) !important;
}
html[data-theme] .mx-modal .mx-modal__foot button.mx-btn--primary[type="submit"]:hover:not(:disabled),
.mx-modal .mx-modal__foot button.mx-btn--primary[type="submit"]:hover:not(:disabled) {
  background: var(--vl-primary-hover, #1a62d6) !important;
  border-color: var(--vl-primary-hover, #1a62d6) !important;
}
html[data-theme] .mx-modal .mx-modal__foot button:disabled,
.mx-modal .mx-modal__foot button:disabled { opacity: .45; cursor: not-allowed; }
html[data-theme] .mx-modal .mx-btn,
html[data-theme] .mx-modal button[type="submit"],
html[data-theme] .mx-modal button[data-overlay-close]:not(.mx-close),
.mx-modal .mx-btn,
.mx-modal button[type="submit"],
.mx-modal button[data-overlay-close]:not(.mx-close) {
  min-height: var(--vl-control-md, 34px);
  border-radius: var(--vl-radius-md, 6px);
}

/* 4. "Remove this Workspace" rendered as unstyled 15px body text that read as a
   heading (audit 01 §13): the legacy light theme's element rule outranked its
   class. It is a low-emphasis destructive action: tertiary, danger on hover. */
html[data-theme] .mx-next .task-tree__remove-workspace {
  display: inline-flex;
  width: auto;
  min-height: var(--vl-control-sm, 28px);
  margin: 4px 0 0 4px;
  padding: 0 var(--vl-space-2, 8px);
  border: 1px solid transparent;
  border-radius: var(--vl-radius-md, 6px);
  background: transparent;
  color: var(--vl-text-faint, #848d97);
  font: var(--vl-weight-medium, 500) var(--vl-text-xs, 11px) / var(--vl-leading-xs, 16px) var(--vl-font-sans);
}
html[data-theme] .mx-next .task-tree__remove-workspace:hover {
  border-color: color-mix(in srgb, var(--vl-danger, #f85149) 45%, transparent);
  color: var(--vl-danger, #f85149);
}

/* 5. Icons: the notification bell is an SVG from the same stroke set as the
   rest of the chrome instead of a colour emoji. */
.mx-icon-btn svg { width: 15px; height: 15px; display: block; }

/* Problem record 1.3.172 #4: a denied Add Task / Remove Workspace entry stays legible and
   says why (#9198a1 on the #161b22 panel is >= 4.5:1; guarded by task-entry-permissions.test). */
html[data-theme] .mx-next .task-tree__remove-workspace.is-denied,
html[data-theme] .mx-next .task-tree__addline.is-denied { color: #9198a1; cursor: not-allowed; opacity: 1; }
html[data-theme] .mx-next .task-tree__remove-workspace.is-denied:hover { color: #9198a1; border-color: transparent; }
