/* ═══════════════════════════════════════════════════════════════════
   HPSEBL – Larji Dam AI&D Siren System Portal  |  style.css v3.0
   ═══════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Rajdhani:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-base:       #070d1a;
  --bg-surface:    #0d1626;
  --bg-card:       #111d2e;
  --bg-card-hover: #152236;
  --bg-input:      #0a1526;
  --bg-sidebar:    #080f1c;
  --border:        rgba(56,100,170,0.22);
  --border-light:  rgba(100,160,255,0.12);

  --primary:       #2563eb;
  --primary-light: #3b82f6;
  --primary-glow:  rgba(37,99,235,0.35);
  --accent:        #0ea5e9;
  --accent-glow:   rgba(14,165,233,0.3);

  --green:         #22c55e;
  --green-dark:    #16a34a;
  --green-glow:    rgba(34,197,94,0.25);
  --yellow:        #eab308;
  --yellow-glow:   rgba(234,179,8,0.25);
  --orange:        #f97316;
  --orange-glow:   rgba(249,115,22,0.25);
  --red:           #ef4444;
  --red-dark:      #dc2626;
  --red-glow:      rgba(239,68,68,0.35);
  --teal:          #14b8a6;
  --teal-glow:     rgba(20,184,166,0.25);

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;
  --text-dim:      #334155;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --radius-xs:     5px;
  --shadow:        0 4px 24px rgba(0,0,0,0.45);
  --shadow-sm:     0 2px 12px rgba(0,0,0,0.3);
  --shadow-glow:   0 0 20px rgba(37,99,235,0.2);

  --transition:    all 0.22s cubic-bezier(0.4,0,0.2,1);
  --font-main:     'Inter', sans-serif;
  --font-display:  'Rajdhani', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }
.mt-3 { margin-top: 1.2rem; }
.mt-4 { margin-top: 1.8rem; }
.mb-3 { margin-bottom: 1.2rem; }

/* ═══════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════ */

.app-body { min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(20px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}

.sb-logo { width: 44px; height: 44px; flex-shrink: 0; }
.sb-logo-svg { width: 100%; height: 100%; filter: drop-shadow(0 0 8px rgba(255,215,0,0.3)); }

.sb-brand-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sb-brand-main {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFD700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-shadow: 0 0 12px rgba(255,215,0,0.4);
}
.sb-brand-sub { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.03em; }

.sidebar-close-btn {
  display: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 4px;
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  padding: 10px 8px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
  font-size: 0.875rem;
}
.nav-item:hover { background: rgba(37,99,235,0.12); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.25), rgba(14,165,233,0.12));
  color: var(--primary-light);
  border-left: 3px solid var(--primary-light);
  box-shadow: inset 0 0 20px rgba(37,99,235,0.08);
}
.nav-item.active .nav-icon { color: var(--primary-light); }

