/* Spool Sheet */
:root {
  --ground: #EEF1EF;
  --surface: #F9FBFA;
  --ink: #15201E;
  --muted: #5B6A67;
  --rule: #D3DAD7;
  --track: #DCE2DF;
  --accent: #A8741F;
  --accent-soft: #F1E3C8;
  --good: #2F7A4F;
  --warn: #9A5B12;
  --hatch: rgba(21, 32, 30, .38);
  --shadow: 0 1px 0 rgba(21,32,30,.04), 0 8px 24px -12px rgba(21,32,30,.18);
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0F1413; --surface: #172020; --ink: #E4EBE8; --muted: #93A39F; --rule: #2A3533; --track: #26302E;
    --accent: #E0A850; --accent-soft: #3A2E1B; --good: #6FC08F; --warn: #E3A560; --hatch: rgba(228,235,232,.42);
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 28px -14px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --ground: #0F1413; --surface: #172020; --ink: #E4EBE8; --muted: #93A39F; --rule: #2A3533; --track: #26302E;
  --accent: #E0A850; --accent-soft: #3A2E1B; --good: #6FC08F; --warn: #E3A560; --hatch: rgba(228,235,232,.42);
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 28px -14px rgba(0,0,0,.6);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; padding-inline: 20px; padding-block: 0 64px; }
.wrap { max-width: 1040px; margin: 0 auto; display: grid; gap: 28px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* masthead */
.mast { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; padding-block: 28px 18px; border-bottom: 2px solid var(--ink); }
.brand { display: grid; gap: 2px; }
.brand h1 { font-family: var(--display); font-stretch: 118%; font-weight: 800; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.01em; line-height: 1; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field { display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field select { text-transform: none; letter-spacing: 0; font-size: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; color: var(--ink); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--ground); border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn:hover { filter: brightness(1.12); }
.btn.ghost:hover { border-color: var(--ink); filter: none; }

/* drop zone + status */
.drop { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 14px 18px; align-items: center; padding: 16px 18px; border: 1.5px dashed var(--rule); border-radius: 10px; background: var(--surface); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .glyph { width: 40px; height: 40px; }
.drop strong { font-weight: 650; }
.drop p { margin: 0; color: var(--muted); font-size: 14px; }
.status { font-size: 14px; color: var(--muted); min-height: 1.5em; }
.status.err { color: var(--warn); }
.bar-progress { height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.bar-progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* summary */
.summary { display: grid; gap: 14px; }
.file-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.file-line h2 { font-family: var(--display); font-stretch: 105%; font-weight: 700; font-size: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; }
.chip.exact { color: var(--good); border-color: currentColor; }
.chip.est { color: var(--accent); border-color: currentColor; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; border-block: 1px solid var(--rule); }
.fig { padding: 12px 16px 12px 0; display: grid; gap: 2px; }
.fig + .fig { padding-left: 16px; border-left: 1px solid var(--rule); }
.fig .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fig .v { font-family: var(--display); font-stretch: 110%; font-weight: 750; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fig .v small { font-family: var(--body); font-stretch: 100%; font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
@media (max-width: 560px) { .fig + .fig { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); } }

/* shopping list */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; }
.section-head h3 { font-family: var(--display); font-stretch: 112%; font-weight: 750; font-size: 18px; text-transform: uppercase; letter-spacing: .04em; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 8px; border-radius: 2px; display: inline-block; }
.sw.model { background: var(--ink); }
.sw.support { background: color-mix(in srgb, var(--ink) 45%, transparent); }
.sw.purge { background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 5px); outline: 1px solid var(--hatch); outline-offset: -1px; }
.list { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); }
.row { display: grid; grid-template-columns: 60px minmax(0, 1.25fr) minmax(0, 1fr) 96px 92px; gap: 6px 18px; align-items: center; padding: 14px 18px; }
.row + .row { border-top: 1px solid var(--rule); }
.ring { width: 56px; height: 56px; display: block; }
.who { display: grid; gap: 4px; min-width: 0; }
.who .name { font-weight: 650; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.who .name em { font-style: normal; color: var(--muted); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 4px; background: var(--ground); border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; }
.tag.code { color: var(--ink); border-color: var(--ink); }
.tag.near { color: var(--warn); border-color: currentColor; background: transparent; }
.split { display: grid; gap: 5px; min-width: 0; }
.stack { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--track); }
.stack i { display: block; height: 100%; }
.stack .m { background: var(--ink); }
.stack .s { background: color-mix(in srgb, var(--ink) 45%, transparent); }
.stack .p { background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 5px); }
.split .nums { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; font-variant-numeric: tabular-nums; }
.grams { text-align: right; display: grid; }
.grams b { font-family: var(--display); font-stretch: 108%; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.grams span { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.buy { text-align: right; font-weight: 700; font-size: 15px; }
.buy small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .split { grid-column: 2 / -1; grid-row: 2; }
  .grams { grid-column: 3; grid-row: 1; }
  .buy { grid-column: 1; grid-row: 2; text-align: left; font-size: 13px; }
}

/* plates */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 9px 10px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--rule); vertical-align: bottom; }
tbody tr + tr td { border-top: 1px solid var(--rule); }
td.num { font-family: var(--mono); }
td.zero { color: var(--rule); }
tfoot td { border-top: 2px solid var(--ink); font-weight: 700; font-family: var(--mono); }
tfoot td:first-child { font-family: var(--body); }
.colhead { display: inline-grid; justify-items: end; gap: 4px; }
.colhead i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--hatch); display: block; }

