/* Renbolt. "Ledger": calm business workspace. Light and dark themes share token names.
   Plum = actions and selection only. Blue = printing. Amber = processing (printer done, not checked).
   Green = ready. Red = errors and destructive. Status always has an icon and a word, never color alone. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/static/fonts/plex-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/static/fonts/plex-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/static/fonts/plex-600.woff2") format("woff2"); }
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --subtle: #F7F8FA; --sunken: #ECEEF1; --stage-hi: #FFFFFF;
  --line: #E4E7EB; --border: #DDE1E6; --control: #C9CED6;
  --ink: #1F2328; --ink2: #3D4550; --muted: #5B6470; --dim: #8A919C;
  --accent: #6D3F74; --on-accent: #FFFFFF; --accent-bg: #F3ECF4; --accent-fg: #5A2F61; --accent-line: #E3D3E5;
  --printing: #1F5FAE; --printing-bg: #E8F0FA; --printing-fg: #174C8C;
  --processing: #7A4B00; --processing-bg: #FFF3DC;
  --ok: #166A40; --ok-bg: #E5F3EB;
  --late: #9A5B00; --danger: #B42318; --danger-bg: #FCE4E2; --neutral-bg: #F0F1F3;
  --ring-mid: #9AA1AB; --ring-deep: #C9CED6;
  --scrim: rgba(20, 24, 31, .45); --shadow: 0 8px 28px rgba(20, 24, 31, .12);
  --ease: cubic-bezier(.45, 0, .55, 1);
  --radius: 8px; --r-ctl: 6px;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121418; --surface: #1B1E24; --subtle: #1F2329; --sunken: #0E0F12; --stage-hi: #262A33;
  --line: #262A31; --border: #2F343C; --control: #3A404A;
  --ink: #E6E8EB; --ink2: #C4C9D0; --muted: #A3A9B3; --dim: #7E8591;
  --accent: #C595CD; --on-accent: #1A1320; --accent-bg: #2E2433; --accent-fg: #E6CBEA; --accent-line: #4A3950;
  --printing: #74A3E4; --printing-bg: #1C2B40; --printing-fg: #93BAF0;
  --processing: #EDC27A; --processing-bg: #3A2E17;
  --ok: #86D1A3; --ok-bg: #16301F;
  --late: #E2A857; --danger: #F2877A; --danger-bg: #3A1F1C; --neutral-bg: #2A2E35;
  --ring-mid: #7E8591; --ring-deep: #4A505A;
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #121418; --surface: #1B1E24; --subtle: #1F2329; --sunken: #0E0F12; --stage-hi: #262A33;
  --line: #262A31; --border: #2F343C; --control: #3A404A;
  --ink: #E6E8EB; --ink2: #C4C9D0; --muted: #A3A9B3; --dim: #7E8591;
  --accent: #C595CD; --on-accent: #1A1320; --accent-bg: #2E2433; --accent-fg: #E6CBEA; --accent-line: #4A3950;
  --printing: #74A3E4; --printing-bg: #1C2B40; --printing-fg: #93BAF0;
  --processing: #EDC27A; --processing-bg: #3A2E17;
  --ok: #86D1A3; --ok-bg: #16301F;
  --late: #E2A857; --danger: #F2877A; --danger-bg: #3A1F1C; --neutral-bg: #2A2E35;
  --ring-mid: #7E8591; --ring-deep: #4A505A;
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 64px); }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 "IBM Plex Sans", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: inherit; }
.wrap { max-width: 34rem; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-bottom: 64px; outline: none; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- type ---------- */
h1 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.eyebrow { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 20px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 12px; color: var(--accent); text-decoration: none; font-size: 16px; }
.back::before { content: ""; width: 9px; height: 9px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 2px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; height: 56px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: .02em; margin-right: auto; min-height: 44px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-search { display: grid; place-items: center; width: 40px; height: 40px; background: none; border: 0; border-radius: var(--r-ctl); color: var(--ink2); cursor: pointer; }
.nav-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.nav-search:hover { background: var(--subtle); color: var(--ink); }
.side-search { display: none; }
.nav-link { text-decoration: none; color: var(--ink2); font-size: 15px; font-weight: 500; padding: 8px 10px; border-radius: var(--r-ctl); }
.nav-link[aria-current="page"] { color: var(--accent-fg); background: var(--accent-bg); font-weight: 600; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; margin-left: 6px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-fg); text-decoration: none; font-weight: 600; font-size: 15px; }

/* ---------- maw (Visual Law §7.1) ---------- */
.maw { display: block; flex: none; }
.maw .throat { fill: var(--sunken); }
.maw circle.c1 { stroke: var(--muted); }
.maw circle.c2 { stroke: var(--ring-mid); }
.maw circle.c3 { stroke: var(--ring-deep); }
.maw circle.c4 { stroke: var(--accent); }
.maw g { transform-box: view-box; transform-origin: 50% 50%; }
.maw.spin .g1 { animation: turn 45s linear infinite; }
.maw.spin .g2 { animation: turn 30s linear infinite reverse; }
.maw.spin .g3 { animation: turn 22.5s linear infinite; }
.maw.spin .g4 { animation: turn 16.4s linear infinite reverse; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------- auth ---------- */
.auth { max-width: 24rem; margin: 0 auto; padding-top: clamp(32px, 9vh, 88px); }
.auth .maw { margin-bottom: 20px; }
.wordmark { font-size: 34px; letter-spacing: .02em; }
.auth-sub { color: var(--muted); margin: 6px 0 32px; }
.auth-foot { color: var(--muted); font-size: 15px; margin: 24px 0 0; }
.auth-foot a { color: var(--ink); }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 22px; }
.label { display: block; font-weight: 600; margin-bottom: 8px; }
.opt { font-weight: 400; color: var(--muted); margin-left: 4px; }
.hint { display: block; color: var(--muted); font-size: 15px; margin-top: 8px; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="url"], textarea, select {
  display: block; width: 100%;
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--control); border-radius: var(--r-ctl);
  padding: 11px 13px; min-height: 48px;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { resize: vertical; min-height: 132px; line-height: 1.45; }
select { padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239B948A' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
input[type="date"] { min-width: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .7; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input[readonly] { color: var(--muted); }
.pw { position: relative; display: block; }
.pw input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 10px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.form-error { margin: 0 0 16px; padding: 12px 14px; background: var(--danger-bg); color: var(--danger); border-radius: var(--r-ctl); }
details.more { margin: 0 0 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
details.more > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 52px; color: var(--muted); font-weight: 600; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-size: 22px; font-weight: 400; line-height: 1; }
details.more[open] > summary::after { content: "–"; }
details.more[open] { padding-bottom: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  font: inherit; font-weight: 500; text-decoration: none; text-align: center;
  border-radius: var(--r-ctl); border: 1px solid transparent; cursor: pointer;
  transition: filter .12s var(--ease), background-color .12s var(--ease);
}
.btn:disabled { background: transparent; border-color: var(--line); color: var(--dim); cursor: not-allowed; filter: none; }
.btn-primary { width: 100%; min-height: 52px; background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(.94); }
.btn-primary:active { filter: brightness(.86); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--control); }
.btn-quiet:hover { background: var(--subtle); }
.btn-quiet:active { background: var(--sunken); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 14px; width: auto; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }
.text-btn { font: inherit; font-size: 15px; background: none; border: 0; padding: 0; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-btn.danger { color: var(--danger); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:first-child { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 16px 0; text-decoration: none; color: inherit; cursor: pointer; }
a.row::after, summary.row::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ring-deep); border-top: 2px solid var(--ring-deep); transform: rotate(45deg); margin-right: 4px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row-title { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-meta { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 2px; font-size: 15px; color: var(--muted); }
.row-thumb { flex: none; width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--sunken); }
.list-gap { margin-top: 24px; }

/* ---------- status ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink2); background: var(--neutral-bg); }
.st::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.st.st-printing { color: var(--printing-fg); background: var(--printing-bg); }
.st.st-printing::before { background: linear-gradient(90deg, transparent 50%, currentColor 50%); }
.st.st-processing { color: var(--processing); background: var(--processing-bg); }
.st.st-processing::before { background: currentColor; }
.st.st-ready { color: var(--ok); background: var(--ok-bg); }
.st.st-ready::before { width: 7px; height: 4px; border-radius: 0; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.st.st-done { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.st.st-done::before { width: 7px; height: 0; border-radius: 0; border-width: 1.5px 0 0; }
.late { color: var(--danger); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.soon { color: var(--late); font-weight: 600; }
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; height: 3px; max-width: 180px; }
.progress span { border-radius: 2px; background: var(--border); }
.progress.lg { height: 5px; max-width: none; gap: 5px; margin: 18px 0 10px; }
.p-new span.on { background: var(--accent); }
.p-printing span.on { background: var(--printing); }
.p-processing span.on { background: var(--processing); }
.p-ready span.on { background: var(--ok); }
.p-done span.on { background: var(--muted); }
.status-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 22px 0 26px; }
.status-card .status-line { color: var(--ink); }
.status-card.st-processing { background: var(--processing-bg); border-color: transparent; }
.status-card.st-processing .status-line { color: var(--processing); }
.status-card.st-ready { background: var(--ok-bg); border-color: transparent; }
.status-card.st-ready .status-line { color: var(--ok); }
.status-line { font-size: 20px; line-height: 1.35; font-weight: 500; margin: 0; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }

/* ---------- request detail ---------- */
.req-title { margin-top: 8px; overflow-wrap: anywhere; }
.req-meta { color: var(--muted); margin: 8px 0 0; }
.req-desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 24px; }
.facts { margin: 0 0 24px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.facts div:first-child { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.facts a { text-underline-offset: 4px; text-decoration-color: var(--border); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 0 0 24px; }
.gallery a { display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--sunken); border: 1px solid var(--border); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.files { list-style: none; margin: 0 0 24px; padding: 0; }
.files a { display: flex; align-items: center; gap: 10px; min-height: 48px; text-underline-offset: 4px; text-decoration-color: var(--border); overflow-wrap: anywhere; }
.section { margin-top: 32px; }

/* ---------- attachments picker ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 12px; }
.thumbs:empty { display: none; }
.thumb { position: relative; margin: 0; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--sunken); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-file { display: flex; align-items: center; justify-content: center; padding: 8px; font-size: 13px; text-align: center; word-break: break-all; border: 1px dashed var(--border); color: var(--muted); }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(20, 24, 31, .7); color: #fff; font: 400 20px/1 system-ui, sans-serif; cursor: pointer; }

/* ---------- queue ---------- */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabs button { font: inherit; font-size: 15px; font-weight: 600; min-height: 46px; padding: 0; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); cursor: pointer; }
.tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.count { font-weight: 400; color: var(--muted); margin-left: 4px; }
.tabs + .list > li:first-child { border-top: 0; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--control); border-radius: var(--r-ctl); overflow: hidden; }
.seg button { font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; border: 0; border-radius: 0; background: transparent; color: var(--ink2); cursor: pointer; transition: background-color .12s var(--ease), color .12s var(--ease); }
.seg button + button { border-left: 1px solid var(--control); }
.seg button:hover { background: var(--subtle); }
.seg button[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-fg); font-weight: 600; }
.danger-zone { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- people ---------- */
.badge { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--accent-fg); background: var(--accent-bg); border-radius: 10px; padding: 1px 8px; vertical-align: 1px; }
details.person > summary { list-style: none; }
details.person > summary::-webkit-details-marker { display: none; }
details.person[open] > summary::after { transform: rotate(135deg); }
.person-actions { padding: 0 0 18px; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0 0 20px; }
.card .field { margin-bottom: 14px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.card p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- empty state, tip, toast ---------- */
.quiet { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 12px; }
.quiet h2 { font-size: 18px; font-weight: 600; margin: 18px 0 6px; }
.quiet p { color: var(--muted); margin: 0; max-width: 22rem; }
.tip { position: relative; background: var(--accent-bg); border-radius: var(--radius); padding: 14px 52px 14px 16px; margin: 16px 0 0; font-size: 15px; color: var(--ink2); }
.tip strong { color: var(--accent-fg); display: block; margin-bottom: 2px; }
.tip-x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font: 400 22px/1 system-ui, sans-serif; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); z-index: 60; max-width: calc(100% - 40px); padding: 12px 16px; border-radius: var(--radius); background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.error-block { padding: 48px 0; color: var(--muted); }

/* ---------- loading (Visual Law §7.4) ---------- */
.breach { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); opacity: 0; transition: opacity .35s var(--ease); pointer-events: none; }
.breach.on { opacity: 1; pointer-events: auto; }
.breach .maw { transform: scale(.3); opacity: 0; transition: transform .7s cubic-bezier(.22, 1, .36, 1), opacity .7s var(--ease); }
.breach.on .maw { transform: scale(1); opacity: 1; }
.breach .eyebrow { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01s !important; animation: none !important; }
  .breach .maw { transform: none; }
}
.card .card-action { margin-top: 14px; }
.person-actions .muted { margin: 0; }

