:root {
  --red: #e4002b;
  --gold: #b8964e;
  --green: #2e8b4f;
  --green-d: #1f6b3a;
  --ink: #243240;
  --mut: #7c8a99;
  --line: #e4e8ee;
  --bg: #ffffff;
  --card: #fff;
  --panel: #f5f8f5;
  --warn: #e8a33d;
  --bad: #d8413a;
  --ok: #3fae6a;
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  height: 100%
}

body {
  font: 14px/1.45 "Segoe UI", system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink)
}

.hidden {
  display: none !important
}

button {
  font: inherit;
  cursor: pointer
}

/* ---- login ---- */
#login {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #4b5560
}

#login .box {
  background: #222a31;
  color: #dfe6ee;
  padding: 28px 30px;
  border-radius: 10px;
  width: 360px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4)
}

#login h2 {
  margin: 0 0 4px;
  color: #fff;
  font-weight: 600;
  text-align: center
}

#login .logo {
  text-align: center;
  margin-bottom: 14px
}

#login .logo img {
  height: 108px;
  width: auto;
  display: inline-block;
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  box-sizing: border-box
}

#login label {
  display: block;
  font-size: 12px;
  color: #9fb0bf;
  margin: 12px 0 4px
}

#login input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid #3a444d;
  background: #1a2127;
  color: #fff
}

#login button {
  width: 100%;
  margin-top: 18px;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: var(--gold);
  color: #1a1a1a;
  font-weight: 700
}

#login .err {
  color: #ff8a8a;
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px
}

#login .hint {
  font-size: 11px;
  color: #7c8a99;
  margin-top: 6px
}

/* ---- app shell ---- */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh
}

/* ===== dashboard selector (exact match to original Selector widget) ===== */
.ds-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 76px;
  min-height: 0;
  padding: 0 50px;
  box-sizing: border-box;
  background: #fff;
  gap: 16px;
  position: relative;
  border-bottom: 1px solid #ececef;
  flex-shrink: 0
}

.ds-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 1 auto;
  order: 0;
  min-height: 58px
}

.ds-logo {
  height: 100px;
  width: auto;
  align-self: center;
  object-fit: contain;
  margin: -11px 0
}

.ds-col {
  display: flex;
  flex-direction: column
}

.ds-col-store {
  justify-content: center
}

.ds-lbl {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #A1A1AA;
  text-align: center;
  margin: 0 0 6px 0;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box
}

.ds-store,
.ds-sel {
  font-weight: 600;
  font-size: 15px;
  padding: 6px 24px 6px 10px;
  color: #18181B;
  background-color: #FAFAFA;
  border: 1px solid #E4E4E7;
  border-radius: 6px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2371717A' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center
}

.ds-store {
  width: 200px
}

.ds-sel {
  font-weight: 500;
  color: #52525B;
  background-color: #fff
}

.ds-store:hover,
.ds-sel:hover {
  border-color: #D4D4D8;
  background-color: #F4F4F5
}

.ds-store:focus,
.ds-sel:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 95, 51, .12);
  border-color: #0F5F33
}

.dashboard-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
  flex: 1 1 auto;
  min-width: 0
}

.ds-tray {
  display: flex;
  align-items: center;
  background: #F4F4F5;
  border-radius: 10px;
  padding: 4px;
  gap: 2px
}

.dashboard-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 24px;
  font-size: 18px;
  font-weight: 500;
  color: #71717A;
  cursor: pointer;
  position: relative;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -.01em;
  border-radius: 8px;
  transition: all 150ms ease
}

.dashboard-pills:hover {
  color: #3F3F46;
  background-color: rgba(0, 0, 0, .05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .10)
}

.dashboard-pills.active {
  color: #18181B;
  font-weight: 600;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .14), 0 4px 10px rgba(0, 0, 0, .10)
}

.tws-inline {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  gap: 10px;
  min-height: 58px
}

.ds-lh-tray {
  display: inline-flex;
  align-items: stretch;
  background: #F4F4F5;
  border-radius: 7px;
  padding: 2px;
  margin-bottom: 6px;
  align-self: center;
  height: 24px;
  box-sizing: border-box
}

.ds-lh {
  font-size: 13px;
  font-weight: 600;
  color: #71717A;
  padding: 0 11px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  transition: all 120ms ease;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center
}

.ds-lh.active {
  background: #fff;
  color: #18181B;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06)
}

.ds-lh:not(.active):hover {
  color: #3F3F46
}

.ds-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C4C7C9;
  margin-right: 6px;
  vertical-align: -1px;
  transition: background 150ms ease
}

#segLive.active .ds-live-dot {
  background: #D32F2F;
  animation: tws-live-pulse 1.5s ease-in-out infinite
}

@keyframes tws-live-pulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(211, 47, 47, .5)
  }

  50% {
    opacity: .55;
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0)
  }
}

#tws-nav-group {
  display: flex;
  align-items: center;
  gap: 0
}

.ds-arrow {
  width: 29px;
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #71717A;
  user-select: none;
  border: 1px solid #E4E4E7;
  background: #fff;
  font-size: 12px;
  transition: all 120ms ease
}

#mPrev {
  border-radius: 6px 0 0 6px
}

#mNext {
  border-radius: 0 6px 6px 0
}

.ds-arrow:hover {
  background-color: #FAFAFA;
  border-color: #D4D4D8;
  color: #18181B
}

.ds-arrow.ds-arrow-disabled {
  opacity: .3;
  pointer-events: none;
  cursor: default
}

.tws-clickable { cursor: pointer }
.tws-clickable:hover { text-decoration: underline }

