/*
 * ACME Printworks — order app layout. Built on the ACME Printworks design system:
 * acme-tokens.css (tokens + fonts) and acme-components.css (acme-btn, acme-badge,
 * acme-card, acme-field, acme-progress). Use semantic tokens only — no raw hex here.
 */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/24px var(--font-body); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
p { margin: 0 0 var(--space-4); }
hr { border: 0; border-top: 2px solid var(--line-soft); margin: var(--space-5) 0; }

/* Type: Righteous only at 28px and up (h1–h3); everything else Rethink Sans. */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0 0 var(--space-3); }
h1 { font-size: 48px; line-height: 52px; }
h2 { font-size: 28px; line-height: 32px; }
h3, .h4 { font-family: var(--font-body); font-size: 20px; line-height: 28px; font-weight: 800; }
small, .small { font-size: 14px; line-height: 20px; }
.mute { color: var(--text-muted); }
.label, .lbl { display: block; font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.mono, .num { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.danger-text { color: var(--danger-text); font-weight: 600; }
.marker { background: var(--highlight); color: var(--ink); padding: 0 4px; border-radius: 4px; }

/* Header (Ink band) */
.topbar { background: var(--bg); border-bottom: var(--border-bold) solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: var(--space-5); min-height: 76px; flex-wrap: wrap; padding-top: var(--space-3); padding-bottom: var(--space-3); }
.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--text); }
.brand img { height: 40px; width: auto; display: block; }
.brand .tag { font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--highlight); }
.nav { display: flex; gap: var(--space-1); flex-wrap: wrap; flex: 1; }
.nav a { color: var(--text); text-decoration: none; padding: var(--space-2) var(--space-3); font-weight: 600; font-size: 15px; border-radius: var(--radius-sm); }
.nav a:hover { color: var(--highlight); }
.nav a.on { color: var(--ink); background: var(--highlight); font-weight: 800; }
.who { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; }
.who a { color: var(--text); }
.who form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--text); cursor: pointer; font: 600 14px var(--font-body); text-decoration: underline; text-underline-offset: 4px; padding: 0; }
.linkbtn:hover { color: var(--highlight); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--space-5); }
main.wrap { padding-top: var(--space-6); padding-bottom: var(--space-8); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-muted); margin-top: var(--space-2); }
.page-head .label { color: var(--text-muted); margin-bottom: var(--space-2); }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* Cards & grids */
.acme-card { margin-bottom: var(--space-5); position: relative; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: var(--space-5); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-5); align-items: start; }
@media (max-width: 1000px) { .split, .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 36px; line-height: 40px; } }

/* Stat tiles */
.stat { background: var(--surface); border: var(--border-bold) solid var(--line); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); }
.stat .v { font-family: var(--font-display); font-size: 36px; line-height: 40px; margin-top: var(--space-2); font-variant-numeric: tabular-nums; }
.stat.featured { background: var(--highlight); color: var(--ink); box-shadow: var(--shadow-pop); }

/* Buttons: extra app variant for destructive actions (Issue fill + Ink text, per the brand rules) */
.acme-btn--danger { background: var(--danger); color: var(--ink); box-shadow: none; }
.acme-btn--danger:hover { background: var(--brick-light); filter: brightness(.95); }
.acme-btn--secondary, .acme-btn--ghost { box-shadow: none; }
.acme-btn--block { width: 100%; }
form.inline { display: inline; margin: 0; }

