:root {
  --bg: #f4f5f7; --panel: #fff; --text: #1f2933; --muted: #6b7280; --border: #e3e6ea;
  --brand: #e11d48; --brand-dark: #be123c; --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --side: #111827; --side-text: #d1d5db; --radius: 8px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
small, .muted { color: var(--muted); }

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--side); color: var(--side-text); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { padding: 18px 16px; font-weight: 700; color: #fff; font-size: 16px; border-bottom: 1px solid #1f2937; }
.sidebar .logo span { color: var(--brand); }
.sidebar nav { padding: 8px 0; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--side-text); font-weight: 500; }
.sidebar nav a:hover { background: #1f2937; text-decoration: none; }
.sidebar nav a.active { background: #1f2937; color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar nav .sec { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; }
.sidebar .badge { margin-left: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .spacer { flex: 1; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.btn.menu-btn { display: none; }

/* components */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
a.card:hover { text-decoration: none; border-color: #cbd5e1; }
.grid { display: grid; gap: 16px; }
.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)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); padding: 7px 12px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.blue { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.green { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.lg { padding: 12px 18px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: #374151; white-space: nowrap; border: 1px solid transparent; margin: 1px 2px 1px 0; }
.pill i { font-style: normal; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #f3f4f6; border: 1px solid var(--border); font-size: 11px; margin: 1px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #fafafa; }
tr.click:hover td { background: #fafbff; cursor: pointer; }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-color: var(--brand); text-decoration: none; }
.alert { padding: 10px 12px; border-radius: 6px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; white-space: pre-line; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.progress { height: 8px; border-radius: 99px; background: #e5e7eb; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; margin: 6px 0; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* forms */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 4px; }
label.f > span .req { color: var(--bad); }
input, select, textarea { width: 100%; padding: 7px 9px; border: 1px solid #cfd4da; border-radius: 6px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-check { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 980px; }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal header h2 { margin: 0; flex: 1; }
.modal .body { padding: 18px; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; white-space: pre-line; }
.toast.err { background: #991b1b; }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kcol { background: #eceff3; border-radius: 8px; min-width: 250px; width: 250px; flex-shrink: 0; }
.kcol header { padding: 10px 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kcol header .dot { width: 10px; height: 10px; border-radius: 50%; }
.kcol header small { margin-left: auto; }
.kcol .items { padding: 0 8px 8px; min-height: 60px; }
.kcol.drag-over { outline: 2px dashed var(--accent); }
.kcard { background: #fff; border-radius: 6px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid transparent; }
.kcard .t { font-weight: 600; }
.kcard .m { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; gap: 6px; }

/* job sheet builder */
.task { border: 1px solid var(--border); border-radius: 8px; background: #fff; margin-bottom: 12px; overflow: hidden; }
.task > .th { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fafafa; border-bottom: 1px solid var(--border); }
.task > .th .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task > .tb { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 12px; }
.task.sub { margin: 0 12px 12px; border-style: dashed; }
.preview { width: 200px; height: 160px; border: 2px dashed #cbd5e1; border-radius: 8px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 12px; background: #f8fafc center/contain no-repeat; cursor: pointer; position: relative; padding: 8px; }
.preview.has { border-style: solid; color: transparent; }
.preview.drag { border-color: var(--accent); background-color: #eff6ff; }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.info-grid .wide { grid-column: span 2; }
.info-grid .full { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: #fff; }
.chip.Waiting { background: #f3f4f6; color: #6b7280; }
.chip.Queued, .chip.Ready { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.chip.InProgress { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.chip.superseded { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }
.chip.In\ Progress { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.chip.Completed { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.chip.Cancelled { background: #fef2f2; color: #b91c1c; text-decoration: line-through; }
.arrow { color: var(--muted); font-size: 11px; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); background: #f8fafc; }
.dropzone.drag { border-color: var(--accent); background: #eff6ff; color: var(--accent); }

/* production */
.station-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.station-tabs a { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-weight: 600; color: var(--text); }
.station-tabs a.active { background: var(--side); color: #fff; border-color: var(--side); text-decoration: none; }
.pcols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pcard { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; display: grid; grid-template-columns: 70px 1fr; gap: 10px; }
.pcard .thumb { width: 70px; height: 70px; border-radius: 6px; background: #f1f5f9 center/cover no-repeat; border: 1px solid var(--border); }
.pcard .t { font-weight: 600; }
.pcard .acts { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.pcard.due-soon { border-left: 4px solid var(--warn); }
.pcard.overdue { border-left: 4px solid var(--bad); }
.revised { background: #fef3c7; color: #92400e; font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 700; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); background: #fff; }
.cal .dh { padding: 6px; font-size: 12px; font-weight: 700; color: var(--muted); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fafafa; }
.cal .d { min-height: 110px; padding: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal .d.other { background: #fafafa; color: #9ca3af; }
.cal .d.today .n { background: var(--brand); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal .n { font-size: 12px; font-weight: 600; }
.ev { display: block; font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-top: 3px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.ev.done { opacity: .55; text-decoration: line-through; }

/* installer (mobile first) */
.inst { max-width: 560px; margin: 0 auto; }
.inst .job { display: block; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; color: var(--text); }
.inst .job:hover { text-decoration: none; border-color: var(--accent); }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* login */
.login { max-width: 760px; margin: 60px auto; padding: 0 16px; }
.login .users { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.login .u { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer; text-align: left; font: inherit; }
.login .u:hover { border-color: var(--brand); }

/* notifications */
.ndrop { position: absolute; right: 16px; top: 52px; width: 380px; max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 40; }
.ndrop .n { padding: 10px 12px; border-bottom: 1px solid var(--border); display: block; color: var(--text); }
.ndrop .n.unread { background: #eff6ff; }

/* job sheet document (A4) */
.a4-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; background: #e5e7eb; padding: 18px; border-radius: 8px; overflow-x: auto; }
.a4 { width: 210mm; height: 297mm; overflow: hidden; background: #fff; color: #000; padding: 6mm 7mm; box-shadow: 0 2px 10px rgba(0,0,0,.15); display: flex; flex-direction: column; font: 11px/1.35 Arial, Helvetica, sans-serif; flex-shrink: 0; }
.a4 .red { color: #d0021b; font-weight: 700; }
.js-checks { display: flex; justify-content: center; gap: 22px; font-size: 9px; margin-bottom: 4px; }
.js-checks span { display: inline-flex; align-items: center; gap: 4px; }
.js-checks i { width: 14px; height: 10px; border: 1px solid #000; border-radius: 3px; display: inline-block; position: relative; }
.js-checks i.on::after { content: "✓"; position: absolute; left: 2px; top: -5px; font-size: 13px; font-style: normal; font-weight: 700; color: #d0021b; }
.js-hdr { width: 100%; border-collapse: collapse; border: 1.5px solid #000; font-size: 12px; }
.js-hdr td { border: none; border-bottom: 1px solid #000; padding: 2px 6px; background: #fff; }
.js-hdr td.k { font-weight: 700; width: 70px; white-space: nowrap; }
.js-hdr td.v { font-weight: 700; }
.js-hdr tr.title td { height: 22px; vertical-align: top; }
.js-hdr .rem { font-weight: 400; font-size: 11px; margin-top: 2px; }
.js-hdr tr.red-row td { color: #d0021b; font-weight: 700; border-bottom: 2px solid #000; }
.js-tab { display: inline-block; background: #000; color: #fff; font-weight: 700; font-size: 10px; padding: 2px 18px 2px 10px; margin-top: 3px; clip-path: polygon(0 0, 92% 0, 100% 100%, 0 100%); align-self: flex-start; }
.js-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; border-top: 1px solid #000; margin-top: -1px; padding-top: 2px; }
.js-section { color: #d0021b; font-weight: 800; font-size: 20px; text-align: center; margin: 0 0 2px; }
.js-section small { font-size: 12px; }
.js-final { text-align: center; font-size: 11px; margin-bottom: 3px; }
.js-preview { flex: 1; min-height: 0; border-bottom: 1px solid #000; padding: 4px; display: flex; flex-direction: column; }
.js-preview .ptitle { color: #d0021b; font-weight: 800; font-size: 24px; align-self: flex-start; margin-left: 10%; }
.js-preview .img { flex: 1; min-height: 0; position: relative; }
.js-grid { flex: 1; min-height: 0; display: grid; gap: 0; }
.js-grid.n1 { grid-template-columns: 1fr; }
.js-grid.n2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.js-grid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.js-grid.n6 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.js-item { padding: 4px 6px; border-bottom: 1px solid #000; display: flex; flex-direction: column; min-height: 0; }
.js-grid.n4 .js-item:nth-child(odd), .js-grid.n6 .js-item:nth-child(odd) { border-right: 1px solid #000; }
.js-grid.n1 .js-item, .js-grid.n2 .js-item { display: grid; grid-template-columns: 38% 1fr; grid-template-rows: auto 1fr; gap: 0 8px; align-items: start; }
.js-grid.n1 .js-item .img, .js-grid.n2 .js-item .img { align-self: stretch; height: 100%; padding-top: 0; }
.js-grid.n1 .js-item .lbl, .js-grid.n2 .js-item .lbl { grid-column: 1 / -1; }
.js-item .lbl { color: #d0021b; font-weight: 700; font-size: 11px; word-break: break-word; margin-bottom: 1px; }
.js-item .kv { font-size: 10.5px; line-height: 1.25; }
.js-item .kv b { display: inline-block; width: 62px; }
.js-item .route { color: #555; font-weight: 400; }
.js-item .img { flex: 1; min-height: 0; position: relative; margin-top: 3px; }
.js-item { overflow: hidden; }
.js-item .img > .noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
/* Image fills its cell by default; width/height % set per image (resizable in the preview). */
/* --ar = image aspect ratio, --s = size %, --w = box width as % of the cell (set by fitImgBox). Only % units,
   so the printed page matches the on-screen preview exactly. The box hugs the image so the handle sits on its corner. */
.js-item .img, .js-preview .img { overflow: hidden; }
/* --x / --y = offset from the default spot (top centre), in % of the cell. */
.imgbox { position: absolute; left: calc(50% + var(--x, 0) * 1%); top: calc(var(--y, 0) * 1%); transform: translateX(-50%); aspect-ratio: var(--ar, 1); width: calc(var(--w, var(--s, 100)) * 1%); }
.imgbox img { width: 100%; height: 100%; object-fit: contain; display: block; }
#pages .imgbox:has(.rz):hover { outline: 1px dashed #3b82f6; }
#pages .imgbox:has(.rz) { cursor: move; touch-action: none; user-select: none; }
#pages .imgbox:has(.rz) img { pointer-events: none; }
#pages .imgbox.dragging { outline: 1px solid #3b82f6; z-index: 1; }
.imgbox .rz { position: absolute; right: 0; bottom: 0; background: #3b82f6; color: #fff; font: 600 9px/1 Arial, sans-serif; font-style: normal; padding: 3px 4px; border-radius: 3px; cursor: nwse-resize; opacity: .25; touch-action: none; user-select: none; }
.imgbox:hover .rz, .imgbox .rz:active { opacity: 1; }
.noimg { color: #9ca3af; font-size: 11px; font-style: italic; }
.js-foot { font-size: 9px; color: #555; text-align: right; margin-top: 4px; }
.modal .a4-wrap { max-height: 72vh; overflow: auto; }
.modal .a4 { transform-origin: top center; }
.print-sheet { background: #fff; padding: 24px; max-width: 1000px; margin: 0 auto; }
@page { size: A4; margin: 0; }
@media print {
  .sidebar, .topbar, .no-print, #toast-root { display: none !important; }
  body, .layout, .main, .content { background: #fff; padding: 0 !important; margin: 0 !important; display: block !important; min-height: 0 !important; }
  .a4-wrap { background: none; padding: 0; gap: 0; display: block; }
  .a4 { box-shadow: none; page-break-after: always; break-after: page; margin: 0; height: 296.5mm; }
  .a4:last-child { page-break-after: auto; break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; z-index: 30; transition: left .2s; }
  .sidebar.open { left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .g2, .g3, .g4, .pcols { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .task > .tb { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .ndrop { left: 8px; right: 8px; width: auto; }
}

/* ---------- workflow prototype additions ---------- */
.alert.warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert { margin-bottom: 8px; }
.unavail { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 260px; vertical-align: top; }
.unavail small { color: var(--muted); font-size: 11px; line-height: 1.3; white-space: normal; }
.rec { font-weight: 600; }
.help { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.bad { color: var(--bad); } .warn { color: var(--warn); }
.tag.warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.count { color: var(--muted); font-weight: 500; }
.card.attn { border-color: #fcd34d; box-shadow: 0 0 0 2px #fef3c7; }
tr.hl td { background: #fffbeb; }
tr.sel td { background: #eff6ff !important; }
.hl-legend { background: #fffbeb; border: 1px solid #fcd34d; padding: 0 4px; border-radius: 3px; }
.datebox { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fafafa; margin-bottom: 8px; }
.datebox small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.datebox b { font-size: 15px; }
.estbox .alert { margin: 6px 0 0; }
.tno { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
input.changed, select.changed, .preview.changed { border-color: #f59e0b !important; background-color: #fffbeb; }
.pcard.frozen { border-left: 4px solid #b45309; background: #fffbeb; }
.freeze { font-weight: 700; color: #92400e; margin-bottom: 4px; }
table.diff td.to { font-weight: 600; color: #92400e; }
tr.affected td { background: #fffbeb; }
table.proc input { width: 70px; } table.proc input[data-k=overrideRemarks] { width: 160px; margin-top: 4px; }
table.proc select[multiple] { min-width: 170px; }
.kcard.lost { opacity: .7; }
.kcol.lostcol { background: #fdecec; }
.empty.sm { padding: 12px; font-size: 12px; }
.switch-wrap { display: flex; flex-direction: column; font-size: 11px; }
.switch { width: 190px; padding: 4px 6px; }
.who { text-align: right; line-height: 1.2; }
.side-foot { padding: 10px 16px; font-size: 11px; color: #6b7280; border-top: 1px solid #1f2937; }
.nrow { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.nrow.unread { background: #eff6ff; }
.nrow span { color: var(--accent); width: 10px; }
.checks.big { gap: 8px 18px; }
.stack .inline-check { align-items: flex-start; margin-bottom: 6px; }
.visit { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.notes h2 { margin-top: 18px; } .notes h3 { margin-top: 14px; text-transform: none; letter-spacing: 0; color: var(--text); font-size: 15px; }
.notes p, .notes li { max-width: 900px; } .notes code { background: #f3f4f6; padding: 0 4px; border-radius: 3px; }
.notes table td, .notes table th { font-size: 13px; }
.notes pre { background: #f8fafc; padding: 10px; border-radius: 6px; overflow: auto; }
/* mobile Installer interface */
.mobile { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.mobile .content { padding: 12px; }
.mtop { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 10; }
.mtop small { color: #9ca3af; } .mtop .switch { width: 160px; }
.daytabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.daytabs a { position: relative; text-align: center; padding: 10px 4px; border-radius: 10px; background: #fff; border: 1px solid var(--border); color: var(--text); font-weight: 700; }
.daytabs a small { font-weight: 400; color: var(--muted); }
.daytabs a.active { background: var(--side); color: #fff; border-color: var(--side); text-decoration: none; }
.daytabs a.active small { color: #d1d5db; }
.daytabs .badge { position: absolute; top: -6px; right: -4px; }
.inst .job .jt { font-weight: 700; font-size: 16px; margin-top: 6px; }
.visit .photos, .card > .photos { max-width: 420px; }
.rec { white-space: nowrap; }

/* ---------- V3 additions ---------- */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.metrics > div { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; }
.metrics small { color: var(--muted); font-size: 11px; }
.metrics b { font-size: 15px; }
.demo-tag { display: inline-block; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.urgentbox { border-color: #fda4af; background: #fff1f2; margin-top: 12px; }
.pcard.urgent { border-left: 4px solid #be123c; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.tray { border-color: #fda4af; }
.trayjob { padding: 8px 0; border-bottom: 1px solid var(--border); }
.gblock.trayitem { position: static; display: inline-block; margin: 4px 6px 0 0; cursor: grab; }
.proposal { border: 2px dashed #6b7280; margin-top: 12px; }
.gscroll { overflow-x: auto; }
.ggrid { position: relative; }
.gaxis, .glane { display: flex; border-bottom: 1px solid var(--border); }
.glabel { width: 130px; flex-shrink: 0; padding: 8px 10px; font-weight: 600; background: #fafafa; border-right: 1px solid var(--border); position: sticky; left: 0; z-index: 2; }
.gdays { position: relative; height: 34px; }
.gdays > div { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--border); font-size: 11px; padding: 8px 4px; color: var(--muted); }
.gtrack { position: relative; height: 46px; }
.gtrack.drop { background-color: #eff6ff; outline: 2px dashed var(--accent); }
.gblock { position: absolute; top: 8px; height: 30px; border-radius: 5px; background: #dbeafe; border: 1px solid #2563eb; color: #1e3a8a; font-size: 11px; font-weight: 600; padding: 7px 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.gblock[draggable=true] { cursor: grab; }
.gblock.urgent { background: repeating-linear-gradient(45deg, #ffe4e6 0 6px, #fecdd3 6px 12px); border-color: #be123c; color: #881337; }
.gblock.running { background: #ffedd5; border-color: #c2410c; color: #7c2d12; }
.gblock.ghost { background: transparent; border: 2px dashed #374151; color: #111827; z-index: 3; }
.gblock.frozenb { background: #fef3c7; border-color: #b45309; color: #78350f; }
.gblock.selj { box-shadow: 0 0 0 2px #111827; }
.grest { position: absolute; top: 14px; height: 18px; border-radius: 4px; background: repeating-linear-gradient(90deg, #ccfbf1 0 4px, #99f6e4 4px 8px); color: #115e59; font-size: 10px; padding: 2px 4px; overflow: hidden; }
.greq { position: absolute; top: 0; height: 100%; border-left: 2px solid #be123c; color: #be123c; font-size: 10px; font-weight: 700; padding: 2px 4px; white-space: nowrap; background: #fff1f2cc; }
.greqline { position: absolute; top: 0; bottom: 0; border-left: 2px solid #be123c; z-index: 1; }
.batch { border-color: #93c5fd; margin-bottom: 12px; }
.stages { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.stages span { border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-size: 11px; color: var(--muted); text-align: center; }
.stages span.on { background: #dbeafe; border-color: #2563eb; color: #1e3a8a; font-weight: 600; }
@media (max-width: 900px) { .metrics { grid-template-columns: 1fr; } }