.fr-quicklink { cursor: pointer; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; transition: background 120ms ease }
.fr-quicklink:hover { background: #f1f5f3 }
.gen-quicklink { cursor: pointer; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; transition: background 120ms ease }
.gen-quicklink:hover { background: #f1f5f3 }
.row-flash { animation: rowFlash 1.6s ease-out }
@keyframes rowFlash { 0% { background: #fff7d6 } 100% { background: transparent } }

.cat-pie .seg { cursor: pointer; transform-box: view-box; transform-origin: 150px 118px; transition: transform .25s cubic-bezier(.34,1.56,.64,1) }
.cat-pie .seg:hover { transform: scale(1.06); animation: catPulse 1.8s ease-in-out .25s infinite }
@keyframes catPulse { 0%, 100% { transform: scale(1.055) } 50% { transform: scale(1.09) } }

#dpChart { position: relative }

.tws-dp { position: fixed; z-index: 1200; background: #fff; border: 1px solid #E4E4E7; border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.18); padding: 10px; width: 280px; font-family: 'Segoe UI',Roboto,system-ui,sans-serif; user-select: none }
.tws-dp-hd { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px }
.tws-dp-title { font-weight: 700; font-size: 14px; color: #18181B }
.tws-dp-nav { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; color: #52525B; font-size: 16px }
.tws-dp-nav:hover { background: #F4F4F5 }
.tws-dp-dow { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 4px }
.tws-dp-dow span { text-align: center; font-size: 11px; font-weight: 700; color: #A1A1AA; padding: 2px 0 }
.tws-dp-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px }
.tws-dp-empty { height: 32px }
.tws-dp-day { height: 32px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #3F3F46; cursor: pointer; border-radius: 6px }
.tws-dp-day:hover { background: #ECFDF3 }
.tws-dp-day.in { background: #E6F4EA; border-radius: 0 }
.tws-dp-day.sel { background: #1F8B4D; color: #fff; border-radius: 6px; font-weight: 700 }
.tws-dp-day.fut { color: #D4D4D8 }
.tws-dp-times { display: flex; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #EFEFF1 }
.tws-dp-tl { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 700; color: #A1A1AA; text-transform: uppercase; letter-spacing: .03em }
.tws-dp-time { border: 1px solid #E4E4E7; border-radius: 6px; padding: 5px 7px; font-size: 13px; color: #18181B; font-family: inherit; background: #fff }
.tws-dp-time:focus { outline: none; border-color: #1F8B4D }
.tws-dp-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px }
.tws-dp-btn { border: 0; background: #F4F4F5; color: #3F3F46; border-radius: 6px; padding: 6px 14px; font-weight: 600; cursor: pointer; font-size: 13px }
.tws-dp-btn.primary { background: #1F8B4D; color: #fff }
.tws-dp-btn:hover { filter: brightness(.97) }

.tws-range-label {
  font-size: 15px;
  font-weight: 600;
  color: #18181B;
  width: 190px;
  flex: 0 0 190px;
  text-align: center;
  cursor: pointer;
  letter-spacing: -.01em;
  padding: 0 4px;
  white-space: nowrap;
  position: relative;
  border-top: 1px solid #E4E4E7;
  border-bottom: 1px solid #E4E4E7;
  height: 29px;
  line-height: 29px;
  background: #fff
}

/* hover the (custom-range) date button to reveal the start/end times beneath it */
.tws-range-label.has-times:hover::after {
  content: attr(data-times);
  white-space: pre;
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, .94);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0;
  text-align: left;
  padding: 7px 12px;
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .24);
  z-index: 70;
  pointer-events: none
}
.tws-range-label.has-times:hover::before {
  content: "";
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(17, 24, 39, .94);
  z-index: 70;
  pointer-events: none
}

.ovbtn {
  border: 1px solid var(--line);
  background: #fff;
  color: #69788a;
  border-radius: 14px;
  padding: 3px 11px;
  font-size: 11px;
  margin-left: 5px;
  text-transform: none;
  letter-spacing: 0
}

.ovbtn.on {
  background: var(--green);
  color: #fff;
  border-color: var(--green)
}

.ovbtn {
  border: 1px solid var(--line);
  background: #fff;
  color: #69788a;
  border-radius: 14px;
  padding: 3px 11px;
  font-size: 11px;
  margin-left: 5px;
  text-transform: none;
  letter-spacing: 0
}

.ovbtn.on {
  background: var(--green);
  color: #fff;
  border-color: var(--green)
}

.exp-dd {
  position: relative;
  display: inline-block
}

.exp-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .14);
  z-index: 50;
  min-width: 170px;
  overflow: hidden
}

.exp-menu.hidden {
  display: none
}

.exp-menu>div {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink)
}

.exp-menu>div:hover {
  background: #f4f6f8
}

.exp-menu .material-icons {
  font-size: 18px;
  color: #69788a
}

/* custom report — paged document builder */
.pb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px
}

.pb-rtitle {
  font-size: 16px;
  font-weight: 700;
  margin-right: 6px
}

.pb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: #3f4b59;
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer
}

.pb-btn:hover {
  background: #f4f6f8;
  border-color: #cfd6df
}

.pb-btn .material-icons {
  font-size: 16px
}

.pb-add {
  color: var(--green-d)
}

.pb-add:hover {
  background: #eef6f0
}

.pb-saved {
  max-width: 170px
}

.pb-pages-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #eef1f5;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #5b6a7b;
  margin-bottom: 14px
}

.pb-pages-bar .pb-count {
  margin-left: auto;
  color: #8b96a3;
  font-weight: 600
}

.pb-stage {
  display: flex;
  justify-content: center;
  background: #e9edf1;
  border-radius: 10px;
  padding: 24px;
  max-height: calc(100vh - 280px);
  overflow: auto
}

#pb-pages-host {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%
}

.pb-page {
  background: #fff;
  width: 820px;
  flex: 0 0 auto;
  min-height: 1040px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .13);
  border-radius: 3px;
  padding: 46px 54px;
  box-sizing: border-box
}

.cr-edit {
  background: #f8fafc;
  border: 1px solid #e6ebf1;
  border-radius: 8px;
  padding: 12px 14px
}

.pb-rpt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #ececef;
  padding-bottom: 14px;
  margin-bottom: 18px
}

.pb-doc-title {
  font-size: 24px;
  font-weight: 700;
  color: #243240;
  outline: none
}

.pb-doc-sub {
  font-size: 12px;
  color: #8b96a3;
  margin-top: 3px
}

.pb-doc-logo img {
  height: 30px;
  width: auto;
  display: block
}

.pb-empty {
  text-align: center;
  color: #aab4c0;
  font-size: 14px;
  padding: 80px 20px;
  line-height: 1.7
}

.pb-item {
  border: 1px solid transparent;
  border-radius: 8px;
  margin: 16px 0;
  transition: border-color .15s;
  resize: both;
  overflow: hidden;
  min-width: 300px;
  min-height: 120px;
  max-width: 100%
}

.pb-item:hover {
  border-color: #e4e8ee
}

.pb-item::-webkit-resizer {
  background: linear-gradient(135deg, transparent 0 50%, #b9c2cc 50% 60%, transparent 60% 72%, #b9c2cc 72% 82%, transparent 82%)
}

.pb-item-t[contenteditable] {
  outline: none;
  cursor: text;
  border-radius: 3px;
  padding: 0 4px;
  margin: 0 -4px;
  transition: background .12s
}

.pb-item-t[contenteditable]:hover {
  background: rgba(15, 95, 51, .07)
}

.pb-item-t[contenteditable]:focus {
  background: rgba(15, 95, 51, .1)
}

.pb-item-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px
}

.pb-item-t {
  font-size: 13px;
  font-weight: 700;
  color: #5b6a7b
}

.pb-item-acts {
  display: flex;
  gap: 4px;
  opacity: .55;
  transition: opacity .15s
}

.pb-item:hover .pb-item-acts {
  opacity: 1
}

.pb-mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: #69788a;
  font-size: 12px
}

.pb-mini:hover {
  border-color: var(--green);
  color: var(--green-d)
}

.pb-ph {
  border: 1.5px dashed #cfd6df;
  border-radius: 8px;
  padding: 34px;
  text-align: center;
  color: #9aa7b4;
  font-size: 13px;
  cursor: pointer
}

.pb-plot {
  min-height: 190px
}

.pb-cap {
  font-size: 13px;
  font-weight: 600;
  color: #243240;
  margin-bottom: 6px
}

.pb-text {
  outline: none;
  border: 1px dashed transparent;
  border-radius: 6px;
  padding: 6px;
  font-size: 13px;
  color: #3f4b59;
  min-height: 24px
}

.pb-text:hover,
.pb-text:focus {
  border-color: #e4e8ee
}

.pb-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

.pb-tbl th {
  text-transform: none;
  font-size: 12px
}

@media print {

  .ds-wrap,
  .subtabs,
  .pb-toolbar,
  .pb-pages-bar,
  nav,
  header {
    display: none !important
  }

  .pb-stage {
    background: #fff;
    padding: 0;
    max-height: none;
    overflow: visible
  }

  .pb-page {
    box-shadow: none
  }
}

.genctl {
  border: 0;
  border-radius: 8px;
  padding: 14px;
  color: #fff;
  font-weight: 700;
  font-size: 15px
}

/* multi-genset site switcher (Genset 1 / Genset 2 …) */
.gen-switch {
  display: inline-flex;
  gap: 4px;
  background: #EEF1F4;
  border-radius: 9px;
  padding: 3px
}

.gen-switch-btn {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 14px;
  color: #5b6b7c;
  cursor: pointer
}

.gen-switch-btn.active {
  background: #fff;
  color: var(--green-d);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12)
}

/* TOU demand-profile meter switcher + breakdown table (electrical KPI) */
.ksv-pk-sel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 10px
}

.ksv-pk-sel-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-d);
  text-transform: uppercase;
  letter-spacing: .3px
}

.ksv-pk-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap
}

.ksv-pk-tab {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 16px;
  cursor: pointer;
  color: #666;
  background: #f0f0f0;
  border: 1px solid #ddd;
  transition: all .2s;
  user-select: none
}

.ksv-pk-tab:hover {
  background: #e3e6e9;
  color: #333
}

.ksv-pk-tab-active,
.ksv-pk-tab-active:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green)
}

.tdc-tbl {
  width: 100%;
  border-collapse: collapse
}

.tdc-tbl th,
.tdc-tbl td {
  padding: 6px 8px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0
}

.tdc-tbl th {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .3px
}

.tdc-tbl th:first-child,
.tdc-tbl td:first-child {
  text-align: left
}

.tdc-leg {
  cursor: pointer
}

.tdc-leg:hover {
  background: #fafafa
}

.genctl.start {
  background: var(--ok)
}

.genctl.stop {
  background: var(--bad)
}

.genctl.auto {
  background: #3d7fd6
}

.genctl.man {
  background: var(--warn)
}

main {
  flex: 1;
  overflow: auto;
  padding: 18px 22px
}

/* ---- subtabs ---- */
.subtabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px
}

.subtabs button {
  border: 0;
  background: transparent;
  padding: 10px 2px;
  color: #69788a;
  font-weight: 600;
  border-bottom: 2px solid transparent
}

.subtabs button.active {
  color: var(--green-d);
  border-bottom-color: var(--green)
}

/* ---- cards ---- */
.grid {
  display: grid;
  gap: 16px
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px
}

/* accordion / report tables were white widgets on the original dashboard — keep table cards white
   (var(--card)) rather than the gray stat-card panel, so rows read cleanly with the warm-gray hover */
.card:has(table) {
  background: var(--card)
}

/* ALL card titles: centred, 22px, with the LIVE indicator pinned top-right (absolute, so it doesn't offset centering) */
.card h3 {
  position: relative;
  margin: 0 0 13px;
  font-size: 22px;
  letter-spacing: .3px;
  color: var(--green-d);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px
}
.card h3 .live-badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%)
}

/* pie cards: vertically centre the (enlarged) pie within the card body */
.pie-card {
  display: flex;
  flex-direction: column
}
.pie-card > div {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0
}
.pie-card > div > svg {
  width: 100%;
  margin: 0 auto;
  display: block
}

/* plots inside a card share the card's background (no white frame) — the DATA marks (bars, pie wedges) carry the
   black outline instead, matching the original dashboard. Excludes pies (max-width) and sparklines. */
svg[style*="width:100%"]:not([style*="max-width"]):not(.spark) {
  background: transparent;
  border-radius: 5px;
  padding: 3px;
  box-sizing: border-box
}

/* Overview — fills viewport height (2 rows x 3 cols) */
.ov-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 12px;
  padding: 0;
  height: calc(100vh - 112px)
}

.ov-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 13px 15px;
  border-color: #E5E7EB;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04)
}

.ov-card h3 {
  margin: 0 0 9px;
  color: #374151;
  letter-spacing: .03em;
  font-size: 14px
}

.ov-fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center
}

.ov-foot {
  font-size: 12px;
  margin-top: 8px
}

.ov-sl {
  font-size: 11px;
  letter-spacing: .4px;
  color: var(--mut);
  text-transform: uppercase
}

