:root {
  --bg: #f3f4f6; --surf: #ffffff; --surf2: #eceef2; --line: #e1e4e9; --line2: #c4cad3;
  --text: #101214; --muted: #5d6571; --accent: #2b59ff; --cyan: #1cb7ec;
  --ochre: #a8690f; --ochre2: #ecd3a0; --danger: #c93a2e; --used: #c3c8d0; --grey: #7b838f;
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--text); text-underline-offset: 3px; }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
code { background: var(--surf2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.text { color: var(--text); }
.hp { position: absolute; left: -9999px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; border: 0; padding: 0; }

/* header */
.topline { height: 3px; background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.bar { background: var(--surf); border-bottom: 1px solid var(--line); }
.barin { min-height: 60px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; text-decoration: none; }
.barnav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.barnav a.muted { text-decoration: none; }
main.wrap { padding-top: 24px; padding-bottom: 40px; }

/* buttons + form controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surf); color: var(--text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-height: 44px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.sm { min-height: 32px; padding: 0 12px; }
.btn.sm.primary { min-height: 32px; }
.btn.icon { width: 32px; padding: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surf); border: 1px solid var(--line2); border-radius: 6px; padding: 9px 10px; width: 100%; }
input[type=color] { padding: 3px; height: 34px; width: 72px; }
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.hl { border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field legend { padding: 0; margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }   /* end: inputs line up even when a label wraps or has a hint */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.field > small { margin-top: -2px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { flex: 1; }

/* cards + layout */
.card { background: var(--surf); border: 1px solid var(--line); border-radius: 8px; }
.card.pad { padding: 18px; margin-bottom: 16px; }
.card.empty { padding: 24px; text-align: center; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.main { flex: 999 1 540px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.side { flex: 1 1 320px; max-width: 360px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.intro { margin: 0; max-width: 60ch; }
.split { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.big { font-size: 18px; font-weight: 600; }
.cardhead { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cardbody { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.cardfoot { padding: 10px 18px; border-top: 1px solid var(--line); font-size: 13px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surf2); overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: -8px; }
.tabs a { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.count { background: var(--surf2); color: var(--muted); border-radius: 4px; padding: 0 7px; font-size: 12px; }

/* status + colour */
.st { display: inline-flex; align-items: center; gap: 8px; }
.st i { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--grey); background: var(--grey); }
.st-pending i { background: transparent; border-color: var(--ochre); }
.st-queued i { background: var(--grey); }
.st-printing { font-weight: 600; }
.st-printing i { background: var(--accent); border-color: var(--accent); }
.st-done i { background: var(--line2); border-color: var(--line2); }
.st-rejected i { background: transparent; border-color: var(--danger); }
.swatch, .sw { flex: none; display: inline-block; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22); }
.swatch { width: 14px; height: 14px; }
.swatch.big { width: 30px; height: 30px; }
.colour { display: inline-flex; align-items: center; gap: 8px; }

/* public table */
.tablewrap { overflow-x: auto; }
table.pub { width: 100%; min-width: 600px; border-collapse: collapse; }
table.pub th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 18px; }
table.pub th.r { text-align: right; }
table.pub td { padding: 11px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
table.pub td.r { text-align: right; }
table.pub td.nw { white-space: nowrap; }
table.pub .model { display: block; font-weight: 600; }
table.pub .sub { display: block; font-size: 12.5px; }
table.pub tr.s-done, .qrow.s-done { opacity: 0.6; }

/* colour picker with hover preview */
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 4px; }
.chip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip .sw { width: 34px; height: 34px; border: 2px solid var(--surf); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--line2); }
.chip input:checked ~ .sw { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22), 0 0 0 3px var(--surf), 0 0 0 5px var(--text); }
.chip input:focus-visible ~ .sw { outline: 2px solid var(--accent); outline-offset: 5px; }
.cname { font-size: 12px; line-height: 1.2; color: var(--text); }
.cmeta { font-size: 11px; color: var(--muted); line-height: 1.2; }
.chip:nth-child(4n+1) .pop { left: 0; transform: none; }
.chip:nth-child(4n) .pop { left: auto; right: 0; transform: none; }
.pop { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: 184px; z-index: 5; flex-direction: column; gap: 3px; padding: 10px; text-align: left; background: var(--surf); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 10px 28px rgba(16, 18, 20, 0.18); pointer-events: none; }
.chip:hover .pop, .chip:focus-within .pop { display: flex; }
.pop strong { font-size: 13px; }
.pop .small { margin-top: 4px; font-size: 11.5px; }
.sample { position: relative; display: block; height: 92px; border-radius: 6px; margin-bottom: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22); overflow: hidden; }
.sample::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 4px); }
.sample::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 55%); }

