/* JWorks 3D site chrome, dark like jworks-ai.com. Loaded after the legacy styles.css. */
:root {
  --bg: #050508;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.65);
  --brand: #9333ea;
  --brand-soft: rgba(147, 51, 234, 0.16);
  --brand-line: rgba(192, 132, 252, 0.4);
  --danger: #fca5a5;
  --site-version-clearance: calc(32px + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}

html { scroll-padding-bottom: var(--site-version-clearance); }
/* Keep scrolling content above the persistent version, including mid-page. */
html:has(.site-version) { height: 100%; overflow: hidden; }
body:has(.site-version) {
  height: calc(100dvh - var(--site-version-clearance)); min-height: 0;
  box-sizing: border-box; overflow-y: auto; scroll-padding-bottom: 16px;
}
body:has(.site-version) > * { flex-shrink: 0; }

.gpu-status { margin: 24px 0; padding: 20px 0; border-block: 1px solid var(--line); width: 100%; max-width: 1100px; }
.gpu-status[hidden] { display: none; }
.gpu-status-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; }
.gpu-status h2 { font-size: 20px; margin: 0 0 16px; }
.gpu-status h3 { font-size: 15px; margin: 0 0 12px; overflow-wrap: anywhere; }
.gpu-status-stamp { color: var(--muted); font-size: 13px; }
.gpu-status-device { padding-bottom: 16px; }
.gpu-status-metrics { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.gpu-status-metrics dt { color: var(--muted); }
.gpu-status-metrics dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gpu-status-apps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.gpu-status-app { border-top: 1px solid var(--line); padding-top: 16px; min-width: 0; }
.gpu-status-app-name { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.gpu-app-state { font-size: 13px; color: var(--muted); }
.gpu-app-state.running { color: #86efac; }
.gpu-app-state.unknown { color: #fcd34d; }
@media (max-width: 600px) { .gpu-status-apps { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

.slicer-device-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.slicer-device-bar select { min-width: 0; max-width: 100%; min-height: 40px; padding: 6px 32px 6px 10px; font: inherit; background: #202327; color: var(--text); border: 1px solid var(--line); border-radius: 4px; }
.slicer-device-bar select:focus-visible { outline: 2px solid #6ee7b7; outline-offset: 2px; }
.slicer-device { min-width: 0; }
.slicer-device[hidden] { display: none; }
.slicer-gpu-status { box-sizing: border-box; max-width: none; margin: 0; padding: 12px; }
.slicer-gpu-status h2 { font-size: 15px; margin-bottom: 8px; }
.slicer-gpu-status .gpu-status-apps { grid-template-columns: minmax(0, 1fr); }
.slicer-gpu-status .gpu-status-app-name { margin-bottom: 8px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  justify-content: flex-start;
  padding: 0 0 calc(96px + var(--site-version-clearance));
}

h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin: 28px 16px 8px; text-align: center; }
#feed-status { color: var(--muted); font-size: 14px; margin: 0 16px 12px; text-align: center; order: 2; }

.site-header {
  position: sticky; top: 0; z-index: 40; width: 100%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 8px max(16px, calc((100vw - 1440px) / 2));
  background: rgba(5, 5, 8, 0.82); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 48px; }
.brand-mark {
  width: 35px; height: 45px; display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: 8px 0 8px 0; overflow: hidden; padding: 2px; box-sizing: border-box;
}
.brand-mark img { height: 40px; width: auto; object-fit: contain; mix-blend-mode: screen; }
.brand-name { font-weight: 700; font-size: 1.25rem; }
.brand-name span { color: #c084fc; }
.account { position: relative; display: flex; align-items: center; justify-content: flex-end; flex-shrink: 0; }
.account-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #202327; color: var(--text); cursor: pointer;
}
.account-toggle:hover, .account-toggle[aria-expanded="true"] { border-color: #86efac; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1; width: 260px; max-width: calc(100vw - 32px);
  box-sizing: border-box; padding: 6px; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 8px; background: #17191c; box-shadow: 0 8px 24px #0008;
}
.account-menu[hidden], .account-error[hidden] { display: none; }
.account-email { display: block; padding: 10px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.account-menu a, .account-menu button {
  display: flex; align-items: center; min-height: 40px; padding: 8px 10px; box-sizing: border-box;
  color: var(--text); background: transparent; border: 0; border-radius: 4px; font: inherit; font-size: 14px;
  text-align: left; text-decoration: none; cursor: pointer;
}
.account-menu a:hover, .account-menu button:hover { background: var(--surface-strong); }
.account-menu button:disabled { opacity: 0.55; cursor: wait; }
.account :focus-visible { outline: 2px solid #6ee7b7; outline-offset: -2px; }
.account-error { margin: 4px 10px 8px; color: var(--danger); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px;
  border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--text); border: 1px solid var(--line); background: transparent; box-sizing: border-box;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.35); }
.btn-brand { background: var(--brand-soft); border-color: var(--brand-line); }
.btn-brand:hover { background: rgba(147, 51, 234, 0.26); border-color: #c084fc; }
.btn:disabled { opacity: 0.55; cursor: wait; }

/* Cameras, with the admin printer column beside them on wide screens. */
.workbench { width: min(1280px, 96%); display: grid; gap: 24px; order: 3; }
.workbench.with-printers { width: min(2400px, 97%); }
@media (min-width: 1500px) {
  .workbench.with-printers { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
.camera-column { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.camera-embedded iframe { display: block; width: 100%; min-height: 120px; aspect-ratio: 16 / 11; border: 0; }
body.camera-panel-page { display: block; height: auto; min-height: 0; margin: 0; padding: 0; overflow: hidden; }
.camera-panel-page .workbench { display: block; width: 100%; }
.workbench #main-stream-container { width: 100%; box-sizing: border-box; border-color: var(--line); border-radius: 12px; overflow: hidden; background: #000; }
#secondary-streams .stream-container, #nozzle-inset { border-color: var(--line); }
#nozzle-note { color: var(--muted); }
.camera-label { border-radius: 6px; font-size: 13px; }
.button-container button { border-radius: 10px; font-weight: 600; }
.button-container button.active { background: var(--brand-soft); color: var(--text); border: 1px solid #c084fc; }
.button-container button.inactive { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.button-container button:hover { background: var(--surface-strong); }

.printer-control { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.printer-control[hidden] { display: none; }
.admin-badge { font-size: 12px; color: #fde68a; border: 1px solid rgba(253, 230, 138, 0.4); border-radius: 999px; padding: 3px 10px; }
.printer-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.printer-tabs button {
  min-height: 40px; padding: 0 18px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.printer-tabs button.active { background: var(--brand-soft); color: var(--text); border-color: #c084fc; }
.printer-tabs button:focus-visible { outline: 2px solid #c084fc; outline-offset: 3px; }
.printer-panel { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #0b0b12; }
.printer-panel[hidden] { display: none; }
.printer-panel-bar { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); }
.printer-open { color: #c084fc; font-size: 13px; text-decoration: none; }
.printer-panel iframe { width: 100%; height: min(78vh, 900px); border: 0; background: #fff; }

.workbench.workspace { grid-template-columns: minmax(0, 1fr); gap: 12px 20px; align-items: start; }
.workspace-modes { grid-row: 1; grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.workspace-modes button, .workspace-tabs button {
  min-height: 40px; font: inherit; font-size: 14px; padding: 8px 14px;
  background: transparent; color: var(--muted); border: 1px solid var(--line); cursor: pointer;
}
.workspace-modes button:first-child { border-radius: 6px 0 0 6px; }
.workspace-modes button:last-child { border-radius: 0 6px 6px 0; }
.workspace-modes button[aria-pressed="true"] { background: var(--surface-strong); color: var(--text); }
.workspace-tabs { display: flex; flex-wrap: wrap; min-width: 0; border-bottom: 1px solid var(--line); }
.workspace-tabs button { border: 0; border-bottom: 2px solid transparent; }
.workspace-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: #6ee7b7; }
.workspace-tabs button:disabled, .workspace-modes button:disabled { opacity: 0.4; cursor: default; }
.workspace-tabs button:focus-visible, .workspace-modes button:focus-visible { outline: 2px solid #6ee7b7; outline-offset: -2px; }
.workspace-tabs[data-slot="0"] { grid-row: 2; grid-column: 1; }
.workspace-pane[data-slot="0"] { grid-row: 3; grid-column: 1; }
.workspace-tabs[data-slot="1"] { grid-row: 4; grid-column: 1; }
.workspace-pane[data-slot="1"] { grid-row: 5; grid-column: 1; }
.workspace-pane { min-width: 0; }
.workspace-pane[hidden], .workspace-tabs[hidden] { display: none; }
.remote-tool iframe { display: block; width: 100%; height: min(78vh, 900px); border: 0; background: #111; }
.remote-tool iframe[hidden], .app-control-placeholder[hidden] { display: none; }
.app-control-placeholder { display: grid; place-items: center; min-height: min(50vh, 440px); padding: 24px; color: var(--muted); background: #111; }
.app-control-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.app-control-state { font-weight: 600; min-width: 86px; }
.app-control-state[data-state="running"] { color: #71cfa0; }
.app-control-state[data-state="save_required"], .app-control-state[data-state="error"] { color: #edc46f; }
.app-control-metric { color: var(--muted); font-variant-numeric: tabular-nums; }
.app-control-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.app-control-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; }
.app-control-button svg { flex: 0 0 18px; }
.app-control-button:disabled { opacity: .45; cursor: default; }
.app-control-message { margin: 0; padding: 0 12px 12px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 600px) { .app-control-actions { width: 100%; margin-left: 0; } }
.slicer-app-control .app-control-bar { border-top: 0; border-bottom: 1px solid var(--line); }
.slicer-app-control .app-control-message { padding-top: 10px; }
.slicer-app-off { align-content: center; gap: 8px; text-align: center; }
.slicer-app-off strong { color: var(--text); font-size: 17px; }
.slicer-app-off span[hidden] { display: none; }
/* Phones: the off message sits right under the wrapped buttons, inside the first screen. */
@media (max-width: 600px) { .slicer-app-off { align-content: start; min-height: 240px; padding-top: 28px; } }
.tc00-upload-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.tc00-upload-bar .btn { white-space: normal; min-height: 36px; }
.upload-status { flex: 1 1 180px; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.cad-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; min-width: 0; }
.cad-parts select, .cad-parts button { min-width: 0; max-width: 100%; min-height: 40px; font: inherit; font-size: 13px; padding: 8px; border: 1px solid #4c555d; border-radius: 4px; background: #20262b; color: #f1f4f6; }
.cad-parts .cad-part-select { flex: 1 1 240px; width: 0; }
.cad-parts label { display: flex; align-items: center; gap: 6px; min-height: 40px; font-size: 13px; }
.cad-parts button { cursor: pointer; }
.cad-parts :disabled { opacity: .5; cursor: default; }
.cad-parts .cad-reload { width: 40px; height: 40px; flex: 0 0 40px; padding: 9px; }
.cad-reload svg { width: 20px; height: 20px; }
.cad-parts-status { flex-basis: 100%; margin: 0; font-size: 13px; color: #b9c1c7; overflow-wrap: anywhere; }
.cad-parts-status:empty { display: none; }
.cad-parts :focus-visible { outline: 2px solid #6ee7b7; outline-offset: 2px; }
@media (min-width: 1100px) {
  .workbench.workspace[data-layout="dual"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace[data-layout="dual"] .workspace-tabs[data-slot="1"] { grid-row: 2; grid-column: 2; }
  .workspace[data-layout="dual"] .workspace-pane[data-slot="1"] { grid-row: 3; grid-column: 2; }
}
/* Quad: 2x2 on wide screens; stacked one panel at a time below that. */
.workspace-tabs[data-slot="2"] { grid-row: 6; grid-column: 1; }
.workspace-pane[data-slot="2"] { grid-row: 7; grid-column: 1; }
.workspace-tabs[data-slot="3"] { grid-row: 8; grid-column: 1; }
.workspace-pane[data-slot="3"] { grid-row: 9; grid-column: 1; }
@media (min-width: 1100px) {
  .workbench.workspace[data-layout="quad"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace[data-layout="quad"] .workspace-tabs[data-slot="1"] { grid-row: 2; grid-column: 2; }
  .workspace[data-layout="quad"] .workspace-pane[data-slot="1"] { grid-row: 3; grid-column: 2; }
  .workspace[data-layout="quad"] .workspace-tabs[data-slot="2"] { grid-row: 4; grid-column: 1; }
  .workspace[data-layout="quad"] .workspace-pane[data-slot="2"] { grid-row: 5; grid-column: 1; }
  .workspace[data-layout="quad"] .workspace-tabs[data-slot="3"] { grid-row: 4; grid-column: 2; }
  .workspace[data-layout="quad"] .workspace-pane[data-slot="3"] { grid-row: 5; grid-column: 2; }
}

.member-printer-status { min-width: 0; }
.status-heading, .printer-status-heading, .status-camera { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
.status-readonly, .status-updated, .status-label, .status-job, .status-camera { color: var(--muted); font-size: 12px; }
.status-readonly { border-left: 2px solid #6ee7b7; padding-left: 8px; }
.status-heading .status-readonly { margin-left: auto; }
.status-updated { display: block; margin: 6px 0 14px; min-height: 18px; }
.status-updated[data-stale="true"] { color: #fcd34d; }
.printer-status-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.printer-status-card { --status-accent: #a1a1aa; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-left: 3px solid var(--status-accent); border-radius: 6px; background: #141619; }
.printer-status-card[data-state="printing"] { --status-accent: #6ee7b7; }
.printer-status-card[data-state="idle"] { --status-accent: #93c5fd; }
.printer-status-card[data-state="paused"], .printer-status-card[data-state="busy"] { --status-accent: #fcd34d; }
.printer-status-card[data-state="halted"], .printer-status-card[data-state="cancelling"] { --status-accent: #fca5a5; }
.printer-status-heading h3 { margin: 0; font-size: 18px; }
.printer-state { color: var(--status-accent); font-size: 13px; font-weight: 600; text-transform: capitalize; }
.status-job { display: block; margin-top: 4px; min-height: 18px; }
.status-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 10px; }
.status-metrics > div { min-width: 0; }
.status-label { display: block; margin-bottom: 4px; }
.status-metrics strong { display: block; font-size: 24px; line-height: 1.3; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.status-progress-value { color: var(--status-accent); }
.printer-status-card progress { display: block; appearance: none; width: 100%; height: 5px; border: 0; border-radius: 3px; overflow: hidden; background: #303438; color: var(--status-accent); }
.printer-status-card progress::-webkit-progress-bar { background: #303438; }
.printer-status-card progress::-webkit-progress-value { background: var(--status-accent); }
.printer-status-card progress::-moz-progress-bar { background: var(--status-accent); }
.printer-status-card progress[hidden] { display: block; visibility: hidden; }
.status-camera { margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.status-bed { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 12px; }
.status-bed-value { font-variant-numeric: tabular-nums; }
.status-bed-detail { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.status-bed-soak { flex-basis: 100%; color: var(--muted); font-size: 11px; }
.printer-status-card[data-bed="fault"] .status-bed-detail { color: #ff9d9d; }
.status-camera > :last-child { text-transform: capitalize; }
.member-printer-status :is(h2, h3, span) { overflow-wrap: anywhere; }
@media (min-width: 760px) {
  .workspace[data-layout="solo"] .printer-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The library occupies its own left rail; camera and remote frames stay mounted. */
.parts-library {
  position: fixed; left: 0; top: calc(var(--parts-header-height, 64px) + 16px); bottom: 16px; z-index: 35; width: 44px;
  background: #101113; border-right: 1px solid var(--line); box-sizing: border-box;
}
.parts-library.expanded { width: 320px; }
.parts-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; padding: 0; color: var(--text); background: transparent;
  border: 0; border-radius: 4px; cursor: pointer;
}
.parts-icon:hover { background: var(--surface-strong); }
.parts-icon:disabled { color: var(--muted); cursor: default; }
.parts-content { display: flex; flex-direction: column; gap: 10px; height: calc(100% - 44px); padding: 0 12px 12px; box-sizing: border-box; }
.parts-content[hidden], .parts-more[hidden] { display: none; }
.parts-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.parts-header h2 { margin: 0; font-size: 18px; }
.parts-content input, .parts-content select {
  box-sizing: border-box; width: 100%; min-width: 0; min-height: 40px; padding: 8px;
  border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 14px;
  color: var(--text); background: #191b1e;
}
.parts-status, .parts-updated { margin: 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.parts-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; min-height: 0; }
.part-row { display: flex; flex-direction: column; gap: 5px; padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.part-row strong { font-size: 14px; font-weight: 600; }
.part-folder { font-size: 12px; color: var(--muted); }
.part-folder:empty { display: none; }
.part-sync { font-size: 11px; color: #fcd34d; }
.part-sync.ready { color: #86efac; }
.part-sync.error { color: var(--danger); }
.part-files { display: flex; flex-wrap: wrap; gap: 10px; }
.part-files a { color: #93c5fd; font-size: 12px; min-height: 28px; display: inline-flex; align-items: center; }
.parts-more { min-height: 36px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--text); cursor: pointer; }
.parts-library :focus-visible { outline: 2px solid #6ee7b7; outline-offset: -2px; }
.workbench.parts-available { margin-left: 44px; width: min(2400px, calc(97% - 44px)); }
body.parts-available > :is(h1, #feed-status) {
  box-sizing: border-box; margin-left: 60px; margin-right: 16px; max-width: calc(100% - 76px);
}
.workbench.parts-open { margin-left: 320px; width: min(2400px, calc(97% - 320px)); }
@media (min-width: 1100px) and (max-width: 1439px) {
  .workbench.parts-open[data-layout="dual"] { grid-template-columns: minmax(0, 1fr); }
  .parts-open[data-layout="dual"] .workspace-tabs[data-slot="1"] { grid-row: 4; grid-column: 1; }
  .parts-open[data-layout="dual"] .workspace-pane[data-slot="1"] { grid-row: 5; grid-column: 1; }
}
@media (max-width: 700px) {
  .parts-library.expanded { width: min(320px, calc(100vw - 44px)); }
  .workbench.parts-open { margin-left: 44px; width: calc(97% - 44px); }
}

.admin-main { width: min(2400px, 97vw); margin: 24px auto; display: flex; flex-direction: column; gap: 16px; }
.admin-main h1 { text-align: left; margin: 0; }
.admin-printers { display: grid; gap: 16px; }
@media (min-width: 1500px) { .admin-printers { grid-template-columns: 1fr 1fr; } }
.admin-printers .printer-panel iframe { height: calc(100vh - 220px); min-height: 560px; }

/* Member chat balloon. */
.chat-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff;
  background: #7e22ce; border: 1px solid #c084fc; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.chat-launcher:hover { background: #9333ea; }
.chat-launcher.status-chat { position: static; flex-shrink: 0; width: 40px; height: 40px; box-shadow: none; }
.chat-panel {
  position: fixed; right: 20px; bottom: 90px; z-index: 50; width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: #0d0d14; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-close { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; width: 40px; height: 40px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.chat-empty { color: var(--muted); font-size: 14px; margin: 0; }
.chat-message { max-width: 85%; padding: 8px 12px; border-radius: 12px; background: var(--surface); }
.chat-message p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.chat-message.member { align-self: flex-end; background: var(--brand-soft); border: 1px solid var(--brand-line); }
.chat-who { font-size: 11px; color: var(--muted); }
.chat-status { color: var(--danger); font-size: 13px; margin: 0 16px; }
.chat-status:empty { display: none; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea {
  flex: 1; resize: none; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px;
}
.chat-signin { padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.chat-signin p { margin: 0; color: var(--muted); font-size: 14px; }
.chat-join { color: #c084fc; font-size: 13px; }

/* Window chrome loads before the private terminal assets, including stale-session prompts. */
.terminal-panel {
  width: min(740px, calc(100vw - 16px)); height: min(600px, calc(100dvh - 88px));
  max-height: none; border-radius: 8px; border-color: #56615f; box-sizing: border-box;
  background: #101416; color: #edf2f0; z-index: 1100;
}
.terminal-panel .terminal-titlebar {
  min-height: 40px; flex: 0 0 auto; gap: 12px; padding: 8px 6px 4px 16px;
  background: #252c2d; border-color: #414b4a; cursor: grab; touch-action: none; user-select: none;
}
.terminal-titlebar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.terminal-window-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.terminal-panel .terminal-window-button {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 4px; background: transparent; color: #c4d0cc; cursor: pointer;
}
.terminal-window-button:hover { background: #3c4845; color: #fff; }
.terminal-window-button.chat-close:hover { background: #713c40; }
.terminal-panel :focus-visible { outline: 2px solid #8ed9be; outline-offset: -2px; }
.terminal-maximize .restore-icon, .terminal-panel[data-maximized="true"] .terminal-maximize .maximize-icon { display: none; }
.terminal-panel[data-maximized="true"] .terminal-maximize .restore-icon { display: block; }
.terminal-resize { position: absolute; z-index: 3; touch-action: none; }
.terminal-resize[hidden] { display: none; }
.terminal-resize-n { top: 0; left: 14px; right: 0; height: 8px; cursor: ns-resize; }
.terminal-resize-w { top: 14px; left: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.terminal-resize-nw { top: 0; left: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.terminal-resize-n::after, .terminal-resize-w::after { content: ''; position: absolute; background: #718781; border-radius: 2px; }
.terminal-resize-n::after { top: 1px; left: calc(50% - 18px); width: 36px; height: 2px; }
.terminal-resize-w::after { left: 1px; top: calc(50% - 18px); width: 2px; height: 36px; }
.terminal-resize:hover::after, .terminal-resize:focus-visible::after { background: #8ed9be; }
.terminal-window-interacting, .terminal-window-interacting * { user-select: none !important; }
.terminal-window-interacting .terminal-titlebar { cursor: grabbing; }
.terminal-panel[data-maximized="true"] .terminal-titlebar { cursor: default; }
body.terminal-window-interacting iframe { pointer-events: none; }
@media (pointer: coarse) {
  .terminal-panel .terminal-window-button { width: 44px; height: 44px; }
  .terminal-panel .terminal-titlebar { padding-top: 12px; padding-left: 18px; }
  .terminal-resize-n { height: 12px; left: 18px; }
  .terminal-resize-w { width: 12px; top: 18px; }
  .terminal-resize-nw { width: 18px; height: 18px; }
}

/* Dock chat beside the workspace on desktop and keep it in flow on phones. */
.visitor-chat { border-radius: 8px; background: #15191b; }
.visitor-chat .chat-head { gap: 12px; min-height: 54px; }
.visitor-chat > :not(.chat-messages) { flex-shrink: 0; }
.visitor-chat .chat-messages { min-height: 0; flex: 1 1 160px; }
.chat-public-notice { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.chat-identity { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-identity :is(select, input) { width: 100%; min-width: 0; min-height: 40px; padding: 8px;
  box-sizing: border-box; font: inherit; font-size: 14px; color: var(--text); background: #22282b;
  border: 1px solid var(--line); border-radius: 4px; }
.chat-identity input[hidden] { display: none; }
.chat-account-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; }
.chat-account-links :is(a, button) { color: #93c5fd; min-height: 30px; display: inline-flex; align-items: center;
  background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.visitor-chat .chat-form textarea { min-width: 0; border-radius: 4px; }
.visitor-chat .chat-message { border-radius: 6px; max-width: 100%; box-sizing: border-box; }
.visitor-chat .chat-message.member { background: #173833; border-color: #37695d; }
.visitor-chat .chat-who { overflow-wrap: anywhere; }
.chat-send { flex: 0 0 40px; width: 40px; height: 40px; padding: 8px; border-radius: 4px; color: #a7f3d0; }
.visitor-chat-launcher { background: #23483f; border-color: #6cae99; }
.visitor-chat-launcher:hover { background: #306451; }
.visitor-chat-launcher.chat-alongside-terminal { right: 90px; }
.visitor-chat :focus-visible { outline: 2px solid #6ee7b7; outline-offset: -2px; }
@media (min-width: 1100px) {
  .chat-sidebar { right: 16px; top: 108px; bottom: 96px; width: 320px; max-height: none;
    border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .chat-docked .workbench { width: min(2400px, calc(97% - 352px)); margin-left: auto; margin-right: 352px; }
  .chat-docked .workbench.parts-available { margin-left: 44px; width: calc(97% - 396px); }
  .chat-docked .workbench.parts-open { margin-left: 320px; width: calc(97% - 672px); }
  .chat-docked .visitor-chat-launcher { display: none; }
}
@media (max-width: 1099px) {
  body[data-page="home"] .chat-panel.visitor-chat {
    position: static; z-index: auto; order: 5; align-self: center; width: min(680px, 97%);
    max-height: 560px; margin: 12px auto; box-sizing: border-box; box-shadow: none;
    scroll-margin-top: 96px;
  }
  body[data-page="home"] .visitor-chat-launcher {
    position: static !important; z-index: auto; order: 4; flex: 0 0 44px; align-self: flex-end;
    width: 44px; height: 44px; margin: 8px 16px; box-shadow: none;
  }
}
@media (max-height: 540px) {
  .chat-panel.visitor-chat { top: 8px; bottom: 8px; max-height: none; overflow-y: auto; }
  .visitor-chat .chat-head { min-height: 0; padding: 6px 12px; }
  .visitor-chat .chat-identity { padding: 8px 12px; }
  .visitor-chat .chat-identity :is(select, input) { flex: 1 1 calc(50% - 4px); width: 0; }
  .visitor-chat .chat-account-links { flex-basis: 100%; }
  .visitor-chat .chat-form { padding: 8px 12px; }
  .visitor-chat .chat-form textarea { height: 52px; min-height: 0; box-sizing: border-box; }
  body:not([data-page="home"]) .visitor-chat-launcher[aria-expanded="true"], .chat-docked .terminal-launcher { visibility: hidden; }
}

/* Sign-in page. */
.login-main { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 48px 16px; box-sizing: border-box; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; box-sizing: border-box; display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; text-align: left; font-size: 1.5rem; }
.login-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.login-card input {
  min-height: 44px; background: rgba(0, 0, 0, 0.35); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; font: inherit; font-size: 16px;
}
.login-card input:focus, .chat-form textarea:focus { outline: 2px solid #c084fc; outline-offset: 1px; }
.login-error { color: var(--danger); font-size: 14px; min-height: 1em; }
.login-card a { color: #c084fc; }
.login-card a.login-sso { color: #fff; }
.login-sso[hidden] { display: none; }  /* .btn sets display, which beats the hidden attribute */

.site-links { display: flex; gap: 8px; margin-left: auto; }
.site-links:empty { display: none; }

/* Site footer: the JWorks sites and the Jay Network; bottom padding keeps it clear of the chat button. */
/* The home page body is a flex column whose sections carry order 2-3, so the footer orders itself last. */
.site-footer { order: 99; width: min(1280px, 96vw); box-sizing: border-box; margin: 48px auto 0; padding: 24px 16px 96px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); text-align: center; }
body.parts-available .site-footer {
  width: min(1280px, calc(100% - 60px));
  margin-left: max(44px, calc((100% - 1280px) / 2)); margin-right: auto;
}
.site-footer-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.site-version {
  position: fixed; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 1200; max-width: calc(100% - 32px); box-sizing: border-box; padding: 2px 8px;
  color: #d7dfdc; background: #101416; border: 1px solid #3d4843; border-radius: 4px;
  font-size: 0.75rem; line-height: 1.4; overflow-wrap: anywhere; pointer-events: none;
}
.site-network { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: 12px; }
.site-network > span:first-child { flex-basis: 100%; }
.site-network a { color: var(--muted); text-decoration: none; }
.site-network a:hover, .site-network a:focus-visible { color: var(--text); text-decoration: underline; }
.site-network-current { color: var(--text); }

/* Printers: one large link per printer; a CAD view later mounts inside each link. */
.printers { width: min(1100px, 92vw); margin: 32px auto; display: flex; flex-direction: column; gap: 20px; }
.printers h1 { margin: 0; text-align: left; }
.printer-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.printer-choice {
  min-height: 160px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px;
  padding: 24px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: border-color 0.15s, background 0.15s;
}
a.printer-choice:hover { border-color: #c084fc; background: var(--brand-soft); }
.printer-soon { cursor: default; opacity: 0.6; }
.printer-choice:focus-visible { outline: 2px solid #c084fc; outline-offset: 3px; }
.printer-name { font-size: 1.6rem; font-weight: 700; }
.printer-host { color: var(--muted); font-size: 14px; }

/* Designs list: server-rendered cards from designs/catalog.json. */
.design-collection h2 { margin: 8px 0 0; font-size: 1.4rem; }
.design-note { margin: 6px 0 0; font-size: 14px; color: #fde68a; }
.design-elsewhere { margin: 6px 0 0; font-size: 14px; }
.design-elsewhere a { color: #c084fc; }
.design-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.design-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
/* /designs#<slug> lands the card below the sticky header: 65 px tall, 109-121 px once it wraps at 800 px and below. */
.design-card { scroll-margin-top: 81px; }
.design-card:target { border-color: #c084fc; box-shadow: 0 0 0 1px #c084fc; }
@media (max-width: 800px) { .design-card { scroll-margin-top: 137px; } }
.design-figure { aspect-ratio: 4 / 3; background: #24252b; display: flex; align-items: center; justify-content: center; }
.design-figure img { display: block; width: 100%; height: 100%; object-fit: cover; }
.design-placeholder { color: var(--muted); font-size: 14px; }
.design-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.design-info h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.design-info p { margin: 0; font-size: 14px; color: var(--muted); }
.design-stage { align-self: flex-start; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--text); background: var(--brand-soft); border: 1px solid var(--brand-line); }
.design-card[data-stage="concept"] .design-stage { background: transparent; border-color: var(--line); color: var(--muted); }
.design-size { color: var(--text) !important; }
/* Value + scale is one atomic unit beside or below the label; it breaks (between value and scale) only when wider than the card. */
.design-dims { display: inline-block; max-width: 100%; }
.design-value, .design-scale { white-space: nowrap; }
.design-credit a { color: var(--muted); font-size: 12px; }
.design-figure img[hidden] { display: none; }
.design-figure video { display: block; width: 100%; height: 100%; object-fit: cover; background: #24252b; }
.design-figure video[hidden] { display: none; }
/* Lighter in the middle, like the renders, so a black piece (the shelf) still reads against it. */
.design-figure model-viewer { width: 100%; height: 100%; background: radial-gradient(ellipse at 50% 42%, #6a7079 0%, #454a52 55%, #2c2f35 100%); --poster-color: transparent; }
.design-view, .design-blender { align-self: flex-start; min-height: 36px; margin-top: 4px; }
.design-view.open { background: var(--brand-soft); border-color: var(--brand-line); }

/* Timelapse library. */
.print-view-tabs { display: flex; gap: 4px; padding: 4px; border-bottom: 1px solid var(--line); }
.print-view-tabs button { flex: 1; min-height: 40px; min-width: 0; padding: 6px 12px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; overflow-wrap: anywhere; }
.print-view-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: #22c3a6; }
.print-view-tabs button:disabled { opacity: 0.4; cursor: default; }
.print-view-tabs button:focus-visible { outline: 2px solid #22c3a6; outline-offset: -2px; }
.print-view-preview { position: relative; aspect-ratio: 16 / 9; width: 100%; min-width: 0;
  overflow: hidden; background: #24252b; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.print-view-preview model-viewer, .print-view-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.print-view-message { color: var(--muted); font-size: 14px; padding: 12px; margin: 0; text-align: center; }
.print-view-tabs[hidden], .print-view-preview[hidden], [role="tabpanel"][hidden] { display: none !important; }
.library { width: min(1440px, 96vw); margin: 24px auto; display: flex; flex-direction: column; gap: 16px; }
.library-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.library-head h1 { margin: 0; text-align: left; }
.library-lead, .library-admin-note { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.library-admin-note { color: #fde68a; }
.library-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.library-filters button {
  min-height: 40px; padding: 0 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.library-filters button.active { background: var(--brand-soft); color: var(--text); border-color: #c084fc; }
.timelapse-month h2 { font-size: 1.1rem; margin: 8px 0 12px; color: var(--muted); }
.timelapse-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.timelapse-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.timelapse-player { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.timelapse-player video { width: 100%; height: 100%; background: #000; }
.timelapse-play { min-height: 44px; padding: 0 20px; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; color: #fff; background: rgba(147, 51, 234, 0.35); border: 1px solid #c084fc; }
.timelapse-preview { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: #000; }
.timelapse-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.timelapse-preview img[hidden] { display: none; }
.timelapse-preview span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 8px 16px; border-radius: 4px; background: rgba(0, 0, 0, 0.75); white-space: nowrap; }
.timelapse-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.timelapse-info strong { overflow-wrap: anywhere; }
.timelapse-meta { color: var(--muted); font-size: 13px; }
.timelapse-admin { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 12px 12px; }
.visibility { font-size: 12px; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line); }
.visibility.public { color: #86efac; border-color: rgba(134, 239, 172, 0.4); }
.visibility.private { color: #fca5a5; border-color: rgba(252, 165, 165, 0.4); }

@media (max-width: 640px) {
  .brand-name { font-size: 1.05rem; }
  .site-header { gap: 8px; }
  .site-links .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .account .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .chat-launcher { right: 16px; bottom: 16px; }
  .chat-panel { right: 16px; bottom: 84px; }
  body:has(.visitor-chat-launcher) .site-footer { padding-right: 90px; }
}

@media (max-width: 430px) {
  .brand-name { display: none; }  /* the logo alone links home on phones */
  .site-links { gap: 6px; }  /* four links (a printer host, or any page while Live shows) stay on one row */
  .site-links .btn { padding: 0 8px; }
}
html[lang="ja"] { word-break: auto-phrase; }
.language-toggle { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.language-toggle button { min-height: 32px; min-width: 38px; padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.language-toggle button[aria-pressed="true"] { border-color: #71717a; background: #27272a; color: #fff; }
.language-toggle button:focus-visible { outline: 2px solid #22c55e; outline-offset: 2px; }
@media (max-width: 800px) {
  .site-header { flex-wrap: wrap; }
  .language-toggle { margin-left: auto; }
  .site-links { order: 1; flex-basis: 100%; flex-wrap: wrap; justify-content: center; margin-left: 0; }
}
.camera-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 0 0 10px; }
.camera-sources button { border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--muted); padding: 8px 12px; font: inherit; cursor: pointer; }
.camera-sources button[aria-pressed="true"] { background: #173c30; border-color: #6ee7b7; color: #e5fff1; }
.camera-sources .admin-badge { margin-left: auto; }
.room-camera { display: block; border: 0; width: 100%; height: auto; aspect-ratio: 16 / 10.6; min-height: 240px; }
.microscope-preview { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #090b0c; overflow: hidden; }
.microscope-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.microscope-preview p { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; color: var(--muted); }
.microscope-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-height: 40px; padding: 6px 0; font-size: 13px; color: var(--muted); }
.microscope-status a { margin-left: auto; color: #6ee7b7; }
.microscope-status [data-live="true"] { color: #6ee7b7; }
.microscope-view[hidden], .microscope-preview [hidden], .camera-column > [hidden] { display: none !important; }
.calibration-history { min-width: 0; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #6666; }
.calibration-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.calibration-heading h2 { margin: 0; }
.calibration-filters { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.calibration-filters label { display: flex; flex: 1 1 8rem; flex-direction: column; min-width: 0; gap: .25rem; }
.calibration-filters select { max-width: 100%; min-width: 0; padding: .5rem; color: inherit; background: #18202b; border: 1px solid #777; border-radius: .35rem; }
.calibration-cards { display: grid; gap: .6rem; min-width: 0; }
.calibration-entry { border: 1px solid #7776; border-radius: .5rem; padding: .75rem; min-width: 0; overflow-wrap: anywhere; }
.calibration-entry time, .calibration-note, .calibration-delta { font-size: .85em; opacity: .8; }
.calibration-entry p { margin: .4rem 0 0; }
.calibration-chip { border: 1px solid currentColor; border-radius: 1rem; padding: .15rem .5rem; font-size: .8em; }
.calibration-applied { color: #73dcaa; }
.calibration-proposed { color: #f1cf78; }
.calibration-failed { color: #ff9d9d; }
.calibration-note.calibration-proposed { opacity: 1; }
.calibration-timeline { margin-top: 1rem; }
.calibration-timeline summary { padding: .75rem 0; cursor: pointer; }
.calibration-measurements { font-variant-numeric: tabular-nums; }

/* Printer tasks board (admin): five columns that stack on narrow screens. */
.printer-board { margin-top: 28px; }
.printer-board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.printer-board-message { color: var(--muted); font-size: 13px; }
.printer-board-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 14px; }
.printer-board-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.printer-board-printing { display: grid; gap: 8px; margin-bottom: 12px; }
/* Columns follow the panel's own width (Solo, Dual or Quad), not the window's: 5 across only when there is room. */
.printer-board-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; align-items: start; }
.printer-board-column { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-width: 0; }
.printer-board-column h3 { font-size: 13px; margin: 2px 4px 8px; display: flex; gap: 6px; align-items: baseline; }
.printer-board-count { color: var(--muted); font-weight: 400; }
.printer-board-column[data-column="needs_attention"] h3 { color: #f1cf78; }
.printer-board-list { display: grid; gap: 8px; }
.printer-board-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; font-size: 13px; overflow-wrap: anywhere; }
.printer-board-live { border-color: #73dcaa; }
.printer-board-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.printer-board-tag { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); }
.printer-board-next { margin: 0; color: var(--muted); }
.printer-board-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.printer-board-file, .printer-board-empty { margin: 0; font-size: 12px; color: var(--muted); }
.printer-board-more { justify-self: start; }

/* Printer Status chat (admin). */
.printer-chat { margin-top: 28px; display: grid; gap: 10px; }
.printer-chat-hint, .printer-chat-status { color: var(--muted); font-size: 13px; margin: 0; }
.printer-chat-log { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.printer-chat-message { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; font-size: 14px; overflow-wrap: anywhere; }
.printer-chat-member { border-color: rgba(110, 231, 183, 0.4); }
.printer-chat-model { background: rgba(255, 255, 255, 0.03); }
.printer-chat-team { border-color: #c084fc; }
.printer-chat-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.printer-chat-text { margin: 0; white-space: pre-wrap; }
.printer-chat-delivery { margin: 0; font-size: 12px; color: var(--muted); }
.printer-chat-delivery.printer-chat-sent { color: #73dcaa; }
.printer-chat-delivery.printer-chat-refused { color: #ff9d9d; }
.printer-chat-suggest { justify-self: start; }
.printer-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: end; }
.printer-chat-form textarea { width: 100%; min-height: 44px; resize: vertical; font: inherit; }
@media (max-width: 640px) { .printer-chat-form { grid-template-columns: 1fr; } }

/* Slicer jobs and optional remote engines (admin workspace). */
.slicer-workspace { overflow: auto; }
.slicer-nav { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.slicer-nav [aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-line); }
.slicer-jobs { padding: 20px; }
.slicer-jobs-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slicer-jobs-heading h2 { font-size: 20px; margin: 0; }
.slicer-message, .slicer-muted { color: var(--muted); font-size: 14px; }
.slicer-job-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 24px; }
.slicer-job-list { display: flex; flex-direction: column; gap: 10px; }
.slicer-job { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px;
  text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.slicer-job[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-line); }
.slicer-job span, .slicer-job time { font-size: 13px; color: var(--muted); }
.slicer-job .slicer-job-state { color: #d8b4fe; }
.slicer-job-detail { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; }
.slicer-job-detail:empty { display: none; }
.slicer-job-detail h3 { margin-top: 0; font-size: 18px; overflow-wrap: anywhere; }
.slicer-job-detail img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 6px; background: #16151b; }
.slicer-job-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; }
.slicer-job-metrics dt { color: var(--muted); }
.slicer-job-metrics dd { text-align: right; margin: 0; }
.slicer-check { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px 12px;
  padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.slicer-check p { grid-column: 2; color: var(--muted); margin: 0; }
.slicer-pass { color: #86efac; } .slicer-fail { color: #fca5a5; }
.slicer-engine { margin: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.slicer-engine h3 { font-size: 16px; margin: 0 0 8px; }
.slicer-engine .app-control-bar { padding: 0; border: 0; }
.slicer-workspace [hidden] { display: none !important; }
@media (max-width: 700px) {
  .slicer-jobs { padding: 12px; }
  .slicer-job-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .slicer-job-detail { padding: 12px; }
  .slicer-engine .app-control-actions { flex-wrap: wrap; }
}

/* Private agent conversations occupy the opposite corner from the existing public chat and terminal. */
.agent-chat-launcher { position: fixed; left: 16px; bottom: calc(20px + var(--site-version-clearance)); z-index: 1101; display: flex; align-items: center;
  gap: 8px; padding: 12px 16px; border: 1px solid #80c6ae; border-radius: 28px; background: #153e32;
  color: #f1fff8; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px #0008; }
.agent-chat-unread { min-width: 22px; padding: 2px 6px; border-radius: 20px; background: #ddf8a2; color: #163620; }
.agent-chat-panel { position: fixed; left: 16px; bottom: calc(82px + var(--site-version-clearance)); z-index: 1101; box-sizing: border-box;
  width: min(440px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 156px - var(--site-version-clearance))); display: flex;
  flex-direction: column; gap: 10px; padding: 16px; border: 1px solid #536d61; border-radius: 16px;
  background: #111d18; color: #e8f1ec; box-shadow: 0 16px 50px #0009; }
.agent-chat-panel[hidden], .agent-chat-launcher[hidden], .agent-chat-unread[hidden], .agent-chat-form[hidden] { display: none; }
.agent-chat-panel textarea { width: 100%; box-sizing: border-box; background: #08140e;
  color: inherit; border: 1px solid #526f60; border-radius: 8px; padding: 10px; font: inherit; }
.agent-chat-messages { min-height: 60px; flex: 1; overflow: auto; overscroll-behavior: contain; }
.agent-chat-message { padding: 10px; margin-bottom: 10px; border-radius: 10px; background: #21352b; }
.agent-chat-message.admin { margin-left: 24px; background: #203e3e; }
.agent-chat-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .8rem; }
.agent-chat-meta time { color: #b3c9bb; }
.agent-chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; line-height: 1.5; }
.agent-chat-form { display: flex; flex-direction: column; gap: 8px; }
.agent-chat-recipient-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.agent-chat-shift { padding: 5px 0; border: 1px solid #80c6ae; border-radius: 8px;
  background: #153e32; color: #f1fff8; font: inherit; cursor: pointer; }
.agent-chat-shift:disabled { opacity: .35; cursor: default; }
.agent-chat-mentions { display: flex; gap: 6px; overflow-x: auto; flex-wrap: nowrap; padding: 2px 0; }
.agent-chat-mentions button { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #526f60; border-radius: 14px;
  background: #08140e; color: #c1d5ca; font: inherit; font-size: .8rem; cursor: pointer; }
.agent-chat-mentions button[aria-pressed="true"] { border-color: #b7ec9c; background: #254b36; color: #edffe3; }
.agent-chat-actions { display: flex; justify-content: space-between; gap: 12px; }
.agent-chat-form textarea { resize: vertical; min-height: 64px; max-height: 140px; }
.agent-chat-status { min-height: 0; margin: 0; color: #e2d6ad; font-size: .85rem; }
@media (max-width: 600px) {
  .agent-chat-launcher { left: 12px; bottom: calc(16px + var(--site-version-clearance)); }
  .agent-chat-panel { left: 12px; width: calc(100vw - 24px); bottom: calc(76px + var(--site-version-clearance));
    height: calc(100dvh - 148px - var(--site-version-clearance)); padding: 12px; }
  .agent-chat-panel textarea { font-size: 16px; }
}