.ov-bv {
  font-size: 24px;
  font-weight: 700;
  color: var(--green-d);
  line-height: 1.15
}

.ov-subcard {
  background: #F9FAFB;
  border: 1px solid #EEF0F2;
  border-radius: 9px;
  padding: 8px 11px;
  box-sizing: border-box
}

.ov-bv.sm {
  font-size: 19px
}

.ov-plot-hd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: .4px;
  color: var(--mut);
  text-transform: uppercase
}

.viewlink {
  font-size: 11px;
  color: var(--green-d);
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0
}

.viewlink:hover {
  text-decoration: underline
}

.live-badge {
  font-size: 11px;
  color: var(--red);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px
}

.live-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  animation: tws-live-pulse 1.5s ease-in-out infinite
}

/* generator header: active-alarm indicator under the title (pulses; hover reveals details) */
.gen-alarm { position: relative; display: inline-block; margin-top: 4px; text-align: center }
.gen-alarm-lbl { font-size: 12.5px; font-weight: 600; color: var(--mut) }
.gen-alarm.has .gen-alarm-lbl { color: var(--red); animation: gen-alarm-pulse 1.6s ease-in-out infinite }
.gen-alarm.has .gen-alarm-lbl::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 6px;
  vertical-align: -1px;
  box-shadow: 0 0 6px var(--red)
}
.gen-alarm.has { cursor: pointer }
@keyframes gen-alarm-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }
.gen-alarm-pop {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
  padding: 8px 10px;
  min-width: 220px;
  max-width: 360px;
  z-index: 50;
  text-align: left
}
.gen-alarm:hover .gen-alarm-pop,
.gen-alarm:focus-within .gen-alarm-pop { display: block }
.gen-al-row { white-space: nowrap; font-size: 12px; padding: 3px 2px; display: flex; align-items: center; color: var(--ink) }
.gen-al-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; flex: 0 0 auto }
body.dark .gen-alarm-pop { background: #1e2732; border-color: #35485c; color: #dce4ee }
body.dark .gen-al-row { color: #dce4ee }

/* generator header: multi-generator switcher (segmented) + stale-data warning */
.gen-htitle { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap }
.gen-htitle-txt { font-size: 18px; font-weight: 700; white-space: nowrap }
.udc-wrap { cursor: crosshair }
.udc-tip { position: absolute; pointer-events: none; background: rgba(17, 24, 39, .92); color: #fff; font-size: 11.5px; line-height: 1.55; padding: 5px 9px; border-radius: 6px; white-space: nowrap; display: none; z-index: 5; box-shadow: 0 2px 8px rgba(0, 0, 0, .22) }
.udc-tip-d { font-weight: 700; margin-bottom: 1px; color: #e5e7eb }
.udc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0 }
.gen-hsw { display: inline-flex; gap: 4px; background: #eef1f4; border: 1px solid var(--line); border-radius: 9px; padding: 3px; max-width: 100%; flex-wrap: wrap; justify-content: center }
.gen-hsw-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--mut); font-weight: 600; font-size: 14px; padding: 6px 14px; border-radius: 7px; cursor: pointer; white-space: nowrap }
.gen-hsw-btn:hover { color: var(--ink) }
.gen-hsw-btn.active { background: var(--card); color: var(--green-d); box-shadow: 0 1px 3px rgba(16, 24, 40, .12) }
.gen-hsw-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto }
.gen-hsw-dot.on { background: #1F8B4D }
.gen-hsw-dot.off { background: #E64A19 }
.gen-stale { display: flex; align-items: center; gap: 9px; background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; border-radius: 9px; padding: 9px 14px; margin: -4px 0 16px; font-weight: 600; font-size: 13.5px }
body.dark .gen-hsw { background: #1b2530; border-color: #2b3846 }
body.dark .gen-hsw-btn { color: #93a1b0 }
body.dark .gen-hsw-btn:hover { color: #e6edf3 }
body.dark .gen-hsw-btn.active { background: #0f172a; color: #4cd08a }
body.dark .gen-stale { background: #3a2f12; color: #f5d98a; border-color: #5a4a1e }

.big {
  font-size: 34px;
  font-weight: 700;
  color: var(--green-d);
  text-align: center;
  margin: 6px 0
}

.big.na {
  color: var(--mut);
  font-style: italic;
  font-weight: 400
}

.sub {
  text-align: center;
  color: var(--mut);
  font-size: 12px
}

.kv {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px dashed #eef1f4;
  font-variant-numeric: tabular-nums
}

.kv:last-child {
  border-bottom: 0
}

.kv .k {
  color: var(--mut)
}

.kv .v {
  font-weight: 700
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
  font-size: 13px
}

.bar-track {
  display: block;
  height: 9px;
  background: #eef1f4;
  border-radius: 5px;
  overflow: hidden
}

.bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--gold);
  border-radius: 5px
}

/* tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

th {
  text-align: left;
  color: var(--mut);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap
}

/* sortable column headers */
th.th-sort {
  cursor: pointer;
  user-select: none
}

th.th-sort:hover {
  color: var(--green-d)
}

/* arrow sits directly after the column title; a transparent placeholder on EVERY sortable header
   reserves the exact glyph width so sorting never changes a column's width (no shifting) */
th.th-sort::after {
  content: "\25BE";
  display: inline-block;
  margin-left: 6px;
  font-size: 16px;
  line-height: 0;
  vertical-align: -2px;
  color: transparent
}

th.th-sort:hover::after {
  color: #b9c2cc
}

th.sorted-asc::after {
  content: "\25B4";
  color: var(--green-d)
}

th.sorted-desc::after {
  content: "\25BE";
  color: var(--green-d)
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f2f5;
  white-space: nowrap
}

tr:hover td {
  background: #F6F3F3
}
body.dark tr:hover td {
  background: #1f2730
}

.acc-parent td {
  cursor: pointer
}

.acc-parent .chev {
  color: var(--green);
  font-size: 11px;
  display: inline-block;
  width: 14px;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1)
}

.acc-parent.open .chev {
  transform: rotate(90deg)
}

tr.child td {
  background: #fbfcfd;
  color: #56657a;
  font-size: 12px;
  padding: 0 !important;
  border-bottom: 0
}

/* Multiplexes + Fridges & Freezers: identical fixed column widths so both tables' columns line up vertically (same order) */
#muxTable, #frTable { table-layout: fixed }
#muxTable th:nth-child(1), #frTable th:nth-child(1) { width: 31% }
#muxTable th:nth-child(2), #frTable th:nth-child(2) { width: 17% }
#muxTable th:nth-child(3), #frTable th:nth-child(3) { width: 17% }
#muxTable th:nth-child(4), #frTable th:nth-child(4) { width: 17.5% }
#muxTable th:nth-child(5), #frTable th:nth-child(5) { width: 17.5% }
#muxTable td, #frTable td { overflow: hidden; text-overflow: ellipsis }
#muxTable tr.child td, #frTable tr.child td { overflow: visible }

.racc-det {
  max-height: 0;
  overflow: hidden;
  transition: max-height .5s cubic-bezier(.4, 0, .2, 1), padding .5s cubic-bezier(.4, 0, .2, 1);
  padding: 0 16px;
  background: #f8faf9
}

.racc-det.open {
  max-height: 1000px;
  padding: 16px;
  border-bottom: 1px solid #f0f2f5
}

/* ---- expanded fridge row: info grid + history + distribution (matches Unified Dev) ---- */
.racc-di {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 6px
}

.racc-ks {
  flex: 1;
  min-width: 160px
}

.racc-kt {
  font-size: 12px;
  font-weight: 600;
  color: #0F5F33;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .3px
}

.racc-dg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px
}

.racc-dl {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px
}

.racc-dv {
  font-size: 14px;
  font-weight: 500;
  color: #1B2A4A
}

.racc-dv.temp-ok {
  color: #1F8B4D
}

.racc-dv.temp-warn {
  color: #F5A623
}

.racc-dv.temp-alarm {
  color: #D32F2F
}

.racc-temp-bar {
  display: flex;
  align-items: center;
  gap: 6px
}

.racc-temp-track {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  position: relative
}

.racc-temp-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s
}

.racc-temp-sp {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: #333;
  border-radius: 1px
}

.fcc-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 4px 0 2px;
  margin-bottom: 2px
}

.fcc-lbl {
  grid-column: 2;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #333
}

.fcc-pills {
  grid-column: 3;
  justify-self: end;
  display: flex;
  gap: 4px
}

.fcc-pill {
  border: 1px solid #ccc;
  background: #fff;
  color: #666;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s
}

.fcc-pill:hover {
  border-color: #1F8B4D;
  color: #1F8B4D
}

.fcc-pill.active {
  background: #1F8B4D;
  color: #fff;
  border-color: #1F8B4D
}

.fcc-chart,
.fbc-chart {
  width: 100%;
  position: relative
}

.fr-tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, 0);
  background: rgba(30, 30, 30, .9);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  display: none;
  z-index: 6
}

.fr-tip b {
  color: #fff;
  font-weight: 600
}

.fcc-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 0 44px;
  font-size: 10px;
  color: #666
}

.fcc-stat-col {
  display: flex;
  align-items: center;
  gap: 4px
}

.fcc-stat-swatch {
  width: 10px;
  height: 3px;
  border-radius: 1px;
  flex-shrink: 0
}