.nav-icon { width: 20px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--red);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}
.nav-ext { font-size: 0.65rem; color: var(--text-dim); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.su-avatar { font-size: 1.8rem; color: var(--primary-light); }
.su-info { flex: 1; min-width: 0; }
.su-name { display: block; font-weight: 600; font-size: 0.8rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { display: block; font-size: 0.68rem; color: var(--text-muted); }
.su-logout {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: var(--transition);
}
.su-logout:hover { background: rgba(239,68,68,0.15); color: var(--red); }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  display: none;
  backdrop-filter: blur(2px);
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: rgba(13,22,38,0.92);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 150;
  backdrop-filter: blur(20px);
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-menu-btn {
  display: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.topbar-menu-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.topbar-title { display: flex; flex-direction: column; }
.topbar-page {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.topbar-breadcrumb { font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.04em; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}
.topbar-clock-icon { color: var(--accent); font-size: 0.85rem; }
.topbar-datetime { display: flex; flex-direction: column; align-items: flex-end; }
.live-clock {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  line-height: 1.2;
}
.live-date { font-size: 0.62rem; color: var(--text-muted); }

.topbar-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot--green { background: var(--green); }
.pulse-dot {
  animation: pulse-ring 2s infinite;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.4);
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.topbar-alert-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 20px;
  padding: 5px 12px;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 700;
  animation: flash-border 1.5s infinite;
}
@keyframes flash-border {
  0%,100% { border-color: rgba(239,68,68,0.35); }
  50%      { border-color: rgba(239,68,68,0.8); }
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  padding-bottom: 40px;
}

.main-content > *:not(.messages-container) {
  padding-left: 24px;
  padding-right: 24px;
}
.main-content > .messages-container { padding-left: 24px; padding-right: 24px; }

/* ═══════════════════════════════════════════════
   CARDS & SECTIONS
   ═══════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.02);
}
.card-header i { color: var(--primary-light); }
.card-body { padding: 18px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.03em;
}
.section-title i { color: var(--primary-light); }
.section-actions { display: flex; align-items: center; gap: 10px; }

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  margin-left: 24px;
  margin-right: 24px;
}

/* ═══════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding-top: 20px;
  padding-bottom: 4px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card--blue::before   { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card--green::before  { background: linear-gradient(90deg, var(--green), var(--teal)); }
.stat-card--red::before    { background: linear-gradient(90deg, var(--red), #f97316); }
.stat-card--orange::before { background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.stat-card--yellow::before { background: linear-gradient(90deg, var(--yellow), var(--orange)); }
.stat-card--teal::before   { background: linear-gradient(90deg, var(--teal), var(--accent)); }

.sc-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-card--blue   .sc-icon { background: rgba(37,99,235,0.18); color: var(--primary-light); }
.stat-card--green  .sc-icon { background: rgba(34,197,94,0.18); color: var(--green); }
.stat-card--red    .sc-icon { background: rgba(239,68,68,0.18); color: var(--red); }
.stat-card--orange .sc-icon { background: rgba(249,115,22,0.18); color: var(--orange); }
.stat-card--yellow .sc-icon { background: rgba(234,179,8,0.18); color: var(--yellow); }
.stat-card--teal   .sc-icon { background: rgba(20,184,166,0.18); color: var(--teal); }

.sc-body { flex: 1; }
.sc-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.sc-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.04em; display: flex; align-items: center; gap: 5px; }
.sc-trend { font-size: 0.8rem; }
.sc-trend--up { color: var(--green); }
.sc-trend--red { color: var(--red); }
.sc-pct { font-size: 0.8rem; font-weight: 600; color: var(--accent); }

.sc-alarm { animation: alarm-pulse 1.4s infinite; }
@keyframes alarm-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%      { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}

/* ═══════════════════════════════════════════════
   WATER LEVEL BANNER
   ═══════════════════════════════════════════════ */

.wl-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid;
  margin-top: 14px;
  flex-wrap: wrap;
}

#wlBanner{
margin-left: 24px;
margin-right: 24px;
}

.wl-banner--normal   { background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.3); }
.wl-banner--warning  { background: rgba(234,179,8,0.08); border-color: rgba(234,179,8,0.35); }
.wl-banner--danger   { background: rgba(249,115,22,0.1); border-color: rgba(249,115,22,0.4); }
.wl-banner--critical { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.45); animation: alarm-pulse 1.4s infinite; }

.wl-banner-left  { display: flex; align-items: center; gap: 12px; }
.wl-banner-icon  { font-size: 1.5rem; }
.wl-banner--normal   .wl-banner-icon { color: var(--primary-light); }
.wl-banner--warning  .wl-banner-icon { color: var(--yellow); }
.wl-banner--danger   .wl-banner-icon { color: var(--orange); }
.wl-banner--critical .wl-banner-icon { color: var(--red); }

.wl-banner-title { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.wl-banner-time  { font-size: 0.68rem; color: var(--text-muted); }

.wl-banner-gauge { flex: 1; min-width: 180px; }
.wl-gauge-bar {
  position: relative;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
}
.wl-gauge-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.wl-gauge-label {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  color: white;
}

.wl-banner-right { display: flex; flex-direction: column; align-items: flex-end; }
.wl-big-level { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }

.wl-status-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}
.wl-badge, .wl-status-badge {
  font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
  border-radius: 12px; letter-spacing: 0.06em; text-transform: uppercase;
}
.wl-badge--normal,  .wl-status-badge--normal  { background: rgba(37,99,235,0.2); color: var(--primary-light); border: 1px solid rgba(37,99,235,0.4); }
.wl-badge--warning, .wl-status-badge--warning { background: rgba(234,179,8,0.2); color: var(--yellow); border: 1px solid rgba(234,179,8,0.4); }
.wl-badge--danger,  .wl-status-badge--danger  { background: rgba(249,115,22,0.2); color: var(--orange); border: 1px solid rgba(249,115,22,0.4); }
.wl-badge--critical,.wl-status-badge--critical{ background: rgba(239,68,68,0.2); color: var(--red); border: 1px solid rgba(239,68,68,0.4); }

