/* Palette and look carried over from closure/case_builder. */
:root {
  --olive: #58594f; --orange: #de8233; --fog: #edebe6; --carbon: #232323;

  --bg: #161616; --panel: #1c1c1c; --card: #212121; --line: #2e2e2e; --line-soft: #262626;
  --ink: var(--fog); --muted: #a3a19b;
  --accent: var(--orange); --accent-ink: #1a1a1a;
  --ok: #6fcf7f; --bad: #ff8a7a;
  --gutter: 48px;          /* page sides: the header, content and footer line up on it */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink);
       font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }

header { border-bottom: 1px solid var(--line); background: #141414; }
.bar { max-width: 1400px; margin: 0 auto; padding: 0 var(--gutter); height: 74px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; }
.brand img { height: 40px; width: auto; display: block; }
nav { display: flex; gap: 8px; height: 100%; margin-left: 24px; }
nav a { display: flex; align-items: center; gap: 8px; padding: 0 16px; color: var(--muted); text-decoration: none;
        border-bottom: 2px solid transparent; }
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--orange); font-weight: 600; border-bottom-color: var(--orange); }
nav a .step { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.account { margin-left: auto; display: flex; align-items: center; gap: 14px; padding-left: 28px;
           border-left: 1px solid var(--line); height: 38px; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #4a4a42; color: var(--fog);
          display: grid; place-items: center; font-size: 14px; font-weight: 600; }

main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px var(--gutter); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.panel h1 { margin: 0 0 6px; font-size: 22px; }
.panel .lead { margin: 0; color: var(--muted); max-width: 70ch; }

button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
button.link:hover { color: var(--orange); }
.go { padding: 12px 22px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink);
      font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.go:hover:not(:disabled) { filter: brightness(1.07); }
.go:disabled { opacity: .6; cursor: progress; }

input { width: 100%; padding: 10px 12px; border-radius: 4px; border: 1px solid #3a3a3a; background: #1a1a1a;
        color: var(--ink); font: inherit; }
input:focus { outline: none; border-color: var(--orange); }

.login { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login img { height: 44px; justify-self: center; margin-bottom: 18px; }
.login label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.error { color: var(--bad); font-size: 14px; margin: 0; min-height: 1.5em; }

.page-head { position: relative; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
             margin: 0 0 18px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 8px;
             background: linear-gradient(100deg, #1d1d1d 30%, #191919); }
/* clipped to the head's rounded corners; the head itself does not clip, so its menus can open below it */
.contours { position: absolute; inset: 0 0 0 auto; width: 70%; height: 100%; pointer-events: none; clip-path: inset(0 round 0 8px 8px 0);
            fill: none; stroke: #2c2c2c; stroke-width: 1; }
.head-icon { position: relative; display: grid; place-items: center; }
.head-icon svg { width: 34px; height: 34px; fill: none; stroke: var(--orange); stroke-width: 1.7;
                 stroke-linejoin: round; stroke-linecap: round; }
.head-text { position: relative; display: flex; align-items: baseline; gap: 6px 22px; flex-wrap: wrap; flex: 1; min-width: 0; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.page-head .lead { margin: 0; color: var(--muted); font-size: 14px; max-width: 70ch; }
.crumb { display: flex; gap: 10px; color: var(--muted); font-size: 28px; font-weight: 400; text-decoration: none; }
.crumb:hover { color: var(--orange); }
.crumb span { color: #4a4a4a; }
.page-head .tools { position: relative; z-index: 2; margin-left: auto; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.note, .muted { color: var(--muted); }
.note { margin: -6px 0 14px; font-size: 14px; }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }

.field-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; margin-bottom: 10px; color: var(--muted); }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { max-width: 140px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.go.small { padding: 9px 18px; font-size: 15px; }
button.secondary { padding: 9px 16px; border-radius: 6px; border: 1px solid #3a3a3a; background: #1a1a1a;
                   color: var(--ink); font: inherit; cursor: pointer; }
button.secondary:hover { border-color: var(--orange); }
button.link:disabled { opacity: .35; cursor: not-allowed; }
select { padding: 8px 10px; border-radius: 4px; border: 1px solid #3a3a3a; background: #1a1a1a; color: var(--ink);
         font: inherit; max-width: 100%; }
select:focus { outline: none; border-color: var(--orange); }

.readout { display: grid; grid-template-columns: 110px 1fr; gap: 8px 0; margin: 0; font-size: 14.5px; }
.readout dt { color: var(--muted); }
.readout dd { margin: 0; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; font-size: 12px;
         border: 1px solid currentColor; white-space: nowrap; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.banner { padding: 10px 14px; border: 1px solid currentColor; border-radius: 6px; background: #2a1c1a; margin: 0 0 16px; }

.swatch { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1px solid #ffffff30; }
.filaments, .roles { list-style: none; margin: 0; padding: 0; }
.filaments li, .roles li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.roles li { padding: 7px 0; }
.roles .swatch { width: 22px; height: 22px; }
.roles select { width: 300px; }
.filament-form { margin-top: 16px; padding: 14px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 6px; }
.filament-form.editing { margin: 8px 0; }
.filament-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.filament-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.color-pick { display: flex; gap: 8px; }
.color-pick input[type=color] { width: 44px; height: 42px; padding: 2px; flex: none; }

.tools { display: flex; align-items: center; gap: 8px; }
.index + .index { margin-top: 16px; }
.index-list { list-style: none; margin: 0; padding: 0; }
.index-list li + li { border-top: 1px solid var(--line-soft); }
.index-list a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: baseline;
                padding: 12px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.index-list a:hover { background: #2a2018; }
.index-list a:hover b { color: var(--orange); }
.menu { position: relative; }
.menu summary { list-style: none; padding: 9px 16px; border-radius: 6px; border: 1px solid #3a3a3a; background: #1a1a1a;
                cursor: pointer; user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { border-color: var(--orange); }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 170px; display: grid; padding: 4px;
             border: 1px solid #3a3a3a; border-radius: 6px; background: var(--panel); box-shadow: 0 8px 24px #0008; }
.menu-list button { padding: 8px 12px; border: 0; border-radius: 4px; background: none; color: var(--ink); font: inherit;
                    text-align: left; cursor: pointer; }
.menu-list button:hover { background: #2a2018; color: var(--orange); }
.editor-grid { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(0, 1.6fr); gap: 24px; align-items: start; }
.editor-grid .stage { margin-top: 0; }
.option { display: grid; gap: 6px; margin: 0 0 22px; }
.option-label { color: var(--muted); }
.option > .option-label { color: var(--ink); font-size: 17px; font-weight: 700; }
.option > .help { margin-top: -4px; color: var(--muted); font-size: 14px; }
.option > .segmented, .option > .stepper, .option > input { margin-top: 4px; }
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.segmented button { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 6px; border: 1px solid #3a3a3a;
                    background: #1a1a1a; color: var(--ink); font: inherit; text-align: left; cursor: pointer; line-height: 1.3; }
.segmented .choice { display: flex; flex-direction: column; }
.segmented button b { font-size: 16px; }
.segmented .choice span { color: var(--muted); font-size: 13px; }
.segmented svg { flex: none; width: 30px; height: 30px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.segmented button:hover { border-color: var(--orange); }
.segmented button[aria-checked="true"] { border-color: var(--orange); background: #2a2018; }
.segmented button[aria-checked="true"] b, .segmented button[aria-checked="true"] svg { color: var(--orange); stroke: var(--orange); }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper button { width: 40px; height: 40px; border-radius: 4px; border: 1px solid #3a3a3a; background: #1a1a1a;
                  color: var(--ink); font-size: 20px; cursor: pointer; }
.stepper button:hover:not(:disabled) { border-color: var(--orange); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { min-width: 64px; height: 40px; display: grid; place-items: center; border-radius: 4px; border: 1px solid #3a3a3a;
                  background: #1a1a1a; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stage { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; margin-top: 16px; border: 1px solid var(--line-soft); }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage + .note { margin-top: 8px; }
.stage:fullscreen { aspect-ratio: auto; border-radius: 0; border: 0; }
.stage-labels { position: absolute; inset: 0; pointer-events: none; }
.dim-label { padding: 2px 7px; border-radius: 4px; background: #141414e6; border: 1px solid var(--orange); color: var(--fog);
             font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer-modes { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 3px;
                border: 1px solid #3a3a3a; border-radius: 8px; background: #141414d9; }
.viewer-modes button { display: flex; align-items: center; gap: 7px; padding: 6px 14px; border: 1px solid transparent;
                       border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; }
.viewer-modes button:hover { color: var(--orange); }
.viewer-modes button[aria-checked="true"] { border-color: var(--orange); background: #2a2018; color: var(--orange); }
.viewer-full { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center;
               border: 1px solid #3a3a3a; border-radius: 8px; background: #141414d9; color: var(--ink); cursor: pointer; }
.viewer-full:hover { color: var(--orange); border-color: var(--orange); }
.stage-status { position: absolute; left: 12px; bottom: 12px; right: 12px; padding: 8px 12px; border-radius: 4px;
                background: #141414e6; color: var(--muted); font-size: 14px; }
.parts-panel { margin-top: 16px; padding: 0 20px 14px; }
.parts-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
             border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.tabs { display: flex; gap: 4px; }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; border: 0; border-bottom: 2px solid transparent;
               background: none; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--orange); border-bottom-color: var(--orange); }
.tabs svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.parts-tools { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.parts-tools select { padding: 7px 10px; }
.search { display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid #3a3a3a; border-radius: 6px; background: #1a1a1a; }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search input { width: 180px; padding: 7px 0; border: 0; background: none; outline: none; }
.search:focus-within { border-color: var(--orange); }
.parts-tools .menu summary.go { padding: 8px 16px; border-color: transparent; background: var(--accent); color: var(--accent-ink); font-size: 15px; }
.menu.disabled summary { opacity: .45; pointer-events: none; }
.table-scroll { overflow-x: auto; }
table.parts { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.parts th, table.parts td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); }
table.parts th { color: var(--muted); font-weight: 500; }
table.parts th.tick, table.parts td.tick { width: 28px; padding-right: 0; }
table.parts input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--orange); cursor: pointer; }
table.parts tr.unticked td:not(.tick) { opacity: .5; }
table.parts tbody tr:hover { background: #1f1f1f; }
.sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.sort:hover { color: var(--ink); }
.sort .arrow { font-size: 10px; opacity: .6; }
th[aria-sort] .sort { color: var(--orange); }
.part-name svg, td.status svg { width: 17px; height: 17px; vertical-align: -4px; margin-right: 10px; fill: none; stroke: currentColor;
                                stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.part-name svg { color: var(--muted); }
td.status svg { margin-right: 6px; }
.parts-foot { margin: 10px 0 0; }
.printer-summary { display: flex; gap: 40px; flex-wrap: wrap; padding: 14px 0; }
.printer-summary div { display: grid; gap: 2px; }
.printer-summary + .problems { margin-bottom: 10px; }
#checks h3 { margin-top: 18px; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }

.build-grid { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.6fr); gap: 16px; align-items: start; margin-top: 12px; }
.build-grid .stage { margin-top: 0; }
.add-layer { width: 100%; margin-bottom: 10px; border-style: dashed; }
.layer { background: var(--card); border: 1px solid var(--line-soft); border-radius: 6px; padding: 16px 18px 8px; margin-bottom: 14px; }
.layer-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.layer-head .trash { margin-left: auto; }
.trash { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent;
         border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.trash svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.trash:hover { color: var(--bad); border-color: var(--bad); }
.slot { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.slot > * + * { margin-top: 12px; }
.slot-head { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; }
.slot-head select { width: 100%; }
.mounts { list-style: none; margin: 12px 0 0 100px; padding: 0; display: grid; gap: 16px; }
.mount { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 6px; }
.mount select { padding: 5px 8px; font-size: 14px; }
.nudges { display: inline-flex; gap: 2px; }
.nudge { width: 28px; height: 28px; border-radius: 4px; border: 1px solid #3a3a3a; background: #1a1a1a; color: var(--ink);
         cursor: pointer; font-size: 14px; }
.nudge:hover { border-color: var(--orange); }
.link.add { margin-left: 100px; color: var(--orange); }
.problems { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.problems li { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--bad); background: #2a1c1a; color: var(--bad); font-size: 14px; }

footer { width: 100%; max-width: 1400px; margin: 0 auto; padding: 8px var(--gutter) 28px; color: var(--muted); }
.tagline { font-size: 11px; letter-spacing: .3em; }
.tagline b { color: var(--orange); letter-spacing: 0; margin-right: 8px; }

@media (max-width: 1000px) {
  .cols, .editor-grid, .build-grid { grid-template-columns: 1fr; }
  .index-list a { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 800px) {
  .mounts, .link.add { margin-left: 0; }
  .slot-head { grid-template-columns: 1fr; }
  .stage { aspect-ratio: 1; }
  .viewer-modes button span { display: none; }
  .field-row { grid-template-columns: 1fr; gap: 4px; }
  .filament-grid { grid-template-columns: 1fr; }
  .roles li { flex-wrap: wrap; }
  .roles select { width: 100%; }
  :root { --gutter: 16px; }
  .bar { gap: 8px; }
  .brand img { height: 28px; }
  nav { margin-left: 0; gap: 0; }
  nav a { padding: 0 6px; }
  nav a .step, .account .name, .avatar { display: none; }
  .account { padding-left: 8px; gap: 8px; }
  #logout { white-space: nowrap; }
  .page-head { padding: 16px; gap: 14px; }
  .page-head h1, .crumb { font-size: 22px; }
  .head-icon svg { width: 28px; height: 28px; }
  .page-head .tools { width: 100%; }
}
@media (max-width: 380px) {
  nav a { padding: 0 3px; }
}
