/* Quick Design - site stylesheet.
   Ported from the approved sample page (code/sample/index.html): its colours, the Inter font, the header with the
   logo and tabs, cards, buttons, tables, pills and spacing. Added: dark mode (spec section 5), the sign-in page, the
   footer, forms and the Users card; build phase 2: the Drawing Styles tab; build phase 4: its random practice examples.
   Every colour is a variable on :root. The dark values apply when the computer asks for dark (unless the person chose
   light with the theme button), or when the person chose dark. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --blue: #1E5AA8;
  --blue-dk: #163F78;
  --blue-bg: #F0F5FC;
  --blue-soft: #E3ECF8;
  --blue-line: #8FB0D9;
  --ink: #1B2430;
  --muted: #5A6675;
  --line: #DDE3EA;
  --line2: #E6EBF0;
  --ground: #F4F6F9;
  --card: #FFFFFF;
  --tab-ink: #3A4654;
  --control: #FFFFFF;
  --control-line: #C9D2DC;
  --pri: #1E5AA8;
  --pri-hover: #163F78;
  --pri-ink: #FFFFFF;
  --ok-bg: #E8F4EE;
  --ok-ink: #145A37;
  --ok-dot: #1F7A4D;
  --ok-line: #A9D5BD;
  --chk-bg: #FDF1DE;
  --chk-ink: #7A4A00;
  --chk-dot: #B26A00;
  --bad-bg: #FBE9E7;
  --bad-ink: #8C1D16;
  --bad-dot: #B3261E;
  --bad-line: #EDB5AF;
  --danger: #B3261E;
  --danger-hover: #8C1D16;
  --code-bg: #F4F6F9;
  --shadow: 0 12px 32px rgba(27, 36, 48, .18);
  --backdrop: rgba(27, 36, 48, .45);
  --logo-bg: transparent;
  --logo-pad: 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --blue: #6EA8F0;
    --blue-dk: #9CC4F6;
    --blue-bg: #13223A;
    --blue-soft: #1B3254;
    --blue-line: #3D6FAE;
    --ink: #E4E9EF;
    --muted: #9AA6B4;
    --line: #2B3440;
    --line2: #242C37;
    --ground: #0F1419;
    --card: #171D24;
    --tab-ink: #C2CBD6;
    --control: #1D252E;
    --control-line: #3A4553;
    --pri: #2F6FC0;
    --pri-hover: #255EA8;
    --pri-ink: #FFFFFF;
    --ok-bg: #11301F;
    --ok-ink: #8BD6AA;
    --ok-dot: #3FB27A;
    --ok-line: #24583B;
    --chk-bg: #33260C;
    --chk-ink: #F0C677;
    --chk-dot: #E0A23A;
    --bad-bg: #36151A;
    --bad-ink: #F3A39B;
    --bad-dot: #E5534B;
    --bad-line: #6B2A26;
    --danger: #C0352D;
    --danger-hover: #A82B24;
    --code-bg: #0F1419;
    --shadow: 0 12px 32px rgba(0, 0, 0, .55);
    --backdrop: rgba(0, 0, 0, .6);
    --logo-bg: #FFFFFF;
    --logo-pad: 3px 6px;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: #6EA8F0;
  --blue-dk: #9CC4F6;
  --blue-bg: #13223A;
  --blue-soft: #1B3254;
  --blue-line: #3D6FAE;
  --ink: #E4E9EF;
  --muted: #9AA6B4;
  --line: #2B3440;
  --line2: #242C37;
  --ground: #0F1419;
  --card: #171D24;
  --tab-ink: #C2CBD6;
  --control: #1D252E;
  --control-line: #3A4553;
  --pri: #2F6FC0;
  --pri-hover: #255EA8;
  --pri-ink: #FFFFFF;
  --ok-bg: #11301F;
  --ok-ink: #8BD6AA;
  --ok-dot: #3FB27A;
  --ok-line: #24583B;
  --chk-bg: #33260C;
  --chk-ink: #F0C677;
  --chk-dot: #E0A23A;
  --bad-bg: #36151A;
  --bad-ink: #F3A39B;
  --bad-dot: #E5534B;
  --bad-line: #6B2A26;
  --danger: #C0352D;
  --danger-hover: #A82B24;
  --code-bg: #0F1419;
  --shadow: 0 12px 32px rgba(0, 0, 0, .55);
  --backdrop: rgba(0, 0, 0, .6);
  --logo-bg: #FFFFFF;
  --logo-pad: 3px 6px;
}

/* ---- base (sample) ---- */
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45 }
a { color: var(--blue) }
a:hover { color: var(--blue-dk) }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px }
h1 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.2 }
h1:focus { outline: none }
p { margin: 0 }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 15px }
.note { font-size: 13px; color: var(--muted) }
.hint { font-weight: 400; color: var(--muted) }
.vh { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden }
.hide { display: none !important }

/* ---- page frame ---- */
.page { min-height: 100vh; display: flex; flex-direction: column }
.site-head { background: var(--card); border-bottom: 1px solid var(--line) }
.wrap { max-width: 1200px; margin: 0 auto; padding: 12px 24px }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none }
.brand:hover { color: var(--ink) }
.brand img { display: block; height: 40px; width: auto; background: var(--logo-bg); padding: var(--logo-pad); border-radius: 6px }
.brand b { display: block; font-size: 17px }
.brand small { display: block; font-size: 12px; color: var(--muted) }
.brand-name { display: flex; align-items: center; gap: 8px }
/* Change 25: the version badge beside the program's name. */
.brand-version {
  display: inline-block; padding: 1px 8px; border: 1px solid var(--blue-line); border-radius: 999px;
  background: var(--blue-soft); color: var(--blue-dk); font-size: 11px; font-weight: 600; line-height: 1.5;
  letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap
}
nav.tabs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto }
.tab { font: inherit; font-size: 15px; font-weight: 600; padding: 12px 18px; border: 0; border-radius: 10px; cursor: pointer; background: transparent; color: var(--tab-ink); text-decoration: none; display: inline-block; line-height: 1.2 }
.tab:hover { background: var(--blue-bg); color: var(--blue) }
.tab.on { background: var(--blue-soft); color: var(--blue) }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: var(--muted) }
.who b { color: var(--ink); font-weight: 600 }
.who form { margin: 0 }
.site-main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 24px; flex: 1 0 auto }
.site-foot { background: var(--card); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px }
.site-foot .wrap { padding-top: 14px; padding-bottom: 14px }

