/* ============================================================
   Smart Home Dashboard – Laravel Blade CSS
   Adapté du template Next.js Smart Home Dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- Variables de thème (mode clair) ---- */
:root {
  --background: #ffffff;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #1e293b;
  --primary-foreground: #f8fafc;
  --secondary: #f1f5f9;
  --secondary-foreground: #1e293b;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #1e293b;
  --destructive: #ef4444;
  --destructive-foreground: #ef4444;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #94a3b8;
  --radius: 0.625rem;
  --sidebar-bg: #f8fafc;
  --sidebar-foreground: #0f172a;

  /* Brand colors */
  --brand: #7c3aed;
  --brand-2: #5b21b6;
  --brand-light: rgba(124, 58, 237, 0.1);

  /* Charts */
  --chart-1: #f97316;
  --chart-2: #06b6d4;
  --chart-3: #3b82f6;
  --chart-4: #eab308;
  --chart-5: #84cc16;

  /* Sidebar gradient */
  --sidebar-gradient-from: var(--brand);
  --sidebar-gradient-to: var(--brand-2);
}

/* ---- Variables de thème (mode sombre) ---- */
.dark {
  --background: #0f172a;
  --foreground: #f8fafc;
  --card: #1e293b;
  --card-foreground: #f8fafc;
  --popover: #1e293b;
  --popover-foreground: #f8fafc;
  --primary: #f8fafc;
  --primary-foreground: #1e293b;
  --secondary: #334155;
  --secondary-foreground: #f8fafc;
  --muted: #334155;
  --muted-foreground: #94a3b8;
  --accent: #334155;
  --accent-foreground: #f8fafc;
  --destructive: #7f1d1d;
  --destructive-foreground: #f87171;
  --border: #334155;
  --input: #334155;
  --ring: #475569;
  --sidebar-bg: #1e293b;
  --brand-light: rgba(124, 58, 237, 0.2);
}

