:root {
  color-scheme: dark;
  --bg: #101317;
  --panel: #191d23;
  --surface: #212730;
  --line: #39414d;
  --text: #edf0f4;
  --muted: #adb6c3;
  --accent: #ffad66;
  --on-accent: #201107;
  --fire: #ff7780;
  --fault: #ffc266;
  --ok: #6edba4;
  --offline: #bdc5d0;
  --shadow: 0 18px 50px #0005;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #fff;
  --surface: #edf0f4;
  --line: #c7ced8;
  --text: #17202d;
  --muted: #556171;
  --accent: #a93d0c;
  --on-accent: #fff;
  --fire: #b51c30;
  --fault: #805200;
  --ok: #146b42;
  --offline: #566174;
  --shadow: 0 18px 50px #24314625;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.45 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
button,
input,
a {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  gap: 8px;
}
button:hover,
.button:hover {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 700;
}
a {
  color: var(--accent);
}
[hidden] {
  display: none !important;
}
.object-plan-toolbar { margin-bottom: 10px; }
.plan-legend { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 10px 0; color: var(--muted); font-size: 12px; }
.plan-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.plan-dot.ok, .plan-marker.ok { background: var(--ok); }
.plan-dot.fault, .plan-marker.fault { background: var(--fault); }
.plan-dot.fire, .plan-marker.fire { background: var(--fire); }
.plan-dot.offline, .plan-marker.offline { background: var(--offline); }
.plan-scroll { max-height: 64vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.plan-stage { position: relative; min-width: 760px; line-height: 0; }
.plan-stage > img { display: block; width: 100%; height: auto; }
.plan-marker { position: absolute; transform: translate(-50%, -50%); width: 25px; height: 25px; padding: 0; min-height: 0; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 5px #000a; cursor: pointer; z-index: 2; }
.plan-marker.manual { border-radius: 5px; }
.plan-marker:hover, .plan-marker:focus { outline: 3px solid #172025; z-index: 3; }
.plan-marker span { position: absolute; left: 50%; top: 27px; transform: translateX(-50%); padding: 2px 4px; border-radius: 4px; background: #fffffff0; color: #172025; font-size: 10px; font-weight: 800; line-height: 1; white-space: nowrap; }
.plan-selected { min-height: 50px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; }
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  letter-spacing: -0.7px;
}
h2 {
  font-size: 23px;
  line-height: 1.25;
}
h3 {
  font-size: 16px;
}
small,
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
}
.error {
  color: var(--fire);
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
input {
  width: 100%;
  margin-top: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  min-height: 46px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 19px;
  white-space: nowrap;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.brand-mark {
  display: block;
  flex: 0 0 42px;
  object-fit: contain;
  width: 42px;
  height: 42px;
  border-radius: 10px;
}
.brand-frame {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  overflow: hidden;
  border-radius: 10px;
}
.brand-frame .brand-mark {
  border-radius: 0;
  transform: scale(1.47);
}
.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 20%, #a94a161f, transparent 60%), var(--bg);
}
.auth-card {
  width: min(100%, 440px);
  padding: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  margin: 30px 0 10px;
  font-size: 29px;
}
.auth-card p {
  color: var(--muted);
  margin-bottom: 22px;
}
.auth-card form {
  display: grid;
  gap: 17px;
}
.auth-card > button {
  width: 100%;
  margin-top: 12px;
}
.auth-card .error {
  color: var(--fire);
  margin: 15px 0;
  min-height: 22px;
}
.auth-card > a {
  font-size: 13px;
}
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
header {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
nav a {
  text-decoration: none;
  color: var(--muted);
}
.current {
  font-weight: 650;
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.header-actions button {
  font-size: 12px;
}
.overview {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 26px 28px 20px;
}
.overview-title {
  min-width: 210px;
}
.overview-title p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}
.counters {
  display: grid;
  grid-template-columns: repeat(5, minmax(95px, 1fr));
  gap: 12px;
  width: 100%;
}
.counter {
  min-height: 86px;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: var(--panel);
  padding: 14px 18px;
}
.counter b {
  font-size: 29px;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.counter span {
  font-size: 12px;
  color: var(--muted);
}
.counter[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.fire {
  color: var(--fire);
}
.fault {
  color: var(--fault);
}
.ok {
  color: var(--ok);
}
.offline {
  color: var(--offline);
}
.healthbar {
  margin: 0 28px 16px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 12px;
}
.healthbar.stale {
  border-color: var(--fault);
  color: var(--fault);
}
.healthbar button {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}
.healthbar.stale span {
  color: var(--fault);
}
main {
  flex: 1;
  min-height: 380px;
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: 18px;
  margin: 0 28px 18px;
}
.object-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.searchbox {
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}
.list-meta button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  padding: 4px 8px;
  min-height: 36px;
}
.object-list {
  padding: 10px;
  overflow: auto;
  max-height: calc(100dvh - 460px);
  min-height: 240px;
  flex: 1;
}
.object-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 15px;
  margin-bottom: 8px;
  border-radius: 12px;
}
.object-card.selected {
  border-color: var(--accent);
}
.object-card strong {
  display: block;
  font-size: 15px;
  margin: 9px 0 4px;
  overflow-wrap: anywhere;
}
.object-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
}
.object-card .signal {
  font-size: 11px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}
.panel-note {
  padding: 10px 18px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}
.empty {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.65;
}
.map-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  min-height: 440px;
  background: var(--surface);
}
#map {
  position: absolute;
  inset: 0;
  background: var(--surface);
  font-family: inherit;
}
.map-tools {
  position: absolute;
  left: 14px;
  right: 56px;
  top: 14px;
  z-index: 500;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.map-tools span {
  background: var(--panel);
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--fault);
  box-shadow: var(--shadow);
}
.map-legend {
  position: absolute;
  bottom: 28px;
  left: 14px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.map-legend .dot:not(:first-child) {
  margin-left: 7px;
}

footer {
  padding: 0 28px 15px;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  gap: 5px;
}
footer > span:last-child {
  margin-left: auto;
}
dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 20px;
  padding: 0;
  width: min(820px, calc(100% - 28px));
  max-height: 90dvh;
  box-shadow: var(--shadow);
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.detail-head h2 {
  margin-top: 5px;
}
.detail-head p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
}
.detail-head button {
  flex-shrink: 0;
}
#detailBody {
  padding: 20px 24px;
  display: grid;
  gap: 18px;
}
.detail-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.detail-section h3 {
  margin-bottom: 12px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.contact-name {
  font-weight: 700;
  margin: 5px 0;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.contact-links a {
  font-size: 12px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 8px;
  text-decoration: none;
}
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.detail-row:last-child {
  border-bottom: 0;
}
.detail-row small {
  display: block;
  font-size: 11px;
}
.detail-row strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.detail-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
}
.detail-actions > * {
  font-size: 12px;
}
.detail-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
@media (min-width: 1900px) {
  body {
    font-size: 18px;
  }
  header {
    padding: 24px 40px;
  }
  .overview {
    padding: 32px 40px;
  }
  .counters {
    gap: 20px;
  }
  .counter {
    min-height: 104px;
  }
  .counter b {
    font-size: 38px;
  }
  .counter span {
    font-size: 15px;
  }
  main {
    grid-template-columns: 460px minmax(0, 1fr);
    margin: 0 40px 24px;
  }
  .healthbar {
    margin: 0 40px 20px;
    font-size: 15px;
  }
  .object-card {
    padding: 20px;
  }
  .object-card strong {
    font-size: 19px;
  }
  .object-card p {
    font-size: 15px;
  }
  .object-list {
    max-height: calc(100dvh - 490px);
  }
  .pill {
    font-size: 12px;
  }
  .brand {
    font-size: 23px;
  }
}
/* Exhibition monitor: 21:9 at 2560×1080 or 3440×1440, browser zoom 100%.
   Fit the live dashboard into the viewport; only the object list scrolls. */
@media (min-width: 1900px) and (min-height: 800px) and (min-aspect-ratio: 2/1) {
  #app {
    height: 100dvh;
    min-height: 800px;
  }
  #app header {
    padding: 18px 32px;
    gap: 32px;
  }
  .brand {
    font-size: clamp(24px, 1vw, 32px);
  }
  .brand small {
    font-size: 15px;
  }
  .brand-mark {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 12px;
  }
  .brand-frame {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 12px;
  }
  .header-actions button,
  nav {
    font-size: clamp(17px, 0.72vw, 22px);
  }
  .overview {
    padding: 20px 32px 16px;
    gap: 26px;
  }
  .overview-title {
    flex: 0 0 clamp(280px, 13vw, 380px);
  }
  .overview-title h1 {
    font-size: clamp(30px, 1.25vw, 40px);
  }
  .eyebrow,
  .overview-title p {
    font-size: 15px;
  }
  .counter {
    min-height: 112px;
    padding: 16px 24px;
  }
  .counter b {
    font-size: clamp(44px, 1.9vw, 64px);
  }
  .counter span {
    font-size: clamp(18px, 0.82vw, 26px);
  }
  .healthbar {
    margin: 0 32px 16px;
    padding: 8px 16px;
    font-size: clamp(16px, 0.72vw, 22px);
  }
  .healthbar button {
    font-size: 17px;
    min-height: 40px;
  }
  #app main {
    grid-template-columns: clamp(430px, 20vw, 650px) minmax(0, 1fr);
    min-height: 0;
    flex: 1 1 0;
    margin: 0 32px 16px;
    gap: 22px;
  }
  .object-panel,
  .map-panel {
    min-height: 0;
  }
  .searchbox {
    padding: 18px 22px 12px;
  }
  .searchbox label,
  .searchbox input {
    font-size: clamp(19px, 0.85vw, 26px);
  }
  .list-meta,
  .list-meta button,
  .panel-note {
    font-size: 16px;
  }
  .object-list {
    min-height: 0;
    max-height: none;
    padding: 12px;
  }
  .object-card {
    padding: 20px;
    margin-bottom: 12px;
  }
  .object-card strong {
    font-size: clamp(23px, 1vw, 32px);
  }
  .object-card p {
    font-size: clamp(18px, 0.8vw, 24px);
  }
  .object-card .signal {
    font-size: clamp(16px, 0.72vw, 22px);
  }
  .pill {
    font-size: clamp(15px, 0.7vw, 20px);
  }
  .map-tools {
    top: 20px;
    left: 20px;
    right: 80px;
  }
  .map-tools button,
  .map-tools span {
    font-size: 19px;
  }
  .map-legend {
    font-size: clamp(18px, 0.85vw, 26px);
    padding: 14px 18px;
    left: 20px;
    bottom: 32px;
    gap: 12px;
  }
  .map-legend .dot {
    width: 12px;
    height: 12px;
  }

  #app footer {
    padding: 0 32px 12px;
    font-size: 15px;
  }
  #details {
    width: min(1180px, 75vw);
  }
  .detail-head h2 {
    font-size: 34px;
  }
  .detail-head p,
  .detail-row,
  .detail-row strong,
  .contact-name {
    font-size: 20px;
  }
  .detail-section h3 {
    font-size: 24px;
  }
  .detail-row small,
  .detail-note,
  .contact-links a,
  .detail-actions > * {
    font-size: 17px;
  }
}
@media (max-width: 1100px) {
  header {
    gap: 20px;
    padding: 15px 20px;
  }
  nav {
    gap: 12px;
    font-size: 13px;
  }
  .header-actions button {
    padding: 8px;
  }
  #fullscreen {
    display: none;
  }
  .overview {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }
  .overview-title h1 {
    font-size: 24px;
  }
  .overview-title {
    display: none;
  }
  main {
    grid-template-columns: 310px minmax(0, 1fr);
    margin: 0 20px 16px;
    gap: 12px;
  }
  .healthbar {
    margin: 0 20px 14px;
  }
  .counter {
    padding: 12px;
  }
  .object-list {
    max-height: calc(100dvh - 365px);
  }
}
@media (max-width: 720px) {
  header {
    flex-wrap: wrap;
    gap: 12px;
  }
  .brand {
    font-size: 17px;
  }
  nav {
    margin-left: auto;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .overview {
    padding: 12px 16px;
  }
  .counters {
    gap: 6px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .counter {
    padding: 9px 6px;
    min-height: 70px;
    align-items: center;
  }
  .counter b {
    font-size: 23px;
  }
  .counter span {
    font-size: 9px;
  }
  .healthbar {
    margin: 0 16px 12px;
  }
  main {
    display: flex;
    flex-direction: column-reverse;
    margin: 0 16px 16px;
  }
  .map-panel {
    height: 330px;
    min-height: 330px;
  }
  .map-legend {
    font-size: 9px;
    gap: 4px;
    padding: 7px;
  }
  .object-list {
    max-height: 420px;
    min-height: 150px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-head {
    padding: 18px;
  }
  #detailBody {
    padding: 16px;
  }
  .detail-actions {
    flex-wrap: wrap;
    padding: 16px;
  }
  .detail-actions > * {
    width: 100%;
  }
  footer {
    padding: 0 16px 12px;
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
.overview-title {
  flex: 0 0 215px;
}

@media (min-width: 721px) and (min-height: 600px) {
  #app {
    height: 100dvh;
    min-height: 0;
  }
  main {
    min-height: 0;
  }
  .map-panel {
    min-height: 0;
  }
  .object-panel {
    min-height: 0;
  }
  .object-list {
    min-height: 0;
    max-height: none;
  }
  .overview-title h1 {
    font-size: 25px;
    white-space: nowrap;
  }
}
dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-head,
.detail-actions {
  flex-shrink: 0;
}
#detailBody {
  overflow-y: auto;
  min-height: 0;
}
#detailFreshness {
  padding: 10px 24px 0;
  font-size: 12px;
  color: var(--muted);
}
#detailFreshness.error {
  color: var(--fire);
}
.location-label.uncertain {
  color: #428fff;
  font-weight: 700;
}
[data-theme="light"] .location-label.uncertain {
  color: #165ebd;
}
.location-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.location-inputs label {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.location-inputs input {
  min-width: 0;
  width: 100%;
}
.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#locationFields {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
#locationSection {
  scroll-margin: 12px;
}
.dot.uncertain { background: #176fe5; }
