/* ===== NexHome Dashboard ===== */

/* Status Cards Row */
.status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}
.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: fit-content;
}
.status-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  transition: all 0.2s ease-out;
}
.status-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.status-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.status-card-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.status-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}
.status-card-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Time Card */
.time-display {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.date-display {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Weather Card */
.weather-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.weather-temp {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}
.weather-details {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.weather-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Notes Card */
.notes-list {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}
.notes-list::-webkit-scrollbar {
  width: 6px;
}
.notes-list::-webkit-scrollbar-track {
  background: transparent;
}
.notes-list::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
.notes-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}
.note-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.note-item:last-child { border-bottom: none; }
.note-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}
.note-delete:hover { color: var(--color-danger); background: rgba(239,68,68,0.1); }

/* Scenes Grid */
.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Device Quick Overview (horizontal scroll) */
.device-overview-wrap {
  position: relative;
}
.device-overview-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: calc(100% - 8px);
  background: linear-gradient(to right, transparent, var(--bg-primary));
  pointer-events: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.device-overview {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
  scrollbar-width: thin;
}
.device-overview::-webkit-scrollbar { height: 4px; }
.device-overview::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }
.device-mini-card {
  flex: 0 0 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all var(--transition-normal);
  cursor: pointer;
}
.device-mini-card:hover { border-color: var(--border-accent); transform: translateY(-2px); box-shadow: var(--shadow-md); transition: all 0.2s ease-out; }
.device-mini-card.active { border-color: var(--accent-cyan); box-shadow: 0 0 16px rgba(56,189,248,0.12); background: rgba(56,189,248,0.04); }
.device-mini-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 1rem;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.device-mini-card.active .device-mini-icon {
  background: rgba(56,189,248,0.12);
  color: var(--accent-cyan);
}
.device-mini-name {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.device-mini-status {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Voice Panel */
.voice-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  transition: all var(--transition-normal);
}
.voice-panel:hover {
  border-color: var(--border-accent);
}
.voice-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.voice-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.voice-indicator i { color: var(--accent-cyan); }
.command-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
}
.command-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.command-phrase { color: var(--text-primary); }
.command-action { color: var(--text-muted); font-size: 0.78rem; }

/* Door Section */
.door-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.door-status-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.door-lock-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.door-lock-indicator.locked {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--color-success);
}
.door-lock-indicator.unlocked {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--color-danger);
}
.door-lock-indicator i { font-size: 1.4rem; }
.door-lock-indicator:hover { transform: scale(1.02); }
.door-controls-grid {
  display: flex;
  flex-direction: column;
}
.door-control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.door-control-item:last-child { border-bottom: none; }
.door-control-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.door-control-label i { color: var(--accent-cyan); width: 16px; }

.door-monitor {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.door-monitor video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 200px;
  background: var(--bg-elevated);
}
.door-monitor canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.face-detect-badge {
  position: absolute;
  bottom: 50px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}
.face-detect-badge.known {
  background: rgba(34, 197, 94, 0.7);
  color: #fff;
}
.face-detect-badge.unknown {
  background: rgba(248, 113, 113, 0.7);
  color: #fff;
  animation: pulse-badge 1.5s infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.monitor-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}
.monitor-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}
.monitor-btn:hover { background: rgba(56,189,248,0.2); border-color: var(--accent-cyan); }
.monitor-btn.active { background: rgba(56,189,248,0.3); color: var(--accent-cyan); }
.monitor-status {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--color-success);
  background: rgba(0,0,0,0.5);
  padding: 4px 10px;
  border-radius: 20px;
}
.monitor-status i { font-size: 0.5rem; animation: pulse 2s infinite; }

