:root {
  --dash-max-w: 1360px;
  --bg: #070D18;
  --bg-2: #172554;
  --card-bg: rgba(18, 28, 48, 0.72);
  --card-border: rgba(56, 189, 248, 0.2);
  --primary: #7C4DFF;
  --primary-2: #6366F1;
  --accent: #38BDF8;
  --success: #10B981;
  --warn: #F59E0B;
  --danger: #EF4444;
  --info: #38BDF8;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --switch-off: #0F172A;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 20px;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
body.theme-emerald { --bg: #061e14; --bg-2: #0a2a1c; --card-bg: rgba(11, 45, 31, 0.75); --card-border: rgba(16, 185, 129, 0.25); --primary: #059669; --primary-2: #047857; --accent: #10b981; --text-muted: #6ee7b7; --switch-off: #134e35; }
body.theme-ocean { --bg: #070D18; --bg-2: #172554; --card-bg: rgba(18, 28, 48, 0.75); --card-border: rgba(56, 189, 248, 0.25); --primary: #7C4DFF; --primary-2: #6366F1; --accent: #38BDF8; --success: #10B981; --text-muted: #94A3B8; --switch-off: #0F172A; }
body.theme-amber { --bg: #1a1208; --bg-2: #231809; --card-bg: rgba(40, 29, 15, 0.75); --card-border: rgba(245, 158, 11, 0.25); --primary: #d97706; --primary-2: #b45309; --accent: #fbbf24; --success: #f59e0b; --text-muted: #fcd34d; --switch-off: #452d14; }
body.theme-violet { --bg: #0f0b1a; --bg-2: #171128; --card-bg: rgba(28, 21, 48, 0.75); --card-border: rgba(167, 139, 250, 0.25); --primary: #7c3aed; --primary-2: #6d28d9; --accent: #a78bfa; --success: #8b5cf6; --text-muted: #c4b5fd; --switch-off: #2a2140; }
body.theme-light { --bg: #f1f5f4; --bg-2: #e6ece9; --card-bg: #ffffff; --card-border: rgba(0, 0, 0, 0.08); --primary: #059669; --primary-2: #047857; --accent: #047857; --text: #0f172a; --text-muted: #475569; --switch-off: #cbd5e1; --shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
 
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; letter-spacing: -0.2px; }
body {
  background-color: #060B14;
  background-image: 
    radial-gradient(rgba(56, 189, 248, 0.08) 1.5px, transparent 1.5px),
    radial-gradient(ellipse 90% 60% at 50% -15%, #172554 0%, #060B14 70%);
  background-size: 28px 28px, 100% 100%;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px clamp(16px, 3.5vw, 40px) 100px; transition: background 0.5s var(--ease), color 0.5s var(--ease);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 0.76rem; }
.mono { font-family: 'JetBrains Mono', monospace; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.wrap { flex-wrap: wrap; }

/* ---------------- hub pill badge ---------------- */
.hub-pill-wrapper {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  display: flex;
  justify-content: center;
  margin-top: 2px;
  margin-bottom: 8px;
}
.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #C7D2FE;
  background: rgba(30, 27, 75, 0.75);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(124, 77, 255, 0.45);
  box-shadow: 0 0 16px rgba(124, 77, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: all 0.25s var(--ease);
}
.hub-pill:hover {
  border-color: #A78BFA;
  box-shadow: 0 0 22px rgba(167, 139, 250, 0.4);
}

/* ---------------- hero dashboard title ---------------- */
.dash-hero {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  text-align: center;
  margin: 6px 0 16px;
}
.dash-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.1rem, 4.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.15;
  margin-bottom: 6px;
  background: linear-gradient(180deg, #FFFFFF 15%, #BAE6FD 55%, #38BDF8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(56, 189, 248, 0.35));
}
.dash-sub {
  font-size: 0.92rem;
  font-weight: 500;
  color: #94A3B8;
  letter-spacing: 0.2px;
}

/* ---------------- status edge & security bar ---------------- */
.status-edge-bar {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.pill-edge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.pill-edge.ok {
  background: rgba(10, 35, 25, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #A7F3D0;
}
.pill-edge .led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981, 0 0 18px rgba(16, 185, 129, 0.8);
}
.pill-edge.busy .led {
  background: #38BDF8;
  box-shadow: 0 0 10px #38BDF8;
  animation: blink 1s infinite;
}
.pill-edge.bad {
  background: rgba(45, 15, 15, 0.7);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FECACA;
}
.pill-edge.bad .led {
  background: #EF4444;
  box-shadow: 0 0 10px #EF4444;
}
.pill-edge.security {
  background: rgba(12, 30, 26, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #A7F3D0;
}

/* ---------------- master action bar ---------------- */
.master-action-bar {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.btn-master {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 24px;
  min-width: 170px;
  color: #F8FAFC;
  font-weight: 700;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s var(--ease);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}
@media (max-width: 600px) {
  .master-action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1.15fr;
    gap: 8px;
  }
  .btn-master {
    min-width: 0;
    padding: 10px 8px;
    font-size: 0.8rem;
  }
}
.btn-master:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
  transform: translateY(-2px);
}
.btn-master:active {
  transform: scale(0.96);
}
.btn-master.primary {
  background: linear-gradient(135deg, #4338CA 0%, #6366F1 50%, #7C4DFF 100%);
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45), 0 0 14px rgba(124, 77, 255, 0.35);
}
.btn-master.primary:hover {
  box-shadow: 0 8px 26px rgba(99, 102, 241, 0.6), 0 0 20px rgba(124, 77, 255, 0.5);
}

/* ---------------- room filter bar ---------------- */
.room-filter-bar {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  display: flex;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 4px 20px;
  scrollbar-width: none;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .room-filter-bar {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
}
.room-filter-bar::-webkit-scrollbar { display: none; }
.room-pill {
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.65);
  color: #94A3B8;
  white-space: nowrap;
  transition: all 0.25s var(--ease);
  backdrop-filter: blur(10px);
}
.room-pill:hover {
  color: #FFFFFF;
  border-color: rgba(56, 189, 248, 0.35);
}
.room-pill.active {
  background: linear-gradient(135deg, #7C4DFF 0%, #9333EA 100%);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 0 16px rgba(124, 77, 255, 0.65), 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ---------------- header ---------------- */
header { width: 100%; max-width: var(--dash-max-w, 1360px); display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 22px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 14px; flex-shrink: 0; user-select: none; }
.brand .logo { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; box-shadow: 0 0 24px rgba(56, 189, 248, 0.55); overflow: hidden; background: transparent; flex-shrink: 0; }
.brand-logo-img { width: 100%; height: 100%; object-fit: cover; border-radius: 15px; display: block; }
.brand-text { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.brand-title { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.35rem; letter-spacing: -0.4px; color: #FFFFFF; white-space: nowrap; }
.brand small { display: block; font-size: 0.78rem; font-weight: 700; color: #94A3B8; letter-spacing: 1.2px; text-transform: uppercase; -webkit-text-fill-color: #94A3B8; margin-top: 3px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid rgba(56, 189, 248, 0.28); background: rgba(18, 28, 48, 0.75); backdrop-filter: blur(14px); color: var(--accent); display: grid; place-items: center; font-size: 1.22rem; transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.25s; position: relative; }
.icon-btn:hover { background: rgba(56, 189, 248, 0.2); border-color: var(--accent); box-shadow: 0 0 20px rgba(56, 189, 248, 0.4); transform: translateY(-2px); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.primary { width: 48px; height: 48px; font-size: 1.35rem; background: linear-gradient(135deg, #7C4DFF, #6366F1); color: #fff; border-color: transparent; box-shadow: 0 4px 22px rgba(124, 77, 255, 0.55); }
.icon-btn .dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); border: 2.5px solid var(--bg); }
.btn-auth { background: rgba(18, 28, 48, 0.75); backdrop-filter: blur(14px); border: 1.5px solid rgba(56, 189, 248, 0.3); border-radius: 999px; padding: 10px 18px; font-size: 0.94rem; font-weight: 700; color: #F8FAFC; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); transition: all 0.2s ease; }
.btn-auth i { font-size: 1.15rem; }
.btn-auth:hover { border-color: var(--accent); box-shadow: 0 0 18px rgba(56, 189, 248, 0.35); }
.user-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
 
/* ---------------- pull to refresh ---------------- */
.pull-to-refresh {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: height;
  pointer-events: none;
  margin-bottom: 2px;
}
.pull-to-refresh.dragging {
  transition: none; /* instant response while dragging */
}
.ptr-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  backdrop-filter: blur(8px);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-4px);
  transition: transform 0.2s, background 0.2s;
}
.pull-to-refresh.ready .ptr-content {
  background: rgba(16, 185, 129, 0.24);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
  transform: translateY(0);
}
.ptr-icon {
  font-size: 0.85rem;
  transition: transform 0.22s ease;
}
.pull-to-refresh.ready .ptr-icon {
  transform: rotate(180deg);
}
.ptr-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(52, 211, 153, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptrSpin 0.65s linear infinite;
}
.ptr-spinner.hidden {
  display: none;
}
@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}

/* ---------------- status strip ---------------- */
.status-strip { width: 100%; max-width: var(--dash-max-w, 1360px); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; border: 1px solid rgba(56, 189, 248, 0.2); background: rgba(18, 28, 48, 0.65); backdrop-filter: blur(12px); color: var(--text-muted); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }
.pill .led { width: 8px; height: 8px; border-radius: 50%; background: #64748b; box-shadow: 0 0 0 0 transparent; }
.pill.ok .led { background: var(--success); box-shadow: 0 0 8px var(--success); }
.pill.warn .led { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.pill.bad .led { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.pill.busy .led { animation: blink 1s infinite; background: var(--info); box-shadow: 0 0 8px var(--info); }
.pill.clickable { cursor: pointer; transition: all 0.2s ease; }
.pill.clickable:hover { border-color: var(--accent); color: #FFF; transform: translateY(-1px); }
@keyframes blink { 50% { opacity: 0.2; } }
 
/* ---------------- banners ---------------- */
.banner { width: 100%; max-width: var(--dash-max-w, 1360px); border-radius: 16px; padding: 12px 18px; font-size: 0.82rem; line-height: 1.4; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; backdrop-filter: blur(14px); }
.banner i { margin-top: 2px; }
.banner.error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.banner.warn { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); color: #fde68a; }
.banner.info { background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.35); color: #bae6fd; }
.banner .close { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.7; }
.banner a, .banner button.link { color: inherit; font-weight: 700; text-decoration: underline; background: none; border: 0; padding: 0; }
 
/* ---------------- device grid & node cards ---------------- */
.container {
  width: 100%;
  max-width: var(--dash-max-w, 1360px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 24px;
  margin-bottom: 36px;
  align-items: start;
}
@media (max-width: 640px) {
  .container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
.node-card {
  width: 100%;
  background: linear-gradient(180deg, rgba(16, 26, 48, 0.92) 0%, rgba(9, 14, 28, 0.98) 100%);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(56, 189, 248, 0.24);
  border-radius: 24px;
  padding: 20px 20px 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 25px rgba(56, 189, 248, 0.06);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.25s var(--ease);
}
.node-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.15);
}
.node-card.offline {
  opacity: 0.65;
  filter: saturate(0.5);
}
.node-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.node-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #F8FAFC;
  letter-spacing: -0.3px;
  margin-bottom: 3px;
}
.node-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748B;
  letter-spacing: 0.5px;
}
.node-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.room-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.32);
  padding: 5px 14px;
  border-radius: 999px;
  text-transform: uppercase;
}
.node-menu-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94A3B8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.node-menu-btn:hover {
  color: #FFF;
  background: rgba(56, 189, 248, 0.2);
  border-color: #38BDF8;
}

.relay-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}
.relay-grid.dual {
  grid-template-columns: 1fr 1fr;
}
.relay-grid.single {
  grid-template-columns: 1fr;
}
.relay-tile {
  background: linear-gradient(145deg, #10162A 0%, #0A0E1C 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.25s var(--ease);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}
.relay-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
}
.relay-tile:active {
  transform: scale(0.97);
}
.relay-tile.active {
  background: linear-gradient(145deg, #1A2346 0%, #131732 100%);
  border-color: #38BDF8;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.28), inset 0 0 16px rgba(56, 189, 248, 0.12);
}
.relay-tile.active::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #38BDF8, transparent);
}
.tile-icon-box {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.tile-name {
  font-size: 1.22rem;
  font-weight: 800;
  color: #F8FAFC;
  letter-spacing: -0.2px;
}
.tile-status {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.tile-status.on {
  color: #38BDF8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}
.tile-status.off {
  color: #64748B;
}

.node-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.trigger-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94A3B8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  transition: all 0.2s;
}
.trigger-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFF;
}
.trigger-pill .count {
  background: var(--primary);
  color: #FFF;
  border-radius: 999px;
  padding: 0 5px;
  font-size: 0.62rem;
}
.link-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rssi-text {
  font-size: 0.7rem;
  color: #64748B;
  font-family: 'JetBrains Mono', monospace;
}

.empty {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 580px;
  margin: 12px auto;
  text-align: center;
  padding: 36px 24px;
  color: var(--text-muted);
  background: rgba(18, 28, 48, 0.72);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.card {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border); padding: 14px; display: flex; flex-direction: column; justify-content: space-between;
  background-size: cover; background-position: center; overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), border-color 0.3s, box-shadow 0.3s; user-select: none; -webkit-user-select: none;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 20px rgba(56, 189, 248, 0.15);
}
.card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55)); opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.card.has-bg::before { opacity: 1; }
.card.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 14px 34px rgba(56, 189, 248, 0.22);
}
.card.offline { opacity: 0.55; filter: saturate(0.4); }
.card.idle .fading { opacity: 0.25; transition: opacity 1.2s var(--ease); }
.card.idle::before { opacity: 0.2; }
.card.idle .toggle .track { background: rgba(255, 255, 255, 0.12); backdrop-filter: blur(6px); }
.card > * { position: relative; z-index: 1; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-box {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted); font-size: 1.15rem; transition: all 0.3s var(--ease); cursor: pointer;
}
.icon-box.on {
  background: linear-gradient(135deg, #7C4DFF, #38BDF8);
  color: #fff; border-color: transparent;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.45);
}
.card-info h3 { font-size: 0.96rem; font-weight: 700; margin-bottom: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-info p { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.card.has-bg .card-info h3, .card.has-bg .card-info p { color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
.link-tag { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.5px; padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); text-transform: uppercase; font-family: 'JetBrains Mono', monospace; }
.link-tag.lan { color: var(--success); background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.3); }
.link-tag.cloud { color: var(--info); background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.3); }
.link-tag.none { color: var(--danger); background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.trigger-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 700; color: var(--accent); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--card-border); border-radius: 10px; padding: 5px 8px; max-width: 100%; overflow: hidden; }
.trigger-btn .count { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 0.62rem; }
.wifi { font-size: 0.85rem; }
.active-chips { display: flex; gap: 3px; flex-wrap: wrap; }
.active-chips i { font-size: 0.65rem; color: var(--accent); background: rgba(0, 0, 0, 0.3); padding: 3px; border-radius: 5px; }
 
/* toggle */
.toggle { position: relative; width: 48px; height: 28px; display: inline-block; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .track { position: absolute; inset: 0; border-radius: 999px; background: #0F172A; transition: background 0.35s var(--ease), box-shadow 0.35s; border: 1px solid rgba(255, 255, 255, 0.1); }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.35s var(--ease); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.toggle input:checked + .track { background: linear-gradient(135deg, #7C4DFF, #38BDF8); border-color: transparent; box-shadow: 0 0 14px rgba(56, 189, 248, 0.45); }
.toggle input:checked + .track::after { transform: translateX(20px); }
.toggle.disabled { opacity: 0.45; pointer-events: none; }
.toggle.verifying .track::after { animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.4); } }
 
/* long-press menu */
.card-menu { position: absolute; top: 46px; right: 10px; z-index: 5; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); min-width: 150px; display: none; }
.card-menu.show { display: block; animation: pop 0.25s var(--ease); }
.card-menu button { width: 100%; display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: none; border: none; text-align: left; font-size: 0.78rem; font-weight: 600; }
.card-menu button:hover { background: rgba(255, 255, 255, 0.06); }
.card-menu button.danger { color: var(--danger); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }
 
/* ---------------- sheets / modals ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: none; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.overlay.show { display: flex; animation: fade 0.25s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 22px 22px 0 0; padding: 14px 16px 24px; animation: slideUp 0.35s var(--ease); box-shadow: var(--shadow); }
@media (min-width: 600px) { .overlay { align-items: center; padding: 20px; } .sheet { border-radius: 22px; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-handle { width: 44px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); margin: 0 auto 12px; }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 800; font-size: 1rem; color: var(--accent); }
.sheet-header .sub { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.btn-close { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--card-border); color: var(--text); width: 32px; height: 32px; border-radius: 50%; }
 
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group label { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); display: flex; justify-content: space-between; }
.form-group label b { color: var(--accent); }
input[type="text"], input[type="number"], input[type="password"], input[type="url"], input[type="time"], select, textarea {
  width: 100%; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--card-border); border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; outline: none; color: var(--text);
}
body.theme-light input[type="text"], body.theme-light input[type="number"], body.theme-light input[type="password"], body.theme-light input[type="url"], body.theme-light input[type="time"], body.theme-light select, body.theme-light textarea { background: #f8fafc; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
input[type="file"] { font-size: 0.78rem; }
.help { font-size: 0.7rem; color: var(--text-muted); line-height: 1.4; }
.btn { border: none; border-radius: 12px; padding: 11px 14px; font-weight: 700; font-size: 0.86rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.2s var(--ease), opacity 0.2s; width: 100%; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.secondary { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--card-border); }
.btn.danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.35); }
.btn.sm { padding: 7px 10px; font-size: 0.74rem; width: auto; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
 
.seg { display: flex; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--card-border); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: none; background: transparent; color: var(--text-muted); font-size: 0.74rem; font-weight: 700; padding: 8px 4px; border-radius: 9px; }
.seg button.on { background: var(--primary); color: #fff; }
 
.steps { display: flex; flex-direction: column; gap: 8px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--card-border); padding: 12px; border-radius: 14px; margin-bottom: 12px; }
.step { display: flex; gap: 10px; align-items: flex-start; font-size: 0.8rem; line-height: 1.4; }
.step .num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; }
.progress { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--primary); width: 0; transition: width 0.3s; }
.found-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.found { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--card-border); border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.found .meta { flex: 1; font-size: 0.78rem; }
.found .meta small { display: block; color: var(--text-muted); font-size: 0.66rem; }
 
/* ---------------- trigger sheet ---------------- */
.trigger-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
@media (min-width: 480px) { .trigger-grid { grid-template-columns: repeat(4, 1fr); } }
.tchip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 14px; border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.03); font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-align: center; transition: all 0.3s var(--ease); cursor: pointer; }
.tchip i { font-size: 1.15rem; color: var(--accent); }
.tchip.on { background: rgba(16, 185, 129, 0.16); border-color: var(--accent); color: var(--text); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35); }
.tchip.active-tab { border-color: var(--accent); background: rgba(16, 185, 129, 0.24); box-shadow: 0 0 14px rgba(16, 185, 129, 0.35); color: #fff; }
.tchip.unsupported { opacity: 0.45; }
.tchip .st { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.tchip.on .st { background: var(--success); box-shadow: 0 0 6px var(--success); }
.tchip.on.bad .st { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.tchip.on.warn .st { background: var(--warn); }
.tconf { border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: rgba(0, 0, 0, 0.18); animation: pop 0.25s var(--ease); }
.tconf h4 { font-size: 0.84rem; color: var(--accent); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.tconf h4 .badge { margin-left: auto; font-size: 0.62rem; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--text-muted); font-weight: 700; }
.tconf h4 .badge.ok { color: var(--success); } .tconf h4 .badge.bad { color: var(--danger); } .tconf h4 .badge.warn { color: var(--warn); }
 
/* mic meter */
.meter { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; position: relative; }
.meter .lvl { height: 100%; width: 0; background: linear-gradient(90deg, var(--success), var(--warn), var(--danger)); transition: width 0.05s linear; }
.meter .flr { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; opacity: 0.6; }
.clap-log { font-size: 0.68rem; line-height: 1.5; max-height: 92px; overflow-y: auto; background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 6px 8px; font-family: ui-monospace, Menlo, monospace; }
.clap-log .ok { color: var(--success); } .clap-log .no { color: var(--warn); }
.train-dots { display: flex; gap: 6px; }
.train-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--card-border); }
.train-dots span.done { background: var(--success); border-color: var(--success); }
.diy-pad { border: 2px dashed var(--accent); border-radius: 14px; padding: 22px; text-align: center; font-weight: 700; color: var(--accent); user-select: none; touch-action: none; }
.diy-pad.pressing { background: var(--primary); color: #fff; border-style: solid; }
.rule { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--card-border); border-radius: 10px; margin-bottom: 6px; font-size: 0.74rem; }
.days { display: flex; gap: 4px; }
.days button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--card-border); background: transparent; color: var(--text-muted); font-size: 0.64rem; font-weight: 700; }
.days button.on { background: var(--primary); color: #fff; border-color: transparent; }
 
/* room map */
.compass { position: relative; width: 240px; height: 240px; margin: 0 auto 10px; border-radius: 50%; border: 1px solid var(--card-border); background: radial-gradient(circle, rgba(255, 255, 255, 0.05), transparent 70%); }
.compass .ctr { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.1rem; box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
.compass .dirbtn { position: absolute; width: 54px; height: 54px; transform: translate(-50%, -50%); border-radius: 50%; border: 1px solid var(--card-border); background: var(--card-bg); font-size: 0.6rem; font-weight: 800; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.1; padding: 2px; overflow: hidden; }
.compass .dirbtn small { font-size: 0.52rem; font-weight: 600; color: var(--text); max-width: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compass .dirbtn.set { border-color: var(--accent); color: var(--accent); }
.compass .dirbtn.live { background: var(--primary); color: #fff; }
 
/* theme tiles */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-tile { border: 1px solid var(--card-border); border-radius: 12px; padding: 10px 8px; font-size: 0.72rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #fff; }
.theme-tile .swatch { width: 14px; height: 14px; border-radius: 50%; }
.theme-tile.on { outline: 2px solid var(--accent); }
 
/* diagnostics */
.diag { display: flex; flex-direction: column; gap: 6px; }
.diag div { font-size: 0.74rem; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--card-border); background: rgba(0, 0, 0, 0.2); display: flex; gap: 8px; }
.diag .error { border-color: rgba(239, 68, 68, 0.4); } .diag .warn { border-color: rgba(245, 158, 11, 0.4); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.74rem; }
.kv b { color: var(--text-muted); font-weight: 600; }
details { border: 1px solid var(--card-border); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 700; font-size: 0.82rem; color: var(--accent); }
details[open] summary { margin-bottom: 8px; }
 
/* toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 100; width: min(92vw, 420px); pointer-events: none; }
.toast { background: rgba(15, 23, 42, 0.95); color: #fff; border-left: 4px solid var(--info); padding: 10px 12px; border-radius: 10px; font-size: 0.78rem; box-shadow: var(--shadow); animation: slideUp 0.3s var(--ease); }
.toast.ok { border-left-color: var(--success); } .toast.warn { border-left-color: var(--warn); } .toast.error { border-left-color: var(--danger); }
 
/* install prompt */
.fab-install {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40;
  background: linear-gradient(135deg, #0284C7, #38BDF8);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  font-size: 0.86rem;
  display: none;
  gap: 10px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.fab-install:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.6);
}
.fab-install.show { display: inline-flex; }

/* ---------------- customer welcome guide (empty state) ---------------- */
.welcome-guide {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  margin-top: 14px;
}
.wstep {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: rgba(11, 19, 36, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  transition: all 0.2s ease;
}
.wstep:hover {
  background: rgba(18, 28, 48, 0.9);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}
.wnum {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284C7, #38BDF8);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  margin-top: 1px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}
.wstep b {
  font-size: 0.94rem;
  display: block;
  margin-bottom: 4px;
  color: #F8FAFC;
  font-weight: 700;
}
.wstep p {
  font-size: 0.8rem;
  color: #94A3B8;
  line-height: 1.5;
  margin-top: 3px;
}
.wstep code {
  background: rgba(56, 189, 248, 0.12);
  color: #38BDF8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.76rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.wpill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.74rem;
  color: #FDE68A;
  margin-top: 4px;
  font-weight: 600;
}

/* ---------------- provisioning guide (+ modal) ---------------- */
.provision-guide { display: flex; flex-direction: column; gap: 0; margin-bottom: 14px; border: 1px solid var(--card-border); border-radius: 16px; overflow: hidden; background: rgba(0,0,0,0.15); }
.pstep { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-bottom: 1px solid var(--card-border); transition: background 0.2s; }
.pstep:last-child { border-bottom: none; }
.pstep-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; background: rgba(52, 211, 153, 0.12); color: var(--accent); display: grid; place-items: center; font-size: 0.95rem; }
.pstep-body b { font-size: 0.82rem; display: block; margin-bottom: 5px; color: var(--text); }
.pstep-body p { font-size: 0.74rem; color: var(--text-muted); line-height: 1.45; }
.pstep-body code { background: rgba(52, 211, 153, 0.12); color: var(--accent); border-radius: 5px; padding: 1px 5px; font-size: 0.72rem; font-family: ui-monospace, Menlo, monospace; }
.pkey { display: inline-flex; align-items: center; gap: 6px; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: 8px; padding: 4px 9px; font-size: 0.73rem; color: #fde68a; margin: 5px 0; }
.scan-divider { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); padding: 10px 0 10px; letter-spacing: 0.3px; }
.manual-ip-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.manual-ip-row input { flex: 1; }
.manual-ip-row .btn { flex: none; white-space: nowrap; }

/* ---------------- master controls: quick scenes ---------------- */
.scenes-bar {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.scenes-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.3px;
}
.scenes-label i {
  color: var(--accent);
}
.scenes-btns {
  display: flex;
  gap: 8px;
}
.scene-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transition: all 0.2s ease;
}
.scene-btn:hover {
  transform: translateY(-1px);
}
.scene-btn.off:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.scene-btn.on:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* ---------------- family qr share modal ---------------- */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border-radius: 18px;
  margin: 12px auto 14px;
  width: fit-content;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.share-code-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.74rem;
  color: var(--accent);
  word-break: break-all;
  max-height: 80px;
  overflow-y: auto;
  margin: 8px 0 12px;
}

/* ---------------- consumer ota firmware update ---------------- */
.ota-box {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 12px;
}
.ota-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ota-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.ota-ver-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.ota-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  margin-bottom: 8px;
}
.ota-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}
.ota-notes {
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--accent);
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
  margin: 6px 0 10px;
}
.ota-progress-wrap {
  margin: 10px 0 6px;
}
.ota-progress-bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.ota-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.35s ease;
}
.ota-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ---------------- Left Slide-Out Sidebar ---------------- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.left-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 86%;
  max-width: 380px;
  background: var(--bg);
  border-right: 1px solid var(--card-border);
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  transform: translateX(-100%);
  transition: transform 0.35s var(--ease);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.left-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}
.home-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.btn-close-sidebar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  margin-top: 3px;
}
.role-badge.admin {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.role-badge.member {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.role-explainer {
  font-size: 0.76rem;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px;
}
.sidebar-card .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 800;
  color: #f4f4f5;
  margin-bottom: 4px;
}
.sidebar-card .card-title.between {
  justify-content: space-between;
}
.sidebar-card .card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 12px;
}

/* Duration selector pills */
.duration-pills {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.dur-pill {
  flex: 1;
  padding: 7px 4px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}
.dur-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* Switch selector list */
.switch-selector-list {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
}
.switch-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.switch-select-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Active guest rows */
.active-guest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
}
.btn-revoke {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  font-size: 0.68rem;
  font-weight: 700;
}

/* Family members list */
.family-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.family-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  font-size: 0.78rem;
}
.family-member-row.admin {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.25);
}
.member-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.member-info .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.member-info .avatar.admin {
  background: #f59e0b;
  color: #000;
}
.role-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fbbf24;
  display: block;
}
.btn-promote {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  font-size: 0.66rem;
  font-weight: 700;
}
.btn-demote {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.66rem;
}
.btn-remove {
  padding: 4px 7px;
  border-radius: 6px;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  font-size: 0.68rem;
}

