/* Metre2 Earthworks - the dense docked workspace from the signed-off boards (10 Nov 2026).
   Openspace look with survey marking pink (#ff4f9a) as the accent and a dark loam title bar; cut is burnt orange and
   fill is blue, as data only. Light by default, a dark "site at night" mode. Inter for the interface, JetBrains Mono for
   every measurement - both bundled (fonts/, SIL OFL). Component styles shared with Print Imposition and Programme Studio. */
@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: #e9e7e1; --panel: #ffffff; --panel2: #faf9f6; --tint: #f4f2ec; --hover: rgba(176,18,92,.06); --sel: #ffe9f2;
  --line: #e2dfd6; --line2: #d6d2c6; --tx: #1d1b16; --tx2: #4f4a3f; --tx3: #6b6455;
  --acc: #ff4f9a; --ink: #b0125c; --ink2: #7d0c41; --on: #2a0a17; --ok: #0f7a43; --warn: #a14a07; --bad: #b4232f;
  --okbg: #e8f6ee; --warnbg: #fdf0e3; --badbg: #fbe8ea; --plan: #f4f2ec; --title: #17150f; --titletx: #ece7dc; --titletx2: #c9c2b2;
  --cut: #a8470f; --cutbg: #f6d5bb; --fill: #1f56ad; --fillbg: #cfe0f7; --eg: #6b5634; --design: #ff4f9a; --form: #5b6b7c;
  --sheet: #ffffff; --grip: rgba(176,18,92,.13);
  --glow: 0 6px 18px -8px rgba(176,18,92,.5); --shadow: 0 28px 70px -24px rgba(23,21,15,.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: #0d0c09; --panel: #18160f; --panel2: #12110c; --tint: #1d1b14; --hover: rgba(255,79,154,.07); --sel: rgba(255,79,154,.16);
  --line: rgba(236,231,220,.10); --line2: rgba(236,231,220,.19); --tx: #f3efe6; --tx2: #ddd6c7; --tx3: #a9a18f;
  --acc: #ff4f9a; --ink: #ff8fbd; --ink2: #ffc2dc; --on: #2a0a17; --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: #12110c; --title: #050504; --titletx: #ece7dc; --titletx2: #a9a18f;
  --cut: #ffab73; --cutbg: #5a2f12; --fill: #8fb8ff; --fillbg: #18325c; --eg: #c9b08c; --design: #ff4f9a; --form: #8fa4bd;
  --sheet: #f4f1ea; --grip: rgba(255,79,154,.18);
  --glow: 0 0 22px -6px rgba(255,79,154,.5); --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: 34px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 10px; background: var(--title); color: var(--titletx); }