/* ---- Presets de couleur de marque ---- */
[data-brand="purple"] { --brand: #7c3aed; --brand-2: #5b21b6; }
[data-brand="blue"]   { --brand: #2563eb; --brand-2: #1d4ed8; }
[data-brand="teal"]   { --brand: #0d9488; --brand-2: #0f766e; }
[data-brand="orange"] { --brand: #ea580c; --brand-2: #c2410c; }
[data-brand="pink"]   { --brand: #db2777; --brand-2: #be185d; }

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: var(--border);
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.dashboard-wrapper {
  background-color: var(--background);
  min-height: 100vh;
}

.dashboard-outer {
  margin: 0 auto;
  padding: 0.75rem;
}

@media (min-width: 640px) {
  .dashboard-outer {
    padding: 1.5rem;
  }
}

.dashboard-card-wrap {
  border-radius: 1.5rem;
  background-color: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  background: linear-gradient(to bottom, var(--brand), var(--brand-2));
  color: #ffffff;
  border-radius: 1.5rem 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.3s ease;
  width: 13rem; /* 208px */
  flex-shrink: 0;
}

.sidebar.collapsed { width: 5rem; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
}

.sidebar-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s, width 0.3s;
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 0.5rem;
  padding: 0.375rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.sidebar-toggle:hover { background: rgba(255,255,255,0.3); }

.sidebar-nav { margin-top: 0.5rem; flex: 1; }

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.75rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  color: rgba(255,255,255,0.9);
  transition: background 0.2s;
  font-size: 0.875rem;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.1); }

.sidebar-nav a.active {
  background: #ffffff;
  color: var(--brand);
}

.sidebar-nav a.active svg { color: var(--brand); }

.sidebar-nav a span {
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s, width 0.3s;
}

.sidebar.collapsed .sidebar-nav a span {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar-nav svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.sidebar-tip {
  padding: 0 0.75rem 1.25rem;
}

.sidebar-tip-inner {
  background: rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(var(--background-rgb, 255,255,255), 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  border-radius: 0.75rem;
}

@media (min-width: 1024px) {
  .topbar {
    margin-left: -1.75rem;
    margin-right: -1.75rem;
    border-radius: 0;
  }
}

.topbar-inner {
  height: 4rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .topbar-inner { padding: 0 1.75rem; }
}

.menu-btn {
  background: none;
  border: none;
  border-radius: 9999px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  color: var(--foreground);
}

.menu-btn:hover { background: var(--muted); }

@media (min-width: 1024px) { .menu-btn { display: none; } }

.topbar-search {
  flex: 1;
  max-width: 28rem;
}

.topbar-search label { position: relative; display: block; }

.topbar-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
}

.topbar-search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-btn {
  background: none;
  border: none;
  border-radius: 9999px;
  padding: 0.5rem;
  color: var(--foreground);
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-btn:hover { background: var(--muted); }

.topbar-btn svg { width: 1.25rem; height: 1.25rem; }

.notif-badge {
  position: absolute;
  right: 0.25rem;
  top: 0.25rem;
  background: #ef4444;
  color: #fff;
  border-radius: 9999px;
  font-size: 0.625rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-btn {
  background: none;
  border: none;
  border-radius: 9999px;
  padding: 0.375rem;
  cursor: pointer;
}

.avatar-btn:hover { background: var(--muted); }

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Dropdown */
.dropdown { position: relative; }

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  min-width: 14rem;
  padding: 0.5rem;
  z-index: 50;
}

.dropdown:hover .dropdown-content,
.dropdown.open .dropdown-content { display: block; }

.dropdown-label {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.dropdown-sep { height: 1px; background: var(--border); margin: 0.25rem 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--muted); }

.dropdown-item.destructive { color: var(--destructive); }

/* ============================================================
   LAYOUT DASHBOARD (FLEX)
   ============================================================ */

.dash-flex {
  display: flex;
  height: 95vh;
}

.dash-main {
  flex: 1;
  min-width: 0;
  border-radius: 0 1.5rem 1.5rem 0;
  background: var(--muted);
  padding: 0.75rem;
  overflow-y: auto;
}

@media (min-width: 640px) { .dash-main { padding: 1.25rem; } }
@media (min-width: 768px) { .dash-main { padding: 1.75rem; } }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

.sidebar-overlay.active { display: block; }

/* Mobile: sidebar hors-écran */
.sidebar-mobile-wrap {
  position: fixed;
  inset-y: 0;
  left: 0;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.sidebar-mobile-wrap.open { transform: translateX(0); }

@media (min-width: 1024px) {
  .sidebar-mobile-wrap {
    position: relative;
    transform: none;
    z-index: auto;
  }
}

/* ============================================================
   COMPOSANTS CARDS
   ============================================================ */

.card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  padding: 1.25rem;
}

.card-sm { padding: 1rem; }
.card-lg { padding: 1.5rem; border-radius: 1.5rem; }

/* ---- Welcome Card ---- */
.welcome-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  padding: 1.5rem;
  color: #ffffff;
}

.welcome-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .welcome-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.welcome-text { max-width: 36rem; }

@media (min-width: 768px) { .welcome-text { width: 60%; } }

.welcome-text h1 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.welcome-text p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255,255,255,.9);
}

.welcome-temp {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 1rem;
  background: rgba(255,255,255,.1);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.welcome-temp-value { font-size: 1.5rem; font-weight: 700; }

.welcome-image {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  height: 16rem;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .welcome-image { width: 40%; height: auto; min-height: 15rem; }
}

.welcome-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem;
  opacity: 0.9;
}

.welcome-blur {
  position: absolute;
  right: -2.5rem;
  top: -2.5rem;
  width: 10rem;
  height: 10rem;
  border-radius: 9999px;
  background: rgba(255,255,255,.1);
  filter: blur(2rem);
  pointer-events: none;
}

/* ---- Grid utilitaires ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-title { font-size: 0.875rem; font-weight: 600; }
.section-sub { font-size: 0.625rem; color: var(--muted-foreground); }

/* ---- Room Card ---- */
.room-card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.room-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.room-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  background: var(--brand);
  display: grid;
  place-items: center;
  color: #fff;
}

.room-icon svg { width: 1rem; height: 1rem; }

.room-title { font-size: 0.875rem; font-weight: 600; }

.room-label { font-size: 0.75rem; color: var(--muted-foreground); }

.room-link { margin-top: 0.75rem; font-size: 0.75rem; color: var(--brand); cursor: pointer; }

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--muted);
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-switch input:checked + .toggle-track { background: var(--brand); }

