/* Software Automation: line-fit explorer and perceptron stepper.
   Uses the theme's custom properties so light and dark mode both work. */
.auto-lab {
  --auto-ok: #cfe8d6;  --auto-ok-ink: #123d26;
  --auto-bad: #f6c4bd; --auto-bad-ink: #5c1410;
  --auto-next: #f6e0a8;
  --auto-one: var(--primary);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.1rem 1.2rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  min-width: 0;
}
[data-theme="dark"] .auto-lab {
  --auto-ok: #21503a;  --auto-ok-ink: #d8f3e3;
  --auto-bad: #6b2a26; --auto-bad-ink: #fde0dc;
  --auto-next: #5d4a12;
}
.auto-lab h4 { margin: 0 0 .25rem; font-size: 1.05rem; }
.auto-lead { margin: 0 0 .9rem; color: var(--text-secondary); font-size: .92rem; }
.auto-muted { color: var(--text-secondary); }

.auto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; align-items: start; }
.auto-plotbox { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-tertiary); padding: .5rem; }
.auto-plotbox-sq { max-width: 22rem; }
.auto-side { min-width: 0; display: grid; gap: .75rem; }
.auto-plot { display: block; width: 100%; height: auto; }
.auto-plotnote { margin: .4rem .2rem .1rem; font-size: .82rem; }