/* flash + notices */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; background: #e8f0ff; border: 1px solid #bcd0ff; }
.flash.err { background: #fdecea; border-color: #f2b8b2; color: #8f2118; }
.notice { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 8px; border: 1px solid; background: var(--surf); }
.notice svg { flex: none; }
.notice.bad { border-color: #f2b8b2; background: #fdf0ee; color: #8f2118; }
.notice.warn { border-color: var(--ochre2); background: #fbf4e4; color: #6d430a; }

/* login */
.loginbox { max-width: 360px; margin: 60px auto; padding: 0 20px; }

/* admin shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.rail { flex: 0 0 220px; background: var(--surf); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.logo { font-weight: 700; font-size: 16px; padding: 4px 12px 16px; letter-spacing: -0.01em; }
.rail a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.rail a:hover { background: var(--surf2); }
.rail a.on { background: var(--surf2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nb { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.nb.warn { color: var(--ochre); }
.grow { flex: 1; min-height: 24px; }
.content { flex: 999 1 640px; min-width: 0; padding: 22px 28px 36px; display: flex; flex-direction: column; gap: 16px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.stats span { display: flex; flex-direction: column; }
.stats small { color: var(--muted); font-size: 12px; }
.stats strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* condensed queue rows */
.qtable { min-width: 940px; }
.qf { display: contents; }
.qf small, .qcost small { display: none; }
.qrow { position: relative; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr) minmax(0, 1fr) 64px 64px 70px 140px 84px 118px; gap: 10px; align-items: center; padding: 7px 14px; border-top: 1px solid var(--line); font-size: 13.5px; margin: 0; }
.qrow.qhead { background: var(--surf2); border-top: 0; color: var(--muted); font-size: 12px; font-weight: 600; padding: 9px 14px; }
.qrow input, .qrow select { height: 32px; padding: 0 8px; border-radius: 5px; }
.qrow input.num { text-align: right; }
.qrow input.need { border-color: var(--ochre); }
.qrow .acts { justify-content: flex-end; flex-wrap: nowrap; }
.modelcell { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.modelcell small { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* filament cards */
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.k { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.k.used, .seg.used { background: var(--used); }
.k.appr, .seg.appr { background: var(--accent); }
.k.wait, .seg.wait { background: repeating-linear-gradient(135deg, var(--ochre) 0 3px, var(--ochre2) 3px 6px); }
.k.free { background: linear-gradient(135deg, #8a8a8a, #cfcfcf); }
.addroll { max-width: 340px; flex: 1 1 300px; }
.rolls { flex: 999 1 560px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 16px; align-items: start; }
.roll { display: flex; flex-direction: column; }
.roll.off { opacity: 0.7; }
.rollhead { padding: 14px 16px 0; display: flex; align-items: center; gap: 12px; }
.rollhead div { display: flex; flex-direction: column; min-width: 0; }
.rollhead strong { font-size: 15px; }
.left { padding: 14px 16px 0; font-size: 18px; }
.left .muted { font-size: 13px; }
.stack4 { margin: 8px 16px 0; display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surf2); box-shadow: 0 0 0 1px var(--line); }
.stack4.bad { box-shadow: 0 0 0 1px var(--danger); }
.stack4.warn { box-shadow: 0 0 0 1px var(--ochre); }
.seg { flex: none; height: 100%; }
.seg.free { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.nums { margin: 8px 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.nums b { font-weight: 500; color: var(--text); }
.warnings { padding: 10px 16px 12px; min-height: 40px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.warnings .bad { color: var(--danger); font-weight: 500; }
.warnings .warn { color: var(--ochre); font-weight: 500; }
.rollfoot { margin-top: auto; border-top: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.rollfoot form { margin: 0; }
.edit summary { list-style: none; cursor: pointer; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.edit summary::-webkit-details-marker { display: none; }
.edit[open] summary { color: var(--text); }
.editpanel { padding: 4px 16px 16px; }
.colorrow { display: flex; align-items: flex-end; gap: 10px; }
.colorrow .swatch.big { width: 40px; height: 40px; margin-bottom: 2px; }
form.fil.is-solid .multi, form.fil.is-solid .multi + .multi { display: none; }
form.fil:not(.is-solid) .solidnote { display: none; }

.jump { display: none; align-self: flex-start; }

/* admin queue: below this width the nine columns no longer fit, so each request becomes a small card */
@media (max-width: 1239px) {
  .qtable { min-width: 0; }
  .qrow.qhead { display: none; }
  .qrow { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 12px 14px; }
  .qrow > .strong { grid-column: span 2; }
  .qrow > .modelcell { grid-column: span 4; }
  .qrow > .strong, .qrow > .modelcell { align-self: start; }
  .qrow > .colour { grid-column: span 6; }
  .qf { display: flex; flex-direction: column; gap: 3px; grid-column: span 2; min-width: 0; }
  .qf.st-col { grid-column: span 3; }
  .qf small, .qrow .qcost small { display: block; color: var(--muted); font-size: 12px; }
  .qrow .qcost { grid-column: span 2; display: flex; flex-direction: column; gap: 3px; text-align: right; }
  .qrow .qcost small { text-align: right; }
  .qrow .qdate { grid-column: span 3; align-self: end; padding-bottom: 6px; }
  .qrow .acts { grid-column: span 6; }
}

@media (max-width: 720px) {
  .wrap, .content { padding-left: 16px; padding-right: 16px; }
  .rail { flex-basis: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px; }
  .rail a { padding: 0 6px; gap: 6px; white-space: nowrap; }
  .logo, .grow { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid2.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .addroll { order: 2; max-width: none; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .jump { display: inline-flex; }

  /* public queue: one card per request instead of a table that scrolls sideways */
  .tablewrap { overflow-x: visible; }
  table.pub, table.pub tbody { display: block; min-width: 0; }
  table.pub thead { display: none; }
  table.pub tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
  table.pub tr:first-child { border-top: 0; }
  table.pub td { display: block; padding: 0; border: 0; }
  table.pub td:first-child { flex: 1 1 100%; }
  table.pub td.r { margin-left: auto; text-align: right; }
  table.pub td.r ~ td.r { margin-left: 0; }
}
