/* ==========================================================================
   IPS-530 demo webapp – components (ported from the Vizora design screens)
   ========================================================================== */

/* Author display rules (flex/inline-flex) must not override the hidden attribute. */
[hidden] { display: none !important; }

/* ---------- typography helpers ---------- */
.eyebrow {
  font: 500 10.5px var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow--wide { letter-spacing: 0.22em; font-size: 11px; }
.muted { color: var(--mut2); }
.num { font-variant-numeric: tabular-nums; }
.title-sm { font: 700 14px var(--font); color: var(--txt); }
.hint { font: 400 12px var(--font); color: var(--mut2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--bd3);
  background: none;
  color: var(--txt3);
  font: 600 12px var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.btn--primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--on-gold); }
.btn--ghost { border-color: transparent; color: var(--mut); }
.btn--ghost:hover { background: var(--hov); color: var(--txt); border-color: transparent; }
.btn--danger { border-color: rgba(217, 106, 91, 0.45); color: var(--crit); }
.btn--danger:hover { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 11.5px; }
.btn--lg { height: 44px; padding: 0 18px; font-size: 14px; }
.btn--block { width: 100%; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 30px; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font: 500 12px var(--font); color: var(--mut); }
.input, .select, .textarea {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--bd3);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--txt);
  font: 400 13.5px var(--font);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(216, 176, 98, 0.18);
}
.input::placeholder { color: var(--faint); }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--mut2) 50%), linear-gradient(135deg, var(--mut2) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.select option { background: var(--surface); color: var(--txt); }
.textarea { min-height: 72px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 9px; font: 400 13px var(--font); color: var(--txt2); cursor: pointer; }
.checkbox input { accent-color: var(--gold); width: 15px; height: 15px; }
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--bd2);
  border-radius: 8px;
  padding: 0 13px;
  height: 38px;
  width: 300px;
  max-width: 100%;
}
.search svg { width: 15px; height: 15px; color: var(--mut2); flex: none; }
.search input { background: none; border: none; outline: none; color: var(--txt); font: 400 13px var(--font); flex: 1; min-width: 0; }

/* ---------- cards / KPI ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 16px 18px;
}
.card--tight { padding: 12px 14px; }
.card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.card__head .title-sm { flex: none; }
.card__head .spacer, .spacer { flex: 1; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.kpi__value { display: flex; align-items: baseline; gap: 5px; }
.kpi__value b { font: 700 22px var(--font); color: var(--txt); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi__value b.is-water { color: var(--water); }
.kpi__value b.is-gold { color: var(--gold); }
.kpi__value b.is-warn { color: var(--warn); }
.kpi__value b.is-crit { color: var(--crit); }
.kpi__value b.is-ok { color: var(--ok); }
.kpi__value span { font: 500 12px var(--font); color: var(--mut2); }
.kpi__sub { font: 400 11.5px var(--font); color: var(--mut2); }

/* ---------- key/value rows ---------- */
.kv { display: flex; flex-direction: column; }
.kv__row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--bdf); }
.kv__row:last-child { border-bottom: none; }
.kv__row > span:first-child { font: 400 12px var(--font); color: var(--mut2); flex: none; }
.kv__row > span:last-child { font: 500 12px var(--font); color: var(--txt2); text-align: right; word-break: break-word; }