.wl-details-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 14px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}
.wl-details-btn:hover { background: rgba(37,99,235,0.15); color: var(--primary-light); }

/* ═══════════════════════════════════════════════
   LOCATION GRID
   ═══════════════════════════════════════════════ */

.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.loc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.loc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow), var(--shadow-glow); }
.loc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.loc-card--offline::before  { background: linear-gradient(90deg, var(--text-dim), var(--text-muted)); }
.loc-card--warning::before  { background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.loc-card--alarm::before    { background: linear-gradient(90deg, var(--red), var(--orange)); }
.loc-card--alarm { animation: card-alarm 1.5s infinite; }
@keyframes card-alarm {
  0%,100% { border-color: var(--border); }
  50%      { border-color: rgba(239,68,68,0.6); box-shadow: 0 0 20px rgba(239,68,68,0.2); }
}

.lc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-light);
}
.lc-header-left  { display: flex; align-items: center; gap: 8px; }
.lc-header-right { display: flex; align-items: center; gap: 8px; }

.lc-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: var(--transition);
}
.dot--online  { background: var(--green); box-shadow: 0 0 8px var(--green-glow); animation: pulse-ring 2.5s infinite; }
.dot--offline { background: var(--text-dim); }
.dot-inline   { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

.lc-name-wrap { display: flex; flex-direction: column; }
.lc-name { font-weight: 700; font-size: 0.8rem; color: var(--text-primary); line-height: 1.2; }
.lc-code { font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.06em; }

.gsm-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.gsm-bar {
  width: 3px;
  background: var(--border);
  border-radius: 1px;
  transition: var(--transition);
}
.gsm-bar--active { background: var(--green); }

.lc-detail-link {
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.lc-detail-link:hover { color: var(--primary-light); background: rgba(37,99,235,0.1); }

.lc-devices { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.lc-device-row { display: flex; gap: 6px; }

.lc-device {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
}
.lc-device i { font-size: 0.75rem; flex-shrink: 0; }
.lc-device span:last-child {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
}

.dev--active   { border-color: rgba(234,179,8,0.35); background: rgba(234,179,8,0.06); color: var(--yellow); }
.dev--active span:last-child { background: var(--yellow); box-shadow: 0 0 6px rgba(234,179,8,0.5); }
.dev--critical { border-color: rgba(239,68,68,0.45) !important; background: rgba(239,68,68,0.1) !important; color: var(--red) !important; }
.dev--critical span:last-child { background: var(--red) !important; box-shadow: 0 0 6px rgba(239,68,68,0.6) !important; animation: pulse-ring 1.5s infinite !important; }
.dev--warning  { border-color: rgba(249,115,22,0.35) !important; background: rgba(249,115,22,0.08) !important; color: var(--orange) !important; }
.dev--alarm    { border-color: rgba(239,68,68,0.5) !important; background: rgba(239,68,68,0.12) !important; color: var(--red) !important; }
.dev--alarm span:last-child { background: var(--red) !important; animation: pulse-ring 1s infinite !important; }
.dev--danger   { border-color: rgba(239,68,68,0.35) !important; background: rgba(239,68,68,0.08) !important; color: var(--red) !important; }
.dev--ok       { border-color: rgba(34,197,94,0.25) !important; background: rgba(34,197,94,0.06) !important; color: var(--green) !important; }
.dev--ok span:last-child { background: var(--green) !important; }

.lc-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border-light);
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.lc-timestamp { display: flex; align-items: center; gap: 5px; }

.refresh-indicator {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.refresh-indicator i { color: var(--accent); }

/* ═══════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table thead th {
  background: rgba(255,255,255,0.03);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table tbody td {
  padding: 9px 12px;
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody tr:last-child { border-bottom: none; }

.row--critical { background: rgba(239,68,68,0.06) !important; border-left: 3px solid var(--red); }
.row--error    { background: rgba(249,115,22,0.06) !important; border-left: 3px solid var(--orange); }
.row--warning  { background: rgba(234,179,8,0.05) !important; border-left: 3px solid var(--yellow); }

.td-time { font-family: var(--font-mono); font-size: 0.72rem; white-space: nowrap; color: var(--text-muted); }
.td-msg  { max-width: 300px; }
.td-num  { color: var(--text-dim); font-size: 0.72rem; }
.td-param { white-space: nowrap; }
.td-notes { color: var(--text-muted); font-size: 0.72rem; }
.td-change { white-space: nowrap; font-size: 0.72rem; }
.td-change i { color: var(--text-dim); margin: 0 4px; }

.empty-cell { text-align: center; padding: 32px !important; color: var(--text-dim); font-size: 0.875rem; }
.empty-cell i { display: block; font-size: 1.5rem; margin-bottom: 8px; }

.table-link { color: var(--primary-light); }
.table-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Badges ── */
.action-badge {
  font-size: 0.62rem; font-weight: 700; padding: 2px 7px;
  border-radius: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
}
.action-on       { background: rgba(34,197,94,0.18); color: var(--green); border: 1px solid rgba(34,197,94,0.35); }
.action-off      { background: rgba(71,85,105,0.25); color: #94a3b8; border: 1px solid rgba(71,85,105,0.4); }
.action-alert    { background: rgba(239,68,68,0.18); color: var(--red); border: 1px solid rgba(239,68,68,0.35); }
.action-reset    { background: rgba(14,165,233,0.18); color: var(--accent); border: 1px solid rgba(14,165,233,0.35); }
.action-water_level { background: rgba(37,99,235,0.18); color: var(--primary-light); border: 1px solid rgba(37,99,235,0.35); }
.action-power    { background: rgba(249,115,22,0.18); color: var(--orange); border: 1px solid rgba(249,115,22,0.35); }
.action-comm     { background: rgba(20,184,166,0.18); color: var(--teal); border: 1px solid rgba(20,184,166,0.35); }

.sev-badge {
  font-size: 0.62rem; font-weight: 800; padding: 2px 7px;
  border-radius: 12px; text-transform: uppercase; letter-spacing: 0.07em;
  white-space: nowrap;
}
.sev-info     { background: rgba(59,130,246,0.18); color: #60a5fa; border: 1px solid rgba(59,130,246,0.35); }
.sev-warning  { background: rgba(234,179,8,0.18); color: var(--yellow); border: 1px solid rgba(234,179,8,0.35); }
.sev-error    { background: rgba(249,115,22,0.18); color: var(--orange); border: 1px solid rgba(249,115,22,0.35); }
.sev-critical { background: rgba(239,68,68,0.2); color: var(--red); border: 1px solid rgba(239,68,68,0.45); animation: sev-flash 1.2s infinite; }
@keyframes sev-flash { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

.mini-badge { font-size: 0.62rem; font-weight: 700; padding: 1px 6px; border-radius: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.mb--critical { background: rgba(239,68,68,0.2); color: var(--red); }
.mb--warning  { background: rgba(234,179,8,0.2); color: var(--yellow); }
.mb--alarm    { background: rgba(239,68,68,0.2); color: var(--red); }
.mb--danger   { background: rgba(249,115,22,0.2); color: var(--orange); }
.mb--ok       { background: rgba(34,197,94,0.2); color: var(--green); }

.triggered-badge { font-size: 0.68rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.acked-icon { color: var(--green); font-size: 0.8rem; }
.btn-ack {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: var(--green);
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  font-size: 0.72rem;
  transition: var(--transition);
}
.btn-ack:hover { background: rgba(34,197,94,0.2); }

.code-old { background: rgba(239,68,68,0.15); color: #fca5a5; padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 0.7rem; }
.code-new { background: rgba(34,197,94,0.15); color: #86efac; padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 0.7rem; }
.gsm-text { font-size: 0.72rem; }
.gsm-0 { color: var(--red); }
.gsm-1 { color: var(--orange); }
.gsm-2 { color: var(--yellow); }
.gsm-3 { color: var(--green); }
.gsm-4 { color: var(--teal); }
.ts-badge { font-size: 0.68rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: var(--font-main);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 14px rgba(37,99,235,0.4); }

.btn-danger { background: var(--red-dark); color: white; border-color: var(--red-dark); }
.btn-danger:hover { background: var(--red); box-shadow: 0 4px 14px rgba(239,68,68,0.4); }

.btn-success { background: var(--green-dark); color: white; border-color: var(--green-dark); }
.btn-success:hover { background: var(--green); box-shadow: 0 4px 14px rgba(34,197,94,0.3); }

.btn-warning { background: rgba(249,115,22,0.85); color: white; border-color: transparent; }
.btn-warning:hover { background: var(--orange); box-shadow: 0 4px 14px rgba(249,115,22,0.35); }

.btn-ghost { background: rgba(255,255,255,0.05); color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.09); color: var(--text-primary); }

.btn-sm { padding: 5px 11px; font-size: 0.73rem; }
.btn-lg { padding: 12px 24px; font-size: 0.9rem; font-weight: 700; }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════ */

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-family: var(--font-main);
  transition: var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-surface); }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ts-slider {
  display: block;
  width: 42px; height: 22px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: var(--transition);
  position: relative;
}
.ts-slider::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .ts-slider { background: var(--primary); border-color: var(--primary); }
.toggle-switch input:checked + .ts-slider::after { transform: translateX(20px); }
.toggle-switch input:checked + .ts-slider--red { background: var(--red-dark); border-color: var(--red-dark); }
.toggle-switch input:checked + .ts-slider--orange { background: var(--orange); border-color: var(--orange); }
.toggle-switch input:checked + .ts-slider--yellow { background: var(--yellow); border-color: var(--yellow); }

/* ═══════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 8px;
  border: 1px solid;
}
.alert-warning { background: rgba(234,179,8,0.1); border-color: rgba(234,179,8,0.3); color: var(--yellow); }
.alert-info    { background: rgba(37,99,235,0.1); border-color: rgba(37,99,235,0.3); color: var(--primary-light); }
.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: var(--green); }
.alert-error   { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: var(--red); }
.alert-close { margin-left: auto; background: none; border: none; color: inherit; cursor: pointer; font-size: 0.8rem; opacity: 0.7; }
.alert-close:hover { opacity: 1; }

.messages-container { padding-top: 16px; }

/* ═══════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(12px);
  border: 1px solid;
}
.toast-success { background: rgba(22,163,74,0.9); border-color: rgba(34,197,94,0.4); color: white; }
.toast-error   { background: rgba(220,38,38,0.9); border-color: rgba(239,68,68,0.4); color: white; }
.toast-warning { background: rgba(202,138,4,0.9); border-color: rgba(234,179,8,0.4); color: white; }
.toast-info    { background: rgba(29,78,216,0.9); border-color: rgba(59,130,246,0.4); color: white; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  max-width: 420px;
  width: 92%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: modal-in 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(-20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-icon { font-size: 2.5rem; margin-bottom: 14px; color: var(--yellow); }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.modal-body  { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════════════
   CONTROL PANEL
   ═══════════════════════════════════════════════ */

.global-controls-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}
.global-controls-row .btn-lg {
  flex: 1; min-width: 200px; justify-content: center;
  letter-spacing: 0.05em;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.cp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  gap: 10px;
  flex-wrap: wrap;
}
.cp-header-left { display: flex; align-items: center; gap: 10px; }
.cp-header-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cp-name { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); display: block; }
.cp-code { font-size: 0.65rem; color: var(--text-muted); }

.cp-toggles { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.cp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.cp-toggle-row:hover { background: rgba(255,255,255,0.03); }
.cp-toggle-label { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-secondary); }
.cp-toggle-label i { width: 14px; text-align: center; color: var(--text-muted); }

.cp-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ═══════════════════════════════════════════════
   WATER LEVEL PAGE
   ═══════════════════════════════════════════════ */

.wl-main-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  margin-top: 14px;
}

.mt-3{
  margin-left: 24px;
  margin-right: 24px;
}

.filter-card{
  margin-left: 24px;
  margin-right: 24px;
}

.dam-gauge-wrap { display: flex; gap: 16px; align-items: flex-start; }
.dam-gauge { display: flex; gap: 10px; height: 200px; }
.dam-body {
  width: 60px;
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  position: relative;
  overflow: hidden;
}
.dam-water {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  border-radius: 0 0 4px 4px;
  transition: height 1.2s cubic-bezier(0.4,0,0.2,1);
  animation: wave 3s ease-in-out infinite;
}
@keyframes wave {
  0%,100% { filter: brightness(1); }
  50%      { filter: brightness(1.15); }
}
.dam-level-line {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.4);
}
.dam-level-val {
  position: absolute;
  right: -50px;
  top: -10px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}
.dam-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 0 2px;
}

.dam-info { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.di-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-muted); }
.di-row strong { font-weight: 700; color: var(--text-primary); }

.alert-thresholds {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}
.ath-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 600;
}
.ath-normal   { background: rgba(37,99,235,0.1); color: var(--primary-light); }
.ath-warning  { background: rgba(234,179,8,0.1); color: var(--yellow); }
.ath-danger   { background: rgba(249,115,22,0.1); color: var(--orange); }
.ath-critical { background: rgba(239,68,68,0.12); color: var(--red); }