.toggle-thumb {
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: #fff;
  transition: transform 0.2s;
  pointer-events: none;
}

.toggle-switch input:checked ~ .toggle-thumb { transform: translateX(1.125rem); }

/* ---- Device Card ---- */
.device-card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.device-title { font-size: 0.75rem; font-weight: 600; }
.device-status { font-size: 0.625rem; color: var(--muted-foreground); }

.device-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-body svg { width: 1.5rem; height: 1.5rem; color: var(--brand); }

/* ---- Air Conditioning ---- */
.ac-bar-wrap {
  position: relative;
  margin-top: 1rem;
  height: 6rem;
  width: 0.5rem;
  border-radius: 9999px;
  background: var(--muted);
}

.ac-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0.5rem;
  border-radius: 9999px;
  background: var(--brand);
  transition: height 0.4s ease;
}

/* ---- Scene Card ---- */
.scene-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  cursor: pointer;
  transition: background 0.2s;
}

.scene-card:hover { background: var(--muted); }

.scene-card svg { width: 1.5rem; height: 1.5rem; color: var(--brand); }

.scene-title { font-size: 0.875rem; font-weight: 600; }
.scene-sub { font-size: 0.75rem; color: var(--muted-foreground); }

/* ---- Shortcut Tile ---- */
.shortcut-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  cursor: pointer;
  transition: background 0.2s;
}

.shortcut-tile:hover { background: var(--muted); }

.shortcut-tile svg { width: 1.5rem; height: 1.5rem; color: var(--brand); }

.shortcut-label { font-size: 0.75rem; color: var(--muted-foreground); }

/* ---- Users Widget ---- */
.user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid rgba(124,58,237,.2);
}

.user-add {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Energy Widget ---- */
.energy-section {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .energy-section { grid-template-columns: 1fr 1fr; }
}

.gauge-svg { width: 14rem; height: 14rem; }

/* SVG gauge track & fill */
.gauge-track { stroke: var(--muted); }
.gauge-fill  { stroke: var(--brand); transition: stroke-dashoffset 0.4s; }
.gauge-text  { fill: var(--foreground); font-size: 1.875rem; font-weight: 600; font-family: 'Inter', sans-serif; }

/* Range themed */
.themed-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.625rem;
  border-radius: 9999px;
  background: var(--muted);
  accent-color: var(--brand);
  outline: none;
}

.themed-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: -0.25rem;
  border-radius: 9999px;
  background: var(--background);
  border: 2px solid var(--brand);
}

/* Mini bar chart (pure CSS fallback) */
.bar-chart-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 7rem;
  padding: 0.5rem 0;
}

.bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.bar-fill {
  width: 100%;
  border-radius: 0.375rem 0.375rem 0 0;
  background: var(--muted-foreground);
  opacity: 0.5;
}

.bar-fill.active { background: var(--brand); opacity: 1; }

.bar-label { font-size: 0.625rem; color: var(--muted-foreground); }

/* Energy action buttons */
.energy-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.energy-btn {
  border-radius: 0.75rem;
  background: var(--muted);
  border: none;
  padding: 0.5rem;
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.2s;
}

.energy-btn:hover { background: var(--border); }
.energy-btn.primary { background: var(--brand); color: #fff; }
.energy-btn.primary:hover { opacity: 0.9; }

/* ---- Light Panels ---- */
.light-panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

@media (max-width: 640px) {
  .light-panel-grid { grid-template-columns: 1fr; }
}

.color-wheel {
  width: 10rem;
  height: 10rem;
  border-radius: 9999px;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  box-shadow: inset 0 0 0 0.625rem var(--background);
  margin: 0 auto;
}

/* Radial gauge SVG (simple) */
.radial-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.radial-gauge { position: relative; }

.radial-gauge svg { width: 11rem; height: 11rem; }

/* ---- Consumption Chart ---- */
.consumption-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  height: 16rem;
  padding: 0.5rem 0;
}

.consumption-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.consumption-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 10rem;
}

.consumption-bar {
  width: 0.5rem;
  border-radius: 0.25rem 0.25rem 0 0;
  min-height: 4px;
}

.consumption-month-label { font-size: 0.625rem; color: var(--muted-foreground); margin-top: 0.25rem; }

/* Legend */
.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.legend-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
}

