/*
 * Dense, functional, dark by default to match KiCad's PCB editor (spec §6.8).
 * Legibility of the change list over decoration.
 */

:root {
  --bg: #1b1b1f;
  --bg-panel: #232329;
  --bg-raised: #2b2b33;
  --bg-input: #17171b;
  --fg: #e4e4ea;
  --fg-dim: #9a9aa8;
  --fg-faint: #6c6c7a;
  --border: #3a3a45;
  --accent: #4a9eff;

  --pass: #3fb950;
  --pass-bg: #10241a;
  --fail: #f85149;
  --fail-bg: #2a1416;
  --warn: #e3b341;
  --warn-bg: #2a2312;

  --added: #3fb950;
  --removed: #f85149;
  --modified: #e3b341;
  --unsupported: #d24bd2;
  --region: #4a9eff;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 380px 1fr 340px;
  grid-template-rows: 100%;
  height: 100vh;
}

/*
 * Below this width the right column moves under the board rather than being
 * hidden. It holds Regions and Merge — choosing a region is not optional, so
 * dropping the column would make the tool unusable on a laptop screen.
 */
@media (max-width: 1200px) {
  .app {
    grid-template-columns: 330px 1fr;
    grid-template-rows: 1fr auto;
  }
  .col-left { grid-row: 1 / 3; }
  .col-main { grid-row: 1; grid-column: 2; }
  .col-right {
    grid-row: 2;
    grid-column: 2;
    border-left: 0;
    border-top: 1px solid var(--border);
    max-height: 42vh;
  }
}

/*
 * The column scrolls as one document, and every section heading is pinned.
 *
 * Headings you have scrolled past stack at the top; headings you have not
 * reached yet stack at the bottom; the content between the two stacks is the
 * section you are reading. Scrolling moves a heading from one stack to the
 * other, so the whole set of sections is visible at all times and a heading is
 * somewhere to jump to rather than something to fold.
 *
 * `display: contents` on the section wrapper is what makes this work. A sticky
 * element is confined to its parent's box, so a heading wrapped in its own
 * section disappears the moment that section scrolls past. With the wrapper
 * generating no box, the heading's containing block is the scrolling column and
 * it can pin anywhere in it.
 */
.col {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
}
.col > .panel { display: contents; }
/*
 * Pinned above the section stack, and above the sections' own headers: the
 * brand header and the way out of merge mode are not things to scroll back up
 * for. `top` is set from the measured height of whatever precedes them, so a
 * column can pin more than one.
 */
.col > .pinned-top { position: sticky; top: 0; z-index: 5; }
.col > .panel > .panel-content { border-bottom: 1px solid var(--border); }

