/* ============================================================
   SMART HOME DASHBOARD — SHARED STYLESHEET
   ============================================================ */

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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f3efe7;
  --bg-alt: #ece2d4;
  --surface: rgba(255, 250, 244, 0.78);
  --surface-strong: rgba(255, 248, 238, 0.94);
  --surface-soft: rgba(255, 245, 232, 0.75);
  --surface-contrast: #1f3038;
  --surface-contrast-2: #223842;
  --border: rgba(29, 38, 41, 0.10);
  --border-strong: rgba(29, 38, 41, 0.18);
  --text: #182126;
  --text-soft: #5d6c70;
  --muted: #718388;
  --accent: #0f8c84;
  --accent-2: #ef8552;
  --accent-dim: rgba(15, 140, 132, 0.12);
  --accent-glow: rgba(15, 140, 132, 0.18);
  --green: #2f9d66;
  --yellow: #c58a13;
  --red: #cf5a57;
  --orange: #de7a38;
  --shadow-lg: 0 24px 50px rgba(55, 45, 31, 0.12);
  --shadow-md: 0 18px 36px rgba(55, 45, 31, 0.08);
  --sidebar-w: 252px;
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --transition: 0.22s ease;
}

html { font-size: 15px; }

body {
  background:
    radial-gradient(circle at top left, rgba(239, 133, 82, 0.12), transparent 28%),
    radial-gradient(circle at 84% 10%, rgba(15, 140, 132, 0.12), transparent 24%),
    linear-gradient(180deg, #faf6ef 0%, var(--bg) 48%, var(--bg-alt) 100%);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-weight: 500;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -220px;
  left: -220px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(15, 140, 132, 0.11) 0%, transparent 68%);
}

body::after {
  right: -180px;
  bottom: -220px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(239, 133, 82, 0.12) 0%, transparent 70%);
}

body[data-theme="dark"] {
  --bg: #08131a;
  --bg-alt: #10202a;
  --surface: rgba(16, 28, 35, 0.86);
  --surface-strong: rgba(17, 29, 37, 0.96);
  --surface-soft: rgba(23, 38, 46, 0.85);
  --surface-contrast: #132028;
  --surface-contrast-2: #18303a;
  --border: rgba(235, 246, 245, 0.09);
  --border-strong: rgba(235, 246, 245, 0.16);
  --text: #edf6f4;
  --text-soft: #aac0c0;
  --muted: #6f878d;
  --accent: #42c6bb;
  --accent-2: #f2a36d;
  --accent-dim: rgba(66, 198, 187, 0.12);
  --accent-glow: rgba(66, 198, 187, 0.22);
  --green: #55d39f;
  --yellow: #f0bc4e;
  --red: #f17b76;
  --orange: #f39a5f;
  --shadow-lg: 0 28px 56px rgba(3, 8, 10, 0.36);
  --shadow-md: 0 20px 40px rgba(3, 8, 10, 0.24);
}

body[data-theme="dark"]::before {
  background: radial-gradient(circle, rgba(66, 198, 187, 0.12) 0%, transparent 70%);
}

body[data-theme="dark"]::after {
  background: radial-gradient(circle, rgba(242, 163, 109, 0.10) 0%, transparent 70%);
}

#sidebar,
#topbar,
.main-content {
  position: relative;
  z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  padding: 18px 14px 14px;
  background: rgba(255, 248, 238, 0.88);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition), background var(--transition);
  overflow-y: auto;
  backdrop-filter: blur(18px);
}

body[data-theme="dark"] #sidebar {
  background: rgba(17, 29, 37, 0.92);
}

#sidebar.collapsed { transform: translateX(-100%); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 14px 28px var(--accent-glow);
  font-size: 20px;
}

.sidebar-brand-text {
  font-family: 'Sora', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 12px 8px;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  flex: 1;
}

.sidebar-nav li { margin-bottom: 4px; }

.sidebar-nav .nav-item-parent > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 16px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  cursor: pointer;
}

.sidebar-nav .nav-item-parent > a:hover,
.sidebar-nav .nav-item-parent > a.open {
  background: var(--accent-dim);
  color: var(--text);
}

.sidebar-nav .nav-item-parent > a:hover { transform: translateX(2px); }

.nav-caret {
  margin-left: auto;
  font-size: 10px;
  transition: transform var(--transition);
}

.nav-item-parent > a.open .nav-caret { transform: rotate(180deg); }

