:root {
  color-scheme: light;
  --bg: #eef6ff;
  --ink: #15223a;
  --muted: #66748a;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-strong: rgba(255, 255, 255, 0.82);
  --stroke: rgba(255, 255, 255, 0.72);
  --blue: #0a84ff;
  --red: #ff3b30;
  --orange: #ff9f0a;
  --purple: #8e5cf7;
  --green: #30d158;
  --shadow: 0 24px 80px rgba(45, 78, 120, 0.18);
  --app-background:
    radial-gradient(circle at 8% 10%, rgba(10, 132, 255, 0.24), transparent 32%),
    radial-gradient(circle at 92% 6%, rgba(48, 209, 88, 0.18), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #e9f3ff 48%, #f7fbff 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--app-background);
  transition: background 260ms ease, color 260ms ease;
}

body.theme-aurora {
  --ink: #101d3b;
  --muted: #587096;
  --panel: rgba(247, 251, 255, 0.68);
  --panel-strong: rgba(255, 255, 255, 0.84);
  --blue: #007aff;
  --purple: #6f5cff;
  --green: #22c55e;
  --shadow: 0 28px 90px rgba(31, 86, 176, 0.22);
  --app-background:
    radial-gradient(circle at 16% 18%, rgba(0, 122, 255, 0.32), transparent 34%),
    radial-gradient(circle at 78% 8%, rgba(111, 92, 255, 0.25), transparent 32%),
    linear-gradient(140deg, #f6fbff 0%, #e8f0ff 52%, #f7fbff 100%);
}

body.theme-alert {
  --ink: #251b18;
  --muted: #775e58;
  --blue: #0a84ff;
  --red: #ff2d20;
  --orange: #ff8a00;
  --purple: #a354ff;
  --shadow: 0 28px 90px rgba(204, 72, 36, 0.19);
  --app-background:
    radial-gradient(circle at 14% 12%, rgba(255, 45, 32, 0.23), transparent 31%),
    radial-gradient(circle at 88% 10%, rgba(255, 138, 0, 0.24), transparent 30%),
    linear-gradient(135deg, #fffaf7 0%, #fff0e9 52%, #fbfdff 100%);
}

body.theme-eco {
  --ink: #10251f;
  --muted: #547068;
  --blue: #0a84ff;
  --green: #1fbf75;
  --purple: #6b7dff;
  --shadow: 0 28px 90px rgba(46, 122, 94, 0.18);
  --app-background:
    radial-gradient(circle at 10% 16%, rgba(31, 191, 117, 0.24), transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(10, 132, 255, 0.18), transparent 30%),
    linear-gradient(135deg, #f8fffb 0%, #eaf8f0 50%, #f5fbff 100%);
}

body.theme-night {
  color-scheme: dark;
  --ink: #edf5ff;
  --muted: #9cafc8;
  --panel: rgba(16, 28, 52, 0.64);
  --panel-strong: rgba(28, 43, 74, 0.82);
  --stroke: rgba(190, 214, 255, 0.22);
  --blue: #5ab0ff;
  --red: #ff6b62;
  --orange: #ffb34d;
  --purple: #b49cff;
  --green: #52d979;
  --shadow: 0 28px 92px rgba(0, 0, 0, 0.34);
  --app-background:
    radial-gradient(circle at 12% 16%, rgba(90, 176, 255, 0.24), transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(180, 156, 255, 0.18), transparent 32%),
    linear-gradient(135deg, #0b1425 0%, #111c33 52%, #0d1628 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.glass-panel {
  border: 1px solid var(--stroke);
  border-radius: 34px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
}

.topbar {
  min-height: 132px;
  padding: 26px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 6px 0 0;
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: 0;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pill {
  min-height: 38px;
  padding: 9px 15px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  color: #496076;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.84);
  font-size: 14px;
  font-weight: 800;
}

.pill-blue {
  color: #064b8f;
  background: rgba(10, 132, 255, 0.16);
}

.pill-ok {
  color: #13752c;
  background: rgba(48, 209, 88, 0.18);
}

.pill-live {
  color: #0d6d26;
  background: rgba(48, 209, 88, 0.22);
}

.pill-warn {
  color: #8b5200;
  background: rgba(255, 159, 10, 0.18);
}

.pill-alert {
  color: #9c1913;
  background: rgba(255, 59, 48, 0.18);
}

.pill-live::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5);
  animation: livePulse 1s ease-out infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5); }
  100% { box-shadow: 0 0 0 9px rgba(48, 209, 88, 0); }
}

.hero-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.85fr);
  gap: 18px;
}

.floor,
.system-card,
.control-stack .glass-panel,
.data-grid .glass-panel {
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title strong {
  font-size: 16px;
}

.floor-plan {
  position: relative;
  min-height: 520px;
  aspect-ratio: 3 / 2;
  border-radius: 30px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.home-model-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.04) contrast(1.02);
}

.heat-zone {
  position: absolute;
  z-index: 1;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 22px;
  color: rgba(21, 34, 58, 0.84);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  opacity: 0.34;
  transform: scale(1);
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
  pointer-events: none;
}

.heat-zone span,
.heat-zone small {
  display: block;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.9);
}

.heat-zone span {
  font-size: 15px;
  font-weight: 950;
}

.heat-zone small {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 850;
}

.heat-zone.active {
  opacity: 1;
  transform: scale(1.015);
}

.heat-zone.alert {
  opacity: 1;
  background: rgba(255, 59, 48, 0.22);
  box-shadow: 0 0 0 8px rgba(255, 59, 48, 0.12), 0 18px 46px rgba(255, 59, 48, 0.2);
}

.zone-foyer {
  left: 7%;
  top: 8%;
  width: 18%;
  height: 17%;
  background: rgba(255, 255, 255, 0.28);
}

.zone-kitchen {
  left: 7%;
  top: 30%;
  width: 17%;
  height: 43%;
  background: rgba(255, 149, 0, 0.18);
}

.zone-kitchen.active {
  background: rgba(255, 149, 0, 0.34);
  box-shadow: 0 0 0 8px rgba(255, 149, 0, 0.14), 0 18px 46px rgba(255, 149, 0, 0.2);
}

