/* Metre2 Programme Studio - the dense docked workspace from the signed-off mock-ups (8 Nov 2026).
   Openspace look with a violet accent of its own; critical red stays for the critical path. Light by default, dark
   blueprint in dark. Inter for the interface, JetBrains Mono for numbers and dates - both bundled (fonts/, SIL OFL). */
@font-face { font-family: 'Inter'; src: url('../fonts/inter-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-var.woff2') format('woff2'); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #f4f5f9; --panel: #ffffff; --panel2: #f8f8fb; --tint: #f1eff9; --hover: rgba(90,63,214,.06); --sel: rgba(90,63,214,.12);
  --line: rgba(40,30,70,.11); --line2: rgba(40,30,70,.21); --tx: #16131f; --tx2: #463f57; --tx3: #655d77;
  --ink: #5a3fd6; --ink2: #43299f; --on: #ffffff; --ok: #0b7a51; --warn: #a14a07; --bad: #b4232f;
  --okbg: #e3f3ec; --warnbg: #fdf0e3; --badbg: #fbe8ea; --plan: #fdfdff; --bar: #6f57e0; --crit: #d23441; --near: #d97706;
  --done: #3b3550; --base: #b9b4c8; --grid: rgba(60,40,120,.06); --shut: rgba(60,40,120,.07); --dd: #0f8a6a; --wbsbar: #2c2640;
  --glow: 0 6px 18px -8px rgba(90,63,214,.55); --shadow: 0 28px 70px -24px rgba(30,20,70,.38);
  --ui: 'Inter', 'Segoe UI', system-ui, sans-serif; --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
  --rh: 24px;
  color-scheme: light;
}
html.dark {
  --bg: #09080f; --panel: #12101b; --panel2: #16131f; --tint: #1c1830; --hover: rgba(160,140,255,.07); --sel: rgba(150,130,255,.17);
  --line: rgba(190,180,255,.11); --line2: rgba(190,180,255,.22); --tx: #f2f0fa; --tx2: #c2bcd6; --tx3: #9d95b4;
  --ink: #a28dff; --ink2: #c3b6ff; --on: #120a2a; --ok: #4ade80; --warn: #fbbf24; --bad: #ff8a93;
  --okbg: rgba(74,222,128,.12); --warnbg: rgba(251,191,36,.12); --badbg: rgba(255,120,130,.14); --plan: #0c0a14; --bar: #8f7bff; --crit: #ff5c68;
  --near: #fbbf24; --done: #d8d2ee; --base: #5d5675; --grid: rgba(170,150,255,.06); --shut: rgba(170,150,255,.08); --dd: #34d399; --wbsbar: #e4defa;
  --glow: 0 0 22px -6px rgba(162,141,255,.55); --shadow: 0 30px 80px -24px rgba(0,0,0,.85);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); font: 12px/1.35 var(--ui); letter-spacing: -.003em; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.lbl { font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--tx3); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.sp { flex: 1; }

#app { height: 100vh; display: flex; flex-direction: column; }