/* ---------- live view ---------- */
.live-card { margin: 0 0 26px; }
.live-card.section { margin-top: 32px; }
.live-frame { position: relative; aspect-ratio: 16 / 9; background: #0B0C0F; border-radius: var(--radius); overflow: hidden; }
.live-frame .live { width: 100%; height: 100%; object-fit: cover; display: block; }
.telemetry { display: flex; align-items: flex-end; gap: 18px; margin-top: 14px; }
.telemetry .figure { font-size: 40px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }
.telemetry .figure small { font-size: 20px; color: var(--muted); margin-left: 2px; }
.tele-detail { display: flex; flex-direction: column; color: var(--muted); font-size: 15px; padding-bottom: 2px; }
.tele .muted { margin: 12px 0 0; font-size: 15px; }
.line-pos { margin: 0 0 12px; }
.btn-row .btn-small { flex: 1; }
.danger-zone .text-btn { margin-top: 12px; }
.btn-row .btn-small { white-space: nowrap; padding: 0 10px; font-size: 14px; }

/* printer pictures, filament swatches and color chips */
.picture { margin: 0 0 24px; }
.picture .eyebrow { display: block; margin-bottom: 10px; }
.picture a { display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.picture img { display: block; width: 100%; height: auto; }
.picture.preview img { max-height: 240px; object-fit: contain; }
.photo-actions { margin: -12px 0 24px; }
.swatch { vertical-align: -3px; margin-right: 8px; }
.swatch circle { stroke: var(--border); stroke-width: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 15px; cursor: pointer; }
.chip small { font-weight: 400; margin-left: 6px; font-size: 13px; }
.chip input:checked + span { color: var(--accent-fg); background: var(--accent-bg); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* makers: stacked links, checkboxes, inline form rows */
.stack { display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.btn-row > select, .btn-row > input { flex: 1; min-width: 0; }
.page-head .btn-row { flex: none; }
.pay { margin: 0; }
.pay-box { display: grid; gap: 10px; margin-bottom: 28px; }
.pay-note { margin: 0; font-size: 17px; color: var(--ink); overflow-wrap: anywhere; }
.tag-unpaid, .tag-paid, .tag-late { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; color: var(--processing); background: var(--processing-bg); }
.tag-paid { color: var(--ok); background: var(--ok-bg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.unit-input { display: flex; align-items: center; gap: 8px; }
.unit-input input { flex: 1; min-width: 0; }
.unit-input .unit { color: var(--muted); min-width: 2.2em; }
.facts.quote { margin-top: 18px; }
.facts .ok { color: var(--ok); font-weight: 600; }
.req-meta.ok { color: var(--ok); }
.req-meta.late { color: var(--danger); }

/* ---------- computers: sidebar, split queue, two columns (makers, 1024 px and wider) ---------- */
.keys { color: var(--muted); font-size: 13px; margin: 18px 0 0; }
kbd { font: inherit; font-size: 12px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--ink); }
.cols > div { min-width: 0; }
.pane-resize, .pane-tools { display: none; }
@media (min-width: 1024px) {
  body.desk { font-size: 15px; }
  body.desk h1 { font-size: 24px; }
  body.desk .topbar { position: fixed; inset: 0 auto 0 0; width: 232px; border-bottom: 0; border-right: 1px solid var(--border); background: var(--surface); }
  .side { display: flex; flex-direction: column; height: 100%; padding: 18px 12px 16px; }
  .side .brand { margin: 0 0 12px 8px; flex: none; }
  body.desk .side-search { display: flex; align-items: center; gap: 8px; flex: none; margin: 0 0 10px; padding: 7px 10px; background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r-ctl); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
  .side-search:hover { border-color: var(--control); color: var(--ink); }
  .side-search svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; flex: none; }
  .side-search kbd { margin-left: auto; font: inherit; font-size: 11px; color: var(--muted); }
  /* The links scroll inside the sidebar; the printer, theme and your name stay at the bottom. */
  .side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -12px; padding: 0 12px; scrollbar-width: thin; }
  .side-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 10px 4px; }
  button.side-group { display: flex; align-items: center; gap: 6px; width: calc(100% - 20px); background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: inherit; text-align: left; }
  button.side-group::after { content: "▾"; font-size: 10px; order: 1; }
  button.side-group:hover { color: var(--ink); }
  .side-sec.folded > button.side-group::after { content: "▸"; }
  .side-sum { order: 2; margin-left: auto; font-size: 11px; color: var(--danger); letter-spacing: 0; }
  .side-sec:not(.folded) .side-sum { display: none; }
  .side-sec-links { display: flex; flex-direction: column; gap: 2px; }
  .side-sec.folded .side-sec-links { display: none; }
  .side-link, .side-me { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: var(--r-ctl); color: var(--ink2); text-decoration: none; font-weight: 400; }
  .side-link:hover, .side-me:hover { background: var(--subtle); color: var(--ink); }
  .side-link[aria-current="page"], .side-me[aria-current="page"] { background: var(--accent-bg); color: var(--accent-fg); font-weight: 600; }
  .side-count { font-size: 12px; font-weight: 600; color: inherit; border: 1px solid var(--accent-line); border-radius: 10px; padding: 0 7px; }
  .side-count:empty { display: none; }
  .side-foot { margin-top: 8px; display: grid; gap: 10px; flex: none; }
  .side-printer { padding: 10px; border-top: 1px solid var(--line); }
  .side-printer:empty { display: none; }
  .side-printer .eyebrow { font-size: 11px; margin-bottom: 4px; }
  .side-printer-line { display: block; color: var(--ink); font-size: 14px; }
  .side-bar svg { display: block; width: 100%; height: 4px; margin-top: 8px; }
  .side-bar .track { fill: var(--border); }
  .side-bar .fill { fill: var(--printing); }
  .side-me { justify-content: flex-start; }
  .side-me .avatar { width: 28px; height: 28px; margin: 0; font-size: 13px; }

  body.desk main.wrap { max-width: none; margin: 0 0 0 232px; padding: 8px 48px 64px; }
  /* One width per page (app.js sets w-980 / w-1180 / w-1400 from what the page holds); every part follows it. */
  body.desk main.wrap > * { max-width: var(--page-w, 760px); }
  body.desk main.wrap > .split, body.desk main.wrap > .cols { max-width: none; }
  body.desk .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 56px; max-width: 1180px; align-items: start; }
  body.desk .side-form { margin-top: 0; position: sticky; top: 24px; }

  .split { display: grid; grid-template-columns: minmax(320px, 1fr) 12px minmax(360px, var(--detail-width, 58%)); height: 100vh; margin: -8px -48px -64px; }
  .split > .pane-list, .split > .pane-detail { min-width: 0; }
  .pane-resize { display: block; position: relative; cursor: col-resize; touch-action: none; background: var(--surface); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .pane-resize::after { content: ""; position: absolute; top: calc(50% - 24px); left: 3px; width: 4px; height: 48px; border-left: 1px solid var(--dim); border-right: 1px solid var(--dim); }
  .pane-resize:hover, .pane-resize:focus-visible { background: var(--accent-bg); }
  .pane-resize:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .resizing-detail, .resizing-detail * { cursor: col-resize !important; user-select: none !important; }
  .pane-tools { display: flex; justify-content: flex-end; position: sticky; top: -14px; z-index: 3; background: var(--surface); padding: 10px 0; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
  .pane-tools .btn { min-height: 36px; }
  .pane-list { overflow-y: auto; padding: 0 20px 32px 24px; background: var(--bg); container-type: inline-size; }
  .pane-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 22px 0 12px; }
  .pane-list .tabs { position: sticky; top: 74px; z-index: 1; background: var(--bg); }
  .pane-list .row { margin: 0 -10px; padding: 10px; border-radius: var(--r-ctl); }
  .pane-list .row:hover { background: var(--surface); }
  .pane-list .row[aria-current] { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
  .pane-list .row-title { font-size: 15px; }
  .pane-list .row-meta { font-size: 13px; }
  .pane-list .thumb { width: 40px; height: 40px; }
  .pane-detail { overflow-y: auto; padding: 14px clamp(20px, 2vw, 40px) 64px; background: var(--surface); container-type: inline-size; }
  /* What's open sits in the middle of its panel, not against the list. */
  .pane-detail > * { max-width: 820px; margin-left: auto !important; margin-right: auto !important; }
  .pane-detail .back { display: none; }
  .pane-detail .picture, body.desk .picture { max-width: 380px; }
  .pane-detail .gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pane-detail .quiet { margin-top: 18vh; }
  body.desk .list a.row:hover { background: var(--subtle); }
  body.desk main.wrap > .back { display: none; }
  body.desk main.wrap > .page-head:first-child, body.desk main.wrap > .back + .page-head { margin-top: 22px; }
}

/* ---------- stock ---------- */
.stock-qty { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-qty small { font-size: 12px; font-weight: 400; color: var(--muted); }
.stock-big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 18px 0 6px; }
.stock-big .figure { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.adjust-note { margin-top: 10px; }
.add-item { padding-bottom: 8px; }
.edit-item summary { list-style: none; }
.edit-item summary::-webkit-details-marker { display: none; }
.edit-item[open] summary { margin-bottom: 14px; }
.moves .row-title { font-size: 15px; }
.moves .row-meta a { color: var(--muted); }
.req-title .swatch { margin-right: 10px; vertical-align: -1px; }
.parts-used { margin-top: 22px; }
.parts-used .label { display: block; font-weight: 600; margin-bottom: 8px; }
.plain { list-style: none; margin: 0 0 10px; padding: 0; }
.plain li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain li > span:first-child { flex: 1; }
.part-add input { max-width: 80px; flex: none; }
input[type="color"] { padding: 4px; height: 48px; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; flex: none; }
@media (min-width: 1024px) { .pane-list .tabs { gap: 20px; } }

/* ---------- labels and receipts ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 20px; }
.qr-label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #111; break-inside: avoid; }
.qr-label img { width: 88px; height: 88px; flex: none; }
.qr-label figcaption { display: grid; gap: 4px; font-size: 13px; line-height: 1.25; }
.qr-label figcaption span { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: #444; }
.receipt-line { padding: 14px 0; border-bottom: 1px solid var(--line); }
.rl-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.rl-fields { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 700px) { .rl-fields { grid-template-columns: 1.3fr 1.6fr .5fr .6fr; } }
@media print {
  body { background: #fff; }
  .topbar, .no-print, .toast { display: none !important; }
  body.desk main.wrap, main.wrap { margin: 0; padding: 0; max-width: none; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .qr-label { border-color: #bbb; }
}

/* ---------- overview ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 8px 0 28px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 18px 16px 18px 0; }
.kpi + .kpi { border-left: 1px solid var(--line); padding-left: 18px; }
.kpi:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
.kpi:nth-child(4) { border-top: 1px solid var(--line); }
.kpi .eyebrow { margin: 0; }
.kpi-figure { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub, .delta { font-size: 13px; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.spice { color: var(--late); }  /* money still owed */
.late { color: var(--danger); }
.ok { color: var(--ok); }
.tag-late { color: var(--danger); background: var(--danger-bg); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.section-head .eyebrow { margin: 0; }
.chart { display: block; width: 100%; height: auto; margin-top: 10px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--ring-mid); }
.chart .bar.now { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart g:hover .bar { fill: var(--accent); }
.chart .line { fill: none; stroke: var(--ok); stroke-width: 2; stroke-linejoin: round; }
.chart .dot { fill: var(--surface); stroke: var(--ok); stroke-width: 2; }
.chart .dot.loss { stroke: var(--danger); }
.legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .key + * { margin-right: 12px; }
.bar-key { background: var(--accent); }
.line-key { background: var(--ok); height: 3px; border-radius: 2px; vertical-align: 2px; margin-left: 10px; }
.stackbar { display: block; width: 100%; height: 14px; border-radius: 4px; margin: 8px 0 16px; }
.seg.filament, .key.filament { fill: var(--accent); background: var(--accent); }
.seg.parts, .key.parts { fill: var(--ring-mid); background: var(--ring-mid); }
.seg.extras, .key.extras { fill: var(--muted); background: var(--muted); }
.seg.machine, .key.machine { fill: var(--ring-deep); background: var(--ring-deep); }
.seg.failed, .key.failed { fill: var(--danger); background: var(--danger); }
.attention .row { padding: 12px 0; }
.all-clear { color: var(--ok); }
.top-gap { margin-top: 28px; }
.small { font-size: 13px; }

/* ---------- customers ---------- */
.avatar.sm { width: 34px; height: 34px; margin: 0 2px 0 0; flex: none; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; margin: 0; flex: none; font-size: 22px; }
.cust-head { display: flex; align-items: center; gap: 16px; margin: 18px 0 20px; }
.cust-head h1 { margin: 0; }
.cust-head .req-meta a { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; }
.stat .eyebrow { margin: 0; font-size: 11px; }
.stat-figure { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-figure small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.notes-label { display: flex; justify-content: space-between; align-items: baseline; }
.saved { font-size: 13px; color: var(--muted); }
.chips.static { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-static { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 14px; }
.search { display: block; margin: 4px 0 8px; }
input[type="search"] { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--control); border-radius: var(--r-ctl); padding: 9px 12px; min-height: 40px; }

/* ---------- approval ---------- */
.approval { border-top: 1px solid var(--line); padding: 18px 0 26px; margin: 0; }
.approval-amount { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.approval .btn-row { margin-top: 14px; }
.approval form { margin-top: 12px; display: grid; gap: 10px; }
.approval-line { margin: 0 0 20px; font-weight: 600; }
.approval-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 14px; }
.approval-row q { color: var(--ink); }

@media (min-width: 1024px) {
  body.desk main.wrap > .kpis { grid-template-columns: repeat(4, 1fr); max-width: 1180px; }
  body.desk .kpi:nth-child(3) { border-left: 1px solid var(--line); padding-left: 18px; border-top: 0; }
  body.desk .kpi:nth-child(4) { border-top: 0; }
  body.desk .kpi-figure { font-size: 32px; }
  body.desk .overview-cols { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); }
  .pane-detail .stats, body.desk .stats { grid-template-columns: repeat(5, 1fr); }
  .stat + .stat { padding-left: 16px; }
}

/* ---------- settings ---------- */
.me-head { display: flex; align-items: center; gap: 16px; }
.me-head h1 { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--ink2); background: var(--neutral-bg); }
.settings-group { display: grid; gap: 14px; padding: 28px 0; border-top: 1px solid var(--line); }
.settings-group:first-of-type { margin-top: 8px; }
.sg-intro h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
.sg-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.sg-body > .field:last-of-type { margin-bottom: 16px; }
.sg-body .btn-row { justify-content: flex-start; }
.sg-body .btn-row .btn { flex: none; min-width: 150px; }
.sg-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.sg-row:first-child { border-top: 0; padding-top: 0; }
.sg-row-text { display: grid; gap: 2px; }
.sg-row-text strong { font-weight: 600; }
.sg-row-text span { color: var(--muted); font-size: 14px; }
.sg-links { list-style: none; margin: 0; padding: 0; }
.sg-links .row { padding: 13px 0; }
.sg-links .row-title { font-weight: 500; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--control)); }
.btn-danger:hover { background: var(--danger-bg); }
.email-confirm[hidden] { display: none; }
@media (min-width: 1024px) {
  body.desk .settings-group { grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 40px; }
}
@media (min-width: 1024px) {
  body.desk main.wrap > .settings-group, body.desk main.wrap > .page-head.settings { max-width: 980px; }
}

/* ---------- library ---------- */
.library-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.library-bar .search { flex: 1; min-width: 220px; margin: 0; }
.library-bar .tabs { border-bottom: 0; margin: 0; }
/* Chips wrap onto more lines: a row that scrolls sideways hides what's past the edge. */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 4px; }
/* A long row (color suggestions): one line that scrolls, with a thin, quiet scrollbar so it's clear there's more. */
.tag-row.scroll-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--control) transparent; }
.tag-row.scroll-row::-webkit-scrollbar { height: 6px; }
.tag-row.scroll-row::-webkit-scrollbar-thumb { background: var(--control); border-radius: 3px; }
.tag-row.scroll-row::-webkit-scrollbar-track { background: transparent; }
.tag-chip { flex: none; font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); color: var(--ink2); cursor: pointer; }
.tag-chip[aria-pressed="true"] { color: var(--accent-fg); background: var(--accent-bg); border-color: var(--accent); }
.tag-chip:hover { color: var(--ink); }
.model-grid { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; }
.model-card { display: grid; gap: 8px; text-decoration: none; }
.model-cover { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--sunken); border: 1px solid var(--border); }
.model-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease); }
.model-card:hover .model-cover img { transform: scale(1.03); }
.badge-3d { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 3px 8px; border-radius: 4px; background: rgba(20, 24, 31, .72); color: #fff; }
.badge-3d.unlisted { left: auto; right: 10px; }
.model-title { font-weight: 600; line-height: 1.3; }
.model-meta { display: flex; gap: 10px; font-size: 14px; color: var(--muted); }
.model-meta strong { color: var(--ink); font-weight: 600; }
.library-link { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; }
.library-link::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ring-deep); border-top: 2px solid var(--ring-deep); transform: rotate(45deg); margin-right: 4px; }
.model-page { display: grid; gap: 28px; margin-top: 10px; }
.stage { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: radial-gradient(ellipse at 50% 35%, var(--stage-hi), var(--sunken)); }
.stage img { width: 100%; height: 100%; object-fit: cover; }
.stage-3d { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.stage-3d:active { cursor: grabbing; }
.stage-empty { display: grid; place-items: center; height: 100%; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumb-btn { flex: none; width: 64px; height: 64px; padding: 0; border-radius: 6px; overflow: hidden; border: 2px solid transparent; background: var(--sunken); cursor: pointer; color: var(--ink); font: inherit; font-weight: 600; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn[aria-pressed="true"] { border-color: var(--accent); }
.model-info h1 { font-size: 30px; }
.tag-link { color: var(--muted); text-decoration: none; margin-right: 6px; }
.tag-link:hover { color: var(--ink); }
.model-price { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 14px 0 20px; font-variant-numeric: tabular-nums; }
.model-price small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.color-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.color-chip small { color: var(--muted); font-size: 12px; }
.color-chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-fg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--control); border-radius: var(--r-ctl); overflow: hidden; background: var(--surface); }
.stepper button { width: 46px; height: 44px; font: inherit; font-size: 20px; background: none; border: 0; color: var(--ink); cursor: pointer; }
.stepper button:hover { background: var(--subtle); }
.stepper output { min-width: 44px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.model-desc { color: var(--ink); line-height: 1.6; }
.edit-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.edit-file { position: relative; margin: 0; display: grid; gap: 6px; }
.edit-file img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.edit-file.three { min-height: 150px; border-radius: 6px; background: var(--sunken); padding: 40px 10px 10px; }
.edit-file figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; overflow-wrap: anywhere; }
@media (min-width: 700px) { .model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  body.desk main.wrap > .library-bar, body.desk main.wrap > .tag-row, body.desk main.wrap > .model-grid, body.desk main.wrap > .model-page { max-width: 1180px; }
  .model-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 28px 22px; }
  .model-page { grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr); gap: 48px; align-items: start; }
  .model-info { position: sticky; top: 24px; }
}
@media (min-width: 900px) { body:not(.desk) .model-page { grid-template-columns: 1fr 1fr; } }


