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

:root {
  --bg:        #050D1A;
  --card:      #0A1628;
  --card2:     #0D1E35;
  --border:    #1A2E50;
  --blue:      #0EA5E9;
  --purple:    #A855F7;
  --green:     #00E676;
  --amber:     #FFB300;
  --red:       #FF1744;
  --text:      #E8F4FD;
  --muted:     #6B8CAE;
  --nav-h:     64px;
}

body {
  font-family: 'Inter', sans-serif;
  background: #020810;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── DESKTOP WRAPPER ──────────────────────────────────────── */
.desktop-bg {
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 20%, #0A1628 0%, #020810 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 16px 40px;
  gap: 20px;
}

.preview-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── PHONE FRAME ──────────────────────────────────────────── */
.phone-frame {
  width: 375px;
  height: 780px;
  background: #0A1628;
  border-radius: 44px;
  border: 2px solid #1A2E50;
  box-shadow:
    0 0 0 6px #050D1A,
    0 0 0 8px #1A2E50,
    0 40px 80px rgba(0,0,0,0.8),
    0 0 60px rgba(14,165,233,0.08);
  position: relative;
  overflow: hidden;
}

.phone-notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 28px;
  background: #050D1A;
  border-radius: 0 0 18px 18px;
  z-index: 100;
}

.phone-screen {
  width: 100%; height: 100%;
  border-radius: 42px;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

/* ── SCREENS ──────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.screen.active {
  display: flex;
  opacity: 1;
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 16px 0;
  scrollbar-width: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }

/* ── SPLASH ───────────────────────────────────────────────── */
.splash-bg {
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 40%, #0D2040 0%, #050D1A 70%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.splash-glow {
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(14,165,233,0.15) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,100% { opacity: 0.6; transform: translate(-50%,-60%) scale(1); }
  50% { opacity: 1; transform: translate(-50%,-60%) scale(1.15); }
}
.splash-content {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 1;
}
.splash-logo {
  width: 100px; height: 100px;
  position: relative; display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.logo-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid rgba(14,165,233,0.3);
  animation: ringPulse 2s ease-in-out infinite;
}
.ring1 { width: 80px; height: 80px; animation-delay: 0s; }
.ring2 { width: 100px; height: 100px; animation-delay: 0.5s; border-color: rgba(14,165,233,0.15); }
@keyframes ringPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
}
.logo-icon {
  font-size: 40px; z-index: 1;
  filter: drop-shadow(0 0 16px rgba(14,165,233,0.8));
  animation: iconFloat 2s ease-in-out infinite;
}
@keyframes iconFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.splash-title {
  font-size: 32px; font-weight: 800; letter-spacing: 0.15em;
  color: var(--text);
  text-shadow: 0 0 20px rgba(14,165,233,0.5);
}
.splash-subtitle {
  font-size: 14px; font-weight: 600; letter-spacing: 0.3em;
  color: var(--blue);
}
.splash-tagline {
  font-size: 12px; color: var(--muted); letter-spacing: 0.05em;
  margin-top: 4px;
}
.splash-loader {
  width: 160px; height: 3px;
  background: var(--border);
  border-radius: 2px; margin-top: 32px; overflow: hidden;
}
.loader-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--blue), #7C3AED);
  border-radius: 2px;
  animation: loadFill 2.5s ease-in-out forwards;
}
@keyframes loadFill {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ── LOGIN ────────────────────────────────────────────────── */
.login-bg {
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 0%, #0D2040 0%, #050D1A 60%);
  overflow-y: auto; scrollbar-width: none;
}
.login-bg::-webkit-scrollbar { display: none; }
.login-glow {
  position: absolute; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, transparent 70%);
  top: 0; left: 50%; transform: translateX(-50%);
}
.login-content {
  padding: 60px 28px 40px;
  display: flex; flex-direction: column; gap: 0;
  position: relative; z-index: 1;
}
.login-logo-sm {
  font-size: 36px; text-align: center; margin-bottom: 16px;
  filter: drop-shadow(0 0 12px rgba(14,165,233,0.6));
}
.login-title {
  font-size: 24px; font-weight: 800; color: var(--text);
  text-align: center; margin-bottom: 6px;
}
.login-sub {
  font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 28px;
}
.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.05em; }
.form-input {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 14px;
}
.input-icon { font-size: 16px; opacity: 0.6; }
.input-placeholder { color: var(--muted); font-size: 14px; }

.btn-primary {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--blue), #0284C7);
  border: none; border-radius: 14px;
  color: white; font-size: 14px; font-weight: 700; letter-spacing: 0.08em;
  cursor: pointer; margin-top: 8px; margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(14,165,233,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(14,165,233,0.4); }
.btn-primary:active { transform: translateY(0); }