.wl-form .wl-form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.wl-form-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; }
.wl-form-field label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.wl-form-field--btn { flex: 0; }

/* ═══════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════ */

.filter-card { margin-top: 16px; }
.filter-form { padding: 16px 18px; }
.filter-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 130px; flex: 1; }
.filter-field label { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.04em; display: flex; align-items: center; gap: 4px; }
.filter-actions { display: flex; gap: 6px; align-items: flex-end; flex-shrink: 0; }

.logs-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.ls-count { display: flex; align-items: center; gap: 6px; }
.ls-note { font-size: 0.72rem; color: var(--text-dim); }

/* ═══════════════════════════════════════════════
   LOCATION DETAIL
   ═══════════════════════════════════════════════ */

.loc-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.ldh-left { display: flex; align-items: center; gap: 14px; }
.ldh-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.ldh-code { font-size: 0.72rem; color: var(--text-muted); background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 10px; margin-left: 8px; }
.ldh-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.device-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
  transition: var(--transition);
}
.device-status-card:hover { transform: translateY(-2px); }
.dsc-icon { font-size: 1.5rem; margin-bottom: 8px; }
.dsc-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 6px; }
.dsc-status { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; }

.dsc--off      { border-color: var(--border-light); }
.dsc--off .dsc-icon   { color: var(--text-dim); }
.dsc--off .dsc-status { color: var(--text-dim); }

