:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-muted: #f8faf9;
  --text: #18201c;
  --muted: #647069;
  --line: #dce2de;
  --line-strong: #c8d0cb;
  --green: #0e9f67;
  --green-dark: #08764c;
  --green-soft: #e5f6ee;
  --blue: #3867c8;
  --blue-soft: #eaf0fc;
  --coral: #cf624f;
  --coral-soft: #fbece8;
  --amber: #a8660f;
  --amber-soft: #fff2dc;
  --red: #c7473c;
  --red-soft: #fcebea;
  --header-bg: rgba(255, 255, 255, 0.96);
  --input-bg: #ffffff;
  --hover-bg: #f7f8f6;
  --row-hover: rgba(255, 255, 255, 0.75);
  --neutral-bg: #ecefeb;
  --neutral-text: #56605a;
  --neutral-soft: #eef0ee;
  --neutral-muted: #8a928d;
  --badge-bg: #edf0ed;
  --badge-text: #536059;
  --track: #e9ece9;
  --code-bg: #f8f9f7;
  --code-text: #2c332f;
  --login-bg: #eef1ed;
  --button-bg: #18201c;
  --button-hover: #2d332f;
  --button-text: #ffffff;
  --error-text: #8f2922;
  --warning-text: #80500f;
  --success-border: #bde4d1;
  --error-border: #efc7c3;
  --swatch-border: rgba(0, 0, 0, 0.14);
  --swatch-highlight: rgba(255, 255, 255, 0.18);
  --shadow: 0 12px 32px rgba(25, 35, 30, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101512;
  --surface: #1a211d;
  --surface-muted: #151b18;
  --text: #edf3ef;
  --muted: #9da9a2;
  --line: #303a34;
  --line-strong: #465249;
  --green: #35c98a;
  --green-dark: #70dda9;
  --green-soft: #17382a;
  --blue: #82a8ff;
  --blue-soft: #1b2b48;
  --coral: #ef8d7c;
  --coral-soft: #43251f;
  --amber: #e5ad57;
  --amber-soft: #3c2f1d;
  --red: #f08b82;
  --red-soft: #432522;
  --header-bg: rgba(20, 27, 23, 0.96);
  --input-bg: #111713;
  --hover-bg: #242d28;
  --row-hover: rgba(255, 255, 255, 0.035);
  --neutral-bg: #252e29;
  --neutral-text: #b7c1bb;
  --neutral-soft: #222a25;
  --neutral-muted: #929e97;
  --badge-bg: #252e29;
  --badge-text: #bac4be;
  --track: #303a34;
  --code-bg: #101512;
  --code-text: #cbd5cf;
  --login-bg: #0d120f;
  --button-bg: #35c98a;
  --button-hover: #56d79b;
  --button-text: #0d1712;
  --error-text: #ffaaa3;
  --warning-text: #f0c378;
  --success-border: #286246;
  --error-border: #75413c;
  --swatch-border: rgba(255, 255, 255, 0.2);
  --swatch-highlight: rgba(255, 255, 255, 0.12);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); }
a { color: inherit; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(14, 159, 103, .28); outline-offset: 2px; }

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand, .login-brand { display: flex; align-items: center; gap: 11px; font-weight: 750; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--green-dark); color: var(--button-text); border-radius: 6px; }
.brand-mark.large { width: 42px; height: 42px; }
.main-nav { display: flex; align-items: center; align-self: stretch; gap: 5px; margin-left: 32px; margin-right: auto; }
.main-nav a { position: relative; height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--muted); border-radius: 5px; text-decoration: none; font-size: 13px; font-weight: 680; }
.main-nav a:hover { color: var(--text); background: var(--surface-muted); }
.main-nav a.active { color: var(--green-dark); background: var(--green-soft); }
.main-nav svg { width: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-actions form { margin: 0; }
.user-name { font-size: 14px; color: var(--muted); }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); transition: border-color .15s, background .15s, color .15s; }
.icon-button:hover { border-color: var(--line-strong); background: var(--hover-bg); }
.icon-button.active { color: var(--green-dark); border-color: var(--green); background: var(--green-soft); }
.theme-toggle { position: relative; }
.theme-icon { grid-area: 1 / 1; }
:root[data-theme="light"] .theme-icon-sun, :root[data-theme="dark"] .theme-icon-moon { display: none; }

.page-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 72px; }
.page-heading, .detail-heading, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; line-height: 1.15; }
h2 { font-size: 18px; line-height: 1.3; }
.eyebrow { margin-bottom: 7px; color: var(--green-dark); font-size: 11px; font-weight: 780; text-transform: uppercase; }
.muted { color: var(--muted); }
.fleet-summary { display: flex; gap: 24px; color: var(--muted); font-size: 14px; }
.fleet-summary strong { color: var(--text); font-size: 18px; }

