/* ═══════════════════════════════════════════════
   SMART HOUSE — DESIGN SYSTEM & STYLES
   ═══════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  /* Colors */
  --bg-base: #0a0d14;
  --bg-surface: #111622;
  --bg-elevated: #161d2e;
  --bg-card: #1a2235;
  --bg-hover: #1f293f;

  --accent: #4f8ef7;
  --accent-2: #7c5dff;
  --accent-glow: rgba(79, 142, 247, .25);
  --accent-2-glow: rgba(124, 93, 255, .2);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --text-primary: #f0f4ff;
  --text-secondary: #8a97b8;
  --text-muted: #4a5568;

  --border: rgba(255, 255, 255, .07);
  --border-accent: rgba(79, 142, 247, .35);

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .6);
  --shadow-accent: 0 4px 24px var(--accent-glow);

  /* Typography */
  --font-body: 'Inter', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;

  /* Transitions */
  --t-fast: .15s ease;
  --t-base: .25s ease;
  --t-slow: .4s ease;
}

/* ── RESET ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
}

input {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 99px;
}

/* ─────────────────────────────────────────────
   LAYOUT
───────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.screen {
  display: none;
  flex: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────
   HEADER
───────────────────────────────────────────── */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 13, 20, .85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 64px;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.logo strong {
  color: var(--accent);
}

.header-nav {
  display: flex;
  gap: var(--sp-2);
  flex: 1;
  justify-content: center;
}

.nav-btn {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--t-base);
}

.nav-btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--bg-elevated);
  color: var(--accent);
}

.nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--t-base), box-shadow var(--t-base);
}

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.partial {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.status-label {
  font-size: .8rem;
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────── */
.btn-primary {
  padding: 12px 24px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  transition: all var(--t-base);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: .4;
  pointer-events: none;
  cursor: not-allowed;
}

.btn-ghost {
  padding: 12px 24px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--t-base);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--t-base);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-icon-lg {
  width: 46px;
  height: 46px;
  font-size: 1.3rem;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--t-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-lg:hover {
  color: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 12px rgba(34, 197, 94, .2);
}

.btn-icon-lg.master-on {
  color: var(--success);
  border-color: var(--success);
  background: rgba(34, 197, 94, .1);
}

.w-full {
  width: 100%;
}

/* ─────────────────────────────────────────────
   UPLOAD SCREEN
───────────────────────────────────────────── */
#screenUpload {
  overflow-y: auto;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(79, 142, 247, .06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(124, 93, 255, .06) 0%, transparent 70%),
    var(--bg-base);
}

.upload-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-10) var(--sp-6);
  gap: var(--sp-8);
  min-height: 100%;
}

/* ── Plans Section ── */
.plans-section {
  width: 100%;
  max-width: 900px;
}

.plans-section-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.plans-section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.plans-count-badge {
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-secondary);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}

.plans-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: var(--sp-6);
}

.plans-divider::before,
.plans-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Plan Card ── */
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t-base);
  cursor: default;
}

.plan-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

.plan-card.active {
  border-color: var(--accent);
}

.plan-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated);
  filter: brightness(.85);
  transition: filter var(--t-base);
}

.plan-card:hover .plan-thumb {
  filter: brightness(1);
}

.plan-card-body {
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.plan-card-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-card-meta {
  font-size: .75rem;
  color: var(--text-secondary);
}

.plan-card-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}

.btn-plan-open {
  flex: 1;
  padding: 7px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: var(--r-sm);
  font-size: .8rem;
  font-weight: 600;
  transition: all var(--t-fast);
}

.btn-plan-open:hover {
  opacity: .85;
}

.btn-plan-delete {
  padding: 7px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  font-size: .85rem;
  transition: all var(--t-fast);
}

.btn-plan-delete:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 68, 68, .1);
}

.upload-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-10);
  max-width: 600px;
  width: 100%;
}


.upload-tagline {
  text-align: center;
}