.dsc--ok       { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.05); }
.dsc--ok .dsc-icon   { color: var(--green); }
.dsc--ok .dsc-status { color: var(--green); }

.dsc--active .dsc-icon   { animation: pulse-ring 1.5s infinite; }
.dsc--critical { border-color: rgba(239,68,68,0.45); background: rgba(239,68,68,0.08); animation: alarm-pulse 1.2s infinite; }
.dsc--critical .dsc-icon   { color: var(--red); }
.dsc--critical .dsc-status { color: var(--red); }
.dsc--warning  { border-color: rgba(249,115,22,0.35); background: rgba(249,115,22,0.06); }
.dsc--warning .dsc-icon   { color: var(--orange); }
.dsc--warning .dsc-status { color: var(--orange); }
.dsc--alarm    { border-color: rgba(239,68,68,0.45); background: rgba(239,68,68,0.1); animation: alarm-pulse 1s infinite; }
.dsc--alarm .dsc-icon   { color: var(--red); }
.dsc--alarm .dsc-status { color: var(--red); }
.dsc--danger   { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.06); }
.dsc--danger .dsc-icon   { color: var(--red); }
.dsc--danger .dsc-status { color: var(--red); }

/* ═══════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.875rem; }

/* ═══════════════════════════════════════════════
   API DOCS
   ═══════════════════════════════════════════════ */

