  :root {
    --bg: #14171d; --panel: #1c2028; --panel2: #232833; --line: #2f3643;
    --text: #dfe5ee; --muted: #8d98a8; --accent: #4aa8ff; --accent2: #ffd24a; --bad: #ff6b6b;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body { background: var(--bg); color: var(--text); font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
    display: grid; grid-template: 46px minmax(0, 1fr) auto / 300px 1fr 300px; overflow: hidden; }
  header { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 0 10px;
    background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
  header .brand { font-weight: 700; letter-spacing: .5px; margin-right: 8px; color: var(--accent); }
  header .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
  header .grow { flex: 1; }
  button, select, input { font: inherit; color: var(--text); }
  button { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; cursor: pointer; }
  button:hover { border-color: var(--accent); }
  button.on { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
  button kbd { opacity: .55; font: 10px monospace; margin-left: 4px; }
  select, input[type=number], input[type=text], input[type=date] { color-scheme: dark; background: #12151b; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; min-width: 0; }
  input.bad { border-color: var(--bad); }
  input:focus, select:focus { outline: 1px solid var(--accent); }
  aside { background: var(--panel); overflow-y: auto; padding: 10px; }
  aside.left { border-right: 1px solid var(--line); }
  aside.right { border-left: 1px solid var(--line); }
  h3 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); display: flex; align-items: center; }
  h3:first-child { margin-top: 0; }
  h3 button { margin-left: auto; padding: 1px 7px; font-size: 11px; text-transform: none; letter-spacing: 0; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .prim { text-align: left; }
  .list { display: flex; flex-direction: column; gap: 3px; }
  .row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; border: 1px solid transparent; cursor: pointer; }
  .row:hover { background: var(--panel2); }
  .row.sel { border-color: var(--accent); background: var(--panel2); }
  .row .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
  .row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row .ic { background: none; border: none; padding: 0 3px; color: var(--muted); }
  .row .ic:hover { color: var(--text); }
  .row.hidden .nm { opacity: .4; }
  .field { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 6px; margin-bottom: 4px; }
  .field label { color: var(--muted); }
  .field .grid3 input { width: 100%; padding: 4px 3px; appearance: textfield; -moz-appearance: textfield; }
  .field .grid3 input::-webkit-inner-spin-button { display: none; }
  .field input, .field select { width: 100%; }
  .empty { color: var(--muted); font-style: italic; padding: 4px 0; }
  .kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
  .kv span:nth-child(odd) { color: var(--muted); }
  .kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
  .meas { border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; display: flex; gap: 8px; align-items: flex-start; }
  .meas .t { color: var(--muted); font-size: 11px; }
  .meas .v { color: var(--accent2); font-weight: 600; font-variant-numeric: tabular-nums; }
  .meas .d { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
  .meas .body { flex: 1; min-width: 0; }
  .check { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
  input[type=range] { width: 100%; accent-color: var(--accent); }
  #viewport { position: relative; overflow: hidden; min-width: 0; min-height: 0; }
  #viewport canvas { display: block; }
  #viewport .labels { position: absolute; inset: 0; pointer-events: none; }
  .mlabel { background: rgba(20, 23, 29, .88); color: var(--accent2); border: 1px solid var(--accent2); border-radius: 4px;
    padding: 1px 6px; font: 600 12px "Segoe UI", system-ui, sans-serif; white-space: nowrap; }
  .mlabel.b { color: #6fe3ff; border-color: #6fe3ff; }
  #hint { position: absolute; left: 10px; bottom: 10px; background: rgba(20, 23, 29, .85); border: 1px solid var(--line);
    border-radius: 5px; padding: 5px 10px; pointer-events: none; max-width: calc(100% - 20px); }
  #hint.warn { border-color: var(--bad); color: var(--bad); }
  header button[data-tip] { padding: 5px 6px; display: inline-flex; align-items: center; flex: none; }
  header button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
  header button svg .f { fill: currentColor; stroke: none; opacity: .55; }
  #tip { position: fixed; z-index: 50; display: none; background: #0d1015; border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px;
    max-width: 260px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
  #tip b { color: var(--accent); } #tip kbd { font: 11px monospace; border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 6px; color: var(--muted); }
  #tip span { color: var(--muted); display: block; }
  .row.grp { font-weight: 600; background: #171b22; margin-top: 3px; }
  .row.grp .cnt { color: var(--muted); font-weight: 400; font-size: 11px; }
  .row.child { margin-left: 14px; }
  #err { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 30px; text-align: center; color: var(--bad); }
  /* 4D dock */
  #dock { grid-column: 1 / -1; background: var(--panel); border-top: 1px solid var(--line); min-width: 0; }
  .simbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; overflow-x: auto; white-space: nowrap; }
  .simbar .grow { flex: 1; } .simbar input[type=range] { width: 260px; flex: 1 1 200px; min-width: 120px; }
  .simbar button { flex: none; }
  #simStatus { padding: 0 10px 5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #simStatus b { color: var(--text); font-weight: 600; }
  #gantt { max-height: 190px; overflow: auto; border-top: 1px solid var(--line); }
  #gantt.folded { display: none; }
  .grow-row, .ghead { display: grid; grid-template-columns: 150px 96px 118px 118px 150px 84px 96px 48px 54px minmax(160px, 1fr) 24px; gap: 4px; align-items: center; padding: 2px 10px; min-width: 1180px; }
  .ghead { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; position: sticky; top: 0; background: var(--panel); z-index: 1; padding-top: 5px; }
  .grow-row input, .grow-row select { width: 100%; padding: 2px 4px; font-size: 12px; }
  .grow-row .lk { font-size: 11px; color: var(--muted); cursor: pointer; text-align: center; } .grow-row .lk.bad { color: var(--bad); }
  .gbar { position: relative; height: 14px; background: #12151b; border-radius: 3px; overflow: hidden; }
  .gbar i { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; background: #3a4a63; overflow: hidden; }
  .gbar i b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
  .keyrow { display: flex; align-items: center; gap: 6px; padding: 1px 0; font-variant-numeric: tabular-nums; }
  .keyrow span { flex: 1; }
  /* guided tutorial */
  #tutSpot { position: fixed; z-index: 90; display: none; border-radius: 7px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(5, 8, 12, .62), 0 0 0 2px var(--accent2); }
  #tutCard { position: fixed; z-index: 91; display: none; width: 350px; max-width: calc(100vw - 24px); background: var(--panel2); border: 1px solid var(--accent2); border-radius: 8px;
    padding: 14px 16px 12px; box-shadow: 0 10px 34px rgba(0, 0, 0, .6); line-height: 1.5; }
  #tutCard h4 { margin: 0 26px 8px 0; font-size: 15px; color: var(--accent2); }
  #tutCard .body b { color: #fff; }
  #tutCard .x { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--muted); padding: 2px 6px; }
  #tutCard .foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
  #tutCard .foot .n { color: var(--muted); font-size: 11px; margin-right: 4px; }
  #tutCard .act { border-color: var(--accent); color: var(--accent); }
