/* =====================================================================
   REDESIGN · PART 6 (19 Oct 2026)
   whole-site electrical path · protection one-line (ETAP view) · switchgear relay + trend calculator
   ===================================================================== */

/* ---------- ELECTRICAL PATH · whole site, top to bottom ---------- */
.ep { display: flex; flex-direction: column; gap: 14px; }
.ep-kp { align-items: center; padding: 10px 14px; background: var(--c1); border: 1px solid var(--ln); border-radius: 12px; margin: 0; }
.ep-all { margin-left: auto; cursor: pointer; font-family: var(--disp); font-size: 11px; letter-spacing: .1em; padding: 6px 14px; border-radius: 7px; border: 1px solid var(--ln2); background: none; color: #c9d3dc; }
.ep-all:hover { border-color: var(--copper); color: #fff; }
.ep-cols { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); align-items: start; }
.ep-bus { display: flex; flex-direction: column; min-width: 0; }
.ep-gens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ep-gen { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: linear-gradient(145deg, #17212b, #111920); border: 1px solid #2c3b4a; }
.ep-gs { grid-row: span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #0e151b; border: 1px solid #3a4c5e; }
.ep-gs svg { width: 30px; height: 30px; fill: none; stroke: #6fb0ff; stroke-width: 2; stroke-linecap: round; }
.ep-gen b { font-family: var(--disp); font-size: 17px; letter-spacing: .08em; color: #fff; }
.ep-gen em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: #9fb0bf; }
.ep-drop { width: 3px; height: 22px; margin: 0 auto; background: linear-gradient(#5d6f82, #b0161c); }
.ep-busbar { display: flex; flex-direction: column; gap: 3px; padding: 11px 18px; border-radius: 9px; background: linear-gradient(90deg, #8e1720, #c3242d 55%, #a31b24); box-shadow: 0 8px 22px -12px #e0384a; }
.ep-busbar b { font-family: var(--disp); font-size: 15px; letter-spacing: .12em; color: #fff; font-weight: 600; }
.ep-busbar span { font-family: var(--mono); font-size: 11.5px; color: #ffd9dc; text-transform: none; }
.ep-feeders { margin: 0 0 0 30px; padding: 14px 0 0 22px; border-left: 4px solid #b0161c; display: flex; flex-direction: column; gap: 12px; }
.ep-f { position: relative; background: #0f161c; border: 1px solid var(--ln); border-left: 4px solid var(--fc); border-radius: 12px; }
.ep-f::before { content: ''; position: absolute; left: -26px; top: 25px; width: 22px; border-top: 4px solid #b0161c; }
.ep-f summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; }
.ep-f summary::-webkit-details-marker { display: none; }
.ep-f summary i { width: 12px; height: 12px; border-radius: 3px; background: var(--fc); flex: none; }
.ep-f summary b { font-family: var(--disp); font-size: 16px; font-weight: 500; letter-spacing: .06em; color: #fff; }
.ep-f summary .mw { font-family: var(--mono); font-size: 15px; color: #fff; }
.ep-f summary .meta { font-family: var(--mono); font-size: 11px; color: #9fb0bf; text-transform: none; }
.ep-f summary .meta em { font-style: normal; color: var(--amber); }
.ep-f summary u { margin-left: auto; text-decoration: none; color: #9fb0bf; transition: transform .25s; }
.ep-f:not([open]) summary u { transform: rotate(-90deg); }
.ep-f summary:hover { background: color-mix(in srgb, var(--fc) 8%, transparent); border-radius: 11px; }
.ep-f[open] > .tv { animation: tabIn .3s ease both; }
.ep-tie { margin-top: 118px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ep-tie i { width: 100%; border-top: 3px dashed #c9a227; }
.ep-tie b { font-family: var(--disp); font-size: 10.5px; letter-spacing: .14em; color: #c9a227; text-align: center; line-height: 1.3; }
@media (max-width: 1250px) { .ep-cols { grid-template-columns: 1fr; gap: 18px; } .ep-tie { margin: 0; flex-direction: row; } .ep-tie i { flex: 1; width: auto; } }

/* vertical tree boxes (same boxes as the plant page's Electrical Path) */
.tv { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.tv-n { position: relative; }
.tv-kids { margin-left: 16px; padding-left: 18px; border-left: 2px solid color-mix(in srgb, var(--fc) 70%, transparent); display: flex; flex-direction: column; gap: 7px; padding-top: 7px; }
.tv-kids > .tv-n::before { content: ''; position: absolute; left: -18px; top: 24px; width: 16px; border-top: 2px solid color-mix(in srgb, var(--fc) 70%, transparent); }
.tv-out { display: block; font-family: var(--mono); font-size: 10px; color: var(--kk); margin: 0 0 2px 2px; letter-spacing: .06em; }
.tv-card { display: flex; align-items: center; gap: 12px; background: var(--c1); border: 1px solid var(--ln); border-radius: 10px; padding: 9px 12px; cursor: pointer; transition: border-color .2s, background .2s, transform .15s; }
.tv-card:hover { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 9%, var(--c1)); transform: translateX(2px); }
.tv-card.feed, .tv-card.swg { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 14%, var(--c1)); cursor: default; }
.tv-card.rmu { border-color: color-mix(in srgb, var(--fc) 50%, var(--ln)); }
.tv-card.grp { border-style: dashed; }
.tv-card.tie { border: 1px dashed #c9a227; background: #1a1610; }
.tv-b { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tv-b small { font-family: var(--disp); font-size: 9.5px; letter-spacing: .14em; color: var(--kk); }
.tv-b b { font-size: 13.5px; font-weight: 600; text-transform: none; }
.tv-b b u { text-decoration: none; font-family: var(--mono); font-size: 10px; color: #c9a227; }
.tv-b em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: #9aa6b2; text-transform: none; }
.tv-bar { height: 5px; border-radius: 3px; background: var(--ln); overflow: hidden; margin-top: 3px; max-width: 260px; }
.tv-bar i { display: block; height: 100%; }
.tv-bar i.ok { background: var(--mint); } .tv-bar i.md { background: var(--amber); } .tv-bar i.hi { background: var(--rose); }
.tv-card strong { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.tv-card strong.ok { color: var(--mint); } .tv-card strong.md { color: var(--amber); } .tv-card strong.hi { color: var(--rose); } .tv-card strong.na { color: var(--kk); }
.tv-sym { display: flex; flex-direction: column; flex: none; }
.tv-sym i { width: 16px; height: 16px; border-radius: 50%; border: 1.6px solid #9aa6b2; margin-top: -5px; }
.tv-sym i:first-child { margin-top: 0; }
.tv-card.md .tv-sym i { border-color: var(--amber); } .tv-card.hi .tv-sym i { border-color: var(--rose); }
.tv-rmu { width: 22px; height: 22px; border: 1.6px solid var(--fc); border-radius: 3px; display: grid; place-items: center; color: var(--fc); font-size: 15px; flex: none; }
.tv-feed { width: 5px; align-self: stretch; border-radius: 2px; background: var(--fc); flex: none; }
.tv.bare { padding-top: 0; }

/* ---------- PROTECTION ONE-LINE (ETAP view): bigger type, every relay's settings on the drawing ---------- */
.et-wrap { padding: 14px; }
.et-svg { min-width: 1500px; }
.et-svg .et-bl { font-size: 14px; letter-spacing: .04em; }
.et-svg .et-lb { font-size: 12.5px; }
.et-svg .et-lb.b { font-size: 13.5px; }
.et-svg .et-lt { font-size: 10.5px; }
.et-svg .et-rt { font-size: 10px; }
.et-svg .et-fl { font-size: 11.5px; }
.et-svg .et-ft { font-size: 11.4px; }
.et-svg .et-ft.b { font-size: 12px; }
.et-svg .et-ft.big { font-size: 22px; }
.et-svg .et-ft.sm { font-size: 10.5px; fill: #666; }
.et-svg .et-ft.ph { fill: #7a4a00; }
.et-svg .et-ft.ea { fill: #4a2fb0; }
.et-svg .et-ft.hot { fill: #c00; font-weight: 700; }
.et-svg .et-div { stroke: #d0d4da; stroke-width: 1; }
.et-svg .et-ct-t { font-size: 10.5px; fill: #5a2fb0; }
.et-svg .et-flag { stroke-width: 1.4; }
.et-svg .et-hit:hover .et-flag { stroke-width: 2; }
.et-where { font-size: 14px; }
.et-howto { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 14px; border: 1px dashed var(--ln2); border-radius: 10px; font-size: 12px; color: #b4c0cc; text-transform: none; }
.et-howto b { color: #fff; font-family: var(--mono); font-weight: 600; }
.et-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.et-g { padding: 10px 14px; border-radius: 10px; background: var(--c1); border: 1px solid var(--ln); border-left: 4px solid var(--mint); font-size: 12px; color: #c9d3dc; text-transform: none; }
.et-g.bad { border-left-color: var(--rose); }
.et-g.warn { border-left-color: var(--amber); }
.et-g b { display: block; font-family: var(--disp); font-size: 11px; letter-spacing: .12em; color: #fff; margin-bottom: 3px; }

.et-svg text { text-transform: none; }
#flowTabRow.compact { padding: 6px 28px; }
#flowTabRow.compact .rail1 { padding-bottom: 6px; gap: 8px; }
#flowTabRow.compact .rail-ws { padding: 5px 12px 5px 8px; border-radius: 11px; }
#flowTabRow.compact .rail-st { display: none; }
#flowTabRow.compact .rail-ic { width: 30px; height: 30px; border-radius: 9px; }
#flowTabRow.compact .rail-ic svg { width: 16px; height: 16px; }
#flowTabRow.compact .rail1 #homeTab { flex-direction: row; padding: 4px 12px; gap: 8px; border-radius: 11px; }
#flowTabRow.compact .rail1 #homeTab svg { width: 18px; height: 18px; }
#flowTabRow.compact .rail2 { padding: 5px 8px; margin-top: 0; }
#flowTabRow.compact .rail2 .mode-tab { padding: 5px 12px 5px 10px; }

/* whole-site path nodes */
.tp-node.bus .tp-box { fill: #3a1216; stroke: #d3242d; stroke-width: 1.6; }
.tp-node.bus { cursor: default; }
.tp-feed { fill: var(--fc); }
.tp-node.bus .tp-feed { fill: #ff4a55; }
.tp-node.gen .tp-box { fill: #12202e; stroke: #4a8fd9; }
.tp-node.gen { cursor: default; }
.tp-gc { fill: #0e151b; stroke: #6fb0ff; stroke-width: 1.6; }
.tp-gs { fill: none; stroke: #6fb0ff; stroke-width: 1.6; }
.tp-svg.tp-site { max-width: none !important; }
.et-svg .et-ft { font-size: 10.8px; } .et-svg .et-ft.b { font-size: 11.6px; } .et-svg .et-ft.sm { font-size: 10px; }

/* whole-site path: a window with always-visible scroll bars, drag to pan */
.tp-wrap .tp-scroll:has(.tp-site) { max-height: 78vh; overflow: scroll; cursor: grab; border: 1px solid var(--ln); border-radius: 10px; background: #0d1318; scrollbar-width: auto; scrollbar-color: #5d6f82 #151d25; }
.tp-wrap .tp-scroll:has(.tp-site).panning { cursor: grabbing; user-select: none; }
.tp-scroll:has(.tp-site)::-webkit-scrollbar { width: 14px; height: 14px; }
.tp-scroll:has(.tp-site)::-webkit-scrollbar-track { background: #151d25; }
.tp-scroll:has(.tp-site)::-webkit-scrollbar-thumb { background: #5d6f82; border-radius: 8px; border: 3px solid #151d25; }
.tp-scroll:has(.tp-site)::-webkit-scrollbar-thumb:hover { background: #8aa0b5; }

/* published version: no sample-data banners or toggles */
.gn-banner, .swm-banner, .swg-banner { display: none !important; }

/* company logo in the header (no box, it shines on its own) */
.hd-logo { width: 74px !important; height: 74px !important; background: none !important; box-shadow: none !important; border-radius: 0 !important; }
.hd-logo img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 10px rgba(140,175,255,.45)); }
.hd-sub { padding-left: 88px !important; }
header h1 { align-items: center; }
.m-logo { background: none !important; box-shadow: none !important; width: 40px !important; height: 40px !important; }
.m-logo img { width: 100%; height: 100%; display: block; }

.hd-logo { width: 86px !important; height: 76px !important; border-radius: 12px !important; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.5), 0 6px 22px -6px rgba(140,175,255,.6) !important; }
.hd-logo img { filter: none !important; }
.hd-sub { padding-left: 100px !important; }
.m-logo { width: 46px !important; height: 41px !important; border-radius: 8px !important; overflow: hidden; }

/* logo centred against title + subtitle, wider */
header h1 { display: grid !important; grid-template-columns: auto 1fr; column-gap: 20px; row-gap: 4px; align-items: center; }
.hd-logo { grid-row: 1 / span 2; width: 128px !important; height: 92px !important; }
.hd-name { grid-column: 2; align-self: end; }
.hd-sub { grid-column: 2; padding-left: 0 !important; align-self: start; flex-basis: auto; }

/* ---------- table headers: the title sits exactly over its numbers (the sort arrow no longer takes width) ---------- */
.pt thead th { position: sticky; }
.pt thead th u { position: absolute; top: 50%; transform: translateY(-50%); margin: 0 !important; line-height: 1; }
.pt thead th.r u { left: 3px; }
.pt thead th.c u { right: 2px; }
.pt thead th:not(.r):not(.c):not(.num) u { right: 4px; }
.pt thead th.sort:not(.r):not(.c):not(.num) { padding-right: 24px; }
.pt thead th.r { padding-left: 16px; }
.pt thead th.num u { display: none; }


/* ---------- HOME 3 Nov: P / Q / S gauges, per-plant P·Q·S·PF tiles, ranked lists without bars ---------- */
.ic { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ic-card.ic-p { --g: #e07a3f; } .ic-card.ic-q { --g: #4fd1b5; } .ic-card.ic-s { --g: #5aa9e6; }
.ic-card.ic-p, .ic-card.ic-q, .ic-card.ic-s { background: linear-gradient(180deg, color-mix(in srgb, var(--g) 9%, var(--c1)), var(--c1) 70%); border-top: 3px solid var(--g); }
.ic-card.ic-p .k, .ic-card.ic-q .k, .ic-card.ic-s .k { color: var(--g); font-weight: 600; }
.ic-card.ic-p .ic-arc, .ic-card.ic-q .ic-arc, .ic-card.ic-s .ic-arc { stroke: var(--g); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--g) 55%, transparent)); }
.ic-card.ic-q .s b.t { color: var(--mint); }

.hp-tile { gap: 8px; padding: 12px 12px 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 8%, var(--c1)), var(--c1) 65%); }
.hp-tile .n em { display: block; font-style: normal; font-size: 9.5px; letter-spacing: .1em; color: #8b98a5; font-weight: 400; }
.hp-tile .pq { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; }
.hp-tile .pq em, .hp-tile .sq em { display: block; font-style: normal; font-size: 8.5px; letter-spacing: .12em; color: #8b98a5; }
.hp-tile .p b { font-family: var(--mono); font-size: 25px; font-weight: 600; color: #e07a3f; text-shadow: 0 0 12px rgba(224,122,63,.35); }
.hp-tile .p i, .hp-tile .sq i { font-style: normal; font-size: 10.5px; color: #8b98a5; margin-left: 3px; }
.hp-tile .sq { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hp-tile .sq > span { background: rgba(255,255,255,.035); border-radius: 6px; padding: 5px 7px; border-left: 3px solid; }
.hp-tile .sq .q { border-color: #4fd1b5; } .hp-tile .sq .s { border-color: #5aa9e6; }
.hp-tile .sq b { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.hp-tile .sq .q b { color: #4fd1b5; } .hp-tile .sq .s b { color: #5aa9e6; }
.pfm { width: 66px; height: 50px; flex: none; overflow: visible; }
.pfm .tr, .pfm .zn { fill: none; stroke-width: 5; stroke-linecap: round; } .pfm .tr { stroke: var(--ln2, #26313b); }
.pfm.good .zn { stroke: #3fcf8e; } .pfm.mid .zn { stroke: #e8a53a; } .pfm.bad .zn { stroke: #e0566a; }
.pfm .nd { stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; } .pfm .hb { fill: var(--text); }
.pfm text { font: 600 9.5px var(--mono); fill: var(--text); }

/* ranks: medals + chips (no bars) */
.hp-lst button { grid-template-columns: 26px minmax(0, 1.3fr) auto 70px; }
.rk-r { grid-template-columns: 34px minmax(0, 1.4fr) 104px 96px; }
.hp-lst .rk, .rk-r .no { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ln2, #2c3945); color: #9aa6b2; font-family: var(--mono); font-size: 11.5px; font-weight: 600; text-align: center; box-sizing: border-box; }
.hp-lst .rk.m1, .rk-r .no.m1 { background: radial-gradient(circle at 35% 30%, #ffe08a, #d9a21b); border-color: #f3c64a; color: #3b2a00; box-shadow: 0 0 10px rgba(243,198,74,.45); }
.hp-lst .rk.m2, .rk-r .no.m2 { background: radial-gradient(circle at 35% 30%, #f1f4f7, #a5afb9); border-color: #d6dde3; color: #1f2830; }
.hp-lst .rk.m3, .rk-r .no.m3 { background: radial-gradient(circle at 35% 30%, #f0b27a, #b2672a); border-color: #d98b4a; color: #2c1500; }
.hp-lst .chip, .rk-r .chip { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; text-align: center; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
@media (max-width: 1100px) { .ic { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- plant tiles, simplified (3 Nov, second pass) ---------- */
.hp-tiles { gap: 14px; }
.hp-tile { gap: 14px; padding: 16px 16px 14px; }
.hp-tile .th { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hp-tile .th .n em { margin-top: 3px; }
.hp-tile .tr { font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.hp-tile .tr.ok { color: var(--mint); } .hp-tile .tr.md { color: var(--amber); } .hp-tile .tr.hi { color: var(--rose); } .hp-tile .tr:empty { display: none; }
.hp-tile .p { display: block; }
.hp-tile .p b { font-size: 32px; line-height: 1; }
.hp-tile .p i { font-size: 12px; margin-left: 5px; }
.hp-tile .p em { display: block; margin-top: 5px; font-style: normal; font-size: 9px; letter-spacing: .14em; color: #8b98a5; }
.hp-tile .qsf { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ln); padding-top: 12px; }
.hp-tile .qsf > span { display: flex; flex-direction: column; gap: 2px; padding: 0 0 0 10px; border-left: 1px solid var(--ln); min-width: 0; }
.hp-tile .qsf > span:first-child { border-left: none; padding-left: 0; }
.hp-tile .qsf em { font-style: normal; font-size: 10px; letter-spacing: .12em; font-weight: 600; }
.hp-tile .qsf b { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.hp-tile .qsf i { font-style: normal; font-size: 9.5px; color: #8b98a5; }
.hp-tile .qsf .q em, .hp-tile .qsf .q b { color: #4fd1b5; } .hp-tile .qsf .s em, .hp-tile .qsf .s b { color: #5aa9e6; }
.hp-tile .qsf .f em { color: #8b98a5; } .hp-tile .qsf .f.good b { color: #3fcf8e; } .hp-tile .qsf .f.mid b { color: #e8a53a; } .hp-tile .qsf .f.bad b { color: #e0566a; }
@media (max-width: 1500px) { .hp-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .hp-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .hp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- plant tiles, third pass: always 5 + 5, four clear boxes P / Q / S / P.F. ---------- */
.hp-tiles, .hp-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 10px; }
.hp-tile { padding: 12px; gap: 10px; }
.hp-tile .g4 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hp-tile .g4 > span { display: flex; flex-direction: column; gap: 1px; padding: 8px 9px; border-radius: 8px; background: rgba(255,255,255,.04); border-top: 2px solid; min-width: 0; border-left: none; }
.hp-tile .g4 em { font-style: normal; font-size: 8.5px; letter-spacing: .1em; color: #8b98a5; white-space: nowrap; }
.hp-tile .g4 b { font-family: var(--mono); font-size: 18px; font-weight: 600; line-height: 1.2; }
.hp-tile .g4 i { font-style: normal; font-size: 9.5px; color: #8b98a5; }
.hp-tile .g4 .p { border-color: #e07a3f; background: rgba(224,122,63,.1); } .hp-tile .g4 .p b { color: #e07a3f; font-size: 20px; text-shadow: none; display: block; }
.hp-tile .g4 .p i { margin: 0; font-size: 9.5px; }
.hp-tile .g4 .q { border-color: #4fd1b5; } .hp-tile .g4 .q b { color: #4fd1b5; }
.hp-tile .g4 .s { border-color: #5aa9e6; } .hp-tile .g4 .s b { color: #5aa9e6; }
.hp-tile .g4 .f.good { border-color: #3fcf8e; } .hp-tile .g4 .f.good b { color: #3fcf8e; }
.hp-tile .g4 .f.mid { border-color: #e8a53a; } .hp-tile .g4 .f.mid b { color: #e8a53a; }
.hp-tile .g4 .f.bad { border-color: #e0566a; } .hp-tile .g4 .f.bad b { color: #e0566a; }
.ic-card.ic-p .s, .ic-card.ic-q .s, .ic-card.ic-s .s { margin-top: 0; min-height: 3em; padding-top: 6px; border-top: 1px solid var(--ln); line-height: 1.5; white-space: nowrap; }
