/* ============================================================
   NEW STYLE - PHONE LAYER (<= 760 px). Loaded after newstyle.css. Desktop is untouched.
   Bottom bar instead of the left rail, compact header, vertical single-line Home, one-column pages.
   ============================================================ */
/* the More sheet exists only on a phone: hidden everywhere else */
#nsMore { display: none !important; }
@media (min-width: 761px) { #nsMore, #nsMoreBtn { display: none !important; } }
@media (max-width: 760px) {
  #nsMore.on { display: block !important; }
  body.ns { padding-left: 0 !important; padding-bottom: 76px; font-size: 15px; }

  /* ----- bottom bar ----- */
  body.ns .ns-rail { flex-direction: row; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 64px; padding: 0 4px calc(env(safe-area-inset-bottom) * .5); gap: 0; align-items: stretch; justify-content: space-around; overflow: visible; box-shadow: 0 -6px 20px rgba(11, 58, 74, .35); }
  body.ns .ns-rail button { flex: 1; width: auto; height: auto; min-width: 0; border-left: 0 !important; border-top: 3px solid transparent; gap: 4px; }
  body.ns .ns-rail button span { font-size: 10.5px; }
  body.ns .ns-rail button svg { width: 24px; height: 24px; }
  body.ns .ns-rail button.on, body.ns .ns-rail button.ph-more-btn.on { border-top-color: #35d0c0; background: #0f4d61; color: #fff; }
  .ns-rail .ph-more-item { display: none !important; }

  /* ----- More sheet ----- */
  #nsMore { position: fixed; inset: 0; z-index: 80; }
  #nsMore .bg { position: absolute; inset: 0; background: rgba(8, 22, 38, .5); }
  #nsMore .sh { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 22px 22px 0 0; padding: 10px 14px calc(76px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); animation: nsUp .22s ease-out; }
  @keyframes nsUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
  #nsMore .gr { display: block; width: 44px; height: 5px; border-radius: 3px; background: #cfd9e0; margin: 2px auto 12px; }
  #nsMore .gd { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  #nsMore .gd button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 16px 6px 12px; background: #f3f6f8; border: 1.5px solid #d4dce2; border-radius: 16px; color: #0b3a4a; font: 700 12.5px 'Segoe UI', sans-serif; }
  #nsMore .gd svg { width: 30px; height: 30px; fill: none; stroke: #0b6fa8; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

  /* ----- header ----- */
  body.ns header { padding: 6px 12px; }
  body.ns .hd-top { gap: 8px; flex-wrap: nowrap; }
  body.ns .hd-logo img { height: 34px; }
  body.ns header h1 { gap: 8px; min-width: 0; font-size: 14px; letter-spacing: .02em; }
  body.ns header h1 .hd-sub, body.ns .hd-sub { display: none; }
  body.ns .ns-hdr { gap: 7px; margin-left: auto; flex: none; }
  body.ns .ns-hdr .mode b { display: none; } body.ns .ns-hdr .mode i { width: 11px; height: 11px; }
  body.ns .ns-hdr .clk { font-size: 13px; font-weight: 800; letter-spacing: .02em; }
  body.ns .ns-hdr button.usr { padding: 6px 8px; } body.ns .ns-hdr button.usr b { display: none; }
  body.ns .ns-hdr .cnt { padding: 4px 7px; font-size: 12px; }
  .ns-moon { width: 32px; height: 32px; }

  /* ----- page area ----- */
  body.ns #homeView, body.ns-lt #homeView, body.ns-lt #ldbView, body.ns-lt #swgView, body.ns-lt #pfView { padding: 10px 10px 24px; }
  #nsStub { padding: 10px; }
  .ns-card { padding: 10px 11px 9px; border-radius: 16px; }
  .ns-hd { flex-direction: column; align-items: stretch; gap: 8px; }
  .ns-hd h2 { font-size: 18px; } .ns-hd p { font-size: 13px; }
  .ns-seg { width: 100%; } .ns-seg button { flex: 1; padding: 9px 6px; }
  .ns-sub { padding: 8px 10px 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .ns-sub::-webkit-scrollbar { display: none; } .ns-sub button { flex: none; }

  /* ----- HOME (vertical single line) ----- */
  #nsHome .ns-tb { display: none; }
  .ph-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .ph-sw .sc { padding: 9px 10px; min-width: 0; } .ph-sw .sc b { font-size: 24px; } .ph-sw .sc .ch { width: 38px; height: 38px; font-size: 14px; flex: none; }
  .ph-bus { background: #fff; border: 1.5px solid #d4dce2; border-radius: 18px; padding: 12px 10px 12px; margin-bottom: 4px; }
  .ph-bus h3 { font: 800 12px 'Inter', 'Segoe UI', sans-serif; letter-spacing: .12em; color: #34566a; margin: 0 2px 10px; display: flex; justify-content: space-between; } .ph-bus h3 em { font-style: normal; color: #6b7f8c; }
  .ph-gens { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ph-gen { position: relative; background: linear-gradient(135deg, #1b5fa8, #37a3ec); color: #fff; border-radius: 16px; padding: 9px 10px 8px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; box-shadow: 0 6px 14px rgba(27, 95, 168, .28); }
  .ph-gen .e { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .16); border: 2px solid rgba(255, 255, 255, .35); display: flex; align-items: center; justify-content: center; } .ph-gen .e svg { width: 24px; height: 14px; }
  .ph-gen b { font: 800 13px 'Segoe UI'; letter-spacing: .04em; } .ph-gen strong { font: 800 22px/1 'Segoe UI'; font-variant-numeric: tabular-nums; grid-column: 2; } .ph-gen i { position: absolute; right: 10px; top: 9px; font: 700 10px 'Segoe UI'; font-style: normal; color: #d6ecff; }
  .ph-drop { width: 5px; height: 16px; margin: 0 auto; background: #111; position: relative; border-radius: 0 0 2px 2px; }
  .ph-drop::after { content: ''; position: absolute; left: 1.2px; top: 0; bottom: 0; width: 2.6px; background: repeating-linear-gradient(180deg, #fff 0 3px, transparent 3px 9px); opacity: .85; animation: nsPhDrop 1s linear infinite; } @keyframes nsPhDrop { to { background-position: 0 9px; } }
  .ph-bar { height: 14px; border-radius: 8px; background: linear-gradient(180deg, #0b3a4a, #145a70); box-shadow: 0 3px 8px rgba(11, 58, 74, .3); }
  .ph-pls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 8px; padding-top: 14px; }
  .ph-pl { position: relative; display: grid; grid-template-columns: 38px 1fr; column-gap: 8px; row-gap: 2px; align-items: center; text-align: left; background: #f7fafc; border: 1.5px solid color-mix(in srgb, var(--c) 35%, #d4dce2); border-radius: 14px; padding: 9px 9px 8px; min-width: 0; font-family: 'Segoe UI', sans-serif; }
  .ph-pl .stub { position: absolute; left: 50%; top: -15px; width: 4px; height: 15px; margin-left: -2px; background: #111; border-radius: 2px 2px 0 0; }
  .ph-pl .lg { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, #fff); border: 2px solid color-mix(in srgb, var(--c) 40%, #fff); display: flex; align-items: center; justify-content: center; }
  .ph-pl .lg svg { width: 22px; height: 22px; fill: none; stroke: var(--c); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .ph-pl .nm { font: 800 11px/1.15 'Segoe UI'; color: #14222c; letter-spacing: .01em; min-width: 0; padding-right: 10px; overflow-wrap: anywhere; }
  .ph-pl strong { font: 800 19px/1.1 'Segoe UI'; font-variant-numeric: tabular-nums; } .ph-pl strong em { font: 700 10px 'Segoe UI'; font-style: normal; color: #566b79; margin-left: 3px; }
  .ph-pl u { grid-column: 1 / 3; display: block; height: 5px; border-radius: 3px; background: #e3ebf1; margin-top: 5px; text-decoration: none; overflow: hidden; } .ph-pl u s { display: block; height: 100%; border-radius: 3px; }
  .ph-pl .dot { position: absolute; right: 8px; top: 8px; width: 9px; height: 9px; border-radius: 50%; }
  .ph-tie { display: flex; align-items: center; gap: 8px; padding: 6px 4px; } .ph-tie i { flex: 1; height: 5px; background: #111; border-radius: 3px; } .ph-tie span { font: 800 11px 'Segoe UI'; letter-spacing: .14em; color: #34566a; }

  /* ----- generic grids collapse ----- */
  .sw { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .ns-tb { display: flex !important; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; } .ns-tb::-webkit-scrollbar { display: none; } .ns-tb .tt { flex: none; width: 92px; }
  .nsph-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .tr-cards { grid-template-columns: repeat(2, 1fr); } .trc b { font-size: 21px; } .trc .r { display: none; }
  .tr-grid { grid-template-columns: 1fr; } .tr-pick { gap: 8px; } .tr-gr { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; } .tr-gr::-webkit-scrollbar { display: none; } .tr-chip { flex: none; }
  .tr-main { padding: 10px 8px; } .tr-tip { width: 210px; }
  .ef-kpi { grid-template-columns: repeat(2, 1fr); } .ef-grid { grid-template-columns: 1fr; }
  .tr-calc { gap: 6px 12px; font-size: 11.5px; } .tr-calc .t { margin-left: 0; width: 100%; }
}
@media (max-width: 760px) {
  body.ns header, body.ns .hd-top { max-width: 100vw; overflow: hidden; }
  body.ns header h1 { flex: 1 1 0; min-width: 0; font-size: 12px !important; line-height: 1.1; white-space: normal !important; letter-spacing: .02em; }
  body.ns .hd-logo img { height: 30px; }
  body.ns .ns-hdr { gap: 5px; }
  body.ns .ns-hdr .clk { font-size: 12px; } body.ns .ns-hdr .mode { display: none; }
  .ns-moon { width: 30px; height: 30px; } .ns-hdr .cnt { padding: 3px 6px; }
}
@media (max-width: 760px) {
  body.ns header h1 .hd-name { font-size: 12.5px !important; line-height: 1.1; letter-spacing: .03em; white-space: normal; min-width: 0; }
  /* bottom bar order = Home, Plants, Equipment, Trends, More */
  body.ns .ns-rail button[data-id="home"] { order: 1; } body.ns .ns-rail button[data-id="plants"] { order: 2; } body.ns .ns-rail button[data-id="equipment"] { order: 3; } body.ns .ns-rail button[data-id="trends"] { order: 4; } body.ns .ns-rail .ph-more-btn { order: 5; }
  /* vertical bus: a spine between the two columns, a short stub from each tile to it */
  .ph-pls { position: relative; column-gap: 20px !important; row-gap: 10px !important; padding-top: 12px !important; }
  .ph-pls::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 5px; margin-left: -2.5px; background: #111; border-radius: 0 0 3px 3px; }
  .ph-pls.odd::before { bottom: 46px; }
  .ph-pl { z-index: 1; }
  .ph-pl .stub { top: 50% !important; left: auto !important; width: 10px !important; height: 5px !important; margin: -2px 0 0 !important; border-radius: 0 !important; }
  .ph-pl:nth-child(odd) .stub { right: -11px; } .ph-pl:nth-child(even) .stub { left: -11px !important; }
}
@media (max-width: 760px) { body.ns .ns-hdr .clk { display: none; } }
@media (max-width: 760px) {
  .pl-tr { grid-template-columns: minmax(0, 1fr) !important; padding: 10px; border-left-width: 5px; }
  .nsph-top { gap: 10px; } .nsph-top .lg { width: 48px; height: 48px; border-width: 4px; } .nsph-top .lg svg { width: 26px; height: 26px; } .nsph-top h2 { font-size: 20px; } .nsph-top p { font-size: 12.5px; }
  .tfp strong, .rmf strong { font-size: 28px; }
  .pl-bc { flex-wrap: wrap; gap: 6px; } .pl-bc button { font-size: 12px; padding: 6px 9px; }
  .tf-grp h3 { font-size: 16px; flex-wrap: wrap; }
  .swf-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; } .swf-one-row { grid-template-columns: minmax(150px, 220px); }
}
@media (max-width: 760px) {
  /* P.F. page: table rows become two-line cards */
  .nspf-hd { display: none !important; }
  .nspf-r, .nspf-ck { grid-template-columns: 38px minmax(0, 1fr) auto !important; gap: 4px 10px !important; align-items: center; padding: 10px 4px !important; }
  .nspf-r > :nth-child(n+4), .nspf-ck > :nth-child(n+4) { grid-column: 2 / 4; text-align: left; }
  .nspf-pl { grid-template-columns: 38px minmax(0, 1fr) !important; gap: 6px 10px !important; }
  .nspf-pl .bars, .nspf-pl .nums { grid-column: 1 / 3; text-align: left !important; }
  .nspf-h { flex-direction: column; align-items: stretch; } .nspf-flt { flex-wrap: wrap; } .nspf-tot { gap: 14px; flex-wrap: wrap; }
  .nspf-grp { flex-wrap: wrap; gap: 6px 10px; } .nspf-grp span { margin-left: 0; }
  .nspf-df .in { flex-wrap: wrap; }
}
@media (max-width: 760px) { .ns-hd > * { flex: 0 0 auto !important; min-width: 0; } }

@media (max-width: 760px) { .view-switch { display: none !important; } }

@media (max-width: 760px) {
  /* the bar is a slider: 4 icons in view, swipe for the rest */
  body.ns .ns-rail { justify-content: flex-start !important; overflow-x: auto !important; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  body.ns .ns-rail::-webkit-scrollbar { display: none; }
  body.ns .ns-rail button { flex: 0 0 25% !important; scroll-snap-align: start; order: 0 !important; }
  .ns-rail .ph-more-item { display: block !important; }
  body.ns .ns-rail button { display: flex !important; }
}
.pl-dots { display: none; }
@media (max-width: 760px) {
  /* Plants: each transformer / RMU card is one slide; swipe to the next */
  .pl-slider { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -2px; padding-bottom: 4px; }
  .pl-slider::-webkit-scrollbar { display: none; }
  .pl-slider > .pl-tr { flex: 0 0 100%; scroll-snap-align: center; margin-bottom: 0; min-width: 0; }
  .pl-dots { display: flex; justify-content: center; gap: 7px; margin: 8px 0 14px; } .pl-dots i { width: 8px; height: 8px; border-radius: 50%; background: #c6d1d9; } .pl-dots i.on { background: #0b6fa8; width: 22px; border-radius: 5px; }
  .ns-tb { scroll-snap-type: x proximity; } .ns-tb .tt { scroll-snap-align: start; }
}
@media (max-width: 760px) {
  /* switchgear faceplates: P, Q, S, P.F. on each */
  .swf .pq { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 6px 0 2px; }
  .swf .pq > span { background: color-mix(in srgb, var(--g) 10%, #fff); border-left: 3px solid var(--g); border-radius: 6px; padding: 3px 5px; min-width: 0; text-align: left; }
  .swf .pq em { display: block; font: 800 8.5px 'Segoe UI'; font-style: normal; color: var(--g); letter-spacing: .06em; } .swf .pq b { font: 800 12px 'Segoe UI'; color: #14222c; font-variant-numeric: tabular-nums; }
  .swf-grid { grid-template-columns: 1fr !important; } .swf-one-row { grid-template-columns: 1fr !important; }
  .swf { min-height: 0; }

  /* the cubicle page: a short header, P Q S P.F., then a swipe menu (Trends, Measurements, Events, Fault records, Protection, Notes) */
  .fp-hd { padding: 12px 12px 10px !important; }
  .fp-hd .top { gap: 10px; flex-wrap: wrap; } .fp-hd .lg { width: 40px !important; height: 40px !important; flex: none; } .fp-hd .lg svg { width: 22px !important; height: 22px !important; }
  .fp-hd h2 { font-size: 17px !important; line-height: 1.15; } .fp-hd p { display: none !important; }
  .fp-hd .kps, .fp-hd .kps-pq { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 6px !important; margin-top: 8px; }
  .fp-hd .kp b { font-size: 22px !important; }
  .swp-nav { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; gap: 8px; padding: 8px 10px !important; scroll-snap-type: x proximity; scrollbar-width: none; position: sticky; top: 46px; z-index: 30; background: #fff; border-bottom: 1px solid #d4dce2; }
  .swp-nav::-webkit-scrollbar { display: none; }
  .swp-tab { flex: none !important; scroll-snap-align: start; white-space: nowrap; border-radius: 999px !important; padding: 9px 14px !important; font-size: 12px !important; }
  .fp-sec:has(> .fp-relay) { display: none !important; }      /* no REF615 front picture on the phone */
  .fp-body { display: block !important; } .fp-body > * { width: auto !important; margin-bottom: 10px; }
  .fp-main { padding: 8px 8px 16px !important; }
  .swf-nav { display: none; }
}
.zm { display: none; }
@media (max-width: 760px) {
  /* single line: the whole drawing, pinch / drag / buttons to zoom like a map */
  .zm { display: block; position: relative; overflow: hidden; touch-action: none; background: #fff; border: 1.5px solid #d4dce2; border-radius: 16px; margin-top: 8px; cursor: grab; }
  .zm-in { width: 1250px; transform-origin: 0 0; will-change: transform; }
  .zm-in .sl-wrap { width: 1250px; }
  .zm-bar { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
  .zm-bar button { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid #c6d1d9; background: rgba(255, 255, 255, .95); color: #0b3a4a; font: 800 20px/1 'Segoe UI'; box-shadow: 0 3px 10px rgba(11, 58, 74, .18); }
}

@media (max-width: 760px) {
  /* Plants: the content keeps its normal stacked view; only the plant cards at the top slide, one card at a time */
  .pl-slider { display: block; overflow: visible; margin: 0; padding: 0; }
  .pl-slider > .pl-tr { flex: none; margin-bottom: 14px; }
  .pl-dots { display: none !important; }
  .ns-tb { display: flex !important; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 18%; padding: 2px 18% 8px; margin: 0 -10px 4px; scrollbar-width: none; }
  .ns-tb::-webkit-scrollbar { display: none; }
  .ns-tb .tt { flex: 0 0 64% !important; width: auto !important; scroll-snap-align: center; scroll-snap-stop: always; min-height: 104px; }
}

/* ===== PHONE v2: no sideways scroll, one clear font, full header, gold slider bar ===== */
@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
  body.ns { -webkit-text-size-adjust: 100%; }
  body.ns > *, body.ns #nsStub, body.ns #homeView, body.ns #nsHome { max-width: 100%; min-width: 0; }
  /* one clear sans font everywhere (a phone has no 'Segoe UI', so it fell back to a thin serif) */
  body.ns, body.ns :where(*:not(svg):not(svg *)) { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important; }
  body.ns h1, body.ns h2, body.ns h3 { font-weight: 800; }

  /* ----- header: logo + title | profile + alerts, then date and time ----- */
  body.ns header { padding: 6px 12px 5px; overflow: visible; max-width: 100%; }
  body.ns .hd-top { display: flex !important; flex-wrap: wrap !important; align-items: center; gap: 3px 8px; max-width: 100%; overflow: visible !important; }
  body.ns header h1 { order: 1; flex: 1 1 0 !important; min-width: 0; display: flex !important; align-items: center; gap: 8px; margin: 0; font-size: 13px !important; }
  body.ns .hd-logo img { height: 32px; width: auto; display: block; }
  body.ns header h1 .hd-name { font-size: 13px !important; line-height: 1.12; letter-spacing: .04em; font-weight: 800; white-space: normal; }
  body.ns .ns-hdr { display: contents !important; }
  body.ns .ns-hdr button.usr { order: 2; display: inline-flex !important; padding: 6px 10px !important; gap: 5px; font-size: 12px; font-weight: 800; flex: none; }
  body.ns .ns-hdr button.usr b { display: inline !important; }
  body.ns .ns-hdr .cnt { order: 3; flex: none; padding: 6px 8px; font-size: 12px; border-radius: 999px; }
  body.ns .ns-hdr .mode { display: none !important; }
  body.ns .ns-moon { order: 4; flex: none; width: 32px; height: 32px; }
  body.ns .ns-hdr .clk { order: 5; display: block !important; flex: 1 1 100%; width: 100%; text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .02em; padding: 3px 2px 0; border-top: 1px solid #e3ebf1; margin-top: 2px; }

  /* ----- page area never wider than the screen ----- */
  .ns-card, .nsph-cards, .nsph-top, .ns-hd, .sw, .swf-grid, .pl-tr, .tf-grp, .fp-main { max-width: 100%; box-sizing: border-box; }
  img, canvas, svg { max-width: 100%; }
  .ns-tb { max-width: calc(100% + 20px); }

  /* ----- P Q S P.F. cards: the numbers always fit ----- */
  .sc { padding: 8px 9px !important; gap: 8px !important; min-width: 0; overflow: hidden; align-items: center; }
  .sc .ch { width: 34px !important; height: 34px !important; font-size: 13px !important; flex: none; }
  .sc > div, .sc > span:not(.ch) { min-width: 0; }
  .sc b { font-size: clamp(19px, 6.2vw, 25px) !important; line-height: 1.05; white-space: nowrap; letter-spacing: -.01em; }
  .sc i, .sc em { font-size: 11px !important; line-height: 1.2; font-style: normal; font-weight: 800; white-space: normal; overflow-wrap: anywhere; max-width: 100% !important; }
  .nsph-cards .sc, .nsph-cards > * { min-width: 0; }

  /* ----- Home: clearer generator cards ----- */
  .ph-gens { gap: 8px; }
  .ph-gen { padding: 10px 11px 9px; border-radius: 16px; }
  .ph-gen b { font-size: 15px; font-weight: 800; letter-spacing: .03em; }
  .ph-gen strong { font-size: 25px; font-weight: 800; letter-spacing: -.01em; }
  .ph-gen i { font-size: 11px; font-weight: 800; color: #e6f3ff; }
  .ph-bus h3 { font-size: 12.5px; }
  .ph-pl .nm { font-size: 12px; font-weight: 800; color: #0b2a38; }
  .ph-pl strong { font-size: 19px; font-weight: 800; }
  .ph-sw .sc b { font-size: clamp(20px, 6.4vw, 25px) !important; }
  .ph-tie span { font-size: 12px; }

  /* ----- bottom bar: always on screen, gold like the desktop, a slider that shows the next icon ----- */
  body.ns { padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important; }
  body.ns .ns-rail { position: fixed !important; left: 0; right: 0; bottom: 0; top: auto !important; z-index: 9500; height: calc(66px + env(safe-area-inset-bottom)) !important; padding: 5px 6px calc(env(safe-area-inset-bottom) + 4px) !important; gap: 4px !important; align-items: stretch; background: linear-gradient(90deg, #15337a 0%, #1c3f8f 100%) !important; border-top: 1px solid rgba(243, 213, 138, .45); box-shadow: 0 -8px 22px rgba(21, 51, 122, .38); scroll-padding: 0 6px; }
  body.ns .ns-rail button { flex: 0 0 calc(25% - 3px) !important; height: auto !important; margin: 0; border: 0 !important; border-radius: 14px !important; color: #dbe6ff !important; gap: 3px !important; background: transparent; transition: background .18s, color .18s, transform .18s; -webkit-tap-highlight-color: transparent; }
  body.ns .ns-rail button span { font-size: 11px !important; font-weight: 700; letter-spacing: .01em; }
  body.ns .ns-rail button svg { width: 24px !important; height: 24px !important; }
  body.ns .ns-rail button.on, body.ns .ns-rail button.ph-more-btn.on { background: linear-gradient(135deg, #f3d58a, #c9973a) !important; color: #15337a !important; border: 0 !important; box-shadow: 0 4px 12px rgba(201, 151, 58, .45); transform: translateY(-1px); }
  body.ns .ns-rail button.on svg { stroke-width: 2.2; }
  body.ns .ns-rail button:active { background: linear-gradient(135deg, #f3d58a, #c9973a) !important; color: #15337a !important; }
  body.ns .ns-rail hr { display: none; }
  /* soft edge so it is clear that the bar slides */
  body.ns::after { content: ''; position: fixed; right: 0; bottom: 0; width: 26px; height: calc(66px + env(safe-area-inset-bottom)); background: linear-gradient(90deg, rgba(28, 63, 143, 0), rgba(28, 63, 143, .85)); pointer-events: none; z-index: 9501; }
}
@media (max-width: 760px) {
  body.ns header h1 { flex-wrap: nowrap !important; grid-template-columns: none; }
  body.ns header h1 .hd-logo { flex: none; width: auto; display: block; }
  body.ns header h1 .hd-logo img { height: 34px !important; width: auto !important; }
  body.ns header h1 .hd-name { flex: 1 1 0; min-width: 0; font-size: 12.5px !important; }
  body.ns .ns-hdr button.usr { padding: 6px 9px !important; }
}
@media (max-width: 760px) {
  .ph-gen .e { width: 46px !important; height: 46px !important; background: none !important; border: 0 !important; border-radius: 0 !important; }
  .ph-gen .e svg { width: 46px !important; height: 46px !important; }
}
@media (max-width: 760px) {
  /* Trends control panel: time on top, all seven measures below in one even row (no half-hidden chips) */
  .tr-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .tr-dock { display: flex !important; flex-direction: column-reverse; gap: 8px; width: 100%; padding: 8px; border-radius: 18px; background: linear-gradient(180deg, #f3f6f8, #e9eff4); border: 1.5px solid #d4dce2; box-sizing: border-box; }
  .tr-qs { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; overflow: visible !important; flex: none !important; }
  .tr-q { min-width: 0 !important; padding: 11px 0 !important; font-size: 13px !important; border-radius: 12px !important; text-align: center; background: #fff; box-shadow: 0 1px 3px rgba(11, 58, 74, .12); }
  .tr-q.on { box-shadow: 0 5px 12px color-mix(in srgb, var(--c) 40%, transparent); transform: translateY(-1px); }
  .tr-tb { width: 100%; justify-content: center; padding: 12px 14px !important; border-radius: 14px !important; font-size: 13px !important; }
}
@media (max-width: 760px) { .tr-qs { width: 100%; box-sizing: border-box; } .tr-q { width: 100%; } }


/* ===== header v3 on the phone: row 1 = logo + title | avatar; row 2 = notification bar; row 3 = date and time ===== */
@media (max-width: 760px) {
  body.ns .ns-hdr { display: contents !important; }
  body.ns .ava-wrap { order: 2; flex: none; }
  body.ns .ava { width: 36px; height: 36px; }
  body.ns .ns-note { order: 4; flex: 1 1 100%; width: 100%; justify-content: stretch; position: static; }
  body.ns .nn-bar { width: 100%; padding: 5px 7px; }
  body.ns .nn-ic { width: 28px; height: 28px; } body.ns .nn-tx b { font-size: 12.5px; } body.ns .nn-tx span { font-size: 11px; }
  body.ns .ns-hdr .clk { order: 5 !important; }
  body.ns .nn-pop { position: fixed; left: 8px; right: 8px; top: 110px; transform: none; width: auto; max-height: 64vh; }
  body.ns .ava-menu { position: fixed; right: 8px; left: 8px; top: 56px; width: auto; }
  body.ns .ns-hdr .mode { display: flex !important; }
}

/* header v3 phone fix: keep the data-source label and the row order inside the profile menu */
@media (max-width: 760px) {
  body.ns .ava-menu .mode, body.ns .ava-menu .mode b { display: inline-flex !important; }
  body.ns .ava-menu .mode b { display: inline !important; }
  body.ns .ava-menu .cnt { order: 0 !important; padding: 4px 8px !important; font-size: 12px; }
  body.ns .ava-menu button.usr { order: 0 !important; padding: 10px 8px !important; }
  body.ns .ava-menu button.usr b, body.ns .ava-menu .mrow b { display: block !important; }
}


/* ===== cubicle faceplate on the phone: one column, key numbers 3 x 2, collapsible cards ===== */
@media (max-width: 760px) {
  .fp-hd .kps.kps6 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 5px !important; }
  .fp-hd .kps6 .kp { padding: 4px 7px !important; border-radius: 10px !important; } .fp-hd .kps6 .kp em { font-size: 8px !important; letter-spacing: .05em !important; } .fp-hd .kps6 .kp b { font-size: 17px !important; } .fp-hd .kps6 .kp b i { font-size: 9px !important; }
  .fp5 .fp-c1, .fp5 .fp-c2, .fp5 .fp-c3 { display: flex !important; flex-direction: column; gap: 8px; margin: 0 0 8px !important; }
  .fp5 .cd5 { padding: 0 !important; overflow: hidden; } .fp5 .cd5 > :not(h4) { margin-left: 12px; margin-right: 12px; } .fp5 .cd5 > :last-child { margin-bottom: 12px; }
  .fp5 .cd5 h4 { padding: 11px 12px 8px; margin: 0 !important; font-size: 12px !important; }
  .fp5 .cd5.acc > h4 { cursor: pointer; } .fp5 .cd5.acc > h4:after { content: "⌄"; margin-left: 8px; font-size: 16px; line-height: 1; transition: transform .2s; } .fp5 .cd5.acc.shut > h4:after { transform: rotate(-90deg); } .fp5 .cd5.acc.shut > h4 { padding-bottom: 11px; }
  .fp5 .cd5 h4 em { margin-left: auto; } .fp5 .cd5.shut > :not(h4) { display: none !important; }
  .fp6 .br { grid-template-columns: 34px minmax(0, 1fr) 78px; margin-top: 8px; margin-bottom: 8px; } .fp6 .br b { font-size: 13px; } .fp6 .br .tr { height: 12px; } .fp6 .br .v { font-size: 18px; } .fp6 .br .v u { font-size: 10px; }
  .fp6 .two { grid-template-columns: 1fr !important; } .fp6 .fqd { width: 150px; } .fp6 .sq span { font-size: 12px; }
  .fp6 .ens { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fp6 .en1 em { font-size: 11px; } .fp6 .en1 b { font-size: 16px; }
  .fp6 .fp-sld { padding: 0 0 6px; } .fp6 .fp-sld svg { width: 100%; max-height: none; height: auto; }
  .fp6 .lms { grid-template-columns: 1fr 1fr; }
  .fp6 .pl b { font-size: 12.5px; } .fp6 .p3 div { font-size: 10.5px; }
}

/* order on the phone: numbers first (currents, voltages), then protection, then single line and status */
@media (max-width: 760px) {
  .fp-body.fp5 { display: flex !important; flex-direction: column; padding: 0 !important; }
  .fp5 .fp-c2 { order: 1; } .fp5 .fp-c3 { order: 2; } .fp5 .fp-c1 { order: 3; }
}
@media (max-width: 760px) {
  .fp-body.fp5 { gap: 8px; } .fp5 .fp-c1, .fp5 .fp-c2, .fp5 .fp-c3 { display: contents !important; }
  .fp5 .fp-c2 .cd5 { order: 1; } .fp5 .fp-c2 .cd5[data-acc="en"] { order: 5; } .fp5 .fp-c3 .cd5 { order: 3; } .fp5 .fp-c1 .cd5[data-acc="sld"] { order: 6; } .fp5 .fp-c1 .cd5[data-acc="st"] { order: 7; }
}

/* 26 Nov 2026 - phone plant cards: every card the same size, name on at most two lines, the value never moves, the EST tag sits in the corner
   (before: the tag was inside the value line and pushed it out of the card; names wrapped to 1 or 2 lines so cards looked different and jumped) */
@media (max-width: 760px) {
  body .ph-pls { grid-auto-rows: 1fr; }
  body .ph-pl { min-height: 98px; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: 30px 24px 5px; row-gap: 3px; align-content: center; padding: 9px 9px 10px; overflow: visible; }
  body .ph-pl .nm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: normal; word-break: normal; font-size: 12px; line-height: 14px; max-height: 28px; padding-right: 14px; align-self: end; }
  body .ph-pl strong { display: block; white-space: nowrap; min-width: 0; align-self: start; font-size: 19px; line-height: 24px; font-variant-numeric: tabular-nums; }
  body .ph-pl strong em { margin-left: 3px; }
  body .ph-pl strong .est { position: absolute; right: 8px; bottom: 17px; margin: 0; padding: 1px 4px; font-size: 8px; line-height: 1.2; letter-spacing: .06em; }
  body .ph-pl u { margin-top: 0; height: 5px; align-self: end; }
  body .ph-pl u s { transition: width .5s ease; min-width: 0; }
  body .ph-gen strong { min-width: 3.4ch; font-variant-numeric: tabular-nums; }
  body .ph-gen .est { position: absolute; right: 10px; bottom: 8px; margin: 0; }
}

/* 27 Nov 2026 - phone: the Switchgear / Transformers header fits the screen (the segment was cut off at the right edge, the live badge was split in two lines) */
@media (max-width: 760px) {
  body .ns-hdr2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
  body .ns-hdr2 .ns-badge { white-space: nowrap; flex: 0 0 auto; }
  body .ns-hdr2 .ns-seg { flex: 1 1 100%; width: 100%; max-width: 100%; }
  body .ns-hdr2 .ns-seg button { flex: 1 1 50%; padding: 9px 4px; font-size: 11px; letter-spacing: .05em; white-space: nowrap; }
}

/* ---- 28 Nov: PHONE HOME - every card has its own coloured line to the bus, the generators too, and a bus coupler capsule ---- */
body .ph-pls { column-gap: 26px !important; }
body .ph-pl .stub { top: 50% !important; width: 12px !important; height: 6px !important; margin: -3px 0 0 !important; border-radius: 3px !important; background: var(--c) !important; box-shadow: 0 0 0 1.5px #fff; z-index: 2; }
body .ph-pl:nth-child(odd) .stub { right: -13px !important; left: auto !important; }
body .ph-pl:nth-child(even) .stub { left: -13px !important; right: auto !important; }
body .ph-gens { margin-bottom: 18px; }
body .ph-drop { display: none; }
body .ph-gen::after { content: ''; position: absolute; left: 50%; top: 100%; width: 6px; height: 18px; margin-left: -3px; background: #2f7fc1; border-radius: 0 0 3px 3px; }
body .ph-bar { position: relative; z-index: 0; }
.ph-cpl { display: flex; flex-direction: column; align-items: center; margin: 0 0 4px; }
.ph-cpl .ln { display: block; width: 6px; height: 14px; background: #111; border-radius: 3px; }
.ph-cpl .cap { width: 100%; box-sizing: border-box; background: #fff; border: 2px solid #1f7fd0; border-radius: 22px; padding: 8px 10px 9px; box-shadow: 0 6px 16px rgba(31, 127, 208, .18); }
.ph-cpl.no .cap { border-color: #8a9aa6; box-shadow: none; }
.ph-cpl .hd { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.ph-cpl .hd b { font: 800 12px 'Segoe UI', sans-serif; letter-spacing: .14em; color: #34566a; }
.ph-cpl .hd em { font: 800 11px 'Segoe UI', sans-serif; font-style: normal; letter-spacing: .08em; color: #1f7fd0; }
.ph-cpl.no .hd em { color: #8a9aa6; }
.ph-cpl .ar { display: inline-flex; width: 16px; height: 20px; color: #1f7fd0; } .ph-cpl .ar svg { width: 16px; height: 20px; }
.ph-cpl.dn .ar svg { transform: rotate(180deg); } .ph-cpl.no .ar { color: #8a9aa6; opacity: .5; }
.ph-cpl .vals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; text-align: center; }
.ph-cpl .vals div { min-width: 0; }
.ph-cpl .vals s { display: block; text-decoration: none; font: 800 10px 'Segoe UI', sans-serif; letter-spacing: .1em; color: #6b7f8c; }
.ph-cpl .vals strong { display: block; font: 800 17px/1.15 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ph-cpl .vals em { font: 700 9px 'Segoe UI', sans-serif; font-style: normal; color: #6b7f8c; margin-left: 2px; }