.printer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr)); gap: 18px; margin-top: 20px; }
.printer-card { min-width: 0; padding: 18px; display: flex; flex-direction: column; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 1px 2px rgba(26,36,30,.025); transition: border-color .16s, box-shadow .16s, transform .16s; }
.printer-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.printer-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.printer-glyph { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; background: var(--neutral-bg); color: var(--neutral-text); }
.printer-glyph.running, .printer-glyph.success { background: var(--green-soft); color: var(--green-dark); }
.printer-glyph.paused { background: var(--amber-soft); color: var(--amber); }
.printer-glyph.error { background: var(--red-soft); color: var(--red); }
.printer-glyph.offline { background: var(--neutral-soft); color: var(--neutral-muted); }
.status-badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; background: var(--badge-bg); color: var(--badge-text); font-size: 12px; font-weight: 700; }
.status-badge.running, .status-badge.success { background: var(--green-soft); color: var(--green-dark); }
.status-badge.paused { background: var(--amber-soft); color: var(--amber); }
.status-badge.error { background: var(--red-soft); color: var(--red); }
.status-badge.large { padding: 8px 12px; font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.printer-identity { margin: 16px 0 18px; min-width: 0; }
.printer-identity h2, .printer-identity h3 { margin: 0 0 4px; font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.printer-identity p { margin: 0; color: var(--muted); font-size: 13px; }
.job-block { min-height: 53px; padding: 12px 13px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); }
.job-block span, .job-block strong { display: block; }
.job-block span { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.job-block strong { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-track { width: 100%; height: 6px; flex: 1; display: block; overflow: hidden; appearance: none; border: 0; border-radius: 3px; background: var(--track); }
.progress-track::-webkit-progress-bar { background: var(--track); }
.progress-track::-webkit-progress-value { background: var(--green); transition: width .35s; }
.progress-track::-moz-progress-bar { background: var(--green); }
.progress-row strong { width: 38px; text-align: right; font-size: 13px; }
.printer-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.printer-metrics div { min-width: 0; padding: 0 11px; border-left: 1px solid var(--line); }
.printer-metrics div:first-child { padding-left: 0; border: 0; }
.printer-metrics span, .stats-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.printer-metrics strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; color: var(--muted); font-size: 10px; }
.card-footer svg { width: 16px; }
.rich-printer-card { padding: 20px; }
.printer-card-title { min-width: 0; display: flex; align-items: center; gap: 12px; }
.rich-printer-card .printer-identity { min-width: 0; margin: 0; }
.rich-printer-card .printer-identity h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.printer-card-status { display: flex; align-items: center; gap: 7px; }
.alert-chip { min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 7px; color: var(--red); background: var(--red-soft); border-radius: 999px; font-size: 10px; font-weight: 750; }
.alert-chip svg { width: 13px; height: 13px; }
.printer-context { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; color: var(--muted); font-size: 10px; }
.printer-context span { min-width: 0; display: inline-flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.printer-context svg { width: 12px; height: 12px; flex: 0 0 12px; }
.printer-context strong { color: var(--text); font-weight: 650; }
.dashboard-job { margin-top: 18px; padding: 16px 0 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dashboard-job-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.dashboard-job-heading strong { color: var(--green-dark); font-size: 10px; }
.dashboard-job h4 { min-height: 38px; margin: 8px 0 13px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.job-facts { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 11px; color: var(--muted); font-size: 10px; }
.job-facts span { display: inline-flex; align-items: center; gap: 5px; }
.job-facts svg { width: 13px; height: 13px; }
.job-facts strong { color: var(--text); font-size: 10px; }
.printer-thermal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 16px 0; border-bottom: 1px solid var(--line); }
.printer-thermal-grid > div { position: relative; min-width: 0; padding: 0 14px; border-left: 1px solid var(--line); }
.printer-thermal-grid > div:first-child { padding-left: 0; border-left: 0; }
.printer-thermal-grid > div > svg { width: 14px; height: 14px; margin-bottom: 7px; color: var(--green-dark); }
.printer-thermal-grid span, .printer-thermal-grid strong, .printer-thermal-grid small { display: block; }
.printer-thermal-grid span { margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.printer-thermal-grid strong { font-size: 14px; }
.printer-thermal-grid small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.printer-electrical { min-width: 0; display: grid; grid-template-columns: 34px repeat(3, minmax(0, 1fr)); align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.data-band-icon { width: 32px; height: 32px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 5px; }
.data-band-icon svg { width: 15px; height: 15px; }
.printer-electrical > div { min-width: 0; }
.printer-electrical span, .printer-electrical strong { display: block; }
.printer-electrical div span { margin-bottom: 3px; color: var(--muted); font-size: 9px; }
.printer-electrical div strong { font-size: 11px; overflow-wrap: anywhere; }
.dashboard-ams { padding: 14px 0 2px; }
.data-band-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.data-band-heading > span { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 750; }
.data-band-heading svg { width: 14px; height: 14px; color: var(--coral); }
.data-band-heading small { color: var(--muted); font-size: 9px; }
.dashboard-ams-environment { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.dashboard-ams-environment > span { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 8px; background: var(--surface-muted); border-radius: 5px; font-size: 9px; }
.dashboard-ams-environment strong { font-size: 9px; }
.dashboard-ams-environment small { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 9px; }
.dashboard-ams-environment svg { width: 11px; height: 11px; color: var(--green-dark); }
.dashboard-ams-slots { min-height: 44px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.dashboard-ams-slot { min-width: 0; display: flex; align-items: center; gap: 7px; padding: 7px; background: var(--surface-muted); border-radius: 5px; }
.dashboard-ams-slot > svg { width: 20px; height: 20px; flex: 0 0 20px; }
.dashboard-ams-slot .spool-hole { fill: var(--surface-muted); }
.dashboard-ams-slot > span { min-width: 0; }
.dashboard-ams-slot strong, .dashboard-ams-slot small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-ams-slot strong { font-size: 9px; }
.dashboard-ams-slot small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.rich-printer-card .card-footer > span { display: inline-flex; align-items: center; gap: 5px; }

.dashboard-page { padding-top: 28px; }
.dashboard-heading { align-items: center; }
.dashboard-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.sync-indicator { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; color: var(--green-dark); border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: 11px; font-weight: 680; }
.sync-indicator.syncing { color: var(--muted); }
.sync-indicator.error { color: var(--red); }
.sync-indicator.syncing .status-dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.overview-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.overview-metrics > div { min-width: 0; min-height: 82px; display: flex; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 1px 2px rgba(26,36,30,.025); }
.overview-metrics > div > div { min-width: 0; }
.overview-metrics > div > div > span { display: block; }
.overview-metrics > div > div > span { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.overview-metrics strong { display: flex; align-items: baseline; gap: 5px; font-size: 22px; line-height: 1.2; white-space: nowrap; }
.overview-metrics strong span { display: inline; }
.overview-metrics strong small { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 6px; }
.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.green { color: var(--green-dark); background: var(--green-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.coral { color: var(--coral); background: var(--coral-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.violet { color: var(--blue); background: var(--blue-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }
.dashboard-section { margin-top: 28px; }
.dashboard-section .section-heading { align-items: center; }
.section-count { color: var(--muted); font-size: 11px; font-weight: 650; }
.compact-empty { margin-top: 20px; padding: 42px 20px; }
.dashboard-columns { display: grid; grid-template-columns: 1.15fr .85fr; gap: 44px; }
.dashboard-feed { min-width: 0; }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--green-dark); text-decoration: none; font-size: 11px; font-weight: 700; }
.text-link:hover { color: var(--text); }
.text-link svg { width: 14px; height: 14px; }
.compact-list { margin-top: 16px; border-top: 1px solid var(--line); }
.compact-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 28px; align-items: center; gap: 12px; min-width: 0; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.compact-row:hover { background: var(--row-hover); }
.print-thumb.small { width: 46px; height: 46px; }
.compact-main { min-width: 0; }
.compact-main strong, .compact-main span, .compact-value strong, .compact-value span { display: block; }
.compact-main strong { margin-bottom: 4px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-main span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-value { text-align: right; }
.compact-value strong { margin-bottom: 3px; font-size: 12px; }
.compact-value span { color: var(--muted); font-size: 10px; }
.compact-value.low strong { color: var(--red); }
.status-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.status-icon svg { width: 13px; height: 13px; }
.status-icon.success { color: var(--green-dark); background: var(--green-soft); }
.status-icon.error { color: var(--red); background: var(--red-soft); }
.status-icon.running { color: var(--blue); background: var(--blue-soft); }
.status-icon.paused { color: var(--amber); background: var(--amber-soft); }
.small-swatch { width: 36px; height: 36px; margin-left: 5px; border: 1px solid rgba(0,0,0,.1); border-radius: 50%; }
.healthy-line, .empty-line { min-height: 86px; display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.healthy-line { color: var(--green-dark); font-weight: 650; }
.healthy-line svg { width: 18px; }

.empty-state { margin-top: 28px; padding: 72px 20px; text-align: center; border: 1px dashed var(--line-strong); }
.empty-state > svg { width: 36px; height: 36px; color: var(--muted); }
.empty-state h2 { margin: 14px 0 6px; }
.empty-state p { margin: 0; color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 30px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.back-link:hover { color: var(--text); }
.detail-heading { align-items: center; padding-bottom: 32px; }
.detail-title { min-width: 0; display: flex; align-items: center; gap: 16px; }
.detail-title h1 { overflow-wrap: anywhere; }
.serial { margin: 5px 0 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.current-job { padding: 30px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-heading h2 { margin-bottom: 0; font-size: 20px; overflow-wrap: anywhere; }
.progress-number { font-size: 30px; }
.progress-track.large { height: 9px; margin: 24px 0 30px; border-radius: 5px; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats-grid > div { min-width: 0; padding: 0 18px; border-left: 1px solid var(--line); }
.stats-grid > div:first-child { padding-left: 0; border: 0; }
.stats-grid svg { width: 18px; height: 18px; margin-bottom: 12px; color: var(--green-dark); }
.stats-grid strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.detail-band { padding: 34px 0; border-bottom: 1px solid var(--line); }
.top-space { margin-top: 20px; }
.chart-wrap { position: relative; height: 330px; margin-top: 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.chart-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.chart-empty svg { width: 30px; height: 30px; }
.electrical-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.electrical-chart-grid > div { min-width: 0; }
.electrical-chart-grid h3 { margin: 0 0 10px; font-size: 13px; }
.electrical-chart { height: 290px; margin-top: 0; padding: 14px; }
.ams-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.ams-units { margin-top: 22px; border-top: 1px solid var(--line); }
.ams-unit { padding: 18px 0 4px; border-bottom: 1px solid var(--line); }
.ams-unit-heading { display: flex; align-items: center; gap: 20px; }
.ams-unit-heading > strong { margin-right: auto; font-size: 14px; }
.ams-unit-heading > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.ams-unit-heading > span.sensor-invalid { color: var(--amber); }
.ams-unit-heading svg { width: 14px; height: 14px; color: var(--green-dark); }
.ams-unit .ams-grid { margin-top: 13px; }
.ams-environment-chart { margin-top: 24px; }
.ams-slot { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.filament-swatch { width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid rgba(0,0,0,.12); border-radius: 50%; }
.ams-slot div { min-width: 0; }
.ams-slot span, .ams-slot strong, .ams-slot small { display: block; overflow-wrap: anywhere; }
.ams-slot div > span, .ams-slot small { color: var(--muted); font-size: 11px; }
.ams-slot strong { margin: 3px 0; font-size: 13px; }
.health-ok { display: flex; align-items: center; gap: 10px; margin-top: 20px; color: var(--green-dark); font-size: 14px; font-weight: 650; }
.hms-list { margin-top: 20px; }
.hms-row { display: grid; grid-template-columns: 22px max-content 1fr; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--red); }
.hms-row code { color: var(--text); font-size: 12px; }
.hms-row span { color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.event-list { margin-top: 22px; }
.event-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.event-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); border-radius: 5px; }
.event-icon svg { width: 17px; }
.event-row strong, .event-row span { display: block; }
.event-row strong { margin-bottom: 3px; font-size: 14px; }
.event-row div span { color: var(--muted); font-size: 12px; }
.raw-data { margin-top: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.raw-data summary { display: flex; align-items: center; gap: 10px; padding: 15px 17px; cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; }
.raw-data summary::-webkit-details-marker { display: none; }
.raw-data .summary-chevron { margin-left: auto; transition: transform .15s; }
.raw-data[open] .summary-chevron { transform: rotate(180deg); }
.raw-data pre { max-height: 520px; overflow: auto; margin: 0; padding: 18px; border-top: 1px solid var(--line); background: var(--code-bg); color: var(--code-text); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--login-bg); }
.login-panel { width: min(420px, 100%); padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.floating-theme-toggle { position: fixed; top: 18px; right: 18px; }
.login-brand { margin-bottom: 34px; }
.login-panel h1 { margin-bottom: 8px; font-size: 28px; }
.login-panel > .muted { margin-bottom: 28px; }
.login-form { display: grid; }
.login-form label { margin: 14px 0 7px; font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 5px; outline: none; color: var(--text); background: var(--input-bg); }
.login-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,166,106,.12); }
.primary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; margin-top: 24px; padding: 0 17px; border: 0; border-radius: 5px; background: var(--button-bg); color: var(--button-text); font-weight: 700; text-decoration: none; }
.primary-button:hover { background: var(--button-hover); }
.alert { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border-radius: 5px; font-size: 13px; }
.alert svg { width: 18px; flex: 0 0 18px; }
.error-alert { background: var(--red-soft); color: var(--error-text); }
.success-alert { background: var(--green-soft); color: var(--green-dark); }
.page-notice { margin-bottom: 24px; }
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.error-code { margin: 22px 0 5px; color: var(--green-dark); font-weight: 800; }
.error-page .primary-button { margin-top: 12px; }

.primary-button.compact { min-height: 40px; margin-top: 0; font-size: 13px; }
.secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); font-weight: 700; text-decoration: none; }
.inventory-heading { align-items: center; }
.inventory-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 30px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.inventory-summary > div { padding: 0 22px; border-left: 1px solid var(--line); }
.inventory-summary > div:first-child { padding-left: 0; border: 0; }
.inventory-summary span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.inventory-summary strong { font-size: 22px; }
.view-tabs { display: flex; gap: 5px; margin-top: 24px; border-bottom: 1px solid var(--line); }
.view-tabs a { padding: 10px 13px; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; font-size: 13px; font-weight: 700; }
.view-tabs a.active { color: var(--green-dark); border-color: var(--green); }
.spool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.spool-card { min-width: 0; padding: 19px; color: inherit; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-decoration: none; transition: border-color .16s, box-shadow .16s, transform .16s; }
.spool-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.spool-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.large-swatch { width: 48px; height: 48px; border: 1px solid var(--swatch-border); border-radius: 50%; box-shadow: inset 0 0 0 7px var(--swatch-highlight); }
.source-badge { padding: 5px 8px; color: var(--muted); background: var(--neutral-soft); border-radius: 999px; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.spool-name { margin: 17px 0 21px; }
.spool-name p { margin-bottom: 3px; color: var(--green-dark); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.spool-name h2 { margin-bottom: 3px; overflow-wrap: anywhere; }
.spool-name > span { color: var(--muted); font-size: 12px; }
.weight-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.weight-line strong { font-size: 20px; }
.weight-line span { color: var(--muted); font-size: 11px; }
.spool-meta { display: grid; gap: 8px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.spool-meta span { display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; }
.spool-meta svg { width: 14px; height: 14px; color: var(--green-dark); }
.narrow-page { width: min(920px, calc(100% - 48px)); }
.form-alert { margin-top: 24px; }
.data-form { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; }
.data-form label, .compact-tool label { display: grid; gap: 7px; min-width: 0; color: var(--text); font-size: 12px; font-weight: 700; }
.data-form input, .data-form textarea, .data-form select, .compact-tool input, .compact-tool select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 5px; outline: none; color: var(--text); background: var(--input-bg); }
.data-form input:focus, .data-form textarea:focus, .data-form select:focus, .compact-tool input:focus, .compact-tool select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,166,106,.12); }
.data-form input[type="color"] { padding: 5px; }
.full-field { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.form-actions .primary-button { margin-top: 0; }
.input-unit { display: grid; grid-template-columns: 1fr 36px; align-items: center; }
.input-unit input { grid-column: 1 / -1; grid-row: 1; padding-right: 38px; }
.input-unit > span { grid-column: 2; grid-row: 1; z-index: 1; color: var(--muted); font-size: 12px; font-weight: 500; pointer-events: none; }
.spool-detail-heading { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 18px; padding-bottom: 28px; }
.hero-swatch { width: 64px; height: 64px; border: 1px solid var(--swatch-border); border-radius: 50%; box-shadow: inset 0 0 0 10px var(--swatch-highlight); }
.spool-detail-heading h1 { overflow-wrap: anywhere; }
.spool-detail-heading .muted { margin: 5px 0 0; }
.stock-band { padding: 30px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stock-number { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.stock-number strong { font-size: 32px; }
.stock-number span { color: var(--muted); font-size: 13px; }
.stock-properties { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stock-properties > div { min-width: 0; padding: 0 17px; border-left: 1px solid var(--line); }
.stock-properties > div:first-child { padding-left: 0; border: 0; }
.stock-properties span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.stock-properties strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; }
.compact-tool { min-width: 0; display: grid; align-content: start; gap: 15px; }
.compact-tool h2 { margin-bottom: 0; }
.compact-tool .primary-button { justify-self: start; margin-top: 0; font-size: 13px; }
.measurement-result { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 13px; border: 1px solid var(--success-border); border-radius: 6px; background: var(--green-soft); color: var(--green-dark); }
.measurement-result strong, .measurement-result span { display: block; }
.measurement-result strong { font-size: 18px; }
.measurement-result span { text-align: right; font-size: 10px; font-weight: 650; }
.measurement-result.invalid { border-color: var(--error-border); background: var(--red-soft); color: var(--red); }
.measurement-result.invalid strong { font-size: 13px; }
.measurement-tool input[list] { padding-right: 28px; }
.ams-location-fields { display: grid; gap: 15px; }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.movement-list { margin-top: 20px; }
.movement-row { display: grid; grid-template-columns: 130px 1fr 80px 90px; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); font-size: 12px; }
.movement-type { color: var(--muted); }
.movement-row div strong, .movement-row div span { display: block; }
.movement-row div strong { margin-bottom: 3px; font-size: 13px; overflow-wrap: anywhere; }
.movement-row div span, .movement-balance { color: var(--muted); font-size: 11px; }
.movement-delta { text-align: right; }
.movement-delta.negative { color: var(--red); }
.movement-delta.positive { color: var(--green-dark); }
.movement-balance { text-align: right; }
.archive-actions { display: flex; gap: 16px; padding-top: 24px; }
.archive-actions button { display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.archive-actions button:hover { color: var(--text); }
.archive-actions svg { width: 16px; }

.secondary-button.compact { min-height: 40px; font-size: 13px; }
.warning-alert { color: var(--warning-text); background: var(--amber-soft); }
.warning-alert svg { flex: 0 0 18px; }
.history-heading { align-items: center; }
.history-summary small { display: block; margin-top: 5px; color: var(--amber); font-size: 10px; font-weight: 700; }
.history-filters { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.history-filters .view-tabs { flex: 1; }
.history-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.history-filters select { min-width: 180px; height: 38px; padding: 0 34px 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--input-bg); color: var(--text); }
.history-filters .icon-button { height: 38px; }
.history-list { margin-top: 20px; border-top: 1px solid var(--line); }
.history-row { display: grid; grid-template-columns: 58px minmax(200px, 1fr) repeat(4, 82px) 110px 20px; align-items: center; gap: 14px; min-width: 0; padding: 14px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.history-row:hover { background: var(--row-hover); }
.history-row .status-badge.running, .print-detail-heading .status-badge.running { color: var(--blue); background: var(--blue-soft); }
.print-thumb { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--neutral-bg); color: var(--muted); }
.print-thumb img { width: 100%; height: 100%; grid-area: 1 / 1; object-fit: cover; }
.print-cover-image { z-index: 1; }
.history-main { min-width: 0; }
.history-main strong, .history-main span { display: block; overflow-wrap: anywhere; }
.history-main strong { margin-bottom: 5px; font-size: 14px; }
.history-main span { color: var(--muted); font-size: 11px; }
.history-main .history-project { width: fit-content; max-width: 100%; min-height: 24px; display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--coral) 32%, transparent); border-radius: 5px; color: var(--coral); background: var(--coral-soft); }
.history-project svg { width: 13px; height: 13px; flex: 0 0 13px; }
.history-project small { color: currentColor; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.history-project b { min-width: 0; overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-metric span, .history-metric strong { display: block; }
.history-metric span { margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.history-metric strong { font-size: 12px; }
.history-metric small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.row-chevron { width: 17px; color: var(--muted); }
.print-detail-heading { display: grid; grid-template-columns: 112px 1fr auto; align-items: center; gap: 22px; padding-bottom: 28px; }
.print-detail-heading h1 { overflow-wrap: anywhere; }
.print-detail-heading .muted { margin: 7px 0 0; }
.print-detail-media { width: 112px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--neutral-bg); color: var(--muted); }
.print-detail-media img { width: 100%; height: 100%; grid-area: 1 / 1; object-fit: cover; }
.print-detail-media svg { width: 32px; height: 32px; }
.print-properties { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.material-lines { margin-top: 20px; border-top: 1px solid var(--line); }
.material-line { display: grid; grid-template-columns: 34px minmax(180px, 1fr) repeat(3, 100px); align-items: center; gap: 15px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.material-line-swatch { width: 30px; height: 30px; border: 1px solid rgba(0,0,0,.12); border-radius: 50%; }
.material-line div strong, .material-line div span { display: block; }
.material-line div > span { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.material-line div:first-of-type strong { font-size: 13px; }
.material-line div:first-of-type span { margin: 3px 0 0; }
.material-line div:not(:first-of-type) strong { font-size: 12px; }
.project-assignment form { display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: 12px; margin-top: 20px; }
.project-assignment label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.project-assignment select { width: 100%; height: 40px; padding: 0 34px 0 10px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text); background: var(--input-bg); }
.project-assignment .primary-button { margin-top: 0; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.project-card { min-width: 0; padding: 19px; color: inherit; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-decoration: none; transition: border-color .16s, box-shadow .16s, transform .16s; }
.project-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.project-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 6px; color: var(--blue); background: var(--blue-soft); }
.project-icon svg { width: 19px; height: 19px; }
.project-card-copy { min-height: 100px; padding: 18px 0; }
.project-card-copy h2 { margin-bottom: 7px; overflow-wrap: anywhere; }
.project-card-copy p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.project-card-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.project-card-metrics div { min-width: 0; padding: 0 9px; border-left: 1px solid var(--line); }
.project-card-metrics div:first-child { padding-left: 0; border: 0; }
.project-card-metrics span, .project-card-metrics strong { display: block; }
.project-card-metrics span { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.project-card-metrics strong { font-size: 13px; overflow-wrap: anywhere; }
.project-card-metrics small { display: block; margin-top: 4px; color: var(--amber); font-size: 8px; font-weight: 700; }
.project-detail-heading { align-items: center; }
.project-description { max-width: 720px; margin: 9px 0 0; line-height: 1.55; white-space: pre-line; }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.project-summary small { display: block; margin-top: 5px; color: var(--amber); font-size: 10px; font-weight: 700; }
.project-summary { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.settings-page { width: min(1080px, calc(100% - 48px)); }
.settings-band { padding: 30px 0; border-bottom: 1px solid var(--line); }
.settings-band:first-of-type { margin-top: 18px; border-top: 1px solid var(--line); }
.settings-band .section-heading { align-items: center; }
.settings-form { margin-top: 22px; padding-top: 0; border-top: 0; }
.toggle-field { min-height: 40px; display: flex !important; grid-auto-flow: column; align-items: center; justify-content: start; gap: 9px !important; color: var(--muted) !important; }
.toggle-field input { width: 17px !important; min-height: 17px !important; margin: 0; accent-color: var(--green); }
.settings-actions { justify-content: space-between; }
.mapping-form { margin-top: 20px; }
.mapping-list { border-top: 1px solid var(--line); }
.mapping-row { min-width: 0; display: grid; grid-template-columns: minmax(200px, .45fr) minmax(420px, 1.55fr); align-items: start; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.mapping-printer { min-width: 0; display: flex; align-items: center; gap: 12px; }
.mapping-printer .printer-glyph { width: 38px; height: 38px; flex: 0 0 38px; }
.mapping-printer strong, .mapping-printer small { display: block; overflow-wrap: anywhere; }
.mapping-printer strong { margin-bottom: 4px; font-size: 13px; }
.mapping-printer small { color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.mapping-sensors { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; }
.mapping-select { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.mapping-select > span, .mapping-select > span strong, .mapping-select > span small { display: block; }
.mapping-select > span strong { margin-bottom: 4px; color: var(--text); font-size: 11px; }
.mapping-select > span small { min-height: 28px; color: var(--muted); font-size: 9px; line-height: 1.45; font-weight: 500; }
.mapping-select input { width: 100%; height: 40px; min-width: 0; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 5px; outline: none; color: var(--text); background: var(--input-bg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.mapping-select input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,166,106,.12); }
.current-rate { text-align: right; }
.current-rate strong, .current-rate span { display: block; }
.current-rate strong { margin-bottom: 3px; font-size: 18px; }
.current-rate span { color: var(--muted); font-size: 10px; }
.price-entry-form { display: grid; grid-template-columns: 1fr 100px 1fr auto; align-items: end; gap: 12px; margin-top: 20px; }
.price-entry-form label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.price-entry-form input, .price-entry-form select { width: 100%; height: 40px; min-width: 0; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text); background: var(--input-bg); }
.price-entry-form .primary-button { margin-top: 0; }
.price-history { margin-top: 22px; border-top: 1px solid var(--line); }
.price-history > div { display: grid; grid-template-columns: 1fr 1fr 60px; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.price-history > div span { color: var(--muted); }
.price-history > div small { color: var(--muted); text-align: right; font-size: 9px; font-weight: 750; }
.role-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.role-overview > div { min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.role-overview strong { display: block; margin-bottom: 4px; font-size: 12px; }
.role-overview p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.role-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 5px; }
.role-icon svg { width: 16px; height: 16px; }
.role-icon.admin { color: var(--green-dark); background: var(--green-soft); }
.role-icon.operator { color: var(--amber); background: var(--amber-soft); }
.role-icon.viewer { color: var(--blue); background: var(--blue-soft); }
.user-list { margin-top: 28px; border-top: 1px solid var(--line); }
.user-list-heading, .user-row { display: grid; grid-template-columns: minmax(220px, 1fr) 120px 180px 110px 20px; align-items: center; gap: 14px; }
.user-list-heading { padding: 10px 4px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.user-row { min-width: 0; padding: 14px 4px; color: inherit; border-bottom: 1px solid var(--line); text-decoration: none; }
.user-row:hover { background: var(--row-hover); }
.user-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.user-avatar { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); border-radius: 5px; }
.user-avatar svg { width: 16px; height: 16px; }
.user-identity strong, .user-identity small { display: block; overflow-wrap: anywhere; }
.user-identity strong { margin-bottom: 4px; font-size: 13px; }
.user-identity small, .user-login { color: var(--muted); font-size: 10px; }
.role-badge { width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 750; }
.role-badge.admin { color: var(--green-dark); background: var(--green-soft); }
.role-badge.operator { color: var(--amber); background: var(--amber-soft); }
.role-badge.viewer { color: var(--blue); background: var(--blue-soft); }
.user-row > svg { width: 16px; color: var(--muted); }
.role-selection-help { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.role-selection-help > div { min-width: 0; padding: 12px; border-left: 2px solid var(--line-strong); background: var(--surface-muted); }
.role-selection-help strong, .role-selection-help span { display: block; }
.role-selection-help strong { margin-bottom: 4px; font-size: 11px; }
.role-selection-help span { color: var(--muted); font-size: 9px; line-height: 1.5; }
.setup-section { margin-top: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.price-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 14px; margin-top: 20px; }
.price-form label, .price-rule label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 10px; font-weight: 700; }
.price-form input, .price-rule input { width: 100%; height: 40px; min-width: 0; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--input-bg); color: var(--text); outline: none; }
.price-form input:focus, .price-rule input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,166,106,.12); }
.price-form .primary-button { justify-self: start; margin-top: 0; font-size: 13px; }
.currency-unit { grid-template-columns: 1fr 44px; }
.price-list { display: grid; gap: 12px; margin-top: 20px; }
.price-rule { padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.price-rule-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.price-rule-heading > div:first-child { min-width: 0; }
.price-rule-heading strong, .price-rule-heading span { display: block; }
.price-rule-heading strong { margin-bottom: 4px; font-size: 14px; overflow-wrap: anywhere; }
.price-rule-heading > div:first-child span { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.rule-actions { display: flex; align-items: center; gap: 7px; }
.price-rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; margin-top: 14px; }
.price-rule .toggle-field { display: flex; align-items: center; gap: 8px; height: 40px; }
.price-rule .toggle-field input { width: 17px; height: 17px; }
.danger-button { color: var(--red); }
.danger-button:hover { border-color: var(--red); background: var(--red-soft); }
.detected-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin-top: 20px; border-top: 1px solid var(--line); }
.detected-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detected-list strong { font-size: 13px; }
.detected-list span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

@media (max-width: 980px) {
  .overview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .dashboard-columns { grid-template-columns: 1fr; gap: 0; }
  .printer-grid { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 28px; }
  .stats-grid > div:nth-child(4) { padding-left: 0; border-left: 0; }
  .ams-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .electrical-chart-grid { grid-template-columns: 1fr; }
  .spool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-summary, .stock-properties { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; }
  .inventory-summary > div:nth-child(3), .stock-properties > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .history-row { grid-template-columns: 58px minmax(180px, 1fr) repeat(3, 72px) 105px 20px; gap: 12px; }
  .history-row .history-metric:first-of-type { display: none; }
  .price-form, .price-rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-entry-form { grid-template-columns: 1fr 100px 1fr; }
  .price-entry-form .primary-button { justify-self: start; }
  .user-list-heading, .user-row { grid-template-columns: minmax(200px, 1fr) 110px 140px 100px 18px; gap: 10px; }
}

@media (max-width: 640px) {
  .topbar { height: 62px; padding: 0 12px; }
  .brand > span:last-child { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .user-name { display: none; }
  .topbar-actions { gap: 7px; }
  .topbar-actions .icon-button { width: 34px; height: 34px; }
  .main-nav { gap: 1px; margin-left: 6px; }
  .main-nav a { height: 34px; gap: 4px; padding: 0 6px; font-size: 10px; }
  .main-nav a span { display: none; }
  .main-nav svg { width: 15px; height: 15px; }
  .page-shell { width: calc(100% - 32px); padding-top: 28px; }
  .page-heading, .detail-heading { align-items: flex-start; flex-direction: column; }
  .fleet-summary { width: 100%; padding-top: 17px; border-top: 1px solid var(--line); }
  .printer-grid { grid-template-columns: 1fr; }
  .dashboard-heading { align-items: flex-start; }
  .sync-indicator { margin-top: 4px; }
  .overview-metrics { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; padding: 0; }
  .overview-metrics > div { min-height: 72px; gap: 9px; padding: 11px; }
  .overview-metrics strong { font-size: 17px; }
  .overview-metrics strong small { font-size: 11px; }
  .metric-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .metric-icon svg { width: 15px; height: 15px; }
  .dashboard-section { margin-top: 24px; }
  .dashboard-columns .section-heading { align-items: center; flex-direction: row; }
  .compact-row { grid-template-columns: 42px minmax(0, 1fr) 26px; gap: 10px; }
  .compact-row .compact-value { display: none; }
  .print-thumb.small { width: 42px; height: 42px; }
  .small-swatch { width: 34px; height: 34px; margin-left: 3px; }
  .printer-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .printer-electrical { grid-template-columns: 30px repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dashboard-ams-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-heading .status-badge { margin-left: 60px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .stats-grid > div:nth-child(4) { padding-left: 18px; border-left: 1px solid var(--line); }
  .chart-wrap { height: 280px; padding: 10px; }
  .electrical-chart { height: 250px; }
  .ams-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 28px 22px; }
  .spool-grid, .project-grid, .form-grid, .tool-grid { grid-template-columns: 1fr; }
  .project-card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .project-card-metrics div:nth-child(3) { padding-left: 0; border-left: 0; }
  .inventory-summary { grid-template-columns: 1fr 1fr; }
  .spool-detail-heading { grid-template-columns: 52px 1fr; }
  .hero-swatch { width: 52px; height: 52px; }
  .spool-detail-heading .status-badge { grid-column: 2; justify-self: start; }
  .stock-properties { grid-template-columns: 1fr 1fr; row-gap: 20px; }
  .movement-row { grid-template-columns: 1fr auto; }
  .movement-type, .movement-balance { display: none; }
  .movement-delta { grid-column: 2; grid-row: 1; }
  .history-filters { align-items: end; flex-wrap: wrap; }
  .history-filters .view-tabs { flex: 1 0 100%; }
  .history-filters label { flex: 1; }
  .history-filters select { width: 100%; min-width: 0; }
  .history-row { grid-template-columns: 52px 1fr auto; gap: 11px; }
  .history-row .history-metric, .history-row .row-chevron { display: none; }
  .history-row .status-badge { grid-column: 2; justify-self: start; }
  .print-thumb { width: 52px; height: 52px; }
  .print-detail-heading { grid-template-columns: 78px 1fr; align-items: start; }
  .print-detail-media { width: 78px; }
  .print-detail-heading .status-badge { grid-column: 2; justify-self: start; }
  .print-properties { grid-template-columns: 1fr 1fr; }
  .material-line { grid-template-columns: 30px 1fr auto; }
  .material-line > div:nth-of-type(2), .material-line > div:nth-of-type(3) { display: none; }
  .project-assignment form { grid-template-columns: 1fr; }
  .project-assignment .primary-button { justify-self: start; }
  .project-detail-heading { align-items: flex-start; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .settings-page { width: calc(100% - 32px); }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; }
  .settings-actions .primary-button, .settings-actions .secondary-button { width: 100%; }
  .mapping-row { grid-template-columns: 1fr; gap: 12px; }
  .mapping-sensors { grid-template-columns: 1fr; }
  .mapping-select > span small { min-height: 0; }
  .price-entry-form { grid-template-columns: 1fr; }
  .setup-section { padding: 18px 14px; }
  .price-form, .price-rule-grid { grid-template-columns: 1fr; }
  .price-rule { padding: 14px; }
  .price-rule-heading { align-items: flex-start; flex-direction: column; }
  .rule-actions { width: 100%; }
  .rule-actions .status-badge { margin-right: auto; }
  .detected-list { grid-template-columns: 1fr; }
  .detected-list > div { align-items: flex-start; flex-direction: column; gap: 4px; }
  .role-overview, .role-selection-help { grid-template-columns: 1fr; }
  .user-list-heading { display: none; }
  .user-row { grid-template-columns: minmax(0, 1fr) auto 18px; }
  .user-row .user-login, .user-row > .status-badge { display: none; }
}