.upload-tagline h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--sp-4);
}

.upload-tagline p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.gradient-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.upload-card {
  width: 100%;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-12) var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  transition: all var(--t-base);
  position: relative;
}

.upload-card:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.upload-card.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: scale(1.01);
}

.upload-icon {
  font-size: 3.5rem;
  line-height: 1;
}

.upload-card h2 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

.upload-card>p {
  font-size: .85rem;
  color: var(--text-secondary);
}

.upload-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: .8rem;
  width: 100%;
  max-width: 280px;
}

.upload-divider::before,
.upload-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.upload-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: center;
}

.feature-chip {
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .8rem;
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   EDITOR SCREEN
───────────────────────────────────────────── */
#screenEditor {
  flex-direction: row;
  overflow: hidden;
  height: calc(100vh - 64px);
}

.editor-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  overflow-y: auto;
}

.editor-sidebar h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-hint {
  font-size: .78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.tool-group-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0 var(--sp-1);
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all var(--t-base);
}

.tool-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.tool-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(79, 142, 247, .08);
}

.tool-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  flex: 1;
}

.empty-hint {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  padding: var(--sp-4);
}

.room-list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-base);
}

.room-list-item:hover {
  border-color: var(--accent);
}

.room-list-item.selected {
  border-color: var(--accent);
  background: rgba(79, 142, 247, .08);
}

.room-num {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 16px;
  text-align: center;
}

.room-color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.room-list-item input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: .875rem;
  font-weight: 500;
  outline: none;
  min-width: 0;
}

.room-delete-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: .75rem;
  flex-shrink: 0;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-delete-btn:hover {
  background: rgba(239, 68, 68, .15);
  color: var(--danger);
}

.editor-canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  overflow: auto;
  padding: var(--sp-6);
}

.editor-sidebar-actions {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
}

.canvas-container {
  position: relative;
  display: inline-block;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.canvas-container img {
  display: block;
  max-height: calc(100vh - 200px);
  max-width: 100%;
}

#editorCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.canvas-hint {
  position: absolute;
  bottom: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-size: .78rem;
  padding: var(--sp-2) var(--sp-4);
  border-radius: 99px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--border);
}

/* ─────────────────────────────────────────────
   DASHBOARD SCREEN
───────────────────────────────────────────── */
#screenDashboard {
  flex-direction: row;
  overflow: hidden;
  height: calc(100vh - 64px);
}

.dashboard-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.dashboard-map-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  overflow: auto;
  padding: var(--sp-8);
  gap: var(--sp-4);
}

.map-container {
  position: relative;
  display: inline-block;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.map-container img {
  display: block;
  max-height: calc(100vh - 220px);
  max-width: 100%;
}

#dashSvg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.map-legend {
  display: flex;
  gap: var(--sp-5);
  font-size: .8rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-active {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.dot-partial {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

.dot-off {
  background: var(--text-muted);
}

/* ─────────────────────────────────────────────
   DASHBOARD PANEL
───────────────────────────────────────────── */
.dashboard-panel {
  width: 360px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-8);
  text-align: center;
}

/* ─────────────────────────────────────────────
   DASHBOARD ROOMS LIST
───────────────────────────────────────────── */
.dash-rooms-list-section {
  border-bottom: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-5);
}

.dash-rooms-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.dash-rooms-list-header h4 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-rooms-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 220px;
  overflow-y: auto;
}

.dash-room-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-base);
  border-left: 3px solid var(--room-color, var(--accent));
}

.dash-room-chip:hover {
  border-right-color: var(--accent);
  background: var(--bg-hover);
}

.dash-room-chip.selected {
  border-color: var(--accent);
  border-left-color: var(--room-color, var(--accent));
  background: rgba(79, 142, 247, .08);
}