/* ---- buttons (sample) ---- */
.btn { font: inherit; font-size: 15px; line-height: 1.2; padding: 12px 16px; border: 1px solid var(--control-line); background: var(--control); border-radius: 10px; cursor: pointer; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px }
.btn:hover { border-color: var(--blue-line); color: var(--ink) }
.btn.sm { font-size: 14px; padding: 8px 14px; border-radius: 8px }
.btn.pri { border: 1px solid transparent; background: var(--pri); color: var(--pri-ink); font-weight: 600 }
.btn.pri:hover { background: var(--pri-hover); color: var(--pri-ink) }
.btn.link { border: 0; background: none; color: var(--blue); padding: 0; font-size: 14px }
.btn.danger { border: 1px solid transparent; background: var(--danger); color: #FFFFFF; font-weight: 600 }
.btn.danger:hover { background: var(--danger-hover); color: #FFFFFF }
.btn.danger-line { color: var(--bad-ink) }
.btn.danger-line:hover { border-color: var(--bad-line); color: var(--bad-ink) }
.btn:disabled { opacity: .55; cursor: default }
.start { align-self: flex-start }

.theme-btn svg { flex: 0 0 auto }
.theme-btn .to-dark, .theme-btn .to-light { display: inline-flex; align-items: center; gap: 6px }
.theme-btn .to-light { display: none }
:root[data-theme="dark"] .theme-btn .to-dark { display: none }
:root[data-theme="dark"] .theme-btn .to-light { display: inline-flex }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .to-dark { display: none }
  :root:not([data-theme="light"]) .theme-btn .to-light { display: inline-flex }
}

/* ---- cards, layout helpers (sample) ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px }
.pad { padding: 20px 24px }
.stack { display: flex; flex-direction: column; gap: 14px }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px }
/* Wave 6 review G7 (and its repair): the Training tab's bars and table by look share a row only when each card is at least
   440 px wide, so the table fits with its looks' tags and notes and figures such as "5 of 6 (83 %)"; narrower (a window under
   about 944 px, as a tablet held upright) they stack. A look's tag never wraps, and from 1024 px a figure stays on one line. */
.grid.score-parts { grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)) }
.style-scores .tag { white-space: nowrap }
@media (min-width: 1024px) { .style-scores td.num { white-space: nowrap } }
.card-title { margin: 0; font-size: 17px; font-weight: 600 }
.card-sub { margin: 0; font-size: 15px; font-weight: 600 }
.card-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px }
.steps b { font-weight: 600 }
.lights { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px }

/* ---- messages (sample) ---- */
.msg { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-ink); border-radius: 10px; padding: 12px 16px; font-size: 14px }
.msg.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink) }
.msg.warn { background: var(--chk-bg); border-color: var(--chk-ink); color: var(--chk-ink) }
.info { background: var(--blue-bg); border: 1px solid var(--blue-line); border-radius: 10px; padding: 14px 16px; font-size: 14px; display: flex; flex-direction: column; gap: 8px }
.confirm { background: var(--bad-bg); border: 1px solid var(--bad-line); border-radius: 10px; padding: 14px 16px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; color: var(--ink) }
.confirm b { color: var(--bad-ink) }
.buttons { display: flex; flex-wrap: wrap; gap: 8px }

/* ---- pills (sample) ---- */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap }
.pill i { width: 9px; height: 9px; border-radius: 5px; display: inline-block }
.ok { background: var(--ok-bg); color: var(--ok-ink) }
.ok i { background: var(--ok-dot) }
.chk { background: var(--chk-bg); color: var(--chk-ink) }
.chk i { background: var(--chk-dot) }
.bad { background: var(--bad-bg); color: var(--bad-ink) }
.bad i { background: var(--bad-dot) }
.tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--blue-soft); color: var(--blue); vertical-align: 1px }
.tag.warn { background: var(--chk-bg); color: var(--chk-ink) }

/* ---- tables (sample) ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 10px 12px }
td { padding: 12px; border-top: 1px solid var(--line2); vertical-align: middle }
th:first-child, td:first-child { padding-left: 0 }
th:last-child, td:last-child { padding-right: 0 }

/* ---- forms (sample) ---- */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500 }
label.c { display: flex; align-items: center; gap: 10px; font-size: 14px }
label.c input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue) }
input[type=text], input[type=password], input:not([type]), select { font: inherit; font-size: 16px; padding: 10px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--control); color: var(--ink); min-width: 0; width: 100% }
input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue) }

/* ---- Settings ---- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start }
.later-cards { gap: 16px }
.users-card { padding: 20px 24px }
.users .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px }
.users td, .who-name { overflow-wrap: anywhere }
.new-password .pw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px }
.new-password .pw { font-size: 18px; letter-spacing: .06em; padding: 8px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--ink); word-break: break-all }
.add-user { border-top: 1px solid var(--line2); padding-top: 16px; gap: 10px }
/* Forms in two even columns (one on a phone): the labels and boxes of each row line up, help text sits under its box,
   and boxes are as tall as the buttons. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start }
.users-card input, .users-card select { height: 44px }
.users .acts .self-note { align-self: center; max-width: 24em }
/* A long user name (an email address has nowhere to break) wraps instead of spilling out on a phone. */
.users-card .msg, .users-card .info, .users-card .confirm, #your-account .note { overflow-wrap: anywhere }
@media (min-width: 900px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) }
  .settings-grid .wide { grid-column: 1 / -1 }
}

/* ---- sign-in and "no access" pages ---- */
.account-main { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 16px }
.account-card { width: 100%; max-width: 420px; padding: 28px; display: flex; flex-direction: column; gap: 16px }
.account-card h1 { font-size: 24px }
.account-card .brand { margin-bottom: 4px }
.account-card .btn.pri[type=submit] { width: 100% }
.account-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 13px }

/* ---- phones ---- */
@media (max-width: 640px) {
  .wrap { padding: 10px 16px }
  .site-main { padding: 20px 16px 48px; gap: 20px }
  .top { gap: 10px 16px }
  .tab { padding: 10px 12px; font-size: 14px }
  h1 { font-size: 24px }
  .pad, .users-card { padding: 16px }
  .account-card { padding: 20px }
  /* The users table becomes one block per user, so nothing scrolls sideways. */
  .users thead { display: none }
  .users tr { display: block; border-top: 1px solid var(--line2); padding: 10px 0 }
  .users td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right }
  /* The label keeps its width and stays on one line (the cell's "break anywhere" must not break it letter by letter). */
  .users td::before { content: attr(data-label); flex: 0 0 auto; white-space: nowrap; overflow-wrap: normal; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; text-align: left }
  .users td.acts { justify-content: flex-start; padding-top: 8px }
  .users td.acts::before { content: none }
  .form-grid { grid-template-columns: minmax(0, 1fr) }
  /* The Drawing Styles rules for phones are after the Drawing Styles block below, so that they win over it. */
}

