/* WebFlash site: the wizard (a top bar, one centered box with a step bar,
   each step's body and footer) and the components the steps host. Variable
   names follow PinConnect's designer where they apply. Dark by default; the
   light palette applies with data-theme="light", which index.html sets from
   ?theme= or prefers-color-scheme before first paint. */

:root {
  --bg: #131313;
  --bg-panel: #1a1a1a;
  --bg-panel-alt: #222222;
  --bg-input: #161616;
  --border: #2c2c2c;
  --border-focus: #ffbf00;
  --text: #e0e0e0;
  --text-dim: #9a9a9a;
  --text-muted: #6b6b6b;
  --accent: #ffbf00;
  --accent-hover: #ffd24d;
  --accent-bg: rgba(255, 191, 0, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.10);
  --ok: #4ade80;
  --log-bg: #0b0b0b;
  --log-text: #d4d4d4;
  --shadow: rgba(0, 0, 0, 0.5);

  --panel-header-h: 34px;
  --gutter: 16px;

  --ui-font: "Roboto", system-ui, sans-serif;
  --mono-font: "Roboto Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f8f8f8;
  --bg-panel: #ffffff;
  --bg-panel-alt: #f1f1f1;
  --bg-input: #ffffff;
  --border: #dcdcdc;
  --border-focus: #c98a00;
  --text: #1a1a1a;
  --text-dim: #5f5f5f;
  --text-muted: #8a8a8a;
  --accent: #c98a00;
  --accent-hover: #7a4d00;
  --accent-bg: rgba(255, 191, 0, 0.18);
  --danger: #c62828;
  --danger-bg: rgba(198, 40, 40, 0.08);
  --warn: #9a5b00;
  --warn-bg: rgba(255, 191, 0, 0.14);
  --ok: #2e7d32;
  --log-bg: #1b1b1b;
  --log-text: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.18);
  color-scheme: light;
}

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

/* Form controls don't inherit the page font, so the chrome would otherwise
   stay on the browser's UI font. */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent-hover); }
code { font-family: var(--mono-font); font-size: 0.92em; }
[hidden] { display: none !important; }

