:root {
  --blue: #0067c8;          /* Costain blue, matches the logo */
  --blue-dark: #0055a6;
  --blue-soft: #e8f1fb;
  --navy: #0b1f33;
  --bg: #eef1f5;
  --panel: #ffffff;
  --line: #e1e5ea;
  --text: #1b1f24;
  --muted: #6b7280;
  --pass: #2e8b57; --warn: #d98b00; --fail: #d0392e; --info: #6b7280;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 31, 51, .06), 0 4px 14px rgba(11, 31, 51, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font: 13px/1.5 "Segoe UI", Inter, system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }

/* ---------------------------------------------------------------- header */
#top { height: 52px; background: var(--blue); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 0; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
#top .logo { height: 52px; width: auto; display: block; }
#top .brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; }
#top .spacer { flex: 1; }
#top .user { opacity: .9; font-size: 12.5px; }
#top button, #top a.btn { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 6px 12px; cursor: pointer; text-decoration: none; transition: background .15s; }
#top button:hover, #top a.btn:hover { background: rgba(255,255,255,.22); }

/* ---------------------------------------------------------------- admin dialog + denied */
dialog#admin, dialog#cfg, dialog#vers, dialog#cmp { border: 0; border-radius: 12px; padding: 20px 22px; width: min(720px, 92vw); box-shadow: 0 20px 60px rgba(11,31,51,.25); }
dialog#admin::backdrop, dialog#cfg::backdrop, dialog#vers::backdrop, dialog#cmp::backdrop { background: rgba(11,31,51,.45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.dialog-head h3 { margin: 0; font-size: 16px; color: var(--navy); }
.muted { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.add-user { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; margin-bottom: 8px; }
table.users { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.users th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.users td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users tr.admin td { color: var(--muted); }
.denied { position: fixed; inset: 52px 0 0 0; background: var(--bg); display: grid; place-items: center; z-index: 5; }
.denied .card { max-width: 440px; text-align: center; padding: 28px; }
.denied h2 { justify-content: center; font-size: 16px; }

/* ---------------------------------------------------------------- layout */
#layout { display: grid; grid-template-columns: var(--leftw, 320px) 6px 1fr 420px; height: calc(100% - 52px); }
.pane { overflow: auto; display: flex; flex-direction: column; }
#files { background: var(--bg); padding: 14px; gap: 12px; border-right: 1px solid var(--line); }
#results { background: var(--panel); border-left: 1px solid var(--line); }

/* ---------------------------------------------------------------- left: cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.grow { flex: 1; min-height: 240px; }
.card h2 { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.card h2 .step { width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.card h2 .hint { margin-left: auto; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
input[type=text], select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; color: var(--text); transition: border-color .15s, box-shadow .15s; }
input[type=text]::placeholder { color: #9aa3ad; }
input[type=text]:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,200,.15); background: #fff; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
button.primary { background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; transition: background .15s, transform .05s; }
button.primary:hover { background: var(--blue-dark); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: .5; cursor: default; }
button.primary.wide { width: 100%; }
button.link { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; font-weight: 500; }
button.link:hover { text-decoration: underline; }

/* breadcrumbs + tree */
.crumbs { display: flex; flex-wrap: wrap; gap: 2px 4px; font-size: 12px; color: var(--muted); min-height: 18px; }
.crumbs button { color: var(--muted); font-weight: 500; }
.crumbs button:last-child { color: var(--navy); font-weight: 600; }
ul.tree { list-style: none; margin: 0; padding: 0; flex: 1; overflow: auto; border-top: 1px solid var(--line); }
ul.tree li { padding: 7px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 9px; align-items: center; transition: background .1s; }
ul.tree li:hover { background: var(--blue-soft); }
ul.tree li .ico { width: 16px; text-align: center; color: var(--muted); font-size: 12px; }
ul.tree li > span:not(.ico):not(.ext) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.tree li .ext { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: #eef1f5; color: var(--muted); }
ul.tree li .ext.rvt { background: #e6f0fb; color: #0b5cad; }
ul.tree li .ext.ifc { background: #e7f5ec; color: #1f6b3a; }
ul.tree li .ext.dwg { background: #fdf0e0; color: #8a4b00; }
ul.tree li.dim { opacity: .45; cursor: default; }
ul.tree li input[type=checkbox] { margin: 0; width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.batchbar { display: flex; gap: 10px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.batchbar span { flex: 1; color: var(--navy); font-weight: 600; }

/* status */
.status { font-size: 12px; color: var(--muted); padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pass); flex: none; }
.status.err { color: var(--fail); }
.status.err::before { background: var(--fail); }

/* ---------------------------------------------------------------- viewer */
#viewer { position: relative; background: #e4e8ee; }
#viewer .empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 40px; color: var(--muted); max-width: 440px; margin: 0 auto; gap: 4px; }
#viewer .empty .mark { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 16px; background: var(--blue); color: #fff; font-weight: 800; letter-spacing: 1px; display: grid; place-items: center; box-shadow: var(--shadow); }
#viewer .empty p { margin: 4px 0; }
#viewer .empty strong { color: var(--navy); font-size: 14px; }

/* ---------------------------------------------------------------- right: results */
#results h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0; padding: 12px 14px 6px; }
.model-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.model-head .name { font-weight: 600; word-break: break-all; color: var(--navy); }
.model-head .meta { color: var(--muted); font-size: 12px; }
.summary { display: flex; gap: 6px; padding: 8px 14px; flex-wrap: wrap; }
.legend { padding-top: 0; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.legend:empty { display: none; }
.chip { border-radius: 12px; padding: 2px 10px; font-size: 12px; color: #fff; font-weight: 600; }
.chip.PASS { background: var(--pass); } .chip.WARN { background: var(--warn); } .chip.FAIL { background: var(--fail); } .chip.INFO { background: var(--info); }
.group { padding: 8px 14px 2px; font-weight: 600; color: var(--navy); border-top: 1px solid var(--line); margin-top: 6px; }
.result { display: grid; grid-template-columns: 18px 1fr auto; gap: 4px 8px; padding: 6px 14px; align-items: start; }
.result .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.dot.PASS { background: var(--pass); } .dot.WARN { background: var(--warn); } .dot.FAIL { background: var(--fail); } .dot.INFO { background: var(--info); }
.result .name { font-weight: 500; }
.result .detail { grid-column: 2 / 4; color: var(--muted); font-size: 12px; word-break: break-word; }
.result button.link { font-size: 12px; white-space: nowrap; }
.actions { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); margin-top: auto; background: var(--panel); position: sticky; bottom: 0; }
#runs { border-bottom: 1px solid var(--line); }
.run { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 14px; border-top: 1px solid var(--line); align-items: center; cursor: pointer; }
.run:hover { background: var(--blue-soft); }
.run.active { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.run .name { font-weight: 500; word-break: break-all; }
.run .chips { display: flex; gap: 4px; }
.run .chips .chip { padding: 1px 7px; font-size: 11px; }
.run .sub { grid-column: 1 / 3; color: var(--muted); font-size: 12px; }
.run .sub.err { color: var(--fail); }

/* ---------------------------------------------------------------- landing page (/) */
body.landing { background: #0b1f33; color: #e6ebf1; min-height: 100%; display: flex; flex-direction: column; }
.landing-top { display: flex; align-items: center; gap: 18px; padding: 18px 32px; border-bottom: 1px solid rgba(255,255,255,.08); }
.landing-top .wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: .3px; color: #fff; }
.landing-top .wordmark img { height: 34px; width: auto; }
.landing-top .wordmark em { font-style: normal; color: #7fb7ff; }
.landing-title { color: rgba(255,255,255,.75); font-size: 14px; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.15); }
.landing-main { flex: 1; padding: 48px 32px; max-width: 1080px; width: 100%; margin: 0 auto; }
.hero h1 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; max-width: 720px; letter-spacing: -.3px; }
.hero p { color: rgba(255,255,255,.72); max-width: 640px; font-size: 14.5px; margin: 0 0 36px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pack-card { display: flex; flex-direction: column; gap: 10px; background: #fff; color: var(--text); border-radius: 12px; padding: 18px; text-decoration: none; border-top: 4px solid var(--accent, #0b1f33); box-shadow: 0 8px 30px rgba(0,0,0,.25); transition: transform .12s, box-shadow .12s; }
.pack-card:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,.3); }
.pack-head { display: flex; align-items: center; gap: 12px; }
.pack-head img { height: 40px; width: auto; border-radius: 4px; }
.pack-name { font-weight: 700; color: var(--navy); font-size: 15px; }
.pack-client { color: var(--muted); font-size: 12px; }
.pack-card p { margin: 0; color: #3b4450; font-size: 13px; flex: 1; }
.pack-card .open { color: var(--accent, #0067c8); font-weight: 600; font-size: 13px; }
.landing .muted { color: rgba(255,255,255,.55); }
.landing-foot { padding: 16px 32px; color: rgba(255,255,255,.45); font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.landing-top .spacer { flex: 1; }
.landing-user { color: rgba(255,255,255,.8); font-size: 12.5px; }
button.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button.ghost:hover { background: rgba(255,255,255,.1); }
a.signin { display: inline-block; background: #fff; color: #0b1f33; font-weight: 700; padding: 11px 18px; border-radius: 8px; text-decoration: none; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
a.signin:hover { background: #e8f1fb; }

/* ---------------------------------------------------------------- signed-out gate */
body.landing { background: radial-gradient(1200px 600px at 20% -10%, #17365a 0%, #0b1f33 55%, #081627 100%); }
.gate { display: grid; place-items: center; min-height: 60vh; }
.gate-card { background: #fff; color: var(--text); border-radius: 16px; padding: 40px 40px 32px; width: min(460px, 92vw); text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.gate-logo { height: 64px; width: auto; margin-bottom: 14px; }
.gate-card h1 { font-size: 24px; margin: 0 0 8px; color: var(--navy); letter-spacing: -.2px; }
.gate-lead { color: #3b4450; margin: 0 0 24px; font-size: 14px; }
.btn-autodesk { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: var(--navy); color: #fff; font-weight: 600; font-size: 14px; padding: 13px 18px; border-radius: 10px; text-decoration: none; transition: background .15s, transform .05s; }
.btn-autodesk:hover { background: #163a63; }
.btn-autodesk:active { transform: translateY(1px); }
.gate-note { color: var(--muted); font-size: 12px; margin: 18px 0 0; line-height: 1.5; }

/* clearable input */
.field.clearable { position: relative; }
.field.clearable input { padding-right: 34px; }
.field.clearable .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%; background: #e6eaf0; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.field.clearable .clear:hover { background: #d5dbe3; color: var(--text); }

/* ---------------------------------------------------------------- results pane, refined */
#results { background: #f7f8fa; }
#results h2 { padding: 14px 16px 6px; }
.model-head { background: var(--panel); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.model-head .name { font-size: 13.5px; }
.model-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .3px; padding: 2px 8px; border-radius: 999px; background: #eef1f5; color: var(--muted); }
.badge.fmt { text-transform: uppercase; }
.badge.fmt.rvt { background: #e6f0fb; color: #0b5cad; } .badge.fmt.ifc { background: #e7f5ec; color: #1f6b3a; } .badge.fmt.dwg { background: #fdf0e0; color: #8a4b00; }
.summary { padding: 14px 16px 0; }
.score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 22px; line-height: 1.1; font-weight: 700; }
.tile span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tile.FAIL b { color: var(--fail); } .tile.WARN b { color: var(--warn); } .tile.PASS b { color: var(--pass); }
.tile.lead.FAIL { background: #fff5f4; border-color: #f3c4bf; } .tile.lead.WARN { background: #fff9ec; border-color: #f2ddb0; } .tile.lead.PASS { background: #f1faf4; border-color: #bfe3cb; }
.legend { display: block; padding: 12px 16px 14px; border-bottom: 0; }
.elbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #e6eaf0; }
.elbar i { display: block; height: 100%; }
.elbar i.FAIL { background: var(--fail); } .elbar i.WARN { background: var(--warn); } .elbar i.PASS { background: var(--pass); }
.elcounts { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.elcounts span { display: inline-flex; align-items: center; gap: 6px; }
.elcounts .total { margin-left: auto; }
.sw { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sw.FAIL { background: var(--fail); } .sw.WARN { background: var(--warn); } .sw.PASS { background: var(--pass); }
.group { margin: 10px 16px 4px; padding: 0; border: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.result { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: start; margin: 0 12px 6px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.result .body { min-width: 0; }
.result .name { font-weight: 600; color: var(--navy); }
.result .detail { grid-column: auto; color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-word; }
.result.FAIL { border-left: 3px solid var(--fail); } .result.WARN { border-left: 3px solid var(--warn); } .result.PASS { border-left: 3px solid var(--pass); } .result.INFO { border-left: 3px solid #cbd2db; }
.pill { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; white-space: nowrap; margin-top: 1px; }
.pill.FAIL, .pill.ERROR { background: #fde3e0; color: #9b1c12; } .pill.WARN { background: #ffefc7; color: #7a4e00; } .pill.PASS { background: #dcf2e3; color: #1f6b3a; } .pill.INFO { background: #eef1f5; color: #4b5563; }
.ghost-sm { border: 1px solid var(--line); background: #fff; color: var(--blue); border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ghost-sm:hover { background: var(--blue-soft); border-color: #c7dcf3; }
.errorbox { background: #fde3e0; color: #9b1c12; border-radius: 10px; padding: 10px 12px; font-weight: 500; }
.actions { gap: 10px; padding: 12px 16px; box-shadow: 0 -8px 20px rgba(11,31,51,.06); }
.actions button.link { font-size: 12.5px; }
#runs { background: var(--panel); padding-bottom: 4px; }
.run { margin: 0 12px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.run.active { background: var(--blue-soft); box-shadow: inset 0 0 0 1px #c7dcf3; }
.run .name { color: var(--navy); }

.gate-alt { display: inline-block; margin-top: 12px; font-size: 12.5px; color: var(--blue); text-decoration: none; font-weight: 500; }
.gate-alt:hover { text-decoration: underline; }
.row-center { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 6px; }
a.btn-like { text-decoration: none; display: inline-block; }

/* ---------------------------------------------------------------- aggregator: model list, summary table, activity log */
.models { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; }
.mrow { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.mrow input[type=checkbox] { margin: 3px 0 0; width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.mrow .body { min-width: 0; }
.mrow .name { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--navy); }
.mrow .name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.mrow .sub b { color: var(--warn); font-weight: 600; }
.mrow .acts { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.mrow .acts button.link { font-size: 12px; color: var(--muted); }
.add-user { grid-template-columns: 1.4fr 1fr auto auto; }
.cats { padding: 0 16px 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 7px 8px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
table.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.tbl th:not(:first-child), table.tbl td:not(:first-child) { text-align: right; white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: 0; }
.log { padding: 0 16px 16px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.logline { white-space: pre-wrap; word-break: break-word; }
.logline.err { color: var(--fail); }

/* ---------------------------------------------------------------- zones */
.zones { display: flex; flex-direction: column; gap: 4px; max-height: 32vh; overflow: auto; }
.zrow { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.zrow:hover { background: var(--blue-soft); }
.zrow.active { background: var(--blue-soft); border-color: #c7dcf3; }
.zrow .sw2 { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
.zrow .name { font-weight: 600; color: var(--navy); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zrow .name small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.zrow .n { color: var(--muted); font-size: 12px; white-space: nowrap; }
.zrow .acts { grid-column: 2 / 4; display: flex; gap: 12px; }
.zrow .acts button.link { font-size: 12px; color: var(--muted); }
.zoneform { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-end { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }
input[type=number] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; color: var(--text); }
input[type=number]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,200,.15); background: #fff; }
input[type=color] { width: 100%; height: 38px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; cursor: pointer; }
.zoutline { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.zoutline.drawing { color: var(--blue); font-weight: 600; }
.drawhint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(11,31,51,.9); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 12.5px; z-index: 4; pointer-events: none; white-space: nowrap; }
#selbar select { width: auto; flex: 1; padding: 6px 28px 6px 10px; }
#results h2 button.link { font-size: 11.5px; text-transform: none; letter-spacing: 0; margin-left: 8px; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover td { background: var(--blue-soft); }
table.tbl tr.active td { background: var(--blue-soft); }
table.tbl td .sw2 { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.15); }
table.tbl tr.total td { font-weight: 700; color: var(--navy); border-top: 2px solid var(--line); }

/* grids panel */
.chips { display: flex; flex-wrap: wrap; gap: 4px; max-height: 18vh; overflow: auto; }
.chips span { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef1f5; color: var(--navy); border: 1px solid var(--line); }
.gridlabels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.gbub { position: absolute; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #fff; border: 2px solid #0b1f33; color: #0b1f33; font: 700 11px/22px "Segoe UI", sans-serif; text-align: center; box-shadow: 0 1px 3px rgba(11,31,51,.3); }
.gbub.long { font-size: 9px; }

/* take-off settings dialog */
dialog#cfg .field { margin-bottom: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
dialog#cfg textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; font: inherit; resize: vertical; }
dialog#cfg textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,200,.15); background: #fff; }
.chips.picks { max-height: 22vh; }
.chips.picks span.pick { cursor: pointer; }
.chips.picks span.pick:hover { background: var(--blue-soft); border-color: #c7dcf3; }
.chips.picks span.pick.on { background: var(--blue); color: #fff; border-color: var(--blue); }

/* datum panel */
.datum { position: absolute; left: 12px; top: 12px; z-index: 4; width: 300px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12.5px; }
.datum-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.datum-head b { color: var(--navy); }
.datum-head .muted { flex: 1; margin: 0; }
.datum-head button.link { font-size: 16px; line-height: 1; color: var(--muted); }
#datumtable { width: 100%; border-collapse: collapse; }
#datumtable td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
#datumtable td:first-child { color: var(--muted); white-space: nowrap; width: 34%; }
#datumtable td:last-child { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; word-break: break-word; }
#datumtable tr:last-child td { border-bottom: 0; }
.datum-acts { display: flex; gap: 8px; margin-top: 8px; }
#zonesbar button.link.on, #datumbtn.on { color: #fff; background: var(--blue); border-radius: 6px; padding: 2px 8px; }
.datumtip { position: absolute; z-index: 5; pointer-events: none; background: rgba(11,31,51,.92); color: #fff; padding: 5px 9px; border-radius: 6px; font: 12px/1.35 Consolas, "Cascadia Mono", monospace; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.datumtip b { color: #ffd166; }
.datum-acts { flex-wrap: wrap; }
.datum.pinned { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,103,200,.2); }
#selbar { flex-wrap: wrap; }
#selbar span { flex: 1 0 100%; }
.zoutline .zbtns { display: flex; gap: 6px; }
.zrow.sub { margin-left: 18px; }
.zrow .n small { color: var(--muted); }
table.tbl tr.sub td:first-child { padding-left: 22px; }
dialog#cmp { width: min(1000px, 94vw); }
.cmpout { margin-top: 10px; max-height: 60vh; overflow: auto; }
table.tbl td.delta.up { color: var(--pass); font-weight: 600; } table.tbl td.delta.down { color: var(--fail); font-weight: 600; }
table.tbl tr.zonehead td { background: #fbfcfd; font-weight: 700; color: var(--navy); cursor: pointer; }
table.tbl tr.grp td:first-child { padding-left: 22px; color: var(--muted); }
.mrow .sub a.link { color: var(--blue); cursor: pointer; }
/* project chooser */
#top .projname { color: #fff; text-decoration: none; opacity: .85; font-size: 13px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.3); }
#top .projname:hover { opacity: 1; text-decoration: underline; }
.denied .card.chooser { max-width: 560px; text-align: left; }
.denied .card.chooser h2 { justify-content: flex-start; }
.projlist { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.projlist a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); background: #fbfcfd; }
.projlist a:hover { background: var(--blue-soft); border-color: #c7dcf3; }
.projlist a .pn { font-weight: 600; color: var(--navy); }
.projlist a .pr { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; align-self: center; }
.projlist a .pd { grid-column: 1 / 3; font-size: 12px; color: var(--muted); }
.newproj { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.newproj h3 { margin: 0; font-size: 13px; color: var(--navy); }
.admin-h3 { margin: 18px 0 4px; font-size: 13px; color: var(--navy); }
.rk { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.rk-row { display: grid; grid-template-columns: 80px 1fr; gap: 8px; align-items: center; font-size: 12px; }
.rk-row code { font-size: 11px; background: #f4f5f7; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; word-break: break-all; user-select: all; }
table.tbl tr.grp td { color: var(--muted); font-size: 11.5px; background: #fbfcfd; }
table.tbl tr.grp td:first-child { padding-left: 26px; }
.picklist { max-height: 30vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; background: #fff; }
.picklist div { padding: 6px 10px; cursor: pointer; font-size: 12.5px; border-bottom: 1px solid #f0f2f5; display: flex; justify-content: space-between; gap: 10px; }
.picklist div:hover { background: var(--blue-soft); }
.picklist div small { color: var(--muted); }
.picklist .none { color: var(--muted); cursor: default; }
.cfgmore { margin: 6px 0 10px; font-size: 12.5px; color: var(--muted); }
.cfgmore summary { cursor: pointer; }
.cfgmore textarea { margin-top: 6px; }
#results h2 .hint2 { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--blue); margin-left: 6px; }
.progress { height: 6px; background: #e6eaf0; border-radius: 999px; overflow: hidden; margin: -6px 0 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--pass); transition: width .2s; }
input.vdate { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12px; }
/* resizable left column + collapsible cards */
.splitter { cursor: col-resize; background: var(--line); }
.splitter:hover, .splitter.on { background: var(--blue); }
body.resizing { cursor: col-resize; user-select: none; }
.card h2 { cursor: pointer; user-select: none; }
.card h2::before { content: "\25BE"; font-size: 10px; color: var(--muted); margin-right: 2px; transition: transform .15s; }
.card.collapsed h2::before { transform: rotate(-90deg); }
.card.collapsed > *:not(h2) { display: none; }
.card.collapsed { gap: 0; }
.card.collapsed.grow { flex: 0; min-height: 0; }
.mrow .mprog { margin: 6px 0 0; height: 5px; }

/* ---------------------------------------------------------------- annotator: form, labels, slide furniture, saved views */
dialog#admin { border: 0; border-radius: 12px; padding: 20px 22px; width: min(720px, 92vw); box-shadow: 0 20px 60px rgba(11,31,51,.25); }
.field.checks { justify-content: flex-end; gap: 6px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer; }
.chk input { accent-color: var(--blue); margin: 0; }
input[type=range] { width: 100%; accent-color: var(--blue); }
#aform.kind-text .area-only, #aform.kind-area .text-only { display: none !important; }
.zrow .sw2.dashed { background: transparent !important; border: 2px dashed var(--swc, #888); }
.zrow .sw2.txt { background: transparent !important; border: 0; font-weight: 800; color: var(--swc, #888); text-align: center; line-height: 14px; font-size: 12px; }
.zrow.hidden .name { color: var(--muted); text-decoration: line-through; }
.zrow .acts button.link.on { color: var(--blue); }
.card h2 .hint button.link { font-size: 11.5px; color: var(--muted); }
.card h2 .hint button.link.on { color: var(--blue); font-weight: 600; }
#mctree { max-height: 30vh; }
#mctree li { cursor: default; }
#mctree li:hover { background: transparent; }
#mctree li .vn { color: var(--muted); font-size: 11px; white-space: nowrap; }
.annlabels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.alab { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); background: rgba(255,255,255,.92); border: 1.5px solid var(--c, #333); color: var(--c, #333); border-radius: 6px; padding: 2px 8px; font: 700 12px/1.3 "Segoe UI", sans-serif; white-space: nowrap; box-shadow: 0 1px 3px rgba(11,31,51,.25); text-align: center; }
.alab small { display: block; font-weight: 500; font-size: 10.5px; color: #333; }
.alab.txt { transform: translate(0, -50%); border-width: 0; background: rgba(255,255,255,.88); padding: 3px 8px; }
.alab.txt::before { content: ""; position: absolute; left: -6px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--c, #333); }
.slide-title { position: absolute; left: 12px; top: 12px; z-index: 4; background: rgba(255,255,255,.94); border-left: 5px solid var(--blue); border-radius: 6px; padding: 8px 14px; font: 700 18px/1.2 "Segoe UI", sans-serif; color: var(--navy); box-shadow: var(--shadow); pointer-events: none; max-width: 60%; }
.slide-legend { position: absolute; left: 12px; top: 64px; z-index: 4; background: rgba(255,255,255,.94); border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow); pointer-events: none; display: flex; flex-direction: column; gap: 6px; max-width: 46%; }
.slide-legend .lrow { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text); }
.slide-legend .lsw { width: 34px; height: 16px; flex: none; border: 2px solid var(--c, #333); background: var(--f, transparent); box-sizing: border-box; }
.slide-legend .lsw.dashed { border-style: dashed; }
.slide-legend .lsw.none { border-color: transparent; }
.slide-table { position: absolute; left: 12px; bottom: 12px; z-index: 4; background: rgba(255,255,255,.96); border-radius: 8px; padding: 6px 8px; box-shadow: var(--shadow); pointer-events: none; max-width: 60%; overflow: hidden; }
.slide-table table { border-collapse: collapse; font-size: 11.5px; }
.slide-table th { background: #bcd4ee; color: var(--navy); font-weight: 700; padding: 3px 8px; border: 1px solid #8fb3d9; text-align: left; }
.slide-table td { padding: 3px 8px; border: 1px solid #c9d3de; white-space: nowrap; }
.slide-note { position: absolute; right: 12px; bottom: 12px; z-index: 4; background: #e9f5e6; border: 1px solid #b7dcb0; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; color: #1f3d1a; box-shadow: var(--shadow); pointer-events: none; max-width: 36%; white-space: pre-wrap; }
.slide-note.has-title { bottom: 12px; }
#results .pad { padding: 0 16px; }
.views { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }
.vrow { display: grid; grid-template-columns: 84px 1fr; gap: 4px 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); align-items: start; cursor: pointer; }
.vrow:hover { background: var(--blue-soft); }
.vrow.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,103,200,.15); }
.vrow img, .vrow .noimg { width: 84px; height: 48px; object-fit: cover; border-radius: 6px; background: #e4e8ee; border: 1px solid var(--line); display: block; }
.vrow .name { font-weight: 600; color: var(--navy); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow .sub { color: var(--muted); font-size: 11.5px; }
.vrow .acts { grid-column: 2 / 3; display: flex; gap: 10px; }
.vrow .acts button.link { font-size: 12px; color: var(--muted); }
.saveview { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px 4px; }
.slide-edit { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.slide-edit textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; font: inherit; font-size: 12.5px; resize: vertical; }
.slide-edit textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,200,.15); background: #fff; }
#results h2 button.link { font-size: 11.5px; text-transform: none; letter-spacing: 0; margin-left: 8px; }
.zrow .n { font-size: 11px; }

/* levels panel */
.levels { display: flex; flex-direction: column; gap: 3px; max-height: 30vh; overflow: auto; }
.lvrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; font-weight: 600; color: var(--navy); }
.lvrow:hover { background: var(--blue-soft); }
.lvrow.active { background: var(--blue); color: #fff; }
.lvrow .z { font-weight: 500; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.lvrow.active .z { color: rgba(255,255,255,.85); }
#levelform textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; font: 12.5px Consolas, "Cascadia Mono", monospace; resize: vertical; }
#levelform textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,200,.15); background: #fff; }
.zrow.off { opacity: .45; }
.zrow.off .name::after { content: " · other level"; font-weight: 400; color: var(--muted); }
.anncontrols { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.anncontrols input[type=range] { margin: 0; }
.anncontrols .chk { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
/* simple mode (non-admin): the levels list is the whole left pane */
body.simple #files > .card { flex: 0 0 auto; }
body.simple .levels { max-height: none; gap: 6px; }
body.simple .lvrow { padding: 12px 14px; font-size: 14px; border: 1px solid var(--line); background: #fbfcfd; }
body.simple .lvrow:hover { background: var(--blue-soft); }
body.simple .lvrow.active { background: var(--blue); border-color: var(--blue); }
body.simple .card h2 .step { display: none; }

/* markup toolbar (lines and text for editors) */
.mktools { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; box-shadow: var(--shadow); }
.mktools button { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 999px; padding: 5px 12px; font-weight: 600; cursor: pointer; }
.mktools button:hover { background: var(--blue-soft); }
.mktools button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.mktools input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.mktools select { width: auto; padding: 5px 26px 5px 10px; border-radius: 999px; }
.mktools input[type=text] { width: 220px; padding: 6px 10px; border: 1px solid var(--blue); border-radius: 999px; }
.drawhint { top: 58px; }
.zrow .sw2.ln { background: transparent !important; border: 0; border-top: 3px solid var(--swc, #888); height: 0; border-radius: 0; }
.zrow .sw2.ln.dashed { border-top-style: dashed; }
#aform.kind-line .text-only, #aform.kind-line .fill-only { display: none !important; }
body.simple .mktools { top: 12px; }