.col-right { border-right: 0; border-left: 1px solid var(--border); }
.col-main {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- panels --------------------------------------------------------------- */

.panel > h2 {
  position: sticky;
  /* Sections stack below anything the column pins above them. */
  top: calc(var(--stack-top-offset, 0px) + var(--panel-above, 0) * var(--panel-head-h));
  bottom: calc(var(--panel-below, 0) * var(--panel-head-h));
  z-index: 3;
  height: var(--panel-head-h);
  box-sizing: border-box;
  box-shadow: 0 1px 0 var(--border);
  margin: 0;
  padding: 8px 12px 8px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.panel > h2:hover { color: var(--fg); background: #32323c; }
.panel > h2 > svg { flex: 0 0 auto; opacity: 0.75; }
.panel > h2:hover > svg { opacity: 1; }
.panel > h2 .panel-title { flex: 1 1 auto; }
.panel > h2 .count {
  color: var(--fg-faint);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  flex: 0 0 auto;
}
.panel-body { padding: 10px 12px; }
.panel-body > * + * { margin-top: 8px; }

.title-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.title-bar .brand-mark { width: 40px; height: 40px; flex: 0 0 auto; }
.title-bar .brand-text { flex: 1 1 auto; min-width: 0; }
/* Typewriter mono, matching the wordmark drawn into the logo itself. */
.title-bar h1 {
  margin: 0;
  font-family: 'Courier New', Courier, 'JetBrains Mono', var(--mono);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.title-bar .tagline {
  margin: 3px 0 0;
  font-family: 'Courier New', Courier, var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--fg-faint);
}
.title-bar .about-button { flex: 0 0 auto; align-self: center; }

/* --- controls -------------------------------------------------------------- */

button {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
button.danger { background: var(--fail); border-color: var(--fail); color: #1a0808; font-weight: 600; }
button.sm { padding: 3px 7px; font-size: 11px; }

input[type="text"], input[type="number"], select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

label { display: block; font-size: 11px; color: var(--fg-dim); }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.row.fill > * { flex: 1 1 0; }

.checkbox { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--fg); }
.checkbox input { margin-top: 2px; flex: 0 0 auto; width: auto; }

/* --- file drop ------------------------------------------------------------- */

.dropzone {
  border: 1px dashed var(--border);
  border-radius: 5px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-input);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #1c2430; }
.dropzone .slot { font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.dropzone .name { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.dropzone .meta { font-size: 11px; color: var(--fg-dim); }
.dropzone.loaded { border-style: solid; }

/* --- verdict --------------------------------------------------------------- */

.verdict {
  padding: 14px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.verdict .word { font-size: 34px; font-weight: 800; letter-spacing: 0.1em; line-height: 1; }
.verdict .sub { font-size: 12px; margin-top: 4px; }
.verdict.pass { background: var(--pass-bg); color: var(--pass); }
.verdict.fail { background: var(--fail-bg); color: var(--fail); }
.verdict.idle { background: var(--bg-raised); color: var(--fg-faint); }
.verdict.idle .word { font-size: 18px; font-weight: 600; letter-spacing: 0.04em; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  padding: 4px 12px;
  border-bottom: 1px solid #2c2c34;
  font-size: 12px;
  /* Every row carries its full explanation as a tooltip. */
  cursor: help;
}
.checklist li:last-child { border-bottom: 0; }
.checklist .id { font-family: var(--mono); font-size: 12px; text-align: center; }
.checklist li.ok .id { color: var(--pass); }
.checklist li.bad .id { color: var(--fail); font-weight: 700; }
.checklist li.bad .what { color: var(--fail); font-weight: 600; }
.checklist .what { color: var(--fg); }
.checklist .why { color: var(--fg-faint); font-size: 11px; }

.violation {
  border-left: 3px solid var(--fail);
  background: #241417;
  padding: 6px 8px;
  margin: 6px 0;
  cursor: pointer;
}
.violation.overridable { border-left-color: var(--warn); background: #241f12; }
.violation:hover { filter: brightness(1.2); }
.violation .vt { font-size: 12px; }
.violation .vd { font-size: 11px; color: var(--fg-dim); margin-top: 2px; }
.violation { cursor: help; }
.violation .tag {
  font-size: 10px;
  padding: 0 5px;
  border-radius: 3px;
  background: #00000055;
  margin-right: 5px;
  white-space: nowrap;
}
.fields { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); margin-top: 3px; }
.fields div { white-space: pre-wrap; word-break: break-all; }

/* --- change list ------------------------------------------------------------ */

.changes { list-style: none; margin: 0; padding: 0; }
.changes li {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 3px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 12px;
}
.changes li:hover { background: var(--bg-raised); }
/* Leaves room above and below when a selection is scrolled into view, so the
   current row never ends up flush against the edge of the panel. */
.changes li { scroll-margin: 56px 0; }
.changes li.selected {
  background: #22303f;
  border-left-color: var(--accent);
  color: #fff;
  outline: 1px solid #3d6a99;
  outline-offset: -1px;
}
.changes li.selected .txt { font-weight: 600; }
.changes li.selected .where { color: var(--fg-dim); }
.changes .glyph { font-family: var(--mono); width: 12px; flex: 0 0 auto; text-align: center; }
.changes li.added .glyph { color: var(--added); }
.changes li.removed .glyph { color: var(--removed); }
.changes li.modified .glyph, .changes li.moved .glyph { color: var(--modified); }
.changes .txt { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/*
 * A change outside the region under test is marked by its left edge alone. The
 * word used to sit at the end of every row, which cost a column and — on a panel
 * with many regions, where most changes are outside the active one — said
 * nothing useful. The full verdict is in the row's tooltip.
 */
.changes li.outside { border-left-color: rgba(248, 81, 73, 0.55); }

.group-head {
  padding: 4px 12px;
  font-size: 11px;
  color: var(--fg-dim);
  background: #1f1f25;
  font-family: var(--mono);
}

/* --- map -------------------------------------------------------------------- */

.map-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-wrap: wrap;
}
.map-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
canvas { display: block; width: 100%; height: 100%; cursor: grab; }
canvas.dragging { cursor: grabbing; }

.map-note {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: #000000bb;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--fg-dim);
  max-width: 460px;
  pointer-events: none;
}
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; align-items: center; }
.legend i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; vertical-align: -1px; border: 1px solid; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #06121f; font-weight: 600; }

/* --- misc ------------------------------------------------------------------- */

.empty { color: var(--fg-faint); font-size: 12px; font-style: italic; }
.note { font-size: 11px; color: var(--fg-dim); }
.note.warn { color: var(--warn); }
.note.bad { color: var(--fail); }
.mono { font-family: var(--mono); }

pre.report {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  margin: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre;
}

.banner {
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.banner.bad { background: var(--fail-bg); color: var(--fail); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }

.region-item {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #2c2c34;
}
.region-item:last-child { border-bottom: 0; }
.region-item .nm { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.region-item input[type="radio"] { width: auto; flex: 0 0 auto; }
.region-item .dims { font-family: var(--mono); font-size: 10px; color: var(--fg-faint); }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 4px;
}

/* --- rendered board view ---------------------------------------------------- */

.layer-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  overflow-x: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}
.layer-bar .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-faint);
  flex: 0 0 auto;
}
.layer-bar .chip.on { color: var(--fg); border-color: var(--fg-faint); background: var(--bg-raised); }
.layer-bar .chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.35;
}
.layer-bar .chip.on .dot { opacity: 1; }
/* Beside the buttons, not after the chips: the bar scrolls sideways and
   anything at the far end is invisible on a board with many layers. */
.layer-bar .layer-hint { flex: 0 0 auto; padding: 0 10px 0 6px; }

.view-footer {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 5px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 11px;
  flex: 0 0 auto;
}

input[type="range"].blend {
  width: 150px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.blend-label { min-width: 82px; display: inline-block; }
.swatch-a { color: #5b8dd6; font-weight: 700; }
.swatch-b { color: #e0703a; font-weight: 700; }
.map-toolbar .keys { margin-left: auto; }


/* --- view option toggles ----------------------------------------------------- */

button.toggle,
button.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* A real checkbox: a highlighted button alone reads as "press me" as much as
   "this is on", which is the ambiguity this removes. */
button.toggle .box {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 1px solid var(--fg-faint);
  border-radius: 2px;
  background: var(--bg-input);
  position: relative;
}
button.toggle.on { color: var(--fg); border-color: var(--accent); }
button.toggle.on .box { background: var(--accent); border-color: var(--accent); }
button.toggle.on .box::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 3px;
  height: 7px;
  border: solid #06121f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
button.toggle:not(.on) { color: var(--fg-faint); }
button.with-icon > svg { opacity: 0.85; }


/* --- source panel: local files or a git repository ---------------------------- */

.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1 1 0; }

.ref-picker { margin-top: 8px; }
.ref-picker select { font-family: var(--mono); font-size: 11px; }

.repo-error { margin: 8px 0; }
.repo-error .note { color: inherit; opacity: 0.85; margin-top: 4px; }

a.note { color: var(--accent); text-decoration: none; display: inline-block; }
a.note:hover { text-decoration: underline; }

/* --- working overlay ---------------------------------------------------------- */

.app { position: relative; }

/*
 * Shown while something blocking runs. It only helps if the browser has painted
 * it *before* the work starts — see nextPaint() — otherwise the tab just
 * freezes with no overlay, which is what this replaces.
 */
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #0e0e12cc;
  z-index: 100;
  cursor: progress;
}
.overlay.on { display: flex; }

.overlay-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 30px #00000066;
  max-width: 70%;
}
.overlay-text { font-size: 13px; color: var(--fg); }

.spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
}

/* --- change rows: what changed, not just which object ------------------------- */

.changes .txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.changes .txt .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changes .txt .detail {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.changes li.selected .txt .detail { color: #b9d4ef; }
.changes li { align-items: flex-start; }


/* --- branding ------------------------------------------------------------------ */

/*
 * The logo stands in for the board while there is nothing to draw, so the canvas
 * reads as "waiting for a file" rather than as a rendering failure.
 */
.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 65%;
  height: 65%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.watermark.on { opacity: 0.16; }

.view-footer .credit { margin-left: auto; opacity: 0.55; }
.view-footer .credit a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.view-footer .credit a:hover { color: var(--accent); }

/* --- splash --------------------------------------------------------------------- */

.splash {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Nearly opaque: the interface behind is a hint of what is coming, not a
     competing thing to read. */
  background: #12121aef;
  cursor: pointer;
  transition: opacity 0.35s ease;
}
.splash.leaving { opacity: 0; }
.splash-logo {
  width: min(46vh, 34vw);
  height: auto;
  animation: splash-in 0.45s ease-out;
}
@keyframes splash-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .splash, .splash-logo, .watermark { transition: none; animation: none; }
}

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

.dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0b10cc;
  padding: 24px;
}
.dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 50px #00000088;
  max-width: 520px;
  width: 100%;
  max-height: 100%;
  overflow: auto;
}
.dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.dialog-logo { width: 52px; height: 52px; flex: 0 0 auto; }
.dialog-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.dialog-head .tagline {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--fg-faint);
}
.dialog-close { margin-left: auto; align-self: flex-start; font-size: 14px; line-height: 1; }
.dialog-body { padding: 16px 18px; font-size: 12.5px; }
.dialog-body > * + * { margin-top: 12px; }
.dialog-body p { margin: 0; }
.dialog-body a { color: var(--accent); text-decoration: none; }
.dialog-body a:hover { text-decoration: underline; }
.dialog-link {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-raised);
}
.dialog-link:hover { border-color: var(--accent); text-decoration: none; }
.dialog-body .disclaimer {
  font-size: 11.5px;
  color: var(--fg-dim);
  border-left: 3px solid var(--warn);
  padding-left: 10px;
}