button {
  padding: 6px 12px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
button:hover:not(:disabled) { border-color: var(--border-focus); }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a1a1a; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
:root[data-theme="light"] button.primary:hover:not(:disabled) { background: #e0a000; border-color: #e0a000; }
button.ghost, .file-btn.ghost { background: none; border-color: transparent; color: var(--text-dim); }
button.ghost:hover:not(:disabled), .file-btn.ghost:hover { color: var(--text); border-color: var(--border); background: none; }
button.muted { background: none; color: var(--text-dim); }
button.muted:hover:not(:disabled) { color: var(--text); }
button.link { padding: 0; background: none; border: 0; color: var(--accent-hover); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
button.link:hover:not(:disabled) { background: none; color: var(--text); }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .panel-tab:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

select, input[type="text"], input[type="search"] {
  padding: 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
select { cursor: pointer; }
select:hover:not(:disabled), select:focus, input:focus { border-color: var(--border-focus); }
select:disabled, input:disabled, textarea:disabled { opacity: 0.5; cursor: default; }

/* --- The page: top bar, the wizard's box, the line under it --- */

.site { min-height: 100vh; display: flex; flex-direction: column; }

.top { display: flex; align-items: center; gap: 6px; padding: 10px 18px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 15px;
  margin-right: auto;
}

.brand-mark {
  width: 16px;
  height: 16px;
  background: var(--accent);
  clip-path: polygon(59% 6%, 19% 58%, 45% 58%, 39% 94%, 81% 41%, 54% 41%);
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}
.field select { color: var(--text); }

/* A file input wrapped in a label that looks like a button. */
.file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.file-btn:hover { border-color: var(--border-focus); }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.file-btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

button.icon-btn { font-weight: 600; }

/* The status chip and its popover, which holds one pill per thing the site
   downloads (Python, the sources, the compiler). */
.status-wrap { position: relative; display: inline-flex; margin-right: 4px; }
/* Read by screen readers, never shown: the chip's changes of state. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.status-chip .dot.ready { background: var(--ok); }
.status-chip .dot.busy { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.status-chip .dot.error { background: var(--danger); }
.status-chip:has(.dot.error) { color: var(--danger); border-color: var(--danger); }
.status-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: min(340px, calc(100vw - 2 * var(--gutter)));
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.status-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; }
.status-row + .status-row { padding-top: 8px; border-top: 1px solid var(--border); }
.status-row .pill { justify-self: start; }
.status-row .mini { grid-column: 2; grid-row: 1; }
.status-detail { grid-column: 1 / -1; font-size: 12px; color: var(--text-dim); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.status-detail:empty { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.pill.busy::before { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.pill.ready::before { background: var(--ok); }
.pill.error { color: var(--danger); border-color: var(--danger); cursor: help; }
.pill.error::before { background: var(--danger); }
.pill.off { opacity: 0.55; }
@keyframes pulse { 50% { opacity: 0.35; } }

.center { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 24px var(--gutter) 40px; }

.wiz {
  width: 100%;
  max-width: 620px;
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px var(--shadow);
}
.wiz.wide { max-width: 760px; }
.wiz-body { padding: 22px 26px 8px; }
.wiz-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px 18px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.wiz-foot .hint { flex: 1; min-width: 0; color: var(--text-dim); font-size: 12.5px; }
.legal { text-align: center; color: var(--text-muted); font-size: 12px; padding: 0 var(--gutter) 24px; }

/* The step bar: a line per step, lit up to the current one; the steps
   before it are links back. */
.steps { display: flex; list-style: none; padding: 16px 26px 0; gap: 4px; }
.steps li { flex: 1; min-width: 0; font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.steps li::before { content: ""; height: 3px; border-radius: 2px; background: var(--border); }
.steps li.done { color: var(--text-dim); }
.steps li.done::before { background: var(--accent); opacity: 0.5; }
.steps li.now { color: var(--text); font-weight: 500; }
.steps li.now::before { background: var(--accent); }
.steps li > span, .steps li > button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps li > button { padding: 0; background: none; border: 0; color: inherit; font-size: inherit; text-align: left; }
.steps li > button:hover:not(:disabled) { color: var(--text); background: none; text-decoration: underline; }

h2.page { font-size: 19px; font-weight: 500; margin-bottom: 4px; }
h2.page:focus { outline: none; }
p.lead { color: var(--text-dim); margin-bottom: 18px; }
h3.sec { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 500; margin: 18px 0 8px; }
.wiz-note { padding: 8px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-panel-alt); font-size: 13px; }

/* Page 1: the firmware switch and the Katapult checkbox. */
.fw {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 10px;
}
.fw.off { background: none; }
.fw.off .what .sub { opacity: 0.7; }
.fw > span:empty { display: none; }
.fw .what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fw .name { font-weight: 500; color: var(--text); font-size: 14px; }
.fw .sub { color: var(--text-dim); font-size: 12.5px; }
.fw .check.name input { width: 15px; height: 15px; }
.fw .ver { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.fw .ver .ver-label { color: var(--text-dim); font-size: 12.5px; min-width: 52px; line-height: 32px; }
.fw .ver .ver-picker { flex: 1; min-width: 0; }
.seg2 { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg2 button { border: 0; border-radius: 0; padding: 6px 13px; background: none; }
.seg2 button + button { border-left: 1px solid var(--border); }
.seg2 button:hover:not(:disabled) { background: var(--bg-panel-alt); }
.seg2 button.on, .seg2 button.on:hover:not(:disabled) { background: var(--accent-bg); color: var(--accent-hover); font-weight: 500; }
.alts { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }

details.spoiler { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 12.5px; }
details.spoiler > summary { color: var(--text-dim); cursor: pointer; list-style: none; }
details.spoiler > summary::-webkit-details-marker { display: none; }
details.spoiler > summary::before { content: "▸ "; color: var(--text-muted); }
details.spoiler[open] > summary::before { content: "▾ "; }
.about-inline { padding-top: 4px; }
.about-inline h3 { font-size: 11.5px; font-weight: 600; margin: 12px 0 4px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Configure's bar, and the bars of Embed's .config and TOML tabs. Configure's
   stays in view while the list scrolls. */
.cfg-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.cfg-bar input[type="search"] { flex: 1; min-width: 140px; }
#configure-panel > .cfg-bar { position: sticky; top: 0; z-index: 5; padding: 8px 0; margin: -8px 0 4px; background: var(--bg-panel); }
.bar-spacer { flex: 1; }

/* Embed's tabs. */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 -26px 16px; padding: 0 26px; overflow-x: auto; }
.panel-tab {
  padding: 9px 12px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-dim);
}
.panel-tab:hover:not(:disabled) { color: var(--text); background: none; border-color: transparent; border-bottom-color: transparent; }
.panel-tab[aria-selected="true"],
.panel-tab[aria-selected="true"]:hover:not(:disabled) { border-bottom-color: var(--accent); color: var(--text); }
.panel-tab-content { display: flex; flex-direction: column; min-width: 0; }

/* The cards the Build and Flash steps host sit in the box without a frame. */
.wiz-step > .wiz-body > .card { padding: 0; border: 0; background: none; }
.wiz-step .flash-panel > .card-head h2 { display: none; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.check input { accent-color: var(--accent); }

.placeholder {
  padding: 16px 14px;
  color: var(--text-dim);
  line-height: 1.6;
  overflow-y: auto;
}
.placeholder p { margin: 0 0 10px; }
.placeholder strong { color: var(--text); font-weight: 500; }

textarea.code {
  height: min(60vh, 560px);
  min-height: 280px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  outline: none;
  font-family: var(--mono-font);
  font-size: 12.5px;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}

.file-name { font-family: var(--mono-font); font-size: 12px; color: var(--text); }
.toml-files { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toml-status {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.toml-status:empty { display: none; }
.toml-status.ok { color: var(--ok); }
.toml-status.warn { color: var(--warn); background: var(--warn-bg); }
.toml-status.error { color: var(--danger); background: var(--danger-bg); }

.form { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.form-row { display: flex; flex-direction: column; gap: 4px; color: var(--text-dim); font-size: 12px; }
.form-row textarea { padding: 6px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; resize: vertical; }

/* --- Configure: the Kconfig tree --- */

.ref-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--warn);
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: help;
}

.kc-count, .bar-note { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.bar-note { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.kc-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0 2px 8px;
  font-size: 12px;
}
.kc-status-detail { color: var(--text-dim); font-family: var(--mono-font); font-size: 11.5px; }
.kc-status-sep { color: var(--text-muted); }
.kc-status .mini { padding: 1px 8px; }
.kc-locked { color: var(--warn); }

/* The Setup select (a board TOML with several setups). */
.kc-setup { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.kc-setup label { color: var(--text-dim); font-size: 12.5px; }
.kc-setup select { flex: 1; min-width: 0; max-width: 420px; }

/* A paired tree's groups: the options both use, then each project's own. */
.kc-group { margin: 0 -10px; padding: 4px 10px 6px; }
.kc-group:first-child { margin-top: -6px; }
.kc-group + .kc-group { border-top: 1px solid var(--border); }
.kc-group-head { display: flex; align-items: center; gap: 6px; padding: 6px 0 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.kc-group > .kc-children { margin-left: 0; padding-left: 0; border-left: 0; }
.kc-tag { font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.kc-tag-fw { border-color: #3b82f680; color: #7fb0ff; }
.kc-tag-katapult { border-color: #a855f780; color: #c69bff; }
:root[data-theme="light"] .kc-tag-fw { color: #1d4ed8; }
:root[data-theme="light"] .kc-tag-katapult { color: #7e22ce; }
.kc-lock { font-size: 12px; color: var(--text-dim); }
.kc-notes { margin: 0 4px 4px 27px; }
.kc-group > .kc-notes { margin-left: 0; }
.kc-note { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--warn); }
.kc-note-error { color: var(--danger); }

.kc-notice {
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.kc-notice.warn { background: var(--warn-bg); }
.kc-notice.error { background: var(--danger-bg); }
.kc-notice.info { background: var(--accent-bg); }
.kc-notice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.kc-notice-head strong { flex: 1; font-weight: 600; }
.kc-notice p { margin: 2px 0 0; word-break: break-word; }

/* The list is in the page's flow: the page scrolls, the bar above stays. */
.kc-scroll {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px 10px;
}

.kc-start { padding: 10px 2px; line-height: 1.6; color: var(--text-dim); max-width: 640px; }
.kc-start h3 { font-size: 14px; color: var(--text); margin-bottom: 6px; }
.kc-start p { margin: 0 0 10px; }
.kc-start code { color: var(--text); }
.kc-start progress { max-width: 320px; }
.kc-start .kc-start-compiler { display: flex; align-items: flex-start; font-size: 13px; line-height: 1.5; }
.kc-start .kc-start-compiler input { margin-top: 3px; flex: none; }
.kc-loading { display: flex; align-items: center; gap: 8px; }
.kc-error-text { color: var(--danger); white-space: pre-wrap; }
.kc-warn-text { color: var(--warn); }
.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kc-tree mark { background: var(--accent-bg); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px var(--accent-bg); }

.kc-node { margin: 0; }
.kc-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 30px;
  padding: 2px 4px;
  border-radius: 4px;
}
.kc-row:hover { background: var(--bg-panel-alt); }
.kc-node[aria-busy="true"] > .kc-row { opacity: 0.6; }
.kc-prompt { color: var(--text); line-height: 1.4; }
.kc-symbol.kc-user > .kc-row .kc-prompt { font-weight: 500; }
.kc-check, .kc-expose, .kc-radio input { accent-color: var(--accent); margin: 0; width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.kc-check:disabled, .kc-radio input:disabled { cursor: default; }
label.kc-prompt { cursor: pointer; }
.kc-name {
  font-family: var(--mono-font);
  font-size: 10.5px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.kc-row .kc-name { margin-left: auto; }
.kc-help-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-dim);
  flex-shrink: 0;
}
.kc-help-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-bg); }
.kc-help {
  margin: 2px 4px 6px 27px;
  padding: 8px 10px;
  background: var(--bg-panel-alt);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  color: var(--text-dim);
  line-height: 1.55;
  font-size: 12px;
}
.kc-help p + p { margin-top: 6px; }
.kc-error { margin: 0 4px 4px 27px; color: var(--danger); font-size: 11.5px; }

.kc-select { max-width: 100%; min-width: 0; }
.kc-select, .kc-input { font-size: 12px; }
.kc-input { width: 11em; font-family: var(--mono-font); }
.kc-input.kc-string { width: 16em; }
.kc-input[aria-invalid="true"] { border-color: var(--danger); }
.kc-range { font-size: 11px; color: var(--text-muted); font-family: var(--mono-font); }
.kc-value { font-size: 12px; }

.kc-radio-list { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.kc-radio { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.kc-radio-text { color: var(--text); }

.kc-children { margin-left: 14px; padding-left: 8px; border-left: 1px solid var(--border); }
.kc-list > .kc-node > .kc-children:empty, .kc-children:empty { display: none; }

.kc-menu { margin: 8px 0 4px; }
.kc-menu > .kc-children { margin-left: 6px; }
.kc-menu-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 6px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: normal;
}
.kc-menu-head:hover:not(:disabled) { background: var(--bg-panel-alt); border-color: transparent; }
.kc-caret::before { content: "▾"; display: inline-block; width: 10px; font-size: 10px; color: var(--text-dim); }
.kc-menu-head[aria-expanded="false"] .kc-caret::before { content: "▸"; }

.kc-comment-text {
  margin: 10px 4px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.kc-exposed {
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 10px;
  color: var(--accent-hover);
  white-space: nowrap;
}
.kc-mode-expose .kc-row { min-height: 28px; }
.kc-state { font-size: 11.5px; color: var(--text-dim); overflow-wrap: anywhere; }
.kc-mode-expose .kc-is-exposed > .kc-row { background: var(--accent-bg); }
.kc-editor { margin: 2px 4px 8px 27px; }

.kc-hidden-matches {
  margin-top: 14px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}
.kc-hidden-matches ul { list-style: none; margin-top: 4px; }
.kc-hidden-matches code { color: var(--text); }
.kc-dep { font-family: var(--mono-font); font-size: 11px; color: var(--text-muted); }

textarea.load-config { height: 240px; min-height: 200px; margin-bottom: 8px; }
.modal-actions .file-btn { position: relative; }

/* --- Embed options --- */

.opt-panel { display: flex; flex-direction: column; min-width: 0; }
.opt-section { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.opt-section:first-child { padding-top: 0; }
.opt-section:last-child { border-bottom: 0; }
.opt-section h3 { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.opt-section .form-row input[type="text"], .opt-section .form-row textarea, .opt-section .form-row select { width: 100%; }
.opt-section .form-row textarea { padding: 6px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; resize: vertical; font-size: 12px; }
.opt-section .opt-search input[type="search"] { flex: 1; }
.opt-add-instructions { align-self: flex-start; }
.opt-note { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.opt-checks .check { color: var(--text); }
.opt-ref-list { padding: 6px 0 0 4px; }
.method-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.method-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 4px; }
.method-row .check { flex: 1; color: var(--text); }
.method-row.off .check { color: var(--text-dim); }
.method-id { font-family: var(--mono-font); font-size: 10.5px; color: var(--text-muted); }
#opt-instructions { display: flex; flex-direction: column; gap: 8px; }
.opt-search { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0; border: 0; }
.opt-unknown { padding: 8px 10px; border: 1px solid var(--warn); border-radius: 4px; background: var(--warn-bg); font-size: 12px; }
.opt-unknown ul { list-style: none; margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.opt-empty { padding: 4px 0; }
#opt-tree.kc-tree { padding: 0; }
.opt-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
}
.opt-editor input[type="text"], .opt-editor textarea { width: 100%; }
.opt-editor textarea { padding: 6px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; resize: vertical; font-size: 12px; }
.opt-values { display: flex; flex-direction: column; gap: 4px; }
.opt-value-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; }
.opt-value-row .check { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.opt-editor .mini { align-self: flex-start; }
.opt-note.warn { color: var(--warn); }
.opt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.opt-versions { display: flex; flex-direction: column; gap: 10px; }
#opt-katapult-block { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
#opt-katapult-block[hidden] { display: none; }
.opt-fold { margin-top: 0; padding-top: 10px; }
.opt-fold + .opt-fold { margin-top: 10px; }
.opt-fold > .opt-section { padding-bottom: 0; }
.opt-fold-n { color: var(--text-muted); margin-left: 6px; font-size: 11.5px; }
.opt-behavior { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; font-size: 12px; }
.opt-behavior li { display: flex; justify-content: space-between; gap: 8px; color: var(--text-dim); }
.opt-behavior b { color: var(--text); font-weight: 500; }

/* The setups the reader picks from: one row per [[setup]]. */
.setup-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.setup-row { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.setup-row.current { border-color: var(--accent); }
.setup-move, .setup-acts { display: flex; gap: 4px; flex: none; }
.setup-move { flex-direction: column; }
.setup-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.setup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.setup-head .setup-title { flex: 1 1 160px; }
.setup-row input.setup-title, .setup-row input.setup-desc {
  width: 100%; min-width: 0; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 2px 6px; margin-left: -6px;
}
.setup-row input.setup-title { font-weight: 600; font-size: 13.5px; }
.setup-row input.setup-desc { font-size: 12px; color: var(--text-dim); }
.setup-row input.setup-title:hover, .setup-row input.setup-desc:hover { border-color: var(--border); }
.setup-row input.setup-title:focus, .setup-row input.setup-desc:focus { border-color: var(--border-focus); background: var(--bg-input); }
.setup-sub { color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.setup-badge { flex: none; font-size: 10.5px; color: var(--accent); border: 1px solid var(--accent); border-radius: 10px; padding: 0 7px; white-space: nowrap; }

.build-plan { color: var(--text); }
.build-plan.warn { color: var(--warn); }

/* --- Build and flash cards --- */

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h2 { font-size: 14px; font-weight: 600; }
.card-spacer { flex: 1; }
.card-note { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }

.progress-list { list-style: none; display: flex; flex-direction: column; gap: 2px; font-family: var(--mono-font); font-size: 12px; }
.progress-list:empty { display: none; }

/* --- Build card (js/build/build-panel.js) --- */

.build-status { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.build-status.busy { color: var(--accent-hover); }
.build-status.ok { color: var(--ok); }
.build-status.error { color: var(--danger); }

.build-start {
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-bg);
  font-size: 12.5px;
  line-height: 1.55;
}
.build-start p { margin: 0 0 6px; }
.build-start strong { font-weight: 600; }
.build-downloads { list-style: none; margin: 0 0 6px; display: flex; flex-direction: column; gap: 3px; }
.build-downloads li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.build-downloads li > span:first-child { flex: 1 1 60%; min-width: 0; }
.dl-size { font-family: var(--mono-font); font-size: 11.5px; color: var(--text); white-space: nowrap; }
.dl-cached { font-size: 11px; color: var(--ok); white-space: nowrap; }
.build-start-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.build-bar { height: 6px; }

/* The Build step: the prerequisites line, one row per firmware, the clock. */
#build-card { display: flex; flex-direction: column; gap: 10px; }
p.build-clock { margin: -12px 0 14px; font-variant-numeric: tabular-nums; font-size: 12.5px; min-height: 1.4em; }
.build-pre { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-dim); }
.build-pre li { display: inline-flex; align-items: center; gap: 5px; }
.build-pre li.pre-ok::before { content: "✓"; color: var(--ok); }
.build-pre li.pre-wait { color: var(--text-muted); }
.build-pre li.pre-wait::before { content: "○"; }
.build-jobs { display: flex; flex-direction: column; gap: 10px; }
.build-jobs:empty { display: none; }
.job { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.job-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.job-name { font-weight: 500; }
.job-version { font-family: var(--mono-font); font-size: 11px; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-status { margin-left: auto; color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-status.done { color: var(--ok); }
.job-status.done::before { content: "✓ "; }
.job-status.failed { color: var(--danger); }
.job-status.idle, .job-status.cancelled { color: var(--text-muted); }
.job-bar { height: 6px; }
.job-files:empty { display: none; }
.job-files .artifacts-head { margin-bottom: 4px; }
.build-memory { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
#build-log-box .progress-list { margin-top: 8px; }

#build-progress { max-height: 220px; overflow-y: auto; padding-right: 2px; }
.build-row { display: flex; align-items: center; gap: 8px; min-height: 20px; line-height: 1.4; color: var(--text); }
.build-row .row-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-row .row-note { color: var(--text-dim); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-icon { width: 12px; height: 12px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1; }
.build-row.running .row-icon { border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.build-row.done .row-icon::before { content: "✓"; color: var(--ok); }
.build-row.done { color: var(--text-dim); }
.build-row.failed .row-icon::before { content: "✕"; color: var(--danger); }
.build-row.failed .row-text { color: var(--danger); }
.build-row.cancelled .row-icon::before { content: "–"; color: var(--text-muted); }
.build-row.cancelled { color: var(--text-muted); }

.build-error {
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: 4px;
  background: var(--danger-bg);
  font-size: 12.5px;
  line-height: 1.5;
}
.build-error strong { color: var(--danger); font-weight: 600; }
.build-error p { margin: 6px 0 4px; color: var(--text-dim); }
.build-error pre {
  margin: 4px 0 0;
  padding: 6px 8px;
  max-height: 240px;
  overflow: auto;
  background: var(--log-bg);
  color: var(--log-text);
  border-radius: 4px;
  font-family: var(--mono-font);
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.build-error .build-cmd { color: var(--accent-hover); }
:root[data-theme="light"] .build-error .build-cmd { color: #ffd24d; }

.memory { border-collapse: collapse; font-size: 12px; width: 100%; }
.memory caption { text-align: left; color: var(--text-dim); font-size: 12px; padding-bottom: 4px; }
.memory th { text-align: left; font-weight: 500; color: var(--text); padding: 2px 10px 2px 0; white-space: nowrap; width: 1%; }
.memory td { padding: 2px 0; }
.memory .mem-bar { width: 100%; padding-right: 10px; }
.mem-bar { position: relative; }
.mem-bar::before { content: ""; display: block; height: 6px; border-radius: 3px; background: var(--bg-panel-alt); border: 1px solid var(--border); }
.mem-fill { position: absolute; left: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--accent); }
.mem-fill.full { background: var(--danger); }
.mem-fill.ram { background: var(--text-muted); }
.mem-num { white-space: nowrap; font-family: var(--mono-font); font-size: 11.5px; color: var(--text-dim); padding-right: 8px !important; }
.mem-pct { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

.artifacts:empty { display: none; }
.artifacts-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--text-dim); }
.artifacts-version { font-family: var(--mono-font); font-size: 11px; color: var(--text-muted); }
.artifacts-stale { font-size: 11px; color: var(--warn); }
.artifact-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
button.artifact { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--mono-font); font-size: 11.5px; }
.artifact-size { color: var(--text-dim); font-size: 10.5px; }
button.artifact.primary .artifact-size { color: inherit; opacity: 0.75; }

.log-count { font-size: 11px; color: var(--text-muted); }

.pill-badge {
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--ok);
}
.about-note { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.about-licenses { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }

.log-box summary, .help-box summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  list-style: none;
}
.log-box summary::-webkit-details-marker, .help-box summary::-webkit-details-marker { display: none; }
.log-box summary::before, .help-box summary::before { content: "▸"; font-size: 10px; }
.log-box[open] summary::before, .help-box[open] summary::before { content: "▾"; }
button.mini { padding: 1px 7px; font-size: 11px; }

.log {
  margin-top: 6px;
  min-height: 60px;
  max-height: 260px;
  overflow: auto;
  padding: 8px 10px;
  background: var(--log-bg);
  color: var(--log-text);
  border-radius: 4px;
  font-family: var(--mono-font);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.help-box p { margin-top: 6px; color: var(--text-dim); line-height: 1.55; }

.flash-step { display: flex; flex-direction: column; gap: 10px; }
.flash-instructions { color: var(--text-dim); line-height: 1.55; }
.flash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

/* --- Modals --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 480px;
  max-width: 100%;
  max-height: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 40px var(--shadow);
}

.modal-wide { width: 1000px; }

.modal-head {
  display: flex;
  align-items: center;
  min-height: var(--panel-header-h);
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 13px; font-weight: 600; }

.modal-close {
  margin-left: auto;
  padding: 0 6px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover:not(:disabled) { color: var(--text); background: none; }

.modal-body {
  overflow: auto;
  padding: 14px;
  font-size: 13px;
  line-height: 1.55;
}
.modal-body p { margin: 0 0 10px; }
.modal-body code { padding: 1px 4px; background: var(--bg-panel-alt); border-radius: 3px; }
.modal-body h3 { font-size: 12px; font-weight: 600; margin: 14px 0 6px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }

.about-links { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.about-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.about-table td { padding: 3px 8px 3px 0; vertical-align: top; }
.about-table td:first-child { color: var(--text-dim); width: 40%; }

.error-text {
  margin: 0;
  padding: 10px 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 4px;
  font-family: var(--mono-font);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* --- Generate dialog --- */

.gen-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.gen-spacer { flex: 1; }
.gen-status { font-size: 11px; color: var(--text-dim); }
.gen-embed { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.gen-embed input { margin: 0; cursor: pointer; accent-color: var(--accent); }
.gen-embed:has(input:disabled) { opacity: 0.45; cursor: default; }

/* The preview is the generated page itself, in an iframe. The page reports
   its height (md-iframe's protocol) and the frame takes it, as a docs site
   would; the box scrolls past its own height. */
.gen-preview {
  height: min(60vh, 560px);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: auto;
  scrollbar-gutter: stable;
  background: var(--bg);
}
.gen-preview iframe { width: 100%; height: 100%; border: 0; display: block; }

.gen-warn {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--warn);
  border-radius: 4px;
  background: var(--warn-bg);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.gen-error { margin: 12px; }
.gen-note { margin: 10px 0 0; font-size: 11px; color: var(--text-dim); }
.gen-files { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 10px; font-size: 12px; color: var(--text-dim); }
.gen-file { font-family: var(--mono-font); font-size: 11.5px; color: var(--text); }
.gen-file-state { font-family: var(--ui-font); font-size: 11px; color: var(--warn); }
.gen-file.attached .gen-file-state { color: var(--ok); }

/* --- Flash panel (js/flash/flash-ui.js) --- */

/* The Method select is as wide as its longest label ("UF2 file onto the
   BOOTSEL drive (not here)"): the field may shrink, and the select with it,
   rather than set the card's width on a phone. */
.flash-panel .card-head .field { min-width: 0; }
.flash-panel #flash-method { max-width: 100%; text-overflow: ellipsis; }
.flash-panel .flash-firmware { font-size: 12px; line-height: 1.6; color: var(--text-dim); word-break: break-word; }
.flash-panel .flash-firmware strong { color: var(--text); font-weight: 500; }
.flash-panel .flash-reason { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.flash-panel .flash-reason:empty { display: none; }
.flash-muted { color: var(--text-dim); }
.flash-panel .flash-instructions { color: var(--text-dim); line-height: 1.55; font-size: 12.5px; }
.flash-panel .flash-instructions p { margin: 0 0 6px; }
.flash-panel .flash-instructions strong { color: var(--text); font-weight: 500; }
.flash-panel .flash-needs { font-size: 11.5px; color: var(--text-dim); }
.flash-panel .flash-notice {
  padding: 8px 10px;
  border: 1px solid var(--warn);
  border-radius: 4px;
  background: var(--warn-bg);
  font-size: 12px;
  line-height: 1.5;
}
.flash-panel .flash-notice p { margin: 0; }
.flash-panel .flash-prompt,
.flash-panel .flash-confirm {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel-alt);
  font-size: 12.5px;
  line-height: 1.5;
}
.flash-panel .flash-prompt p, .flash-panel .flash-confirm p { margin: 0 0 8px; }
.flash-panel .flash-prompt ul { margin: 0 0 8px; padding-left: 1.4em; }
.flash-panel .flash-prompt input[type="text"] { font-family: var(--mono-font); width: 11em; }
.flash-panel .flash-prompt input.bad { border-color: var(--danger); }
.flash-table { border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.flash-table td { padding: 2px 10px 2px 0; vertical-align: top; }
.flash-table td:first-child { color: var(--text-dim); white-space: nowrap; }
.flash-nodes { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.flash-node { display: flex; align-items: center; gap: 6px; font-family: var(--mono-font); font-size: 12px; cursor: pointer; }
.flash-node input { accent-color: var(--accent); }
.flash-node-uuid { margin: 0 0 8px; }
.flash-node-uuid > summary { color: var(--text-dim); cursor: pointer; margin-bottom: 6px; }
.flash-progress-wrap { display: flex; flex-direction: column; gap: 4px; }
.flash-phase { font-size: 12px; color: var(--text-dim); }
.flash-result {
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.55;
}
.flash-result p { margin: 0 0 6px; overflow-wrap: anywhere; }
.flash-result.ok { border-color: var(--ok); }
.flash-result.ok strong { color: var(--ok); }
.flash-result.error { border-color: var(--danger); background: var(--danger-bg); }
.flash-result.error strong { color: var(--danger); }
.flash-hint {
  margin: 0 0 6px;
  padding: 6px 8px;
  background: var(--log-bg);
  color: var(--log-text);
  border-radius: 4px;
  font-family: var(--mono-font);
  font-size: 11.5px;
  white-space: pre-wrap;
}
.flash-log { max-height: 200px; }
.flash-help-body p { margin-top: 6px; color: var(--text-dim); line-height: 1.55; }
.flash-fixes { margin: 6px 0 0 18px; color: var(--text); line-height: 1.55; font-size: 12.5px; }
.flash-fixes li { margin-bottom: 6px; }
.flash-compact .card-head h2 { font-size: 13px; }

/* What gets written, one row per image, checked off as the flash runs. */
.flash-writes { list-style: none; border: 1px solid var(--border); border-radius: 10px; }
.flash-write { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; }
.flash-write + .flash-write { border-top: 1px solid var(--border); }
.fw-icon { width: 20px; display: inline-flex; justify-content: center; color: var(--text-muted); font-size: 12px; flex: none; }
.flash-write.ok .fw-icon { color: var(--ok); }
.flash-write.bad .fw-icon { color: var(--danger); }
.flash-write.skip { color: var(--text-muted); }
.fw-name { min-width: 0; }
.fw-addr { margin-left: auto; font-family: var(--mono-font); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.flash-steps { margin: 0 0 4px 20px; color: var(--text); font-size: 13px; line-height: 1.6; }
.flash-panel .flash-instructions .flash-steps strong { font-weight: 600; }
.flash-device { display: flex; align-items: center; gap: 7px; color: var(--ok); font-size: 12.5px; overflow-wrap: anywhere; }
.flash-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.flash-warn { color: var(--warn); }
.flash-result.ok { background: color-mix(in srgb, var(--ok) 8%, transparent); }

/* --- Narrow screens --- */

@media (max-width: 900px) {
  .modal-backdrop { padding: 0; }
  .modal { width: 100%; height: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .gen-spacer { display: none; }
}

@media (max-width: 640px) {
  /* The box takes the width less the gutter; the top bar keeps one row,
     the chip down to its dot and the buttons to one word. */
  .top { padding: 8px var(--gutter); gap: 2px; }
  .top .wide-only, .status-chip .chip-text { display: none; }
  .status-pop { position: fixed; top: 48px; left: var(--gutter); right: var(--gutter); width: auto; }
  .top button, .top .file-btn { padding: 6px 8px; }
  .center { padding: 8px var(--gutter) 32px; }
  .wiz-body { padding: 18px 16px 6px; }
  .wiz-foot { padding: 12px 16px 14px; flex-wrap: wrap; }
  .wiz-foot .hint { flex-basis: 100%; order: -1; }
  .wiz-foot .hint:empty { display: none; }
  .wiz-foot > :last-child { margin-left: auto; }
  .steps { padding: 14px 16px 0; }
  .tabs { margin: 0 -16px 14px; padding: 0 16px; }
  .fw { grid-template-columns: minmax(0, 1fr); }
  .seg2 { display: flex; }
  .seg2 button { flex: 1; }
  .fw .ver { flex-wrap: wrap; }
  /* The Method field takes a row of its own when it does not fit beside the title. */
  .flash-panel .card-head { flex-wrap: wrap; }
  .field { flex: 1 1 auto; min-width: 0; }
  .field select { flex: 1; min-width: 0; }

  /* The tree is one column: prompt, then its control on the next line when
     they do not fit; names wrap; help opens inline. */
  .kc-scroll { padding: 6px 8px 10px; }
  .kc-row .kc-name { margin-left: 0; flex-basis: 100%; order: 10; }
  .kc-symbol .kc-row > .kc-prompt, .kc-choice .kc-row > .kc-prompt { flex: 1 1 60%; }
  .kc-select, .kc-input, .kc-input.kc-string { flex: 1 1 100%; width: auto; }
  .kc-children { margin-left: 6px; padding-left: 6px; }
  .kc-help, .kc-error, .kc-notes, .kc-editor { margin-left: 4px; }
  .form-pair { grid-template-columns: 1fr; }
  .opt-value-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
}