.fcc-stat-vals {
  margin-left: auto;
  display: flex;
  gap: 12px;
  padding-right: 16px
}

.fcc-stat-vals span {
  color: #888
}

/* clickable meter rows in the Utilities detail table (toggle a meter on/off the plots) */
.util-meter-row {
  cursor: pointer
}

.util-meter-row:hover {
  background: #eef3f8 !important
}

.util-meter-row.meter-off {
  opacity: .4
}

.util-meter-row.meter-off .meter-sw {
  outline: 1px solid #b0b0b0;
  outline-offset: 1px
}

/* table toolbar: centered title + search/export on the right (matches original) */
.tbl-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: 16px 0 8px
}

.tbl-head .panel-title {
  grid-column: 2;
  font-size: 22px
}

.tbl-head .tbl-tools {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px
}

.tbl-search {
  padding: 5px 10px;
  border: 1px solid #d7dde3;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  min-width: 150px
}

.tbl-search:focus {
  border-color: var(--green)
}

.fcc-stat-vals b {
  color: #333;
  font-weight: 600
}

.umrow {
  display: flex;
  gap: 8px;
  padding: 6px 18px;
  font-size: 12.5px;
  color: #56657a;
  border-bottom: 1px dashed #eef1f4
}

.umrow:last-child {
  border-bottom: 0
}

.bms-cir-list {
  display: flex;
  flex-direction: column
}

.bms-cir {
  border-top: 1px solid #f2f2f2
}

.bms-cir-ed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 12px 22px;
  font-size: 12px;
  color: var(--mut)
}

.bms-cir-ed input[type=time] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--card);
  color: var(--ink)
}

.bms-cir-ed-btns {
  margin-left: auto;
  display: flex;
  gap: 8px
}

.bms-cir-ed .btn {
  padding: 4px 12px;
  font-size: 12px
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: #222a31;
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 4000
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0)
}

/* ===================== Alarms report preview (breakdown + per-column filters + stale banner) ===================== */
.rpt-stale { display: flex; align-items: center; gap: 9px; background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; font-size: 13.5px }
.mux-cstat { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 4px 0 14px }
.mux-cstat-cell { display: flex; flex-direction: column; gap: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px }
.mux-cstat-l { font-size: 11.5px; color: var(--mut); font-weight: 600 }
.mux-cstat-v { display: flex; align-items: center; gap: 6px; font-size: 14px }
.mux-cstat-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto }
.al-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap }
.al-toggle { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer }
.al-toggle:hover { border-color: #1F8B4D }
.al-toggle .al-tog-sw { width: 34px; height: 18px; border-radius: 9px; background: #cfd6dd; position: relative; flex: 0 0 auto; transition: background .18s }
.al-toggle .al-tog-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: left .18s }
.al-toggle.on { border-color: #1F8B4D; color: #0F5F33 }
.al-toggle.on .al-tog-sw { background: #1F8B4D }
.al-toggle.on .al-tog-sw::after { left: 18px }
.al-tog-hint { font-size: 12.5px; color: var(--mut) }
.al-break { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap }
.al-stat { flex: 1 1 150px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; text-align: center }
.al-stat-n { font-size: 27px; font-weight: 800; color: var(--ink); line-height: 1 }
.al-stat-l { margin-top: 5px; font-size: 11.5px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .03em }
.alf-row th { background: #f6f8fa; padding: 6px 8px !important; cursor: default; border-bottom: 1px solid var(--line) }
.alf-sel { width: 100%; box-sizing: border-box; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); font-size: 12px; font-weight: 400; text-transform: none }
.alf-dd { position: relative }
.alf-dd summary { list-style: none; cursor: pointer; padding: 5px 10px 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); font-size: 12px; font-weight: 400; text-transform: none; white-space: nowrap }
.alf-dd summary::-webkit-details-marker { display: none }
.alf-dd summary::after { content: "\25BE"; margin-left: 6px; font-size: 9px; color: var(--mut) }
.alf-dd[open] summary { border-color: var(--green) }
.alf-panel { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 240px; max-height: 300px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(16, 24, 40, .18); padding: 8px }
.alf-search { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: var(--card); color: var(--ink); font-size: 12px }
.alf-row2 { display: flex; align-items: center; gap: 7px; padding: 4px 5px; font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink); cursor: pointer; white-space: nowrap; border-radius: 5px }
.alf-row2:hover { background: var(--bg) }
body.dark .rpt-stale { background: #3a2f12; color: #f5d98a; border-color: #5a4a1e }
body.dark .alf-row th { background: #1b2530 }
/* alarms report: filter funnel next to the column title (like the BMS list) + search inside its popup */
.alf-h { display: inline-flex; align-items: center; gap: 5px }
.bms-filter-pop .fp-search { display: block; width: calc(100% - 20px); box-sizing: border-box; margin: 2px 10px 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; background: var(--card); color: var(--ink) }

/* small inline loading spinner (replaces the old "…" loading text) + vertical centering in value cards */
.mini-spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid #eef1f4; border-top-color: #0F5F33; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px }
body.dark .mini-spin { border-color: #2b333d; border-top-color: #4cd08a }
.card > .big:has(.bms-spin), .card > .big:has(.mini-spin) { display: flex; align-items: center; justify-content: center; min-height: 56px }
.card > .center-msg:has(.bms-spin) { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px; padding: 12px }

/* ===================== Embedded original Reports designer (Custom tab) ===================== */
.rpt-embed { width: 100% }
/* hide the embedded widget's own category-tab bar — the SPA's subtabs already switch tabs, and we force the Custom tab */
.rpt-embed .rpt-cat-tabs { display: none !important }

/* Scroll on the app content area (main) — NOT an inner box that cuts off the page.
   The widget nests a flex column whose .pb-stage / .pb-pages scroll internally; flatten them to normal flow. */
/* the widget's JS pins .pb-wrap / .pb-stage to a fixed measured height for its old internal-scroll model;
   force them to grow with content so the app's main area scrolls the whole report (no cut-off) */
.rpt-embed .pb-wrap { display: block; height: auto !important; min-height: 0 !important; max-height: none !important }
.rpt-embed .pb-stage { display: block !important; flex: none !important; min-height: 0 !important; height: auto !important; max-height: none !important; overflow: visible !important }
/* drop the widget's embedded dark "stage" background — the A4 page sits directly on the app background.
   position:relative keeps the axis-title inline editor (absolute, offset from #pb-pages) landing ON the text. */
.rpt-embed .pb-pages { overflow: visible !important; position: relative; background: transparent !important; background-image: none !important }
/* the light-grey "1 page" bar above the page is redundant chrome — remove it */
.rpt-embed .pb-pages-bar { display: none !important }

/* ---- dark mode for the custom report (paper stays white = matches the printable export) ---- */
body.dark .rpt-embed .pb-wrap { background: transparent; color: #dce4ee }
body.dark .rpt-embed .rpt-hdr { background: #1b2530; border-bottom-color: #2b3846 }
body.dark .rpt-embed .rpt-hdr-title,
body.dark .rpt-embed .rpt-hdr-icon { color: #eef3f8 }
body.dark .rpt-embed .pb-pages-bar { background: transparent; color: #9fb0c2 }
body.dark .rpt-embed .pb-btn,
body.dark .rpt-embed .pb-rpt-btn,
body.dark .rpt-embed .pb-rpt-newbtn,
body.dark .rpt-embed .pb-rpt-selwrap,
body.dark .rpt-embed .pb-rpt-sel,
body.dark .rpt-embed .pb-cdd-btn,
body.dark .rpt-embed .pb-type { background: #253140; color: #dce4ee; border-color: #35485c }
body.dark .rpt-embed .pb-pop,
body.dark .rpt-embed .pb-cdd,
body.dark .rpt-embed .pb-settings { background: #1e2732; color: #dce4ee; border-color: #35485c; box-shadow: 0 10px 30px rgba(0, 0, 0, .5) }
body.dark .rpt-embed .pb-cdd-row,
body.dark .rpt-embed .pb-pop-row,
body.dark .rpt-embed .pb-set-row,
body.dark .rpt-embed .pb-set-lbl { color: #cdd8e4 }
body.dark .rpt-embed .pb-cdd-row:hover,
body.dark .rpt-embed .pb-pop-row:hover { background: #2a3a4c }
body.dark .rpt-embed .pb-cdd-srch,
body.dark .rpt-embed .pb-pop-srch,
body.dark .rpt-embed .pb-pop-in,
body.dark .rpt-embed .pb-set-in,
body.dark .rpt-embed .pb-name-input,
body.dark .rpt-embed .pb-svg-edit { background: #141b23; color: #eef3f8; border-color: #35485c }

/* ===================== Custom report (rebuilt to match original) ===================== */
.cr2-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px }
.cr2-title { font-size: 17px; font-weight: 600 }
.cr2-export { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border: 0; border-radius: 6px; background: #1F8B4D; color: #fff; font-weight: 600; font-size: 13px; cursor: pointer }
.cr2-export:hover { background: #0F5F33 }
.cr2-pickers { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 16px }
.cr2-panel { padding: 12px 14px; display: flex; flex-direction: column }
.cr2-ph { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--mut); margin-bottom: 8px }
.cr2-search { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; background: var(--card); color: var(--ink); box-sizing: border-box }
.cr2-list { height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 6px }
.cr2-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line) }
.cr2-row:last-child { border-bottom: 0 }
.cr2-row:hover { background: var(--bg) }
.cr2-row.sel { background: #ECFDF3; color: #0F5F33; font-weight: 600 }
.cr2-row small { color: var(--mut); font-size: 11px; margin-left: 4px }
.cr2-empty { padding: 20px; text-align: center; color: var(--mut); font-size: 13px }
.cr2-chart-card { padding: 14px 16px }
.cr2-chart-title { font-weight: 600; margin-bottom: 8px; font-size: 14px }
body.dark .cr2-row:hover { background: #1f2730 }
body.dark .cr2-row.sel { background: #15301f; color: #4cd08a }

.bms-cir:first-child {
  border-top: 0
}

.bms-cir-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0
}

.bms-cir-toggle {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 9px;
  background: #c4c9ce;
  transition: background .2s;
  flex: 0 0 auto
}

.bms-cir-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3)
}

.bms-cir-toggle.on {
  background: #0F5F33
}

.bms-cir-toggle.on::after {
  left: 16px
}

.bms-cir-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500
}

.bms-cir-sched {
  font-size: 12px;
  color: #777
}

.bms-cir-sp {
  font-size: 11px;
  color: #0F5F33;
  background: #eef5f0;
  border-radius: 4px;
  padding: 2px 7px;
  margin-left: 8px;
  white-space: nowrap;
  letter-spacing: .2px
}

.bms-cir-edit {
  cursor: pointer;
  color: #bbb;
  padding: 2px 6px
}

.bms-cir-edit:hover {
  color: #0F5F33
}

.bms-loading {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center
}

.bms-spin {
  width: 26px;
  height: 26px;
  margin: 4px auto;
  border: 3px solid #eef1f4;
  border-top-color: #0F5F33;
  border-radius: 50%;
  animation: spin .8s linear infinite
}

/* cluster hover tooltip listing the sites/devices in the group */
.cl-tip.leaflet-tooltip {
  background: #fff;
  border: 1px solid #E4E4E7;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
  padding: 7px 10px;
  font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
  color: #1F2937;
  max-width: 320px
}

.cl-tip.leaflet-tooltip::before {
  display: none
}

.cl-tip .cl-tip-hd {
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 4px;
  color: #0F5F33
}

.cl-tip .cl-tip-list {
  column-gap: 16px;
  font-size: 12px;
  line-height: 1.5
}

.cl-tip .cl-tip-r {
  white-space: nowrap;
  display: flex;
  align-items: center
}

.cl-tip .cl-tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex: 0 0 auto
}

body.dark .cl-tip.leaflet-tooltip {
  background: #1e2732;
  border-color: #35485c;
  color: #dce4ee;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5)
}

body.dark .cl-tip .cl-tip-hd {
  color: #4cd08a
}

/* BMS side filter funnel + dropdown */
.bms-filter-btn {
  flex: 0 0 auto;
  cursor: pointer;
  color: #9aa7b4;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px
}

.bms-filter-btn:hover {
  color: #5b6b7c
}

.bms-filter-btn.on,
.bms-filter-btn.open {
  color: var(--green)
}

/* small overlay filter popover anchored to the funnel, like the original (fixed so the panel's overflow can't clip it) */
.bms-filter-pop {
  position: fixed;
  z-index: 1400;
  min-width: 160px;
  background: #fff;
  border: 1px solid #E4E4E7;
  border-radius: 10px;
  box-shadow: 0 8px 26px rgba(16, 24, 40, .18);
  padding: 7px 0
}

.bms-filter-pop .fp-hd {
  font-size: 11px;
  font-weight: 700;
  color: #9AA3AE;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 14px 6px
}

.bms-filter-pop .fp-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #374151
}

.bms-filter-pop .fp-opt:hover {
  background: #f3f6f4
}

.bms-filter-pop .fp-ck {
  width: 15px;
  height: 15px;
  border: 1.5px solid #c4ccd4;
  border-radius: 3px;
  flex: 0 0 auto;
  position: relative
}

.bms-filter-pop .fp-opt.on .fp-ck {
  background: var(--green);
  border-color: var(--green)
}

.bms-filter-pop .fp-opt.on .fp-ck::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg)
}

.bms-filter-pop .fp-d {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto
}

.bms-filter-pop .fp-l {
  flex: 1;
  white-space: nowrap
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600
}

.chip.ok {
  background: #e3f5ea;
  color: #1f7a44
}

.chip.warn {
  background: #fdf2dd;
  color: #a9741a
}

.chip.bad {
  background: #fbe5e4;
  color: #bb2a23
}

.chip.idle {
  background: #eef1f4;
  color: #5b6a7b
}

.na {
  color: var(--mut);
  font-style: italic
}

.panel-title {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 18px 0 6px
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 6px 0 12px
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 8px
}

.toolbar input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px
}

.btn {
  padding: 7px 13px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 6px;
  font-weight: 600
}

.btn.ghost {
  background: #fff;
  color: var(--green-d);
  border-color: var(--line)
}

.muted {
  color: var(--mut)
}

.center-msg {
  text-align: center;
  color: var(--mut);
  padding: 30px
}

/* health shield */
.shield {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  display: block
}

/* BMS — fits to viewport height */
.bms-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  height: calc(100vh - 116px)
}

.bms-side {
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: relative
}

.bms-side-hd {
  font-size: 17px;
  font-weight: 600;
  padding: 2px 0 8px;
  position: relative;
  text-align: center
}

.bms-back {
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--green-d);
  position: absolute;
  left: 0;
  top: 2px
}

.bms-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px
}

.bms-tab {
  flex: 1;
  padding: 9px 4px;
  font-weight: 600;
  color: #69788a;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer
}

.bms-tab.active {
  color: var(--green-d);
  border-bottom-color: var(--green)
}

.bms-tab .tl {
  display: inline-flex;
  align-items: center;
  gap: 6px
}

.bms-tabs .cnt {
  background: #eef1f5;
  border-radius: 9px;
  padding: 0 7px;
  font-size: 11px;
  color: #56657a
}

.bms-tabs .cnt.crit {
  background: #fbe5e4;
  color: #bb2a23
}

.bms-side-body {
  overflow: auto;
  flex: 1
}

.fp-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center
}

.bms-side-loading {
  color: var(--mut);
  text-align: center;
  padding: 28px 24px;
  font-size: 13px
}

.bms-loadbar {
  position: relative;
  height: 4px;
  width: 70%;
  max-width: 200px;
  margin: 0 auto 10px;
  background: #e6ebf0;
  border-radius: 3px;
  overflow: hidden
}

.bms-loadbar>span {
  position: absolute;
  top: 0;
  height: 100%;
  width: 35%;
  border-radius: 3px;
  background: var(--green);
  animation: bmsLoad 1.1s ease-in-out infinite
}

@keyframes bmsLoad {
  0% { left: -35% }
  100% { left: 100% }
}

body.dark .bms-loadbar {
  background: #2b333d
}

.bms-side-empty {
  color: var(--mut);
  text-align: center;
  padding: 24px;
  font-size: 13px
}

.bms-right {
  min-width: 0;
  position: relative
}

.bms-map,
.bms-fp {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line)
}