.nav-submenu {
  list-style: none;
  padding: 2px 0 8px 18px;
  display: none;
}

.nav-submenu.open { display: block; }

.nav-submenu li a {
  display: block;
  padding: 9px 12px;
  border-radius: 14px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.nav-submenu li a:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-submenu li a.active {
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(239, 133, 82, 0.10) 100%);
  color: var(--text);
  border: 1px solid rgba(15, 140, 132, 0.2);
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.sidebar-user-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-user-name {
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
}

.sidebar-user-role {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.user-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-meta strong {
  color: var(--text);
  font-size: 14px;
}

.user-meta span {
  color: var(--muted);
  font-size: 12px;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-select-inline {
  min-width: 110px;
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 16px;
  background: transparent;
  border: none;
  color: var(--text-soft);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  text-decoration: none;
}

.sidebar-footer-btn:hover {
  background: var(--accent-dim);
  color: var(--text);
  transform: translateX(2px);
}

/* ============================================================
   TOPBAR
   ============================================================ */
#topbar {
  position: sticky;
  top: 0;
  margin-left: var(--sidebar-w);
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  background: rgba(255, 248, 238, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

body[data-theme="dark"] #topbar {
  background: rgba(17, 29, 37, 0.78);
}

#sidebarToggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 20px;
  cursor: pointer;
}

.topbar-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.topbar-spacer { flex: 1; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 24px 28px 34px;
  min-height: calc(100vh - 72px);
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.section-stack--tight { gap: 16px; }

/* ============================================================
   CARDS
   ============================================================ */
.card,
.graph-container {
  background: rgba(255, 248, 238, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  min-width: 0;
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .graph-container {
  background: rgba(17, 29, 37, 0.86);
}

.card-header,
.graph-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.card-header-accent {
  color: var(--accent);
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

/* ============================================================
   VALUE BOXES
   ============================================================ */
.value-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  gap: 16px;
}

.value-box + .value-box { margin-top: 10px; }

.vb-label {
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vb-value {
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  text-align: right;
}

canvas { width: 100% !important; height: 220px !important; }

/* ============================================================
   FORM INPUTS
   ============================================================ */
.sh-input,
.sh-select {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  min-width: 0;
}

.sh-input:focus,
.sh-select:focus {
  border-color: rgba(15, 140, 132, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 140, 132, 0.12);
}

.sh-input[type="color"] {
  padding: 3px 6px;
  height: 38px;
  width: 54px;
  cursor: pointer;
}

.sh-input--xs { width: 100px; }
.sh-input--sm { width: 120px; }
.sh-input--md { width: 150px; }

.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-soft);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

input:checked + .slider {
  background: rgba(15, 140, 132, 0.75);
  border-color: rgba(15, 140, 132, 0.75);
}

input:checked + .slider::before {
  transform: translateX(22px);
  background: #fff;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 800;
  min-height: 42px;
  padding: 0 18px;
  transition: transform var(--transition), opacity var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff8f2;
  box-shadow: 0 16px 28px var(--accent-glow);
}

.btn-primary:hover { opacity: 0.95; }

.btn-secondary {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
}

.btn-secondary:hover {
  color: var(--text);
  background: rgba(15, 140, 132, 0.08);
}

.btn-danger {
  background: rgba(207, 90, 87, 0.12);
  border: 1px solid rgba(207, 90, 87, 0.24);
  color: var(--red);
}

.btn-danger:hover { background: rgba(207, 90, 87, 0.18); }

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge-green  { background: rgba(47, 157, 102, 0.12); color: var(--green);  border: 1px solid rgba(47, 157, 102, 0.2); }
.badge-yellow { background: rgba(197, 138, 19, 0.12); color: var(--yellow); border: 1px solid rgba(197, 138, 19, 0.2); }
.badge-red    { background: rgba(207, 90, 87, 0.12); color: var(--red);    border: 1px solid rgba(207, 90, 87, 0.2); }
.badge-blue   { background: var(--accent-dim);       color: var(--accent);  border: 1px solid rgba(15, 140, 132, 0.18); }

/* ============================================================
   MAPS
   ============================================================ */
.map-wrap {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.map-wrap .leaflet-container,
#map {
  height: 320px;
  width: 100%;
}

body[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.84) contrast(0.92) saturate(0.7);
}

.location-card-footer {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

/* ============================================================
   HOURLY FORECAST STRIP
   ============================================================ */
.hourly-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding-bottom: 8px;
}

.hourly-strip::-webkit-scrollbar {
  height: 8px;
}

.hourly-strip::-webkit-scrollbar-thumb {
  background: rgba(15, 140, 132, 0.28);
  border-radius: 999px;
}

.hourly-item {
  flex: 0 0 calc((100% - 50px) / 6);
  min-width: 96px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 10px;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.hourly-item:hover {
  border-color: rgba(15, 140, 132, 0.3);
  transform: translateY(-2px);
}

.hourly-item.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.hi-time {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hi-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.hi-temp {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.hi-rain {
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
  font-weight: 700;
}

/* ============================================================
   WEEKLY FORECAST
   ============================================================ */
.forecast-row {
  display: flex;
  align-items: center;
  padding: 13px 12px;
  border-radius: 18px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  border: 1px solid transparent;
  gap: 12px;
}

.forecast-row + .forecast-row { margin-top: 8px; }

.forecast-row:hover {
  background: var(--surface-soft);
  border-color: var(--border);
  transform: translateX(2px);
}

.fr-day {
  width: 44px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-soft);
}

.fr-icon {
  font-size: 22px;
  width: 30px;
  text-align: center;
}

.fr-desc {
  font-size: 13px;
  color: var(--text-soft);
  flex: 1;
}

.fr-rain {
  font-size: 11px;
  color: var(--accent);
  font-weight: 800;
}

.fr-temps {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.fr-lo {
  color: var(--muted);
  font-weight: 600;
}

/* ============================================================
   SECTION GRID LAYOUTS
   ============================================================ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.sidebar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.sidebar-layout > * {
  min-width: 0;
}

/* ============================================================
   WEATHER HERO
   ============================================================ */
.weather-hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: 30px;
  background: linear-gradient(140deg, var(--surface-contrast) 0%, var(--surface-contrast-2) 52%, rgba(15, 140, 132, 0.72) 100%);
  color: #f9f5ee;
  box-shadow: var(--shadow-lg);
}

.inside-hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(31, 48, 56, 0.95) 0%, rgba(34, 56, 66, 0.96) 54%, rgba(239, 133, 82, 0.86) 100%);
  color: #f9f5ee;
  box-shadow: var(--shadow-lg);
}

.inside-hero::after {
  content: '';
  position: absolute;
  inset: auto -70px -80px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 72%);
  pointer-events: none;
}

.inside-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.inside-hero-copy {
  min-width: 0;
}

.inside-hero-title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.inside-hero-glyph {
  display: grid;
  place-items: center;
  min-width: 128px;
  min-height: 128px;
  padding: 16px;
  border-radius: 28px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 64px;
  line-height: 1;
}

.hero-metrics--inside {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-stat--inside {
  background: rgba(255,255,255,0.09);
}

.inside-hero-badge {
  position: relative;
  z-index: 1;
  margin-top: 16px;
}

.device-details-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13px;
}

.device-details-title {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.device-details-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.device-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.device-detail-label {
  color: var(--text-soft);
  font-weight: 700;
}

.device-detail-value {
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.weather-hero::after {
  content: '';
  position: absolute;
  top: -100px;
  right: -80px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 72%);
  pointer-events: none;
}

.weather-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  min-width: 0;
}

.weather-hero-copy {
  max-width: 560px;
  min-width: 0;
}

.wh-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(249, 245, 238, 0.78);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.wh-location {
  font-size: 14px;
  color: rgba(249, 245, 238, 0.78);
  margin-bottom: 8px;
}

.wh-temp {
  font-family: 'Sora', sans-serif;
  font-size: clamp(3.8rem, 8vw, 5.8rem);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.92;
}

.wh-feels {
  font-size: 14px;
  color: rgba(249, 245, 238, 0.76);
  margin-top: 10px;
}

.wh-desc {
  font-size: 18px;
  font-weight: 700;
  color: #fff4d6;
  margin-top: 10px;
}

.wh-emoji-wrap {
  display: grid;
  place-items: center;
  min-width: 128px;
  min-height: 128px;
  padding: 16px;
  border-radius: 28px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(14px);
}

.wh-emoji {
  font-size: 78px;
  line-height: 1;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.18));
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}

.hero-stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
}