.map-wrap .view-error { position: absolute; top: 0; left: 0; right: 0; z-index: 2; }

/* --- merge mode ------------------------------------------------------------- */

/*
 * Browsing gets the whole width; the right column only exists while choosing
 * what to merge. Nothing in browse mode is one click from producing a file.
 */
.app { grid-template-columns: 380px 1fr 0; }
.app.merging { grid-template-columns: 380px 1fr 360px; }
.app:not(.merging) .col-right { border-left: 0; overflow: hidden; }
@media (max-width: 1200px) {
  .app, .app.merging { grid-template-columns: 330px 1fr; }
}

.verdict.same { background: var(--bg-raised); color: var(--fg-dim); }
.verdict.differs { background: var(--bg-raised); color: var(--fg); }
.verdict.same .word, .verdict.differs .word { font-size: 20px; font-weight: 600; letter-spacing: 0.02em; }

.start-merge { padding: 10px 12px; border-top: 1px solid var(--border); text-align: center; }
.start-merge button { width: 100%; }
.start-merge .note { margin-top: 6px; }

.merge-mode {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}
.merge-mode .badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #06121f;
  font-weight: 600;
}

/* --- selections -------------------------------------------------------------- */

.selection { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.selection:last-child { border-bottom: 0; }
.selection-head { display: flex; gap: 6px; align-items: center; }
.selection-head .chev { background: none; border: 0; padding: 0 2px; cursor: pointer; opacity: 0.75; }
.selection-head .chev:hover { opacity: 1; }
.selection-head .selection-name {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 4px;
}
.selection-head .selection-name:hover { border-color: var(--border); }
.selection-head.active .selection-name { font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; display: inline-block; }
.selection-summary { font-size: 11px; color: var(--fg-dim); padding: 2px 0 0 24px; }
.straddlers { margin: 6px 0 0 24px; }
.straddlers .note { margin-bottom: 4px; }

.selection-changes { list-style: none; margin: 6px 0 0; padding: 0 0 0 20px; max-height: 220px; overflow-y: auto; }
.selection-changes li { display: flex; gap: 6px; align-items: flex-start; font-size: 11px; padding: 1px 0; }
.selection-changes li.sel { background: var(--bg-raised); }
.selection-changes input { margin: 2px 0 0; flex: 0 0 auto; width: auto; }
.selection-changes .what { cursor: pointer; color: var(--fg-dim); }
.selection-changes .what:hover { color: var(--fg); }

/* --- effects and issues ------------------------------------------------------- */

.globals { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.effects { display: flex; flex-direction: column; gap: 3px; }
.effect { font-size: 12px; padding: 3px 6px; border-left: 3px solid var(--border); }
.effect.neutral { color: var(--fg); }
.effect.warn { color: var(--warn); border-left-color: var(--warn); background: var(--warn-bg); }
.effect.danger { color: var(--fail); border-left-color: var(--fail); background: var(--fail-bg); }

.issue { border-left: 3px solid var(--border); padding: 6px 8px; margin: 6px 0; }
.issue.blocker { border-left-color: var(--fail); background: var(--fail-bg); }
.issue.confirm { border-left-color: var(--warn); background: var(--warn-bg); }
.issue.warning { border-left-color: var(--warn); }
.issue .vt { font-size: 12px; font-weight: 600; }
.issue .vd { font-size: 11px; color: var(--fg-dim); margin-top: 2px; }

.violation.informational { border-left-color: var(--fg-faint); background: var(--bg-input); }
.checklist li.note .id { color: var(--fg-dim); }

/* A change nothing claims: the dangerous half of a per-change merge. */
.changes-item.unselected { opacity: 0.55; }
.changes-item .claims { display: inline-flex; gap: 2px; margin-right: 4px; flex: 0 0 auto; }

/* --- section headers ------------------------------------------------------------ */

:root {
  --panel-head-h: 33px;
  --merge-banner-h: 31px;
}



/* --- leaving merge mode ---------------------------------------------------------- */

/*
 * Pinned above the section stack. The way out of merge mode must not be
 * something you have to scroll back up to find.
 */
.merge-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
button.exit-merge {
  border-color: var(--accent);
  color: var(--accent);
  flex: 0 0 auto;
  text-transform: none;
  letter-spacing: 0;
}
button.exit-merge:hover:not(:disabled) { background: var(--accent); color: #06121f; }

/* --- Board A is a merge result ---------------------------------------------- */

/*
 * Pinned over the canvas, not placed in a column: it is a statement about what
 * is on the canvas, and it must be impossible to scroll away from. Losing track
 * of the fact that the board in front of you is a merge — and that it is not on
 * disk — is the mistake this exists to prevent.
 */
.merged-notice {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 20px);
  padding: 7px 9px;
  border-radius: 5px;
  border: 1px solid var(--warn);
  background: #2a2312ee;
  box-shadow: 0 2px 10px #0008;
}
.merged-notice.on { display: flex; }
.merged-notice .merged-text { display: flex; flex-direction: column; min-width: 0; }
.merged-notice strong { font-size: 12px; color: var(--warn); }
.merged-notice span { font-size: 11px; color: var(--fg-dim); }
.merged-notice button { flex: 0 0 auto; border-color: var(--warn); color: var(--warn); }
.merged-notice button:hover:not(:disabled) { background: var(--warn); color: #1a1408; }

/* The merged file's way out, in the panel that owns Board A's identity. */
.merged-source {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.merged-source .row button { flex: 1 1 auto; }
