html {
  overflow-x: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  color: white;
  text-align: center;
  background: linear-gradient(-45deg, #0f172a, #064e3b, #1e293b, #020617);
  background-size: 400% 400%;
  animation: bgMove 12s ease infinite;
  overflow-x: hidden;
}

body.menu-open { overflow: hidden; }

html[data-theme="light"] body {
  color: #0f172a;
  background: linear-gradient(-45deg, #f8fafc, #dcfce7, #e0f2fe, #ffffff);
  background-size: 400% 400%;
}

@keyframes bgMove {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.page-title {
  padding: 14px 12px 6px;
  margin: 0;
}

/* ══════════════════════════════════
   NAVBAR
══════════════════════════════════ */
.nav-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(2,6,23,0.72);
  z-index: 998;
  display: none;
  backdrop-filter: blur(8px);
}
.nav-backdrop.active { display: block; }

html[data-theme="light"] .nav-backdrop {
  background: rgba(15,23,42,0.16);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(6,78,59,0.88), rgba(15,23,42,0.92)),
    rgba(0,0,0,0.78);
  padding: 14px 24px;
  border-bottom: 1px solid rgba(148,255,209,0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.32);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(34,197,94,0), rgba(110,255,196,0.55), rgba(34,197,94,0));
  pointer-events: none;
}

.logo {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #dffef0;
  text-shadow: 0 0 18px rgba(34,197,94,0.18);
}