.bms-fp {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 0
}

.bms-fp.hidden,
.bms-map.hidden {
  display: none
}

.tws-live-disabled {
  color: #b6bfc9 !important;
  cursor: default
}

.store-pin {
  background: transparent;
  border: 0;
  overflow: visible;
  position: absolute
}

.store-pin svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4))
}

.store-pin-label {
  position: absolute;
  bottom: 36px;
  left: 17px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: #1f2937;
  background: rgba(255, 255, 255, .88);
  padding: 1px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  pointer-events: none
}

.dl-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 4px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer
}

.dl-item:hover {
  background: #fafbfc
}

.dl-item.dim {
  opacity: .45
}

.dl-ic {
  flex-shrink: 0;
  line-height: 0
}

.dl-ic svg {
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .3))
}

.dl-tx {
  min-width: 0
}

.dl-nm {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.dl-ty {
  font-size: 11px;
  color: var(--mut)
}

.bms-al-li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer
}

.bms-al-li:hover {
  background: #fafbfc
}

.bms-al-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0
}

.bms-al-t {
  font-size: 12.5px;
  font-weight: 600
}

.bms-al-m {
  font-size: 11px;
  color: var(--mut)
}

/* floor-plan = navigable Leaflet image overlay (pan/zoom) */
.fp-leaflet {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 1
}

.bms-dicon {
  background: none !important;
  border: none !important;
  cursor: pointer
}

.bms-dicon svg {
  display: block;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .35))
}

.bms-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 15;
  pointer-events: none
}

.bms-overlay>* {
  pointer-events: auto
}

.bms-seg {
  display: inline-flex;
  align-items: center;
  height: 56px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, .95);
  border-radius: 28px;
  padding: 4px;
  gap: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12)
}

.bms-seg button {
  border: none;
  background: transparent;
  color: #555;
  font: 600 15px Roboto, system-ui;
  padding: 9px 20px;
  border-radius: 24px;
  cursor: pointer
}

.bms-seg button.active {
  background: #0F5F33;
  color: #fff
}

.bms-ov-pill {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  height: 56px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, .95);
  border-radius: 16px;
  padding: 6px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12)
}

.bms-ov-pill .lbl {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #9aa0a8;
  font-weight: 600
}

.bms-ov-pill .v {
  font-size: 20px;
  font-weight: 600
}

