:root {
  --bg: #f4f5f7; --card: #fff; --text: #16181d; --muted: #646b78; --line: #e3e6eb;
  --accent: #1f6feb; --accent-text: #fff; --danger: #c93c37; --ok: #1a7f37; --warn: #9a6700;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #181b21; --text: #e8eaee; --muted: #9aa2af; --line: #2a2f38;
          --accent: #4c8dff; --danger: #f06a64; --ok: #3fb950; --warn: #d29922; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code { background: var(--line); padding: 0 .3em; border-radius: 4px; font-size: .9em; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; max-width: 980px; margin: 0 auto; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 14px 30px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
h1 { font-size: 1.6rem; margin: .2em 0 .6em; }
h2 { font-size: 1.15rem; margin: 0 0 .4em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.hero { padding: 26px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--accent); color: var(--accent-text);
       font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.form { display: grid; gap: 12px; margin-top: 10px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
input, textarea, select { font: inherit; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.inline input, .inline select { padding: 4px 8px; font-size: 13px; }
.radio { border: 0; padding: 0; margin: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.radio legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.radio label { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.hp { position: absolute; left: -9999px; }
.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid var(--danger); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job h2 { word-break: break-word; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize;
        background: var(--line); color: var(--text); white-space: nowrap; }
.chip.printing { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.chip.paused { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.chip.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip.failed, .chip.cancelled { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 14px 0 8px; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width .6s ease; }
.stats { display: flex; gap: 6px 14px; flex-wrap: wrap; font-weight: 600; font-size: 15px; }
.stats span:empty { display: none; }
.media { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 640px) { .media { grid-template-columns: 1fr; } .media figure:has(img.cover) { max-width: 200px; } }
figure { margin: 0; }
figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
img.cam, img.cover { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16 / 9; object-fit: contain; display: block; }
img.cover { background: var(--bg); aspect-ratio: 1 / 1; }
img.off { opacity: .35; }
img.cam { color: transparent; }
.empty { text-align: center; padding: 34px 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; border-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
details summary { cursor: pointer; margin-top: 10px; }
/* access + waiting */
.center { text-align: center; }
.code-box { display: grid; gap: 2px; justify-items: center; background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin: 14px 0; }
.code-box b { font-size: 2.2rem; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.spinner { width: 34px; height: 34px; margin: 6px auto 4px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
fieldset.pick { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
fieldset.pick legend, fieldset.stack legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.pick-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 400 !important; }
.pick-row input { width: 20px; height: 20px; }
.radio.stack { display: grid; gap: 8px; }
.radio.stack label { font-weight: 400; }
.hours { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
input.num { width: 6em; padding: 6px 8px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; padding-left: 26px; }
.grants { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.grants .chip { text-transform: none; white-space: normal; }
.chip .x { background: none; border: 0; color: inherit; cursor: pointer; font-weight: 700; padding: 0 0 0 6px; }
.friend { border-top: 1px solid var(--line); padding: 12px 0; }
.friend:first-of-type { border-top: 0; padding-top: 0; }
.right { text-align: right; white-space: nowrap; }
.form label.pick-row, .form .radio label, .form label.hours { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 400; }
.form .radio label > input[type=radio] { flex: 0 0 auto; width: 18px; height: 18px; }
img.cover { max-width: 220px; }
.material { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 600; }
.material.small { font-weight: 400; margin-top: 0; }
svg.swatch { width: 14px; height: 14px; flex: 0 0 auto; }
svg.swatch circle { stroke: var(--muted); stroke-width: 1; }
/* done card + materials */
.done-card { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.done-head { display: flex; align-items: center; gap: 8px; }
.done-head h2 { margin: 0; font-size: 1.3rem; }
.check { font-size: 1.4rem; }
img.result { width: 100%; border-radius: 10px; margin-top: 12px; display: block; background: #000; }
.pickup { font-size: 1.1rem; font-weight: 700; margin: 14px 0 4px; }
.materials { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-weight: 600; }
.mat { display: inline-flex; align-items: center; gap: 6px; }
.failed-card { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
