/* overview.css — the overview page only.
 *
 * Loaded after style.css and costs.css and borrows from both: cards, the
 * .fig tiles and table.runs are the cost report's, so it reads as the same
 * tool. The diagram's colours are the --sv-* variables below (and --eq-*,
 * written by js/overview.js from the presets), because @media print swaps
 * them for a palette that works on white paper.
 */

:root {
  --sv-ink: #e6e9ef; --sv-dim: #98a1b3; --sv-panel: #1b1f27; --sv-tray: #161a21;
  --sv-line: #2f3644; --sv-ac: #ffa94d; --sv-dc: #4dd2ff; --sv-badge-ink: #04121f;
  --sv-warn: #ffd166; --sv-net: #b197fc;
}

#ov { height: 100%; display: flex; flex-direction: column; }

#ovbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
#ovbar h1 { margin: 0; font-size: 16px; font-weight: 600; }
#ovbar .sub { color: var(--ink-dim); font-size: 11px; }
#ovbar .dim { color: var(--ink-dim); }

/* the sidebar pages' nav, laid out in a row */
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.topnav a {
  text-decoration: none; font-size: 11px; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 9px; color: var(--ink-dim);
}
.topnav a:hover { background: #2c3340; color: var(--ink); }
.topnav a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

#src { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 11.5px; flex-wrap: wrap; }
#src .chips { margin-left: 0; }
#src button:disabled { opacity: .4; cursor: default; }
.psel {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px;
  color: var(--ink-dim); font: inherit; font-size: 11px; padding: 2px 8px; max-width: 220px;
}
.psel.on { border-color: var(--accent); color: var(--ink); }
#srcNote b { font-weight: 600; }
.pbtn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
  color: var(--ink); font: inherit; font-size: 11.5px; padding: 3px 11px; cursor: pointer;
}
.pbtn:hover { border-color: var(--accent); }

#printHead { display: none; }

#stage {
  flex: 1; min-height: 0; overflow: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
#stage a { color: var(--accent); }
#stagebody { display: flex; flex-direction: column; gap: 10px; }

/* ---------- the site layout page ---------- */

.pchk { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-dim); cursor: pointer; }
.pchk input { margin: 0; }
.sitecard { align-self: center; }
.sitecard h3 .chips { margin-left: auto; }
/* A4 landscape's printable area under the header, at 96 dpi */
#sitemap { width: 1040px; height: 640px; max-width: 100%; border-radius: 4px; background: #0e1116; }
#sitemap .leaflet-control-attribution { font-size: 9px; }

/* ---------- count strip ---------- */

.ovfigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.ovfig { display: flex; align-items: center; gap: 10px; }
.ovfig .mini { flex: 0 0 auto; }
.ovfig .val { color: var(--ink); }
/* not .warn: style.css gives that class padding and a margin of its own */
.ovfig.attn { border-color: #6b5a24; }
.ovfig.attn .val { color: #ffd166; }

/* ---------- diagram beside table ---------- */

.ovsplit { display: grid; grid-template-columns: minmax(0, 1fr) 600px; gap: 10px; align-items: start; }
/* the runs and, when shown, the network: one column that stays in view */
.tblcol { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; min-width: 0; }
.sldwrap { overflow: auto; }
svg.sld { display: block; max-width: 100%; height: auto; }   /* Fit: a wide plan shrinks to the card */
svg.sld.full { max-width: none; }                             /* 100 %: full size, the card scrolls */
.netbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
svg.sld text { user-select: none; }
#stage.live .run, #stage.live .node { cursor: pointer; }
@media (max-width: 1250px) {
  .ovsplit { grid-template-columns: minmax(0, 1fr); }
  .tblcol { position: static; }
}

.legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line); font-size: 10.5px; color: var(--ink-dim);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* hover a run in either place: everything else steps back */
#stage.hl-on svg.sld .run { opacity: .22; transition: opacity .12s; }
#stage.hl-on svg.sld .run.hl { opacity: 1; }
#stage.nhl-on svg.sld .net { opacity: .25; }
#stage.nhl-on svg.sld .net.hl { opacity: 1; }
#stage svg.sld .net.hl polyline:not(.hit), #stage svg.sld .net.hl path:not(.hit) { stroke-width: 3 !important; }

/* ---------- the data network ---------- */

.netbar { margin-left: auto; }
.netstatus {
  font-size: 11.5px; margin: -2px 0 8px; padding: 5px 9px; border-radius: 4px;
  background: #1f1b2e; border-left: 2px solid var(--sv-net); color: var(--ink);
}
.netstatus .dim { color: var(--ink-dim); }
#stage.netedit svg.sld g.node.netok { cursor: pointer; }
#stage.netedit svg.sld g.node.nonet { opacity: .35; }
#stage.netedit svg.sld g.net { cursor: pointer; }
#stage.netedit svg.sld g.run { opacity: .55; }
#stage.netedit svg.sld g.net:hover polyline:not(.hit),
#stage.netedit svg.sld g.net:hover path:not(.hit) { stroke: var(--danger) !important; }
.nnum {
  display: inline-block; min-width: 26px; text-align: center; border-radius: 8px;
  font-size: 9.5px; font-weight: 700; padding: 0 5px; color: #04121f; background: var(--sv-net);
}
.med {
  display: inline-block; border-radius: 3px; font-size: 10px; font-weight: 700; padding: 0 5px;
  border: 1px solid; color: var(--sv-net); border-color: #5f4b8b;
}
.med.fibre { color: #04121f; background: var(--sv-net); border-color: var(--sv-net); }
.med[data-med] { cursor: pointer; }

.costcard h3 .dim { margin-left: auto; color: var(--ink); letter-spacing: 0; font-size: 12px; }
.costcard .bom { margin-top: 0; }
table.ovt td .bad, table.ovt tfoot .bad { color: #ffd166; }
#stage svg.sld .run.hl line:not(.hit) { stroke-width: 3 !important; }
table.ovt tr.hl td { background: #1d2430; }

/* ---------- the run table ---------- */

table.ovt td.nm { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
table.ovt tr[data-run] { cursor: default; }
#stage.live table.ovt tr[data-run] { cursor: pointer; }
table.ovt td.many { color: var(--ink); font-weight: 700; }
table.ovt tfoot td { border-bottom: 0; border-top: 1px solid var(--line); padding-top: 6px; }
.rnum {
  display: inline-block; min-width: 26px; text-align: center; border-radius: 8px;
  font-size: 9.5px; font-weight: 700; padding: 0 5px; color: var(--sv-badge-ink);
}
.rnum.ac { background: var(--sv-ac); }
.rnum.dc { background: var(--sv-dc); }
.mat {
  display: inline-block; min-width: 24px; text-align: center; border-radius: 3px;
  font-size: 10px; font-weight: 700; padding: 0 4px; border: 1px solid;
}
.mat.cu { color: #e8a272; border-color: #7a4a2a; }
.mat.al { color: #c3ccd6; border-color: #4f5966; }
.mat.ex { color: var(--ink-dim); border-color: var(--line); border-style: dashed; font-weight: 600; }
.laid .mth {
  display: inline-block; min-width: 22px; margin-right: 6px; color: var(--ink-dim);
  font-size: 10px; font-weight: 700;
}

/* ---------- paper ----------
 * Light, A4 landscape, diagram above the table. Everything interactive goes;
 * the source and the print date come in through #printHead. */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  :root {
    --sv-ink: #111; --sv-dim: #555; --sv-panel: #fff; --sv-tray: #f6f6f6;
    --sv-line: #bbb; --sv-ac: #d9480f; --sv-dc: #1c7ed6; --sv-badge-ink: #fff;
    --sv-warn: #b35c00; --sv-net: #6741d9;
    --ink: #111; --ink-dim: #555; --line: #ccc; --panel: #fff; --panel-2: #fff;
  }
  html, body { height: auto; overflow: visible; background: #fff; color: #111; }
  #ov { height: auto; display: block; }
  #ovbar { display: none; }
  /* page 1: the site, alone under the header; the rest starts on page 2 */
  .sitecard { break-after: page; break-inside: avoid; border: 0; padding: 0; }
  .sitecard h3 .chips, .sitecard .hint, #sitemap .leaflet-control-zoom { display: none; }
  #sitemap { max-width: none; }
  #printHead { display: block; margin: 0 0 8px; }
  #printHead h1 { margin: 0; font-size: 17px; }
  #printHead div { font-size: 10.5px; color: #555; }
  #stage { overflow: visible; padding: 0; display: block; }
  #stage > * + * { margin-top: 8px; }
  .ovsplit { display: block; }
  .ovsplit > * + * { margin-top: 8px; }
  .card, .fig { background: #fff; border-color: #ccc; break-inside: avoid; }
  /* one row of tiles, and a diagram that fits under it on page 1; the table
   * gets page 2 */
  /* always ONE row, however many types the plan has: a second row pushes the
   * diagram onto page 2 */
  .ovfigs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; }
  .ovfig { gap: 5px; padding: 5px 6px; }
  .ovfig .mini { width: 20px; height: 20px; }
  .ovfig .lbl { font-size: 7.5px; letter-spacing: .05em; }
  .ovfig .val { font-size: 15px; }
  .ovfig .sub { font-size: 8.5px; }
  .fig .sub { white-space: normal; }
  svg.sld, svg.sld.full { max-height: 128mm; max-width: 100%; width: auto; margin: 0 auto; }
  .fig .lbl, .card h3 { color: #555; }
  .ovfig .val { color: #111; }
  .ovfig.attn { border-color: #d9a400; }
  .ovfig.attn .val { color: #9c6b00; }
  .tblcol { position: static; display: block; }
  .tblcol > * + * { margin-top: 8px; }
  .netbar, .netstatus { display: none; }
  .med.fibre { color: #fff; }
  .bom .b.noprice .e, .bom .bn-warn { color: #9c6b00; }
  .bom .bn-dim { color: #555; }
  .costcard { break-inside: avoid; }
  .costcard .hint { display: none; }
  .nnum { color: #fff; }
  .sldwrap { overflow: visible; }
  table.runs th { color: #555; border-bottom-color: #bbb; }
  table.runs td { border-bottom-color: #e2e2e2; }
  table.ovt tr { break-inside: avoid; }
  table.ovt td.nm { max-width: none; }
  table.ovt td.many { color: #111; }
  .mat.cu { color: #8a4a1e; border-color: #c9926a; }
  .mat.al { color: #444; border-color: #aaa; }
  #stage.hl-on svg.sld .run { opacity: 1; }
  /* edit mode and hovering are for the screen: paper gets the plain drawing */
  #stage.netedit svg.sld g.node.nonet, #stage.netedit svg.sld g.run,
  #stage.nhl-on svg.sld .net { opacity: 1; }
  table.ovt tr.hl td { background: none; }
  .legend { border-top-color: #ccc; }
}