/* Plot marks */
.auto-grid-line { stroke: var(--border); stroke-width: 1; }
.auto-box { fill: none; stroke: var(--border-strong); stroke-width: 1.2; }
.auto-tick { fill: var(--text-secondary); font: 500 11.5px var(--font-body, sans-serif); }
.auto-axis { fill: var(--text-secondary); font: 600 12px var(--font-body, sans-serif); }
.auto-point { fill: var(--primary); stroke: var(--surface); stroke-width: 1.5; }
.auto-fitline { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.auto-resid { stroke: #c2410c; stroke-width: 2; stroke-dasharray: 4 3; }
[data-theme="dark"] .auto-resid { stroke: #fb923c; }
.auto-pt-one { fill: var(--primary); stroke: var(--primary); stroke-width: 2; }
.auto-pt-zero { fill: var(--surface); stroke: var(--primary); stroke-width: 2.5; }
.auto-pt-label { font: 700 12px var(--font-mono, monospace); fill: var(--text-primary); pointer-events: none; }
.auto-pt-one + .auto-pt-label { fill: var(--text-inverse, #fff); }

/* Controls */
.auto-fields { display: grid; gap: .7rem; }
.auto-field { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; align-items: center; }
.auto-field label { font-weight: 700; font-size: .85rem; }
.auto-field input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--primary); min-height: 1.5rem; }
.auto-val { font-family: var(--font-mono); font-size: .85rem; }
.auto-stats { display: grid; gap: .15rem; }
.auto-stat { margin: 0; font-family: var(--font-mono); font-size: .85rem; overflow-wrap: anywhere; }
.auto-verdict { margin: 0; padding: .5rem .7rem; border-radius: var(--radius-md); background: var(--bg-tertiary); border: 1px solid var(--border); font-size: .9rem; }
.auto-verdict.auto-good { background: var(--auto-ok); color: var(--auto-ok-ink); border-color: transparent; }
.auto-verdict.auto-badmsg { background: var(--auto-bad); color: var(--auto-bad-ink); border-color: transparent; }
.auto-btnrow { display: flex; flex-wrap: wrap; gap: .45rem; }
.auto-btn, .auto-tab {
  font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; min-height: 2.5rem;
  padding: .4rem .85rem; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--bg-tertiary); color: var(--text-primary);
}
.auto-btn:hover, .auto-tab:hover { background: var(--surface-hover); }
.auto-btn-primary, .auto-tab[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--text-inverse, #fff); }
.auto-btn-primary:hover, .auto-tab[aria-pressed="true"]:hover { background: var(--primary-dark); }
.auto-btn:focus-visible, .auto-tab:focus-visible, .auto-field input:focus-visible, .auto-history summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auto-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }

/* Perceptron table and log */
.auto-tablewrap { overflow-x: auto; }
.auto-table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.auto-table th, .auto-table td { padding: .35rem .6rem; border-bottom: 1px solid var(--border); text-align: center; }
.auto-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.auto-table td.auto-ok { color: var(--auto-ok-ink); background: var(--auto-ok); font-weight: 700; }
.auto-table td.auto-bad { color: var(--auto-bad-ink); background: var(--auto-bad); font-weight: 700; }
.auto-table tr.auto-next td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.auto-table tr.auto-next td:not(.auto-ok):not(.auto-bad) { background: var(--auto-next); }
.auto-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auto-detail { font-size: .88rem; min-height: 6.5rem; }
.auto-detail p { margin: 0 0 .35rem; }
.auto-history { font-size: .85rem; }
.auto-history summary { cursor: pointer; font-weight: 600; }
.auto-loglist { margin: .4rem 0 0; padding-left: 1.3rem; font-family: var(--font-mono); font-size: .8rem; }

@media (max-width: 520px) {
  .auto-table th, .auto-table td { padding: .35rem .25rem; }
  .auto-table th { font-size: .68rem; letter-spacing: 0; }
  .auto-lab { padding: .9rem .8rem 1rem; }
  .auto-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .auto-btn, .auto-tab { transition: background-color .15s ease; }
}

/* Labs built on the shared kit (css/labs.css) */
.lab .lab-stage svg { color: var(--text-secondary); }
.auto-txt { fill: var(--text-secondary); font-family: var(--font-body); font-size: calc(13px * var(--u, 1)); }
.auto-grid { stroke: var(--border); stroke-width: 1; }
.auto-k0 { --kc: #2a6f73; } .auto-k1 { --kc: #c0392b; } .auto-k2 { --kc: #a6720a; } .auto-k3 { --kc: #5b4bdb; }
[data-theme="dark"] .auto-k0 { --kc: #58c0c6; } [data-theme="dark"] .auto-k1 { --kc: #ff8a7a; } [data-theme="dark"] .auto-k2 { --kc: #e6b84d; } [data-theme="dark"] .auto-k3 { --kc: #9a8dff; }
.auto-link { stroke: var(--kc); stroke-width: 1; opacity: .3; }
.auto-pt { fill: var(--kc); stroke: var(--surface); stroke-width: 1.5; }
.auto-pt-none { fill: var(--bg-tertiary); stroke: var(--text-muted); stroke-width: 1.5; }
.auto-cent { fill: none; stroke: var(--kc); stroke-width: 4; stroke-linecap: round; }
.auto-cent-halo { fill: none; stroke: var(--surface); stroke-width: 8; stroke-linecap: round; }
.auto-curve { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; }
.auto-thr { stroke: var(--text-primary); stroke-width: 1.5; stroke-dasharray: 5 4; }
.auto-zone { fill: var(--primary); opacity: .1; }
.auto-dot-pass { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.auto-dot-fail { fill: var(--surface); stroke: var(--primary); stroke-width: 2.5; }
.auto-wrong { fill: none; stroke: #d9534a; stroke-width: 3; }
.auto-legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; list-style: none; margin: .2rem 0 .8rem; padding: 0; font-size: .82rem; color: var(--text-secondary); }
.auto-legend li { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.auto-sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box; }
.auto-sw.is-pass { background: var(--primary); }
.auto-sw.is-fail { background: var(--surface); border: 2.5px solid var(--primary); }
.auto-sw.is-wrong { width: 18px; height: 18px; border: 3px solid #d9534a; }
.auto-rl-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; margin: .8rem 0; }
.auto-rl-cell { display: grid; align-content: start; justify-items: center; gap: .1rem; min-width: 0; min-height: 5.2rem; padding: .45rem .15rem; border: 2px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-tertiary); text-align: center; }
.auto-rl-cell.is-pit { border-color: #d9534a; background: var(--lab-bad); color: var(--lab-bad-ink); }
.auto-rl-cell.is-goal { border-color: #2f9461; background: var(--lab-good); color: var(--lab-good-ink); }
.auto-rl-id { font: 700 .66rem var(--font-mono); letter-spacing: 0; text-transform: uppercase; color: var(--text-secondary); }
.is-pit .auto-rl-id, .is-goal .auto-rl-id { color: inherit; }
.auto-rl-sym { font: 700 1.5rem/1.2 var(--font-display); }
.is-pit .auto-rl-sym, .is-goal .auto-rl-sym { font-size: 1rem; }
.auto-rl-sub { font-size: .72rem; color: var(--text-secondary); }
.is-pit .auto-rl-sub, .is-goal .auto-rl-sub { color: inherit; font-weight: 700; }
.auto-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem 1.6rem; margin: .8rem 0; }
.auto-bar-line { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr) 3rem; gap: .5rem; align-items: center; margin: .3rem 0; font-size: .88rem; }
.auto-bar-line b { text-align: right; font-variant-numeric: tabular-nums; }
.auto-bar-gap { margin: .3rem 0 0; font-size: .88rem; font-weight: 700; }
@media (max-width: 560px) { .auto-rl-sym { font-size: 1.25rem; } .auto-rl-w { display: none; } .auto-rl-id { font-size: .75rem; } }