/* ---- Drawing Styles (build phase 2) ----
   Only the colour variables above are used, so dark mode works by itself. The drawings themselves are black on white,
   so their boxes stay white in dark mode too. */
input[type=number] { font: inherit; font-size: 16px; padding: 10px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--control); color: var(--ink); min-width: 0; width: 100% }
input[type=range] { width: 100%; accent-color: var(--blue) }
input:disabled, select:disabled { opacity: .7; cursor: default }
.crumb { margin: 0 0 4px; font-size: 13px }
.crumb a { text-decoration: none }
.style-head { align-items: flex-end }
.styles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px }
.style-card { display: flex; flex-direction: column; gap: 10px; padding: 16px }
.style-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px }
.style-facts .tag { margin-left: 0 }
.thumb, .preview-box { background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 120px }
.thumb { aspect-ratio: 420 / 297; text-decoration: none }
.thumb img, .preview-box img { display: block; width: 100%; height: auto }
.thumb .wait, .preview-box .wait { color: #5A6675; font-size: 13px; padding: 16px; text-align: center }
.preview-box.full { display: block; overflow: auto; max-height: 75vh }
.preview-box.full img { width: auto; max-width: none }
img.dim { opacity: .55; transition: opacity .2s }
.view-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 8px }
.banner { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start }
.editor-form, .variety, .style-form { display: flex; flex-direction: column; gap: 12px; min-width: 0 }
.editor-preview { order: -1; min-width: 0 }
/* One column (phones, tablets upright): the preview stays at the top of the screen, picture first and kept small, while
   the settings scroll under it. */
@media (max-width: 899.98px) {
  .editor-preview { position: sticky; top: 0; z-index: 5; max-height: 42vh; overflow: auto; border-radius: 14px; box-shadow: var(--shadow) }
  .editor-preview .preview-panel { gap: 8px }
  .editor-preview .preview-panel > .preview-box { order: -1; min-height: 0 }
  .editor-preview .preview-box:not(.full) img { width: auto; max-width: 100%; max-height: 30vh }
}
/* Two columns from 900 px (a tablet on its side, a narrow laptop window): settings on the left, the preview on the right,
   kept in view while the settings scroll. */
@media (min-width: 900px) {
  .editor { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) }
  .editor-preview { order: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto }
}
@media (min-width: 1100px) {
  .editor { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr) }
}
details.group { background: var(--card); border: 1px solid var(--line); border-radius: 14px }
details > summary { list-style: none; cursor: pointer }
details > summary::-webkit-details-marker { display: none }
details.group > summary { padding: 14px 18px; font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px }
details.group > summary::before, details.sub > summary::before, details.more > summary::before, details.find > summary::before, details.engine-notes > summary::before {
  content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px }
details[open] > summary::before { transform: rotate(45deg) }
details > summary .tag { margin-left: auto }
.group-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 12px }
details.sub, details.more { border-top: 1px solid var(--line2) }
details.sub > summary, details.more > summary, details.find > summary, details.engine-notes > summary { padding: 10px 0; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px }
details.more > summary { color: var(--blue) }
.sub-body, .more-body { display: flex; flex-direction: column; gap: 12px; padding: 0 0 12px 14px; border-left: 2px solid var(--line2) }
.field { display: flex; flex-direction: column; gap: 6px }
.field .unit { font-weight: 400; color: var(--muted); font-size: 12px }
.f-label { font-size: 14px; font-weight: 500 }
.field-problem { background: var(--chk-bg); color: var(--chk-ink); border-left: 3px solid var(--chk-dot); border-radius: 6px; padding: 6px 10px; font-size: 13px }
.field.has-problem > input, .field.has-problem > select, .field.has-problem .pair-inputs input { border-color: var(--chk-dot) }
.problems { background: var(--chk-bg); border: 1px solid var(--chk-dot); color: var(--chk-ink); border-radius: 10px; padding: 12px 16px; font-size: 14px; display: flex; flex-direction: column; gap: 6px }
.problems ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px }
.pair-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px }
.choice-list { display: flex; flex-wrap: wrap; gap: 8px 18px }
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 14px }
.list-item { border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px }
.list-item-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 14px }
.preview-panel, .compare { gap: 12px }
.preview-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px }
.find-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px }
.found { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow: auto; padding: 2px }
.engine-notes ul { margin: 0; padding-left: 20px; font-size: 13px; color: var(--muted) }
.status { font-size: 13px; color: var(--muted) }
.bad-text { color: var(--bad-ink) }
.compare-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px }
.compare-controls label.f { flex: 1 1 260px }
.compare-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px }
@media (min-width: 900px) { .compare-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) } }
.compare-side figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0 }
figcaption { font-size: 13px; color: var(--muted) }
.overlay { position: relative; background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.overlay img { display: block; width: 100%; height: auto }
.overlay img.top { position: absolute; left: 0; top: 0 }
.overlay-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px }
.overlay-controls label.f { flex: 1 1 260px }
.copy-row { display: flex; flex-wrap: wrap; gap: 12px }
.copy-row label.f { flex: 1 1 240px }
.folder-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px }
.folder-row label.f { flex: 1 1 320px }
.style-folder { display: flex; flex-direction: column; gap: 4px }
.versions td.acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px }
.versions .note-cell { overflow-wrap: anywhere }
.versions .name-cell .tag { margin-left: 6px }
.ask-row td { border-top: 0; padding-top: 0 }
.save-bar { position: sticky; bottom: 12px; z-index: 10; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 18px; box-shadow: var(--shadow); border-color: var(--blue-line) }
.save-bar .save-what { display: flex; flex-direction: column; gap: 2px; flex: 0 1 220px }
.save-bar label.f { flex: 1 1 260px }
.old-picture { margin: 0 }

/* ---- Drawing Styles: the Variety view's random practice examples (build phase 4, builder F3) ----
   One column on a phone or an upright tablet, the examples first; from 1100 px the settings on the left and the examples
   on the right, kept in view while the settings scroll (as the preview of the Settings view). The pictures stay black on
   white in dark mode, as every drawing does. */