/* ---------- theme switch (Light / Dark / Auto; saved on this device) ---------- */
.theme-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--control); border-radius: var(--r-ctl); overflow: hidden; background: var(--surface); }
.theme-switch button { font: inherit; font-size: 13px; min-height: 32px; border: 0; background: transparent; color: var(--ink2); cursor: pointer; }
.theme-switch button + button { border-left: 1px solid var(--control); }
.theme-switch button[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-fg); font-weight: 600; }
.side-theme { padding: 0 10px; display: grid; gap: 6px; }
.side-theme .label { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0; }
.sg-body .theme-switch { max-width: 320px; }
.sg-body .theme-switch button { min-height: 40px; font-size: 14px; }
@media (min-width: 1024px) {
  body.desk .toast { left: 256px; transform: translate(0, 12px); }
  body.desk .toast.on { transform: translate(0, 0); }
}
.callout { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); }
.callout > div { flex: 1; display: grid; gap: 2px; }
.callout span { font-size: 14px; }
.callout .btn { flex: none; }
.callout.processing { background: var(--processing-bg); color: var(--processing); }
.mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--on-accent); flex: none; }
.brand { font-weight: 600; letter-spacing: 0; }
/* The side panel only opens once something is picked; until then the list has the room. */
@media (min-width: 1024px) {
  .split:not(.open) { grid-template-columns: minmax(0, 1fr); }
  .split:not(.open) > .pane-detail, .split:not(.open) > .pane-resize { display: none; }
  .split:not(.open) > .pane-list { border-right: 0; }
  .split:not(.open) > .pane-list > * { max-width: 980px; margin-left: auto; margin-right: auto; }
}