/* Forms — every native control gets the acme-input treatment */
.field { margin-bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.field > label { font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.help, .field .help { font-size: 14px; line-height: 20px; color: var(--text-muted); margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], select, textarea {
  min-height: 48px; padding: 0 14px; font: 400 16px/24px var(--font-body); color: var(--text); background: var(--surface);
  border: var(--border-thin) solid var(--line); border-radius: var(--radius-sm); width: 100%; }
textarea { padding: 12px 14px; min-height: 112px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--danger-text); border-width: 3px; }
input[type=color] { width: 48px; height: 48px; padding: 2px; border: var(--border-thin) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
input[type=file] { font: 400 15px var(--font-body); color: var(--text); }
input:disabled, select:disabled { opacity: .6; }
.row { display: grid; gap: var(--space-3) var(--space-4); grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.check { display: flex; align-items: center; gap: var(--space-2); font-size: 15px; font-weight: 600; margin-bottom: var(--space-2); text-transform: none; letter-spacing: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--action); }
.drop { border: var(--border-thin) dashed var(--line); border-radius: var(--radius-md); background: var(--bg-alt); padding: var(--space-5); text-align: center; }
.drop input { margin-top: var(--space-2); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; border-bottom: var(--border-thin) solid var(--line); padding: var(--space-2) var(--space-3); white-space: nowrap; }
.tbl td { padding: var(--space-3); border-bottom: 2px solid var(--line-soft); vertical-align: top; font-size: 15px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tfoot td { border-top: var(--border-thin) solid var(--line); border-bottom: 0; font-weight: 800; }
.tbl .r { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.rowlink { font-weight: 800; }
.totals td { padding: 6px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand td { border-top: var(--border-thin) solid var(--line); padding-top: var(--space-3); font-size: 20px; font-weight: 800; }

/* Badges */
.acme-badge.sm { padding: 2px 9px; font-size: 12px; border-width: 2px; }
.swatch { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

/* Flash & notices */
.flash { padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5); border: var(--border-bold) solid var(--line); border-radius: var(--radius-md); font-weight: 600; color: var(--ink); }
.flash.ok { background: var(--success); }
.flash.err { background: var(--danger); }
.notice { padding: var(--space-3) var(--space-4); background: var(--highlight); color: var(--ink); border: var(--border-thin) solid var(--line); border-radius: var(--radius-md); margin-bottom: var(--space-4); }
.notice a { color: var(--ink); }

/* Tabs */
.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.tabs a { padding: var(--space-2) var(--space-4); text-decoration: none; font-size: 14px; font-weight: 800; color: var(--text); border: var(--border-thin) solid var(--line); border-radius: var(--radius-pill); background: var(--surface); }
.tabs a.on { background: var(--highlight); color: var(--ink); }

/* Order lines */
.line { border: var(--border-thin) solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); margin-bottom: var(--space-3); background: var(--surface); }
.line-top { display: flex; justify-content: space-between; gap: var(--space-3); align-items: flex-start; flex-wrap: wrap; }
.line-title { font-weight: 800; font-size: 17px; }
.line-meta { font-size: 14px; color: var(--text-muted); margin-top: var(--space-2); display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.line-money { text-align: right; font-variant-numeric: tabular-nums; }
.line-money .big { font-size: 20px; font-weight: 800; }
details.bd summary { cursor: pointer; font-size: 14px; color: var(--text-muted); margin-top: var(--space-2); }
details.bd table td { padding: 2px 0; font-size: 14px; }
details.bd table td:last-child { text-align: right; }
.editor { background: var(--bg-alt); border: var(--border-thin) solid var(--line); border-radius: var(--radius-md); padding: var(--space-5); margin: var(--space-3) 0; }
.procfields { display: none; }
.procfields.on { display: block; }

/* Files */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.file { border: var(--border-thin) solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3); font-size: 14px; display: flex; flex-direction: column; gap: var(--space-2); }
.file .thumb { height: 120px; background: var(--bg-alt); border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--text-muted); font-weight: 800; font-size: 20px; text-decoration: none; }
.file .thumb img { max-width: 100%; max-height: 120px; }
.file .name { font-weight: 800; word-break: break-all; }
.plates { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Messages */
.msgs { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.msg { padding: var(--space-3) var(--space-4); border: var(--border-thin) solid var(--line); border-radius: var(--radius-md); background: var(--surface); max-width: 90%; }
.msg.mine { align-self: flex-end; background: var(--bg-alt); }
.msg.internal { background: var(--highlight); color: var(--ink); }
.msg .meta { font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-1); }
.msg.internal .meta { color: var(--ink); }
.msg .body { white-space: pre-wrap; }

/* Order progress (portal) */
.acme-progress { margin: var(--space-2) 0 var(--space-6); }

/* Queue board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-5); align-items: start; }
.col { background: var(--surface); border: var(--border-bold) solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.col-head { padding: var(--space-3) var(--space-4); display: flex; justify-content: space-between; align-items: baseline; border-bottom: var(--border-bold) solid var(--line); background: var(--surface); }
.col-head b { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 32px; }
.col-head span { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.col-body { padding: var(--space-3); }
.job { border: var(--border-thin) solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: var(--space-3); background: var(--surface); }
.job.printing { background: var(--bg-alt); border-width: var(--border-bold); }
.job .t { font-weight: 800; }
.job .m { font-size: 14px; color: var(--text-muted); margin: var(--space-1) 0 var(--space-3); }
.job .a { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.empty { color: var(--text-muted); font-size: 14px; padding: var(--space-3); text-align: center; }
.dispatch { font-size: 14px; font-weight: 600; margin: 0 0 var(--space-2); }

/* Live printer panel (dark theme section) */
.live { background: var(--surface); color: var(--text); padding: var(--space-4); border-bottom: var(--border-bold) solid var(--ink); }
.live-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.live .meter { height: 14px; border: 3px solid var(--line); border-radius: var(--radius-pill); background: var(--bg); margin: var(--space-3) 0 var(--space-2); overflow: hidden; }
.live .meter i { display: block; height: 100%; background: var(--action); }
.live-nums { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.live-actions { margin-top: var(--space-3); }
.live .cam { width: 100%; margin-top: var(--space-3); border: var(--border-thin) solid var(--line); border-radius: var(--radius-sm); display: block; }
.live .err { color: var(--danger-text); font-weight: 600; margin-top: var(--space-2); }

/* Generic meter (reports, machines) */
.bar { height: 12px; border: 2px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--action); }

/* Landing */
.auth { max-width: 460px; margin: var(--space-7) auto; }
.hero { position: relative; display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--space-7); align-items: center; padding: var(--space-6) 0 var(--space-7); }
.hero .text-display { margin: 0 0 var(--space-5); }
.hero .lead { font-size: 18px; line-height: 28px; max-width: 540px; }
.hero .service { font-size: 13px; line-height: 16px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--space-4); }
.hero-logo { width: 100%; max-width: 520px; height: auto; margin-bottom: var(--space-6); }
.hero-side { position: relative; padding-top: 128px; }
.hero-side .acme-card { position: relative; z-index: 1; }
.facets { position: absolute; right: 28px; top: 0; width: 180px; height: auto; pointer-events: none; z-index: 0; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding: var(--space-3) 0 var(--space-3) 56px; position: relative; border-bottom: 2px solid var(--line-soft); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: var(--space-3); width: 40px; height: 40px; display: grid; place-items: center; border: 3px solid var(--line); border-radius: var(--radius-pill); background: var(--highlight); color: var(--ink); font-weight: 800; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } .text-display { font-size: 48px; line-height: 52px; } .facets { display: none; } }

.footer { text-align: center; color: var(--text-muted); font-size: 14px; padding: var(--space-5) 0 var(--space-7); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); font-size: 15px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.hide { display: none !important; }
.right { text-align: right; }
.mb0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.copy { display: flex; gap: var(--space-2); }
.copy input { font-size: 13px; }

@media print {
  .topbar, .no-print, .footer { display: none !important; }
  body { background: #fff; }
}
