/* One Line - application chrome. The sheet itself is styled by the renderer.

   Everything is scoped under .ol-root so the whole stylesheet can be loaded into Sparky
   QC without touching the host page. There is no @page rule here on purpose - see the
   note in js/app.js about printing. */

.ol-root {
  --accent: #2E9BE8;        /* the Sparky blue, from the mark */
  --caution: #E8A33D;       /* needs attention - NOT the accent */
  --redline: #DC0E2F;       /* the red from the wordmark, reserved for QC marks */
  --cable: #1163d6;
  --ok: #00c2a8;
  --radius: 3px;
  --rail: 78px;
  --side: 372px;
}

.ol-root[data-theme="black"] { --bg:#000000; --panel:#0b0d10; --panel2:#141821; --line:#242a33; --text:#e9eef5; --dim:#8b97a6; --field:#171c24; }
.ol-root[data-theme="dark"] { --bg:#12161A; --panel:#181e27; --panel2:#202833; --line:#2c3542; --text:#e9eef5; --dim:#93a1b3; --field:#232c38; }
.ol-root[data-theme="slate"] { --bg:#2b333f; --panel:#333c4a; --panel2:#3d4756; --line:#4a5566; --text:#eef2f7; --dim:#b3bfcd; --field:#46515f; }
.ol-root[data-theme="gray"] { --bg:#9aa3ae; --panel:#e7ebf0; --panel2:#f2f5f8; --line:#c3cbd5; --text:#1b2129; --dim:#5b6673; --field:#ffffff; }
.ol-root[data-theme="light"] { --bg:#e8ecf1; --panel:#ffffff; --panel2:#f4f7fa; --line:#d6dde6; --text:#161b22; --dim:#5d6773; --field:#ffffff; }

.ol-root, .ol-root * { box-sizing: border-box; }
.ol-root [hidden] { display: none !important; }

.ol-root {
  height: 100%; margin: 0;
  font: 13px/1.45 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg);
  overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto;
}

/* ---------- top bar ---------- */
.ol-root #topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.ol-root .brand { display: flex; align-items: baseline; gap: 7px; user-select: none; }
.ol-root .brand .mark { width: 25px; height: 25px; flex: none; transform: translateY(5px); }
.ol-root .brand .mark svg { width: 100%; height: 100%; display: block; }
.ol-root .brand .name { font-weight: 800; letter-spacing: 1.6px; font-size: 14px; }
.ol-root .brand .sub { color: var(--dim); font-size: 11px; letter-spacing: .4px; }

.ol-root .group { display: flex; align-items: center; gap: 6px; }
.ol-root .group.grow { margin-left: auto; }

.ol-root .btn {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 5px 11px; cursor: pointer; white-space: nowrap;
}
.ol-root .btn:hover { background: var(--field); border-color: var(--accent); }
.ol-root .btn.primary { background: var(--accent); border-color: var(--accent); color: #0d1520; font-weight: 700; }
.ol-root .btn.primary:hover { filter: brightness(1.08); }
.ol-root .btn.sm { padding: 3px 8px; font-size: 12px; }
.ol-root .btn.danger:hover { border-color: var(--redline); color: var(--redline); }

.ol-root .fld { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); }
.ol-root .fld > span { text-transform: uppercase; letter-spacing: .6px; }
.ol-root select, .ol-root input[type="text"], .ol-root input[type="number"],
.ol-root input:not([type]), .ol-root textarea {
  font: inherit; color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: 2px; padding: 4px 6px;
}
.ol-root select:focus, .ol-root input:focus, .ol-root textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ol-root input[type="checkbox"] { accent-color: var(--accent); }
.ol-root input[type="range"] { accent-color: var(--accent); }

/* Working in redline for an hour and forgetting which state you are in is the failure
   this guards against, so the chrome says so as well as the sheet. */
.ol-root.mode-redline #modeWrap > span,
.ol-root.mode-asbuilt #modeWrap > span { color: var(--redline); font-weight: 700; }
.ol-root.mode-redline #selMode,
.ol-root.mode-asbuilt #selMode { border-color: var(--redline); color: var(--redline); font-weight: 700; }
.ol-root.mode-redline #stage { box-shadow: inset 0 0 0 3px var(--redline); }
.ol-root.mode-asbuilt #stage { box-shadow: inset 0 0 0 3px var(--ok); }

/* ---------- main ---------- */
.ol-root #main { display: flex; min-height: 0; }

.ol-root #toolrail {
  width: var(--rail); flex: 0 0 var(--rail);
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; padding: 8px 6px; overflow-y: auto;
}
.ol-root .tool {
  display: grid; gap: 2px; justify-items: center;
  padding: 7px 2px; border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--dim); font: inherit; cursor: pointer;
}
.ol-root .tool b { font-size: 15px; line-height: 1; font-weight: 800; }
.ol-root .tool span { font-size: 10px; letter-spacing: .2px; }
.ol-root .tool:hover { background: var(--panel2); color: var(--text); }
.ol-root .tool.active { background: var(--accent); color: #0d1520; border-color: var(--accent); }
.ol-root .tool.cable b { color: var(--cable); }
.ol-root .tool.redline b { color: var(--redline); }
.ol-root .tool.active b { color: inherit; }
.ol-root .tool.ghost { color: var(--dim); }
.ol-root .railgap { flex: 1; }

/* ---------- stage ---------- */
.ol-root #stage { position: relative; flex: 1; min-width: 0; background: var(--bg); overflow: hidden; }
.ol-root #canvas { width: 100%; height: 100%; display: block; cursor: default; }
.ol-root #canvas:focus { outline: none; }
.ol-root.tool-add #canvas, .ol-root.tool-feed #canvas { cursor: crosshair; }
.ol-root.tool-cable #canvas, .ol-root.tool-redline #canvas,
.ol-root.tool-note #canvas, .ol-root.tool-revtri #canvas,
.ol-root.tool-cloud #canvas, .ol-root.tool-hl #canvas { cursor: crosshair; }
.ol-root.tool-pan #canvas { cursor: grab; }
.ol-root #sheetHost { filter: drop-shadow(0 6px 22px rgba(0,0,0,.45)); }
.ol-root .ol-hit { cursor: pointer; }
.ol-root .ol-hit-lbl { cursor: move; }

.ol-root #sheetTabs {
  position: absolute; left: 10px; bottom: 10px; display: flex; gap: 5px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line); border-radius: 4px; padding: 5px;
  max-width: calc(100% - 20px); overflow-x: auto;
}
.ol-root .sheetTab {
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 2px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--dim);
  cursor: pointer; white-space: nowrap;
}
.ol-root .sheetTab.active { background: var(--accent); color: #0d1520; border-color: var(--accent); font-weight: 700; }

.ol-root #inlineEdit {
  position: absolute; z-index: 20; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 3px; padding: 6px;
  box-shadow: 0 8px 26px rgba(0,0,0,.4);
}
.ol-root #inlineEdit input { width: 200px; }
.ol-root #inlineEdit .hint { font-size: 10px; color: var(--dim); margin-top: 4px; }