.divider-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  color: var(--muted); font-size: 12px;
}
.divider-row::before, .divider-row::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-google {
  width: 100%; padding: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 20px; transition: background 0.15s;
}
.btn-google:hover { background: var(--card2); }

.login-footer { font-size: 13px; color: var(--muted); text-align: center; }
.link-text { color: var(--blue); font-weight: 600; cursor: pointer; }

/* ── SCREEN HEADER ────────────────────────────────────────── */
.screen-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px; padding-top: 8px;
}
.header-greeting { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.header-name { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: 0.02em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.notif-btn {
  width: 38px; height: 38px; background: var(--card);
  border-radius: 12px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; position: relative;
}
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: white;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--blue), #7C3AED);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
}

/* ── DEVICE BANNER ────────────────────────────────────────── */
.device-banner {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.device-banner-left { display: flex; align-items: center; gap: 10px; }
.device-banner-name { font-size: 14px; font-weight: 700; color: var(--text); }
.device-banner-sub { font-size: 11px; color: var(--muted); }
.badge-active {
  background: rgba(0,230,118,0.12); color: var(--green);
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(0,230,118,0.25);
}
.badge-low {
  background: rgba(0,230,118,0.12); color: var(--green);
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(0,230,118,0.25);
}
.badge-admin {
  background: rgba(14,165,233,0.12); color: var(--blue);
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(14,165,233,0.25);
  display: inline-block; margin-top: 4px;
}

/* ── ONLINE DOTS ──────────────────────────────────────────── */
.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
}
.online-dot.pulse { animation: dotPulse 1.5s ease-in-out infinite; }
@keyframes dotPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.4); }
  50% { box-shadow: 0 0 0 5px rgba(0,230,118,0); }
}
.offline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.online-text { font-size: 11px; color: var(--green); font-weight: 600; }
.offline-text { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ── METRIC CARDS ─────────────────────────────────────────── */
.metrics-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 14px;
}
.metric-card {
  background: var(--card); border-radius: 16px;
  padding: 14px; border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.metric-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  border-radius: 16px 16px 0 0;
}
.metric-card.blue::before { background: var(--blue); }
.metric-card.purple::before { background: var(--purple); }
.metric-card.green::before { background: var(--green); }
.metric-card.amber::before { background: var(--amber); }

.metric-icon { font-size: 18px; margin-bottom: 6px; }
.metric-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.metric-unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.metric-label { font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.metric-trend { font-size: 10px; margin-top: 4px; font-weight: 600; }
.metric-trend.up { color: var(--green); }
.metric-trend.stable { color: var(--green); }
.metric-trend.warn { color: var(--amber); }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px; margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.03em; }
.chart-range {
  font-size: 11px; color: var(--blue); font-weight: 600;
  background: rgba(14,165,233,0.1); padding: 3px 8px; border-radius: 6px;
}

/* ── AI RISK GAUGE ────────────────────────────────────────── */
.ai-risk-card { }
.gauge-container { display: flex; justify-content: center; margin: -4px 0 4px; }
.gauge-svg { width: 180px; }
.ai-insight {
  font-size: 11px; color: var(--muted); text-align: center;
  background: rgba(0,230,118,0.05); border: 1px solid rgba(0,230,118,0.15);
  border-radius: 8px; padding: 8px 10px; margin-top: 4px;
}

/* ── CHARTS ───────────────────────────────────────────────── */
.mini-chart { height: 70px; }
.chart-area { height: 80px; }
.chart-svg { width: 100%; height: 100%; }

/* ── CONTROLS ─────────────────────────────────────────────── */
.controls-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.control-btn {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; transition: border-color 0.15s;
}
.control-btn:hover { border-color: var(--blue); }
.active-ctrl { border-color: rgba(14,165,233,0.4); background: rgba(14,165,233,0.06); }
.danger-ctrl { border-color: rgba(255,23,68,0.2); }
.ctrl-icon { font-size: 18px; }
.ctrl-label { font-size: 9px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; }
.ctrl-state { font-size: 9px; font-weight: 700; }
.ctrl-state.on { color: var(--green); }
.ctrl-state.off { color: var(--muted); }