.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: 4px; background: transparent; color: #c9d2dc; cursor: pointer; }
.menu > button:hover, .menu > button.open { background: rgba(255,255,255,.09); color: #fff; }
.doctitle { flex: 1; text-align: center; color: var(--titletx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doctitle b { color: var(--titletx); font-weight: 600; }
.doctitle .dirty { color: var(--acc); }
.pill { padding: 2px 8px; border-radius: 999px; background: linear-gradient(135deg, #ffe08a, #ffbf3c); color: #7a4a00; font: 700 9px var(--mono); letter-spacing: .08em; }
.menubar .iconbtn { color: #c9d2dc; } .menubar .iconbtn:hover { background: rgba(255,255,255,.09); color: #fff; }
.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(--panel2); 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(--panel); color: var(--tx); font-weight: 700; box-shadow: 0 0 0 1px var(--line2); clip-path: inset(-2px -2px 0 -2px); }
.rbody { display: flex; align-items: stretch; gap: 0; height: 70px; padding: 4px 6px; background: var(--panel); border-top: 1px solid var(--line2); 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); box-shadow: inset 0 0 0 1.5px var(--acc); color: var(--tx); }
.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); position: relative; }

/* 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(--title); font: 10.5px var(--mono); color: #b9c5d1; white-space: nowrap; overflow: hidden; }
.status .ok { color: var(--acc); } .status .bad { color: #ff8a93; } .status .warn { color: #fbbf24; } .status .sepr { color: #3a4756; } .status b { color: #fff; font-weight: 500; }

/* command palette, dialogs, toasts */
.overlay { position: fixed; inset: 0; z-index: 300; background: rgba(6,10,16,.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(0,230,118,.12); border: 3px dashed var(--ink); font-size: 18px; font-weight: 600; color: var(--ink2); pointer-events: none; }
.dropzone.on { display: flex; }

/* ---- 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(6,10,16,.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(6,10,16,.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; } }

/* ==== Print Imposition ==== */
.brand svg { color: var(--acc); }
.propill { background: var(--acc); color: #0b1a10; letter-spacing: .04em; }
.segs { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.segs .seg { height: 24px; padding: 0 10px; border: 0; background: var(--panel); color: var(--tx2); cursor: pointer; font: inherit; font-size: 11px; }
.segs .seg + .seg { border-left: 1px solid var(--line2); }
.segs .seg.on { background: var(--tx); color: var(--panel); font-weight: 600; }
/* view tabs above the sheet */
.vtabs { height: 30px; flex: none; display: flex; overflow-x: auto; overflow-y: hidden; align-items: center; gap: 2px; padding: 0 8px; background: var(--panel2); border-bottom: 1px solid var(--line2); }
.vtabs .vt { white-space: nowrap; flex: none; height: 24px; padding: 0 12px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--tx2); cursor: pointer; font-size: 11.5px; }
.vtabs .vt.on { background: var(--panel); border-color: var(--line2); color: var(--tx); font-weight: 700; }
.vtabs .vt .protag { margin-left: 5px; }
.vtabs .info { font: 10.5px var(--mono); color: var(--tx3); margin: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.viewhost { position: absolute; inset: 0; }
.viewhost.hidden { display: none; }
canvas.sheetc { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.vtools { position: absolute; right: 12px; top: 28px; display: flex; flex-direction: column; gap: 4px; z-index: 4; }
.vtools button { width: 28px; height: 28px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; color: var(--tx); cursor: pointer; padding: 0; }
.vtools button svg { width: 15px; height: 15px; }
.vtools button.on { box-shadow: inset 0 0 0 1.5px var(--acc); background: var(--sel); }
.vlegend { position: absolute; left: 30px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--tx2); z-index: 3; pointer-events: none; }
html.dark .vlegend { color: var(--tx2); }
.vlegend span { display: inline-flex; align-items: center; gap: 5px; }
.vlegend i { display: inline-block; }
.stip { position: absolute; z-index: 30; pointer-events: none; padding: 4px 7px; border-radius: 4px; background: var(--title); color: #fff; font: 10px var(--mono); white-space: nowrap; }
.probanner { position: absolute; left: 50%; top: 26px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 9px; background: var(--goldbg); border: 1px solid var(--gold); color: var(--tx); font-size: 11.5px; box-shadow: var(--shadow); max-width: calc(100% - 120px); }
.probanner b { color: var(--gold); }
.probanner .btn { height: 26px; padding: 0 10px; font-size: 11.5px; white-space: nowrap; flex: none; }
.probanner .x { border: 0; background: transparent; color: var(--tx3); cursor: pointer; font-size: 14px; }
/* job tree and page thumbnails */
.tnode .dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; background: var(--tx3); }
.tnode .dot.side { border-radius: 50%; background: var(--line2); }
.tnode.on .dot.side { background: var(--acc); }
.tnode .dot.sig { background: var(--ink); }
.tnode .dot.job { background: var(--tx); }
.tnode.on { background: var(--sel); box-shadow: inset 3px 0 0 var(--acc); color: var(--tx); }
.pagesbox { flex: none; border-top: 1px solid var(--line); padding: 8px 10px 10px; max-height: 45%; overflow: auto; }
.pagesbox .lbl { display: block; margin-bottom: 6px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; }
.thumb { height: 34px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; font: 9px var(--mono); background: var(--panel2); border: 1px solid var(--line); border-radius: 2px; color: var(--tx3); cursor: pointer; position: relative; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .9; }
.thumb span { position: relative; background: var(--panel); padding: 0 2px; border-radius: 2px; }
.thumb.here { border-color: var(--tx3); color: var(--tx); }
.thumb.sel { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.thumb.blank { background: repeating-linear-gradient(135deg, var(--panel2) 0 4px, var(--line) 4px 5px); }
.thumb.issue::after { content: ''; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
/* properties */
.prow .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.prow .unit { position: relative; }
.prow .unit input { padding-right: 26px; }
.prow .unit::after { content: attr(data-u); position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font: 9.5px var(--mono); color: var(--tx3); pointer-events: none; }
.prow .ro.ok { color: var(--ok); font-weight: 600; font-family: var(--ui); }
.prow .ro.warn { color: var(--warn); font-weight: 600; font-family: var(--ui); }
.prow .chks { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.prow input[type=checkbox] { width: auto; height: auto; accent-color: var(--ink); }
.prow .mini { height: 24px; padding: 0 8px; border: 1px solid var(--line2); border-radius: 6px; background: var(--panel); cursor: pointer; font-size: 11px; white-space: nowrap; }
.prow.wide { grid-template-columns: 1fr; }
.pgroup > .gh .protag { margin-left: 0; }
/* dock tables */
table.grid tr.on td { background: var(--sel); }
table.grid td.ok { color: var(--ok); font-weight: 600; }
table.grid td.warn { color: var(--warn); font-weight: 600; }
table.grid td.bad { color: var(--bad); font-weight: 600; }
table.grid .sw { display: inline-block; width: 22px; height: 14px; border-radius: 3px; vertical-align: -3px; margin-right: 6px; font: 700 9px/14px var(--mono); text-align: center; }
.logline { font: 11px var(--mono); padding: 3px 12px; color: var(--tx2); border-bottom: 1px solid var(--line); }
.logline b { color: var(--tx); font-weight: 600; }
.logline .t { color: var(--tx3); margin-right: 10px; }
/* folding dummy */
.dummy { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--plan); }
.dbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line2); font-size: 12px; flex-wrap: wrap; }
.dbar .btn { height: 26px; padding: 0 10px; font-size: 11.5px; }
.dbar .ok { color: var(--ok); font-weight: 600; }
.dbar .bad { color: var(--bad); font-weight: 600; }
.dsteps { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; align-content: start; }
.dstep { background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.dstep.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.dstep b { font-size: 12px; }
.dstep .m { font: 10.5px var(--mono); color: var(--tx3); }
.dstep canvas { width: 100%; height: auto; display: block; background: var(--plan); border-radius: 6px; }
.dstage { flex: none; height: 46%; min-height: 220px; position: relative; border-bottom: 1px solid var(--line2); }
.dstage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* reader spreads */
.spreads { position: absolute; inset: 0; overflow: auto; padding: 18px; display: flex; flex-wrap: wrap; gap: 22px 28px; align-content: flex-start; background: var(--plan); }
.spread { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.spread .pp { display: flex; box-shadow: 0 6px 18px rgba(14,22,33,.22); }
.spread .pg { position: relative; background: var(--sheet); border: 1px solid #b7c0ca; overflow: hidden; cursor: pointer; }
.spread .pg img { position: absolute; inset: 0; width: 100%; height: 100%; }
.spread .pg .n { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font: 600 11px var(--mono); color: #16202b; text-shadow: 0 0 3px #fff; }
.spread .pg.blank { background: repeating-linear-gradient(135deg, #f4f6f8 0 6px, #e6eaee 6px 7px); }
.spread .pg.on { outline: 2px solid var(--acc); outline-offset: 1px; z-index: 1; }
.spread .pg.lp { border-right-color: #8a94a3; }
.spread .cap { font: 10px var(--mono); color: var(--tx2); }
html.dark .spread .cap { color: var(--tx2); }
.spread .cap .cr { color: var(--ink); }
/* gang plan */
.gangv { position: absolute; inset: 0; overflow: auto; padding: 14px 16px; background: var(--panel2); display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-content: start; }
.plancard { border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); padding: 10px 12px; cursor: pointer; }
.plancard.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.plancard b { display: block; font-size: 12.5px; }
.plancard .big { font: 600 20px var(--mono); margin: 4px 0; }
.plancard .m { font: 10.5px var(--mono); color: var(--tx3); }
.lockedview { position: absolute; inset: 0; display: grid; place-items: center; background: var(--plan); }
.lockedview .lockedtab { background: var(--panel); }
@media (max-width: 760px) {
  .menu, .doctitle { display: none; }
  .side.left, .side.right, #splitL, #splitR { display: none; }
  .gangv { grid-template-columns: 1fr; }
}
@media print { .menubar, .ribbon, .side, .dock, .status, .vtabs { display: none !important; } }

/* ---- Earthworks views ---- */
.viewhost { flex: 1; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: hidden; }
.plancanvas { display: block; position: absolute; inset: 0; outline: none; touch-action: none; }
.vtabs .chips { display: flex; align-items: center; gap: 4px; }
.vtabs .chips .lbl { margin-right: 4px; }
.chip { height: 22px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); color: var(--tx2); font-size: 11px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--sel); border-color: var(--acc); color: var(--tx); font-weight: 600; }
.viewbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.viewbar .lbl { margin-left: 6px; }
.viewbar .btn svg { width: 14px; height: 14px; vertical-align: -2px; }
.secwrap { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.seccard { border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); overflow: hidden; flex: none; }
.seccard.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.sechead { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.sechead .mono { font: 11px var(--mono); }
.seccanvas { display: block; width: 100%; height: 240px; }
.stage3d { flex: 1; min-height: 0; position: relative; }
.stage3d canvas { display: block; position: absolute; inset: 0; cursor: grab; }
.cut { color: var(--cut); } .fill { color: var(--fill); }
.status .cut { color: #ffab73; } .status .fill { color: #8fb8ff; }
.dim { color: var(--tx3); }
.status .dim { color: #8b8574; }
.status .sepb { width: 1px; height: 12px; background: #3a3628; flex: none; }
.doctitle .dirty { color: var(--acc); }
.form2 { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.form2 label, label.chk { display: flex; align-items: center; gap: 6px; }
.dialog .wide, .dialog .db .wide { min-width: min(640px, 80vw); max-height: 60vh; overflow: auto; }
.dialog input[type=text] { height: 26px; border: 1px solid var(--line2); border-radius: 6px; padding: 0 7px; background: var(--panel); color: var(--tx); }

table.grid.mini { width: calc(100% - 12px); margin: 4px 6px; table-layout: fixed; }
table.grid.mini th, table.grid.mini td { padding: 3px 3px; font-size: 10.5px; }
table.grid.mini th:first-child, table.grid.mini td:first-child { width: 26px; }
table.grid.mini th:last-child, table.grid.mini td:last-child { width: 26px; }
.prow .pair { display: flex; gap: 4px; align-items: center; }
.pbtns { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
tr.tmp td { color: var(--tx2); font-style: italic; }

.split2 { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 0; min-height: 100%; }
.balside { border-left: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; }
.balside .big { font: 700 20px var(--ui); } .balside .big.ok { color: var(--ok); } .balside .big.cut { color: var(--cut); } .balside .big.fill { color: var(--fill); }
.balside .btn { align-self: flex-start; }
table.grid tr.sec td { background: var(--tint); font: 600 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tx2); padding-top: 7px; }
table.grid tr.sub td { color: var(--tx2); }
table.grid tr.tot td { font-weight: 700; border-top: 1px solid var(--line2); }
table.grid.bill td:nth-child(2) { white-space: normal; min-width: 280px; }
.cols2 { columns: 2; column-gap: 18px; margin: 8px 0; } .cols2 label { display: flex; break-inside: avoid; padding: 2px 0; }
.dialog h3 { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--tx3); margin: 12px 0 4px; }
table.grid.mats input, table.grid.mats select { font-size: 10.5px; padding: 0 3px; }
.split2 > .scrollx { overflow: auto; min-width: 0; align-self: start; }
.split2 > .scrollx table.grid { width: 100%; }