/* Activity Timeline */
.activity-timeline {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
}
.activity-timeline:hover {
  border-color: var(--border-accent);
}
.activity-list {
  max-height: 300px;
  overflow-y: auto;
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-dot.device { background: var(--accent-cyan); }
.activity-dot.scene { background: var(--accent-indigo); }
.activity-dot.alert { background: var(--color-danger); }
.activity-content { flex: 1; }
.activity-text { color: var(--text-secondary); }
.activity-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Responsive */
@media (max-width: 1024px) {
  .status-row { grid-template-columns: 1fr; }
  .door-section { grid-template-columns: 1fr; }
  .env-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .device-mini-card { flex: 0 0 120px; }
}
@media (max-width: 480px) {
  .env-stats-grid { grid-template-columns: 1fr; }
}

/* ===== Floor Plan Interactive ===== */
.floorplan-section {
  margin-bottom: 24px;
}
.floorplan-viewer {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.floorplan-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0a0a0f;
}
.floorplan-canvas img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.floorplan-canvas img.fp-base {
  z-index: 1;
}
.floorplan-canvas img.fp-layer {
  z-index: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.floorplan-canvas img.fp-layer.lit {
  opacity: 1;
}
/* Hotspot — positioned by x/y %, button floats at that point */
.fp-hotspot {
  position: absolute;
  z-index: 10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-hotspot.draggable {
  cursor: grab;
}
.fp-hotspot.draggable:active {
  cursor: grabbing;
}
/* Edit mode: allow dropdown to overflow canvas */
.fp-canvas-edit {
  overflow: visible !important;
}
/* Floating button inside each hotspot */
.fp-hotspot-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, box-shadow 0.2s ease-out;
  background: rgba(30,30,40,0.9);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  min-width: 0;
  width: max-content;
}
.fp-hotspot-btn span,
.fp-hotspot-btn i {
  flex-shrink: 0;
}
.fp-hotspot-btn i {
  font-size: 0.65rem;
  transition: color 0.3s, filter 0.3s;
}
.fp-hotspot:hover .fp-hotspot-btn {
  /* background: rgba(40,40,55,0.85);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4); */
}
.fp-hotspot-btn.on {
  background: rgba(255,185,50,0.2);
  border-color: rgba(255,185,50,0.5);
  color: #FFD666;
  box-shadow: 0 0 14px rgba(255,185,50,0.2), 0 2px 8px rgba(0,0,0,0.3);
}
.fp-hotspot-btn.on i {
  color: #FFBA32;
  filter: drop-shadow(0 0 4px rgba(255,185,50,0.6));
}
.fp-hotspot:hover .fp-hotspot-btn.on {
  /* background: rgba(255,185,50,0.28);
  border-color: rgba(255,185,50,0.65);
  box-shadow: 0 0 18px rgba(255,185,50,0.3), 0 4px 12px rgba(0,0,0,0.4); */
}

/* Save layout button */
.fp-save-btn {
  background: rgba(50,180,100,0.15) !important;
  border-color: rgba(50,180,100,0.4) !important;
  color: #4ade80 !important;
}
.fp-save-btn:hover {
  background: rgba(50,180,100,0.25) !important;
}
/* Edit mode active button */
.fp-edit-active {
  background: rgba(255,160,50,0.18) !important;
  border-color: rgba(255,160,50,0.5) !important;
  color: #fbbf24 !important;
}
.fp-edit-active:hover {
  background: rgba(255,160,50,0.28) !important;
}

/* Floating toolbar for All On / All Off */
.fp-toolbar {
  position: absolute;
  bottom: 28px;
  right: 28px;
  display: flex;
  gap: 8px;
  z-index: 20;
}
.fp-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20,20,30,0.75);
  color: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: all 0.25s ease;
}
.fp-toolbar-btn:hover {
  background: rgba(30,30,45,0.9);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

/* Fullscreen mode */
.fp-fullscreen {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a14;
}
.fp-fullscreen .floorplan-canvas {
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 100vh;
  max-width: calc(100vh * 16 / 9);
  border-radius: 0;
}
.fp-fullscreen .fp-toolbar {
  bottom: 24px;
  right: 50%;
  transform: translateX(50%);
}
/* Fullscreen ambient glow behind lit zones */
.fp-fullscreen .fp-hotspot.active::before {
  content: '';
  position: absolute;
  width: 80px; height: 80px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,214,102,0.25) 0%, transparent 70%);
  animation: fp-glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes fp-glow-pulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