.api-docs-wrap { padding-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.api-intro-card .api-desc { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 14px; }
.api-base-url, .api-example {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.api-label { color: var(--text-muted); white-space: nowrap; font-size: 0.72rem; }
.api-base-url code, .api-example code { color: var(--accent); font-family: var(--font-mono); }
.btn-copy { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text-muted); border-radius: 4px; padding: 4px 8px; font-size: 0.72rem; transition: var(--transition); cursor: pointer; }
.btn-copy:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.api-auth-info { margin-top: 14px; }
.api-auth-info h4 { font-size: 0.875rem; color: var(--text-primary); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.api-auth-info p  { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; }
.api-auth-info ul { font-size: 0.8rem; color: var(--text-secondary); padding-left: 20px; margin-bottom: 10px; }
.api-auth-info li { margin-bottom: 4px; }
.api-ex-label { color: var(--text-muted); font-size: 0.72rem; }
.api-note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  margin-top: 10px;
}
.api-note--warning  { background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.25); color: var(--yellow); }
.api-note--critical { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }

.api-section-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.api-section { display: flex; flex-direction: column; gap: 10px; }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }

.api-endpoint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.api-endpoint--danger  { border-color: rgba(239,68,68,0.25); }
.api-endpoint--success { border-color: rgba(34,197,94,0.2); }
.api-endpoint--critical { border-color: rgba(239,68,68,0.4); }