.bms-ov-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  box-sizing: border-box;
  padding: 0 22px;
  border-radius: 28px;
  border: none;
  background: rgba(255, 255, 255, .95);
  color: #0F5F33;
  font: 600 15px Roboto, system-ui;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12)
}

.bms-ov-btn:hover {
  background: #0F5F33;
  color: #fff
}

.bms-ov-btn.ac {
  color: #0277BD
}

.bms-ov-btn.ac:hover {
  background: #0277BD;
  color: #fff
}

.bms-lpop .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .2);
  padding: 3px 4px
}

.bms-lpop .leaflet-popup-content {
  margin: 8px 11px;
  line-height: 1.45
}

/* store map click popup — matches the original TB popup (name + city, dotted Status/Generator/Mains/Energy rows) */
.bms-store-pop .leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: 0 8px 26px rgba(0, 0, 0, .2) }
.bms-store-pop .leaflet-popup-content { margin: 10px 13px; line-height: 1.4 }
.bms-spop { min-width: 185px; font-family: 'Segoe UI', Roboto, system-ui, sans-serif }
.bms-spop.drill { cursor: pointer }
.bms-spop .sn { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: #1B2A4A; margin-bottom: 6px }
.bms-spop .sc { font-size: 10px; color: #9AA0A8; font-weight: 400; white-space: nowrap }
.bms-spop .spr { display: flex; align-items: center; gap: 8px; margin: 0 0 5px }
.bms-spop .spr:last-child { margin-bottom: 0 }
.bms-spop .sd { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto }
.bms-spop .sl { color: #555; flex: 1 1 0; font-size: 12px }
.bms-spop .sv { font-weight: 600; font-size: 12px; white-space: nowrap }
/* large centred store popup (site selected) — store summary + Devices & Alarms + View Details */
.bms-spop-lg { width: 320px; font-family: 'Segoe UI', Roboto, system-ui, sans-serif }
.bms-spop-lg .ssl-hd { display: flex; align-items: baseline; gap: 7px; margin-bottom: 11px; padding-right: 16px }
.bms-spop-lg .ssl-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; align-self: center }
.bms-spop-lg .ssl-nm { font-size: 17px; font-weight: 700; color: #1B2A4A }
.bms-spop-lg .ssl-city { font-size: 12px; color: #9AA0A8; font-weight: 400 }
.bms-spop-lg .ssl-r { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 }
.bms-spop-lg .ssl-l { color: #6b7280; font-size: 13px }
.bms-spop-lg .ssl-v { font-size: 13px; font-weight: 700; white-space: nowrap }
.bms-spop-lg .ssl-da { display: flex; justify-content: space-between; align-items: baseline; margin: 13px 0 6px }
.bms-spop-lg .ssl-da b { font-size: 13px; color: #1B2A4A }
.bms-spop-lg .ssl-on { font-size: 12px; color: #6b7280 }
.bms-spop-lg .ssl-bar { display: flex; height: 8px; border-radius: 5px; background: #e6e9ec; overflow: hidden; margin-bottom: 8px }
.bms-spop-lg .ssl-bar span { height: 100% }
.bms-spop-lg .ssl-leg { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 11.5px; color: #6b7280; margin-bottom: 14px }
.bms-spop-lg .ssl-d { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0 }
.bms-spop-lg .ssl-vd { width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px; border: 0; border-radius: 8px; background: #0F5F33; color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit }
.bms-spop-lg .ssl-vd:hover { background: #0c4f2a }
/* store summary shown as a centred modal (dimmed backdrop via .modal-bg) — shrink the card to the content */
.modal:has(.store-modal) { width: auto; max-width: 92vw; padding: 20px }
.store-modal .bms-spop-lg .ssl-hd { padding-right: 22px }

.bms-pop {
  min-width: 150px;
  max-width: 240px
}

.bms-pop .pn {
  font-size: 13px;
  font-weight: 600;
  color: #1B2A4A;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  margin-bottom: 4px
}

.bms-pop .pm {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9aa0a8;
  margin-bottom: 3px
}

.bms-pop .pr .tr {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 1.5px 0;
  font-size: 12px
}

.bms-pop .pr .k {
  color: #888
}

.bms-pop .pr .v {
  font-weight: 600;
  color: #1B2A4A
}

.fp-tip {
  position: fixed;
  transform: translate(-50%, -100%);
  background: #222a31;
  color: #fff;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2000;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3)
}

#chart-tip {
  position: fixed;
  display: none;
  background: #222a31;
  color: #fff;
  font-size: 13px;
  padding: 8px 11px;
  border-radius: 7px;
  pointer-events: none;
  z-index: 2000;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .35);
  white-space: nowrap
}

/* caret linking the tooltip's middle to the top of the dashed guide line */
#chart-tip.ct-above::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #222a31
}
#chart-tip.ct-below::after {
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: #222a31
}

#chart-tip .ct-h {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 13px;
  color: #cdd5e1
}

#chart-tip .ct-r {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0
}

#chart-tip .ct-d {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block
}

.site-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 8px;
  cursor: pointer
}

.site-item:hover {
  border-color: var(--green)
}

.site-item-main {
  flex: 1;
  min-width: 0
}

.site-item .nm {
  font-weight: 700
}

.site-item .st {
  font-size: 12px;
  color: var(--mut)
}

.site-alarm {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 2px 4px;
  border-radius: 6px
}

.site-alarm:hover {
  background: #f1f5f3
}

.site-alarm-n {
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  line-height: 1
}

.store-alarm-pop {
  position: fixed;
  display: none;
  z-index: 1500;
  width: 260px;
  overflow: visible;
  background: #fff;
  border: 1px solid #E4E4E7;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .18);
  padding: 8px 10px;
  font-family: 'Segoe UI', Roboto, system-ui, sans-serif
}

.store-alarm-pop .sap-hd {
  font-weight: 700;
  font-size: 12.5px;
  color: #18181B;
  padding: 2px 2px 7px;
  border-bottom: 1px solid #eef0f2;
  margin-bottom: 5px
}

.store-alarm-pop .sap-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 2px
}

.store-alarm-pop .sap-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 3px
}

.store-alarm-pop .sap-tx {
  min-width: 0
}

.store-alarm-pop .sap-t {
  font-weight: 700;
  font-size: 12.5px;
  color: #1F2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.store-alarm-pop .sap-m {
  font-size: 11px;
  color: #9CA3AF
}

.store-alarm-pop .sap-none {
  color: #6B7280;
  padding: 6px 2px;
  font-size: 12px
}

.store-alarm-pop .sap-more {
  color: #16A34A;
  font-weight: 600;
  font-size: 11px;
  padding: 4px 2px 2px
}

.spark {
  width: 100%;
  height: 70px
}

.gauge-wrap {
  position: relative;
  text-align: center
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 36, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000
}

.modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  width: min(680px, 92vw);
  max-height: 88vh;
  overflow: auto
}

.modal h2 {
  margin: 0 0 4px
}

.modal .x {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;
  border: 0;
  background: #eef1f4;
  color: #5b6b7b;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center
}

.modal .x:hover {
  background: #e2e7ec;
  color: #1f2937
}

.statgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px
}

.statgrid>div {
  padding: 14px;
  border-right: 1px solid var(--line)
}

.statgrid>div:last-child {
  border-right: 0
}

.statgrid .n {
  font-size: 24px;
  font-weight: 700
}

/* BMS device popup card (matches original) */
.modal:has(.dpop) {
  width: fit-content;
  max-width: 92vw;
  padding: 16px 18px
}

.dpop {
  width: 500px;
  max-width: 86vw;
  min-width: 0
}

.dpop-info {
  display: flex;
  gap: 10px;
  margin: 4px 0 2px
}

.dpi-card {
  flex: 1;
  min-width: 0;
  background: #F9FAFB;
  border: 1px solid #EEF0F2;
  border-radius: 9px;
  padding: 8px 11px
}

.dpi-t {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-d);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 5px
}

.dpi-r {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding: 2px 0;
  color: #6B7280
}

.dpi-r b {
  color: #111827;
  font-variant-numeric: tabular-nums
}

.dpop-hd {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 8px;
  padding-right: 30px
}

.dpop-ic {
  flex: 0 0 auto
}

.dpop-tt {
  flex: 1;
  min-width: 0
}

.dpop-name {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2
}

.dpop-type {
  font-size: 12px;
  color: var(--mut);
  margin-top: 2px
}

.dpop-st {
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px
}

.dpop-tabs {
  display: flex;
  gap: 4px;
  flex: 0 0 auto
}

.dpop-tabs .ovbtn {
  padding: 2px 8px;
  font-size: 11px
}

.dpop-ct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 4px
}

.dpop-ct {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  text-align: left;
  margin: 0
}

.ovl-tip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  background: #fff;
  border: 1px solid #E4E4E7;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .14);
  padding: 6px 9px;
  font-size: 12px;
  white-space: nowrap
}

.ovl-tip-t {
  font-weight: 700;
  color: #18181B;
  margin-bottom: 3px
}

.ovl-tip-r {
  color: #4B5563;
  line-height: 1.55
}

.ovl-tip-d {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px
}

/* plot/chart title — centered, 22px */
.plot-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  letter-spacing: .02em;
  margin: 2px 0 8px
}

/* Custom report — telemetry key picker */
.cr-keypick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 10px;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  margin: 6px 0 12px
}