/* ---------- side panel ---------- */
.ol-root #side {
  width: var(--side); flex: 0 0 var(--side); background: var(--panel);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
.ol-root .tabs { display: flex; border-bottom: 1px solid var(--line); }
.ol-root .tab {
  flex: 1; font: inherit; font-size: 11px; padding: 8px 2px; cursor: pointer;
  background: none; border: none; border-bottom: 2px solid transparent; color: var(--dim);
}
.ol-root .tab:hover { color: var(--text); }
.ol-root .tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }
.ol-root .panes { flex: 1; min-height: 0; overflow-y: auto; }
.ol-root .pane { display: none; padding: 12px; }
.ol-root .pane.active { display: block; }

.ol-root h4 {
  margin: 16px 0 8px; font-size: 10.5px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--dim); font-weight: 700;
}
.ol-root h4:first-child { margin-top: 0; }

.ol-root .row { display: grid; grid-template-columns: 118px 1fr; gap: 6px; align-items: center; margin-bottom: 6px; }
.ol-root .row > label { font-size: 11.5px; color: var(--dim); }
.ol-root .row > select, .ol-root .row > input, .ol-root .row > textarea { width: 100%; }
.ol-root .row.wide { grid-template-columns: 1fr; }
.ol-root .rowflex { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }

/* A number with its unit beside it. An unlabelled box asking for 480 and one asking for
   22000 look identical, and getting those two the wrong way round is not a small error. */