.api-ep-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 8px;
}
.api-ep-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.method-badge { font-size: 0.65rem; font-weight: 800; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.08em; }
.method-get  { background: rgba(34,197,94,0.2); color: var(--green); }
.method-post { background: rgba(249,115,22,0.2); color: var(--orange); }

.ep-path { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent); }
.ep-desc { font-size: 0.78rem; color: var(--text-muted); }

.code-block {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #a3e635;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
}
.re-label { font-size: 0.7rem; color: var(--text-muted); display: block; margin-bottom: 5px; }
.api-try { display: flex; justify-content: flex-end; }
.params-table { width: 100%; font-size: 0.78rem; border-collapse: collapse; }
.params-table td { padding: 4px 8px; color: var(--text-secondary); }
.params-table td:first-child { font-family: var(--font-mono); color: var(--accent); }
.params-table td:nth-child(2) { color: var(--text-muted); }

.api-tester-card .card-body { padding: 16px; }
.tester-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; flex-wrap: wrap; }
.tester-method { width: 90px; flex-shrink: 0; }
.tester-url { flex: 1; min-width: 200px; }
.tester-body-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.tester-body-row label { font-size: 0.7rem; color: var(--text-muted); }
.tester-response { margin-top: 10px; }
.tester-resp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.75rem; color: var(--text-muted); }
.tester-status-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.tsb--ok  { background: rgba(34,197,94,0.2); color: var(--green); }
.tsb--err { background: rgba(239,68,68,0.2); color: var(--red); }

/* ═══════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════ */

.login-body { margin: 0; padding: 0; background: #05090f; overflow: hidden; min-height: 100vh; }

.login-bg {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(37,99,235,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.07) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-drift 30s linear infinite;
}
@keyframes grid-drift { from { background-position: 0 0; } to { background-position: 50px 50px; } }

.login-scanline {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.05) 3px,
    rgba(0,0,0,0.05) 4px
  );
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orb-float 12s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: rgba(37,99,235,0.12); top: -100px; right: -100px; animation-delay: 0s; }
.orb-2 { width: 300px; height: 300px; background: rgba(14,165,233,0.1); bottom: -80px; left: -80px; animation-delay: -5s; }
.orb-3 { width: 250px; height: 250px; background: rgba(234,179,8,0.06); top: 40%; left: 40%; animation-delay: -8s; }
@keyframes orb-float {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(30px,-20px) scale(1.05); }
  66%      { transform: translate(-20px,30px) scale(0.95); }
}

.login-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  z-index: 10;
}