.cr-keyopt {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer
}

.cr-keyopt:hover {
  background: #f3f6f9
}

.cr-keyopt input {
  accent-color: var(--green)
}

/* Generator/Utility Data Overlay — grouped dropdowns (matches original) */
.gov-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 14px;
  justify-content: center
}

.gov-group {
  position: relative
}

.gov-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid #d7dee5;
  background: #fff;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #455a64;
  cursor: pointer
}

.gov-btn:hover {
  border-color: #b8c4cf
}

.gov-btn.has-sel {
  border-color: var(--green);
  color: var(--green-d);
  background: #f1f8f3
}

.gov-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid #e2e8ee;
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .14);
  padding: 6px;
  max-height: 280px;
  overflow: auto
}

.gov-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: #37474f;
  border-radius: 5px;
  cursor: pointer
}

.gov-opt:hover {
  background: #f3f6f9
}

.gov-opt input {
  accent-color: var(--green);
  width: 15px;
  height: 15px
}

.statgrid .l {
  font-size: 11px;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: .4px
}
/* ===================== HEADER CONTROLS GROUP + KEBAB (ported from Tsebo) ===================== */
.ds-controls { display:flex; align-items:center; gap:14px; order:3; flex:0 1 auto; min-width:0; }
.ds-kebab-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 8px;
  flex: 0 0 auto;
  align-self: center
}

.ds-kebab {
  border: 1px solid #E4E4E7;
  background: #fff;
  color: #52525B;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms ease
}

.ds-kebab:hover {
  background: #FAFAFA;
  border-color: #D4D4D8;
  color: #18181B
}

.ds-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .16);
  min-width: 180px;
  padding: 5px;
  z-index: 4000
}

.ds-menu.hidden {
  display: none
}

.ds-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: space-between;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer
}

.ds-menu-item:hover {
  background: #f4f6f8
}

.ds-menu-logout {
  justify-content: flex-start;
  color: var(--bad)
}

.ds-menu-logout .material-icons {
  font-size: 18px
}

.ds-menu-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 2px
}

/* sun / moon dark-mode toggle */
.ds-switch { position:relative; width:46px; height:24px; border-radius:13px; background:#bcd6ea; cursor:pointer; flex:0 0 auto; transition:background .3s; }
.ds-switch::after { content:"\2600\FE0E"; position:absolute; top:2px; left:2px; width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); display:flex; align-items:center; justify-content:center; font-size:12px; color:#f59e0b; line-height:1; transition:left .3s, color .3s, background .3s; }
.ds-switch.on { background:#33415a; }
.ds-switch.on::after { left:24px; content:"\263D\FE0E"; color:#cbd5e1; background:#0f172a; }
.ds-switch:focus-visible { outline:2px solid var(--green); outline-offset:2px; }

/* ===================== DARK MODE (ported from Tsebo) ===================== */
body.dark {
  --ink: #e6edf3;
  --mut: #93a1b0;
  --line: #2b333d;
  --bg: #0f1318;
  --card: #161c24;
  --panel: #161c24
}

body.dark .ds-wrap {
  background: #161c24;
  border-bottom-color: #2b333d
}

body.dark .ds-store,
body.dark .ds-sel,
body.dark .ds-arrow,
body.dark .tws-range-label,
body.dark .ds-kebab {
  background: #1f2730;
  color: #e6edf3;
  border-color: #2b333d
}

body.dark .ds-store:hover,
body.dark .ds-sel:hover,
body.dark .ds-arrow:hover,
body.dark .ds-kebab:hover {
  background: #273039;
  color: #fff
}

body.dark .ds-lh-tray,
body.dark .ds-tray {
  background: #1f2730
}

body.dark .ds-lh.active,
body.dark .dashboard-pills.active {
  background: #2b333d;
  color: #fff
}

body.dark .dashboard-pills {
  color: #93a1b0
}

body.dark .dashboard-pills:hover {
  color: #e6edf3;
  background: rgba(255, 255, 255, .06)
}

body.dark .ds-menu {
  background: #1f2730
}

body.dark .ds-menu-item:hover {
  background: #273039
}

body.dark td {
  border-bottom-color: #232b34
}

body.dark tr:hover td {
  background: #1c232c
}

body.dark tr.child td,
body.dark .racc-det {
  background: #141a21
}

body.dark .modal,
body.dark .exp-menu,
body.dark .bms-fmenu,
body.dark .tws-dp {
  background: #1f2730;
  color: #e6edf3
}

body.dark .tws-dp-title {
  color: #e6edf3
}

body.dark .tws-dp-day {
  color: #cbd5e0
}

body.dark .tws-dp-day.in {
  background: #1f3a2a
}

body.dark .tws-dp-btn {
  background: #2b333d;
  color: #e6edf3
}

body.dark .tws-dp-btn.primary {
  background: var(--green);
  color: #fff
}

body.dark .tws-dp-times { border-top-color: #2b3846 }

body.dark .tws-dp-time {
  background: #0f172a;
  border-color: #35485c;
  color: #e6edf3
}

body.dark .modal .x {
  background: #2b333d;
  color: #e6edf3
}

body.dark .toolbar input,
body.dark .tbl-search,
body.dark .bms-ssearch {
  background: #161c24;
  color: #e6edf3;
  border-color: #2b333d
}

body.dark .btn.ghost {
  background: #1f2730;
  color: #e6edf3
}

body.dark .bms-seg,
body.dark .bms-ov-pill,
body.dark .bms-ov-btn {
  background: rgba(31, 39, 48, .96);
  color: #e6edf3
}

body.dark .bms-ov-pill .v {
  color: #e6edf3
}

body.dark .bms-pop,
body.dark .leaflet-popup-content-wrapper,
body.dark .leaflet-popup-tip {
  background: #1f2730;
  color: #e6edf3
}

body.dark .bms-pop .pn,
body.dark .bms-pop .pr .v {
  color: #e6edf3
}

/* overview cards (scoped under #u-content) */
body.dark #u-content .ov-card {
  background: #161c24;
  border-color: #2b333d
}

body.dark #u-content .ov-subcard,
body.dark #u-content .ov-wstat-c,
body.dark #u-content .ov-al-tile,
body.dark #u-content .ov-gen-cell,
body.dark #u-content .ov-temp-card {
  background: #1c232c;
  border-color: #2b333d
}

body.dark #u-content .ov-ch h3,
body.dark #u-content .ov-bv,
body.dark #u-content .ov-wstat-v,
body.dark #u-content .ov-gen-cv,
body.dark #u-content .ov-gen-stat-v,
body.dark #u-content .ov-kpi-val,
body.dark #u-content .ov-temp-val,
body.dark #u-content .ov-al-n,
body.dark #u-content .ov-kpi-ahb {
  color: #e6edf3 !important
}

body.dark #u-content .ov-go {
  background: #1f2730;
  border-color: #2b333d;
  color: #93a1b0
}

/* dark mode — charts (retheme inline SVG colours) + expanded accordion rows */
body.dark .plot-title,
body.dark .fcc-lbl,
body.dark .panel-title,
body.dark .section-title {
  color: #cbd5e0
}

body.dark .big {
  color: #4cd08a
}

body.dark .bar-track {
  background: #2b333d
}

body.dark line[stroke="#eef1f4"],
body.dark circle[stroke="#eef1f4"] {
  stroke: #2b333d
}

body.dark circle[fill="#eef1f4"] {
  fill: #232b34
}

body.dark path[fill="#E5E7EB"],
body.dark circle[fill="#E5E7EB"] {
  fill: #2b333d
}

body.dark text[fill="#7c8a99"],
body.dark text[fill="#7a828b"],
body.dark text[fill="#9aa7b4"],
body.dark text[fill="#888"],
body.dark text[fill="#444"] {
  fill: #93a1b0
}

body.dark .racc-dv {
  color: #e6edf3
}

body.dark .racc-kt {
  color: #4cd08a
}

body.dark .racc-dl,
body.dark .fcc-stats {
  color: #93a1b0
}

body.dark .racc-temp-track {
  background: #2b333d
}

body.dark .racc-temp-sp {
  background: #e6edf3
}

body.dark .fcc-pill {
  background: #1f2730;
  border-color: #2b333d;
  color: #cbd5e0
}

body.dark .fcc-pill.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff
}

body.dark .statgrid,
body.dark .statgrid>div {
  border-color: #2b333d
}

body.dark .statgrid .n {
  color: #e6edf3
}

body.dark .kv {
  border-bottom-color: #232b34
}

body.dark .acc-parent.open,
body.dark tr.acc-parent.open td {
  background: #1c232c
}

/* ============ DARK MODE — remaining surfaces (popups, overlays, chips, tints) ============ */
body.dark .dpi-card {
  background: #1c232c;
  border-color: #2b333d
}

body.dark .dpi-t {
  color: #4cd08a
}

body.dark .dpi-r {
  color: #93a1b0
}

body.dark .dpi-r b,
body.dark .dpop-name {
  color: #e6edf3
}

body.dark .bms-fp,
body.dark .fp-leaflet {
  background: #161c24
}

body.dark .ovbtn {
  background: #1f2730;
  border-color: #2b333d;
  color: #cbd5e0
}

body.dark .ovbtn.on {
  background: var(--green);
  border-color: var(--green);
  color: #fff
}

body.dark .gov-btn,
body.dark .gov-menu {
  background: #1f2730;
  border-color: #2b333d;
  color: #cbd5e0
}

