/* nb.css — shared layout for the monitoring-system demos (EMS, IFMS, IAQ, HVAC).
   Brand tokens come from engine/engine.css (:root --bq-*): navy background, gold
   accent, navy text on gold fills. No ad-hoc colours here. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bq-bg); color: var(--bq-text); font-family: var(--bq-font); -webkit-font-smoothing: antialiased; }

.nb-app { position: relative; min-height: 100vh; max-width: 1440px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-x: hidden; }
.nb-embed { padding: 10px; gap: 8px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; background: linear-gradient(135deg, var(--bq-orange), var(--bq-orange-soft)); box-shadow: 0 0 18px rgba(241,182,33,.5); }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.brand-name span { color: var(--bq-orange); }
.brand-sub { font-size: 11px; color: var(--bq-muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.clock { font-variant-numeric: tabular-nums; color: var(--bq-muted); font-size: 13px; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--bq-ok); border: 1px solid rgba(47,191,113,.4); border-radius: 999px; padding: 4px 10px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bq-ok); animation: nbpulse 1.6s ease-in-out infinite; }
@keyframes nbpulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* chapter chips */
.chapters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--bq-muted); background: var(--bq-panel); border: 1px solid var(--bq-border); border-radius: 999px; padding: 6px 12px 6px 6px; cursor: pointer; transition: background .15s, color .15s; }
.chip-n { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: var(--bq-elevated); color: var(--bq-text); }
.chip.on { color: var(--bq-on-accent); background: var(--bq-orange); border-color: var(--bq-orange); }
.chip.on .chip-n { background: var(--bq-on-accent); color: var(--bq-orange); }

/* visitor actions */
.try-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.try-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bq-orange); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font-family: inherit; font-size: 12px; font-weight: 600; border-radius: 8px; padding: 8px 12px; cursor: pointer; border: 1px solid var(--bq-border); background: var(--bq-elevated); color: var(--bq-text); transition: transform .08s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--bq-orange); border-color: var(--bq-orange); color: var(--bq-on-accent); }
.btn-primary:hover { background: var(--bq-orange-soft); }
.btn-ghost { background: transparent; color: var(--bq-orange); border-color: var(--bq-orange); }
.btn-ghost:hover { background: rgba(241,182,33,.12); }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.panel { background: var(--bq-panel); border: 1px solid var(--bq-border); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.p-one { grid-column: span 1; }
.p-wide { grid-column: span 2; }
.p-full { grid-column: span 3; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel-hint { font-size: 11px; color: var(--bq-faint); }
.pb-chart, .pb-gauge, .pb-bars { width: 100%; height: 240px; }
.alert-scroll { max-height: 300px; overflow-y: auto; }
.panel-alerts { min-height: 120px; }

/* asset tiles (site view) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 10px; }
.tile { background: var(--bq-elevated); border: 1px solid var(--bq-border); border-left: 3px solid var(--bq-ok); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.tile-top { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--bq-muted); text-transform: uppercase; letter-spacing: .02em; }
.tile-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bq-ok); flex: 0 0 auto; }
.tile-val { display: flex; align-items: baseline; gap: 5px; margin: 4px 0 2px; }
.tv { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tu { font-size: 12px; color: var(--bq-muted); }
.tile-sub { font-size: 11px; color: var(--bq-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.st-warning { border-left-color: var(--bq-warning); }
.tile.st-warning .tile-dot { background: var(--bq-warning); }
.tile.st-critical { border-left-color: var(--bq-critical); background: rgba(229,72,77,.10); }
.tile.st-critical .tile-dot { background: var(--bq-critical); animation: nbpulse 1s infinite; }

.nb-foot { font-size: 11px; color: var(--bq-faint); line-height: 1.5; border-top: 1px solid var(--bq-border); padding-top: 10px; }
.nb-foot b { color: var(--bq-muted); }
.foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--bq-faint); }
.foot a { color: var(--bq-orange); text-decoration: none; font-weight: 600; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .p-one, .p-wide, .p-full { grid-column: 1; }
}
@media (max-width: 560px) {
  .nb-app { padding: 10px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .bq-kpi { padding: 10px; overflow: hidden; }
  .bq-kpi .kpi-label { font-size: 10px; letter-spacing: .02em; }
  .bq-kpi .kpi-value { font-size: 21px; }
  .pb-chart, .pb-gauge, .pb-bars { height: 210px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .brand-name { font-size: 16px; }
  .btn { padding: 8px 10px; }
}

/* narration must stay visible on a tall page: pin it to the viewport */
#narration.bq-narration { position: fixed; bottom: 12px; }