.variety-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start }
.variety-examples { order: -1; min-width: 0 }
@media (min-width: 1100px) {
  .variety-layout { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr) }
  .variety-examples { order: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; border-radius: 14px }
}
.examples-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px }
.examples-seed { font-size: 14px; font-weight: 600; color: var(--muted) }
.examples-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px }
.example-card { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 1px solid var(--line2); border-radius: 12px; padding: 10px; background: var(--card) }
.example-card .thumb { min-height: 0 }
.example-card .thumb img { width: 100%; height: 100%; object-fit: contain }
.example-card figcaption { display: flex; flex-direction: column; gap: 4px; color: var(--ink); font-size: 14px }
.example-card figcaption ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere }
.example-card.waiting .thumb { border-style: dashed }

/* Drawing Styles on phones: one column, a short save bar the width of the screen, the versions table as one block per
   version. Quick Design change (phase 2 fix): these rules come after the Drawing Styles rules above so that they win
   (before them they were ignored, and the save bar took two thirds of a phone's screen). */
@media (max-width: 640px) {
  .group-body { padding: 0 14px 14px }
  .save-bar { flex-direction: column; align-items: stretch; gap: 8px; bottom: 0; padding: 12px 14px }
  .save-bar .save-what, .save-bar label.f { flex: 0 0 auto }
  .versions thead { display: none }
  .versions tr { display: block; border-top: 1px solid var(--line2); padding: 10px 0 }
  .versions td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right }
  .versions td::before { content: attr(data-label); flex: 0 0 auto; white-space: nowrap; overflow-wrap: normal; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; text-align: left }
  .versions td.acts { justify-content: flex-start; padding-top: 8px }
  .versions td.acts::before, .ask-row td::before { content: none }
  .ask-row td { display: block; text-align: left }
}

/* ---- Blazor: error bar and "connection lost" box ---- */
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; padding: 12px 48px 12px 20px; background: var(--chk-bg); color: var(--chk-ink); border-top: 1px solid var(--chk-dot); font-size: 14px }
#blazor-error-ui .reload { margin-left: 8px; color: inherit; font-weight: 600 }
#blazor-error-ui .dismiss { position: absolute; right: 12px; top: 8px; border: 0; background: none; color: inherit; font: inherit; font-size: 20px; cursor: pointer; line-height: 1 }

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation { display: none }
#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible { display: block }
#components-reconnect-modal { background: var(--card); color: var(--ink); width: min(22rem, calc(100vw - 32px)); margin: 20vh auto; padding: 28px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow) }
#components-reconnect-modal::backdrop { background: var(--backdrop) }
#components-reconnect-modal p { margin: 0; text-align: center; font-size: 15px }
#components-reconnect-modal .btn { display: none; margin: 0 auto }
#components-reconnect-modal.components-reconnect-failed #components-reconnect-button,
#components-reconnect-modal.components-reconnect-paused #components-resume-button,
#components-reconnect-modal.components-reconnect-resume-failed #components-resume-button { display: inline-flex }
.components-reconnect-container { display: flex; flex-direction: column; align-items: center; gap: 16px }
.components-rejoining-animation { position: relative; width: 80px; height: 80px }
.components-rejoining-animation div { position: absolute; border: 3px solid var(--blue); opacity: 1; border-radius: 50%; animation: components-rejoining-animation 1.5s cubic-bezier(0, .2, .8, 1) infinite }
.components-rejoining-animation div:nth-child(2) { animation-delay: -.5s }
@keyframes components-rejoining-animation {
  0%, 4.9% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0 }
  5% { top: 40px; left: 40px; width: 0; height: 0; opacity: 1 }
  100% { top: 0; left: 0; width: 80px; height: 80px; opacity: 0 }
}
@media (prefers-reduced-motion: reduce) {
  .components-rejoining-animation div { animation: none }
}

/* ---- Training tab, exam answers and round reports (build phase 5, builder N2) ----
   Only the colour variables above are used, so dark mode works by itself; the chart is SVG coloured by these classes.
   The client's drawing on the answer page stays black on white in dark mode, as every drawing does. On a phone the
   wide tables become one block per row and the answer page puts the drawing above the answer. */