/* ---------- chips / status ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 10.5px var(--font);
  color: var(--mut);
  border: 1px solid var(--bd2);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.chip--gold { color: var(--gold); border-color: var(--gold-line); }
.chip--water { color: var(--water); border-color: var(--water); }
.chip--version { font: 700 9.5px var(--font); letter-spacing: 0.1em; color: var(--gold); border-color: var(--gold-line); border-radius: 6px; padding: 3px 7px; }
.chip--sev { font: 700 10px var(--font); letter-spacing: 0.1em; text-transform: uppercase; }
.chip--warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.chip--crit { color: var(--crit); border-color: var(--crit); background: var(--crit-soft); }
.chip--info { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.chip--ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.chip--role { font-weight: 600; }

.status { display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--font); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.status--ok { color: var(--ok); }
.status--warn { color: var(--warn); }
.status--off { color: var(--crit); }
.status--muted { color: var(--mut2); }

.badge-count {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(224, 161, 46, 0.35);
  border-radius: 999px;
  font: 700 10.5px var(--font);
  padding: 2px 8px;
}

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--bd2);
  background: none;
  color: var(--mut);
  border-radius: 999px;
  padding: 7px 14px;
  font: 600 11.5px var(--font);
  cursor: pointer;
}
.filter-chip:hover { border-color: rgba(216, 176, 98, 0.5); }
.filter-chip.is-active { border-color: var(--gold); background: var(--gold-soft); color: var(--txt); }

/* range tabs (24 h / 7 nap / 30 nap) */
.range-tabs { display: flex; gap: 2px; background: var(--surface2); border: 1px solid var(--bd); border-radius: 999px; padding: 3px; }
.range-tabs button { border: none; cursor: pointer; font: 600 11px var(--font); padding: 5px 12px; border-radius: 999px; background: none; color: var(--mut); }
.range-tabs button.is-active { background: var(--gold); color: var(--on-gold); }


