:root {
  --gradient-start: #0057FF;
  --gradient-end: #4DA6FF;
  --accent-orange: #FF9A3D;
  --primary-gradient: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  --primary-blue: #0057FF;
  --primary-hover: #0047D1;
  --dark-blue: #EEF5FF; 
  --light-blue: #D6E6FF;
  --dash-grad-start: #E0F7FF; /* shallow clear water */
  --dash-grad-end: #B3E5FC;   /* deeper aqua */
  
  --critical-gradient: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  --critical-text: #DC2626;
  --critical-border: #FCA5A5;
  
  --warning-gradient: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  --warning-text: #D97706;
  --warning-border: #FCD34D;
  
  --normal-gradient: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  --normal-text: #059669;
  --normal-border: #6EE7B7;
  
  --device-gradient: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  --device-text: #2563EB;
  --device-border: #93C5FD;
  
  --bg-sidebar: #FFFFFF;
  --bg-input: #F8FAFC;
  --border-light: #E2E8F0;
  --text-main: #1E293B;
  --text-muted: #64748B;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background: #fff; overflow-x: hidden; color: var(--text-main); }
.screen { display: none; height: 100vh; width: 100vw; }
.screen.active { display: flex; }
.login-layout { display: flex; width: 100%; }
.login-wave-side {
  flex: 1.1;
  position: relative;
  background: linear-gradient(160deg, #63d4ff 0%, #18a8e0 42%, #046cb8 100%);
  background-size: 220% 220%;
  overflow: hidden;
  clip-path: ellipse(92% 110% at 8% 50%);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  color: white; padding: 40px;
  box-shadow: inset -18px 0 45px rgba(0, 0, 0, 0.12), 0 18px 45px rgba(0, 0, 0, 0.16);
  transform: translateX(-130%);
  opacity: 0;
  animation: slideInFromLeft 1.2s ease-out forwards, waveGlow 18s ease-in-out infinite;
}
.login-wave-side::before {
  content: '';
  position: absolute;
  top: 8%;
  left: -8%;
  width: 136%;
  height: 55%;
  background: radial-gradient(circle at 24% 18%, rgba(255,255,255,0.28), transparent 28%);
  opacity: 0.6;
  filter: blur(8px);
  transform: translateX(-10%);
  z-index: 0;
  animation: surfaceLight 11s ease-in-out infinite;
}
.brand-center { text-align: center; position: relative; z-index: 1; }
.logo-large { width: 140px; margin-bottom: 20px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2)); }