body.dark .kpi-meter-chip {
  background: #1f2730;
  border-color: #2b333d
}

body.dark .chip.idle,
body.dark .bms-tabs .cnt {
  background: #2b333d;
  color: #cbd5e0
}

body.dark .bms-cir-sp {
  background: #15301f;
  color: #7fdca8
}

body.dark .bms-fbtn:hover {
  background: #2b333d
}

body.dark .dl-item:hover,
body.dark .bms-al-li:hover {
  background: #1c232c
}

body.dark .bms-side-empty,
body.dark .dl-ty,
body.dark .bms-al-m {
  color: #93a1b0
}

/* inline row tints used in tables (Mains / VM Remainder / totals) */
body.dark tr[style*="#f4f7fb"],
body.dark tr[style*="#fbfcfd"],
body.dark tr[style*="#fafbfc"] {
  background: #1c232c !important
}

/* keep the leaflet zoom control legible on dark */
body.dark .leaflet-bar a {
  background: #1f2730;
  color: #e6edf3;
  border-color: #2b333d
}

/* map canvas background (shows while tiles load / around the floor plan) */
body.dark .leaflet-container {
  background: #0f1318
}
/* dark mode: lift the near-black basemap tiles to a neutral GRAY so the map reads clearly */
body.dark #map .leaflet-tile {
  filter: grayscale(1) brightness(.62) contrast(1.05)
}
/* dark mode: invert the floor-plan image so the dark wall OUTLINES become white (hue-rotate keeps device-icon colours) */
body.dark #bms-leaflet .leaflet-image-layer,
body.dark .fp-leaflet .leaflet-image-layer {
  filter: invert(1) hue-rotate(180deg) brightness(1.08)
}
/* FLM-specific dark surfaces (components added after the Tsebo split) */
body.dark .tdc-tbl th { color:#93a1b0; }
body.dark .tdc-tbl th, body.dark .tdc-tbl td { border-bottom-color:#232b34; }
body.dark .ksv-pk-tab { background:#1f2730; border-color:#2b333d; color:#cbd5e0; }
body.dark .ksv-pk-tab:hover { background:#273039; color:#fff; }
body.dark .gen-switch { background:#1f2730; }
body.dark .gen-switch-btn { color:#93a1b0; }
body.dark .gen-switch-btn.active { background:#0f172a; color:#4cd08a; }
body.dark .bms-filter-pop, body.dark #store-alarm-pop, body.dark .ovl-tip { background:#1f2730; color:#e6edf3; border-color:#2b333d; }
body.dark .fp-hd { color:#93a1b0; }
body.dark .fp-opt:hover { background:#273039; }
/* dark-mode popup readability: sub-elements with baked-in dark text were unreadable on the dark popup backgrounds */
body.dark .store-alarm-pop .sap-hd { color:#e6edf3; border-bottom-color:#2b333d; }
body.dark .store-alarm-pop .sap-t { color:#e6edf3; }
body.dark .store-alarm-pop .sap-m, body.dark .store-alarm-pop .sap-none { color:#93a1b0; }
body.dark .ovl-tip-t { color:#e6edf3; }
body.dark .ovl-tip-r { color:#b6c0cc; }
body.dark .bms-filter-pop .fp-opt { color:#e6edf3; }
body.dark .gov-opt { color:#dce3ea; }
body.dark .bms-pop .pm, body.dark .bms-pop .pr .k { color:#93a1b0; }
body.dark .leaflet-popup-content [style*="dashed #eee"] { border-bottom-color:#2b333d !important; }
body.dark th.th-sort:hover { color:#4cd08a; }
body.dark .ds-menu-item { color:#e6edf3; }
/* quicklink hover (Refrigeration "fr-quicklink" + Generators "gen-quicklink"): the light #f1f5f3 hover made text unreadable in dark mode */
body.dark .fr-quicklink:hover, body.dark .gen-quicklink:hover { background:#273039; }
body.dark .bar-track { background:#232b34; }
/* animated focus ring on a map marker (store pin / floorplan device) when it's clicked from a list */
@keyframes mkPulse {
  0%   { box-shadow: 0 0 0 0 rgba(31,139,77,.55); }
  70%  { box-shadow: 0 0 0 18px rgba(31,139,77,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,139,77,0); }
}
.leaflet-marker-icon.mk-pulse { animation: mkPulse 1.25s ease-out 2; border-radius: 50%; z-index: 10000 !important; }
body.dark .leaflet-marker-icon.mk-pulse { animation-name: mkPulseDark; }
@keyframes mkPulseDark {
  0%   { box-shadow: 0 0 0 0 rgba(76,208,138,.6); }
  70%  { box-shadow: 0 0 0 18px rgba(76,208,138,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,208,138,0); }
}

/* refrigeration Temperature History plot: light bg + gridlines/labels were baked in, so it stayed white in dark mode */
.fr-hist-svg { background:#f8faf9; }
body.dark .fr-hist-svg { background:#161c24; }
body.dark line[stroke="#e8e8e8"] { stroke:#2b333d; }
body.dark text[fill="#999"] { fill:#93a1b0; }

/* ===================== THEMED SCROLLBARS (were default-white in dark mode) ===================== */
* { scrollbar-width: thin; scrollbar-color: #c2cbd4 transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c2cbd4; border-radius: 7px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a7b2bd; background-clip: content-box; }
body.dark { scrollbar-color: #3a444f transparent; }
body.dark ::-webkit-scrollbar-thumb { background: #3a444f; background-clip: content-box; }
body.dark ::-webkit-scrollbar-thumb:hover { background: #4b5763; background-clip: content-box; }

/* ===================== RESPONSIVE NAV (ported from Tsebo) ===================== */
@media (max-width:1399px){ .ds-wrap{ flex-wrap:wrap; height:auto; row-gap:8px } .ds-brand{ flex:0 1 auto } }
@media (max-width: 1399px) {
  .dashboard-selector {
    order: 5;
    flex: 1 1 100%;
    width: 100%
  }

  /* nav no longer reserves row-1 space, so push the controls group to the right */
  .ds-controls {
    margin-left: auto
  }

  /* overview leaves its fixed-viewport grid the moment the header wraps:
     stack cards row-wise (one column), each card sized to its content (nothing clipped) */
  .ov-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
    overflow: visible !important;
    grid-auto-rows: auto
  }

  .ov-col {
    display: contents
  }

  /* neutralise the viewport-fill flex so every card is pure content height */
  .ov-card,
  .ov-flex1 {
    min-height: 0 !important;
    flex: 0 0 auto !important
  }

  .ov-cbody {
    flex: 0 0 auto !important
  }

  .ov-hl-top,
  .ov-water-sub,
  .ov-gen-top,
  .ov-gen-grid,
  .ov-kpi-tou,
  .ov-kpi-temps,
  .ov-kpi-ahrow {
    flex: 0 0 auto !important
  }

  /* fixed plot height when stacked */
  .ov-line {
    height: 130px;
    min-height: 130px;
    flex: 0 0 auto !important
  }
}

/* small-desktop / tablet: 3-up grids → 2-up */
@media (max-width: 1100px) {

  main .grid[style*="repeat(3"] {
    grid-template-columns: 1fr 1fr !important
  }
}

/* tablet portrait: everything stacks to one column */
@media (max-width: 900px) {
  .ds-wrap {
    padding: 8px 16px
  }

  /* header tier 3: logo alone on row 1 (full width, centred); store + time row 2; nav row 3;
     the 3 dots float to the top-right corner */
  .ds-logo-wrap {
    flex: 1 1 100%;
    order: 0;
    justify-content: center
  }

  .ds-kebab-wrap {
    position: absolute;
    top: 8px;
    right: 14px;
    margin-left: 0
  }

  /* controls scale (shrink, never wrap, no scrollbar) to fit their row */
  .ds-controls {
    gap: clamp(6px, 1.4vw, 14px)
  }

  .ds-store {
    width: clamp(84px, 20vw, 200px)
  }

  .ds-sel {
    padding: 6px clamp(17px, 4.5vw, 24px) 6px 7px;
    font-size: clamp(11px, 2.2vw, 13px)
  }

  .ds-lh {
    padding: 0 clamp(6px, 1.8vw, 11px);
    font-size: clamp(10px, 2vw, 11px)
  }

  .tws-range-label {
    width: clamp(104px, 22vw, 190px);
    flex: 0 0 clamp(104px, 22vw, 190px);
    font-size: clamp(13px, 2.4vw, 15px)
  }

  .ds-arrow {
    width: clamp(21px, 5vw, 29px)
  }

  .tws-inline {
    gap: clamp(4px, 1.2vw, 10px)
  }

  main {
    padding: 14px
  }

  main .grid,
  main .grid[style*="repeat(3"] {
    grid-template-columns: 1fr !important
  }

  .bms-shell {
    grid-template-columns: 1fr !important;
    height: auto !important
  }

  .bms-side {
    max-height: 340px
  }

  .bms-right {
    height: 60vh;
    min-height: 320px
  }
}

/* phones: tighten chrome; let wide tables scroll inside their card */
@media (max-width: 640px) {
  .ds-tray {
    flex-wrap: wrap;
    justify-content: center
  }

  .card {
    overflow-x: auto
  }

  .pb-page {
    width: 100% !important;
    padding: 24px !important
  }

  .modal {
    width: 94vw
  }
}