/* Fullscreen status bar (top) */
.fp-status-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(10,10,20,0.85) 0%, transparent 100%);
  z-index: 20;
  pointer-events: none;
}
.fp-status-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.fp-status-item i {
  font-size: 0.72rem;
}

/* Fullscreen bottom widgets */
.fp-fs-widget {
  position: absolute;
  z-index: 20;
  background: rgba(12,14,24,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 12px 16px;
  pointer-events: none;
  min-width: 160px;
}
.fp-fs-widget-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}
.fp-fs-widget-head i {
  font-size: 0.68rem;
}

/* Weather widget — bottom left */
.fp-fs-weather {
  bottom: 28px;
  left: 28px;
}
.fp-fs-weather-temp {
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.fp-fs-weather-desc {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin: 2px 0 8px;
}
.fp-fs-weather-detail {
  display: flex;
  gap: 14px;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
}
.fp-fs-weather-detail i {
  font-size: 0.58rem;
  margin-right: 3px;
}

/* Home summary widget — bottom right */
.fp-fs-home {
  bottom: 28px;
  right: 28px;
}
.fp-fs-home-stats {
  display: flex;
  gap: 18px;
  margin-bottom: 8px;
}
.fp-fs-home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.fp-fs-home-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.fp-fs-home-label {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fp-fs-home-activity {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.64rem;
  color: rgba(255,255,255,0.4);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 7px;
  margin-top: 2px;
}
.fp-fs-home-activity i {
  font-size: 0.56rem;
}

/* Side panels for room info cards */
.fp-side-panel {
  position: absolute;
  top: 0; bottom: 0;
  width: 18%;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px;
  pointer-events: none;
}
.fp-side-left { left: 0; align-items: flex-start; padding-left: 10px; }
.fp-side-right { right: 0; align-items: flex-end; padding-right: 10px; }

/* Info card */
.fp-info-card {
  background: rgba(15,18,28,0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 9px 11px;
  width: 100%;
  max-width: 190px;
  transition: transform 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
  pointer-events: auto;
  cursor: default;
  transform-origin: top left;
}
.fp-side-right .fp-info-card {
  transform-origin: top right;
}
.fp-info-card:hover {
  transform: scale(1.18);
  z-index: 50;
  background: rgba(15,18,28,0.94);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  transition: transform 0.3s cubic-bezier(0.25,0.46,0.45,0.94),
              box-shadow 0.3s ease,
              border-color 0.3s ease,
              background 0.3s ease;
}
.fp-info-card.fp-info-on:hover {
  background: rgba(25,22,15,0.96);
  border-color: rgba(255,200,60,0.4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(255,200,60,0.12);
}
.fp-info-card.fp-info-on {
  border-color: rgba(255,200,60,0.25);
  background: rgba(25,22,15,0.8);
  box-shadow: 0 0 12px rgba(255,200,60,0.08);
}
.fp-info-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.fp-info-card-head > i {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  transition: color 0.3s, filter 0.3s;
}
.fp-info-card-head > i.fp-icon-lit {
  color: #FFBA32;
  filter: drop-shadow(0 0 3px rgba(255,186,50,0.6));
}
.fp-info-card-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fp-info-card-status {
  font-size: 0.56rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fp-info-card-status.on {
  background: rgba(255,200,60,0.18);
  color: #FFD666;
}
.fp-info-card-status.off {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.3);
}
.fp-info-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.fp-info-metric {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.68);
  font-variant-numeric: tabular-nums;
}
.fp-info-metric i {
  font-size: 0.56rem;
  width: 12px;
  text-align: center;
}
.fp-info-unbound {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.2);
  font-style: italic;
}

/* Fullscreen: bigger side panels */
.fp-fullscreen .fp-side-panel {
  width: 18%;
  gap: 10px;
  padding: 20px 10px;
}
.fp-fullscreen .fp-info-card {
  max-width: 230px;
  padding: 11px 14px;
  border-radius: 12px;
}
.fp-fullscreen .fp-info-card-head > i { font-size: 0.82rem; }
.fp-fullscreen .fp-info-card-name { font-size: 0.88rem; }
.fp-fullscreen .fp-info-card-status { font-size: 0.6rem; padding: 2px 7px; }
.fp-fullscreen .fp-info-card-body { gap: 5px 12px; }
.fp-fullscreen .fp-info-metric { font-size: 0.78rem; gap: 5px; }
.fp-fullscreen .fp-info-metric i { font-size: 0.64rem; width: 14px; }
.fp-fullscreen .fp-info-unbound { font-size: 0.7rem; }

/* Bind room dropdown (shown in edit mode) */

/* ===== Floor Plan Device Badges ===== */
.fp-device-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.fp-dbadge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 0.52rem;
  font-weight: 600;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.2);
  transition: color 0.3s, background 0.3s;
  line-height: 1.4;
}
.fp-dbadge i { font-size: 0.5rem; }