.training-head { align-items: flex-end }
.training-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: stretch }
@media (min-width: 900px) { .training-top { grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr) } }
.big-card { gap: 6px }
.big-label { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted) }
.big { font-size: 64px; font-weight: 700; line-height: 1; color: var(--blue); white-space: nowrap }
.big-none { font-size: 18px; font-weight: 600; line-height: 1.35 }
.change { font-size: 14px; font-weight: 600; color: var(--muted) }
.change.up { color: var(--ok-dot) }
.change.down { color: var(--chk-ink) }
.provisional { margin-top: 8px; background: var(--chk-bg); color: var(--chk-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px }
.provisional .btn { color: var(--ink) }
.round-line, .sitting-line { gap: 8px }
.round-line .bar, .sitting-line .bar { height: 8px }
.round-line .note, .sitting-line .note { color: var(--ink) }
.seg { display: inline-flex; border: 1px solid var(--control-line); border-radius: 10px; overflow: hidden }
.seg-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border: 0; background: var(--control); color: var(--tab-ink); cursor: pointer }
.seg-btn + .seg-btn { border-left: 1px solid var(--control-line) }
.seg-btn.on { background: var(--blue-soft); color: var(--blue) }
.chart-card { gap: 10px }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px }
.leg-real::before, .leg-practice::before { content: ""; display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--blue); vertical-align: middle; margin-right: 6px }
.leg-practice::before { height: 2px; background: var(--muted) }
svg.score-chart { display: block; width: 100%; height: auto; overflow: hidden }
.score-chart text { font-family: inherit; font-size: 11px; fill: var(--muted) }
.chart-grid line { stroke: var(--line); stroke-width: 1 }
.chart-real { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round }
.chart-practice { fill: none; stroke: var(--muted); stroke-width: 2; opacity: .75 }
.dot.filled { fill: var(--blue); stroke: var(--card); stroke-width: 1.5 }
.dot.hollow { fill: var(--card); stroke: var(--blue); stroke-width: 2 }
.dot.grey { fill: var(--card); stroke: var(--muted); stroke-width: 2; stroke-dasharray: 2 2 }
.dot.practice { fill: var(--muted) }
.dot.ring { fill: none; stroke: var(--blue); stroke-width: 2; opacity: .5 }
.score-chart .chart-label { font-size: 13px; font-weight: 700; fill: var(--blue) }
.chart-mark line { stroke: var(--chk-dot); stroke-width: 1.5; stroke-dasharray: 5 4 }
.score-chart .chart-mark text { fill: var(--chk-ink); font-size: 10px; font-weight: 600 }
.chart-flag line { stroke: var(--ink); stroke-width: 1.5 }
.chart-flag path { fill: var(--chk-dot) }
.chart-table > summary, .list-box > summary, details.changes > summary, .doubts-more > summary { cursor: pointer; font-weight: 600 }
.chart-table > summary { color: var(--blue); font-size: 14px }
.chart-table[open] > summary { margin-bottom: 8px }
.bars { display: flex; flex-direction: column; gap: 12px }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px }
.bar { height: 10px; background: var(--line2); border-radius: 5px; overflow: hidden }
.bar > div { height: 100%; background: var(--blue); border-radius: 5px }
th.num, td.num { text-align: right }
.good-text { color: var(--ok-ink); font-weight: 600 }
.warn-text { color: var(--chk-ink); font-weight: 600 }
.result-cell .reason { display: block; margin-top: 2px }
.scroll-x { overflow-x: auto }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px }
fieldset.choice-set { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px }
fieldset.choice-set legend { font-size: 14px; font-weight: 500; padding: 0; margin-bottom: 6px }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px }
.choice { font: inherit; text-align: left; border: 1px solid var(--control-line); background: var(--control); border-radius: 12px; padding: 16px; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; gap: 6px }
.choice:hover { border-color: var(--blue-line) }
.choice em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em }
.choice.main em { color: var(--blue) }
.choice b { font-size: 16px }
.choice span { font-size: 14px; color: var(--muted) }
.choice.on { border: 2px solid var(--blue); background: var(--blue-bg); padding: 15px }
.drop { position: relative; border: 2px dashed var(--blue-line); background: var(--blue-bg); border-radius: 16px; padding: 32px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px }
.drop b { font-size: 18px }
.drop span { font-size: 14px; color: var(--muted) }
.drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer }
.drop:focus-within { outline: 2px solid var(--blue); outline-offset: 2px }
.drop.busy { opacity: .7 }
.outcome-lines { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere }
.list-box { border-top: 1px solid var(--line2); padding-top: 10px }
.list-box > summary { padding: 4px 0; font-size: 15px }
.list-box[open] > summary { margin-bottom: 6px }
.pair { border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; margin-top: 10px }
.pair-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; overflow-wrap: anywhere }
.pair-head .tag { margin-left: 0 }
.pair-arrow { color: var(--muted) }
.pair-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px }
.pair-row label.f { flex: 1 1 200px }
.pair-row .page-box { flex: 0 0 110px }
.reasons { margin: 0; padding-left: 20px; font-size: 13px; color: var(--muted) }
.name-cell { overflow-wrap: anywhere }
.answer-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start }
.answer-drawing { min-width: 0 }
.answer-work { display: flex; flex-direction: column; gap: 16px; min-width: 0 }
@media (min-width: 1100px) {
  .answer-layout { grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr) }
  .answer-drawing { position: sticky; top: 16px }
}
.viewer { display: flex; flex-direction: column; gap: 8px }
.zoom-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.zoom-box { position: relative; overflow: hidden; background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; max-height: 78vh; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none }
.zoom-box.dragging { cursor: grabbing }
.zoom-box img { display: block; width: 100%; height: auto; max-width: none; transform-origin: 0 0; -webkit-user-drag: none }
@media (max-width: 1099.98px) { .zoom-box { max-height: 60vh } }
@media (min-width: 1100px) { .zoom-box { height: calc(100vh - 170px); min-height: 380px; max-height: none } }
.doubts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px }
.doubts label.c { align-items: flex-start }
.doubts label.c input { flex: 0 0 auto; margin-top: 1px }
.checks-text { white-space: pre-wrap; font-size: 12px; background: var(--code-bg); padding: 10px; border-radius: 8px; overflow-wrap: anywhere; max-height: 300px; overflow: auto; margin: 8px 0 0 }
.answer-list { display: flex; flex-direction: column; gap: 12px }
.edit-group { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line2) }
.edit-group.depth-2 { margin-left: 4px; padding: 8px 0 8px 14px; border-top: 0; border-left: 2px solid var(--line2) }
.edit-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px }
.edit-group-head .tag { margin-left: 0 }
.edit-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px }
.edit-field { gap: 4px }
.edit-field .f-label { font-size: 13px }
.edit-field input { font-size: 15px; padding: 8px }
.edit-field.changed input { border-color: var(--blue); background: var(--blue-bg) }
.edit-field .was { font-size: 12px; color: var(--blue); overflow-wrap: anywhere }
.edit-field input[readonly], textarea.aadr[readonly] { background: var(--ground) }
.btn.link.danger-link { color: var(--bad-ink); font-size: 13px; margin-left: auto }
textarea.aadr { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; width: 100%; min-height: 50vh; padding: 10px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--control); color: var(--ink); resize: vertical; white-space: pre; overflow-wrap: normal; overflow-x: auto }
textarea.aadr:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue) }
.findings, .change-list { margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere }
.change-list code { font-size: 12px }
details.changes > summary { font-size: 14px }
.report h2 { font-size: 20px; margin: 18px 0 8px }
.report h2:first-child { margin-top: 0 }
.report h3 { font-size: 16px; margin: 14px 0 6px }
.report p, .report ul, .report ol { margin: 0 0 10px; font-size: 15px }
.report-table { overflow-x: auto; margin: 0 0 12px }
.report table { min-width: 420px }
@media (max-width: 640px) {
  .stack-table thead { display: none }
  .stack-table tr { display: block; border-top: 1px solid var(--line2); padding: 10px 0 }
  .stack-table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right; overflow-wrap: anywhere }
  .stack-table td::before { content: attr(data-label); flex: 0 0 auto; max-width: 45%; white-space: normal; overflow-wrap: normal; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; text-align: left }
  .stack-table td.acts { justify-content: flex-start; padding-top: 8px }
  .stack-table td.acts::before, .stack-table td:not([data-label])::before { content: none }
  .big { font-size: 52px }
  .score-chart text { font-size: 18px }
  .score-chart .chart-label { font-size: 20px }
  .score-chart .chart-mark text { font-size: 16px }
  .edit-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) }
  .edit-group.depth-2 { padding-left: 10px }
  .drop { padding: 24px 14px }
}