/* notes */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px 32px; font-size: 14px; color: var(--muted); }
.notes h4 { margin: 0 0 6px; color: var(--ink); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.notes p { margin: 0 0 8px; max-width: 62ch; }
.notes b { color: var(--ink); font-weight: 600; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 8px 14px; border-radius: 6px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.stack-sec { display: grid; gap: 12px; }

/* projects */
.projects { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.proj { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 8px 16px; align-items: center; padding: 12px 16px; }
.proj + .proj { border-top: 1px solid var(--rule); }
.proj .dots { display: flex; width: 64px; flex-wrap: wrap; gap: 3px; }
.proj .dots i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--hatch); display: block; }
.proj .pname { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.proj .pmeta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--muted); }
.proj .pmeta .chip { font-size: 10.5px; padding: 1px 7px; }
.proj .pg { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.proj .pg b { display: block; font-family: var(--display); font-stretch: 108%; font-size: 17px; color: var(--ink); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.stepper button { width: 30px; height: 30px; border: 0; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; color: var(--ink); }
.stepper button:hover { background: var(--ground); }
.stepper button:disabled { color: var(--rule); cursor: default; background: transparent; }
.stepper output { min-width: 38px; text-align: center; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.remove { width: 30px; height: 30px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.remove:hover { border-color: var(--rule); color: var(--warn); }
.proj.empty { display: block; color: var(--muted); }
.proj.busy { color: var(--muted); }
@media (max-width: 640px) {
  .proj { grid-template-columns: minmax(0, 1fr) auto auto; }
  .proj .dots { grid-column: 1 / -1; width: auto; }
  .proj .pg { grid-column: 1; grid-row: 3; text-align: left; }
}
.sw.sliced { background: var(--good); }
.stack .x { background: var(--good); }
tr.group td { background: var(--ground); font-weight: 650; }
tr.group td:first-child { background: var(--ground); }
tr.plate td:first-child { padding-left: 24px; color: var(--muted); }
td.num.dim { color: var(--muted); }

/* store links */
.buy .shop { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12.5px; font-weight: 650; color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; line-height: 1.2; }
.buy .shop:hover { color: var(--ink); }
.buy .price { display: block; font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag.store { color: var(--muted); border-style: dashed; background: transparent; }