/* LED */
.fp-dbadge.fp-db-led.on {
  color: #FBBF24;
  background: rgba(251,191,36,0.15);
}
.fp-dbadge.fp-db-led.on i {
  animation: badge-led-glow 2s ease-in-out infinite;
}

/* AC cool */
.fp-dbadge.fp-db-cool.on {
  color: #38BDF8;
  background: rgba(56,189,248,0.15);
}
.fp-dbadge.fp-db-cool.on i {
  animation: badge-spin 3s linear infinite;
}

/* AC heat */
.fp-dbadge.fp-db-heat.on {
  color: #F97316;
  background: rgba(249,115,22,0.15);
}
.fp-dbadge.fp-db-heat.on i {
  animation: badge-fire-pulse 1.2s ease-in-out infinite;
}

/* Fan */
.fp-dbadge.fp-db-fan.on {
  color: #34D399;
  background: rgba(52,211,153,0.15);
}
.fp-dbadge.fp-db-fan.on i {
  animation: badge-spin 1.5s linear infinite;
}

/* Speaker */
.fp-dbadge.fp-db-speaker.on {
  color: #818CF8;
  background: rgba(129,140,248,0.15);
}
.fp-dbadge.fp-db-speaker.on i {
  animation: badge-speaker-pulse 1s ease-in-out infinite;
}

/* Curtain */
.fp-dbadge.fp-db-curtain.on {
  color: #A78BFA;
  background: rgba(167,139,250,0.15);
}

/* Fullscreen: slightly bigger badges */
.fp-fullscreen .fp-dbadge {
  font-size: 0.6rem;
  padding: 2px 6px;
  gap: 4px;
}
.fp-fullscreen .fp-dbadge i { font-size: 0.56rem; }

/* ===== Bind room dropdown (shown in edit mode) ===== */
.fp-bind-wrap {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  z-index: 20;
  pointer-events: auto;
}
.fp-bind-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(15,15,25,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  font-size: 0.62rem;
  padding: 4px 22px 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: border-color 0.2s;
}
.fp-bind-select:hover,
.fp-bind-select:focus {
  border-color: rgba(0,212,255,0.5);
}
.fp-bind-select option {
  background: #1a1a2e;
  color: #fff;
}

/* Fullscreen hotspot btn gets bigger */
.fp-fullscreen .fp-hotspot-btn {
  font-size: 0.78rem;
  padding: 6px 14px;
  gap: 6px;
}