/* menu strip */
.menubar { height: 32px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 13px; white-space: nowrap; }
.menu { display: flex; }
.menu > button { height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--tx2); cursor: pointer; }
.menu > button:hover, .menu > button.open { background: var(--hover); color: var(--tx); }
.doctitle { flex: 1; text-align: center; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doctitle b { color: var(--tx); font-weight: 600; }
.doctitle .dirty { color: var(--ink); }
.pill { padding: 2px 8px; border-radius: 999px; background: linear-gradient(135deg, #ffe08a, #ffbf3c); color: #7a4a00; font: 700 9px var(--mono); letter-spacing: .08em; }
.iconbtn { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--tx2); cursor: pointer; }
.iconbtn:hover { background: var(--hover); color: var(--tx); }

/* drop-down menus and context menus */
.popmenu { position: fixed; z-index: 400; min-width: 220px; padding: 4px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); }
.popmenu button { width: 100%; display: flex; align-items: center; gap: 10px; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; color: var(--tx); }
.popmenu button:hover, .popmenu button.hot { background: var(--sel); }
.popmenu button:disabled { color: var(--tx3); cursor: default; background: transparent; }
.popmenu .key { margin-left: auto; font: 10.5px var(--mono); color: var(--tx3); }
.popmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* ribbon */
.ribbon { flex: none; background: var(--panel); border-bottom: 1px solid var(--line2); }
.rtabs { display: flex; gap: 2px; padding: 0 8px; height: 28px; align-items: flex-end; }
.rtabs button { height: 26px; padding: 0 12px; border: 0; border-radius: 7px 7px 0 0; background: transparent; color: var(--tx2); cursor: pointer; font-weight: 500; }
.rtabs button.on { background: var(--tint); color: var(--ink2); font-weight: 600; }
.rbody { display: flex; align-items: stretch; gap: 0; height: 66px; padding: 4px 6px; background: var(--tint); overflow-x: auto; overflow-y: hidden; }
.rgroup { flex: none; display: flex; flex-direction: column; padding: 0 8px; border-right: 1px solid var(--line); }
.rgroup:last-child { border-right: 0; }
.rgroup .items { flex: 1; display: flex; align-items: center; gap: 2px; }
.rgroup .glabel { text-align: center; font: 600 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tx3); padding-top: 1px; }
.rbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 52px; height: 44px; padding: 2px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--tx); cursor: pointer; font-size: 11px; white-space: nowrap; }
.rbtn svg { width: 18px; height: 18px; }
.rbtn:hover { background: var(--hover); }
.rbtn.on { background: var(--sel); color: var(--ink2); }
.rbtn:disabled { color: var(--tx3); cursor: default; background: transparent; opacity: .55; }
.rsmall { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 21px); gap: 1px 2px; }
.rsmall .rbtn { flex-direction: row; min-width: 0; height: 21px; padding: 0 8px; gap: 5px; justify-content: flex-start; }
.rsmall .rbtn svg { width: 14px; height: 14px; }