/* ---------- period controls (range tabs + day picker) ---------- */
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-pick { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--bd2); background: var(--surface2); color: var(--mut); cursor: pointer; }
.day-pick svg { width: 14px; height: 14px; }
.day-pick input { background: none; border: none; color: var(--txt2); font: 600 11.5px var(--font); outline: none; width: 118px; cursor: pointer; color-scheme: inherit; }
.day-pick.is-active { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.kpi-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.single-value { display: flex; align-items: baseline; gap: 10px; padding: 12px 4px; }
.single-value b { font: 700 26px var(--font); color: var(--info); }
.single-value span { font: 400 12px var(--font); color: var(--mut2); }

/* readings recorded before the meter was configured */
.trow--before .cell { color: var(--crit) !important; }
.trow--before { background: var(--crit-soft); }
.trow--before svg { color: var(--crit); vertical-align: -1px; }

/* ---------- grid table ---------- */
.table { background: var(--surface); border: 1px solid var(--bd); border-radius: 12px; overflow: auto; }
.table__inner { min-width: 100%; }
.trow { display: grid; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--bdf); align-items: center; }
.trow:last-child { border-bottom: none; }
.trow--head { padding: 12px 18px; border-bottom: 1px solid var(--bd2); }
.trow--head span { font: 600 10.5px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mut2); white-space: nowrap; }
.trow--click { cursor: pointer; }
.trow--click:hover { background: var(--hov); }
.trow .cell-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.trow .cell-main b { font: 600 13px var(--font); color: var(--txt); overflow: hidden; text-overflow: ellipsis; }
.trow .cell-main small { font: 400 11px var(--font); color: var(--mut3); flex: none; }
.trow .cell { font: 400 12.5px var(--font); color: var(--txt3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .cell--muted { color: var(--mut2); font-size: 12px; }
.trow .cell--right { text-align: right; }
.trow .cell--strong { font-weight: 600; color: var(--txt); font-size: 13px; }
.table__empty { padding: 28px 18px; text-align: center; color: var(--faint); font: 400 13px var(--font); }

/* ---------- alerts ---------- */
.alert {
  background: var(--surface);
  border: 1px solid var(--bd2);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alert--crit { border-color: rgba(217, 106, 91, 0.45); }
.alert--warn { border-color: rgba(224, 161, 46, 0.4); }
.alert--resolved { background: var(--surface4); border-color: var(--bd); }
.alert__head { display: flex; align-items: center; gap: 11px; }
.alert__title { font: 700 14px var(--font); color: var(--txt); flex: 1; min-width: 0; }
.alert--resolved .alert__title { font-weight: 600; font-size: 13.5px; color: var(--txt3); }
.alert__time { font: 400 11.5px var(--font); color: var(--mut2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.alert__desc { font: 400 13px/1.6 var(--font); color: var(--mut); }
.alert__foot { display: flex; align-items: center; gap: 10px; margin-top: 2px; flex-wrap: wrap; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }
.sidebar {
  width: 236px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface3);
  border-right: 1px solid var(--bd);
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; }
.sidebar__brand img { height: 30px; display: block; }
.sidebar__brand b { display: block; font: 700 13.5px var(--font); color: var(--txt); letter-spacing: 0.01em; line-height: 1.2; }
.sidebar__brand small { display: block; font: 500 9.5px var(--font); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.sidebar__rule { height: 1px; background: var(--bd); margin: 0 18px 14px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; flex: 1; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--mut);
  font: 500 13.5px var(--font);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.nav-btn:hover { background: var(--hov); color: var(--txt); }
.nav-btn.is-active { background: var(--gold-soft); border-color: var(--gold-line); color: var(--txt); }
.nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-btn span { flex: 1; }
.sidebar__user { padding: 14px 12px; border-top: 1px solid var(--bd); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 11.5px var(--font);
  flex: none;
}
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.sidebar__user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sidebar__user .who b { font: 600 12.5px var(--font); color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user .who small { font: 400 10.5px var(--font); color: var(--mut2); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--bd);
  background: var(--surface2);
}
.topbar__title { font: 700 16px var(--font); color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { display: flex; align-items: center; gap: 7px; font: 700 10.5px var(--font); letter-spacing: 0.14em; color: var(--ok); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--ok); animation: ipsblink 2s ease infinite; }
.live--stale { color: var(--warn); }
.live--stale::before { background: var(--warn); animation: none; }
.topbar__meta { font: 400 12px var(--font); color: var(--mut2); white-space: nowrap; }
.toggle-group { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--bd2); border-radius: 999px; padding: 3px; }
.toggle-group button { border: none; cursor: pointer; font: 600 11px var(--font); padding: 5px 12px; border-radius: 999px; background: none; color: var(--mut); }
.toggle-group button.is-active { background: var(--gold); color: var(--on-gold); }
.icon-btn { background: var(--surface); border: 1px solid var(--bd2); color: var(--mut); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--gold); border-color: var(--gold); }
.icon-btn.is-active { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.icon-btn svg { width: 15px; height: 15px; }

.content { flex: 1; overflow: auto; padding: 22px 24px 40px; }
.view { display: flex; flex-direction: column; gap: 16px; animation: ipsfade 0.25s ease both; }

/* ---------- in-place refresh: the page stays, only data areas show loading ---------- */
@keyframes ipsshimmer { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }
.content.is-refreshing .chart-box { position: relative; }
.content.is-refreshing .chart-box canvas { opacity: 0.18; filter: blur(1.5px); transition: opacity 0.2s, filter 0.2s; }
.content.is-refreshing .chart-box::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid var(--bd3); border-top-color: var(--gold); border-radius: 50%; animation: ipsspin 0.8s linear infinite;
}
.content.is-refreshing .kpi__value b,
.content.is-refreshing .kpi__sub,
.content.is-refreshing .trow:not(.trow--head),
.content.is-refreshing .alert,
.content.is-refreshing .kv__row > span:last-child { animation: ipsshimmer 1.1s ease-in-out infinite; }
.content.is-refreshing .range-tabs, .content.is-refreshing .btn, .content.is-refreshing .filter-chip { pointer-events: none; }
.content.is-refreshing .range-tabs button.is-active { opacity: 0.8; }
.view--narrow { max-width: 900px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1.9fr 1fr; gap: 14px; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-head .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.detail-head .titles b { font: 700 19px var(--font); color: var(--txt); }
.detail-head .titles span { font: 400 12.5px var(--font); color: var(--mut2); }

.chart-box { position: relative; height: 280px; }
.chart-box--sm { height: 200px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font: 500 11.5px var(--font); color: var(--mut); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.notice {
  border: 1px solid var(--bd2);
  border-radius: 10px;
  padding: 10px 14px;
  font: 400 12.5px/1.55 var(--font);
  color: var(--mut);
  background: var(--surface4);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.notice--warn { border-color: rgba(224, 161, 46, 0.4); color: var(--txt2); }
.notice--warn svg { color: var(--warn); }
.notice--crit { border-color: rgba(217, 106, 91, 0.45); color: var(--txt2); }
.notice--crit svg { color: var(--crit); }
.notice--info svg { color: var(--water); }

.empty { padding: 32px; text-align: center; color: var(--faint); font: 400 13px var(--font); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--bd3); border-top-color: var(--gold); border-radius: 50%; animation: ipsspin 0.8s linear infinite; display: inline-block; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--mut2); font: 400 13px var(--font); padding: 24px; justify-content: center; }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(12, 10, 7, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: 520px; max-width: 100%; max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--bd3); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--pshadow); }
.modal__head { display: flex; align-items: center; gap: 12px; }
.modal__head .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.modal__head .titles b { font: 700 15px var(--font); color: var(--txt); }
.modal__head .titles span { font: 400 11.5px var(--font); color: var(--mut2); }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.form-grid .field > span { min-height: 18px; }
.form-section { display: flex; flex-direction: column; gap: 10px; }
.form-section__title { display: flex; align-items: center; gap: 6px; font: 600 10.5px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mut2); }
.form-section__title svg { width: 12px; height: 12px; }
.form-section--readonly { background: var(--surface2); border: 1px solid var(--bd); border-radius: 10px; padding: 12px 14px; }
.form-section--readonly .form-section__title { color: var(--gold); }
.form-section--readonly .kv__row { padding: 6px 0; }
.form-grid .field--full { grid-column: 1 / -1; }
.meter-picker { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; border: 1px solid var(--bd); border-radius: 8px; padding: 8px 10px; background: var(--surface2); }

/* drop zone */
.dropzone { border: 1px dashed var(--bd4); border-radius: 12px; padding: 18px; text-align: center; color: var(--mut2); font: 400 12.5px var(--font); background: var(--surface4); }
.dropzone.is-over { border-color: var(--gold); background: var(--gold-soft); color: var(--txt); }

/* header call-to-action when a newer build is deployed */
@keyframes ipsattention { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 161, 46, 0.55); } 50% { box-shadow: 0 0 0 7px rgba(224, 161, 46, 0); } }
.update-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: #E0A12E; border: 1px solid #E0A12E; color: #1A170F; font: 700 12px var(--font); white-space: nowrap;
  animation: ipsattention 1.6s ease-out infinite;
}
.update-btn:hover { background: #F0B54A; border-color: #F0B54A; }
.update-btn svg { width: 15px; height: 15px; animation: ipsspin 2.4s linear infinite; }
.update-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 16px;
  background: var(--panel); border: 1px solid var(--gold-line); border-radius: 12px; box-shadow: var(--pshadow);
  color: var(--txt); font: 500 12.5px var(--font); max-width: calc(100vw - 32px); animation: ipsfade 0.3s ease both;
}
.update-bar svg { width: 16px; height: 16px; color: var(--gold); flex: none; }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 80; background: var(--panel); border: 1px solid var(--bd3); color: var(--txt); border-radius: 10px; padding: 10px 14px; font: 500 12.5px var(--font); box-shadow: var(--pshadow); max-width: 360px; }
.toast--err { border-color: var(--crit); }
.toast--ok { border-color: var(--ok); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid, .kpi-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .two-col--wide, .three-col { grid-template-columns: 1fr; }
}
/* Mobile: the sidebar becomes a fixed bottom tab bar (icon + label, evenly spaced, no scrolling);
   sign-out and password move into the top bar. */