/* ── Login Left Panel ── */
.login-left {
  flex: 0 0 480px;
  background: linear-gradient(145deg, rgba(10,18,38,0.97), rgba(7,13,26,0.99));
  border-right: 1px solid rgba(37,99,235,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
}

.login-left-inner { text-align: center; max-width: 360px; }

.ll-logo-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 24px;
}
.ll-logo-svg {
  width: 150px; height: 150px;
  filter: drop-shadow(0 0 24px rgba(255,215,0,0.35));
  animation: logo-glow 3s ease-in-out infinite;
}
@keyframes logo-glow {
  0%,100% { filter: drop-shadow(0 0 18px rgba(255,215,0,0.3)); }
  50%      { filter: drop-shadow(0 0 32px rgba(255,215,0,0.55)); }
}
.ll-logo-ring {
  position: absolute;
  inset: -12px;
  border: 2px solid rgba(255,215,0,0.2);
  border-radius: 50%;
  animation: ring-spin 8s linear infinite;
}
@keyframes ring-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.ll-org {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  color: #FFD700;
  letter-spacing: 0.1em;
  text-shadow: 0 0 30px rgba(255,215,0,0.4);
  margin-bottom: 4px;
}
.ll-org-full { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.04em; margin-bottom: 18px; }

.ll-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
}
.ll-divider span:first-child, .ll-divider span:last-child {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37,99,235,0.4));
}
.ll-divider span:last-child { background: linear-gradient(270deg, transparent, rgba(37,99,235,0.4)); }
.ll-divider-icon { color: var(--primary-light); font-size: 0.8rem; }

.ll-project { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.ll-project-sub { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 24px; }

.ll-features { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.ll-feat {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--radius-xs);
  padding: 8px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.ll-feat i { color: var(--primary-light); width: 16px; text-align: center; }

.ll-tagline {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ── Login Right Panel ── */
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
  background: linear-gradient(145deg, rgba(7,13,26,0.97), rgba(5,9,15,0.99));
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(37,99,235,0.1);
  position: relative;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
  border-radius: 2px;
}

.lc-top { text-align: center; margin-bottom: 28px; }
.lc-badge {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, rgba(37,99,235,0.2), rgba(14,165,233,0.1));
  border: 1px solid rgba(37,99,235,0.3);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--primary-light);
  margin-bottom: 14px;
  box-shadow: 0 0 24px rgba(37,99,235,0.2);
}
.lc-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.lc-sub   { font-size: 0.75rem; color: var(--text-muted); }

.lc-error {
  display: flex; align-items: center; gap: 8px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #fca5a5;
  margin-bottom: 18px;
}

.lc-form { display: flex; flex-direction: column; gap: 16px; }
.lc-field { display: flex; flex-direction: column; gap: 5px; }
.lc-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; display: flex; align-items: center; gap: 5px; }
.lc-input-wrap { position: relative; }
.lc-input {
  width: 100%;
  background: rgba(10,21,38,0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  transition: var(--transition);
}
.lc-input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); background: rgba(15,25,48,0.9); }
.lc-input::placeholder { color: var(--text-dim); }
.lc-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 0.85rem; padding: 4px;
  transition: var(--transition);
}
.lc-eye:hover { color: var(--text-secondary); }

.lc-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
  font-family: var(--font-main);
  box-shadow: 0 4px 20px rgba(37,99,235,0.3);
}
.lc-submit:hover { box-shadow: 0 6px 28px rgba(37,99,235,0.5); transform: translateY(-1px); }
.lc-submit:active { transform: translateY(0); }
.lc-submit:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.lc-footer {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .wl-main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-close-btn { display: flex; }
  .topbar { left: 0; padding: 0 16px; }
  .topbar-menu-btn { display: flex; }
  .main-content { margin-left: 0; }
  .main-content > * { padding-left: 16px; padding-right: 16px; }
  .topbar-clock { display: none; }
  .login-wrapper { flex-direction: column; }
  .login-left { flex: none; border-right: none; border-bottom: 1px solid rgba(37,99,235,0.2); padding: 28px 24px; }
  .login-right { padding: 28px 20px; }
  .global-controls-row { flex-direction: column; }
  .filter-row { gap: 8px; }
  .cp-grid { grid-template-columns: 1fr; }
  .location-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .stats-row { grid-template-columns: 1fr; }
  .device-grid { grid-template-columns: repeat(2, 1fr); }
  .wl-banner { flex-direction: column; align-items: flex-start; }
}