/* ── DEVICES SCREEN ───────────────────────────────────────── */
.btn-sm-blue {
  background: rgba(14,165,233,0.12); color: var(--blue);
  border: 1px solid rgba(14,165,233,0.3); border-radius: 10px;
  padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-sm-muted {
  background: var(--card); color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 11px; font-weight: 600; cursor: pointer;
}

.device-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px; margin-bottom: 12px;
}
.active-device { border-color: rgba(14,165,233,0.3); }
.dc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dc-icon {
  width: 40px; height: 40px; background: var(--card2);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; border: 1px solid var(--border); flex-shrink: 0;
}
.active-icon { border-color: rgba(14,165,233,0.3); background: rgba(14,165,233,0.08); }
.dc-info { flex: 1; min-width: 0; }
.dc-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dc-name { font-size: 14px; font-weight: 700; color: var(--text); }
.dc-id { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dc-online { display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; }
.dc-divider { height: 1px; background: var(--border); margin-bottom: 10px; }
.dc-metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 4px; margin-bottom: 10px; }
.dc-metric { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dcm-icon { font-size: 12px; }
.dcm-val { font-size: 12px; font-weight: 700; }
.dcm-lbl { font-size: 9px; color: var(--muted); }
.dc-footer { font-size: 10px; color: var(--muted); }

/* ── ANALYTICS SCREEN ─────────────────────────────────────── */
.range-pills { display: flex; gap: 6px; }
.pill {
  padding: 5px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  transition: all 0.15s;
}
.active-pill {
  background: rgba(14,165,233,0.15); color: var(--blue);
  border-color: rgba(14,165,233,0.4);
}

.stats-row {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 14px;
}
.stat-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 8px; text-align: center;
}
.stat-val { font-size: 13px; font-weight: 800; }
.stat-lbl { font-size: 9px; color: var(--muted); margin-top: 2px; }

/* ── ALERTS SCREEN ────────────────────────────────────────── */
.filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.alert-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px; margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 12px;
  position: relative;
}
.alert-item.unread { border-left: 3px solid; }
.alert-item.critical.unread { border-left-color: var(--red); }
.alert-item.warning.unread { border-left-color: var(--amber); }
.alert-item.info.unread { border-left-color: var(--blue); }

.alert-icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.critical-bg { background: rgba(255,23,68,0.12); }
.warning-bg { background: rgba(255,179,0,0.12); }
.info-bg { background: rgba(14,165,233,0.12); }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.alert-msg { font-size: 11px; color: var(--muted); margin-bottom: 4px; line-height: 1.4; }
.alert-time { font-size: 10px; color: var(--muted); opacity: 0.7; }
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0; margin-top: 4px;
}

/* ── SETTINGS SCREEN ──────────────────────────────────────── */
.profile-card { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.profile-avatar {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--blue), #7C3AED);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 22px; flex-shrink: 0;
}
.profile-name { font-size: 16px; font-weight: 700; color: var(--text); }
.profile-email { font-size: 12px; color: var(--muted); margin-top: 2px; }

.settings-section-title {
  font-size: 10px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.12em; padding: 0 4px; margin-bottom: 6px; margin-top: 4px;
}
.settings-card { padding: 0; overflow: hidden; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
}
.setting-label { font-size: 13px; color: var(--text); font-weight: 500; }
.setting-value { font-size: 13px; font-weight: 600; }
.setting-divider { height: 1px; background: var(--border); margin: 0 14px; }

.toggle {
  width: 42px; height: 24px; border-radius: 12px; position: relative; cursor: pointer;
  transition: background 0.2s;
}
.toggle::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%; background: white;
  top: 3px; transition: left 0.2s;
}
.toggle.on { background: var(--green); }
.toggle.on::after { left: 21px; }
.toggle.off { background: var(--border); }
.toggle.off::after { left: 3px; }

/* ── BOTTOM NAV ───────────────────────────────────────────── */
.bottom-nav {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(10,22,40,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 4px 8px;
  z-index: 50;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 8px 4px; cursor: pointer;
  border-radius: 12px; transition: background 0.15s;
  position: relative;
}
.nav-item:hover { background: rgba(14,165,233,0.06); }
.nav-item.active .nav-icon { filter: none; }
.nav-item.active .nav-label { color: var(--blue); }
.nav-icon { font-size: 20px; position: relative; filter: grayscale(0.5) opacity(0.6); }
.nav-item.active .nav-icon { filter: none; }
.nav-label { font-size: 9px; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; }
.nav-badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--red); color: white;
  font-size: 8px; font-weight: 700;
  width: 14px; height: 14px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── SCREEN NAV LABELS ────────────────────────────────────── */
.screen-nav-labels {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-width: 500px;
}
.snl-btn {
  padding: 7px 16px; border-radius: 20px;
  background: rgba(10,22,40,0.8); border: 1px solid #1A2E50;
  color: #6B8CAE; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; font-family: 'Inter', sans-serif;
}
.snl-btn:hover { border-color: var(--blue); color: var(--blue); }
.snl-btn.active { background: rgba(14,165,233,0.15); border-color: var(--blue); color: var(--blue); }

/* ── COLOR UTILITIES ──────────────────────────────────────── */
.blue-t   { color: var(--blue); }
.green-t  { color: var(--green); }
.amber-t  { color: var(--amber); }
.purple-t { color: var(--purple); }
.red-t    { color: var(--red); }
.muted-t  { color: var(--muted); }