:root {
  --bg: #0E1524; --bg-2: #101A2E; --panel: #17233C; --panel-2: #1E2C49;
  --line: #263349; --line-soft: rgba(255,255,255,.06);
  --text: #F1EDE4; --muted: #8B96AE; --faint: #5D6A83;
  --hot: #efac42; --ready: #33C98A; --printing: #FF8A3D; --prep: #FFD24A;
  --paused: #B08CFF; --error: #FF5468; --offline: #5D6B85; --harvest: #2FD3C3;
  --operator: #FF5CB8;   /* "waiting for operator" (insert NFC chip) — urgent, distinct from error red */
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--ui); color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(239,172,66,.08), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(239,172,66,.04), transparent 55%), var(--bg);
  min-height: 100vh; }
h1,h2,h3,h4,p { margin: 0; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 22px 60px; }
.hide { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 22px; padding: 16px 22px 14px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  background: rgba(14,21,36,.82); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 17px; }
.brand small { color: var(--faint); font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-left: 2px; }
.logo { width: 32px; height: 32px; flex: none;
  background: url("/logo.svg") center/contain no-repeat;
  filter: drop-shadow(0 5px 14px rgba(239,172,66,.28)); }
.auth-brand .logo { width: 38px; height: 38px; }
.stats { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.stat b { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.stat.dot-ready b { color: var(--ready); } .stat.dot-print b { color: var(--printing); } .stat.dot-warn b { color: var(--error); } .stat.dot-harvest b { color: var(--harvest); }
.simtoggle { border: 1px solid var(--line); background: var(--panel-2); color: var(--hot); font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
#alarmBtn:not(.on) { color: var(--muted); }
.simtoggle[aria-pressed="true"] { color: var(--faint); border-style: dashed; }
.simtoggle:hover { border-color: var(--line-soft); }
/* Notification bell + panel */
.bell-wrap { position: relative; }
.bell { position: relative; background: var(--panel); border: 1px solid var(--line); color: var(--muted); width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bell:hover { color: var(--text); border-color: var(--hot); }
.bell-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--error); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.notif-panel { position: absolute; top: 46px; right: 0; width: 340px; max-height: 460px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 60; padding: 6px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 6px; }
.notif-item { padding: 8px 9px; border-radius: 9px; border-left: 3px solid var(--muted); background: var(--bg-2); margin: 4px 2px; }
.notif-item.lvl-error { border-left-color: var(--error); }
.notif-item.lvl-warn { border-left-color: var(--prep); }
.notif-item.lvl-info { border-left-color: var(--ready); }
.ni-top { display: flex; justify-content: space-between; gap: 8px; }
.ni-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ni-time { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ni-printer { margin-top: 2px; line-height: 1.2; }
.ni-printer .ni-loc { font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: .01em; }
.ni-printer .ni-pname { font-size: 12px; font-weight: 500; color: var(--muted); }
.ni-detail { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.notif-empty { padding: 18px; text-align: center; color: var(--faint); font-size: 12px; }
/* Card error/pause line */
.perr:empty { display: none; }
.hms:empty { display: none; }
.hms { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 4px; }
.hmsline { display: flex; align-items: baseline; gap: 6px; font-size: 11.5px; line-height: 1.32;
  background: rgba(255,210,74,.09); border: 1px solid rgba(255,210,74,.22); border-radius: 8px; padding: 5px 8px; }
.hmsline .hi { color: var(--prep); flex: none; }
.hmsline .ht { flex: 1; color: var(--text); }
.hmsline .hc { font-family: var(--mono); font-size: 9.5px; color: var(--faint); white-space: nowrap; text-decoration: none; }
.hmsline .hc:hover { color: var(--muted); text-decoration: underline; }
.hmsline.unknown { background: var(--panel-2); border-color: var(--line); }
.hmsline.unknown .hi { color: var(--faint); }
.hmsline.unknown .ht { color: var(--muted); }
.plast:empty { display: none; }
.plast { margin: 2px 0 4px; font-size: 11.5px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plast .lp-lab { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-right: 5px; }
.perr { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-size: 11.5px; color: var(--prep); line-height: 1.3; }
.perr .perrmsg { flex: 1; }
.btn.tiny { padding: 3px 9px; font-size: 11px; border-radius: 7px; }

/* tabs */
.tabs { display: flex; gap: 2px; padding: 10px 22px 0; border-bottom: 1px solid var(--line);
  position: sticky; top: 63px; z-index: 20; background: rgba(14,21,36,.82); backdrop-filter: blur(12px); overflow-x: auto; }
.tab { border: none; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 550;
  padding: 9px 15px 12px; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--hot); }
.tab .badge { font-family: var(--mono); font-size: 11px; background: var(--panel-2); color: var(--muted);
  padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .badge { color: var(--text); }
/* Attention glows: Harvest tab pulses blue when prints await pickup; Triage tab
   pulses red when a printer is in a critical-error state. */
@keyframes tabGlowBlue { 0%,100% { box-shadow: 0 0 0 0 rgba(77,159,255,0); } 50% { box-shadow: 0 0 15px 1px rgba(77,159,255,.6); } }
@keyframes tabGlowRed  { 0%,100% { box-shadow: 0 0 0 0 rgba(255,84,104,0); } 50% { box-shadow: 0 0 15px 1px rgba(255,84,104,.72); } }
.tab.glow-harvest { color: #8fccff; animation: tabGlowBlue 1.6s ease-in-out infinite; }
.tab.glow-triage  { color: #ff97a3; animation: tabGlowRed 1.3s ease-in-out infinite; }
.tab.glow-harvest .badge { color: #dbefff; background: rgba(77,159,255,.2); }
.tab.glow-triage .badge  { color: #ffd6db; background: rgba(255,84,104,.22); }

/* controls row */
.controls { display: flex; align-items: center; gap: 10px; padding: 18px 0 4px; flex-wrap: wrap; }
/* Monitoring status filter bar */
.statusbar { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 0 10px; }
.sfchip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.sfchip:hover { border-color: var(--line-soft); color: var(--text); }
.sfchip .sfdot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sfchip .sfn { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.sfchip.on { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-soft); }
.sfchip.on .sfn { color: var(--muted); }
.sfchip.harvest .sfdot { background: var(--harvest); } .sfchip.error .sfdot { background: var(--error); }
.sfchip.paused .sfdot { background: var(--paused); } .sfchip.printing .sfdot { background: var(--printing); }
.sfchip.prep .sfdot { background: var(--prep); } .sfchip.ready .sfdot { background: var(--ready); }
.sfchip.connecting .sfdot { background: var(--muted); } .sfchip.offline .sfdot { background: var(--offline); }
.sfchip.sfclear { color: var(--hot); } .sfchip.sfclear .sfdot { display: none; }
.controls .title { font-size: 20px; font-weight: 650; letter-spacing: -.01em; margin-right: 4px; }
.controls .sub { color: var(--faint); font-size: 12.5px; }
.controls .btn:last-child, .controls .segmented { margin-left: auto; }
.controls .segmented + .btn { margin-left: 0; }
/* Keep the monitoring toolbar (search / group-by / add) pinned while the board scrolls. */
[data-panel="monitor"] .controls { position: sticky; top: 108px; z-index: 15;
  background: rgba(14,21,36,.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); padding: 14px 0 12px; }
#sortby { font-size: 12.5px; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; cursor: pointer; }
[data-panel="monitor"] #sortby + .btn { margin-left: 0; }
.search { position: relative; }
.search input { font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px 8px 32px; width: 210px; outline: none; }
.search input:focus { border-color: var(--hot); box-shadow: 0 0 0 3px rgba(239,172,66,.14); }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--faint); }
.segmented { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { border: none; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 550; padding: 5px 11px; border-radius: 6px; }
.segmented button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-soft); }

.btn { border: none; background: var(--hot); color: #16223c; font-size: 13px; font-weight: 650; padding: 8px 14px; border-radius: 9px; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: #33456a; }
.btn.danger { background: transparent; color: var(--error); border: 1px solid var(--line); }
.btn.small { padding: 5px 11px; font-size: 12.5px; }

/* group headers + grid */
.group-h { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; }
.group-h h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.group-h .rule { flex: 1; height: 1px; background: var(--line); }
.group-h .cnt { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(284px, 1fr)); gap: 14px; }

/* printer card */
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  position: relative; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.pcard:hover { transform: translateY(-2px); border-color: #33456a; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.pcard.menu-open { z-index: 100; }   /* lift the whole card so its ⋯ menu is on top */
.pcard[data-state="printing"] { box-shadow: inset 0 0 0 1px rgba(255,138,61,.22), 0 0 26px -12px rgba(255,138,61,.6); }
.pcard[data-state="error"] { box-shadow: inset 0 0 0 1px rgba(255,84,104,.3); }
.cam { position: relative; aspect-ratio: 16/9; background: #070b14; overflow: hidden; border-radius: 14px 14px 0 0; }
.cam canvas { width: 100%; height: 100%; display: block; }
.cam-feed { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; background: #000; }
.cam-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; opacity: 0; transition: opacity .4s ease; }
.cam-still.loaded { opacity: 1; }
.cam-scan { position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.028) 0 1px, transparent 1px 3px); mix-blend-mode: overlay; }
.cam-vig { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0,0,0,.55)); }
.statusstripe { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 3; }
.cam-top { position: absolute; inset: 8px 8px auto 8px; display: flex; align-items: center; justify-content: space-between; z-index: 4; }
.cam-badge { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; padding: 3px 7px; border-radius: 6px;
  background: rgba(0,0,0,.55); color: var(--muted); display: flex; align-items: center; gap: 5px; }
.cam-badge .rec { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.cam-badge.on { color: var(--text); } .cam-badge.on .rec { background: var(--error); box-shadow: 0 0 8px var(--error); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.cam-toggle { border: 1px solid rgba(255,255,255,.16); background: rgba(0,0,0,.5); color: var(--text);
  font-size: 11px; font-weight: 550; padding: 4px 9px; border-radius: 7px; backdrop-filter: blur(3px); }
.cam-toggle:hover { border-color: var(--hot); color: #ffd9c8; }
.cam-time { position: absolute; right: 8px; bottom: 7px; z-index: 4; font-family: var(--mono); font-size: 10px; color: rgba(234,238,247,.7); text-shadow: 0 1px 2px #000; }
/* Big, glanceable bay+position coordinate (e.g. "1A") on the camera — the fast way
   to locate a printer on the floor. Mirrors the Filament Loading card's badge. */
.pcoord { position: absolute; left: 8px; bottom: 7px; z-index: 4; font-family: var(--mono); font-weight: 800; font-size: 22px; line-height: 1; letter-spacing: 1px; color: var(--hot); background: rgba(9,14,24,.72); border: 1px solid rgba(239,172,66,.5); border-radius: 9px; padding: 4px 9px; text-shadow: 0 1px 2px #000; }
/* Idle-only broom quick-action (run a bed-cleaner / utility print) */
.cam-broom { position: absolute; left: 8px; bottom: 8px; z-index: 5; width: 28px; height: 28px;
  display: grid; place-items: center; padding: 0; border-radius: 8px; cursor: pointer; color: #fff;
  border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  transition: border-color .15s, background .15s, transform .08s; }
.cam-broom:hover { border-color: var(--hot); background: rgba(239,172,66,.28); }
.cam-broom:active { transform: scale(.9); }
.ic-broom { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.pbody { padding: 12px 13px 13px; }
.prow1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pname { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.mbadge { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.ploc { font-size: 11.5px; color: var(--faint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.phours { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.simtag { font-size: 9px; color: var(--prep); border: 1px solid rgba(255,210,74,.3); padding: 0 5px; border-radius: 5px; margin-left: 2px; }
.menu-wrap { position: relative; }
.menu-btn { border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.menu-btn:hover { background: var(--panel-2); color: var(--text); }
.menu-pop { position: absolute; right: 0; top: 26px; z-index: 12; width: 178px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: 0 16px 34px rgba(0,0,0,.5); display: none; }
.menu-pop.open { display: block; }
.menu-pop button { display: flex; width: 100%; align-items: center; gap: 9px; background: transparent; border: none;
  color: var(--text); font-size: 13px; text-align: left; padding: 7px 9px; border-radius: 7px; }
.menu-pop button:hover { background: var(--panel); }
.menu-pop button.danger { color: var(--error); }
.menu-pop .sep { height: 1px; background: var(--line); margin: 4px 2px; }

.pstate { display: flex; align-items: center; gap: 9px; margin: 12px 0 8px; }
.pill { font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.printing { color: var(--printing); background: rgba(255,138,61,.13); }
.pill.ready { color: var(--ready); background: rgba(51,201,138,.12); }
.pill.prep { color: var(--prep); background: rgba(255,210,74,.13); }
.pill.paused { color: var(--paused); background: rgba(176,140,255,.14); }
.pill.harvest { color: var(--harvest); background: rgba(47,211,195,.14); }
.pill.error { color: var(--error); background: rgba(255,84,104,.14); }
.pill.offline { color: var(--offline); background: rgba(93,107,133,.16); }

/* "Ready to harvest" — the print finished into the end-gcode pause, bed held hot. */
.harvestrow { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; }
.harvest-btn { background: var(--harvest); color: #06231f; border-color: var(--harvest); font-weight: 700; padding: 7px 16px; }
.harvestrow .hmsg { font-size: 11.5px; color: var(--harvest); }
.rb-tile.harvest { border-color: rgba(47,211,195,.5); box-shadow: 0 0 22px -15px var(--harvest); }

/* "Waiting for operator" — a scripted mid-print pause to insert an NFC chip. */
.pill.operator { color: var(--operator); background: rgba(255,92,184,.15); }
.operatorrow { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; }
.op-btn { background: var(--operator); color: #2a0a1e; border-color: var(--operator); font-weight: 700; padding: 7px 16px; }
.operatorrow .opmsg { font-size: 11.5px; color: var(--operator); font-weight: 600; }
/* Pulse the whole card so a floor operator notices it needs a chip inserted NOW. */
.pcard[data-state="operator"] { animation: oppulse 1.5s ease-in-out infinite; }
@keyframes oppulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,92,184,.55), 0 0 20px -10px var(--operator); }
  50%      { box-shadow: 0 0 0 1px rgba(255,92,184,.9), 0 0 30px -2px var(--operator); }
}
.stars { display: flex; gap: 4px; margin: 16px 0 6px; }
.stars .star { background: none; border: none; cursor: pointer; font-size: 34px; line-height: 1; color: var(--line-soft); padding: 0 2px; transition: color .1s, transform .1s; }
.stars .star:hover { transform: scale(1.12); }
.stars .star.on { color: var(--prep); }
.hv-note-l { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; }
.hv-note-l .req { color: var(--error); font-size: 11px; }
.hv-note-l textarea { width: 100%; margin-top: 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 8px; font: inherit; resize: vertical; }
.hv-plate { margin: 12px 0 4px; font-size: 12.5px; color: var(--text); background: rgba(239,172,66,.1); border: 1px solid rgba(239,172,66,.3); border-radius: 8px; padding: 8px 11px; }
.hv-plate b { color: var(--hot); }
.hv-next { margin: 8px 0 2px; font-size: 12.5px; color: var(--muted); }
.hv-next b { color: var(--text); }
.hv-next .hv-hold { color: var(--hot); }
.pill.connecting { color: var(--muted); background: rgba(139,150,174,.14); }
.pill.connecting::before { animation: pulse-dot 1.2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.peta { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prog { height: 7px; border-radius: 999px; background: #0d1526; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-soft); }
.prog > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff6a35, var(--printing)); position: relative; }
.prog > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-100%); animation: sheen 2.1s linear infinite; }
@keyframes sheen { to { transform: translateX(220%); } }
.pfile { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.pfile .th { width: 22px; height: 22px; border-radius: 5px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.pfile b { color: var(--text); font-weight: 550; }
.pfile .pct { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--faint); }
.instr { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.ig { display: flex; flex-direction: column; gap: 2px; }
.ig .lab { font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.ig .val { font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ig .val.hot { color: var(--hot); }
.ams { margin-left: auto; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; cursor: pointer; padding: 2px; border-radius: 6px; }
.ams:hover { background: var(--panel-2); }
.ams:hover .lab { color: var(--hot); }
.ams .lab { font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.ams .chips { display: flex; gap: 4px; }
.ams .chips i { width: 15px; height: 15px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); }

.ctlbar { display: flex; align-items: center; gap: 6px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.ctl { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 12px; font-weight: 600;
  min-width: 30px; padding: 5px 10px; border-radius: 7px; line-height: 1; }
.ctl:hover { border-color: #33456a; }
.ctl.warn { color: var(--ready); }
.ctl.danger { color: var(--error); }
.ctl.on { background: rgba(255,210,74,.15); color: var(--prep); border-color: rgba(255,210,74,.35); }
.ctl-speed { margin-left: auto; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 12px; padding: 5px 8px; border-radius: 7px; font-family: inherit; }
.ctl-speed:focus { outline: none; border-color: var(--hot); }

/* ---- File Library ---- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px,1fr)); gap: 14px; margin-top: 8px; }
.dcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px,1fr)); gap: 14px; }
/* File-manager toolbar + selects */
.controls .lib-spacer { flex: 1 1 auto; }
#lib-filter, #lib-sort { font-size: 12.5px; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; cursor: pointer; }
/* Breadcrumbs */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 12px 0 4px; min-height: 26px; }
.crumb { background: none; border: 1px solid transparent; color: var(--muted); font-size: 12.5px; font-weight: 550;
  border-radius: 7px; padding: 4px 9px; cursor: pointer; }
.crumb:hover { color: var(--text); background: var(--panel); }
.crumb:last-of-type { color: var(--text); }
.crumb.dropok { border-color: var(--hot); color: var(--text); background: rgba(239,172,66,.12); }
.crumb-sep { color: var(--faint); font-size: 13px; }
/* Folders */
/* Collapsible "Folders" header — tuck the folder tiles away to cut scrolling. */
.foldbar { display: flex; align-items: center; gap: 8px; width: 100%; margin: 6px 0 8px;
  background: transparent; border: none; cursor: pointer; padding: 6px 2px;
  color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.foldbar:hover { color: var(--text); }
.foldbar .fb-chev { display: inline-block; transition: transform .15s; font-size: 10px; color: var(--faint); }
.foldbar[aria-expanded="true"] .fb-chev { transform: rotate(90deg); }
.foldbar .fb-n { font-family: var(--mono); font-size: 11px; background: var(--panel-2); color: var(--muted);
  border-radius: 999px; padding: 1px 8px; font-weight: 600; letter-spacing: 0; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px,1fr)); gap: 10px; margin: 4px 0 18px; }
.folder-tile { position: relative; display: flex; align-items: center; gap: 11px; padding: 12px 13px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .12s, background .12s; }
.folder-tile:hover { border-color: #33456a; }
.folder-tile.dropok { border-color: var(--hot); background: rgba(239,172,66,.1); box-shadow: 0 0 0 1px var(--hot); }
.folder-ic { width: 34px; height: 34px; flex: none; fill: var(--hot); opacity: .92; }
.folder-tile .ft-body { min-width: 0; flex: 1; }
.folder-tile .ft-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tile .ft-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; margin-top: 1px; }
.folder-tile .fmenu { margin-left: auto; }
.folder-tile .fmenu .menu-btn { color: var(--faint); }
.dcard.dragging { opacity: .45; }
.dfolder { font-size: 11px; color: var(--muted); margin-top: 3px; }
.dcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; position: relative; }
.dcard .swatch { height: 92px; position: relative; }
.dcard .swatch.has-thumb { background: radial-gradient(130% 120% at 50% 0%, #16233c, #0c1220); }
.dcard .swatch .dthumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.dcard .swatch .dmenu { position: absolute; right: 6px; top: 6px; }
.dcard .swatch .dmenu .menu-btn { background: rgba(0,0,0,.42); color: #fff; }
.dcard .swatch .dmenu .menu-btn:hover { background: rgba(0,0,0,.62); }
.menu-pop button .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hot); display: inline-block; }
.menu-pop button .mc { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
/* design notes — messaging timeline */
.chatlog { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 2px 2px 6px; }
.chatempty { color: var(--faint); font-size: 12.5px; text-align: center; padding: 26px 8px; }
.chatlog .msg { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.chatlog .msg-head { display: flex; align-items: baseline; gap: 8px; }
.chatlog .msg-head b { font-size: 12.5px; color: var(--text); }
.chatlog .msg-time { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chatlog .msg-del { margin-left: auto; background: transparent; border: none; color: var(--faint); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 3px; }
.chatlog .msg-del:hover { color: var(--error); }
.chatlog .msg-text { font-size: 13px; color: var(--text); margin-top: 3px; white-space: pre-wrap; line-height: 1.42; word-break: break-word; }
.chatbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.chatbar input, .chatbar textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px; }
.chatbar .chat-author { grid-column: 1 / -1; max-width: 180px; }
.chatbar textarea { grid-column: 1; resize: vertical; min-height: 40px; }
.chatbar .btn { grid-column: 2; align-self: end; }
.dcard .dropcue { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(14,21,36,.86); border: 2px dashed var(--hot); border-radius: 14px; color: var(--text);
  font-size: 14px; font-weight: 600; z-index: 15; pointer-events: none; }
.dcard.dragover { border-color: var(--hot); }
.dcard.dragover .dropcue { display: flex; }
.dcard .swatch .cat { position: absolute; left: 10px; bottom: 8px; font-size: 10.5px; background: rgba(0,0,0,.5);
  color: var(--text); padding: 2px 8px; border-radius: 6px; backdrop-filter: blur(3px); }
.dcard .swatch .cat.util { background: rgba(239,172,66,.9); color: #17120f; font-weight: 650; }
/* Design lifecycle status badge (corner of the card swatch). */
.dcard .swatch .stbadge { position: absolute; left: 10px; bottom: 8px; font-size: 10.5px; font-weight: 650;
  padding: 2px 8px; border-radius: 6px; backdrop-filter: blur(3px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.stbadge.st-active  { background: rgba(51,201,138,.9);  color: #06231a; }
.stbadge.st-retired { background: rgba(93,107,133,.85); color: #f0f3f8; }
.stbadge.st-testing { background: rgba(255,210,74,.92); color: #201a06; }
.stbadge.st-custom  { background: rgba(176,140,255,.9); color: #17102b; }
.stbadge.st-utility { background: rgba(239,172,66,.92); color: #17120f; }
/* Card inventory line (on-hand vs par). */
.dcard .dmeta .inv { font-weight: 650; }
.dcard .dmeta .inv.ok { color: var(--ready); }
.dcard .dmeta .inv.low { color: var(--error); }
/* Small grey sub-label inside a form <label>. */
.field label .lbl-sub { color: var(--faint); font-weight: 400; font-size: 11px; }
/* Utility-print launch button on a free routing tile */
.rb-tile .rb-util { margin-top: 6px; align-self: center; padding: 3px 10px; font-size: 11.5px; }
/* Checkbox row in modals (e.g. the "utility print" flag on New design) */
label.chk { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 2px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; line-height: 1.35; }
label.chk input { margin-top: 1px; flex: none; accent-color: var(--hot); }
.dcard .dbody { padding: 12px 13px 13px; }
.dcard h4 { font-size: 15px; font-weight: 650; }
.dcard .dmeta { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.files2 { display: flex; gap: 7px; margin: 11px 0 2px; }
.filechip { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: var(--bg-2); }
.filechip .fam { font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--text); }
.filechip .ft { font-size: 11px; color: var(--faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.filechip.missing { border-style: dashed; }
.filechip.missing .fam { color: var(--faint); }
.filechip .fils { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 5px; }
.filechip .fdot { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filechip .fdot i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.25); flex: none; }
/* File chip is clickable to assign specific filament shades */
.filechip[data-fil] { cursor: pointer; position: relative; transition: border-color .12s, background .12s; }
.filechip[data-fil]:hover { border-color: var(--hot); }
.filechip .fdot.assigned { color: var(--text); }
.filechip .fdot.assigned i { border-color: rgba(239,172,66,.7); box-shadow: 0 0 0 1px rgba(239,172,66,.35); }
.filechip .fil-edit { margin-top: 6px; font-size: 10px; color: var(--faint); opacity: 0; transition: opacity .12s; }
.filechip[data-fil]:hover .fil-edit { opacity: 1; color: var(--hot); }
/* Filament-assignment modal rows */
.afil-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; margin: 6px 0 4px; }
.afil-row { display: flex; align-items: center; gap: 10px; }
.afil-sw { width: 24px; height: 24px; border-radius: 7px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); }
.afil-meta { min-width: 116px; display: flex; flex-direction: column; }
.afil-meta b { font-size: 12.5px; }
.afil-sub { font-size: 10.5px; color: var(--faint); }
.afil-sel { flex: 1; }
.afil-inh { color: var(--hot); }
.dcard .row { display: flex; gap: 6px; margin-top: 11px; }

/* ---- rows (needed / routing) ---- */
.rows { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rrow { display: grid; grid-template-columns: 40px 1fr auto auto auto; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; }
.rrow .sw { width: 34px; height: 34px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.rrow .nm { font-size: 14px; font-weight: 600; }
.rrow .sub2 { font-size: 12px; color: var(--faint); margin-top: 2px; }
.prio { font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 999px; }
.prio.p-high, .prio.p-high-manual { color: var(--error); background: rgba(255,84,104,.14); }
.prio.p-medium { color: var(--prep); background: rgba(255,210,74,.13); }
.prio.p-low { color: var(--muted); background: var(--panel-2); }
.gap { font-family: var(--mono); font-size: 12.5px; color: var(--error); font-variant-numeric: tabular-nums; }
.badge2 { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; text-transform: capitalize; }
.b-needed { color: var(--muted); background: var(--panel-2); }
.b-routed, .b-queued, .b-scheduled { color: var(--prep); background: rgba(255,210,74,.13); }
.b-printing, .b-sending { color: var(--printing); background: rgba(255,138,61,.13); }
.b-done { color: var(--ready); background: rgba(51,201,138,.12); }
.b-failed { color: var(--error); background: rgba(255,84,104,.14); }
.b-canceled { color: var(--faint); background: var(--panel-2); }
.rrow .miniprog { width: 90px; height: 6px; border-radius: 999px; background: #0d1526; overflow: hidden; }
.rrow .miniprog > i { display: block; height: 100%; background: var(--printing); }

/* ---- Filament loading ---- */
.loadbank { margin-top: 18px; }
.loadbank .bh { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.loadbank .bh h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.loadgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 12px; }
.loadcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.loadcard.action { border-color: rgba(239,172,66,.4); box-shadow: 0 0 22px -14px var(--hot); }
.loadcard .lh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.loadcard .lh .nm { font-size: 14px; font-weight: 650; }
.loadcard .lh .pos { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.loadcard .lh-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.loadcard .lh-id .nm { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loadcard .lh-id .pmodel { font-family: var(--mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
/* Big, glanceable bay+position coordinate (e.g. "1A") — the primary way to find a printer on the floor. */
.loadcard .coord { flex: none; font-family: var(--mono); font-size: 26px; font-weight: 800; line-height: 1; color: var(--hot); background: rgba(239,172,66,.12); border: 1px solid rgba(239,172,66,.4); border-radius: 10px; padding: 7px 11px; letter-spacing: 1px; }
#loadFilterRouted.on { color: var(--hot); border-color: var(--hot); background: rgba(239,172,66,.14); box-shadow: inset 0 0 0 1px var(--hot); }
/* Always 4 columns: single-AMS (4 slots) = one row; dual-AMS (8 slots) wraps to two. */
.slotrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.slotrow.editable { cursor: pointer; border-radius: 8px; padding: 5px; margin: 7px -5px 0; transition: background .12s; }
.slotrow.editable:hover { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-soft); }
.slot { text-align: center; min-width: 0; }
.slot i { display: block; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); }
.slot span { display: block; font-size: 9px; color: var(--faint); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Dual-AMS (8 slots): shorter rectangles + hide the tiny per-slot names so two
   stacked rows occupy the same height as a single-AMS row — cards stay uniform.
   (The specific per-slot filament is still in the load list below the strip.) */
.slotrow.two .slot i { height: 16px; }
.slotrow.two .slot span { display: none; }
.needline { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.needline .req { display: inline-flex; align-items: center; gap: 5px; margin: 3px 6px 0 0; }
.needline .req i { width: 12px; height: 12px; border-radius: 4px; }
.needline .req.missing { color: var(--error); font-weight: 600; }
.needline .req.loaded { color: var(--ready); font-weight: 600; }
.needline .req .req-mat { color: var(--faint); font-weight: 500; font-family: var(--mono); font-size: 11px; }
.needline .req.loaded i { box-shadow: 0 0 0 2px rgba(51,201,138,.5); }
.needline .req .grabhint { color: var(--harvest); font-weight: 600; font-size: 11px; background: rgba(47,211,195,.12); border: 1px solid rgba(47,211,195,.3); border-radius: 6px; padding: 1px 6px; margin-left: 4px; white-space: nowrap; }
.loadcard.ready { border-color: rgba(51,201,138,.4); box-shadow: 0 0 22px -14px var(--ready); }
.needline .ok { color: var(--ready); }

/* ---- routing board (drag-and-drop assignment) ---- */
.routeboard { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.rb-colh { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 11px; display: flex; align-items: center; gap: 8px; }
.rb-colh .cnt { font-family: var(--mono); font-size: 11px; color: var(--faint); background: var(--panel-2); padding: 1px 7px; border-radius: 999px; }
.rb-colh .hint2 { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); font-size: 11px; }
.rb-sortsel { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 11.5px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 7px; cursor: pointer; }
.rb-queue { position: sticky; top: 74px; }
.rb-help { font-size: 11px; color: var(--faint); line-height: 1.45; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-bottom: 10px; }
.rb-help b { color: var(--muted); }
.rb-qlist { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 190px); overflow-y: auto; padding-right: 2px; }
.qcard { display: flex; flex-direction: column; gap: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; cursor: grab; }
.qcard:hover { border-color: var(--hot); }
.qcard:active { cursor: grabbing; }
.qcard.dragging { opacity: .4; }
.qc-top { display: flex; align-items: center; gap: 10px; }
.qc-suggest { align-self: stretch; font-size: 11px; color: var(--ready); background: rgba(51,201,138,.1); border: 1px solid rgba(51,201,138,.25); border-radius: 7px; padding: 4px 8px; cursor: pointer; }
.qc-suggest:hover { background: rgba(51,201,138,.2); }
.qc-suggest .sg-head b { color: var(--text); font-family: var(--mono); }
.qc-suggest .sg-circ { font-family: var(--mono); font-size: 10px; color: var(--prep); opacity: .9; }
.qc-suggest.none { color: var(--faint); background: var(--panel-2); border-color: var(--line); cursor: default; }
.sg-loads { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; margin-top: 4px; }
.sg-loads .sg-lab { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.sg-fil { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.sg-fil i { width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
/* "Choose a printer" button on a queue card → opens the tap-to-route picker
   (the no-drag path, primary on mobile). */
.qc-choose { align-self: stretch; font-size: 11.5px; font-weight: 550; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; cursor: pointer; text-align: center; }
.qc-choose:hover { color: var(--text); border-color: var(--hot); }
/* Printer picker sheet — ranked list of printers you can tap to route to. */
.pick-list { display: flex; flex-direction: column; gap: 7px; max-height: 62vh; overflow-y: auto; margin: 2px 0; }
.pick-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.pick-row:hover { border-color: var(--hot); background: var(--panel); }
.pk-loc { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--hot);
  border: 1px solid rgba(239,172,66,.4); border-radius: 8px; padding: 5px 8px; min-width: 42px; text-align: center; }
.pk-mid { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pk-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.pk-name .pk-model { font-family: var(--mono); font-size: 10.5px; color: var(--faint); font-weight: 500; }
.pk-name .pk-best { font-size: 10px; color: var(--hot); font-weight: 700; }
.pk-sub { font-size: 11.5px; color: var(--muted); }
.pk-sub .pk-free { color: var(--ready); } .pk-sub .pk-noswap { color: var(--ready); }
.pk-loads { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; margin-top: 2px; }
.pk-loads .pk-lab { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.pk-fil { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.pk-fil i { width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.pk-go { font-size: 12px; font-weight: 600; color: var(--hot); white-space: nowrap; }
/* Studio-style AMS strip on the printer tiles */
.ams-strip { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; margin: 6px 0; }
.ams-strip.editable { cursor: pointer; border-radius: 7px; padding: 4px; margin: 4px -4px; transition: background .12s; }
.ams-strip.editable:hover { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-soft); }
.f-dupwarn { font-size: 12px; color: var(--prep); background: rgba(255,210,74,.08); border: 1px solid rgba(255,210,74,.3); border-radius: 8px; padding: 8px 10px; margin: 4px 0 2px; line-height: 1.4; }
.ams-slot { flex: 0 0 auto; line-height: 0; padding: 0; }
.ams-slot i { display: block; width: 15px; height: 15px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.ams-slot.mt i { background: #1a2338; box-shadow: inset 0 0 0 1px var(--line); }
.ams-slot.idle i { opacity: .8; }
.ams-slot.keep i { box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 0 0 1.5px var(--ready); }
.ams-slot.swap { display: inline-flex; align-items: center; gap: 1px; }
.ams-slot.swap .from { width: 12px; height: 12px; opacity: .45; }
.ams-slot.swap .arw { font-size: 9px; color: var(--hot); font-weight: 700; }
.ams-slot.swap .to { box-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 0 0 0 1.5px var(--hot); }
.qcard .sw { width: 30px; height: 30px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.qcard .qc-body { flex: 1; min-width: 0; }
.qcard .nm { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qcard .qc-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.qcard .qc-grip { color: var(--faint); font-size: 13px; letter-spacing: -2px; }
.famtag { font-family: var(--mono); font-size: 9.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.famtag.multicolor { color: var(--hot); border-color: rgba(239,172,66,.5); }
.rb-bays { display: flex; flex-direction: column; gap: 14px; }
.rb-bay .rb-bayhdr { font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 7px; }
.rb-baygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 9px; }
.rb-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; min-height: 88px; display: flex; flex-direction: column; }
.rb-tile .rb-th { display: flex; align-items: baseline; justify-content: space-between; }
.rb-tile .ploc { font-size: 14px; font-weight: 800; }
.rb-tile .pm { font-family: var(--mono); font-size: 10px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 8px; }
.rb-tile.free { border-style: dashed; border-color: rgba(51,201,138,.55); background: linear-gradient(180deg, rgba(51,201,138,.07), transparent 60%); box-shadow: 0 0 22px -14px var(--ready); }
.rb-tile.free .ploc { color: var(--ready); }
.rb-tile.free .rb-drop { color: var(--muted); }
.rb-avail { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ready); margin: 1px 0 4px; }
.rb-tile .rb-drop { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; min-height: 44px; }
.rb-tile.dropok { border-style: solid; border-color: var(--ready); box-shadow: 0 0 0 1px var(--ready), 0 0 22px -9px var(--ready); }
.rb-tile.dropbad { border-color: var(--error); opacity: .7; }
.rb-tile.err { border-color: var(--error); box-shadow: 0 0 0 1px var(--error), 0 0 22px -11px var(--error); }
.rb-tile.err .ploc { color: var(--error); }
.rb-tile.needsload { border-color: rgba(239,172,66,.5); box-shadow: 0 0 22px -15px var(--hot); }
.rb-tile.armed { border-color: rgba(51,201,138,.5); }
.rb-design { font-size: 13px; font-weight: 600; margin: 5px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-loads { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.rb-load { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--hot); font-weight: 600; }
.rb-load i { width: 12px; height: 12px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.rb-ok { font-size: 12px; color: var(--ready); margin-bottom: 6px; }
.rb-actstate { font-size: 12px; color: var(--muted); }
.rb-actstate.off { color: var(--faint); }
.rb-hold { font-size: 11px; color: var(--hot); margin-top: 3px; line-height: 1.3; }
.rb-eta { color: var(--faint); font-size: 11px; }
.rb-tile.busy { border-color: rgba(255,138,76,.4); }
.rb-tacts { display: flex; gap: 5px; margin-top: auto; }
.rb-prog { height: 5px; border-radius: 999px; background: #0d1526; overflow: hidden; margin-top: 6px; }
.rb-prog i { display: block; height: 100%; background: var(--printing); }
.empty.small { padding: 22px 12px; font-size: 12.5px; }
@media (max-width: 900px) { .routeboard { grid-template-columns: 1fr; } .rb-queue { position: static; } }

/* ---- triage ---- */
.tlist { display: flex; flex-direction: column; gap: 9px; }
/* Collapsible triage groups (Critical Errors / Fix Soon) */
.tgroup { margin-bottom: 14px; }
.tgroup > summary { cursor: pointer; list-style: none; user-select: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; }
.tgroup[open] > summary { border-radius: 11px 11px 0 0; }
.tgroup > summary::-webkit-details-marker { display: none; }
.tgroup > summary::before { content: "▸"; color: var(--faint); font-size: 11px; transition: transform .15s; }
.tgroup[open] > summary::before { transform: rotate(90deg); }
.tgroup .tg-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tgroup.crit .tg-dot { background: var(--error); box-shadow: 0 0 8px -1px var(--error); }
.tgroup.soon .tg-dot { background: var(--prep); }
.tgroup .tg-label { font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
.tgroup.crit .tg-label { color: var(--error); } .tgroup.soon .tg-label { color: var(--prep); }
.tgroup .tg-count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--panel-2); padding: 2px 9px; border-radius: 999px; }
.tgroup .tlist { padding: 12px; border: 1px solid var(--line); border-top: none; border-radius: 0 0 11px 11px; }
.trow { display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px; padding: 12px 15px; }
.trow.crit { border-left-color: var(--error); }
.trow.warn { border-left-color: var(--prep); }
.trow.off { border-left-color: var(--offline); }
.tr-loc { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tr-loc .ploc { font-size: 16px; font-weight: 800; }
.tr-loc .tr-name { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-loc .pm { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.tr-mid { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.tr-alerts { display: flex; flex-direction: column; gap: 4px; }
.tr-alert { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.tr-alert.crit { color: var(--error); font-weight: 600; }
/* ⋯ → View errors modal */
.ve-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; margin: 6px 0 2px; }
.ve-row { display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.ve-row.crit { border-color: rgba(255,84,104,.5); }
.ve-ic { flex: none; font-size: 14px; line-height: 1.3; }
.ve-body { min-width: 0; }
.ve-text { font-size: 12.8px; color: var(--text); line-height: 1.35; }
.ve-row.warn .ve-text { color: var(--muted); }
.ve-meta { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.ve-meta .hc { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-decoration: none; }
.ve-meta .hc:hover { color: var(--muted); text-decoration: underline; }
.ve-lvl { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.ve-row.crit .ve-lvl { color: var(--error); }
.tr-alert.unknown { color: var(--muted); }
.tr-alert .hc { font-family: var(--mono); font-size: 10px; color: var(--faint); text-decoration: none; white-space: nowrap; }
.tr-alert .hc:hover { color: var(--muted); text-decoration: underline; }
.tr-act { display: flex; gap: 8px; }
.pcard.flash { animation: cardflash 1.4s ease; }
@keyframes cardflash { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 2px var(--hot), 0 0 30px -6px var(--hot); } }
.calbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; }
.calbtns .btn { justify-content: center; }
.calresult { min-height: 20px; font-size: 12.5px; margin-top: 2px; }
/* Calibration tracking: card "Cal due" badge + modal status block */
.caldue { font-size: 10px; font-weight: 600; color: var(--prep); background: rgba(255,210,74,.12);
  border: 1px solid rgba(255,210,74,.3); border-radius: 6px; padding: 2px 7px; cursor: pointer; white-space: nowrap; }
.caldue:hover { border-color: var(--prep); color: var(--text); }
.calstat { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 2px 0 10px; background: var(--bg-2); font-size: 12.5px; }
.calstat.due { border-color: rgba(255,210,74,.35); background: rgba(255,210,74,.07); }
.calstat.ok .calhead { color: var(--ready); }
.calstat.due .calhead { color: var(--prep); }
.calhead { font-weight: 600; }
.calrows { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.calrow { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.calrow b { color: var(--text); font-variant-numeric: tabular-nums; }
.calrow b.faint { color: var(--faint); font-weight: 400; }

/* ---- print queue ---- */
.qlist { display: flex; flex-direction: column; gap: 8px; }
.qrow { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; }
.qrow .qthumb, .qrow .qsw { width: 44px; height: 44px; border-radius: 9px; }
.qrow .qthumb { object-fit: contain; background: radial-gradient(130% 120% at 50% 0%, #16233c, #0c1220); }
.qrow .qsw { box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.qrow .nm { font-size: 14px; font-weight: 600; }
.qrow .sub2 { font-size: 12px; color: var(--faint); margin-top: 2px; }
.qpr { color: var(--muted); font-weight: 550; white-space: nowrap; }
.qrow .qact { display: flex; align-items: center; gap: 8px; }
.qrow.hist { opacity: .7; }
.qrow .qmiss { margin-top: 5px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--prep); }
.qmiss-up { font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 999px; cursor: pointer; color: var(--prep); background: rgba(255,210,74,.13); border: 1px solid rgba(255,210,74,.35); }
.qmiss-up:hover { background: rgba(255,210,74,.22); }
.qmiss-fam { font-weight: 650; color: var(--prep); }
.qmiss.ok { color: var(--muted); }
.qslice-col { font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 999px; cursor: pointer; color: var(--harvest); background: rgba(47,211,195,.12); border: 1px solid rgba(47,211,195,.32); }
.qslice-col:hover { background: rgba(47,211,195,.2); }

/* "Fire confirmed" popup — planned release schedule, one column per circuit. */
.fc-grid { display: flex; gap: 14px; flex-wrap: wrap; max-height: 56vh; overflow-y: auto; margin: 8px 0 4px; }
.fc-circ { flex: 1 1 190px; min-width: 180px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.fc-circh { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.fc-go { font-size: 12px; font-weight: 700; color: var(--ready); margin: 3px 0 1px; }
.fc-wait { font-size: 11.5px; font-weight: 600; color: var(--prep); margin: 9px 0 2px; }
.fc-wait .fc-sub { color: var(--faint); font-weight: 400; }
.fc-print { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.fc-loc { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--printing); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.fc-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qhistory { margin-top: 18px; }
.qhistory > summary { cursor: pointer; list-style: none; user-select: none; display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 7px 2px; }
.qhistory > summary::-webkit-details-marker { display: none; }
.qhistory > summary::before { content: "▸"; color: var(--faint); font-size: 10px; transition: transform .15s; }
.qhistory[open] > summary::before { transform: rotate(90deg); }
.qhistory > summary .cnt { font-family: var(--mono); font-size: 11px; color: var(--faint); background: var(--panel-2); padding: 1px 7px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.qhistory .qlist { margin-top: 8px; }
.qmore { margin-top: 10px; width: 100%; justify-content: center; }
.qmore .cnt { color: var(--faint); margin-left: 6px; }

/* ---- (c) File Library → Print Queue preview ---- */
.qp-cnt { font-family: var(--mono); font-size: 12px; color: var(--faint); background: var(--panel-2); padding: 1px 9px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.modal:has(.qlist) { width: 520px; }

/* ---- (f) Print Queue search-to-add typeahead ---- */
.qadd-wrap { position: relative; }
.qadd-results { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; max-width: 340px; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 5px; box-shadow: 0 12px 34px rgba(0,0,0,.4); max-height: 320px; overflow: auto; }
.qadd-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 7px 8px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; }
.qadd-item:hover { background: var(--panel-2); }
.qadd-item .qsw.sm { width: 20px; height: 20px; border-radius: 6px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.qadd-nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qadd-meta { margin-left: auto; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.qadd-empty { padding: 9px 10px; color: var(--faint); font-size: 12.5px; }

/* ---- staging / Send All ---- */
.b-staged { color: var(--muted); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-soft); }
.b-armed { color: var(--hot); background: rgba(239,172,66,.13); }
.sendbar { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.sendbar b { color: var(--text); }
.sendbar .btn[disabled] { opacity: .45; pointer-events: none; }
.slot.toload i { box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 2px var(--hot); animation: toloadpulse 1.8s ease-in-out infinite; }
@keyframes toloadpulse { 0%,100% { box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 2px var(--hot); } 50% { box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 2px rgba(239,172,66,.4); } }
.loadcard.ready { border-color: rgba(51,201,138,.4); box-shadow: 0 0 22px -14px var(--ready); }
.confirmrow { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.confirmrow .rdy { font-size: 11px; color: var(--ready); font-weight: 600; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 550;
  padding: 11px 18px; border-radius: 11px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- projector (floor-map loading display) ---- */
#projector { position: fixed; inset: 0; z-index: 90; background: radial-gradient(1200px 800px at 50% -10%, #0e1830, var(--bg)); display: flex; flex-direction: column; padding: 22px 26px 26px; }
body.projecting { overflow: hidden; }
.proj-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.proj-title { font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.proj-title span { color: var(--faint); font-weight: 500; font-size: 15px; margin-left: 8px; }
.proj-meta { display: flex; align-items: center; gap: 14px; }
.proj-armed { font-size: 15px; font-weight: 650; color: var(--hot); background: rgba(239,172,66,.13); padding: 5px 12px; border-radius: 999px; }
.floor { flex: 1; display: grid; gap: 14px 26px; min-height: 0;
  grid-template-columns: 1fr 1fr 0.28fr 1fr; grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas: "b1 b2 . b3" ". . . b4" "b6 b7 . b5"; }
.baybox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; }
.bayhdr { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.bayhdr b { font-size: 15px; }
.bayhdr .circ { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.bayhdr .bs { margin-left: auto; font-size: 11px; font-weight: 650; padding: 2px 9px; border-radius: 999px; }
.bs.heat { color: var(--printing); background: rgba(255,138,61,.15); }
.bs.cool { color: var(--prep); background: rgba(255,210,74,.13); font-variant-numeric: tabular-nums; }
.bs.wait { color: var(--muted); background: var(--panel-2); }
.baygrid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; min-height: 0; }
.ptile { background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ptile.empty { opacity: .3; }
.ptile.toload { border-color: var(--hot); box-shadow: 0 0 0 1px var(--hot), 0 0 26px -10px var(--hot); }
.ptile.ready, .ptile.confirmed { border-color: rgba(51,201,138,.55); }
.ptile.running { opacity: .72; }
.ptile .thdr { display: flex; align-items: baseline; justify-content: space-between; }
.ptile .ploc { font-size: 17px; font-weight: 800; letter-spacing: .01em; margin: 0; color: var(--text); }
.ptile .pm { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.ptile .tbody { flex: 1; margin-top: 5px; min-height: 0; overflow: hidden; }
.ptile .tdesign { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptile .loadrow { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.ptile .loadrow i { width: 15px; height: 15px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.ptile .loadrow b { color: var(--hot); font-weight: 750; }
.ptile .big { font-size: 20px; font-weight: 800; color: var(--ready); }
.ptile.confirmed .big { color: var(--ready); }
.ptile .tdim { font-size: 12px; color: var(--faint); }
.ptile .tdots { display: flex; gap: 4px; margin-top: 6px; }
.ptile .tdots i { width: 16px; height: 6px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }

/* ---- modal ---- */
.modal-host { position: fixed; inset: 0; background: rgba(6,10,18,.6); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 460px; max-width: 96vw; max-height: 90vh; overflow: auto; }
/* Anchored popover — a compact inline form that spawns right off its trigger. */
.popover { position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 250px; max-width: 92vw; box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.pop-head { font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.pop-design { font-size: 13px; font-weight: 600; color: var(--hot); background: var(--panel-2); border-radius: 7px; padding: 6px 9px; margin-bottom: 8px; }
.pop-row { display: flex; gap: 8px; }
.pop-lbl { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); flex: 1; }
.pop-lbl input, .pop-lbl select { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 6px 8px; border-radius: 8px; font: inherit; font-size: 13px; width: 100%; }
.pop-hint { font-size: 10.5px; color: var(--faint); margin: 7px 0 2px; line-height: 1.35; }
.pop-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 9px; }
/* Triage "View" — the Monitoring card popped into a modal. */
.cardpop { margin: -6px -4px 2px; }
.cardpop .pcard { width: 100%; }
/* New-design folder picker + inline "new folder" */
.fld-pick { display: flex; gap: 8px; align-items: center; }
.fld-pick select { flex: 1; }
.fld-pick .btn.small { white-space: nowrap; }
.fld-pick .btn.on { color: var(--hot); border-color: var(--hot); }
.fld-newname { width: 100%; margin-top: 8px; }
.modal h3 { font-size: 17px; font-weight: 650; margin-bottom: 16px; }
.field { margin-bottom: 13px; } .field.half { display: inline-block; width: calc(50% - 5px); }
.field.half + .field.half { margin-left: 8px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 5px; }
.field input, .field select { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 13.5px; outline: none; font-family: inherit; }
.field input:focus, .field select:focus { border-color: var(--hot); box-shadow: 0 0 0 3px rgba(239,172,66,.14); }
.hint { font-size: 12px; color: var(--faint); margin: -4px 0 12px; line-height: 1.5; }
.amsmap { display: flex; flex-direction: column; gap: 7px; }
.amsrow { display: flex; align-items: center; gap: 8px; }
.amsrow .sw { width: 18px; height: 18px; border-radius: 5px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); }
.amsrow .ft { font-size: 12px; color: var(--muted); width: 62px; }
.amsrow .arrow { color: var(--faint); }
.amsrow .slotn { font-size: 12px; color: var(--muted); width: 50px; flex: none; }
.catlist { display: flex; flex-direction: column; gap: 6px; max-height: 54vh; overflow: auto; margin-bottom: 4px; }
.catrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.catrow .sw { width: 22px; height: 22px; border-radius: 6px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); }
.catrow .cn { flex: 1; }
.catrow .cn .nm { font-size: 13.5px; font-weight: 600; }
.catrow .inv { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* editor: three stock fields across */
.frow3 { display: flex; gap: 8px; }
.frow3 .field { flex: 1; margin-bottom: 13px; }

/* ---- Filament Stock (spool inventory count page) ---- */
#filstock.rows { display: flex; flex-direction: column; gap: 8px; max-width: 780px; }
.fsrow { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; border-left: 3px solid transparent; }
.fsrow.uncounted { border-left-color: rgba(255,210,74,.55); background: linear-gradient(90deg, rgba(255,210,74,.05), transparent 55%); }
.fs-grip { cursor: grab; color: var(--faint); font-size: 16px; padding: 0 2px; }
.fsrow.dragging { opacity: .5; }
#filstock.reordering .fsrow { cursor: grab; }
.fs-sw { width: 30px; height: 30px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08); }
.fs-info { flex: 1; min-width: 0; }
.fs-nm { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.fsrow.low .fs-nm { color: var(--error); }
.fs-low { font-size: 10px; font-weight: 700; color: var(--error); background: rgba(255,84,104,.15); border-radius: 999px; padding: 1px 7px; letter-spacing: .04em; }
.fs-sub2 { font-size: 12px; color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-when { color: var(--muted); }
.fsrow.uncounted .fs-when { color: var(--prep); font-weight: 600; }
.fs-count { display: flex; align-items: center; gap: 4px; flex: none; }
.fs-step { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 22px; font-weight: 600; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fs-step:active { background: var(--line); }
.fs-spools { width: 52px; height: 40px; text-align: center; font-family: var(--mono); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); color: var(--text); }
.fs-unit { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-left: 4px; }
@media (max-width: 560px) { .fs-unit { display: none; } .fsrow { padding: 10px 11px; gap: 9px; } }
.catrow .inv.low { color: var(--error); font-weight: 600; }
.amsrow select { flex: 1; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); padding: 6px 9px; border-radius: 8px; font-size: 13px; font-family: inherit; }
/* Multi-unit AMS editor: tabs + slot rows */
.amstabs { display: flex; gap: 8px; margin: 10px 0 14px; }
.amstab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-2); color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.amstab.active { border-color: var(--hot); color: var(--text); }
.amstab .tdots { display: inline-flex; gap: 3px; }
.amstab .tdots i { width: 11px; height: 11px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.12); }
.amspanel { display: flex; flex-direction: column; gap: 4px; }
.amsrow2 { display: flex; align-items: center; gap: 11px; padding: 5px 0; flex-wrap: wrap; }
/* "This print needs <shade>" sub-line under a slot, aligned under the swatch. */
.amsneed { flex-basis: 100%; margin: 1px 0 3px 61px; font-size: 12px; color: var(--hot); display: flex; align-items: center; gap: 6px; }
.amsneed i { width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); flex: none; }
.amsneed b { color: var(--text); font-weight: 650; }
.amsneed .faint { color: var(--faint); }
/* Banner naming the print routed to this printer. */
.amsfor { margin: 2px 0 8px; font-size: 12.5px; color: var(--text); background: rgba(239,172,66,.1); border: 1px solid rgba(239,172,66,.3); border-radius: 8px; padding: 6px 10px; }
.amsfor b { color: var(--hot); }
.amslock-banner { margin: 2px 0 10px; font-size: 12.5px; color: var(--text); background: rgba(220,90,90,.12); border: 1px solid rgba(220,90,90,.34); border-radius: 8px; padding: 7px 11px; }
.amslock-banner b { color: var(--error); }
.amslocked { font-size: 12px; color: var(--faint); font-family: var(--mono); white-space: nowrap; }
/* Per-design print history table (File Library ⋯ → Print history) */
.ph-wrap { max-height: 52vh; overflow: auto; margin: 4px 0 2px; border: 1px solid var(--line); border-radius: 10px; }
.modal:has(.ph-table) { width: 720px; }
.ph-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ph-table th { position: sticky; top: 0; background: var(--panel-2); text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ph-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.ph-row:last-child td { border-bottom: none; }
.ph-when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ph-stars { color: var(--prep); letter-spacing: 1px; white-space: nowrap; }
.ph-stars .ph-empty { color: var(--line); }
.ph-note { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); vertical-align: bottom; }
.ph-badge { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.ph-badge.failed { color: var(--error); }
.ph-badge.printing, .ph-badge.sending { color: var(--printing); }
.ph-thumbcell { width: 52px; }
.ph-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); cursor: zoom-in; display: block; background: var(--panel-2); }
.ph-thumb:hover { border-color: var(--accent); }
.ph-nothumb { color: var(--faint); }
.imgmodal { width: auto; max-width: 92vw; padding: 14px; }
.lightbox-img { display: block; max-width: 100%; max-height: 78vh; border-radius: 10px; border: 1px solid var(--line); }
.amsrow2 .slotn { font-size: 12px; color: var(--muted); width: 50px; flex: none; }
.amsrow2 .sw.big { width: 26px; height: 26px; border-radius: 7px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.14); }
.amsrow2 .amsload { flex: 1; font-size: 12.5px; color: var(--text); }
.amsrow2 .amsload .faint { color: var(--faint); }
.amsrow2 select { flex: 1.3; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); padding: 6px 9px; border-radius: 8px; font-size: 13px; font-family: inherit; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .spacer { margin-right: auto; }
.empty { color: var(--faint); text-align: center; padding: 60px 20px; }

/* ---------- Auth: login gate + header user chip + role gating ---------- */
.auth-host { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(8,11,18,.9); backdrop-filter: blur(6px); }
.auth-card { width: min(360px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 24px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55); }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 18px; }
.auth-card h2 { font-size: 14px; font-weight: 600; color: var(--muted); margin: -4px 0 2px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.auth-field input { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; }
.auth-field input:focus { border-color: var(--hot); box-shadow: 0 0 0 3px rgba(239,172,66,.14); outline: none; }
.auth-card .btn { margin-top: 6px; justify-content: center; }
.auth-err { color: var(--error); font-size: 12.5px; min-height: 16px; }
.userbox { position: relative; margin-left: 4px; }
.user-trigger { display: flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 5px 9px 5px 11px; cursor: pointer; }
.user-trigger:hover { border-color: var(--hot); }
.user-trigger .uname { font-size: 12.5px; color: var(--text); font-weight: 600; }
.user-trigger .urole { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.user-trigger .urole.admin { color: var(--hot); border-color: rgba(239,172,66,.4); }
.user-trigger .chev { color: var(--faint); transition: transform .15s; }
.user-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }
.user-menu { position: absolute; top: 46px; right: 0; min-width: 190px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 60; padding: 5px; }
.um-head { font-size: 11px; color: var(--muted); padding: 7px 9px 6px; }
.um-head b { color: var(--text); }
.user-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text);
  border-radius: 7px; padding: 8px 9px; font-size: 12.5px; cursor: pointer; }
.user-menu button:hover { background: var(--panel-2); }
.user-menu button.danger { color: var(--error); }
.um-sep { height: 1px; background: var(--line); margin: 4px 2px; }
/* Employees never see admin-only controls (backend enforces regardless) */
body:not(.role-admin) .admin-only { display: none !important; }
.userlist { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow: auto; margin: 6px 0; }
.urow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.urow .un { font-weight: 600; flex: 1; }
.urow .ur { font-size: 10px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.urow .ur.admin { color: var(--hot); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ================================================================== *
 * PHONE LAYOUT (<= 640px). AutoFarmer is desktop/TV-first; this block
 * makes it usable on a phone (the remote DuckDNS URL, full parity). The
 * card GRIDS already collapse to one column via auto-fill minmax(); what
 * needs help is the chrome — the header, the 8-tab bar, the controls row —
 * plus letting dialogs use the full screen width.
 * ================================================================== */
@media (max-width: 640px) {
  .wrap { padding: 0 12px 48px; }

  /* Header: wrap to two rows, drop the "Print Ops" wordmark, compact stats. */
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 12px 12px 10px; }
  .brand { font-size: 16px; }
  .brand small { display: none; }
  .stats { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; gap: 10px 14px; }
  .stat { flex-direction: row; align-items: baseline; gap: 5px; }        /* number + label inline */
  .stat b { font-size: 16px; }
  .stat span { font-size: 9.5px; }
  /* Pin the notifications panel to the viewport (near full-width) instead of
     hanging off the bell — otherwise it spills off the left edge. JS sets `top`
     from the bell's position (positionNotifPanel). */
  .notif-panel { position: fixed; left: 8px; right: 8px; width: auto; max-width: none; top: 120px; }

  /* Tabs: one horizontally-scrollable strip (8 tabs won't fit) that sticks
     to the top so you can switch tabs from anywhere in a long board. */
  .tabs { padding: 8px 12px 0; overflow-x: auto; flex-wrap: nowrap;
          -webkit-overflow-scrolling: touch; scrollbar-width: none;
          position: sticky; top: 0; z-index: 20; background: var(--bg); }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; font-size: 13px; padding-left: 10px; padding-right: 10px; }

  /* Controls: title + search go full width, filter chips flow from the left. */
  .controls { gap: 8px; padding: 12px 0 4px; }
  .controls .title { font-size: 18px; width: 100%; margin-right: 0; }
  .search { width: 100%; }
  .search input { width: 100%; }
  .controls .segmented, .controls .btn:last-child { margin-left: 0; }

  /* Dialogs: full-width, tighter, top-aligned so the on-screen keyboard fits. */
  .modal-host { padding: 10px; align-items: flex-start; }
  .modal, .modal:has(.qlist), .modal:has(.ph-table) { width: 100%; max-width: 100%; padding: 18px 15px; }
  .modal-actions { flex-wrap: wrap; }
}
