/* styles for the Ender 3 S1 firmware configurator */
  :root { --bg:#0b0f16; --panel:#121824; --panel2:#171f2e; --line:#232d3f; --ink:#e7ecf5;
          --muted:#8b97ab; --accent:#4c8dff; --good:#43d17c; --bad:#ff5a52; --warn:#ffb020;
          color-scheme: dark; }
  * { box-sizing: border-box; }
  body { margin:0; background:var(--bg); color:var(--ink);
         font:15px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
  a { color:var(--accent); }
  code { font-family:ui-monospace,monospace; font-size:.85em; }
  .topbar { position:sticky; top:0; z-index:20; display:flex; justify-content:space-between;
            gap:20px; align-items:flex-start; padding:12px 22px; background:rgba(11,15,22,.95);
            backdrop-filter:blur(8px); border-bottom:1px solid var(--line); }
  .brand h1 { font-size:1.05rem; margin:0 0 2px; }
  .brand p { margin:0; color:var(--muted); font-size:.8rem; max-width:62ch; }
  .controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
  .controls label { font-size:.72rem; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
  select, input[type=search], input[type=password] { background:var(--panel2); color:var(--ink);
      border:1px solid var(--line); border-radius:8px; padding:7px 9px; font:inherit; font-size:.87rem; }
  main { display:grid; grid-template-columns:minmax(0,1fr) 400px; gap:18px; padding:16px 22px 60px; align-items:start; }
  @media (max-width:1050px) { main { grid-template-columns:1fr; } .side { order:-1; } }
  .toolbar { display:flex; gap:10px; align-items:center; margin-bottom:10px; }
  .toolbar input { flex:1; }
  .groups { display:flex; flex-direction:column; gap:12px; }
  .group { background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
  .group > h2 { margin:0; padding:9px 13px; font-size:.7rem; letter-spacing:.12em; text-transform:uppercase;
                color:var(--muted); background:var(--panel2); border-bottom:1px solid var(--line);
                display:flex; justify-content:space-between; cursor:pointer; }
  .group.collapsed .row { display:none; }
  .row { display:grid; grid-template-columns:22px 1fr auto; gap:10px; align-items:start;
         padding:9px 13px; border-bottom:1px solid rgba(35,45,63,.55); cursor:pointer; }
  .row:last-child { border-bottom:none; }
  .row:hover { background:rgba(76,141,255,.05); }
  .row.changed { box-shadow:inset 3px 0 0 var(--accent); }
  .row input { margin:3px 0 0; width:15px; height:15px; accent-color:var(--accent); }
  .row .name { font-weight:600; font-size:.9rem; }
  .row .sub { color:var(--muted); font-size:.8rem; margin-top:2px; }
  .row .cost { font-family:ui-monospace,monospace; font-size:.78rem; color:var(--good); white-space:nowrap; }
  .side { position:sticky; top:74px; display:flex; flex-direction:column; gap:12px; max-height:calc(100vh - 92px); overflow-y:auto; }
  .card { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:14px; }
  .card > h2 { margin:0 0 10px; font-size:.72rem; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); }
  .card label { display:block; font-size:.76rem; color:var(--muted); margin:8px 0 4px; }
  .card select { width:100%; }
  .presets { display:flex; gap:6px; margin-bottom:10px; flex-wrap:wrap; }
  .preset { flex:1 1 auto; padding:7px 8px; font-size:.76rem; border-radius:8px; cursor:pointer;
            background:var(--panel2); color:var(--ink); border:1px solid var(--line); }
  .preset.active { background:rgba(76,141,255,.18); border-color:var(--accent); }
  .radiogroup { display:flex; gap:6px; flex-wrap:wrap; }
  .radio { display:flex; align-items:center; gap:6px; flex:1 1 42%; padding:6px 8px;
           border:1px solid var(--line); border-radius:8px; background:var(--panel2); font-size:.78rem; cursor:pointer; }
  .radio.on { border-color:var(--accent); background:rgba(76,141,255,.16); }
  .budget-head { display:flex; justify-content:space-between; font-size:.8rem; margin:10px 0 6px; }
  .bar { height:8px; background:#0d1220; border-radius:4px; overflow:hidden; position:relative; }
  .bar-used { height:100%; width:100%; transform:scaleX(0); transform-origin:left;
              background:linear-gradient(90deg,#3d7be0,#6aa6ff); transition:transform .18s ease-out; }
  .bar.over .bar-used { background:linear-gradient(90deg,#a33,var(--bad)); }
  .budget-foot { display:flex; justify-content:space-between; font-size:.76rem; color:var(--muted);
                 margin-top:5px; font-variant-numeric:tabular-nums; }
  .delta { font-size:.82rem; margin:8px 0 0; }
  .delta.good { color:var(--good); } .delta.bad { color:var(--bad); }
  .hint { color:var(--muted); font-size:.78rem; margin:8px 0 0; }
  .mono { font-family:ui-monospace,monospace; font-variant-numeric:tabular-nums; }
  .primary { display:block; width:100%; margin-top:12px; padding:11px 12px; border-radius:9px;
             border:1px solid var(--accent); background:var(--accent); color:#06101f; font-weight:700;
             font-size:.92rem; cursor:pointer; }
  .primary[disabled] { opacity:.45; cursor:not-allowed; }
  /* the Build button carries the status, so each state needs a readable colour:
     green text on the blue accent was illegible */
  #build.busy { background:#1d4f92; border-color:#1d4f92; color:#f2f7ff; }
  #build.done { background:#1d6f3c; border-color:#1d6f3c; color:#f2fff6; }
  #build.failed { background:#8a2323; border-color:#8a2323; color:#fff4f4; }
  .ghost { display:block; width:100%; margin-top:8px; padding:9px 12px; border-radius:9px;
           border:1px solid var(--line); background:transparent; color:var(--ink); font-size:.85rem;
           cursor:pointer; text-align:center; text-decoration:none; }
  .small-btn { display:inline-block; width:auto; padding:5px 9px; font-size:.75rem; margin:6px 0 0; }
  table.kv { width:100%; border-collapse:collapse; font-size:.82rem; }
  table.kv th { text-align:left; color:var(--muted); font-weight:500; padding:2px 0; }
  table.kv td { text-align:right; font-variant-numeric:tabular-nums; }
  .actions { display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }
  .actions .ghost { flex:1 1 30%; margin-top:0; }
  .actions .primary { flex:1 1 40%; margin-top:0; padding:9px; text-align:center; text-decoration:none; }
  .status-line { display:flex; justify-content:space-between; font-size:.85rem; }
  .log { background:#0a0e15; border:1px solid var(--line); border-radius:8px; padding:8px;
         font-size:.74rem; max-height:180px; overflow:auto; margin:8px 0 0; white-space:pre-wrap; }
  .badge { font-size:.7rem; padding:1px 6px; border-radius:4px; background:var(--panel2); color:var(--muted); }
  .ok { color:var(--good); } .warn { color:var(--warn); } .bad { color:var(--bad); }
  [hidden] { display:none !important; }
  footer { color:var(--muted); font-size:.8rem; border-top:1px solid var(--line); margin:0 22px; padding:14px 0 40px; }
  .skip { position:absolute; left:-9999px; }
  .skip:focus { left:8px; top:8px; background:var(--accent); color:#06101f; padding:6px 10px; border-radius:6px; }
  @media (prefers-reduced-motion:reduce) { * { transition:none !important; } }