.nav-links {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  gap: 10px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.3s, background-color 0.3s, transform 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: #0f172a;
  background: linear-gradient(135deg, #86efac, #5eead4);
  transform: translateY(-1px);
  outline: none;
}

.nav-links a.current {
  color: #0f172a;
  background: linear-gradient(135deg, #86efac, #5eead4);
}

.hamburger {
  display: none;
  font-size: 24px;
  color: #dffef0;
  cursor: pointer;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 10px;
  line-height: 1;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.3s;
}

.hamburger:hover,
.hamburger:focus-visible {
  background: rgba(110,255,196,0.14);
  border-color: rgba(110,255,196,0.38);
  color: #ffffff;
  transform: translateY(-1px);
  outline: none;
}

html[data-theme="light"] .navbar {
  background:
    linear-gradient(135deg, rgba(236,253,245,0.94), rgba(224,242,254,0.96)),
    rgba(255,255,255,0.9);
  border-bottom-color: rgba(15,23,42,0.08);
  box-shadow: 0 10px 24px rgba(15,23,42,0.12);
}

html[data-theme="light"] .navbar::after {
  background: linear-gradient(90deg, rgba(15,118,110,0), rgba(15,118,110,0.35), rgba(15,118,110,0));
}

html[data-theme="light"] .logo {
  color: #0f766e;
  text-shadow: none;
}

html[data-theme="light"] .nav-links a {
  color: #0f172a;
  background: rgba(255,255,255,0.76);
  border-color: rgba(15,23,42,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

html[data-theme="light"] .nav-links a:hover,
html[data-theme="light"] .nav-links a:focus-visible,
html[data-theme="light"] .nav-links a.current {
  color: #064e3b;
  background: linear-gradient(135deg, #bbf7d0, #99f6e4);
}

html[data-theme="light"] .hamburger {
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.1);
  color: #0f766e;
}

html[data-theme="light"] .hamburger:hover,
html[data-theme="light"] .hamburger:focus-visible {
  background: rgba(16,185,129,0.14);
  color: #064e3b;
}

/* ══════════════════════════════════
   SENSOR CARDS
══════════════════════════════════ */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
}

.sensor-card {
  position: relative;
  padding: 20px;
  border-radius: 15px;
  color: white;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 0 0 1px rgba(0,255,100,0.15),
    0 0 18px rgba(0,255,100,0.15),
    0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.3s, box-shadow 0.3s;
  overflow: visible;
}

.sensor-card::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 17px;
  background: linear-gradient(45deg,
    #ff0000, #ff7300, #fffb00,
    #48ff00, #00ffd5, #002bff,
    #7a00ff, #ff00c8, #ff0000);
  background-size: 400%;
  animation: rgbGlow 10s linear infinite;
  z-index: -1;
}

.sensor-card > * { position: relative; z-index: 1; }

@keyframes rgbGlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.sensor-card:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 0 30px rgba(0,255,157,0.5), 0 8px 30px rgba(0,0,0,0.6);
}

.sensor-label {
  display: block;
  font-size: 15px;
  color: #d1d5db;
}

.sensor-card h2 {
  font-size: 28px;
  margin-top: 10px;
  margin-bottom: 0;
}

/* ══════════════════════════════════
   FAN BOX
══════════════════════════════════ */
.fan-box {
  background: rgba(30,41,59,0.8);
  padding: 30px;
  border-radius: 15px;
  width: min(90%, 360px);
  margin: 30px auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

.fan-icon {
  font-size: 70px;
  margin: 20px;
  display: inline-block;
  transform-origin: center;
  transition: color 0.3s ease, filter 0.3s ease;
}

.fan-on  {
  color: #22c55e;
  filter: drop-shadow(0 0 14px rgba(34,197,94,0.55));
}
.fan-off {
  color: #ef4444;
  filter: drop-shadow(0 0 12px rgba(239,68,68,0.4));
}

.rotate-center-normal {
  animation: rotate-center-normal 0.6s cubic-bezier(0.645, 0.045, 0.355, 1.000) 0s 1 normal both;
}

@keyframes rotate-center-normal {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinFan {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s, filter 0.3s, border-color 0.3s;
  min-height: 44px;
}

.fan-control-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 10px 22px rgba(15,23,42,0.28);
}

.scale-down-center-normal {
  animation: scale-down-center-normal 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) 0s 1 normal both;
}

@keyframes scale-down-center-normal {
  0% { transform: scale(1); }
  40% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.btn-on   { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.btn-off  { background: linear-gradient(135deg, #ef4444, #b91c1c); color: white; }
.btn-auto { background: linear-gradient(135deg, #22c55e 0%, #84cc16 35%, #f97316 68%, #ef4444 100%); color: white; }
.btn:hover { transform: scale(1.06); }

.fan-btn-active {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.22);
}

.fan-btn-active-on {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 0 0 1px rgba(34,197,94,0.35),
    0 0 22px rgba(34,197,94,0.6);
  filter: brightness(1.08);
}

.fan-btn-active-off {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 0 0 1px rgba(239,68,68,0.35),
    0 0 22px rgba(239,68,68,0.55);
  filter: brightness(1.08);
}

.fan-btn-active-auto {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 0 0 1px rgba(255,255,255,0.18),
    -10px 0 24px rgba(34,197,94,0.38),
    10px 0 24px rgba(239,68,68,0.34);
  filter: brightness(1.08);
}

/* ══════════════════════════════════
   CHARTS
══════════════════════════════════ */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px;
}

.chart-box {
  background: rgba(30,41,59,0.8);
  padding: 20px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  box-sizing: border-box;
  overflow: hidden;
}

.chart-box canvas { width: 100% !important; max-height: 320px; }

/* ══════════════════════════════════
   WEATHER
══════════════════════════════════ */
.weather-box {
  width: min(90%, 320px);
  margin: 30px auto;
  padding: 20px;
  background: rgba(30,41,59,0.8);
  border-radius: 15px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

/* ══════════════════════════════════
   ALERT TOAST
══════════════════════════════════ */
.alert-box {
  position: fixed;
  top: 24px;
  right: 24px;
  width: min(420px, calc(100vw - 48px));
  background: linear-gradient(135deg, #ff4d4d, #ef4444);
  color: white;
  padding: 16px 20px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 18px 40px rgba(239,68,68,0.34);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -12px, 0);
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
  pointer-events: none;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.alert-box.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
  .alert-box {
    top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    right: 16px;
    left: 16px;
    width: auto;
    max-width: min(520px, calc(100vw - 32px));
    margin: 0 auto;
    transform: translate3d(0, 18px, 0);
  }
}

html[data-theme="light"] .alert-box {
  color: #7f1d1d;
  border-color: rgba(239,68,68,0.18);
  box-shadow: 0 18px 34px rgba(239,68,68,0.2);
}

/* ══════════════════════════════════
   FILTER
══════════════════════════════════ */
.filter {
  text-align: center;
  margin: 20px;
}

.filter form {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: end;
  gap: 12px;
}

.filter label {
  font-size: 14px;
  color: #d1d5db;
}

.filter input {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  box-sizing: border-box;
  color: #111;
  min-height: 42px;
}

.filter button {
  padding: 10px 18px;
  background: #22c55e;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  min-height: 42px;
}

/* ══════════════════════════════════
   GENERAL CONTAINER
══════════════════════════════════ */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
}

.box {
  background: #111827;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0,255,100,0.2);
  text-align: left;
  box-sizing: border-box;
}

.box h3     { margin-top: 0; color: #22c55e; }
.time       { color: #9ca3af; margin-bottom: 10px; }
.box_text details { margin-top: 10px; }
.box_text summary { cursor: pointer; color: #93c5fd; }

/* ══════════════════════════════════
   SENSOR STATUS ROWS
══════════════════════════════════ */
.status-row {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
}

.sensor-status      { font-weight: bold; margin: 6px 0; }
.active             { color: #22c55e; }
.inactive           { color: #ef4444; }
.sensor-value       { color: #cbd5e1; font-size: 14px; margin-top: 4px; }
.last-update-inline { margin-top: 8px; font-size: 13px; color: #cbd5e1; }

/* ══════════════════════════════════
   DEVICE STATUS BOX
══════════════════════════════════ */
.device-status-box {
  max-width: 360px;
  width: 90%;
  margin: 10px auto 20px;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(30,41,59,0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 15px rgba(0,0,0,0.4);
  font-weight: bold;
  text-align: center;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.device-online  { color: #22c55e; }
.device-offline { color: #ef4444; }

/* ══════════════════════════════════
   SETTINGS PAGE
══════════════════════════════════ */
.settings-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.panel {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 30px;
  border-radius: 15px;
  width: min(95%, 350px);
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  text-align: left;
  box-sizing: border-box;
}

.panel h2 { text-align: center; color: white; }

.setting { margin: 15px 0; }

.setting input[type="number"],
.setting input[type="text"],
.setting input[type="email"],
.setting select {
  padding: 10px;
  border-radius: 5px;
  border: none;
  width: 100%;
  margin-top: 8px;
  box-sizing: border-box;
  color: #111;
}

.panel button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #22c55e;
  color: white;
  font-size: 16px;
  cursor: pointer;
  margin-top: 10px;
}

.settings-panel-wide {
  width: min(95%, 520px);
}

.settings-status {
  min-height: 24px;
  margin-top: 12px;
  font-size: 14px;
  color: #bfdbfe;
  text-align: center;
}

.settings-status.success { color: #86efac; }
.settings-status.error { color: #fca5a5; }

/* ══════════════════════════════════
   REPORTS
══════════════════════════════════ */
.report-wrapper { padding: 20px; }

.report-card {
  background: rgba(17,24,39,0.95);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 0 18px rgba(0,255,100,0.15);
  border: 1px solid rgba(255,255,255,0.08);
  text-align: left;
  box-sizing: border-box;
}

.report-head {
  font-size: 15px;
  color: #cbd5e1;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.report-list { display: grid; gap: 10px; }

.report-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 12px;
  align-items: center;
}

.report-label { color: #93c5fd; font-weight: bold; }
.report-value { color: #ffffff; text-align: right; overflow-wrap: anywhere; }

.alert-danger  { color: #ef4444; font-weight: bold; }
.alert-normal  { color: #22c55e; font-weight: bold; }
.alert-warning { color: #f59e0b; font-weight: bold; }
.fan-on-text   { color: #22c55e; font-weight: bold; }
.fan-off-text  { color: #ef4444; font-weight: bold; }

/* ══════════════════════════════════
   LIVE SENSOR PAGE
══════════════════════════════════ */
.sensor-page-title {
  text-align: center;
  margin-top: 20px;
  padding: 0 12px;
  color: #22c55e;
}

.page-info-box {
  text-align: center;
  background: #1e293b;
  max-width: 320px;
  width: 90%;
  margin: 10px auto;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.last-update-box {
  text-align: center;
  margin-bottom: 20px;
  color: #ddd;
  padding: 0 10px;
}

.sensor-live-wrapper {
  width: 95%;
  max-width: 1100px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 10px;
  box-sizing: border-box;
}

.sensor-live-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  background: #1e293b;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
  box-sizing: border-box;
  text-align: left;
}

.sensor-live-image            { flex: 0 0 120px; max-width: 120px; text-align: center; }
.sensor-live-image img        { width: 100px; height: 100px; object-fit: contain; max-width: 100%; }
.sensor-live-content          { flex: 1; min-width: 220px; }
.sensor-live-title            { font-size: 20px; color: #22c55e; font-weight: bold; }
.sensor-live-desc             { color: #ccc; margin: 5px 0; }
.sensor-live-value            { font-size: 16px; margin-top: 5px; }
.sensor-active                { color: #22c55e; font-weight: bold; }
.sensor-inactive              { color: red; font-weight: bold; }

html[data-theme="light"] .sensor-card,
html[data-theme="light"] .fan-box,
html[data-theme="light"] .chart-box,
html[data-theme="light"] .weather-box,
html[data-theme="light"] .device-status-box,
html[data-theme="light"] .page-info-box,
html[data-theme="light"] .panel,
html[data-theme="light"] .report-card,
html[data-theme="light"] .notification-list-panel,
html[data-theme="light"] .notification-summary-card,
html[data-theme="light"] .sensor-live-card,
html[data-theme="light"] .box {
  background: rgba(255,255,255,0.84);
  color: #0f172a;
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 10px 26px rgba(15,23,42,0.10);
}

html[data-theme="light"] .page-title,
html[data-theme="light"] .sensor-page-title,
html[data-theme="light"] .notifications-page-title,
html[data-theme="light"] .panel h2,
html[data-theme="light"] .report-label,
html[data-theme="light"] .sensor-live-title {
  color: #0f766e;
}

html[data-theme="light"] .sensor-label,
html[data-theme="light"] .last-update-box,
html[data-theme="light"] .last-update-inline,
html[data-theme="light"] .notification-summary-label,
html[data-theme="light"] .notification-time,
html[data-theme="light"] .report-head,
html[data-theme="light"] .sensor-live-desc,
html[data-theme="light"] .page-info-box,
html[data-theme="light"] .device-status-box,
html[data-theme="light"] .weather-box p {
  color: #475569;
}

html[data-theme="light"] .notification-card,
html[data-theme="light"] .report-item,
html[data-theme="light"] .status-row,
html[data-theme="light"] .notifications-empty {
  background: rgba(15,23,42,0.04);
}

html[data-theme="light"] .notification-card-title,
html[data-theme="light"] .notification-panel-head h3,
html[data-theme="light"] .report-value,
html[data-theme="light"] .sensor-card h2,
html[data-theme="light"] .weather-box h2,
html[data-theme="light"] .fan-box h2,
html[data-theme="light"] .chart-box h3 {
  color: #0f172a;
}

html[data-theme="light"] .notification-card-message,
html[data-theme="light"] .notification-panel-head p {
  color: #475569;
}

html[data-theme="light"] .notifications-stage {
  background:
    linear-gradient(180deg, rgba(248,250,252,0.98), rgba(240,249,255,0.95)),
    rgba(255,255,255,0.95);
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 22px 45px rgba(15,23,42,0.10);
}

html[data-theme="light"] .notifications-stage-subtitle {
  color: #64748b;
}

html[data-theme="light"] .notification-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(241,245,249,0.96));
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 16px 30px rgba(15,23,42,0.08);
}

html[data-theme="light"] .notification-card-footer {
  border-top-color: rgba(15,23,42,0.08);
}

html[data-theme="light"] .notification-time {
  color: #475569;
}

html[data-theme="light"] .setting input[type="number"],
html[data-theme="light"] .setting input[type="text"],
html[data-theme="light"] .setting input[type="email"],
html[data-theme="light"] .setting select,
html[data-theme="light"] .filter input {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(15,23,42,0.12);
  color: #0f172a;
}

/* ══════════════════════════════════
   NOTIFICATIONS
══════════════════════════════════ */
.notifications-page-title {
  text-align: center;
  margin: 0;
  padding: 0 12px;
  color: #9ff7cd;
}

.notifications-shell {
  width: min(1100px, 95%);
  margin: 24px auto 30px;
}

.notifications-stage {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(11,27,47,0.92), rgba(7,18,34,0.94)),
    rgba(2,6,23,0.85);
  border: 1px solid rgba(148,255,209,0.14);
  border-radius: 28px;
  box-shadow:
    0 24px 70px rgba(2,6,23,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
}

.notifications-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(34,197,94,0.12), transparent 36%),
    radial-gradient(circle at bottom right, rgba(59,130,246,0.10), transparent 30%);
  pointer-events: none;
}

.notifications-stage-head {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.notifications-stage-subtitle {
  margin: 0;
  max-width: 640px;
  color: #9fb4c9;
  line-height: 1.6;
}

.notifications-summary-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.notification-summary-card {
  background: rgba(15,23,42,0.76);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
  text-align: left;
}

.notification-summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  color: #ffffff;
}

.notification-summary-card.danger strong { color: #fca5a5; }
.notification-summary-card.warning strong { color: #fde68a; }

.notification-summary-label {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.notification-list-panel {
  position: relative;
  z-index: 1;
  background: rgba(15,23,42,0.78);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  text-align: left;
}

.notification-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.notification-panel-head h3 {
  margin: 0;
  color: #f8fafc;
}

.notification-panel-head p {
  margin: 6px 0 0;
  color: #94a3b8;
}

.notification-panel-copy {
  max-width: 560px;
}

.notification-refresh-btn {
  white-space: nowrap;
}

.notification-list {
  display: grid;
  gap: 16px;
}

.notification-card {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(17,24,39,0.96), rgba(15,23,42,0.92));
  border: 1px solid rgba(255,255,255,0.09);
  border-left: 5px solid #60a5fa;
  border-radius: 22px;
  padding: 20px;
  box-sizing: border-box;
  text-align: left;
  box-shadow: 0 18px 40px rgba(2,6,23,0.28);
}

.notification-card.warning { border-left-color: #f59e0b; }
.notification-card.danger  { border-left-color: #ef4444; }

.notification-card-body {
  display: grid;
  gap: 10px;
}

.notification-card-title {
  margin: 0;
  color: #f8fafc;
  font-size: 24px;
  line-height: 1.2;
}

.notification-card-message {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.65;
  font-size: 16px;
}

.notification-card-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.notification-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(96,165,250,0.18);
  color: #bfdbfe;
}

.notification-pill.warning {
  background: rgba(245,158,11,0.16);
  color: #fde68a;
}

.notification-pill.danger {
  background: rgba(239,68,68,0.16);
  color: #fecaca;
}

.notification-time {
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
}

.notifications-empty {
  padding: 26px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  color: #cbd5e1;
  text-align: center;
}

/* ════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
════════════════════════════════════════ */

/* ── Mobile ≤ 768px ── */
@media screen and (max-width: 768px) {

  .navbar {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    overflow: visible;
    background:
      linear-gradient(180deg, rgba(6,78,59,0.92), rgba(15,23,42,0.96)),
      rgba(0,0,0,0.95);
    padding: 10px 14px;
  }

  .logo {
    font-size: 16px;
    flex: 1;
    text-align: left;
    padding-right: 12px;
  }
  .hamburger {
    display: inline-flex;
    order: 2;
    align-items: center;
    justify-content: center;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    background:
      linear-gradient(180deg, rgba(8,47,73,0.96), rgba(2,6,23,0.98)),
      rgba(5,10,20,0.98);
    padding: 14px;
    gap: 6px;
    z-index: 1002;
    border: 1px solid rgba(148,255,209,0.16);
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.34);
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: min(calc(100vh - env(safe-area-inset-top, 0px) - 92px), 360px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, -10px, 0);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  html[data-theme="light"] .nav-links {
    background:
      linear-gradient(180deg, rgba(255,255,255,0.98), rgba(240,249,255,0.98)),
      rgba(255,255,255,0.96);
    border-color: rgba(15,23,42,0.08);
  }

  .nav-links.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
  }
  .nav-links li { width: 100%; }

  .nav-links a {
    font-size: 17px;
    padding: 14px 16px;
    text-align: left;
    display: flex;
    justify-content: flex-start;
    color: white;
    border-radius: 16px;
    margin-bottom: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: none;
  }

  .nav-links a:hover,
  .nav-links a:focus-visible {
    color: #082f49;
    background: linear-gradient(135deg, #86efac, #67e8f9);
  }

  html[data-theme="light"] .nav-links a {
    color: #0f172a;
    background: rgba(15,23,42,0.04);
    border-color: rgba(15,23,42,0.08);
  }

  .nav-backdrop,
  .nav-backdrop.active {
    display: none !important;
  }

  .sensor-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .sensor-card    { padding: 14px; min-width: 0; }
  .sensor-card h2 { font-size: 22px; }
  .sensor-label   { font-size: 12px; }

  .charts {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 12px;
  }

  .chart-box { padding: 14px; }
  .chart-box canvas { max-height: 260px; }

  .fan-box, .weather-box, .panel,
  .device-status-box, .page-info-box { width: 90%; }

  .fan-icon   { font-size: 50px; margin: 12px; }
  .button-group { gap: 10px; }
  .btn {
    padding: 10px 18px;
    font-size: 14px;
    flex: 1 1 130px;
  }

  .settings-wrapper { padding: 14px; }

  .alert-box {
    top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    right: 10px;
    left: 10px;
    width: auto;
    font-size: 14px;
    padding: 13px 14px;
    border-radius: 16px;
    transform: translate3d(0, 18px, 0);
  }

  .page-title, .sensor-page-title { font-size: 19px; padding: 10px 12px 4px; }

  .report-wrapper, .container { padding: 12px; gap: 12px; }
  .box { padding: 14px; }

  .sensor-live-card  { flex-direction: column; text-align: center; }
  .sensor-live-image { flex: 0 0 auto; max-width: 100%; }
  .sensor-live-content { text-align: center; min-width: auto; }
  .sensor-live-image img { width: 80px; height: 80px; }

  .notifications-shell { width: 92%; }
  .notifications-stage { padding: 18px 14px; border-radius: 24px; }
  .notification-list-panel { padding: 18px; }
  .notification-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .notification-refresh-btn { width: 100%; }

  .report-item  { flex-direction: column; align-items: flex-start; }
  .report-value { text-align: left; }

  .filter form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    width: min(100%, 320px);
    margin: 0 auto;
  }

  .filter input,
  .filter button { width: 100%; }
}

/* ── Small mobile ≤ 480px ── */
@media screen and (max-width: 480px) {
  .navbar { padding: 10px 12px; }
  .logo { font-size: 15px; }
  .nav-links {
    left: 10px;
    right: 10px;
    top: calc(100% + 8px);
    padding: 12px;
    border-radius: 18px;
    max-height: min(calc(100vh - env(safe-area-inset-top, 0px) - 86px), 320px);
  }

  .sensor-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .sensor-card    { padding: 12px; }
  .sensor-card h2 { font-size: 20px; }
  .sensor-label   { font-size: 12px; }

  .charts { padding: 10px; }
  .chart-box { padding: 12px; }

  .fan-box  { width: 95%; padding: 15px; }
  .fan-icon { font-size: 40px; margin: 10px; }
  .btn {
    padding: 10px 14px;
    font-size: 13px;
    flex-basis: 100%;
  }

  .weather-box, .device-status-box,
  .page-info-box, .panel { width: 95%; }

  .alert-box {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    font-size: 14px;
    padding: 12px 13px;
  }

  .page-title, .sensor-page-title { font-size: 17px; }
  .sensor-live-title { font-size: 17px; }
  .sensor-live-value { font-size: 13px; }
  .report-head { font-size: 14px; }
  .notifications-page-title { font-size: 18px; }
  .notifications-stage-subtitle { font-size: 14px; }
  .notification-summary-card strong { font-size: 24px; }
  .notification-card { padding: 16px; }
  .notification-card-title { font-size: 21px; }
  .notification-card-message { font-size: 15px; }
}

/* ── Tablet 769–1024px ── */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .sensor-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px;
  }
  .charts { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .fan-box           { width: min(90%, 320px); }
  .weather-box       { width: min(90%, 280px); }
  .device-status-box { width: min(90%, 300px); }
  .panel             { width: min(95%, 320px); }
}

/* ── Laptop 1025–1440px ── */
@media screen and (min-width: 1025px) and (max-width: 1440px) {
  .sensor-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
  }
  .charts { grid-template-columns: repeat(2, 1fr); gap: 25px; }
  .fan-box           { width: min(90%, 400px); }
  .weather-box       { width: min(90%, 350px); }
  .device-status-box { width: min(90%, 380px); }
  .panel             { width: min(95%, 400px); }
  .navbar            { padding: 15px 40px; }
  .nav-links         { gap: 30px; }
}

/* ── Large desktop ≥ 1441px ── */
@media screen and (min-width: 1441px) {
  .sensor-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
  }
  .charts { grid-template-columns: repeat(3, 1fr); gap: 30px; }
  .fan-box           { width: min(90%, 450px); }
  .weather-box       { width: min(90%, 400px); }
  .device-status-box { width: min(90%, 420px); }
  .panel             { width: min(95%, 450px); }
  .navbar            { padding: 20px 50px; }
  .nav-links         { gap: 35px; }
  .logo              { font-size: 24px; }
  .nav-links a       { font-size: 18px; }
  .sensor-live-wrapper { max-width: 1200px; }
}