@media (max-width: 768px) {
  .fp-hotspot-btn { font-size: 0.58rem; padding: 3px 7px; gap: 3px; }
  .fp-toolbar { bottom: 12px; right: 12px; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .fp-toolbar-btn { font-size: 0.6rem; padding: 4px 8px; }
  .fp-bind-select { font-size: 0.58rem; }
  .fp-status-bar { gap: 14px; padding: 8px 12px; }
  .fp-status-item { font-size: 0.68rem; }
  .fp-side-panel { display: none; }
  .fp-fullscreen .fp-side-panel { display: flex; width: 18%; }
  .fp-fs-widget { display: none; }
  .fp-fullscreen .fp-fs-widget { display: block; padding: 8px 10px; min-width: 120px; border-radius: 8px; }
  .fp-fs-weather-temp { font-size: 1.2rem; }
  .fp-fs-home-val { font-size: 1rem; }
}

/* ===== Room Card Device Badges ===== */
.room-device-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.room-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.3s;
}
.room-badge.on {
  color: var(--accent-cyan);
  border-color: rgba(56,189,248,0.25);
  background: rgba(56,189,248,0.08);
}
.room-badge i { font-size: 0.62rem; }

/* LED on glow */
.room-badge.badge-led.on {
  color: #FBBF24;
  border-color: rgba(251,191,36,0.3);
  background: rgba(251,191,36,0.1);
}
.room-badge.badge-led.on i {
  animation: badge-led-glow 2s ease-in-out infinite;
}
@keyframes badge-led-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(251,191,36,0.4)); }
  50% { filter: drop-shadow(0 0 6px rgba(251,191,36,0.8)); }
}

/* AC cool */
.room-badge.badge-ac-cool.on {
  color: #38BDF8;
  border-color: rgba(56,189,248,0.3);
  background: rgba(56,189,248,0.1);
}
.room-badge.badge-ac-cool.on i {
  animation: badge-spin 3s linear infinite;
}

/* AC heat */
.room-badge.badge-ac-heat.on {
  color: #F97316;
  border-color: rgba(249,115,22,0.3);
  background: rgba(249,115,22,0.1);
}
.room-badge.badge-ac-heat.on i {
  animation: badge-fire-pulse 1.2s ease-in-out infinite;
}
@keyframes badge-fire-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* Fan */
.room-badge.badge-fan.on {
  color: #34D399;
  border-color: rgba(52,211,153,0.3);
  background: rgba(52,211,153,0.1);
}
.room-badge.badge-fan.on i {
  animation: badge-spin 1.5s linear infinite;
}
@keyframes badge-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Speaker */
.room-badge.badge-speaker.on {
  color: #818CF8;
  border-color: rgba(129,140,248,0.3);
  background: rgba(129,140,248,0.1);
}
.room-badge.badge-speaker.on i {
  animation: badge-speaker-pulse 1s ease-in-out infinite;
}
@keyframes badge-speaker-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Curtain */
.room-badge.badge-curtain.on {
  color: #A78BFA;
  border-color: rgba(167,139,250,0.3);
  background: rgba(167,139,250,0.1);
}

/* Heater */
.room-badge.badge-heater.on {
  color: #FB923C;
  border-color: rgba(251,146,60,0.3);
  background: rgba(251,146,60,0.1);
}
.room-badge.badge-heater.on i {
  animation: badge-fire-pulse 1.2s ease-in-out infinite;
}

/* Buzzer active */
.room-badge.badge-buzzer.on {
  color: #F87171;
  border-color: rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.1);
}
.room-badge.badge-buzzer.on i {
  animation: badge-buzzer-ring 0.4s ease-in-out infinite alternate;
}
@keyframes badge-buzzer-ring {
  from { transform: rotate(-12deg); }
  to { transform: rotate(12deg); }
}

/* ===== Environment Stats ===== */
.env-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.env-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-normal);
  min-width: 0;
  overflow: hidden;
}

.env-stat-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.env-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.env-stat-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.env-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-stat-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 1px;
}

.env-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-stat-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.env-stat-badge.ok {
  background: rgba(34, 197, 94, 0.12);
  color: #22C55E;
}

.env-stat-badge.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
}

.env-stat-badge.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
}

/* ===== Quick Actions ===== */
.quick-actions-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.quick-actions-grid::-webkit-scrollbar { height: 4px; }
.quick-actions-grid::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  flex: 0 0 auto;
  min-width: 100px;
}