/* ---------- maintenance ---------- */
.maint .row { align-items: flex-start; }
.maint-actions { display: flex; gap: 8px; flex: none; }
.maint-form { padding: 4px 0 18px; }
.meter { display: block; height: 4px; max-width: 320px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--muted); }
.meter-fill.m-soon { background: var(--processing); }
.meter-fill.m-due { background: var(--danger); }
.st.st-late { color: var(--danger); background: var(--danger-bg); }
.st.st-late::before { background: currentColor; border-radius: 2px; }
@media (max-width: 600px) { .maint .row { flex-direction: column; } }
.chips .tag-chip { white-space: normal; text-align: left; max-width: 100%; }

/* ---------- shopping list ---------- */
.shop-row { align-items: center; }
.shop-row .row-title { text-decoration: none; }
.shop-qty input { width: 84px; min-height: 36px; padding: 6px 8px; text-align: right; font-size: 15px; }
.shop-cost { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.shop-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.shop-group .section-head .text-btn { margin-left: 10px; min-height: 0; font-size: 13px; }
@media (max-width: 700px) {
  .shop-row { flex-wrap: wrap; }
  .shop-row .row-main { flex-basis: 100%; }
  .shop-actions { margin-left: auto; }
}

/* ---------- queue board and capacity ---------- */
.dim { color: var(--dim); }
.view-switch { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--control); border-radius: var(--r-ctl); overflow: hidden; background: var(--surface); }
.view-switch a { display: grid; place-items: center; min-height: 34px; padding: 0 14px; font-size: 14px; color: var(--ink2); text-decoration: none; }
.view-switch a + a { border-left: 1px solid var(--control); }
.view-switch a[aria-current] { background: var(--accent-bg); color: var(--accent-fg); font-weight: 600; }
.req-meta.capacity { margin: -4px 0 10px; font-size: 13px; }
.board-head .text-btn { font-size: 14px; min-height: 0; margin-left: 6px; }
.plate-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-bg); color: var(--accent-fg); font-weight: 600; }
.plate-bar .btn { margin-left: auto; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
body.desk main.wrap > .board { max-width: 1400px; }
.board-col { background: var(--subtle); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 240px; transition: border-color .12s var(--ease), background-color .12s var(--ease); }
.board-col.over { border-color: var(--accent); background: var(--accent-bg); }
.board-col-head { display: flex; align-items: baseline; gap: 6px; margin: 2px 4px 10px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 40px; }
.board-empty { margin: 4px; color: var(--dim); font-size: 14px; }
.card-item { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: grab; }
.card-item:hover { border-color: var(--control); }
.card-item.dragging { opacity: .45; }
.card-item.is-late { box-shadow: inset 3px 0 0 var(--danger); }
.card-item .thumb, .card-item .row-thumb { width: 44px; height: 44px; flex: none; }
.card-link { flex: 1; min-width: 0; display: grid; gap: 6px; color: inherit; text-decoration: none; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-hours { font-size: 12px; font-weight: 600; color: var(--muted); }
.card-title { font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-item .row-meta { font-size: 13px; column-gap: 10px; }
.pick { display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.drop-marker { height: 3px; border-radius: 2px; background: var(--accent); list-style: none; }
.plain-set { border: 0; margin: 0 0 14px; padding: 0; }
.tag-row a.tag-chip { text-decoration: none; }
.side-stack { position: static !important; }
.side-stack > .section:first-child { margin-top: 0; }
#business textarea { min-height: 72px; }

/* Two-step sign-in (Account) */
.tfa-setup { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.tfa-setup > div { flex: 1 1 260px; }
.tfa-setup p { margin: 0 0 12px; }
.tfa-qr { width: 180px; height: 180px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; flex: none; }
.tfa-key, .codes code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; letter-spacing: .04em; }
.tfa-key { user-select: all; background: var(--subtle); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.tfa-codes > p { margin: 0 0 12px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin: 0 0 16px; padding: 12px 16px 12px 36px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.codes code { user-select: all; }

/* Activity (admin) */
.filters { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 16px 0 4px; }
.filters .tabs { flex: 1 1 auto; margin-bottom: 0; gap: 20px; }
.filters select { min-width: 160px; }
.log .day-head { padding: 18px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 0; }
.log .log-row { display: flex; gap: 16px; align-items: baseline; padding: 12px 0; }
.log-time { flex: none; width: 72px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.log-row .row-meta a { color: var(--accent); }
@media (max-width: 600px) {
  .codes { grid-template-columns: 1fr; }
  .log .log-row { flex-direction: column; gap: 2px; }
  .log-time { width: auto; }
}

/* Computers: every page's column sits in the middle of the space beside the sidebar. The column is as
   wide as the page's widest part, so its headings and sections keep one left edge. */
@media (min-width: 1024px) {
  body.desk main.wrap { --page-w: 760px; padding-left: max(48px, calc((100% - 232px - var(--page-w)) / 2)); padding-right: max(48px, calc((100% - 232px - var(--page-w)) / 2)); }
  /* app.js sets these classes from what the page holds (Safari doesn't recheck :has() as a page fills in). */
  body.desk main.wrap.w-980 { --page-w: 980px; }
  body.desk main.wrap.w-1180 { --page-w: 1180px; }
  body.desk main.wrap.w-1400 { --page-w: 1400px; }
  body.desk main.wrap.w-split { padding-left: 48px; padding-right: 48px; }

}

/* Layout fixes (audit, 2026-09-29) */
.desk-only { display: none; }
@media (min-width: 1024px) {
  body.desk .desk-only { display: inline-flex; }
  body.desk .phone-only { display: none; }
}
.page-head .btn, .page-head .view-switch button { white-space: nowrap; flex: none; }
@media (min-width: 1024px) { .filters select { width: auto; flex: 0 0 220px; min-width: 0; } }
/* Phones: the first box in a row of controls gets its own line, instead of shrinking until it's unreadable. */
@media (max-width: 600px) {
  .btn-row > :is(input, select):first-child { flex: 1 1 100%; }
  .sg-body .grid2 { grid-template-columns: minmax(0, 1fr); }
  .page-head:has(> div > p) { flex-wrap: wrap; }
  .page-head > div:has(> p) { flex: 1 1 100%; }
}
/* Phones: the twelve-month chart keeps a readable size and scrolls sideways. */
.chart-scroll { overflow-x: auto; scrollbar-width: thin; }
@media (max-width: 600px) { .chart-scroll .chart { min-width: 560px; } }
/* Phones: the payment settings under the list need space above them. */
@media (max-width: 1023px) { .side-stack { margin-top: 36px; } }
.est-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.est-head .eyebrow { margin: 0; }
.file-btn { cursor: pointer; }
.plate-pick { flex-wrap: wrap; margin-bottom: 8px; }
.callout.late-callout { background: var(--danger-bg); color: var(--danger); }
.fail-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.remind-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.remind-row .hint { margin: 0; }
.top-gap-sm { margin-top: 14px; }
.warn-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 15px; }

/* Short windows: a tighter sidebar so everything fits before it has to scroll. */
@media (min-width: 1024px) and (max-height: 860px) {
  .side { padding-top: 12px; padding-bottom: 10px; }
  .side .brand { margin-bottom: 8px; }
  .side-group { margin: 10px 10px 2px; }
  .side-link { min-height: 30px; padding: 4px 10px; }
  .side-foot { gap: 6px; }
  .side-printer { padding: 6px 10px; }
  .side-theme .label { display: none; }
}
/* The list beside an open item is narrow: its filter tabs sit closer and scroll if they still don't fit. */
@media (min-width: 1024px) {
  .pane-list .tabs { gap: 16px; overflow-x: auto; scrollbar-width: none; }
  .pane-list .tabs button { flex: none; white-space: nowrap; }
}
.warn-box { width: 100%; }

/* Roles */
.perm-list { border: 0; padding: 0; margin: 8px 0 14px; display: grid; gap: 8px; }
.perm-list legend { margin-bottom: 6px; }
.check.perm { align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); }
.check.perm span { display: grid; gap: 2px; }
.check.perm small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.check.perm input:disabled + span { opacity: .55; }
.role-body { padding: 4px 0 20px; }
details.role > summary { list-style: none; cursor: pointer; }
details.role > summary::-webkit-details-marker { display: none; }
@media (min-width: 900px) { .perm-list { grid-template-columns: 1fr 1fr; } }

/* A resized detail column responds to its own width, independently of the desktop viewport. */
@container (max-width: 480px) {
  .pane-list .tabs { position: static; }
  .pane-detail .grid2 { grid-template-columns: minmax(0, 1fr); }
  .pane-detail .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pane-detail .btn-row > :is(input, select):first-child { flex: 1 1 100%; }
  .pane-detail .callout { align-items: flex-start; flex-wrap: wrap; }
}

/* Filament: colors with their spool counts */
.color-chips { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 14px; color: var(--ink2); }
.color-count { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.color-count b { font-weight: 600; color: var(--ink); }
.color-count small { color: var(--muted); font-size: 12px; }
.color-count.low b { color: var(--late); }
.color-list > li { padding: 14px 0; border-bottom: 1px solid var(--line); list-style: none; }
.color-list > li.archived { opacity: .7; }
.color-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.color-head strong { font-weight: 600; }
.spool-list { margin: 8px 0 0 24px; padding: 0; list-style: none; font-size: 15px; }
.spool-list li { margin: 4px 0; }
.color-actions { margin-top: 10px; align-items: center; }
.color-actions .btn-small { flex: none; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input[type=number] { width: 72px; min-height: 36px; padding: 0 8px; }
.inline-form .form-error { margin: 0; }
.edit-color { margin-top: 8px; }
.edit-color form { margin-top: 12px; }
.color-pick-rows { display: grid; gap: 8px; margin-top: 10px; }
.color-pick-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 80px auto; gap: 8px; align-items: center; }
.color-pick-row input[type=color] { width: 44px; height: 40px; padding: 2px; }
.add-color > summary { list-style: none; display: inline-flex; }
.add-color > summary::-webkit-details-marker { display: none; }
.add-color form { margin-top: 12px; }

.update-log { max-height: 240px; overflow: auto; padding: 12px; background: var(--sunken); border-radius: var(--r-ctl); font-size: 13px; white-space: pre-wrap; }
.discount { margin-top: 14px; }
.discount .label { font-weight: 600; }
.discount-now { margin: 6px 0 0; }
.discount .btn-row input { max-width: 200px; }
.invoice-box { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--subtle); }
.invoice-box p { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.invoice-box .btn-row { align-items: center; }
.invoice-box .btn-small, .invoice-box .text-btn { flex: none; }
.invoice-line .stock-qty .text-btn { margin-top: 4px; }

/* ---------- Ledger: the queue as a table; details open in a drawer over the list ---------- */
.qtable-wrap { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: auto; }
.qtable { width: 100%; border-collapse: collapse; }
.qtable th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; background: var(--subtle); border-bottom: 1px solid var(--line); white-space: nowrap; }
.qtable td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.qtable tr:last-child td { border-bottom: 0; }
.qrow { cursor: pointer; }
.qrow:hover td { background: var(--subtle); }
.qrow[aria-current] td { background: var(--accent-bg); }
.qrow[aria-current] td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.qtable .c-pos { width: 44px; color: var(--muted); font-weight: 600; }
.qtable .c-num { text-align: right; white-space: nowrap; }
.qtable .c-due { white-space: nowrap; }
.qtable td.c-next { color: var(--ink2); font-size: 14px; }
.qtable .req { display: flex; align-items: center; gap: 12px; }
.qtable .row-thumb { width: 40px; height: 40px; flex: none; }
.qtable .row-thumb.empty { display: block; border-radius: 6px; background: var(--sunken); }
.qtable .req-text { display: flex; flex-direction: column; min-width: 0; }
.qtable .req-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.qtable .req-title:hover { text-decoration: underline; }
.qtable .req-sub { color: var(--muted); font-size: 13px; }
@media (min-width: 1024px) {
  .split:has(> #pdetail) > .pane-list > * { max-width: 1320px; margin-left: auto; margin-right: auto; }
  .split.open { grid-template-columns: minmax(0, 1fr); }
  .split.open > .pane-list > * { margin-left: auto; margin-right: auto; }
  .split.open > .pane-detail { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(var(--detail-width, 680px), calc(100vw - 352px)); border-left: 1px solid var(--border); box-shadow: -12px 0 32px rgba(20, 24, 31, .10); }
  .split.open > .pane-resize { position: fixed; top: 0; bottom: 0; z-index: 31; width: 10px; right: calc(min(var(--detail-width, 680px), calc(100vw - 352px)) - 5px); background: transparent; border: 0; }
  .split.open > .pane-resize::after { left: 3px; opacity: .6; }
  .pane-detail > * { max-width: none; }
}

/* Ledger drawer: a sticky header (step, pin, full width, close), sections to jump to, actions at the bottom. */
.pane-detail.decorated { padding-top: 0; padding-bottom: 0; }
.pane-detail.decorated > .pane-tools { display: none; }
.drawer-head { position: sticky; top: 0; z-index: 4; background: var(--surface); margin: 0 calc(-1 * clamp(20px, 2vw, 40px)) !important; max-width: none !important; padding: 10px clamp(20px, 2vw, 40px) 0; border-bottom: 1px solid var(--line); }
.dh-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dh-step, .dh-tools { display: flex; align-items: center; gap: 4px; }
.dh-pos { color: var(--muted); font-size: 13px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.drawer-head .icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--ink2); cursor: pointer; }
.drawer-head .icon-btn:hover:not(:disabled) { background: var(--subtle); color: var(--ink); }
.drawer-head .icon-btn:disabled { color: var(--control); cursor: default; }
.drawer-head .icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-drawer][aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-fg); }
.dh-title { font-size: 22px; line-height: 1.25; margin: 8px 0 6px; overflow-wrap: anywhere; }
.dh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.dh-jump { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
.dh-jump a { padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.dh-jump a:hover { color: var(--ink); }
.dh-jump a[aria-current] { color: var(--accent-fg); border-bottom-color: var(--accent); }
.pane-detail.decorated > .section, .pane-detail.decorated > .callout, .pane-detail.decorated > form { scroll-margin-top: 140px; }
.pane-detail.decorated > :nth-child(3) { margin-top: 18px; }
.drawer-actions { position: sticky; bottom: 0; z-index: 4; margin: 24px calc(-1 * clamp(20px, 2vw, 40px)) 0 !important; max-width: none !important; padding: 12px clamp(20px, 2vw, 40px); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border-top: 1px solid var(--line); }
.drawer-actions .seg { margin: 0; }
.pane-detail.decorated > .danger-zone { margin-bottom: 24px; }
@media (min-width: 1024px) {
  .split.open.pinned { grid-template-columns: minmax(320px, 1fr) 12px minmax(360px, var(--detail-width, 58%)); }
  .split.open.pinned > .pane-detail, .split.open.pinned > .pane-resize { position: static; width: auto; box-shadow: none; }
  .split.open.pinned > .pane-resize { border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--surface); }
  .split.open.wide > .pane-detail { width: calc(100vw - 232px); box-shadow: none; }
  .split.open.wide > .pane-resize { display: none; }
  .split.open.wide > .pane-detail > :not(.drawer-head):not(.drawer-actions):not(.pane-tools) { width: 100%; max-width: 900px; margin-left: auto !important; margin-right: auto !important; }
  /* A pinned, narrower list drops the columns it has least room for. */
  @container (max-width: 820px) { .qtable .c-next, .qtable .c-due { display: none; } }
  @container (max-width: 520px) { .qtable .c-num { display: none; } }
}

/* Ledger drawer, refined: compact controls, one divider per section, what was asked for first. */
.pane-detail.decorated { font-size: 15px; }
.drawer-head { padding-top: 8px; }
.dh-bar { min-height: 40px; }
.dh-step .icon-btn:first-child { margin-left: -8px; }
.dh-tools .icon-btn[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-fg); }
.dh-title { font-size: 20px; font-weight: 600; margin: 4px 0 6px; }
.dh-meta { font-size: 13px; margin-bottom: 8px; }
.dh-jump { gap: 22px; margin-top: 2px; }
.dh-jump a { font-size: 13px; padding: 6px 0 9px; }
.pane-detail.decorated > :is(.section, .callout, form, label.field) { margin: 0 !important; padding: 20px 0; border-top: 1px solid var(--line); border-radius: 0; }
.pane-detail.decorated > .drawer-head + :is(.section, .callout, form, label.field),
.pane-detail.decorated > .pane-tools + .back + :is(.section, .callout, form, label.field) { border-top: 0; }
.pane-detail.decorated > .callout { margin: 16px 0 4px !important; padding: 12px 14px; border: 0; border-radius: var(--radius); }
.pane-detail.decorated .eyebrow { margin-bottom: 10px; }
.pane-detail.decorated .req-desc { margin: 0 0 14px; }
.pane-detail.decorated .gallery { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin: 0 0 12px; }
/* Facts as a tidy two-column list. */
.pane-detail.decorated .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0 0 14px; }
.pane-detail.decorated .facts div { display: flex; flex-direction: column; justify-content: flex-start; gap: 1px; padding: 0; border: 0; }
.pane-detail.decorated .facts dt { font-size: 12px; }
.pane-detail.decorated .facts dd { text-align: left; font-weight: 500; }
/* Controls sized for a panel, not a page. */
.pane-detail.decorated :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) { min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: 15px; }
.pane-detail.decorated textarea { font-size: 15px; }
.pane-detail.decorated .btn { min-height: 36px; font-size: 14px; }
.pane-detail.decorated .btn-row { gap: 8px; }
.pane-detail.decorated .btn-row > .btn, .pane-detail.decorated .btn-row .btn-small { flex: 0 0 auto; }
.pane-detail.decorated .btn-row > :is(select, input) { flex: 1 1 200px; }
.pane-detail.decorated .label { font-size: 13px; font-weight: 500; color: var(--ink2); }
.pane-detail.decorated .grid2 { gap: 0 16px; }
.pane-detail.decorated .field { margin-bottom: 12px; }
.pane-detail.decorated .unit-input { position: relative; }
.pane-detail.decorated .unit-input input { padding-right: 44px; }
.pane-detail.decorated .unit-input .unit { position: absolute; right: 12px; min-width: 0; font-size: 14px; pointer-events: none; }
/* The line: where it is, and the moves, on one row. */
.d-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; }
.d-line .eyebrow { grid-column: 1 / -1; }
.d-line .line-pos { margin: 0; font-weight: 500; }
.d-line .btn-row { flex-wrap: nowrap; }
.drawer-actions { padding-top: 10px; padding-bottom: 10px; }
.drawer-actions .seg { display: inline-grid; grid-template-columns: repeat(4, auto); }
.drawer-actions .seg button { min-height: 36px; padding: 0 14px; font-size: 14px; }
.pane-detail.decorated .hint { font-size: 13px; line-height: 1.5; }
.pane-detail.decorated #estimate .facts { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pane-detail.decorated #estimate .btn-row + .facts, .pane-detail.decorated #estimate .field + .facts { margin-top: 16px; }
.pane-detail.decorated .picture { max-width: 260px; }
.drawer-actions { justify-content: flex-start; }