.zone-bathroom {
  left: 33%;
  top: 6%;
  width: 13%;
  height: 23%;
  background: rgba(10, 132, 255, 0.18);
}

.zone-bathroom.active {
  background: rgba(10, 132, 255, 0.34);
  box-shadow: 0 0 0 8px rgba(10, 132, 255, 0.14), 0 18px 46px rgba(10, 132, 255, 0.2);
}

.zone-living {
  left: 23%;
  top: 35%;
  width: 43%;
  height: 34%;
  background: rgba(48, 209, 88, 0.15);
}

.zone-living.active {
  background: rgba(48, 209, 88, 0.3);
  box-shadow: 0 0 0 8px rgba(48, 209, 88, 0.13), 0 18px 46px rgba(48, 209, 88, 0.18);
}

.zone-study {
  right: 10%;
  top: 8%;
  width: 28%;
  height: 23%;
  background: rgba(142, 92, 247, 0.17);
}

.zone-study.active {
  background: rgba(142, 92, 247, 0.32);
  box-shadow: 0 0 0 8px rgba(142, 92, 247, 0.13), 0 18px 46px rgba(142, 92, 247, 0.18);
}

.zone-bedroom {
  right: 7%;
  top: 42%;
  width: 28%;
  height: 33%;
  background: rgba(255, 45, 120, 0.14);
}

.zone-bedroom.active {
  background: rgba(255, 45, 120, 0.28);
  box-shadow: 0 0 0 8px rgba(255, 45, 120, 0.12), 0 18px 46px rgba(255, 45, 120, 0.18);
}

.zone-balcony {
  left: 34%;
  bottom: 7%;
  width: 32%;
  height: 16%;
  background: rgba(21, 199, 116, 0.15);
}

.zone-balcony.active {
  background: rgba(21, 199, 116, 0.32);
  box-shadow: 0 0 0 8px rgba(21, 199, 116, 0.13), 0 18px 46px rgba(21, 199, 116, 0.18);
}

.zone-hub {
  right: 4%;
  bottom: 6%;
  width: 23%;
  height: 16%;
  border-style: dashed;
  background: rgba(10, 132, 255, 0.16);
}

.zone-hub.active {
  background: rgba(10, 132, 255, 0.3);
  box-shadow: 0 0 0 8px rgba(10, 132, 255, 0.12), 0 18px 46px rgba(10, 132, 255, 0.2);
}

.map-dot {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(36, 60, 94, 0.22);
  z-index: 2;
}

.dot-light { right: 18%; top: 18%; background: var(--blue); }
.dot-sound { right: 29%; top: 20%; background: var(--purple); }
.dot-pir { left: 43%; bottom: 13%; background: var(--green); }
.dot-mq2 { left: 11%; top: 42%; background: var(--red); }
.dot-water { left: 38%; top: 17%; background: var(--blue); }
.dot-flame { left: 16%; top: 50%; background: var(--orange); }
.dot-ring { right: 22%; top: 51%; background: var(--purple); }

.map-dot.active {
  transform: scale(1.08);
  box-shadow: 0 0 0 8px rgba(255, 59, 48, 0.15), 0 18px 44px rgba(255, 59, 48, 0.32);
}

.map-dot.scene-active {
  outline: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 7px rgba(10, 132, 255, 0.14), 0 18px 44px rgba(10, 132, 255, 0.22);
}