/* ---- Build phase 6: Convert (wave 4 design 2.9 and 3; step c2) ----
   The Convert tab (the large drop box, the packs and their drawings), a pack's own page, and the Settings cards for the
   Convert choices and the training settings. Only the colour variables above are used, so dark mode works by itself. The
   pills of the sample (Ready, Please check, Couldn't read) get two more: grey for Waiting, Not a spool drawing and
   Cancelled, blue for Being read. On a phone the drawings table becomes one block per drawing (.stack-table). */
.convert-head { align-items: flex-end }
.convert-links { align-items: center }
.convert-links .everyone { font-weight: 500; white-space: nowrap }
.choices-line { margin: -8px 0 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere }
.drop.convert-drop { padding: 40px 24px; gap: 10px; color: var(--ink) }
.drop.convert-drop svg { color: var(--blue) }
.drop.convert-drop b { font-size: 20px }
.drop.convert-drop .drop-limits { font-size: 13px }
.drop.convert-drop:hover { border-color: var(--blue) }
.pill.off { background: var(--line2); color: var(--muted) }
.pill.off i { background: var(--muted) }
.pill.run { background: var(--blue-soft); color: var(--blue) }
.pill.run i { background: var(--blue); animation: qd-pulse 1.6s ease-in-out infinite }
@keyframes qd-pulse { 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .pill.run i { animation: none } }
.tag.accepted { background: var(--ok-bg); color: var(--ok-ink) }
.off-why { display: inline-flex }
.pack-card { overflow: hidden; display: flex; flex-direction: column }
.pack-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; padding: 18px 20px; border-bottom: 1px solid var(--line2) }
.pack-what { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px }
.pack-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere }
h1.pack-title { font-size: 24px; font-weight: 700 }
.pack-title a { color: var(--ink); text-decoration: none }
.pack-title a:hover { color: var(--blue); text-decoration: underline }
.pack-counts { color: var(--ink) }
.pack-progress { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--blue); max-width: 520px }
.pack-progress .bar { height: 8px }
.pack-meta, .pack-choices { overflow-wrap: anywhere }
.pack-downloads { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 100% }
.download-note { text-align: right; max-width: 340px }
.pack-message { margin: 14px 20px 0 }
.pack-message.rename { max-width: 520px }
.pack-actions { padding: 12px 20px; align-items: center; border-bottom: 1px solid var(--line2) }
.pack-menu { position: relative }
.pack-menu > summary { list-style: none }
.pack-menu > summary::-webkit-details-marker { display: none }
.pack-menu > summary::after { content: "▾"; font-size: 11px; color: var(--muted) }
.pack-menu-list { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 160px }
.pack-menu-list .btn { justify-content: flex-start }
.pack-card .scroll-x { overflow-x: auto }
.pack-card table.drawings { min-width: 760px }
.pack-card table.drawings th:first-child, .pack-card table.drawings td:first-child { padding-left: 20px }
.pack-card table.drawings th:last-child, .pack-card table.drawings td:last-child { padding-right: 20px }
.drawings td { vertical-align: top }
.drawings td.acts { white-space: nowrap; text-align: right }
.drawings td.acts .btn + .btn, .drawings td.acts .btn + .off-why, .drawings td.acts .off-why + .btn, .drawings td.acts .off-why + .off-why { margin-left: 6px }
.drawing-cell, .drawing-info { min-width: 0 }
.drawing-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; font-weight: 600; overflow-wrap: anywhere }
.drawing-name a { color: var(--ink); text-decoration: none }
.drawing-name a:hover { color: var(--blue); text-decoration: underline }
.drawing-cell .reason { display: block; margin-top: 2px; overflow-wrap: anywhere }
.drawing-cell .where { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere }
.read-by { color: var(--muted) }
.pack-foot { padding: 14px 20px; border-top: 1px solid var(--line2) }
.earlier-table td { vertical-align: top }
.earlier-counts { display: block; margin-top: 2px }
.earlier-table td.acts { text-align: right }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px }
.radio-set { gap: 10px }
label.radio-choice { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer }
label.radio-choice input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue) }
label.radio-choice b { display: block; font-weight: 600 }
label.radio-choice .help { display: block; color: var(--muted); font-size: 13px; margin-top: 2px }
.gb-row { display: flex; align-items: center; gap: 10px; font-weight: 400 }
.gb-row input[type=number] { width: 120px; flex: 0 0 auto }
#training-files fieldset label.c { align-items: flex-start }
#training-files fieldset label.c input { flex: 0 0 auto }
@media (max-width: 640px) {
  .convert-head { align-items: flex-start }
  .choices-line { margin-top: -6px }
  .drop.convert-drop { padding: 26px 14px }
  .drop.convert-drop b { font-size: 18px }
  .pack-head { padding: 14px 16px }
  .pack-downloads { align-items: stretch; width: 100% }
  .pack-downloads .btn.pri { width: 100% }
  .download-note { text-align: left; max-width: none }
  .pack-message { margin: 12px 16px 0 }
  .pack-actions { padding: 10px 16px }
  .pack-card table.drawings { min-width: 0 }
  .pack-card .stack-table tr { padding: 10px 16px }
  .pack-card table.drawings td:first-child, .pack-card table.drawings td:last-child { padding-left: 0; padding-right: 0 }
  .drawings td.acts { white-space: normal; flex-wrap: wrap; gap: 6px; text-align: left }
  .drawings td.acts .btn + .btn, .drawings td.acts .btn + .off-why, .drawings td.acts .off-why + .btn, .drawings td.acts .off-why + .off-why { margin-left: 0 }
  .drawing-info { min-width: 0; text-align: right }
  .drawing-name { justify-content: flex-end }
  .pack-foot { padding: 12px 16px }
}

/* ---- Build phase 6: the Check page (wave 4 design part C; step k1) ----
   The drawing beside our redraw (side by side from 1000 px, stacked on a phone), decision 18's choice, "Things to check"
   and the reading as an editable list with every finding marked beside its value: amber or red boxes with the finding's
   words under them, softer dashed amber for values the AI was not sure of that are still unchanged. Only the colour
   variables above are used, so dark mode works by itself; the drawings stay black on white. */