@keyframes slideInFromLeft {
  0% { transform: translateX(-130%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

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

@keyframes surfaceLight {
  0%, 100% { transform: translateX(-10%); opacity: 0.55; }
  50% { transform: translateX(12%); opacity: 0.7; }
}

@keyframes formFadeIn {
  0% { opacity: 0; transform: translateY(18px); }
  100% { opacity: 1; transform: translateY(0); }
}

.brand-title { font-size: 3.8rem; font-weight: 800; margin-bottom: 5px; letter-spacing: -1px; color: white; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); }
.brand-desc { opacity: 0.9; max-width: 400px; font-weight: 400; line-height: 1.4; font-size: 0.95rem; color: rgba(255, 255, 255, 0.85); }
.login-form-side { flex: 1; display: flex; justify-content: center; align-items: center; background: #FFFFFF; }
.login-box { width: 440px; padding: 50px; background: #ffffff; border-radius: 24px; box-shadow: 0 8px 32px rgba(0, 87, 255, 0.12); border: 1px solid var(--border-light); text-align: center; opacity: 0; transform: translateY(18px); animation: formFadeIn 0.9s ease-out forwards; animation-delay: 1.1s; }
.login-box h2 { font-size: 2rem; font-weight: 700; margin-bottom: 5px; color: var(--text-main); }
.sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 35px; }
.field { text-align: left; margin-bottom: 20px; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; color: var(--text-main); }
.field input { width: 100%; padding: 14px; border: 1px solid var(--border-light); border-radius: 12px; outline: none; background: var(--bg-input); color: var(--text-main); font-family: 'Poppins', sans-serif; transition: 0.2s; }
.field input:focus { border-color: var(--primary-blue); background: #FFFFFF; box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.1); }
.error-bubble { background: #DC2626; color: white; padding: 8px 12px; border-radius: 6px; font-size: 0.8rem; margin-top: 5px; position: relative; }
.error-bubble::before { content: ''; position: absolute; top: -5px; left: 20px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #DC2626; }
.btn-login { width: 100%; padding: 15px; background: var(--primary-gradient); color: white; border: none; border-radius: 12px; font-weight: 600; font-size: 1rem; cursor: pointer; transition: 0.2s; margin-top: 15px; }
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0, 87, 255, 0.3); }
.dashboard-wrapper { display: flex; width: 100%; height: 100vh; background: white; }
.sidebar { width: 260px; background: var(--bg-sidebar); padding: 40px 20px; display: flex; flex-direction: column; border-right: 1px solid var(--border-light); }
.user-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 35px; }
.avatar-circle { width: 45px; height: 45px; border-radius: 50%; overflow: hidden; border: 2px solid var(--gradient-end); }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.content-area { flex: 1; background: linear-gradient(135deg, var(--dash-grad-start) 0%, var(--dash-grad-end) 100%); border-radius: 40px 0 0 0; margin-top: 20px; margin-left: 20px; padding: 45px; overflow-y: auto; }
.page-content { display: none; }
.page-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 35px; }
.dash-header-left { display: flex; align-items: center; gap: 15px; }
.dash-header-left img { width: 50px; height: 50px; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }
.card { 
  background: #FFFFFF;
  padding: 24px; 
  border-radius: 16px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); 
  border: 1px solid var(--border-light);
  cursor: pointer; 
  transition: 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card-left { display: flex; flex-direction: column; gap: 4px; }
.card-label { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); }
.card-value { font-size: 1.75rem; font-weight: 700; color: var(--text-main); }
.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.card.critical .card-icon { background: transparent; }
.card.warning .card-icon { background: transparent; }
.card.normal .card-icon { background: transparent; }
.card.device-status { 
  justify-content: flex-start; 
  flex-direction: column; 
  align-items: flex-start; 
  gap: 8px;
}
.device-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}
.device-row span:last-child {
  font-weight: 700;
  color: var(--text-main);
}
.station-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.station-card { background: rgba(255, 255, 255, 0.95); padding: 30px; border-radius: 20px; box-shadow: 0 2px 8px rgba(30, 41, 59, 0.06); border: 1px solid var(--border-light); transition: all 0.3s ease; cursor: pointer; }
.station-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0, 87, 255, 0.12); border-color: var(--gradient-end); }
.s-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; border-bottom: 1px solid #F1F5F9; padding-bottom: 10px; }
.s-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.yellow { background: #F59E0B; }
.dot.green { background: #22C55E; }
.dot.red { background: #EF4444; }
.s-row { display: flex; justify-content: space-between; padding: 10px 0; font-size: 0.95rem; color: var(--text-muted); }
.s-row .val { font-weight: 700; color: var(--text-main); }
.s-label { margin-top: 15px; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; }
.s-label.warning { color: #D97706; }
.s-label.safe { color: #059669; }
.s-label.critical { color: #DC2626; }
.search-bar { margin-bottom: 20px; }
.search-bar input { width: 300px; padding: 12px 16px; border: 1px solid var(--border-light); border-radius: 12px; font-family: 'Poppins', sans-serif; }
.data-table { width: 100%; background: white; border-radius: 20px; padding: 30px; border: 1px solid var(--border-light); box-shadow: 0 2px 8px rgba(30, 41, 59, 0.06); }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 15px; font-weight: 600; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; border-bottom: 2px solid var(--border-light); }
.data-table td { padding: 18px 15px; border-bottom: 1px solid #F1F5F9; color: var(--text-main); }
.data-table tr:hover { background: #F8FAFC; cursor: pointer; }
.status-badge { padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; color: white; }
.status-badge.warning { background: #F59E0B; }
.status-badge.safe { background: #22C55E; }
.status-badge.critical { background: #EF4444; }
.settings-section { background: white; border-radius: 20px; padding: 30px; margin-bottom: 20px; border: 1px solid var(--border-light); box-shadow: 0 2px 8px rgba(30, 41, 59, 0.06); }
.settings-section h3 { font-size: 1.2rem; margin-bottom: 20px; color: var(--text-main); }
.nav-btn { width: 100%; padding: 14px 18px; text-align: left; border: none; background: none; border-radius: 12px; cursor: pointer; margin-bottom: 8px; color: var(--text-muted); display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 0.95rem; transition: 0.2s; }
.nav-btn img { width: 20px; height: 20px; }
.nav-btn:hover { background: #F1F5F9; }
.nav-btn.active { background: var(--primary-gradient); color: white; font-weight: 600; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: white; border-radius: 24px; padding: 40px; max-width: 700px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-close { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text-muted); }
.chart-container { position: relative; height: 300px; margin-top: 20px; }