/* Public switches */
.public-switch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pub-switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.76rem;
}
.btn-pub-toggle {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}
.btn-pub-toggle.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

/* Activity log */
.activity-log-box {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.log-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.74rem;
  padding: 5px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}
.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}
.log-dot.on {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.log-dot.off {
  background: var(--text-muted);
}
.log-content {
  display: flex;
  flex-direction: column;
}
.log-text {
  font-weight: 600;
  color: #f4f4f5;
}
.log-time {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.empty-log {
  text-align: center;
  padding: 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.btn-clear-log {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------------- Smart Scenes Hub ---------------- */
.smart-scenes-hub {
  grid-column: 1 / -1;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 12px 14px 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.hub-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 800;
  color: #f4f4f5;
  letter-spacing: 0.2px;
}
.hub-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
.hub-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.scene-fast-btn {
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.scene-fast-btn:active {
  transform: scale(0.95);
}
.scene-fast-btn.all-off:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.scene-fast-btn.all-on:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}
.scene-add-btn {
  padding: 5px 9px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Horizontal Scenes Carousel */
.scenes-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.scenes-carousel::-webkit-scrollbar {
  height: 4px;
}
.scenes-carousel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Individual Scene Card */
.scene-card {
  flex: 0 0 135px;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.scene-card:hover {
  transform: translateY(-2px);
  border-color: var(--scene-color, var(--primary));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.scene-card:active {
  transform: scale(0.96);
}
.scene-card.active {
  border-color: var(--scene-color, var(--primary));
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.4), inset 0 0 0 1px var(--scene-color, var(--primary));
}
.scene-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.scene-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.scene-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}
.scene-card:hover .scene-edit-btn {
  opacity: 1;
  color: #fff;
}
.scene-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scene-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f4f4f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-sub {
  font-size: 0.64rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-trigger-tag {
  margin-top: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Modal Hub: Opened from top-right icon button */
.scenes-hub-modal {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
}
.scenes-hub-top-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.scenes-hub-top-row .grow {
  flex: 1;
}
.scenes-grid-wrap {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.scenes-grid-wrap .scene-card {
  flex: none;
  width: 100%;
  min-height: 108px;
}
@media (max-width: 420px) {
  .scenes-grid-wrap {
    grid-template-columns: 1fr;
  }
}

/* Scene Editor Sheet Styling */
.scene-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.scene-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
.icon-pick-btn {
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
}
.icon-pick-btn i {
  font-size: 1rem;
}
.icon-pick-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.scene-color-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s;
}
.color-dot:active {
  transform: scale(0.9);
}
.color-dot.active {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

/* ========================================================
   eWeLink-Style Creative Smart Scene Builder
   ======================================================== */
.ewelink-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 2px 2px 14px;
}

.ewelink-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 6px;
}

.ewelink-back-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ewelink-back-btn:active {
  transform: scale(0.92);
}

.ewelink-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}
body.theme-light .ewelink-title {
  color: #0f172a;
}

.ewelink-save-link {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 8px;
}
.ewelink-save-link:active {
  opacity: 0.7;
}

/* Metadata Card */
.ewelink-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 2px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
body.theme-light .ewelink-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.ewelink-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.92rem;
}
.ewelink-row:last-child {
  border-bottom: none;
}

.ewelink-label {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
body.theme-light .ewelink-label {
  color: #1e293b;
}

input[type="text"].ewelink-value-input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 60%;
  padding: 0 !important;
}
input[type="text"].ewelink-value-input:focus {
  color: var(--accent);
}

.ewelink-value-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.ewelink-icon-preview {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Sections: IF and THEN */
.ewelink-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.ewelink-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.ewelink-sec-titles {
  display: flex;
  flex-direction: column;
}

.ewelink-sec-name {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
body.theme-light .ewelink-sec-name {
  color: #0f172a;
}

.ewelink-sec-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.ewelink-add-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  border: none;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}
.ewelink-add-action-btn:active {
  transform: scale(0.9);
}

/* Action & Trigger Item Cards */
.ewelink-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, background 0.2s;
  position: relative;
}
body.theme-light .ewelink-item-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.ewelink-del-item {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 1.35rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 2px;
  flex: none;
}
.ewelink-del-item:active {
  transform: scale(0.85);
}

.ewelink-dev-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex: none;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.ewelink-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  cursor: pointer;
}

.ewelink-item-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.theme-light .ewelink-item-title {
  color: #0f172a;
}

.ewelink-item-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ewelink-item-home {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
}
body.theme-light .ewelink-item-home {
  color: #94a3b8;
}

.ewelink-action-tag {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  white-space: nowrap;
  user-select: none;
  transition: transform 0.15s, background 0.15s;
}
.ewelink-action-tag:active {
  transform: scale(0.95);
}
.ewelink-action-tag.on {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border-color: #10b981;
}
.ewelink-action-tag.off {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border-color: #ef4444;
}
.ewelink-action-tag.toggle {
  background: rgba(14, 165, 233, 0.22);
  color: #38bdf8;
  border-color: #0ea5e9;
}

.ewelink-drag-handle {
  color: rgba(255, 255, 255, 0.3);
  font-size: 1.15rem;
  padding: 4px 6px;
  flex: none;
}
body.theme-light .ewelink-drag-handle {
  color: #cbd5e1;
}

.ewelink-empty-card {
  padding: 18px 14px;
  border-radius: 16px;
  border: 1px dashed var(--card-border);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}
.ewelink-empty-card:hover {
  border-color: var(--accent);
  color: var(--text);
}

.ewelink-advanced-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  cursor: pointer;
  margin-top: 4px;
}
body.theme-light .ewelink-advanced-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ewelink-badge-adv {
  background: rgba(14, 165, 233, 0.16);
  color: #38bdf8;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
body.theme-light .ewelink-badge-adv {
  background: #e0f2fe;
  color: #0369a1;
}

/* Delete Button */
.ewelink-del-btn {
  border: 1.5px solid #ef4444;
  background: transparent;
  color: #ef4444;
  border-radius: 999px;
  padding: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-top: 8px;
}
.ewelink-del-btn:active {
  background: rgba(239, 68, 68, 0.1);
  transform: scale(0.98);
}

/* Icon & Color Selector Tray */
.ewelink-tray {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px;
  margin-top: 10px;
  display: none;
  animation: pop 0.25s var(--ease);
}
.ewelink-tray.show {
  display: block;
}

/* Picker List for Triggers & Actions */
.ewelink-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 2px;
}

.ewelink-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.ewelink-pick-item:hover, .ewelink-pick-item:active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateY(-1px);
}
/* ---------------- mobile header responsive adjustments ---------------- */
@media (max-width: 480px) {
  header {
    padding: 6px 2px 12px;
    gap: 6px;
  }
  .brand {
    gap: 8px;
  }
  .brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .brand-logo-img {
    border-radius: 10px;
  }
  .brand-title {
    font-size: 0.95rem;
  }
  .brand small {
    font-size: 0.6rem;
    letter-spacing: 0.4px;
  }
  .header-actions {
    gap: 5px;
  }
  .icon-btn {
    width: 35px;
    height: 35px;
    font-size: 0.88rem;
  }
  .btn-auth {
    padding: 6px 9px;
    font-size: 0.74rem;
  }
}



