#twin-home {
  --twin-bg: #0b0e13;
  --twin-panel: #12161f;
  --twin-panel2: #171c27;
  --twin-line: #232a3a;
  --twin-gold: #d4a23c;
  --twin-gold2: #f0c061;
  --twin-text: #e8e6df;
  --twin-dim: #8b93a5;
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  background: var(--twin-bg);
  color: var(--twin-text);
}

.app-shell.twin-on {
  background: #0b0e13;
  overflow: hidden;
}

.app-shell.twin-on #twin-home {
  display: flex;
}

.app-shell.twin-on #orbit-nav,
.app-shell.twin-on .workspace,
.app-shell.twin-on #adminbanner,
.app-shell.twin-on #chips {
  display: none !important;
}

.app-shell.twin-on .app-header {
  background: linear-gradient(180deg, #141925, #0e1219);
  border-bottom-color: #232a3a;
  color: #e8e6df;
}

.app-shell.twin-on .app-header h1 span { color: #d4a23c; }
.app-shell.twin-on .app-header .sub { color: #8b93a5; }
.app-shell.twin-on .tenant-cluster { border-left-color: #232a3a; }
.app-shell.twin-on .switchbtn {
  background: linear-gradient(180deg, #e2b354, #d4a23c);
  border-color: #d4a23c;
  color: #1a1408;
  font-weight: 700;
}
.app-shell.twin-on .switchbtn:hover {
  background: linear-gradient(180deg, #f0c061, #e2b354);
  color: #1a1408;
}

body:has(.app-shell.twin-on) #viewtransition {
  background: #0b0e13;
}

#twin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--twin-line);
  background: var(--twin-panel);
}

#twin-home .hbtn {
  background: var(--twin-panel2);
  border: 1px solid var(--twin-line);
  color: var(--twin-text);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: .5px;
}

#twin-home .hbtn:hover {
  border-color: var(--twin-gold);
  color: var(--twin-gold2);
}

#twin-main {
  display: grid;
  grid-template-columns: 248px 1fr;
  flex: 1;
  min-height: 0;
}

#twin-nav {
  border-right: 1px solid var(--twin-line);
  background: var(--twin-panel);
  overflow-y: auto;
  padding: 10px 0;
}

#twin-home .navgroup {
  padding: 14px 16px 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--twin-dim);
  text-transform: uppercase;
}

#twin-home .navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  border-left: 3px solid transparent;
  color: #c8cdd9;
}

#twin-home .navitem:hover { background: #1a2030; }
#twin-home .navitem.active {
  background: #1d2435;
  border-left-color: var(--twin-gold);
  color: #fff;
}

#twin-home .navnum {
  font-size: 10px;
  color: var(--twin-gold);
  font-weight: 700;
  width: 18px;
  flex-shrink: 0;
}

#twin-home .badges { margin-left: auto; display: flex; gap: 3px; }
#twin-home .badge {
  font-size: 8px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #242c40;
  color: var(--twin-dim);
  letter-spacing: .5px;
}

#twin-content {
  display: grid;
  grid-template-columns: minmax(280px, 44%) 1fr;
  min-width: 0;
  min-height: 0;
}

#twin-home .pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

#twin-home .pane + .pane { border-left: 1px solid var(--twin-line); }

#twin-home .panehead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--twin-line);
  background: var(--twin-panel);
}

#twin-home .panetitle {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--twin-dim);
}

#twin-home .chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

#twin-home .chip {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 14px;
  border: 1px solid var(--twin-line);
  background: var(--twin-panel2);
  color: #c8cdd9;
  cursor: pointer;
  white-space: nowrap;
}

#twin-home .chip.active {
  border-color: var(--twin-gold);
  color: var(--twin-gold2);
  background: #221d10;
}

#twin-home .panebody {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #000;
}

#twin-vid {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

#twin-mapimg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0b0e13;
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
}

#twin-gl { width: 100%; height: 100%; display: block; }
#twin-sizeslider { width: 110px; }

#twin-sizeslider { width: 110px; }
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 13, 20, .75);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--twin-line);
  font-size: 11px;
  color: var(--twin-dim);
}

#twin-loadwrap {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(8, 10, 15, .85);
  z-index: 6;
}

#twin-loadbar {
  width: 240px;
  height: 4px;
  background: #222a3c;
  border-radius: 2px;
  overflow: hidden;
}

#twin-loadfill {
  height: 100%;
  width: 0%;
  background: var(--twin-gold);
  transition: width .15s;
}

#twin-loadtext {
  font-size: 12px;
  color: var(--twin-dim);
  letter-spacing: 1px;
}

#twin-home footer {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 18px;
  font-size: 11px;
  color: var(--twin-dim);
  border-top: 1px solid var(--twin-line);
  background: var(--twin-panel);
  flex: none;
  height: 34px;
}

#twin-home footer b { color: var(--twin-gold2); font-weight: 600; }

#twin-legend { display: flex; gap: 5px; margin-left: 8px; }

#twin-home .lg {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--twin-line);
  background: var(--twin-panel2);
  cursor: pointer;
  color: #c8cdd9;
  user-select: none;
}

#twin-home .lg .dot { width: 8px; height: 8px; border-radius: 50%; }
#twin-home .lg.off { opacity: .35; }

#twin-hslist {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 7;
  width: 188px;
  max-height: 55%;
  overflow-y: auto;
  background: rgba(10, 13, 20, .82);
  border: 1px solid var(--twin-line);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

#twin-hslist .hshead {
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--twin-dim);
  border-bottom: 1px solid var(--twin-line);
}

#twin-home .hsitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 11px;
  cursor: pointer;
}

#twin-home .hsitem:hover { background: #1c2336; }
#twin-home .hsitem .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
#twin-home .hsitem .val {
  margin-left: auto;
  color: var(--twin-dim);
  font-size: 10px;
  white-space: nowrap;
}

#twin-hscard {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 8;
  width: 250px;
  display: none;
  background: rgba(12, 16, 25, .94);
  border: 1px solid var(--twin-gold);
  border-radius: 12px;
  padding: 14px 16px;
}

#twin-hscard h3 {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
}

#twin-hscard .meta { font-size: 11px; color: var(--twin-dim); line-height: 1.5; }
#twin-hscard .val { font-size: 17px; color: var(--twin-gold2); font-weight: 700; margin: 7px 0; }
#twin-hscard .close {
  position: absolute;
  top: 8px;
  right: 12px;
  cursor: pointer;
  color: var(--twin-dim);
}

#twin-vid-banner,
#twin-map-banner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 24px;
  text-align: center;
  background: rgba(8, 10, 15, .88);
  color: var(--twin-dim);
  font-size: 13px;
  letter-spacing: .4px;
  line-height: 1.5;
}

#twin-vid-banner.on,
#twin-map-banner.on { display: flex; }

#twin-mapmodal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, .92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  cursor: zoom-out;
  color: var(--twin-dim);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

#twin-home .ctxmenu {
  position: fixed;
  z-index: 6000;
  background: var(--twin-panel2);
  border: 1px solid var(--twin-line);
  border-radius: 8px;
  padding: 5px;
  min-width: 200px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  display: none;
}

#twin-home .ctxmenu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--twin-text);
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
}

#twin-home .ctxmenu button:hover {
  background: #1d2435;
  color: var(--twin-gold2);
}

@media (max-width: 1100px) {
  #twin-main { grid-template-columns: 1fr; }
  #twin-nav { max-height: 160px; }
  #twin-content { grid-template-columns: 1fr; }
}