.check-head { display: flex; flex-direction: column; gap: 6px }
.check-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px }
.check-steps { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px }
.check-title { overflow-wrap: anywhere }
.check-where, .check-facts { overflow-wrap: anywhere }
.check-light { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px }
.light-words { font-size: 15px; font-weight: 500 }
.light-words.amber { color: var(--chk-ink) }
.light-words.red { color: var(--bad-ink) }
.light-words.green { color: var(--ok-ink) }
.check-actions .btn { flex: 0 0 auto }
.check-pictures { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start }
@media (min-width: 1000px) { .check-pictures { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) } }
.check-picture { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0 }
.check-picture .zoom-box { height: auto; min-height: 0; max-height: 70vh }
@media (min-width: 1000px) { .check-picture .zoom-box { height: 62vh; min-height: 320px } }
.viewer-empty { margin: 0; padding: 24px 16px; color: #5A6675; font-size: 14px; text-align: center }
.coordinates-choice legend { font-weight: 600 }
.things { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px }
.thing { border-left: 4px solid var(--chk-dot); background: var(--chk-bg); color: var(--chk-ink); border-radius: 6px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere }
.thing.red { border-left-color: var(--bad-dot); background: var(--bad-bg); color: var(--bad-ink) }
.thing.soft { border-left-style: dashed; background: transparent }
.thing a { color: inherit; text-decoration: underline }
.thing-level { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em }
.thing-suggestion { color: inherit; opacity: .85 }
.soft-list > summary, .check-notes > summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0 }
.soft-list[open] > summary, .check-notes[open] > summary { margin-bottom: 6px }
.mark-note { margin: 0; font-size: 13px; border-radius: 6px; padding: 5px 9px; overflow-wrap: anywhere }
.mark-note.amber { background: var(--chk-bg); color: var(--chk-ink); border-left: 3px solid var(--chk-dot) }
.mark-note.red { background: var(--bad-bg); color: var(--bad-ink); border-left: 3px solid var(--bad-dot) }
.mark-note.soft { color: var(--chk-ink); border-left: 3px dashed var(--chk-dot); padding-left: 8px }
.mark-note.info { color: var(--muted); border-left: 3px solid var(--line) }
.edit-field.mark-amber input { border-color: var(--chk-dot); box-shadow: 0 0 0 1px var(--chk-dot) }
.edit-field.mark-red input { border-color: var(--bad-dot); box-shadow: 0 0 0 1px var(--bad-dot) }
.edit-field.mark-soft input { border-color: var(--chk-dot); border-style: dashed }
.edit-group.mark-amber > .edit-group-head b { color: var(--chk-ink) }
.edit-group.mark-red > .edit-group-head b { color: var(--bad-ink) }
.pcf-files { display: flex; flex-direction: column; gap: 6px; font-size: 14px }
.spools-line { margin: 0 }
.file-names { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere }
.file-names .note { margin-left: 6px }
.accept-confirm { background: var(--chk-bg); border-color: var(--chk-dot) }
.accept-confirm b { color: var(--chk-ink) }
.pcf-drop { padding: 22px 16px }
.check-reading .answer-list { gap: 12px }

/* Quick Design change 17 (19 Nov 2026): the Flanges box on the Check page - each flange's number in a round badge (the
   main run's two ends filled in the primary colour, branch ends soft blue), the numbering rule in a muted line, a "Flow"
   pill, and the flange names beside the routes of the reading and beside findings. Colours from the variables, so dark
   mode follows. */
.pill.flow { background: var(--blue-soft); color: var(--blue) }
.pill.flow i { background: var(--blue) }
.flange-card .flange-rule-all { margin: 0 }
.flange-system { display: flex; flex-direction: column; gap: 8px; min-width: 0 }
.flange-system + .flange-system { border-top: 1px solid var(--line2); padding-top: 12px }
.flange-why { margin: 0; font-size: 14px }
.flange-table td { vertical-align: top }
.flange-table td:first-child { width: 64px }
.flange-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 9px;
  box-sizing: border-box; border-radius: 999px; border: 1px solid var(--blue-line); background: var(--blue-soft); color: var(--blue);
  font-weight: 700; font-size: 14px; text-decoration: none; font-variant-numeric: tabular-nums }
.flange-badge.main { background: var(--pri); border-color: var(--pri); color: var(--pri-ink) }
.flange-badge:hover, .flange-badge:focus-visible { background: var(--pri-hover); border-color: var(--pri-hover); color: var(--pri-ink) }
.flange-coords { font-variant-numeric: tabular-nums; white-space: nowrap }
.route-flange { margin-left: 10px; font-size: 13px; font-weight: 500; color: var(--muted) }
.tag.flange-tag { background: var(--blue-soft); color: var(--blue) }
@media (max-width: 640px) {
  .flange-coords { white-space: normal }
  .flange-table td:first-child { width: auto }
}
:target { scroll-margin-top: 16px }
@media (max-width: 640px) {
  .check-nav { align-items: flex-start }
  .check-actions .btn, .check-actions .off-why { flex: 1 1 calc(50% - 8px) }
  .check-actions .off-why .btn { width: 100% }
  .check-picture .zoom-box { max-height: 55vh }
  .light-words { font-size: 14px }
}

/* ---- Build phase 6: notes on drawings and the Check list (wave 4 design parts D and E; step k2) ----
   The notes' marks sit in the client drawing's zoom layer (so they stay on their spots at any zoom) and keep their own size:
   the zoom helper puts the zoom in --qd-zoom. A spot is a numbered circle, an area a dashed rectangle; notes for every
   drawing of the style are blue, the drawing's own amber, the one being placed or changed green. While a note is being
   placed the drawing shows a cross. The note's box floats beside the drawings on wide screens and sits under the drawing on
   a phone. Only the colour variables above are used, so dark mode works by itself. */