/* ============================================================
   PAGES INTERNES
   ============================================================ */

/* Messages */
.page-header h1 { font-size: 1.5rem; font-weight: 600; }
.page-header p { margin-top: 0.5rem; color: var(--muted-foreground); }

.thread-list { margin-top: 1.5rem; border-top: 1px solid var(--border); }

.thread-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.thread-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 600;
  flex-shrink: 0;
}

.thread-meta { flex: 1; min-width: 0; }

.thread-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.thread-name { font-weight: 500; }
.thread-time { font-size: 0.75rem; color: var(--muted-foreground); }
.thread-preview { font-size: 0.875rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  background: var(--brand-light);
  color: var(--brand);
  flex-shrink: 0;
}

/* Profile */
.profile-grid { display: grid; gap: 1.5rem; margin-top: 1.5rem; }

@media (min-width: 768px) { .profile-grid { grid-template-columns: repeat(3, 1fr); } }

.profile-card {
  background: var(--background);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  padding: 1rem;
}

.profile-avatar-wrap { display: flex; align-items: center; gap: 0.75rem; }

.profile-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 1.125rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.pref-label { font-size: 0.875rem; }

.shortcut-tags { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

.shortcut-tag {
  border-radius: 0.5rem;
  background: var(--brand-light);
  color: var(--brand);
  padding: 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

/* Devices */
.devices-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }

@media (min-width: 640px) { .devices-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .devices-grid { grid-template-columns: repeat(3, 1fr); } }

.device-item {
  background: var(--background);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  padding: 1rem;
}

.device-item-inner { display: flex; align-items: center; justify-content: space-between; }
.device-item-meta { display: flex; align-items: center; gap: 0.75rem; }
.device-item-name { font-weight: 500; }
.device-item-room { font-size: 0.75rem; color: var(--muted-foreground); }

/* Security */
.security-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }

@media (min-width: 640px) { .security-grid { grid-template-columns: repeat(3, 1fr); } }

.security-item {
  background: var(--background);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  padding: 1rem;
}

.security-item-header { display: flex; align-items: center; justify-content: space-between; }
.security-item-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.security-item-label svg { width: 1.25rem; height: 1.25rem; color: var(--brand); }
.security-item-desc { margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }

.activity-list { list-style: none; }

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

/* Statistics */
.stats-chart-wrap {
  margin-top: 1.5rem;
  border-radius: 0.75rem;
  background: var(--background);
  border: 1px solid var(--border);
  padding: 1rem;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */

.auth-page {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.auth-card h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.auth-card p { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 1.5rem; }

.form-group { display: grid; gap: 0.5rem; margin-bottom: 1rem; }

.form-label { font-size: 0.875rem; color: var(--muted-foreground); }

.form-input {
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--background);
  border: 1px solid var(--border);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.btn-brand {
  width: 100%;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--brand);
  color: #fff;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-brand:hover { opacity: 0.9; }

.auth-link { font-size: 0.875rem; color: var(--muted-foreground); margin-top: 1rem; display: block; }
.auth-link a { color: var(--brand); }

/* ============================================================
   THEME TOGGLE & COLOR PICKER
   ============================================================ */

.theme-toggle-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background: none;
  color: var(--foreground);
  cursor: pointer;
}

.color-picker-label { font-size: 0.75rem; color: var(--muted-foreground); margin-bottom: 0.5rem; }

.color-picker-row { display: flex; align-items: center; gap: 0.5rem; }

.color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  outline: 2px solid transparent;
  transition: outline-color 0.2s;
}

.color-swatch.active { outline-color: var(--ring); outline-offset: 2px; }

/* ============================================================
   SIDEBAR MOBILE TOGGLE ICON
   ============================================================ */

.chevron-icon { width: 1.25rem; height: 1.25rem; }

/* ============================================================
   UTILITY
   ============================================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }

.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 0.75rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.text-brand { color: var(--brand); }
.text-muted { color: var(--muted-foreground); }
.text-white { color: #ffffff; }
.text-foreground { color: var(--foreground); }

.bg-brand { background: var(--brand); }
.bg-muted { background: var(--muted); }
.bg-card { background: var(--card); }

.rounded-full { border-radius: 9999px; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.copyright {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding-top: 0.5rem;
}

.copyright a { color: var(--brand); }