.topbar__mobile { display: none; }
.mobile-brand { display: none; }
@media (max-width: 820px) {
  .shell { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    width: 100%; height: 64px; flex-direction: row; align-items: stretch;
    border-right: none; border-top: 1px solid var(--bd2); background: var(--panel);
    padding: 0 max(4px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-right));
    backdrop-filter: blur(8px);
  }
  .sidebar__brand, .sidebar__rule, .sidebar__user { display: none; }
  .sidebar__nav { flex-direction: row; padding: 0; gap: 0; flex: 1; overflow: visible; }
  .nav-btn {
    flex: 1 1 0; min-width: 0; width: auto; flex-direction: column; justify-content: center; gap: 4px;
    padding: 6px 2px; border-radius: 10px; border: none; margin: 6px 2px; font: 500 10.5px var(--font); line-height: 1.1;
  }
  .nav-btn.is-active { background: var(--gold-soft); }
  .nav-btn svg { width: 20px; height: 20px; }
  .nav-btn span { display: block; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
  .nav-btn .badge-count { position: absolute; top: 2px; right: 6px; transform: none; font-size: 9.5px; padding: 1px 5px; line-height: 1.3; }
  .nav-btn { position: relative; }
  .content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .mobile-brand {
    display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
    background: var(--surface3); border-bottom: 1px solid var(--bd); font: 500 11px var(--font); color: var(--mut);
  }
  .mobile-brand__logo { height: 20px; width: auto; display: none; }
  :root[data-ips-theme="dark"] .mobile-brand__logo--dark, :root:not([data-ips-theme="light"]) .mobile-brand__logo--dark { display: block; }
  :root[data-ips-theme="light"] .mobile-brand__logo--light { display: block; }
  .mobile-brand__title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; border-left: 1px solid var(--bd2); color: var(--txt2); }
  .mobile-brand__version { font: 700 9.5px var(--font); letter-spacing: 0.08em; color: var(--gold); border: 1px solid var(--gold-line); border-radius: 6px; padding: 1px 6px; }
  .period { flex-wrap: nowrap; width: 100%; gap: 6px; }
  .period .range-tabs { flex: 1 1 auto; min-width: 0; padding: 2px; }
  .period .range-tabs button { flex: 1; padding: 6px 4px; font-size: 10.5px; white-space: nowrap; }
  .period .day-pick { flex: none; height: 30px; padding: 0 6px; gap: 4px; }
  .period .day-pick input { width: 92px; font-size: 10.5px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__meta, .chip--version, .topbar .live, #previewChip { display: none; }
  .update-btn { padding: 0 10px; font-size: 11px; gap: 6px; }
  .update-btn__long { display: none; }
  .topbar__mobile { display: inline-flex; }
  .toggle-group button { padding: 5px 9px; }
  .form-grid { grid-template-columns: 1fr; }
  /* header call-to-action when a newer build is deployed */
@keyframes ipsattention { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 161, 46, 0.55); } 50% { box-shadow: 0 0 0 7px rgba(224, 161, 46, 0); } }
.update-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: #E0A12E; border: 1px solid #E0A12E; color: #1A170F; font: 700 12px var(--font); white-space: nowrap;
  animation: ipsattention 1.6s ease-out infinite;
}
.update-btn:hover { background: #F0B54A; border-color: #F0B54A; }
.update-btn svg { width: 15px; height: 15px; animation: ipsspin 2.4s linear infinite; }
.update-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: none; }
  .modal { max-height: calc(100vh - 100px); }
  /* meter detail header: title on its own full-width row, tabs stretched */
  .detail-head { gap: 10px; }
  .detail-head .titles { flex: 1 1 100%; order: -1; }
  .detail-head .titles b { font-size: 17px; }
  .detail-head .titles span { word-break: normal; }
  .detail-head .period, .toolbar .period { flex: 1 1 100%; }
}

.two-col--wide { grid-template-columns: 2.4fr 1fr; }
