/* Interface styles. The canvas simulation and its content live in index.html. */
body.scenic-view .welcome, body.scenic-view .telemetry, body.scenic-view #legend { display: none !important; }
body:not(.view3d) #bScenic { display: none; }
:root {
  --panel: rgba(255, 255, 255, .94);
  --panel-solid: rgba(255, 255, 255, .985);
  --text: #182c40;
  --muted: #63778b;
  --line: rgba(44, 70, 99, .12);
  --chip: #f2f6fa;
  --accent: #2469e8;
  --shadow: 0 8px 28px rgba(33, 61, 91, .07), 0 1px 3px rgba(33, 61, 91, .04);
  color-scheme: light;
}
body.night {
  --panel: rgba(17, 28, 46, .96);
  --panel-solid: rgba(17, 28, 46, .99);
  --text: #e7effa;
  --muted: #a0b1c8;
  --line: rgba(180, 202, 235, .14);
  --chip: #1c2c43;
  --accent: #80adff;
  --shadow: 0 8px 30px rgba(0, 0, 0, .18);
  color-scheme: dark;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, [tabindex]:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
button:disabled { cursor: not-allowed; opacity: .38; }
button { touch-action: manipulation; }
.ui-icon { width: 19px; height: 19px; display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 24px; z-index: 100; padding: 12px 20px; color: var(--text); background: var(--panel); border-radius: 10px; }
.skip-link:focus { top: 20px; }
.top { top: 18px; left: 24px; right: 24px; height: 72px; padding: 0 18px; gap: 24px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(18px); pointer-events: auto; }
.brand { padding: 0; gap: 11px; background: none; box-shadow: none; backdrop-filter: none; flex: none; }
.logo { width: 40px; height: 42px; border-radius: 12px; background: #2469e8; box-shadow: 0 4px 10px #2469e826; }
.logo .ui-icon { width: 26px; height: 26px; stroke-width: 1.6; }
.brand h1 { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: -.8px; }
.brand-accent { color: var(--accent, #1e88e5); }
.brand-tag { font-size: 9px; letter-spacing: 1.4px; font-weight: 600; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.brand p { margin-top: 4px; font-size: 10px; letter-spacing: .1px; }
.search-trigger { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--muted); background: var(--chip); border: 1px solid var(--line); border-radius: 10px; height: 38px; padding: 0 12px; cursor: pointer; font-size: 11px; min-width: 0; }
kbd { font: 10px/1.5 Inter, system-ui, sans-serif; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); }
.search-trigger kbd { margin-left: 16px; background: var(--panel); }
.ctrls { flex-wrap: nowrap; gap: 5px; }
.ctrls button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; height: 40px; padding: 0 12px; border: 0; border-radius: 9px; box-shadow: none; background: transparent; backdrop-filter: none; white-space: nowrap; }
.ctrls button:hover, .view-tools button:hover, .map-tools button:hover, .x:hover { background: var(--chip); transform: none; }
.ctrls button.active { color: var(--accent); background: var(--chip); }
.ctrls .primary { background: #2469e8; color: #fff; font-size: 12px; margin-left: 8px; padding: 0 16px; box-shadow: 0 3px 8px #2469e81a; }
.ctrls .primary:hover, .explore-button:hover { background: #1858cc; }
.ctrls .primary.stop { background: #b93648; }
.welcome { position: fixed; top: 128px; left: 36px; width: 258px; z-index: 4; transition: opacity .2s; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 9px; font-weight: 700; letter-spacing: 1.8px; color: var(--muted); }
.live { width: 6px; height: 6px; background: #1ca780; animation: none; }
.welcome h2 { font-size: 32px; letter-spacing: -1.2px; line-height: 1.15; margin: 18px 0 12px; font-weight: 700; }
.welcome p { font-size: 12px; line-height: 1.85; color: var(--muted); margin: 0; }
.city-stats { display: flex; gap: 0; margin: 23px 0; }
.city-stats > div { padding: 0 16px; border-right: 1px solid var(--line); }
.city-stats > div:first-child { padding-left: 0; }
.city-stats > div:last-child { padding-right: 0; border: 0; }
.city-stats b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.city-stats span { display: block; font-size: 9px; color: var(--muted); margin-top: 5px; white-space: nowrap; }
.explore-button { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 42px; padding: 0 15px; border: 0; border-radius: 10px; background: #2469e8; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.about-button { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; margin-top: 13px; border: 0; padding: 4px 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.about-button .ui-icon { width: 14px; height: 14px; }
.install-button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 38px; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: 600 11px Inter, system-ui, sans-serif; cursor: pointer; }
.install-button:hover { background: var(--chip); }
#bInstall[hidden], #installHelp[hidden] { display: none !important; }
.welcome #installHelp { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 11px; line-height: 1.5; }
body.panel-open .welcome, body.inside .welcome, body.story .welcome, body.riding .welcome { display: none; }
.view-tools, .map-tools { position: fixed; z-index: 5; display: flex; align-items: center; gap: 3px; padding: 5px; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.view-tools { top: 112px; right: 24px; }
.view-tools button, .map-tools button { display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; min-width: 36px; padding: 0 9px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.view-tools button[aria-pressed="true"], .map-tools button[aria-pressed="true"] { color: var(--accent); background: var(--chip); }
.tool-divider { height: 20px; width: 1px; background: var(--line); margin: 0 3px; flex: none; }
.map-tools { right: 24px; bottom: 150px; flex-direction: column; }
.map-tools .tool-divider { width: 22px; height: 1px; margin: 4px 0; }
#zoomLevel { font-size: 9px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding: 2px 0; }
body.panel-open .view-tools { right: 448px; }
body.panel-open .map-tools { right: 448px; }
.hint { top: auto; bottom: 137px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 0; background: var(--panel); color: var(--muted); font-size: 10px; border-radius: 8px; white-space: nowrap; }
.hint .ui-icon { width: 14px; height: 14px; }
.hint i { height: 3px; width: 3px; background: var(--muted); border-radius: 50%; opacity: .5; }
body.panel-open .hint { display: none; }
#legend { left: 36px; bottom: 153px; box-shadow: none; padding: 14px 16px; gap: 10px; border-radius: 12px; font-size: 10px; }
#legend b { font-size: 9px; letter-spacing: 1.3px; margin-bottom: 3px; }
#legend i { width: 9px; height: 9px; border-width: 2px; border-radius: 3px; }
.telemetry { position: fixed; left: 24px; right: 24px; bottom: 20px; z-index: 5; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(14px); padding: 13px 18px 15px; }
.telemetry-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; letter-spacing: 1.2px; font-weight: 600; padding-bottom: 12px; }
.telemetry-label > span:first-child { display: flex; align-items: center; gap: 7px; }
.telemetry-label i { width: 5px; height: 5px; border-radius: 50%; background: #1ca780; }
.telemetry-label > span:last-child { font-size: 10px; letter-spacing: .2px; }
.partner-cross { opacity: .4; margin: 0 6px; }
#ticker { position: static; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
#ticker > div { display: grid; grid-template-columns: 30px 1fr; align-content: center; gap: 3px 10px; border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 0 18px; box-shadow: none; background: none; backdrop-filter: none; font-size: 10px; }
#ticker > div:first-child { padding-left: 0; }
#ticker > div:last-child { border: 0; padding-right: 0; }
.metric-icon { grid-row: span 2; align-self: center; display: grid; place-items: center; width: 30px; height: 32px; color: var(--accent); background: var(--chip); border-radius: 9px; }
.metric-icon .ui-icon { width: 16px; height: 16px; }
#ticker b { font-size: 17px; font-weight: 600; letter-spacing: -.5px; }
#panel { top: 110px; right: 24px; bottom: 137px; width: 402px; padding: 24px; border-radius: 16px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
#panel .p-head { gap: 12px; }
.p-ico { width: 42px; height: 44px; font-size: 22px; border-radius: 12px; }
.p-kicker { font-size: 9px; letter-spacing: 1.2px; line-height: 1.5; }
.p-head h2 { font-size: 20px; letter-spacing: -.5px; line-height: 1.25; }
.p-sum { font-size: 13px; line-height: 1.8; color: var(--muted); opacity: 1; }
.x { display: grid; place-items: center; border-radius: 8px; }
#panel h3 { font-size: 9px; letter-spacing: 1.3px; margin: 23px 0 10px; }
.metric { padding: 13px; border-radius: 11px; }
.metric b { font-size: 21px; font-weight: 600; margin-top: 6px; }
.metric span { font-size: 10px; }
#panel li { font-size: 12px; line-height: 1.7; }
.p-actions button { font-size: 11px; height: 32px; border-radius: 8px; }
.chips span { font-size: 10px; line-height: 1.5; }
.tourbtn { border-radius: 10px; height: auto; min-height: 42px; padding: 10px 12px; line-height: 1.5; background: #2469e8; font-size: 12px; box-shadow: none; }
.p-nav button { font-size: 11px; border-radius: 8px; }
.p-meta { font-size: 11px; line-height: 1.5; }
.p-meta dd { overflow-wrap: anywhere; }
.product-source { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 11px; font-weight: 600; text-underline-offset: 3px; }
.product-note { color: var(--muted); font-size: 10px; line-height: 1.65; margin: 8px 0; }
.catalog-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.catalog-products .pcard { min-width: 0; }
.catalog-products .pcard small { display: block; margin-top: 4px; font-size: 10px; }
.catalog-products .pcard span { display: block; line-height: 1.5; margin-top: 4px; }
table.bom { font-size: 11px; }
.bom .mdl { white-space: normal; overflow-wrap: anywhere; }
.bom th { font-size: 9px; }
.bom td { padding: 10px 5px; }
#panel [role="button"]:hover { background-color: var(--chip); }
#story { top: 112px; width: min(520px, calc(100% - 48px)); }
body.panel-open #story { left: calc((100% - 448px) / 2); }
.backcity { top: 112px; left: 24px; font-size: 12px; height: 40px; background: #2469e8; }
#tip { max-width: min(420px, calc(100vw - 32px)); white-space: normal; text-align: center; font-size: 11px; line-height: 1.5; }
#lbStrip button { display: block; padding: 3px; border: 2px solid transparent; background: transparent; border-radius: 12px; cursor: pointer; }
#lbStrip button[aria-pressed="true"] { border-color: #80adff; }
#lbStrip img { display: block; }
#lbMain { max-width: 100%; }
#lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; color: #e7effa; }
#lightbox::backdrop { background: #080c14; }
#lbCap { text-align: center; }
#searchDialog { width: min(590px, calc(100vw - 32px)); max-height: min(700px, calc(100dvh - 64px)); border: 1px solid var(--line); border-radius: 20px; padding: 24px; color: var(--text); background: var(--panel); box-shadow: 0 30px 100px #071b3c40; overflow: auto; }
#searchDialog::backdrop { background: #0e21385e; backdrop-filter: blur(6px); }
.search-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.search-heading h2 { font-size: 23px; letter-spacing: -.8px; margin: 10px 0 20px; }
.search-field { display: flex; align-items: center; gap: 10px; background: var(--chip); padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
#citySearch { width: 100%; min-width: 0; height: 46px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 12px; }
#citySearch::placeholder { color: var(--muted); }
.search-filters { display: flex; gap: 6px; margin-top: 16px; }
.search-filters button { font-size: 11px; font-weight: 600; padding: 7px 12px; border: 1px solid var(--line); background: transparent; border-radius: 7px; color: var(--muted); cursor: pointer; }
.search-filters button[aria-pressed="true"] { background: #2469e8; color: white; border-color: #2469e8; }
#searchCount { font-size: 10px; color: var(--muted); margin: 16px 0 8px; }
#searchResults { max-height: 340px; overflow: auto; padding: 4px; margin: 0 -4px; scrollbar-width: thin; }
.search-result { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.search-result:hover, .search-result:focus-visible { background: var(--chip); }
.result-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; font-size: 20px; background: var(--chip); border-radius: 9px; }
.result-copy { min-width: 0; flex: 1; }
.result-copy b { display: block; font-size: 12px; line-height: 1.5; }
.result-copy small { display: block; color: var(--muted); font-size: 10px; line-height: 1.6; margin-top: 2px; }
.search-result > .ui-icon { color: var(--muted); width: 15px; }
.empty-search { padding: 26px 12px; text-align: center; font-size: 13px; }
.empty-search p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.search-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.search-footer kbd { margin-right: 4px; }
@media (max-width: 1200px) {
  .top { gap: 14px; }
  .brand-tag { display: none; }
  .search-trigger .search-label { display: none; }
  .search-trigger kbd { margin-left: 4px; }
  .welcome { width: 220px; }
  .welcome h2 { font-size: 29px; }
  .city-stats > div { padding: 0 12px; }
  #ticker > div { padding: 0 12px; grid-template-columns: 1fr; }
  .metric-icon { display: none; }
  #ticker b { font-size: 16px; }
}
@media (max-width: 1000px) and (min-width: 821px) {
  .welcome { width: 195px; left: 28px; }
  .welcome h2 { font-size: 26px; }
  .welcome p { font-size: 11px; }
  .city-stats > div { padding: 0 9px; }
  .city-stats b { font-size: 19px; }
  .city-stats span { font-size: 8px; }
  .view-tools { top: 108px; }
  body.panel-open .view-tools { right: auto; left: 24px; }
  body.panel-open #legend { display: none; }
}
@media (max-width: 820px) {
  .top { top: 10px; left: 12px; right: 12px; height: auto; display: grid; grid-template-columns: 1fr auto; gap: 14px 8px; padding: 14px; border-radius: 15px; }
  .brand { padding: 0; gap: 9px; }
  .logo { width: 34px; height: 36px; border-radius: 10px; }
  .logo .ui-icon { width: 23px; height: 23px; }
  .brand h1 { font-size: 19px; }
  .brand p { font-size: 9px; }
  .brand-tag { display: inline; font-size: 8px; letter-spacing: 1px; }
  .search-trigger { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .search-trigger kbd { display: none; }
  .ctrls { grid-column: 1 / -1; display: grid; grid-template-columns: .9fr .9fr 1.15fr 1fr 1.25fr; gap: 3px; border-top: 1px solid var(--line); padding-top: 10px; }
  .ctrls button { padding: 0 5px; gap: 5px; height: 35px; min-width: 0; font-size: 10px; }
  .ctrls button span { display: inline-flex; }
  .ctrls .primary { margin: 0; padding: 0 7px; font-size: 10px; }
  .ctrls .ui-icon { width: 15px; height: 15px; }
  .welcome { top: 160px; left: 24px; width: 230px; }
  .welcome h2 { font-size: 25px; margin: 12px 0 9px; }
  .welcome h2 br { display: none; }
  .welcome p { font-size: 11px; line-height: 1.7; }
  .welcome p br { display: none; }
  .welcome .eyebrow { font-size: 8px; letter-spacing: 1.4px; }
  .city-stats { margin: 15px 0; }
  .city-stats b { font-size: 19px; }
  .city-stats span { font-size: 8px; }
  .welcome .explore-button { height: 36px; width: 190px; font-size: 11px; }
  .welcome .about-button { display: none; }
  .welcome .install-button { width: 190px; min-height: 36px; }
  .view-tools, body.panel-open .view-tools { top: auto; bottom: 64px; left: 12px; right: auto; gap: 0; }
  .map-tools, body.panel-open .map-tools { bottom: 12px; top: auto; left: 12px; right: 12px; flex-direction: row; gap: 0; justify-content: space-between; }
  .view-tools button, .map-tools button { width: 36px; min-width: 32px; height: 36px; padding: 0; }
  .map-tools button { flex: 1; }
  .view-tools button > span:not([data-icon]) { display: none; }
  .map-tools .tool-divider { width: 1px; height: 20px; margin: 0 3px; }
  #zoomLevel { display: none; }
  .telemetry { display: none; }
  .hint { bottom: 124px; padding: 7px 10px; gap: 7px; font-size: 9px; }
  #panel { top: auto; bottom: 124px; left: 12px; right: 12px; width: auto; max-height: min(50dvh, calc(100dvh - 295px)); padding: 20px; border-radius: 16px; transform: translateY(calc(100% + 150px)); }
  body.story #panel { max-height: calc(100dvh - 290px - 23dvh); }
  #panel.open { transform: none; }
  .p-head h2 { font-size: 19px; }
  .backcity { top: 152px; bottom: auto; left: 12px; transform: none; height: 34px; font-size: 11px; }
  body.panel-open #story, #story { top: 152px; left: 50%; width: calc(100% - 24px); max-height: 23dvh; overflow: auto; padding: 10px 12px; }
  #story h4 { font-size: 14px; }
  #story p { font-size: 11px; line-height: 1.5; }
  .st-top { font-size: 9px; }
  #searchDialog { padding: 20px; }
  .search-heading h2 { font-size: 21px; }
  .search-footer { font-size: 9px; }
  #lbMain img { max-width: 100%; padding: 10px; }
}
@media (max-width: 480px) {
  .welcome { top: 159px; width: 215px; }
  .welcome h2 { font-size: 22px; }
  .welcome p { display: none; }
  .welcome #installHelp { display: block; }
  .welcome .install-button { width: 178px; }
  .city-stats { margin: 13px 0; }
  .welcome .explore-button { width: 178px; }
  .hint span:last-child, .hint i:last-of-type { display: none; }
}
@media (max-width: 360px) {
  .brand-tag { display: none; }
  .ctrls button { font-size: 9px; gap: 4px; }
  .ctrls .primary { font-size: 9px; }
  .ctrls .ui-icon { width: 13px; height: 13px; }
  #panel { padding: 16px; }
  .search-heading h2 { font-size: 18px; }
  .search-filters button { padding: 7px 9px; }
}
@media (max-height: 700px) and (min-width: 821px) {
  .welcome { top: 115px; }
  .welcome h2 { font-size: 25px; margin: 12px 0 8px; }
  .welcome p, .welcome .about-button { display: none; }
  .city-stats { margin: 14px 0; }
  #legend { bottom: 140px; gap: 6px; }
}
@media (max-height: 600px) and (max-width: 820px) and (orientation: landscape) {
  .top { top: 8px; padding: 10px; grid-template-columns: auto auto 1fr; gap: 10px; }
  .brand p, .brand-tag { display: none; }
  .ctrls { grid-column: auto; border: 0; padding: 0; }
  .welcome { top: 86px; }
  .welcome h2 { font-size: 19px; }
  .welcome .city-stats { display: none; }
  .welcome .explore-button { margin-top: 12px; }
  #panel, body.story #panel { top: 78px; bottom: 124px; left: auto; width: min(380px, 60vw); max-height: none; }
  body.panel-open #story, #story { top: 80px; left: 12px; transform: none; width: 33vw; max-height: calc(100dvh - 210px); }
  .backcity { top: 78px; }
}
@media (min-height: 601px) and (max-height: 700px) and (max-width: 820px) {
  .welcome .city-stats { display: none; }
  .welcome h2 { font-size: 20px; }
  .welcome .explore-button { margin-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.utility-flow.power { border-left: 3px solid #d98a08; padding-left: 9px; }
.utility-flow.water { border-left: 3px solid #00a7db; padding-left: 9px; }
#panel .utility-note { font-size: 12px; color: var(--muted); }

/* Performance: the city canvas repaints every frame, so any frosted-glass blur over it is
   recomputed every frame too and competes with the map for GPU time (slow panel slide-in,
   choppy camera fly-to). The bars are made nearly opaque instead, which looks the same. */
.top, .ctrls button, .view-tools, .map-tools, .telemetry, #panel, #legend, #story, .p-actions button, .p-nav button, .tourbtn {
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.top, .view-tools, .map-tools, .telemetry, #panel, #legend, #story { background: var(--panel-solid); }
#panel { will-change: transform; contain: layout paint; }

/* Device insights (device-insights.js): connections, rules, MQTT, health and tests for IRIV devices. */
.ins-card { background: var(--chip); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.ins-note { font-size: 11.5px; margin: 6px 0 0; }
.ins-map { width: 100%; display: block; }
.ins-map text { font-family: Inter, sans-serif; }
.ins-node { cursor: pointer; }
.ins-node:hover rect { stroke-width: 2.5; }
.ins-flow { stroke-dasharray: 5 5; animation: ins-flow 1s linear infinite; }
.ins-map.down .ins-flow { stroke: #c62828; stroke-dasharray: 3 6; animation: none; }
@keyframes ins-flow { to { stroke-dashoffset: -10; } }
.ins-rule { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); margin-bottom: 8px; }
.ins-rule code { font: 600 12px/1.45 ui-monospace, Consolas, monospace; color: var(--text); }
.ins-live { font-size: 12px; color: var(--muted); }
.ins-runs { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.ins-runs b { color: var(--text); }
.ins-chip { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: var(--line); color: var(--muted); }
.ins-chip.t { background: #e6f4ea; color: #2e7d32; }
.ins-chip.p { background: #fdecea; color: #c62828; }
.ins-outs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ins-out { display: flex; flex-direction: column; gap: 5px; padding: 10px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ins-out:hover { border-color: var(--zc); }
.ins-out:disabled { opacity: .5; cursor: not-allowed; }
.ins-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; }
.ins-led { width: 10px; height: 10px; border-radius: 50%; background: #c9d1d9; flex: none; }
.ins-led.on { background: #ff5252; box-shadow: 0 0 0 3px #ff525233; }
.ins-pin { font: 700 10.5px ui-monospace, Consolas, monospace; color: #e53935; }
.ins-out small { font-size: 11px; color: var(--muted); }
.ins-net { display: flex; align-items: center; gap: 12px; }
.ins-dot { width: 12px; height: 12px; border-radius: 50%; background: #2e7d32; flex: none; }
.ins-net.off .ins-dot { background: #c62828; }
.ins-state { flex: 1; font-size: 12.5px; line-height: 1.45; }
.ins-btn { font: inherit; font-size: 12.5px; font-weight: 700; border: 1px solid #f3c7c7; background: #fff5f5; color: #c62828; padding: 8px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.ins-btn.good { border-color: #bfe3c7; background: #f1faf3; color: #2e7d32; }
.ins-feed { background: #0f1724; border-radius: 12px; padding: 8px 10px; height: 200px; overflow: auto; font: 11.5px/1.5 ui-monospace, Consolas, monospace; color: #cfe3f5; }
.ins-msg { padding: 4px 0; border-bottom: 1px solid #ffffff12; }
.ins-tp { color: #80cbc4; } .ins-msg.dn .ins-tp { color: #ffcc80; }
.ins-pl { color: #9ef0c0; word-break: break-all; }
.ins-st { float: right; font-size: 10px; padding: 0 5px; border-radius: 4px; background: #ffffff14; color: #cfd8dc; }
.ins-st.q { background: #ffb30033; color: #ffd54f; } .ins-st.x { background: #ff525233; color: #ff8a80; }
.ins-health { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ins-health div { background: var(--chip); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.ins-health span { display: block; font-size: 11px; color: var(--muted); }
.ins-health b { display: block; font-size: 13.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ins-bus { margin-top: 8px; }
.ins-sites { display: grid; gap: 6px; }
.ins-site { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.ins-site:hover { border-color: var(--zc); }
.ins-site b { display: block; font-size: 13px; } .ins-site small { font-size: 11.5px; color: var(--muted); }
.ins-here { border-color: var(--zc); cursor: default; }
.ins-go { margin-left: auto; color: var(--muted); }
.ins-cmp { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ins-cmp th, .ins-cmp td { padding: 6px 7px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.ins-cmp td:first-child { color: var(--muted); width: 22%; }
.ins-cmp .ins-me { background: color-mix(in srgb, var(--zc) 9%, transparent); font-weight: 600; }
.ins-prod { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; }
.ins-film { display: flex; align-items: center; gap: 12px; padding: 8px; margin-bottom: 8px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.ins-film:hover { border-color: var(--zc); }
.ins-film img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.ins-film span { display: grid; gap: 2px; font-size: 13px; }
.ins-film small { color: var(--muted, #6b7280); font-size: 11px; }
.ins-prod:hover { border-color: var(--zc); }
.ins-cam svg { width: 100%; display: block; border-radius: 12px; background: #000; }
.ins-cam g[class^="ins-"] { transform-box: view-box; }
.ins-cam text { font-family: Inter, sans-serif; }
.ins-walk { animation: ins-walk 9s ease-in-out infinite alternate; }
.ins-drive { animation: ins-drive 6s linear infinite; }
.ins-belt { animation: ins-belt 5s linear infinite; }
@keyframes ins-walk { to { transform: translateX(var(--dx, 120px)); } }
@keyframes ins-drive { from { transform: translateX(-110px); } to { transform: translateX(330px); } }
@keyframes ins-belt { from { transform: translateX(-70px); } to { transform: translateX(70px); } }
@media (prefers-reduced-motion: reduce) { .ins-walk, .ins-drive, .ins-belt, .ins-flow { animation: none; } }

/* Short desktop windows: the device legend would sit on top of the welcome card, so it hides while the welcome card shows. */
@media (max-height: 900px) and (min-width: 821px) {
  body:not(.panel-open):not(.inside):not(.story):not(.riding) #legend { display: none; }
}

/* the "Go inside" button under a place title (city3d.js) */
#panel .go-inside { display: block; width: 100%; margin: 2px 0 14px; font-size: 13px; font-weight: 700; }

/* Warehouse Command 3D inside the dashboard (city3d.js) */
#whLayer { position: fixed; inset: 0; z-index: 60; background: #0b1220; }
#whLayer iframe { width: 100%; height: 100%; border: 0; display: block; }
#whLayer #whBack { position: fixed; top: auto; bottom: 14px; right: 14px; left: auto; z-index: 61; }
#whLayer.ready #whBack { display: none; }   /* the warehouse shows its own Back to city button */