.scene-map-status {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  grid-template-columns: 0.7fr 1.2fr 1.1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.scene-map-status span,
.scene-map-status strong,
.scene-map-status small {
  display: block;
}

.scene-map-status span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.scene-map-status strong {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.15;
}

.scene-map-status small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.control-stack {
  display: grid;
  gap: 18px;
}

.summary-grid,
.sensor-grid,
.actuator-grid,
.health-list {
  display: grid;
  gap: 12px;
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-grid div,
.sensor-card,
.actuator-card,
.health-item {
  min-height: 82px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.76);
}

.summary-grid span,
.sensor-card span,
.actuator-card span,
.health-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sensor-card em,
.actuator-card em {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.summary-grid strong,
.sensor-card strong,
.actuator-card strong,
.health-item strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.05;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-button,
.primary-action,
.secondary-action {
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.mode-button:hover,
.primary-action:hover,
.secondary-action:hover {
  transform: translateY(-1px);
}

.mode-button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.slider-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.primary-action {
  width: 100%;
  margin-top: 12px;
  color: white;
  background: linear-gradient(135deg, var(--orange), var(--red));
}

.secondary-action {
  width: 100%;
  margin-top: 10px;
  color: #184875;
  background: rgba(10, 132, 255, 0.14);
  border: 1px solid rgba(10, 132, 255, 0.18);
}

.actuator-test-panel {
  display: grid;
  gap: 12px;
}

.test-group {
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.test-group > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.fan-config {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.fan-config label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.fan-config select,
.voice-mic-card select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 900;
}

.test-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rgb-test-buttons {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.fan-diagnostic-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.fan-diagnostic-buttons button {
  color: #184875;
  background: rgba(10, 132, 255, 0.14);
  border: 1px solid rgba(10, 132, 255, 0.16);
}

.fan-hard-stop {
  width: 100%;
  min-height: 52px;
  margin-bottom: 10px;
  border: 0;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, #ff3b30, #ff9f0a);
  box-shadow: 0 12px 26px rgba(255, 59, 48, 0.22);
  font-size: 16px;
  font-weight: 950;
  cursor: pointer;
}

.fan-hard-stop:active {
  transform: translateY(1px) scale(0.99);
}

.test-buttons button {
  min-height: 42px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  font-weight: 950;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.test-buttons button:hover {
  transform: translateY(-1px);
}

.test-buttons button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.test-readout {
  display: inline-grid;
  min-width: 104px;
  min-height: 42px;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-size: 18px;
}

.data-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 18px;
}

.data-grid .wide {
  grid-column: span 2;
}

.sensor-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sensor-card {
  min-height: 122px;
}

.bar {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(91, 123, 160, 0.18);
}

.bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 240ms ease;
}

.sensor-card.alert .bar i {
  background: linear-gradient(90deg, var(--orange), var(--red));
}

.sensor-card.scene-active,
.actuator-card.scene-active {
  border-color: rgba(10, 132, 255, 0.42);
  background: rgba(10, 132, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.18);
}

.actuator-card.scene-active strong,
.sensor-card.scene-active strong {
  color: #075fb3;
}

.actuator-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.health-item {
  min-height: 68px;
}

.event-log {
  min-height: 210px;
  max-height: 260px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
}

.event-log div {
  padding: 12px 14px;
  border-radius: 18px;
  color: #31445f;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 700;
}

.voice-hub {
  margin-top: 18px;
  padding: 22px;
}

.voice-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1.05fr 1.08fr;
  gap: 14px;
}

.voice-orb-card,
.voice-reply-card,
.voice-actions-card,
.voice-mic-card {
  min-height: 176px;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.74);
}

.voice-orb-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.voice-orb {
  position: relative;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 18px 44px rgba(10, 132, 255, 0.28);
}

.voice-orb i {
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 2px solid rgba(10, 132, 255, 0.2);
  animation: livePulse 1.8s ease-out infinite;
}

.voice-orb span {
  position: relative;
  font-size: 26px;
  font-weight: 950;
}

.voice-orb-card span,
.voice-reply-card span,
.voice-actions-card > span,
.voice-mic-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.voice-orb-card strong,
.voice-reply-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.12;
}

.voice-orb-card small,
.voice-reply-card small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.voice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.voice-actions button {
  min-height: 50px;
  border: 0;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  font-weight: 950;
  cursor: pointer;
}

.voice-actions button:nth-child(2) {
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.voice-actions button:nth-child(3) {
  background: linear-gradient(135deg, var(--orange), var(--red));
}

.voice-actions button:nth-child(4) {
  color: #184875;
  background: rgba(10, 132, 255, 0.14);
  border: 1px solid rgba(10, 132, 255, 0.18);
}

.voice-mic-card select {
  margin-top: 14px;
}

.mic-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.mic-controls button {
  min-height: 42px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  font-weight: 950;
  cursor: pointer;
}

.mic-controls button:last-child {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.voice-mic-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.usb-state-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.usb-state-grid div {
  min-height: 70px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.usb-state-grid span,
.usb-status-text {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.usb-state-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 17px;
  line-height: 1.1;
}

.usb-actions {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 8px;
  margin-top: 10px;
}

.usb-actions .primary-action,
.usb-actions .secondary-action {
  margin-top: 0;
}

.usb-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.usb-status-text {
  margin-top: 9px;
  overflow-wrap: anywhere;
}

.voice-timeline {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.voice-line,
.voice-empty {
  min-height: 92px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.voice-line span,
.voice-line small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.voice-line strong {
  display: inline-flex;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-size: 11px;
}

.voice-line.speech strong {
  background: var(--green);
}

.voice-line.status strong {
  background: var(--purple);
}

.voice-line p {
  margin: 8px 0 6px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.voice-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.smart-hub {
  margin-top: 18px;
  padding: 22px;
}

.hub-title {
  align-items: flex-start;
}

.hub-title div {
  display: grid;
  gap: 4px;
}

.hub-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.hub-step {
  min-height: 92px;
  padding: 14px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.hub-step i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: rgba(91, 123, 160, 0.44);
  font-style: normal;
  font-size: 13px;
  font-weight: 950;
}

.hub-step.done i {
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.hub-step span,
.hub-step strong {
  display: block;
}

.hub-step span {
  margin-top: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.hub-step strong {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.hub-dashboard {
  display: grid;
  grid-template-columns: 0.78fr 1fr 1.28fr;
  gap: 14px;
}

.hub-card {
  min-height: 236px;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.74);
}

.hub-card > span,
.mini-title span,
.hub-kv small,
.registry-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.hub-card > strong {
  display: block;
  margin: 10px 0 16px;
  font-size: 24px;
  line-height: 1.08;
}

.hub-kv {
  min-height: 48px;
  padding: 12px 0;
  border-top: 1px solid rgba(91, 123, 160, 0.14);
}

.hub-kv b {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.mini-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mini-title strong {
  font-size: 15px;
}

.theme-shell-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.theme-shell {
  min-height: 132px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.theme-shell.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.theme-shell i {
  display: block;
  width: 100%;
  height: 46px;
  margin-bottom: 10px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.theme-shell[data-theme="aurora"] i { background: linear-gradient(135deg, #007aff, #6f5cff); }
.theme-shell[data-theme="alert"] i { background: linear-gradient(135deg, #ff8a00, #ff2d20); }
.theme-shell[data-theme="eco"] i { background: linear-gradient(135deg, #1fbf75, #0a84ff); }
.theme-shell[data-theme="night"] i { background: linear-gradient(135deg, #172846, #5ab0ff); }

.theme-shell span,
.theme-shell small {
  display: block;
}

.theme-shell span {
  font-size: 13px;
  font-weight: 950;
}

.theme-shell small {
  margin-top: 4px;
  color: inherit;
  opacity: 0.72;
  font-size: 11px;
  font-weight: 800;
}

.registry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.registry-form label {
  display: grid;
  gap: 7px;
}

.registry-form .label-field {
  grid-column: span 2;
}

.registry-form button {
  grid-column: span 2;
  margin-top: 0;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(91, 123, 160, 0.18);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  padding: 0 12px;
  font-weight: 850;
}

.compact-title {
  margin-top: 18px;
}

.port-scan-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.port-card {
  min-height: 116px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.port-card.alert {
  background: rgba(255, 59, 48, 0.16);
}

.port-card.online {
  background: rgba(48, 209, 88, 0.14);
}

.port-card span,
.port-card small,
.port-card b {
  display: block;
}

.port-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.port-card strong {
  display: block;
  margin-top: 7px;
  font-size: 17px;
  line-height: 1.1;
}

.port-card small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.port-card b {
  margin-top: 8px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .hero-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .data-grid .wide {
    grid-column: auto;
  }

  .sensor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub-steps,
  .hub-dashboard,
  .voice-layout,
  .voice-timeline,
  .port-scan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-card,
  .registration-card {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1480px);
    padding-top: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }

  .floor-plan {
    min-height: 430px;
  }

  .sensor-grid,
  .actuator-grid,
  .summary-grid,
  .mode-grid,
    .test-buttons,
    .mic-controls,
    .usb-state-grid,
    .usb-actions,
    .hub-steps,
  .hub-dashboard,
  .voice-layout,
  .voice-timeline,
  .theme-shell-grid,
  .registry-form,
  .port-scan-grid {
    grid-template-columns: 1fr;
  }

  .voice-orb-card {
    grid-template-columns: 1fr;
  }

  .theme-card,
  .registration-card,
  .registry-form .label-field,
  .registry-form button {
    grid-column: auto;
  }
}

/* Sandbox v3 layout */
html {
  scroll-behavior: smooth;
}

.app-shell {
  width: min(1600px, calc(100vw - 18px));
  padding: 8px 0 26px;
}

.topbar {
  min-height: 66px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(350px, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-radius: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 318px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, #0a84ff, #15c774);
  box-shadow: 0 12px 28px rgba(10, 132, 255, 0.22);
  font-size: 18px;
  font-weight: 950;
}

.topbar .eyebrow {
  font-size: 11px;
  line-height: 1;
}

.topbar h1 {
  margin: 2px 0 0;
  max-width: 330px;
  font-size: 23px;
  line-height: 1.08;
}

.top-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.top-nav a {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(91, 123, 160, 0.14);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  text-decoration: none;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.top-nav a.active,
.top-nav a:hover {
  color: #064b8f;
  background: rgba(10, 132, 255, 0.16);
  border-color: rgba(10, 132, 255, 0.22);
}

.topbar .status-strip {
  flex-wrap: nowrap;
  gap: 7px;
}

.topbar .pill {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 11px;
}

.sandbox-layout {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.86fr) minmax(430px, 0.84fr);
  gap: 10px;
}

.sandbox-stage,
.student-console > .glass-panel,
.sensor-fusion-panel,
.strategy-panel,
.smart-hub,
.diagnostics-grid > .glass-panel {
  padding: 14px;
  border-radius: 20px;
}

.floor-plan {
  min-height: 690px;
  aspect-ratio: 99 / 65;
  border-radius: 18px;
  background: rgba(236, 247, 255, 0.72);
}

.home-model-image {
  object-fit: cover;
  object-position: center center;
  filter: saturate(1.08) contrast(1.04) brightness(1.02);
}

.generated-floorplan .heat-zone {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-width: 2px;
  border-radius: 20px;
  opacity: 0;
  background: transparent;
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
}

.generated-floorplan .heat-zone span,
.generated-floorplan .heat-zone small {
  display: none;
}

.generated-floorplan .heat-zone.active {
  opacity: 1;
  background: rgba(10, 132, 255, 0.16);
  box-shadow: 0 0 0 7px rgba(10, 132, 255, 0.14), inset 0 0 32px rgba(255, 255, 255, 0.22);
  transform: translateY(-1px) scale(1.01);
}

.generated-floorplan .zone-kitchen.active {
  background: rgba(255, 59, 48, 0.2);
  box-shadow: 0 0 0 8px rgba(255, 59, 48, 0.13), inset 0 0 44px rgba(255, 159, 10, 0.24);
}

.generated-floorplan .zone-bathroom.active {
  background: rgba(10, 132, 255, 0.2);
  box-shadow: 0 0 0 8px rgba(10, 132, 255, 0.14), inset 0 0 40px rgba(10, 132, 255, 0.18);
}

.generated-floorplan .zone-living.active {
  background: rgba(21, 199, 116, 0.2);
  box-shadow: 0 0 0 8px rgba(21, 199, 116, 0.14), inset 0 0 44px rgba(21, 199, 116, 0.2);
}

.generated-floorplan .zone-study.active {
  background: rgba(142, 92, 247, 0.2);
  box-shadow: 0 0 0 8px rgba(142, 92, 247, 0.14), inset 0 0 44px rgba(142, 92, 247, 0.2);
}

.generated-floorplan .zone-bedroom.active {
  background: rgba(255, 45, 120, 0.18);
  box-shadow: 0 0 0 8px rgba(255, 45, 120, 0.13), inset 0 0 44px rgba(255, 45, 120, 0.18);
}

.generated-floorplan .zone-balcony.active {
  background: rgba(21, 199, 116, 0.18);
  box-shadow: 0 0 0 8px rgba(21, 199, 116, 0.13), inset 0 0 40px rgba(21, 199, 116, 0.18);
}

.generated-floorplan .zone-hub.active {
  background: rgba(10, 132, 255, 0.18);
  box-shadow: 0 0 0 8px rgba(10, 132, 255, 0.13), inset 0 0 40px rgba(10, 132, 255, 0.18);
}

.heat-zone span {
  font-size: 15px;
  line-height: 1;
}

.heat-zone small {
  font-size: 11px;
  line-height: 1.18;
}

.generated-floorplan .zone-foyer {
  left: 10%;
  top: 5%;
  width: 17%;
  height: 17%;
}

.generated-floorplan .zone-kitchen {
  left: 6%;
  top: 22%;
  width: 17%;
  height: 38%;
}

.generated-floorplan .zone-bathroom {
  left: 34%;
  top: 0%;
  width: 16%;
  height: 24%;
}

.generated-floorplan .zone-living {
  left: 23%;
  top: 38%;
  width: 37%;
  height: 25%;
}

.generated-floorplan .zone-study {
  right: 18%;
  top: 5%;
  width: 28%;
  height: 22%;
}

.generated-floorplan .zone-bedroom {
  right: 17%;
  top: 46%;
  width: 26%;
  height: 25%;
}

.generated-floorplan .zone-balcony {
  left: 33%;
  bottom: 5%;
  width: 28%;
  height: 19%;
}

.generated-floorplan .zone-hub {
  right: 6%;
  bottom: 1%;
  width: 29%;
  height: 22%;
  border-style: dashed;
}

.generated-floorplan .hub-link-line {
  position: absolute;
  right: 13%;
  bottom: 19%;
  z-index: 1;
  width: 20%;
  height: 26%;
  border-right: 2px dashed rgba(10, 132, 255, 0.68);
  border-bottom: 2px dashed rgba(10, 132, 255, 0.68);
  border-radius: 0 0 20px 0;
  pointer-events: none;
}

.generated-floorplan .map-dot {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  font-size: 13px;
  opacity: 0;
  transition: transform 170ms ease, box-shadow 170ms ease, outline-color 170ms ease;
}

.generated-floorplan .dot-light { right: 32%; top: 17%; background: #ffb020; }
.generated-floorplan .dot-sound { right: 38%; top: 17%; background: var(--purple); }
.generated-floorplan .dot-pir { left: 36%; bottom: 11%; background: var(--green); }
.generated-floorplan .dot-mq2 { left: 14%; top: 35%; background: var(--red); }
.generated-floorplan .dot-water { left: 43%; top: 12%; background: var(--blue); }
.generated-floorplan .dot-flame { left: 18%; top: 35%; background: var(--orange); }
.generated-floorplan .dot-fan { left: 28%; top: 51%; background: #2475ff; }
.generated-floorplan .dot-buzzer { left: 42%; top: 51%; background: #ff9f0a; }
.generated-floorplan .dot-keypad { left: 49%; top: 51%; background: #0a84ff; }
.generated-floorplan .dot-dht { left: 55%; top: 51%; background: #129b76; }
.generated-floorplan .dot-servo { right: 31%; top: 59%; background: #ff5e8a; }
.generated-floorplan .dot-ring { right: 24%; top: 59%; background: var(--purple); }
.generated-floorplan .dot-relay { right: 16%; bottom: 9%; background: #0f9d58; }

.generated-floorplan .map-dot.scene-active {
  opacity: 1;
  transform: translateY(-2px) scale(1.08);
  outline: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 7px rgba(10, 132, 255, 0.22), 0 18px 38px rgba(10, 132, 255, 0.3);
}

.generated-floorplan .map-dot.active {
  opacity: 1;
  transform: translateY(-2px) scale(1.12);
  box-shadow: 0 0 0 8px rgba(255, 59, 48, 0.18), 0 18px 42px rgba(255, 59, 48, 0.34);
}

.scene-map-status {
  left: 14px;
  right: 14px;
  bottom: 14px;
  grid-template-columns: 0.7fr 1fr 1.18fr;
  border-radius: 18px;
}

.student-console {
  display: grid;
  align-content: start;
  gap: 10px;
}

.console-title {
  min-height: 54px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.console-title p {
  margin: 0;
  color: #064b8f;
  font-size: 20px;
  font-weight: 950;
}

.console-title strong {
  display: block;
  margin-top: 2px;
  color: #22548f;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.mode-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.mode-button {
  min-height: 78px;
  padding: 8px 4px;
  border: 1px solid rgba(91, 123, 160, 0.12);
  border-radius: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.64);
}

.mode-button i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-style: normal;
  font-size: 14px;
}

.mode-button span {
  font-size: 12px;
  line-height: 1.15;
}

.mode-button.active i {
  color: #064b8f;
  background: white;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-grid div {
  min-height: 70px;
  padding: 12px;
  border-radius: 16px;
}

.summary-grid strong {
  font-size: 18px;
}

.student-console .slider-row {
  min-height: 34px;
}

.actuator-test-panel {
  gap: 8px;
}

.test-group {
  padding: 10px;
  border-radius: 16px;
}

.test-group > span {
  margin-bottom: 8px;
  font-size: 12px;
}

.test-buttons {
  gap: 7px;
}

.test-buttons button,
.mic-controls button {
  min-height: 36px;
  border-radius: 12px;
  font-size: 12px;
}

.fan-hard-stop {
  min-height: 42px;
  border-radius: 14px;
  font-size: 14px;
}

.voice-panel .voice-layout {
  grid-template-columns: 1fr;
  gap: 8px;
}

.voice-panel .voice-orb-card,
.voice-panel .voice-reply-card,
.voice-panel .voice-actions-card,
.voice-panel .voice-mic-card {
  min-height: auto;
  padding: 12px;
  border-radius: 16px;
}

.voice-panel .voice-orb-card {
  grid-template-columns: 54px minmax(0, 1fr);
}

.voice-panel .voice-orb {
  width: 48px;
  height: 48px;
}

.voice-panel .voice-orb-card strong,
.voice-panel .voice-reply-card strong {
  font-size: 16px;
}

.voice-panel .voice-actions-card {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.74);
}

.voice-panel .voice-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.voice-panel .voice-actions button {
  min-height: 38px;
  border-radius: 12px;
  font-size: 12px;
}

.voice-panel .voice-timeline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.voice-panel .voice-line,
.voice-panel .voice-empty {
  min-height: 72px;
  padding: 10px;
  border-radius: 16px;
}

.fusion-register-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(420px, 0.86fr);
  gap: 10px;
}

.sensor-fusion-panel .section-title > span {
  color: #064b8f;
  font-size: 12px;
  font-weight: 950;
}

.fusion-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 10px;
}

.sensor-grid {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.actuator-grid {
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
}

.sensor-card,
.actuator-card {
  min-height: 86px;
  padding: 12px;
  border-radius: 16px;
}

.sensor-card strong,
.actuator-card strong {
  font-size: 17px;
}

.smart-hub {
  margin-top: 0;
}

.hub-steps {
  gap: 8px;
  margin-bottom: 10px;
}

.hub-step {
  min-height: 76px;
  padding: 10px;
  border-radius: 16px;
}

.hub-step span {
  font-size: 12px;
}

.hub-dashboard {
  grid-template-columns: 0.72fr 1fr;
  gap: 8px;
}

.registration-card {
  grid-column: 1 / -1;
}

.hub-card {
  min-height: auto;
  padding: 12px;
  border-radius: 18px;
}

.theme-shell-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.theme-shell {
  min-height: 74px;
  padding: 8px;
  border-radius: 14px;
}

.theme-shell i {
  height: 24px;
  border-radius: 10px;
}

.registry-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.registry-form .label-field,
.registry-form button {
  grid-column: auto;
}

.diagnostics-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 0.78fr 0.88fr 1.34fr;
  gap: 10px;
}

.diagnostics-grid .glass-panel {
  margin-top: 0;
}

.port-scan-panel {
  padding: 14px;
}

.port-scan-grid {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.port-card {
  min-height: 86px;
  padding: 10px;
  border-radius: 16px;
}

@media (max-width: 1100px) {
  .topbar,
  .sandbox-layout,
  .fusion-register-grid,
  .diagnostics-grid {
    grid-template-columns: 1fr;
  }

  .top-nav,
  .topbar .status-strip {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .brand-lockup {
    min-width: 0;
  }

  .floor-plan {
    min-height: 580px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 1600px);
  }

  .topbar h1 {
    white-space: normal;
    font-size: 22px;
  }

  .mode-grid,
  .summary-grid,
  .fusion-columns,
  .hub-steps,
  .hub-dashboard,
  .theme-shell-grid,
  .registry-form,
  .voice-panel .voice-actions,
  .voice-panel .voice-timeline {
    grid-template-columns: 1fr;
  }

  .floor-plan {
    min-height: 460px;
  }

  .scene-map-status {
    grid-template-columns: 1fr;
  }

  .map-dot {
    width: 34px;
    height: 34px;
    font-size: 11px;
  }
}

/* v3 preview fidelity pass */
.app-shell {
  width: min(1524px, calc(100vw - 14px));
  padding: 7px 0 18px;
}

.topbar {
  min-height: 61px;
  padding: 8px 14px;
  grid-template-columns: minmax(300px, 340px) minmax(510px, 1fr) auto;
  gap: 12px;
  border-radius: 15px;
}

.brand-lockup {
  min-width: 0;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 24px;
}

.topbar h1 {
  max-width: none;
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
}

.top-nav {
  justify-content: flex-start;
  gap: 9px;
}

.top-nav a {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
}

.topbar .status-strip {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.topbar .pill {
  min-height: 26px;
  padding: 5px 11px;
  font-size: 11px;
}

.sandbox-layout {
  margin-top: 10px;
  grid-template-columns: minmax(0, 1fr) 496px;
  gap: 10px;
}

.sandbox-stage,
.student-console > .glass-panel,
.sensor-fusion-panel,
.strategy-panel,
.smart-hub,
.diagnostics-grid > .glass-panel {
  border-radius: 15px;
  padding: 14px;
}

.section-title {
  min-height: 24px;
  margin-bottom: 10px;
}

.section-title p {
  font-size: 14px;
}

.section-title strong {
  font-size: 15px;
}

.floor-plan {
  width: 100%;
  height: auto;
  min-height: 0;
  border-radius: 14px;
  aspect-ratio: 793 / 496;
}

.scene-map-status {
  display: none;
}

.generated-floorplan .heat-zone {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 15px;
  color: #ffffff;
  opacity: 0;
  background: rgba(10, 132, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 18px 34px rgba(29, 62, 107, 0.16);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  transform: translateY(8px) scale(0.985);
}

.generated-floorplan .heat-zone span,
.generated-floorplan .heat-zone small {
  display: block;
  text-shadow: 0 2px 10px rgba(7, 25, 54, 0.36);
}

.generated-floorplan .heat-zone span {
  font-size: 14px;
  line-height: 1.12;
}

.generated-floorplan .heat-zone small {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.1;
}

.generated-floorplan .heat-zone.active {
  opacity: 1;
  background: rgba(10, 132, 255, 0.2);
  box-shadow: 0 0 0 5px rgba(10, 132, 255, 0.16), inset 0 0 28px rgba(255, 255, 255, 0.18), 0 18px 34px rgba(29, 62, 107, 0.2);
  transform: translateY(0) scale(1);
}

.generated-floorplan .zone-kitchen.active {
  background: rgba(255, 87, 68, 0.32);
  box-shadow: 0 0 0 6px rgba(255, 59, 48, 0.18), inset 0 0 32px rgba(255, 159, 10, 0.22), 0 18px 34px rgba(176, 56, 24, 0.2);
}

.generated-floorplan .zone-bathroom.active {
  background: rgba(10, 132, 255, 0.3);
  box-shadow: 0 0 0 6px rgba(10, 132, 255, 0.18), inset 0 0 32px rgba(10, 132, 255, 0.18), 0 18px 34px rgba(10, 82, 161, 0.18);
}

.generated-floorplan .zone-living.active {
  background: rgba(21, 151, 105, 0.32);
  box-shadow: 0 0 0 6px rgba(21, 199, 116, 0.18), inset 0 0 32px rgba(21, 199, 116, 0.16), 0 18px 34px rgba(6, 114, 84, 0.18);
}

.generated-floorplan .zone-study.active {
  background: rgba(111, 76, 204, 0.34);
  box-shadow: 0 0 0 6px rgba(142, 92, 247, 0.18), inset 0 0 32px rgba(142, 92, 247, 0.16), 0 18px 34px rgba(65, 44, 137, 0.18);
}

.generated-floorplan .zone-bedroom.active {
  background: rgba(220, 67, 130, 0.32);
  box-shadow: 0 0 0 6px rgba(255, 45, 120, 0.17), inset 0 0 32px rgba(255, 45, 120, 0.14), 0 18px 34px rgba(139, 42, 87, 0.18);
}

.generated-floorplan .zone-balcony.active {
  background: rgba(21, 151, 105, 0.3);
  box-shadow: 0 0 0 6px rgba(21, 199, 116, 0.17), inset 0 0 30px rgba(21, 199, 116, 0.14), 0 18px 34px rgba(6, 114, 84, 0.16);
}

.generated-floorplan .zone-hub.active {
  background: rgba(10, 91, 211, 0.2);
  box-shadow: 0 0 0 6px rgba(10, 132, 255, 0.17), inset 0 0 30px rgba(10, 132, 255, 0.14), 0 18px 34px rgba(10, 82, 161, 0.18);
}

.generated-floorplan .zone-foyer {
  left: 12%;
  top: 6%;
  width: 18%;
  height: 20%;
}

.generated-floorplan .zone-kitchen {
  left: 7%;
  top: 25%;
  width: 20%;
  height: 52%;
}

.generated-floorplan .zone-bathroom {
  left: 35%;
  top: 5%;
  width: 15%;
  height: 28%;
}

.generated-floorplan .zone-living {
  left: 28%;
  top: 34%;
  width: 31%;
  height: 35%;
}

.generated-floorplan .zone-study {
  left: 54%;
  top: 6%;
  right: auto;
  width: 29%;
  height: 27%;
}

.generated-floorplan .zone-bedroom {
  left: 61%;
  top: 35%;
  right: auto;
  width: 30%;
  height: 42%;
}

.generated-floorplan .zone-balcony {
  left: 32%;
  bottom: 3%;
  width: 33%;
  height: 22%;
}

.generated-floorplan .zone-hub {
  right: 3%;
  bottom: 7%;
  width: 24%;
  height: 25%;
  border-style: dashed;
}

.generated-floorplan .map-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 12px;
  border-width: 2px;
}

.generated-floorplan .dot-light { left: 62.5%; top: 18%; right: auto; background: #ffb020; }
.generated-floorplan .dot-sound { left: 56%; top: 18%; right: auto; background: var(--purple); }
.generated-floorplan .dot-pir { left: 42%; bottom: 9%; background: var(--green); }
.generated-floorplan .dot-mq2 { left: 17%; top: 48%; background: var(--red); }
.generated-floorplan .dot-water { left: 40%; top: 22%; background: var(--blue); }
.generated-floorplan .dot-flame { left: 16%; top: 62%; background: var(--orange); }
.generated-floorplan .dot-fan { left: 38%; top: 36%; background: #2475ff; }
.generated-floorplan .dot-buzzer { left: 46%; top: 53%; background: #ff9f0a; }
.generated-floorplan .dot-keypad { left: 37%; top: 62%; background: #0a84ff; }
.generated-floorplan .dot-dht { left: 47%; top: 62%; background: #129b76; }
.generated-floorplan .dot-servo { right: 23%; top: 38%; background: #ff5e8a; }
.generated-floorplan .dot-ring { right: 22%; top: 64%; background: var(--purple); }
.generated-floorplan .dot-relay { right: 4%; bottom: 12%; background: #0f9d58; }

.generated-floorplan .map-dot.scene-active {
  box-shadow: 0 0 0 5px rgba(10, 132, 255, 0.22), 0 13px 24px rgba(10, 132, 255, 0.28);
}

.generated-floorplan .hub-link-line {
  right: 9%;
  bottom: 25%;
  width: 18%;
  height: 22%;
}

.student-console {
  gap: 8px;
}

.console-title {
  min-height: 42px;
  padding: 0 10px;
}

.console-title p {
  font-size: 20px;
}

.console-title strong {
  font-size: 12px;
}

.mode-panel {
  padding: 12px;
}

.mode-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.mode-button {
  min-height: 78px;
  border-radius: 12px;
}

.mode-button i {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.mode-button span {
  font-size: 12px;
  font-weight: 950;
}

.system-card .summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-grid div {
  min-height: 64px;
  padding: 10px;
  border-radius: 13px;
}

.summary-grid span {
  font-size: 11px;
}

.summary-grid strong {
  margin-top: 5px;
  font-size: 17px;
}

.strategy-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.threshold-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.threshold-control {
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(130, 185, 255, 0.26);
}

.threshold-control.active {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.18), rgba(48, 209, 88, 0.16));
  border-color: rgba(10, 132, 255, 0.62);
  box-shadow: 0 12px 28px rgba(10, 132, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.threshold-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.threshold-control-head span,
.threshold-control small {
  color: #5a718b;
  font-size: 11px;
  font-weight: 850;
}

.threshold-control-head strong {
  color: var(--blue);
  font-size: 16px;
}

.threshold-control small {
  display: block;
  margin-top: 7px;
  line-height: 1.35;
}

.threshold-summary strong {
  color: #075eb8;
}

.actuator-test-panel {
  gap: 7px;
}

.actuator-test-panel .section-title {
  margin-bottom: 8px;
}

.test-group {
  min-height: 42px;
  padding: 6px 8px;
  border-radius: 13px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.test-group > span {
  margin: 0;
  color: #315171;
  font-size: 12px;
}

.test-group:has(#keypadTestValue),
.test-group:has([data-actuator-voice]) {
  display: none;
}

.fan-config,
.fan-hard-stop,
.fan-diagnostic-buttons {
  display: none;
}

.test-buttons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.rgb-test-buttons {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.test-buttons button {
  min-height: 30px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(91, 123, 160, 0.08);
}

.voice-panel .section-title {
  margin-bottom: 8px;
}

.voice-panel .voice-orb-card,
.voice-panel .voice-reply-card,
.voice-panel .voice-timeline {
  display: none;
}

.voice-panel .voice-layout {
  display: block;
}

.voice-panel .voice-mic-card {
  padding: 10px;
  border-radius: 13px;
}

.voice-mic-card select {
  min-height: 34px;
  margin-top: 8px;
  border-radius: 10px;
}

.mic-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.mic-controls button {
  min-height: 30px;
  border-radius: 9px;
  font-size: 12px;
}

.voice-panel .voice-actions-card {
  padding: 10px;
  border-radius: 13px;
}

.voice-panel .voice-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.voice-panel .voice-actions button {
  min-height: 32px;
  border-radius: 10px;
}

.fusion-register-grid {
  grid-template-columns: minmax(0, 1fr) 532px;
  gap: 10px;
}

.sensor-fusion-panel,
.smart-hub {
  min-height: 218px;
}

.fusion-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.sensor-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.actuator-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.sensor-card,
.actuator-card {
  min-height: 70px;
  padding: 10px 10px 10px 38px;
  border-radius: 12px;
  position: relative;
}

.sensor-card::before,
.actuator-card::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 19px;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.sensor-card span,
.actuator-card span {
  font-size: 11px;
}

.sensor-card strong,
.actuator-card strong {
  margin-top: 4px;
  font-size: 15px;
}

.sensor-card em,
.actuator-card em,
.sensor-card .bar {
  display: none;
}

.smart-hub .hub-title {
  margin-bottom: 9px;
}

.hub-steps {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.hub-step {
  min-height: 72px;
  padding: 9px;
  border-radius: 12px;
}

.hub-step i {
  width: 24px;
  height: 24px;
}

.hub-step span {
  margin-top: 7px;
}

.hub-dashboard {
  display: block;
}

.board-card,
.registration-card {
  display: none;
}

.theme-card {
  min-height: 88px;
  margin-top: 8px;
}

.theme-shell-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.theme-shell {
  min-height: 58px;
  border-radius: 11px;
}

.theme-shell i {
  height: 18px;
  margin-bottom: 6px;
  border-radius: 8px;
}

.theme-shell span {
  font-size: 12px;
}

.theme-shell small {
  display: none;
}

.diagnostics-grid {
  display: none;
}

@media (min-width: 1400px) {
  .floor-plan {
    height: auto;
  }
}

@media (max-width: 1320px) and (min-width: 1101px) {
  .topbar {
    grid-template-columns: minmax(300px, 340px) 1fr;
  }

  .topbar .status-strip {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .floor-plan { height: auto; }
}

/* Clean floorplan two-column stack: keep sensor fusion directly under the map. */
.dashboard-two-column {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 496px;
  gap: 10px;
  align-items: start;
}

.sandbox-left-stack,
.sandbox-right-stack {
  display: grid;
  gap: 10px;
  align-content: start;
}

.sandbox-left-stack > .glass-panel,
.sandbox-right-stack > .glass-panel,
.sandbox-right-stack > .control-stack {
  min-width: 0;
}

.sandbox-left-stack .sensor-fusion-panel,
.sandbox-right-stack .smart-hub {
  min-height: 0;
}

.sandbox-left-stack .sensor-fusion-panel {
  padding: 14px;
}

.sandbox-left-stack .sensor-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sandbox-left-stack .threshold-control-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sandbox-left-stack .actuator-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sandbox-left-stack .sensor-card,
.sandbox-left-stack .actuator-card {
  min-height: 64px;
  padding: 9px 9px 9px 36px;
}

.sandbox-left-stack .sensor-card::before,
.sandbox-left-stack .actuator-card::before {
  top: 17px;
}

.sandbox-left-stack .sensor-card strong,
.sandbox-left-stack .actuator-card strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.08;
}

.sandbox-left-stack .sensor-card span,
.sandbox-left-stack .actuator-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sandbox-right-stack .smart-hub {
  margin-top: 0;
}

@media (min-width: 1400px) {
  .sandbox-left-stack .sensor-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) and (min-width: 1101px) {
  .dashboard-two-column {
    grid-template-columns: minmax(0, 1fr) 496px;
  }
}

@media (max-width: 1100px) {
  .dashboard-two-column {
    grid-template-columns: 1fr;
  }

  .sandbox-left-stack .sensor-grid,
  .sandbox-left-stack .threshold-control-grid,
  .sandbox-left-stack .actuator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sandbox-left-stack .sensor-grid,
  .sandbox-left-stack .threshold-control-grid,
  .sandbox-left-stack .actuator-grid {
    grid-template-columns: 1fr;
  }
}

/* Competition preview density for the right student console. */
.student-console > .glass-panel {
  padding: 11px;
}

.usb-panel .section-title {
  margin-bottom: 8px;
}

.usb-panel .pill {
  min-height: 24px;
  padding: 4px 9px;
  font-size: 11px;
}

.usb-panel .usb-state-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.usb-panel .usb-state-grid div {
  min-height: 44px;
  padding: 7px 8px;
  border-radius: 11px;
}

.usb-panel .usb-state-grid span {
  font-size: 10px;
}

.usb-panel .usb-state-grid strong {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  white-space: nowrap;
}

.usb-panel .usb-actions {
  gap: 6px;
  margin-top: 7px;
}

.usb-panel .primary-action {
  min-height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-size: 12px;
}

.usb-panel .secondary-action {
  min-height: 30px;
  border-radius: 10px;
  font-size: 12px;
}

.usb-panel .usb-status-text {
  display: block;
  margin-top: 6px;
  font-size: 11px;
}

.student-console .section-title {
  min-height: 22px;
  margin-bottom: 7px;
}

.student-console .section-title p {
  font-size: 13px;
}

.student-console .section-title strong {
  font-size: 14px;
}

.mode-grid {
  gap: 7px;
}

.mode-button {
  min-height: 58px;
  border-radius: 11px;
}

.mode-button i {
  width: 27px;
  height: 27px;
  border-radius: 8px;
}

.mode-button span {
  margin-top: 4px;
}

.system-card .summary-grid {
  gap: 6px;
}

.summary-grid div {
  min-height: 50px;
  padding: 8px 10px;
}

.summary-grid strong {
  margin-top: 3px;
  font-size: 16px;
}

.actuator-test-panel {
  gap: 5px;
}

.test-group {
  min-height: 36px;
  padding: 4px 7px;
}

.test-group > span {
  font-size: 11px;
}

.test-buttons button {
  min-height: 27px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 11px;
}

#actuatorAutoButton {
  display: none;
}

.voice-panel {
  gap: 6px;
}

.voice-panel .section-title {
  align-items: center;
}

.voice-panel #voiceStatusPill {
  min-height: 24px;
  padding: 4px 10px;
}

.voice-panel .voice-mic-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px 8px;
  padding: 8px;
}

.voice-mic-card > span {
  align-self: center;
  font-size: 12px;
}

.voice-mic-card select {
  min-height: 30px;
  margin-top: 0;
}

.voice-mic-card small {
  display: none;
}

.mic-controls {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
}

.mic-controls button {
  min-height: 27px;
}

.voice-panel .voice-actions-card {
  padding: 8px;
}

.voice-panel .voice-actions {
  gap: 6px;
}

.voice-panel .voice-actions button {
  min-height: 28px;
  font-size: 11px;
}