/* ---------- Money (money.js): quotes, invoices, credit notes, payments, receivables. Ledger look. ---------- */
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.p-draft { color: var(--ink2); background: var(--neutral-bg); }
.p-open { color: var(--printing-fg); background: var(--printing-bg); }
.p-part { color: var(--processing); background: var(--processing-bg); }
.p-ok { color: var(--ok); background: var(--ok-bg); }
.p-late { color: var(--danger); background: var(--danger-bg); }
.doc { max-width: 1320px; }
.crumb { color: var(--muted); font-size: 13px; margin: 18px 0 6px; }
.crumb a { color: var(--muted); }
.doc-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.doc-head h1 { font-size: 24px; margin: 0; }
.doc-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-actions .btn, .doc-actions summary.btn { min-height: 36px; flex: none; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.menu-item { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--r-ctl); color: var(--ink); cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--subtle); }
.menu-item.danger { color: var(--danger); }
.flow { display: flex; list-style: none; padding: 0; margin: 14px 0 18px; font-size: 12px; font-weight: 600; }
.flow li { padding: 5px 16px 5px 20px; background: var(--neutral-bg); color: var(--muted); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); margin-right: -4px; }
.flow li:first-child { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); padding-left: 12px; }
.flow li.done { background: var(--printing-bg); color: var(--printing-fg); }
.flow li.now { background: var(--accent); color: var(--on-accent); }
.flow li.now.warn { background: var(--danger); color: #fff; }
.doc-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.doc-main > .card, .doc-side > .card { padding: 0; margin: 0 0 16px; overflow: hidden; }
.dfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; padding: 8px 20px 14px; border-bottom: 1px solid var(--line); }
.df { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; min-height: 42px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.df > .lbl { font-size: 14px !important; font-weight: 400 !important; letter-spacing: 0 !important; text-transform: none !important; flex: none; }
.df > .v { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.df-edit { background: none; border: 0; padding: 2px 0; font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; }
.df-edit span[aria-hidden] { color: var(--muted); font-size: 12px; margin-left: 2px; }
.df-edit:hover { color: var(--accent); }
.df .lbl, .dtotals .lbl, .calc .lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.df .v { font-weight: 500; overflow-wrap: anywhere; }
.df .v.late, td.late, .late { color: var(--danger); }
.df :is(input, select) { min-height: 34px; padding: 4px 8px; font-size: 14px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--subtle); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtable td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tfoot td { font-weight: 600; background: var(--subtle); border-top: 1px solid var(--line); border-bottom: 0; }
.dtable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dtable .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.dtable .c-n { width: 32px; color: var(--muted); }
.dtable .c-chk { width: 36px; }
.dtable .dim { color: var(--dim); }
.drow { cursor: pointer; }
.drow:hover td { background: var(--subtle); }
.doc-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.doc-link:hover { text-decoration: underline; }
.items td { vertical-align: top; }
.items .text-btn { min-height: 0; font-size: 12px; }
.cell { width: 100%; min-height: 32px; padding: 4px 8px; font: inherit; font-size: 14px; border: 1px solid var(--control); border-radius: 5px; background: var(--surface); color: var(--ink); }
.cell.n { text-align: right; max-width: 96px; }
.cell:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.tax-chk { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.addrow td { border-bottom: 0; }
.addrow .text-btn { min-height: 32px; margin-right: 16px; text-decoration: none; font-weight: 500; font-size: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--subtle); color: var(--ink); }
.icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.calc-row td { background: var(--subtle); }
.calc { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.calc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.calc-grid .field { margin: 0; gap: 4px; }
.calc-wide { grid-column: span 2; }
.calc-grid :is(input, select) { min-height: 34px; padding: 4px 8px; font-size: 14px; }
.calc .unit-input { position: relative; display: block; }
.calc .unit-input input { padding-right: 38px; width: 100%; }
.calc .unit-input .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.calc-btns, .calc-parts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.calc-btns .btn, .calc-parts .btn { min-height: 32px; flex: none; }
.part-chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; }
.part-chip .text-btn { min-height: 0; font-size: 12px; }
.part-add { display: inline-flex; gap: 6px; align-items: center; }
.part-add .part-pick { max-width: 220px; }
.calc-out { display: flex; flex-direction: column; gap: 8px; }
.calc-cost { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calc-cost summary { display: flex; align-items: center; gap: 6px; padding: 10px 0; cursor: pointer; list-style: none; }
.calc-cost summary::-webkit-details-marker { display: none; }
.calc-cost summary::after { content: "▾"; color: var(--muted); font-size: 12px; order: 1; }
.calc-cost summary strong { order: 2; margin-left: auto; }
.calc-cost[open] summary::after { content: "▴"; }
.calc-cost dl { display: grid; grid-template-columns: 1fr auto; margin: 0 0 10px; font-size: 14px; }
.calc-cost dt { color: var(--muted); padding: 5px 0; border-top: 1px solid var(--line); }
.calc-cost dd { margin: 0; padding: 5px 0; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.price-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 520px; }
.price-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--surface); border: 1px solid var(--control, var(--line)); border-radius: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.price-tile span { font-size: 12px; color: var(--muted); }
.price-tile strong { font-variant-numeric: tabular-nums; }
.price-tile:hover { border-color: var(--accent); }
.price-tile.avg { border-color: var(--accent); }
.price-tile.avg span { color: var(--accent); }
.dtotals { display: grid; grid-template-columns: 1fr 280px; gap: 24px; padding: 16px 20px; border-top: 1px solid var(--line); }
.dtotals textarea { width: 100%; margin-top: 4px; font-size: 14px; }
.dtotals .pre, .pre { white-space: pre-wrap; margin: 4px 0 0; }
.dtotals dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-variant-numeric: tabular-nums; }
.dtotals dt { color: var(--muted); }
.dtotals dd { margin: 0; text-align: right; }
.dtotals .gt { font-weight: 600; font-size: 15px; color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }
.dtotals .out { font-weight: 600; color: var(--danger); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; }
.card-head h2 { font-size: 15px; margin: 0; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .btn { flex: none; min-height: 32px; }
.card-empty { padding: 0 20px 16px; margin: 0; }
.side-card { padding: 16px 18px !important; }
.side-card h2 { font-size: 14px; margin: 0 0 8px; }
.side-card p { margin: 6px 0; }
.side-card .btn { width: 100%; margin: 8px 0; }
.conn { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 0; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; font-size: 14px; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.conn:first-of-type { border-top: 0; }
.conn > span:last-child { color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
a.conn:hover, button.conn:hover { color: var(--accent); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 6px 0; font-size: 13px; }
.tl .d { width: 7px; height: 7px; border-radius: 50%; background: var(--control); margin-top: 6px; }
.tl .when { display: block; color: var(--muted); font-size: 12px; }
.pay-card h2 { font-size: 16px; }
.aging { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0; margin: 4px 0 16px; overflow: hidden; }
.aging-cell { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-left: 1px solid var(--line); }
.aging-cell:first-child { border-left: 0; }
.aging .lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.aging .big { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aging .big.late { color: var(--danger); }
.aging .sub { color: var(--muted); font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.filter { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px 0 10px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface); font-size: 13px; color: var(--muted); }
.filter select { width: auto; border: 0; min-height: 34px; padding: 0 6px; background: none; font-size: 13px; font-weight: 500; color: var(--ink); }
.filter.search-f { padding: 0; flex: 1 1 260px; max-width: 360px; }
.filter.search-f input { border: 0; min-height: 34px; width: 100%; font-size: 14px; background: none; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin: 0 0 10px; border-radius: var(--radius); background: var(--accent-bg); color: var(--accent-fg); font-size: 14px; font-weight: 500; }
.bulk-bar .btn { min-height: 32px; flex: none; }
.bulk-bar .text-btn { min-height: 0; margin-left: auto; font-size: 14px; }
.table-card { padding: 0 !important; overflow-x: auto; }
.quote-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 10px; }
.terms-list .row { align-items: center; }
.dlg { border: 0; border-radius: 10px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dlg.dlg-wide { width: min(720px, calc(100vw - 32px)); }
.dlg::backdrop { background: var(--scrim); }
.dlg-form { display: flex; flex-direction: column; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.dlg-head h2 { font-size: 18px; margin: 0; }
.dlg-body { padding: 14px 20px 4px; display: flex; flex-direction: column; gap: 12px; max-height: 65vh; overflow: auto; }
.dlg-body .field { margin: 0; }
.dlg-body .dtable { border: 1px solid var(--line); border-radius: 6px; }
.dlg .form-error { margin: 0 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.dlg-actions .btn { flex: none; min-width: 96px; }
.dlg-actions .btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
@media (max-width: 1100px) {
  .doc-cols { grid-template-columns: 1fr; }
  .dfields { grid-template-columns: minmax(0, 1fr); }
  .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .aging { grid-template-columns: 1fr 1fr; }
  .aging-cell:nth-child(odd) { border-left: 0; }
  .dtotals { grid-template-columns: 1fr; }
  .doc-actions { margin-left: 0; width: 100%; }
  .items, .items tbody, .items tr, .items td { font-size: 13px; }
  .card.table-card .dtable th, .card.table-card .dtable td { padding: 8px; }
}
.df .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
/* The document follows its own width (the customer's pages are narrower than the maker's). */
.doc { container-type: inline-size; }
@container (max-width: 1000px) {
  .doc-cols { grid-template-columns: minmax(0, 1fr); }
  .dfields { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 560px) {
  .items th:nth-child(5), .items td:nth-child(5), .items th:nth-child(6), .items td:nth-child(6) { display: none; }
  .dtotals { grid-template-columns: minmax(0, 1fr); }
  .doc-actions { margin-left: 0; width: 100%; }
  .flow li { padding: 5px 10px 5px 14px; }
}
.doc-main > .card:first-child { overflow-x: auto; }
.doc-main > .card:has(.qtip) { overflow: visible; }
.thread { list-style: none; margin: 0; padding: 0 20px 6px; display: flex; flex-direction: column; gap: 10px; }
.thread li { max-width: 85%; padding: 10px 12px; border-radius: 10px; background: var(--subtle); border: 1px solid var(--line); }
.thread li.mine { align-self: flex-end; background: var(--accent-bg); border-color: transparent; }
.thread .t-who { display: flex; gap: 8px; align-items: baseline; font-size: 13px; font-weight: 600; }
.thread .when { color: var(--muted); font-weight: 400; font-size: 12px; }
.thread .pre { margin: 4px 0 0; }
.thread-form { display: flex; flex-direction: column; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.thread-form textarea { width: 100%; font-size: 14px; min-height: 64px; height: 64px; }
.thread-form .btn { align-self: flex-end; flex: none; min-height: 34px; }
.tip-head { display: flex; align-items: center; gap: 8px; }
.card-head:has(.qtip) { position: relative; }
.qtip { position: static; font-weight: 400; }
.qtip > summary { list-style: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--control); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.qtip > summary::-webkit-details-marker { display: none; }
.qtip > summary:hover, .qtip[open] > summary { color: var(--accent-fg); border-color: var(--accent); background: var(--accent-bg); }
.qtip-pop { position: absolute; left: 20px; right: 20px; top: calc(100% - 4px); z-index: 20; max-width: 420px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13px; line-height: 1.5; color: var(--ink2); }

/* Search everything (⌘K) */
.palette { width: min(640px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.palette::backdrop { background: rgba(0,0,0,.25); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 16px; font-size: 16px; background: transparent; outline: none; box-shadow: none; }
.pal-list { list-style: none; margin: 0; padding: 6px 0; max-height: 60vh; overflow-y: auto; }
.pal-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 16px; cursor: pointer; }
.pal-row.on, .pal-row:hover { background: var(--accent-bg); }
.pal-kind { flex: none; font-size: 11px; color: var(--muted); background: var(--subtle); border-radius: 8px; padding: 1px 7px; }
.pal-title { flex: none; color: var(--ink); }
.pal-meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 10px 16px; color: var(--muted); }

/* Reports */
.rep-chart { padding: 18px 20px 12px; }
.rep-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; height: 140px; align-items: end; border-bottom: 1px solid var(--line); }
.rep-col { height: 100%; display: flex; align-items: flex-end; }
.rep-bar { display: block; width: 100%; background: var(--accent-bg); border-top: 3px solid var(--accent); border-radius: 3px 3px 0 0; min-height: 0; }
.rep-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; margin-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.rep-cols .card + .card { margin-top: 16px; }
.aging-cell .big.ok { color: var(--ok, inherit); }
tr.rep-month td { font-weight: 600; background: var(--subtle); }

.doc-status { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.doc-status.late { color: var(--danger); }
.doc-error { margin: 8px 0 0; }

.quiet-link { text-align: center; margin: -8px 0 24px; }

.color-fact { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 4px 0; }
.color-fact small { color: var(--muted); }
.color-fact.custom { display: block; color: var(--muted); }
