:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #16171a;
  --muted: #62656c;
  --line: #dddbd3;
  --accent: #f5c400;      /* number-plate yellow */
  --accent-ink: #16171a;
  --primary: #1f5f4a;
  --primary-ink: #ffffff;
  --warn: #9a4b00;
  --warn-bg: #fff3df;
  --err: #a12622;
  --err-bg: #fde9e7;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); padding-bottom: 96px; }
button, input { font: inherit; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 30px; height: 30px; border-radius: 6px; background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 5px var(--accent); }
.brand-title { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: #b9bbc0; }
.account { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who { font-size: 13px; color: #d6d7da; }
.topbar .btn-ghost { color: #fff; border-color: #44464c; background: transparent; }
.topbar .btn-ghost:hover { background: #26282c; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; line-height: 1.2; }
.btn:hover { background: #f0efe9; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: #184c3b; }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.btn-dark:hover { background: #2b2d31; }
.btn-icon { width: 38px; padding: 6px 0; font-size: 20px; }
.btn-ghost { background: transparent; }

.controls { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.date-row, .source-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input[type=date] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.date-label { font-weight: 600; margin-left: 6px; }
.file-btn { display: inline-flex; align-items: center; }
.status { font-size: 14px; color: var(--muted); min-height: 1.2em; }
.status.err { color: var(--err); background: var(--err-bg); padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; }
.status.warn { color: var(--warn); background: var(--warn-bg); padding: 8px 10px; border-radius: 8px; }

.notice { margin-top: 16px; background: var(--warn-bg); border: 1px solid #f0d3a6; border-radius: var(--radius); padding: 12px 16px; }
.notice h2 { margin: 0 0 4px; font-size: 16px; }
.notice p { margin: 0; }

.jobs-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; gap: 12px; flex-wrap: wrap; }
.jobs-head h2 { margin: 0; font-size: 18px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.jobs { display: grid; gap: 10px; }

.job { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.job.noparts { opacity: .65; }
.job-top { display: grid; grid-template-columns: auto auto 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; }
.job-top input[type=checkbox] { width: 20px; height: 20px; }
.plate { background: var(--accent); color: var(--accent-ink); font-weight: 800; letter-spacing: 1.5px;
  border: 2px solid var(--ink); border-radius: 5px; padding: 3px 10px; font-size: 18px; white-space: nowrap; min-width: 110px; text-align: center; }
.job-meta { min-width: 0; }
.job-meta .l1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta .l2 { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-right { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.job-right b { color: var(--ink); font-size: 15px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #ecebe5; color: var(--muted); margin-left: 6px; }
.pill.fin { background: #e3efe9; color: var(--primary); }
.job-lines { border-top: 1px solid var(--line); padding: 4px 14px 10px 52px; }
.job-lines table { width: 100%; border-collapse: collapse; font-size: 14px; }
.job-lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 6px 4px; }
.job-lines td { padding: 5px 6px; border-top: 1px solid #efeee8; vertical-align: top; }
.job-lines td.q { width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.job-lines td.pn { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; white-space: nowrap; }
.job-lines tr.off td { color: #aaa; text-decoration: line-through; }
.job-lines .none { color: var(--muted); padding: 8px 6px; font-size: 14px; }
.toggle-lines { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font-size: 13px; }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.actionbar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sel-summary { font-weight: 600; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.settings-form { padding: 18px 20px; display: grid; gap: 12px; }
.settings-form h2 { margin: 0; font-size: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; display: grid; gap: 8px; }
legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
fieldset label:not(.chk) { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
fieldset input:not([type=checkbox]) { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.diag { font-size: 11px; background: #f6f6f3; padding: 8px; border-radius: 6px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

#printFrame { position: fixed; width: 0; height: 0; border: 0; right: 0; bottom: 0; visibility: hidden; }

@media (max-width: 640px) {
  .job-top { grid-template-columns: auto 1fr; }
  .job-top .plate { grid-column: 2; justify-self: start; }
  .job-meta, .job-right { grid-column: 1 / -1; text-align: left; }
  .job-lines { padding-left: 14px; }
}