.ol-root .unitrow { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ol-root .unitrow input { flex: 1; min-width: 0; }
.ol-root .unitrow .u { font-size: 10px; color: var(--dim); letter-spacing: .4px; white-space: nowrap; }
.ol-root .triple { display: flex; align-items: center; gap: 5px; min-width: 0; }
.ol-root .triple input { width: 100%; min-width: 0; }
.ol-root .triple .u { font-size: 10px; color: var(--dim); white-space: nowrap; }

.ol-root .check { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: 12px; }
.ol-root .muted { color: var(--dim); font-size: 11.5px; }
.ol-root .note { color: var(--dim); font-size: 11px; margin: 8px 0 0; line-height: 1.55; }
.ol-root .note b { color: var(--text); }
.ol-root .empty { color: var(--dim); font-size: 12px; padding: 22px 6px; text-align: center; }
.ol-root .ok-note {
  color: var(--text); font-size: 11.5px; line-height: 1.5; margin: 0 0 8px;
  border-left: 3px solid var(--ok); padding: 7px 9px; background: var(--panel2);
}

/* ---------- findings ----------
   The checks are what this tool has that a drawing program does not, so they get real
   presentation: severity in the border, the rule underneath, the numbers in the text. */
.ol-root .finding {
  border-left: 3px solid var(--caution); padding: 7px 9px; margin-bottom: 7px;
  background: var(--panel2); border-radius: 0 2px 2px 0;
}
.ol-root .finding.over { border-left-color: var(--redline); }
.ol-root .finding .fhd { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ol-root .finding .fhd b { font-size: 9.5px; letter-spacing: 1px; color: var(--caution); }
.ol-root .finding.over .fhd b { color: var(--redline); }
.ol-root .finding .ftext { font-size: 11.5px; line-height: 1.5; margin: 3px 0; }
.ol-root .finding .muted { font-size: 10px; font-family: Consolas, "Courier New", monospace; }

.ol-root ul.plainlist { margin: 0; padding-left: 18px; }
.ol-root ul.plainlist li { font-size: 11px; color: var(--dim); line-height: 1.5; margin-bottom: 3px; }
.ol-root ul.plainlist.warn li { color: var(--caution); }

/* equipment palette */
.ol-root .parts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.ol-root .part {
  font: inherit; font-size: 11px; text-align: left; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: 2px; background: var(--panel2);
  color: var(--text); cursor: pointer; line-height: 1.3;
}
.ol-root .part:hover { border-color: var(--accent); }
.ol-root .part.active { background: var(--accent); color: #0d1520; border-color: var(--accent); font-weight: 700; }

/* schedule tables */
.ol-root table.sched { width: 100%; border-collapse: collapse; font-size: 11px; }
.ol-root table.sched th {
  text-align: left; color: var(--dim); font-size: 9.5px; letter-spacing: .6px;
  text-transform: uppercase; border-bottom: 1px solid var(--line); padding: 5px 4px;
}
.ol-root table.sched td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ol-root table.sched td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* sheets list */
.ol-root .sheetRow {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; margin-bottom: 5px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--panel2);
}
.ol-root .sheetRow.active { border-color: var(--accent); }
.ol-root .sheetRow .nm { flex: 1; font-size: 12px; min-width: 0; }
.ol-root .sheetRow .no { color: var(--dim); font-size: 11px; min-width: 20px; }
.ol-root .sheetRow .elev { width: 78px; flex: none; font-size: 11px; }
/* Grade is the one level that means something structural, so the row says so as well as
   the sheet. */
.ol-root .sheetRow.grade { border-left: 3px solid var(--text); }
.ol-root .sheetRow .check span { font-size: 10px; color: var(--dim); }

.ol-root .speclist { display: grid; gap: 6px; }
.ol-root .specRow { border: 1px solid var(--line); border-radius: 3px; padding: 8px; background: var(--panel2); }
.ol-root .specRow .hd { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 6px; }
.ol-root .specRow .hd b { font-size: 12px; }

/* ---------- status ---------- */
.ol-root #status {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px;
  background: var(--panel); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim);
}
.ol-root #status .spacer { flex: 1; }
.ol-root .chip {
  padding: 2px 8px; border-radius: 20px; background: var(--panel2);
  border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* The check count is the one number in the chrome worth colouring, because it is the one
   that means somebody has to do something. */
.ol-root .chip.good { color: var(--ok); border-color: var(--ok); }
.ol-root .chip.warn { color: var(--caution); border-color: var(--caution); }
.ol-root .chip.bad { color: var(--redline); border-color: var(--redline); font-weight: 700; }
.ol-root #statusText { color: var(--text); }