/* main area with docked panels */
.main { flex: 1; min-height: 0; display: flex; }
.side { flex: none; display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
.side.left { border-right: 1px solid var(--line2); }
.side.right { border-left: 1px solid var(--line2); }
.phead { height: 28px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; border-bottom: 1px solid var(--line); }
.phead .colbtn { width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--tx3); cursor: pointer; font-size: 13px; line-height: 1; }
.phead .colbtn:hover { background: var(--hover); color: var(--tx); }
.scroll { flex: 1; min-height: 0; overflow: auto; }
.splitter { flex: none; width: 5px; margin: 0 -2px; z-index: 5; cursor: col-resize; background: transparent; border: 0; padding: 0; position: relative; }
.splitter:hover, .splitter.drag { background: var(--ink); opacity: .35; }
.splitter.h { width: auto; height: 5px; margin: -2px 0; cursor: row-resize; }
.rail { flex: none; width: 22px; border: 0; padding: 0; background: var(--panel2); color: var(--tx3); cursor: pointer; display: flex; align-items: flex-start; justify-content: center; padding-top: 10px; }
.rail span { writing-mode: vertical-rl; font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.rail:hover { background: var(--hover); color: var(--tx); }
.side.left + .rail, .rail.left { border-right: 1px solid var(--line2); }
.rail.right { border-left: 1px solid var(--line2); }
.rail.bottom { width: auto; height: 22px; padding: 0 12px; align-items: center; justify-content: flex-start; border-top: 1px solid var(--line2); font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; }

.centre { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.planarea { flex: 1; min-height: 0; display: flex; background: var(--plan); }

/* activity table */
.tablepane { flex: none; display: flex; flex-direction: column; min-width: 160px; background: var(--panel); border-right: 1px solid var(--line2); }
.thead { height: 40px; flex: none; display: flex; background: var(--tint); border-bottom: 1px solid var(--line2); }
.th { flex: none; display: flex; align-items: flex-end; padding: 0 6px 6px; font: 600 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tx2); border-right: 1px solid var(--line); position: relative; user-select: none; cursor: default; }
.th.num { justify-content: flex-end; }
.th .cresize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.tbody { flex: 1; min-height: 0; overflow: hidden; position: relative; outline: none; }
.trows { position: absolute; left: 0; right: 0; top: 0; }
.tr { height: var(--rh); display: flex; align-items: center; border-bottom: 1px solid var(--line); cursor: default; }
.tr:hover { background: var(--hover); }
.tr.sel { background: var(--sel); }
.tr.wbs { background: var(--panel2); font-weight: 600; }
.tr.wbs.sel { background: var(--sel); }
.td { flex: none; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid transparent; height: 100%; display: flex; align-items: center; }
.td.num { justify-content: flex-end; font-family: var(--mono); font-size: 11px; }
.td.mono { font-family: var(--mono); font-size: 11px; }
.td.cur { box-shadow: inset 0 0 0 1.5px var(--ink); border-radius: 2px; }
.td .tw { width: 14px; flex: none; color: var(--tx3); cursor: pointer; text-align: center; }
.td .crit { color: var(--crit); font-weight: 600; }
.td .neg { color: var(--bad); font-weight: 600; }
.td .cons { margin-left: 4px; color: var(--warn); font: 600 9px var(--mono); }
.td .done { color: var(--ok); }
.editor { position: absolute; z-index: 20; height: calc(var(--rh) - 2px); border: 1.5px solid var(--ink); border-radius: 3px; padding: 0 5px; background: var(--panel); color: var(--tx); outline: none; font: 12px var(--ui); box-shadow: var(--glow); }
.editor.mono { font: 11px var(--mono); }

/* Gantt */
.ganttpane { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.gscroll { position: absolute; inset: 40px 0 0 0; overflow: auto; }
.gspacer { width: 1px; height: 1px; }
canvas.gantt { position: absolute; left: 0; top: 0; pointer-events: none; }
canvas.gscale { position: absolute; left: 0; top: 0; height: 40px; }
.gtip { position: absolute; z-index: 30; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: var(--tx); color: var(--bg); font: 11px var(--mono); white-space: nowrap; box-shadow: var(--shadow); }

/* dock */
.dock { flex: none; display: flex; flex-direction: column; background: var(--panel); border-top: 1px solid var(--line2); min-height: 80px; }
.dtabs { height: 28px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 4px 0 6px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.dtabs button.tab { height: 22px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--tx2); cursor: pointer; font-size: 11.5px; }
.dtabs button.tab.on { background: var(--sel); color: var(--ink2); font-weight: 600; }
.dtabs .count { margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--tint); font: 600 9.5px var(--mono); color: var(--tx2); }
.dtabs .count.bad { background: var(--badbg); color: var(--bad); }
table.grid { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.grid th { position: sticky; top: 0; background: var(--tint); text-align: left; padding: 5px 8px; font: 600 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tx2); border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.grid td { padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td.num { text-align: right; font-family: var(--mono); font-size: 10.5px; }
table.grid tr.click { cursor: pointer; }
table.grid tr.click:hover td { background: var(--hover); }
table.grid input, table.grid select { height: 22px; border: 1px solid var(--line2); border-radius: 5px; background: var(--panel); padding: 0 5px; font-size: 11px; }
.sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.sev.error { background: var(--bad); } .sev.warning { background: var(--warn); } .sev.info { background: var(--tx3); }

/* properties */
.props { padding: 0 0 20px; }
.pgroup { border-bottom: 1px solid var(--line); }
.pgroup > .gh { display: flex; align-items: center; height: 28px; padding: 0 10px; cursor: pointer; user-select: none; }
.pgroup > .gh .lbl { flex: 1; }
.pgroup.closed > .gb { display: none; }
.prow { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 8px; padding: 3px 10px; min-height: 26px; }
.prow > label { color: var(--tx2); font-size: 11.5px; }
.prow input, .prow select, .prow textarea { width: 100%; min-width: 0; height: 24px; border: 1px solid var(--line2); border-radius: 6px; background: var(--panel); padding: 0 6px; font-size: 11.5px; }
.prow textarea { height: 60px; padding: 4px 6px; resize: vertical; }
.prow input.mono { font: 11px var(--mono); }
.prow .ro { font: 11px var(--mono); color: var(--tx); }
.prow .ro.crit { color: var(--crit); font-weight: 600; }
.why { margin: 6px 10px 10px; padding: 9px 10px; border-radius: 9px; background: var(--tint); font-size: 11.5px; line-height: 1.45; color: var(--tx2); }
.why b { color: var(--tx); }
.empty { padding: 24px 16px; color: var(--tx3); text-align: center; line-height: 1.5; }

/* WBS tree / filters (left) */
.tree { padding: 4px 0; }
.tnode { display: flex; align-items: center; gap: 4px; height: 26px; padding-right: 8px; cursor: pointer; white-space: nowrap; }
.tnode:hover { background: var(--hover); }
.tnode.on { background: var(--sel); color: var(--ink2); font-weight: 600; }
.tnode .tw { width: 14px; text-align: center; color: var(--tx3); }
.tnode .n { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.tnode .c { font: 10px var(--mono); color: var(--tx3); }
.filters { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 11.5px; cursor: pointer; }
.chk input { accent-color: var(--ink); }

/* status bar */
.status { height: 24px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 10px; background: var(--panel); border-top: 1px solid var(--line2); font: 10.5px var(--mono); color: var(--tx2); white-space: nowrap; overflow: hidden; }
.status .ok { color: var(--ok); } .status .bad { color: var(--bad); } .status .sepr { color: var(--line2); }

/* command palette, dialogs, toasts */
.overlay { position: fixed; inset: 0; z-index: 300; background: rgba(10,8,20,.42); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette { width: 560px; max-width: 94vw; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.palette input { width: 100%; height: 44px; border: 0; border-bottom: 1px solid var(--line); padding: 0 16px; background: transparent; font-size: 14px; outline: none; }
.palette .list { max-height: 50vh; overflow: auto; padding: 4px; }
.palette .item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer; }
.palette .item.hot { background: var(--sel); }
.palette .item .k { margin-left: auto; font: 10.5px var(--mono); color: var(--tx3); }
.palette .item .t { font: 10px var(--mono); color: var(--tx3); width: 64px; }
.dialog:has(.wide) { width: min(1040px, 94vw); }
.dialog { width: 520px; max-width: 94vw; max-height: 80vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); }
.dialog h2 { margin: 0; padding: 16px 18px 6px; font-size: 15px; }
.dialog .db { padding: 6px 18px 12px; overflow: auto; line-height: 1.5; color: var(--tx2); }
.dialog .df { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.btn { height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel); color: var(--tx); cursor: pointer; font-weight: 500; }
.btn.primary { border: 0; background: var(--ink); color: var(--on); font-weight: 600; box-shadow: var(--glow); }
.btn:hover { filter: brightness(1.04); }
.toasts { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 350; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--tx); color: var(--bg); box-shadow: var(--shadow); font-size: 12px; }
.toast button { border: 0; background: transparent; color: var(--ink); font-weight: 700; cursor: pointer; filter: brightness(1.6); }
.dropzone { position: fixed; inset: 0; z-index: 290; display: none; align-items: center; justify-content: center; background: rgba(90,63,214,.14); border: 3px dashed var(--ink); font-size: 18px; font-weight: 600; color: var(--ink2); pointer-events: none; }
.dropzone.on { display: flex; }

/* ---- other views (line of balance, time-chainage, network, calendar) ---- */
.planarea { position: relative; }
.planarea.alt > .tablepane, .planarea.alt > #splitT, .planarea.alt > .ganttpane { display: none; }
.viewpane { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--plan); }
.viewpane.hidden, .vhost.hidden { display: none; }
.vbar { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line2); font-size: 12px; overflow-x: auto; }
.vbar .vtitle { font-weight: 650; margin-right: 6px; white-space: nowrap; }
.vbar label { color: var(--tx3); white-space: nowrap; }
.vbar select { height: 26px; border: 1px solid var(--line2); border-radius: 6px; background: var(--panel); color: var(--tx); padding: 0 6px; }
.vbar .btn { height: 26px; padding: 0 10px; }
.vbar .hint { color: var(--tx3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vbar .sp { flex: 1; }
.segs { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; }
.segs .seg { height: 26px; padding: 0 11px; border: 0; background: var(--panel); color: var(--tx2); cursor: pointer; font: inherit; }
.segs .seg + .seg { border-left: 1px solid var(--line2); }
.segs .seg.on { background: var(--sel); color: var(--ink); font-weight: 600; }
.vbody { flex: 1; min-height: 0; position: relative; }
.vhost { position: absolute; inset: 0; overflow: hidden; }
.vcanvas { position: absolute; inset: 0; display: block; outline: none; }
.vscroll { position: absolute; inset: 0; overflow: auto; outline: none; }
.calview { position: absolute; inset: 0; overflow: auto; }
.month { display: flex; flex-direction: column; min-height: 100%; padding: 10px 14px 14px; box-sizing: border-box; min-width: 760px; }
.mhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mhead h3 { margin: 0 8px; font-size: 15px; min-width: 150px; text-align: center; }
.mhead .btn { height: 28px; }
.wk, .grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wk div { font: 600 9.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--tx3); padding: 2px 6px; }
.grid7 { flex: 1; grid-auto-rows: minmax(108px, 1fr); }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.day.off { background: var(--tint); }
.day.out { opacity: .45; }
.day.dd { border-color: var(--dd); box-shadow: inset 0 0 0 1px var(--dd); }
.day .dn { display: flex; gap: 6px; align-items: baseline; font-size: 11px; }
.day .dn b { font: 600 11.5px var(--mono); }
.day .dn span { color: var(--tx3); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 2px 6px 2px 8px; border-radius: 5px; font-size: 10.5px; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--tx); background: color-mix(in srgb, var(--c) 16%, transparent); border-left: 3px solid var(--c); }
.chip:hover, .chip.on { background: color-mix(in srgb, var(--c) 30%, transparent); }
.chip.on { outline: 1.5px solid var(--ink); }
.day .more { all: unset; cursor: pointer; font-size: 10px; color: var(--ink); padding-left: 4px; }
.site { padding: 10px 14px; }
.sitegrid { border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.sitegrid th, .sitegrid td { height: 24px; min-width: 26px; text-align: center; border-radius: 4px; font-family: var(--mono); }
.sitegrid thead th { font: 600 9.5px var(--mono); color: var(--tx3); text-transform: uppercase; text-align: left; padding: 0 2px; position: sticky; top: 0; background: var(--plan); }
.sitegrid th.rowh { position: sticky; left: 0; z-index: 1; background: var(--panel); text-align: left; padding: 0 10px; font: 500 11.5px Inter, sans-serif; white-space: nowrap; min-width: 150px; border: 1px solid var(--line); }
.sitegrid thead th.rowh { font: 600 9.5px var(--mono); text-transform: uppercase; color: var(--tx3); }
.sitegrid td { background: var(--panel); border: 1px solid var(--line); cursor: default; }
.sitegrid td[title]:not([title=""]) { cursor: pointer; }
.sitegrid td.dd, .sitegrid th.dd { box-shadow: inset 0 0 0 1.5px var(--dd); }
.sitegrid td.peak { font-weight: 700; background: var(--tint); }
.sitegrid tr.tot td { background: var(--tint); font-weight: 600; }
.sitegrid .sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.legend { min-width: 200px; max-height: 60vh; overflow: auto; }
.legend .lg { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: 12px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.idsfilter { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 4px 4px 9px; border-radius: 7px; background: var(--sel); color: var(--ink); font-size: 11.5px; font-weight: 600; }
.idsfilter span { flex: 1; }

/* ---- analysis reports (bottom panel) ---- */
.areport { padding: 10px 14px 16px; font-size: 12px; }
.areport .ahead { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.areport h3 { margin: 0; font-size: 14px; }
.areport .sub { color: var(--tx3); font-size: 11.5px; margin-top: 2px; }
.areport .aacts { display: flex; gap: 6px; flex: none; }
.areport .aacts .btn { height: 28px; padding: 0 11px; }
.akpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.akpi { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; }
.akpi .v { font: 600 14px var(--mono); margin-top: 2px; }
.akpi.bad .v { color: var(--crit); } .akpi.ok .v { color: var(--ok, #2f9e6b); } .akpi.warn .v { color: #b7791f; }
.areport section { margin-top: 10px; }
.areport h4 { margin: 0 0 5px; font-size: 12.5px; }
.areport p { margin: 0 0 6px; color: var(--tx2); line-height: 1.45; }
.areport p.muted { color: var(--tx3); }
.areport ul { margin: 0 0 6px; padding-left: 18px; color: var(--tx2); }
table.arep { width: 100%; }
table.arep td { vertical-align: top; }
table.arep tr.click { cursor: pointer; }
table.arep tr.click:hover td { background: var(--sel); }
table.arep tr.bad td.tone { color: var(--crit); font-weight: 600; }
table.arep tr.ok td.tone { color: var(--ok, #2f9e6b); font-weight: 600; }
table.arep tr.warn td.tone { color: #b7791f; font-weight: 600; }
table.arep td { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.4; padding-top: 4px; padding-bottom: 4px; }

/* ---- health, risk, lean ---- */
.hgrid { display: grid; grid-template-columns: 150px minmax(0, 1fr) 380px; gap: 16px; align-items: center; }
.hcats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hcat { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.hcat .v { font: 700 18px var(--mono); margin: 2px 0 5px; }
.hcat .bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.hcat .bar i { display: block; height: 100%; background: var(--ink); }
.hcat.ok .v { color: var(--ok, #2f9e6b); } .hcat.ok .bar i { background: var(--ok, #2f9e6b); }
.hcat.warn .v { color: #b7791f; } .hcat.warn .bar i { background: #d4802a; }
.hcat.bad .v { color: var(--crit); } .hcat.bad .bar i { background: var(--crit); }
.areport .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; max-width: 420px; }
.areport .bar i { display: block; height: 100%; background: var(--ink); transition: width .1s; }
.lean { padding: 10px 14px 16px; font-size: 12px; }
.lean .lhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lean .lhead .btn { height: 28px; } .lean .lhead .sp { flex: 1; }
.lean .ppc { font: 600 12px var(--mono); color: var(--ink); }
.lean .lgrid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.lean td.click { cursor: pointer; color: var(--ink); }
.lean td.warn { color: #b7791f; font-weight: 600; }
.lean tr.late td { background: color-mix(in srgb, var(--crit) 7%, transparent); }
.lean td.bad { color: var(--crit); font-weight: 600; }
.lean .muted, .areport .muted { color: var(--tx3); }
@media (max-width: 1300px) { .hgrid { grid-template-columns: 150px minmax(0, 1fr); } .lean .lgrid { grid-template-columns: 1fr; } }
.lean .lgrid > div { min-width: 0; overflow-x: auto; }

/* ---- print preview ---- */
.printov { align-items: stretch; justify-content: stretch; padding: 24px; }
.pbox { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; min-height: 0; }
.pside { display: flex; flex-direction: column; gap: 7px; padding: 16px; border-right: 1px solid var(--line2); overflow: auto; font-size: 12.5px; }
.pside h2 { margin: 0 0 4px; font-size: 16px; }
.pside .lbl { margin-top: 8px; }
.pside select, .pside input[type=text] { height: 30px; border: 1px solid var(--line2); border-radius: 7px; background: var(--panel); color: var(--tx); padding: 0 7px; width: 100%; min-width: 0; }
.pside .prow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pside .prow2.hidden { display: none; }
.pside .pcols { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; }
.pside .sp { flex: 1; }
.pside .pinfo { color: var(--tx3); font-size: 11.5px; }
.pmain { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--tint); }
.parea { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden; }
.pcanvas { box-shadow: 0 2px 14px rgba(20, 10, 60, .18); background: #fff; }
.pbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line2); background: var(--panel); }
.pbar .sp { flex: 1; } .pbar .btn { height: 32px; }

/* ---- Free and Pro (step 10) ---- */
:root { --gold: #a86a00; --goldbg: #fff4dc; }
html.dark { --gold: #f5c04a; --goldbg: rgba(245,192,74,.13); }
.protag { display: inline-block; margin-left: 6px; padding: 1px 4px; border-radius: 4px; background: var(--goldbg); color: var(--gold); font: 700 8.5px var(--mono); letter-spacing: .06em; vertical-align: 1px; }
.popmenu .protag { margin-left: auto; }
.popmenu .protag + .key { margin-left: 8px; }
.rbtn.locked { position: relative; }
.rbtn.locked::after { content: 'PRO'; position: absolute; top: 1px; right: 1px; padding: 0 3px; border-radius: 3px; background: var(--goldbg); color: var(--gold); font: 700 7px/11px var(--mono); letter-spacing: .05em; }
.rsmall .rbtn.locked::after { content: none; }
.rsmall .rbtn.locked svg { color: var(--gold); }
.rsmall .rbtn.locked span::after { content: ''; display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: var(--gold); vertical-align: 2px; }
.freenote { height: 22px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 11px; background: var(--panel2); color: var(--tx2); font: 10.5px var(--mono); cursor: pointer; white-space: nowrap; }
.freenote.view { border-color: transparent; background: var(--goldbg); color: var(--gold); font-weight: 600; }
.freenote:hover { border-color: var(--gold); }
.propill { height: 22px; padding: 0 10px; border: 0; border-radius: 11px; background: var(--goldbg); color: var(--gold); font-weight: 700; cursor: pointer; }
.lockedtab { max-width: 560px; margin: 18px auto; padding: 16px 18px; border: 1px dashed var(--line2); border-radius: 12px; text-align: center; color: var(--tx2); line-height: 1.5; }
.lockedtab p { margin: 6px 0 12px; }
.profeat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 10px 0; }
.profeat > div { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; }
.profeat .pi { font-size: 16px; line-height: 1; }
.profeat b { display: block; color: var(--tx); }
.dialog .note { font-size: 11px; color: var(--tx3); }
.linkbtn { border: 0; background: transparent; color: var(--ink); cursor: pointer; padding: 4px 6px; border-radius: 6px; font-weight: 500; }
.linkbtn:hover { background: var(--hover); }

/* ---- start screen ---- */
.startov { position: fixed; inset: 0; z-index: 280; background: rgba(10,8,20,.46); display: flex; align-items: center; justify-content: center; padding: 3vh 2vw; }
.startbox { width: min(1180px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.stop { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--tint), var(--panel)); }
.stitle { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.stitle b { font-size: 19px; letter-spacing: -.01em; }
.stitle span { color: var(--tx2); font-size: 12.5px; }
.sbody { display: grid; grid-template-columns: 260px minmax(0, 1fr) 280px; gap: 0; overflow: auto; min-height: 0; }
.scol { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.scol + .scol { border-left: 1px solid var(--line); }
.shead { font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--tx3); margin: 4px 0 2px; }
.scol.wide .shead:not(:first-child) { margin-top: 12px; }
.sact { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left; cursor: pointer; color: var(--tx); }
.sact:hover, .sact:focus-visible { border-color: var(--ink); background: var(--hover); }
.sact .si svg { width: 18px; height: 18px; color: var(--ink); margin-top: 1px; }
.sact b { display: block; font-size: 12.5px; }
.sact span span, .sact > span:last-child > span { display: block; color: var(--tx3); font-size: 11px; margin-top: 2px; }
.sact.back { border-style: dashed; }
.shint { margin: 4px 2px 0; color: var(--tx3); font-size: 11px; line-height: 1.45; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tcard { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left; cursor: pointer; color: var(--tx); min-width: 0; }
.tcard:hover, .tcard:focus-visible { border-color: var(--ink); background: var(--hover); }
.tthumb { height: 56px; margin-bottom: 4px; border-radius: 6px; background: var(--plan); border: 1px solid var(--line); overflow: hidden; }
.tcard b { font-size: 12px; }
.tmeta { font: 10px var(--mono); color: var(--tx3); }
.ttext { font-size: 11px; color: var(--tx2); line-height: 1.4; }
.recent { display: flex; flex-direction: column; gap: 4px; }
.recent .empty { padding: 10px; text-align: left; border: 1px dashed var(--line); border-radius: 10px; }
.ritem { display: flex; align-items: center; gap: 4px; }
.ropen { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; padding: 6px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--tx); }
.ropen:hover, .ropen:focus-visible { background: var(--hover); border-color: var(--line); }
.ropen b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ropen span { grid-column: 1; color: var(--tx3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ropen .when { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: 10px var(--mono); }
.scol.pro { background: var(--panel2); }
.tier { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.tier.pro { border-color: var(--gold); }
.tier b { font-size: 12.5px; }
.tier .price { display: block; font-weight: 500; font-size: 11px; color: var(--gold); margin-top: 1px; }
.tier ul { margin: 6px 0 0; padding-left: 16px; color: var(--tx2); font-size: 11.5px; line-height: 1.5; }
.ison { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--okbg); color: var(--ok); font-weight: 600; }
.btn.trial { height: 36px; background: var(--gold); color: #fff; box-shadow: none; }
html.dark .btn.trial { color: #1d1400; }
.sfoot { display: flex; align-items: center; gap: 4px; padding: 8px 16px; border-top: 1px solid var(--line); }
.sfoot .sp, .hhead .sp, .hfoot .sp, .tbtns .sp { flex: 1; }
.sfoot .ver { font: 10px var(--mono); color: var(--tx3); }
@media (max-width: 900px) { .sbody { grid-template-columns: 1fr; } .scol + .scol { border-left: 0; border-top: 1px solid var(--line); } }

/* ---- help panel ---- */
.helppanel { position: fixed; top: 40px; right: 12px; bottom: 34px; width: min(640px, calc(100vw - 24px)); z-index: 290; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); }
.hhead { display: flex; align-items: center; padding: 10px 12px 6px 16px; font-size: 14px; }
.hsearch { padding: 0 12px 8px; }
.hsearch input { width: 100%; height: 30px; border: 1px solid var(--line2); border-radius: 8px; padding: 0 10px; background: var(--panel2); }
.hwrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr); border-top: 1px solid var(--line); }
.hnav { overflow: auto; padding: 6px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.hnav button { text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--tx2); }
.hnav button:hover { background: var(--hover); }
.hnav button.on { background: var(--sel); color: var(--ink2); font-weight: 600; }
.hbody { overflow: auto; padding: 4px 18px 18px; line-height: 1.55; color: var(--tx2); font-size: 12.5px; }
.hbody h3 { margin: 10px 0 6px; font-size: 15px; color: var(--tx); }
.hbody code, .hbody kbd { font: 11px var(--mono); padding: 1px 4px; border-radius: 4px; background: var(--tint); color: var(--ink2); }
.hbody ol, .hbody ul { padding-left: 20px; }
.hacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hacts .btn { height: 28px; font-size: 11.5px; }
table.keys { border-collapse: collapse; width: 100%; }
table.keys td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.keys td:last-child { text-align: right; white-space: nowrap; }
.hfoot { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--line); font: 10px var(--mono); color: var(--tx3); }

/* ---- tour ---- */
.tour { position: fixed; inset: 0; z-index: 320; }
.tring { position: fixed; border-radius: 10px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 9999px rgba(10,8,20,.5); pointer-events: none; transition: all .25s ease; }
.ttip { position: fixed; padding: 12px 14px 10px; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); transition: top .25s ease, left .25s ease; }
.ttip .tn { font: 10px var(--mono); color: var(--tx3); }
.ttip b { display: block; font-size: 14px; margin: 2px 0 4px; }
.ttip p { margin: 0 0 10px; color: var(--tx2); line-height: 1.5; }
.tbtns { display: flex; align-items: center; gap: 6px; }
.tbtns .btn { height: 28px; }
@media (prefers-reduced-motion: reduce) { .tring, .ttip { transition: none; } }