.hero-stat-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(249, 245, 238, 0.66);
  margin-bottom: 6px;
  font-weight: 800;
}

.hero-stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.panel-note {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.settings-shell {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-shell--narrow {
  max-width: 580px;
}

.settings-grid {
  display: grid;
  gap: 20px;
}

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

.settings-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-actions--top {
  margin-bottom: 12px;
}

.settings-submit {
  align-self: flex-start;
}

.settings-emphasis {
  color: var(--accent);
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 520px);
  padding: 28px;
  border-radius: 30px;
  background: rgba(255, 248, 238, 0.86);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

body[data-theme="dark"] .login-card {
  background: rgba(17, 29, 37, 0.9);
}

.login-header {
  margin-bottom: 18px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.login-input {
  width: 100%;
}

.login-submit {
  margin-top: 10px;
  width: 100%;
}

.login-error {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(207, 90, 87, 0.12);
  border: 1px solid rgba(207, 90, 87, 0.24);
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.security-success {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(47, 157, 102, 0.12);
  border: 1px solid rgba(47, 157, 102, 0.24);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.login-help {
  margin-top: 16px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 400;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(24, 33, 38, 0.92);
  color: #f6f5f0;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 16px 32px rgba(5, 10, 12, 0.24);
  font-size: 13px;
  line-height: 1.6;
}

.toast--success { border-left: 4px solid var(--green); }
.toast--error { border-left: 4px solid var(--red); }
.toast--info { border-left: 4px solid var(--accent); }

/* ============================================================
   INDOOR TILES
   ============================================================ */
.indoor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.indoor-tile {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  transition: border-color var(--transition), transform var(--transition);
}

.indoor-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.it-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
  font-weight: 800;
}

.it-value {
  font-family: 'Sora', sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.it-unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  margin-left: 4px;
}

.it-full { grid-column: 1 / -1; }

/* ============================================================
   DATE FILTER
   ============================================================ */
.date-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.df-group { display: flex; flex-direction: column; gap: 5px; }
.df-group label { font-size: 12px; color: var(--text-soft); }

/* ============================================================
   SETTINGS FORM
   ============================================================ */
.settings-section { margin-bottom: 28px; }

.settings-section-title {
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.card .settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  gap: 12px;
  background: transparent;
  box-shadow: none;
}

.card .settings-row + .settings-row {
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 0;
  gap: 12px;
}

.settings-row:first-of-type { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.settings-row + .settings-row { border-top: none; }
.settings-row:last-of-type { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.settings-row:only-of-type { border-radius: var(--radius-sm); }

.sr-label { font-size: 14px; color: var(--text-soft); font-weight: 700; }
.sr-right { display: flex; align-items: center; gap: 10px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim { animation: fadeUp 0.45s ease both; }
.anim-1 { animation-delay: 0.05s; }
.anim-2 { animation-delay: 0.10s; }
.anim-3 { animation-delay: 0.15s; }
.anim-4 { animation-delay: 0.20s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .sidebar-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
  .settings-grid--two { grid-template-columns: 1fr; }
  .weather-hero-inner { flex-direction: column; }
  .inside-hero-inner { flex-direction: column; }
  .hero-metrics { grid-template-columns: 1fr; }
  .hourly-item { flex-basis: calc((100% - 30px) / 4); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  #sidebar {
    width: 240px;
    transform: translateX(-100%);
  }

  #sidebar.open { transform: translateX(0); }

  #sidebarToggle { display: inline-grid !important; place-items: center; }

  #topbar {
    margin-left: 0;
    padding: 12px 16px;
  }

  .main-content {
    margin-left: 0;
    padding: 18px 16px 28px;
  }

  .weather-hero {
    padding: 22px;
  }

  .wh-emoji-wrap {
    min-width: 100px;
    min-height: 100px;
  }

  .wh-emoji { font-size: 58px; }
}

@media (max-width: 560px) {
  .indoor-grid,
  .three-col,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .hourly-item { flex-basis: calc((100% - 10px) / 2); }

  .date-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .card,
  .graph-container,
  .weather-hero,
  .inside-hero {
    padding: 20px;
  }

  .value-box,
  .settings-row,
  .device-detail-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .vb-value {
    text-align: left;
  }

  .device-detail-value {
    text-align: left;
  }

}

/* ============================================================
   UTILITY
   ============================================================ */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-title { font-family: 'Sora', sans-serif; }
.w-full { width: 100%; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 14, 0.32);
  backdrop-filter: blur(4px);
  z-index: 190;
}

#sidebarOverlay.visible { display: block; }