.zoom-layer { position: relative; transform-origin: 0 0 }
.zoom-layer img { display: block; width: 100%; height: auto }
.zoom-box.placing { cursor: crosshair; outline: 2px dashed var(--chk-dot); outline-offset: -2px }
.note-mark { position: absolute; pointer-events: none; box-sizing: border-box }
.note-mark.spot { width: 24px; height: 24px; margin: 0; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  background: var(--chk-dot); color: #FFFFFF; font-size: 12px; font-weight: 700; border: 2px solid #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transform: translate(-50%, -50%) scale(calc(1 / var(--qd-zoom, 1))); transform-origin: 50% 50% }
.note-mark.area { border: calc(2px / var(--qd-zoom, 1)) dashed var(--chk-dot); background: rgba(178, 106, 0, .08) }
.note-mark.area b { position: absolute; left: 0; top: 0; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 0 0 6px 0; display: flex; align-items: center;
  justify-content: center; background: var(--chk-dot); color: #FFFFFF; font-size: 12px; transform: scale(calc(1 / var(--qd-zoom, 1))); transform-origin: 0 0 }
.note-mark.style.spot, .note-mark.style.area b { background: var(--blue) }
.note-mark.style.area { border-color: var(--blue); background: rgba(30, 90, 168, .08) }
.note-mark.new.spot, .note-mark.new.area b, .note-mark.editing.spot, .note-mark.editing.area b { background: var(--ok-dot) }
.note-mark.new.area, .note-mark.editing.area { border-color: var(--ok-dot); background: rgba(31, 122, 77, .1) }
.note-drag { position: absolute; pointer-events: none; border: calc(2px / var(--qd-zoom, 1)) dashed var(--ok-dot); background: rgba(31, 122, 77, .1) }
.note-mode-hint { color: var(--chk-ink); font-weight: 500 }
.note-box { border: 1px solid var(--chk-dot); gap: 12px }
.note-box textarea { font: inherit; font-size: 16px; padding: 10px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--control); color: var(--ink); width: 100%; resize: vertical; min-height: 64px }
.note-box textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue) }
.note-box .help { display: block; color: var(--muted); font-size: 13px; font-weight: 400 }
.note-place { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px }
.note-kinds .note-sub { margin: -2px 0 4px 30px }
.note-kinds { gap: 8px }
@media (min-width: 1000px) {
  .note-box { position: fixed; right: 24px; bottom: 24px; width: min(440px, calc(100vw - 48px)); max-height: calc(100vh - 48px); overflow: auto; z-index: 40; box-shadow: var(--shadow) }
}
.notes-list { gap: 8px; font-size: 14px }
.notes-title { margin: 6px 0 0; font-size: 15px; font-weight: 600 }
.note-items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px }
.note-item { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; padding: 8px 10px; border-left: 4px solid var(--chk-dot); border-radius: 6px; background: var(--ground); overflow-wrap: anywhere }
.note-item.style { border-left-color: var(--blue) }
.note-num { font-weight: 700; flex: 0 0 auto }
.note-body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0 }
.note-body .note { font-size: 12px }
.own-words { font-style: italic }
.note-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 0 0 auto }
.check-list-tabs { margin: 0 }
.check-list-table td { vertical-align: top }
.check-list-table td.acts { text-align: right }
.check-list-link { margin: 0 }
@media (max-width: 640px) {
  .note-item { padding: 8px }
  .note-acts { width: 100% }
  .check-list-table td.acts { text-align: left }
}

/* ---- Build phase 7: the Claude backup (wave 5 design 4.2, 7.4, 10; step b2) ----
   The Settings card "Claude backup", Claude's part of a drawing on the Convert list (what Claude cost under who read it, the
   Claude line under the reason) and on the Check page (the Claude panel), and the Training tab's monthly share. Only the colour
   variables above are used, so dark mode works by itself; everything wraps on a phone. */
.read-by-lines { display: inline-flex; flex-direction: column; gap: 2px }
.claude-cost { display: block; font-size: 12px; color: var(--ink); white-space: nowrap }
.drawing-cell .claude-line { color: var(--blue) }
.drawing-cell .claude-why { color: var(--chk-ink) }
.claude-card .claude-on b, .claude-ask-first b { font-weight: 600 }
.claude-key { padding-top: 4px; border-top: 1px solid var(--line2) }
.claude-key-line { font-size: 14px; font-weight: 500; overflow-wrap: anywhere }
.claude-key input[type=password] { max-width: 520px }
.money-row { flex-wrap: wrap }
.claude-month { display: flex; flex-direction: column; gap: 2px; color: var(--ink) }
.claude-unsure { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px }
.claude-unsure input[type=number] { width: 90px; flex: 0 0 auto }
.claude-level-group { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap }
.claude-uses { padding-top: 4px; border-top: 1px solid var(--line2); gap: 8px }
.claude-use-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; overflow-wrap: anywhere }
.claude-panel .buttons { margin-top: 2px }
.claude-card .msg, .claude-card .info, .claude-panel { overflow-wrap: anywhere }
/* A fieldset is never narrower than its widest line unless told so: the "When to use it" box keeps to the card. */
fieldset.claude-when { min-inline-size: 0 }
@media (max-width: 640px) {
  .read-by-lines { align-items: flex-end }
  .claude-level-group { margin-left: 30px }
  /* Change 31: the second title on the Convert tab shrinks with the page's h1. */
  .convert-pair .pair-title { font-size: 24px }
}
/* The narrowest phones (320 px): the level box and its words still on one line, with no sideways scrolling. */
@media (max-width: 360px) {
  .claude-level-group { margin-left: 0 }
  .claude-unsure input[type=number] { width: 72px }
}

/* ---- change 28: every drop box takes a folder, a group or a zip (Components/Shared/FileDrop.razor) ---- */
.file-drop { display: flex; flex-direction: column; gap: 8px }
.drop[data-dragging] { border-style: solid; border-color: var(--blue); background: var(--blue-soft) }
.drop.busy input[type=file] { pointer-events: none }
.drop-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--muted) }
.folder-pick { position: relative; overflow: hidden }
.folder-pick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer }
.folder-pick:focus-within { outline: 2px solid var(--blue); outline-offset: 2px }
.folder-pick.busy { opacity: .6; pointer-events: none }
.ignored-line { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere }
.ignored-line summary, .outcome-fold > summary { display: inline; color: var(--blue); text-decoration: underline; font-size: 14px }
.outcome-fold { margin-top: 8px }

/* ---- change 31: "Convert PCF to Drawing" beside "Convert drawings to PCF" (Pages/Convert.razor, ConvertParts/PcfDrawingsCard.razor) ---- */
.convert-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px 28px; align-items: start }
@media (min-width: 1000px) { .convert-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) } }
.convert-col { min-width: 0 }
.pair-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.2 }
.pcf-style select { margin-left: 6px; max-width: 100% }
.pcf-chosen, .pcf-result, .pcf-drawings .info, .pcf-drawings .msg { overflow-wrap: anywhere }
.pcf-chosen .pcf-why { display: block; font-size: 13px }
.pcf-result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px }
.pcf-result-head .card-sub { min-width: 0 }
.pcf-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; font-size: 14px }
.pcf-rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line2) }
.pcf-rows li:last-child { border-bottom: 1px solid var(--line2) }