.dash-room-chip-name {
  flex: 1;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dash-room-chip-count {
  font-size: .75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}


.panel-icon {
  font-size: 3rem;
}

.panel-placeholder h3 {
  color: var(--text-primary);
}

.panel-placeholder p {
  color: var(--text-secondary);
  font-size: .875rem;
}

.panel-room {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.panel-room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.panel-room-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.panel-room-status {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* ─────────────────────────────────────────────
   APPLIANCE CARDS
───────────────────────────────────────────── */
.appliances-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.appliance-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: all var(--t-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.appliance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--t-base);
  border-radius: 0 0 4px 4px;
  transform-origin: left;
}

.appliance-card.on::before {
  transform: scaleX(1);
}

.appliance-card.on {
  border-color: var(--border-accent);
  background: var(--bg-hover);
}

.appliance-card:hover {
  border-color: rgba(79, 142, 247, .4);
}

.appliance-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.appliance-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.appliance-status {
  font-size: .75rem;
  color: var(--text-muted);
}

.appliance-toggle {
  width: 40px;
  height: 22px;
  background: var(--bg-base);
  border-radius: 99px;
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
  align-self: flex-end;
}

.appliance-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--t-base);
}

.appliance-card.on .appliance-toggle {
  background: rgba(79, 142, 247, .2);
  border-color: var(--accent);
}

.appliance-card.on .appliance-toggle::after {
  left: 21px;
  background: var(--accent);
}

.appliance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.appliance-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

/* Slider inside appliance card */
.appliance-slider {
  width: 100%;
  height: 4px;
  appearance: none;
  background: var(--border);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}

.appliance-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-accent);
  transition: transform var(--t-fast);
}

.appliance-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* ─────────────────────────────────────────────
   SCHEDULER
───────────────────────────────────────────── */
.scheduler-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.scheduler-section h4 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.schedule-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.schedule-form label {
  font-size: .78rem;
  color: var(--text-secondary);
}

.schedule-form input[type="time"] {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  padding: var(--sp-2) var(--sp-3);
  font-size: .875rem;
  width: 100%;
}

.schedule-form input[type="time"]:focus {
  outline: none;
  border-color: var(--accent);
}

.schedule-appliances {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.sched-chip {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .75rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}

.sched-chip.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79, 142, 247, .1);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.schedule-entry {
  font-size: .78rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
}

.schedule-entry .del-btn {
  background: none;
  color: var(--danger);
  font-size: .8rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.schedule-entry .del-btn:hover {
  background: rgba(239, 68, 68, .1);
}

/* ─────────────────────────────────────────────
   DASHBOARD SVG ROOM OVERLAYS
───────────────────────────────────────────── */
.room-poly {
  fill: rgba(79, 142, 247, .12);
  stroke: rgba(79, 142, 247, .5);
  stroke-width: 2;
  cursor: pointer;
  transition: fill .2s, stroke .2s;
}

.room-poly:hover {
  fill: rgba(79, 142, 247, .25);
  stroke: rgba(79, 142, 247, .9);
}

.room-poly.active {
  fill: rgba(34, 197, 94, .15);
  stroke: rgba(34, 197, 94, .8);
}

.room-poly.partial {
  fill: rgba(245, 158, 11, .12);
  stroke: rgba(245, 158, 11, .7);
}

.room-poly.selected-room {
  stroke-width: 3;
  stroke: var(--accent);
}

.room-label {
  fill: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, .6);
  stroke-width: 3px;
}

/* ─────────────────────────────────────────────
   TOAST
───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-5);
  font-size: .875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(120%);
  opacity: 0;
  transition: all var(--t-base);
  z-index: 1000;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

.toast.info {
  border-color: var(--accent);
}

/* ─────────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

.screen.active {
  animation: fadeIn var(--t-slow) ease;
}

.appliance-card {
  animation: fadeIn .3s ease both;
}

/* ─────────────────────────────────────────────
   EDITOR CANVAS COLORS
───────────────────────────────────────────── */
/* (applied via JS canvas 2D context) */