.quick-action-btn:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.quick-action-btn:active {
  transform: translateY(0) scale(0.97);
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ===== AI Chat ===== */
.ai-chat-fab {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 250;
  box-shadow: 0 4px 20px rgba(6,182,212,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(6,182,212,0.5);
}

.ai-chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  z-index: 260;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  color: #1e293b;
}
.ai-chat-drawer.open {
  transform: translateX(0);
}
.ai-chat-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.35);
  z-index: 255;
  cursor: pointer;
}
/* AICSS_PART2 */

.ai-chat-header {
  height: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #e5e7eb;
  color: #1e293b;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
}
.ai-msg-user {
  flex-direction: row-reverse;
}
.ai-msg-assistant {
  flex-direction: row;
}

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
  flex-shrink: 0;
}

.ai-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.ai-bubble-user {
  background: #e0f2fe;
  color: #1e293b;
  border-bottom-right-radius: 4px;
}
.ai-bubble-assistant {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}
/* AICSS_PART3 */

.ai-tool-indicator {
  font-size: 0.72rem;
  color: #06b6d4;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #1e293b;
  margin-left: 2px;
  animation: aiCursorBlink 0.8s infinite;
  vertical-align: text-bottom;
}
@keyframes aiCursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.ai-chat-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
}
.ai-chat-input textarea {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  color: #1e293b;
  font-size: 0.85rem;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 100px;
  line-height: 1.4;
}
.ai-chat-input textarea:focus {
  border-color: #06b6d4;
}
.ai-chat-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.ai-chat-input button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Voice Button */
.ai-voice-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
}
.ai-voice-btn:hover:not(:disabled) {
  color: #06b6d4;
  border-color: #06b6d4;
}
.ai-voice-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.ai-voice-btn.active {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  border-color: transparent;
}
.ai-voice-btn.pulse {
  animation: voicePulse 1.5s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Voice Status Bar */
.ai-voice-status {
  padding: 8px 16px;
  font-size: 0.78rem;
  color: #64748b;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-voice-status i {
  margin-right: 4px;
}
.ai-asr-text {
  font-style: italic;
  color: #94a3b8;
  font-size: 0.82rem;
  opacity: 0.8;
}
.ai-interrupt-btn {
  margin-left: 8px;
  padding: 2px 10px;
  font-size: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-interrupt-btn:hover {
  background: var(--accent, #e74c3c);
  color: #fff;
}

@media (max-width: 768px) {
  .status-row {
    grid-template-columns: 1fr;
  }
  .ai-chat-drawer {
    width: 100%;
  }
  .ai-chat-fab {
    bottom: 76px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }
}

/* Responsive breakpoints for status cards */
@media (min-width: 769px) and (max-width: 1200px) {
  .status-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1201px) and (max-width: 1600px) {
  .status-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1601px) and (max-width: 2200px) {
  .status-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  .status-card {
    padding: 24px;
  }
}

/* 2K and higher resolution optimization */
@media (min-width: 2201px) {
  .status-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
  }
  .status-card {
    padding: 28px;
  }
  .scenes-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
  }
}

/* ============================================
   ACCESSIBILITY & PERFORMANCE ENHANCEMENTS
   ============================================ */

/* Optimize animations with transform */
.status-card,
.device-mini-card,
.scene-card,
.device-card {
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s ease-out;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile touch targets and interactions */
@media (max-width: 768px) {
  /* Ensure minimum touch target size */
  button,
  .clickable,
  .fp-toolbar-btn,
  .note-delete {
    min-height: 44px;
    min-width: 44px;
    padding: 12px;
  }

  .btn-icon,
  .ai-chat-fab {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Remove hover dependencies on touch devices */
  .status-card:hover,
  .device-mini-card:hover,
  .scene-card:hover {
    transform: none;
  }

  /* Use active state for touch feedback */
  .status-card:active,
  .device-mini-card:active,
  .scene-card:active {
    background: rgba(0, 212, 255, 0.08);
    transform: scale(0.98);
  }
}
