*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f0f1a; --bg2: #1a1a2e; --bg3: #252540; --bg4: #2f2f4a;
  --text: #e8e8f0; --text2: #9b9bb0; --text3: #6b6b80;
  --accent: #E8A838; --accent-dim: #D4952E;
  --green: #10b981; --yellow: #f59e0b; --red: #ef4444; --blue: #3b82f6;
  --border: rgba(255,255,255,0.08); --radius: 12px; --radius-sm: 8px;
}
html { scroll-behavior: smooth; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
input, select, textarea, button { font-family: inherit; }

/* TOPBAR */
.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; color: var(--text); }
.topbar-logo i { color: var(--accent); }
.topbar-title { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; color: var(--text2); text-transform: uppercase; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 0.85rem;
  color: var(--text2); font-weight: 500; transition: all 0.2s;
}
.topbar-nav a:hover, .topbar-nav a.active { background: var(--bg3); color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 18px; font-size: 0.85rem; }
.btn-sm {
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 0.8rem;
  font-weight: 600; border: none; cursor: pointer; transition: all 0.2s;
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dim); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }

/* CARDS */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; padding: 20px 24px; }
.s-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.s-card-label { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
.s-card-value { font-size: 1.8rem; font-weight: 800; }
.s-card-value.ok { color: var(--green); }
.s-card-value.warn { color: var(--yellow); }
.s-card-value.err { color: var(--red); }
.s-card-value.info { color: var(--blue); }
.s-card-sub { font-size: 0.75rem; color: var(--text3); }

/* TABLE */
.table-wrap { padding: 0 24px 24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--bg2); border-radius: var(--radius); overflow: hidden; }
th { background: var(--bg3); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); text-align: left; padding: 12px 16px; font-weight: 600; }
td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--text2); }
tr:hover td { background: rgba(255,255,255,0.02); }
.badge { padding: 4px 12px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-ok { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-critical { background: rgba(239,68,68,0.18); color: var(--red); }
.badge-offline { background: rgba(107,107,128,0.15); color: var(--text3); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.modal h2 { font-size: 1.2rem; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* DASHBOARD LAYOUT */
.dash-layout { display: grid; grid-template-columns: 1fr 360px; min-height: calc(100vh - 52px); }
.dash-main { padding: 16px 24px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dash-sidebar {
  background: var(--bg2); border-left: 1px solid var(--border); padding: 28px;
  overflow-y: auto; box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}

/* RADIAL VIEW */
.radial-wrap { position: relative; width: 100%; max-width: 640px; aspect-ratio: 1; margin: 0 auto; }
.radial-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.radial-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 130px; height: 130px; background: var(--accent); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 0 50px rgba(232,168,56,0.35), 0 0 100px rgba(232,168,56,0.12);
  z-index: 2;
}
.radial-hub-title { font-size: 1.3rem; font-weight: 800; color: #fff; line-height: 1; }
.radial-hub-sub { font-size: 0.72rem; color: rgba(255,255,255,0.75); margin-top: 2px; }
.radial-hub-status {
  display: flex; align-items: center; gap: 5px; margin-top: 7px;
  background: rgba(0,0,0,0.25); padding: 3px 10px; border-radius: 100px;
}
.radial-hub-status span { font-size: 0.65rem; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: 0.05em; }
.radial-hub-status i { font-size: 0.45rem; color: var(--green); }

/* SENSOR NODES */
.sensor-node {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  cursor: pointer; text-align: center; transition: all 0.25s ease;
}
.sensor-node:hover { transform: translate(-50%, -50%) scale(1.08); }
.sensor-node.active { transform: translate(-50%, -50%) scale(1.12); }
.sensor-node-icon {
  width: 52px; height: 52px; border-radius: 10px;
  background: var(--bg3); border: 2px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; font-size: 1.3rem; color: var(--accent); transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.sensor-node.status-ok .sensor-node-icon { border-color: rgba(16,185,129,0.5); }
.sensor-node.status-warning .sensor-node-icon { border-color: var(--yellow); background: rgba(245,158,11,0.12); box-shadow: 0 0 18px rgba(245,158,11,0.2); }
.sensor-node.status-critical .sensor-node-icon { border-color: var(--red); background: rgba(239,68,68,0.15); color: var(--red); box-shadow: 0 0 22px rgba(239,68,68,0.3); }
.sensor-node.active .sensor-node-icon { border-color: var(--accent); box-shadow: 0 0 22px rgba(232,168,56,0.35); }
.sensor-node-card {
  position: absolute; white-space: nowrap;
  background: #f0f0f5; border: 1px solid rgba(255,255,255,0.15); border-radius: 10px;
  padding: 8px 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  pointer-events: none;
}
.sensor-node-label { font-size: 0.88rem; font-weight: 700; color: #2a2a3e; line-height: 1.2; }
.sensor-node-val { font-size: 0.82rem; color: #5a5a70; font-family: 'Outfit', sans-serif; }
.sensor-node.status-critical .sensor-node-card { background: #fef2f2; border-color: rgba(239,68,68,0.4); }
.sensor-node.status-critical .sensor-node-val { color: var(--red); font-weight: 700; }
.sensor-node.status-warning .sensor-node-card { background: #fefce8; border-color: rgba(245,158,11,0.3); }
.sensor-node.status-warning .sensor-node-val { color: #b45309; font-weight: 700; }

/* SIDEBAR INSPECTOR */
.inspector-empty { text-align: center; padding: 80px 0; color: var(--text3); font-size: 0.9rem; }
.inspector-top { display: flex; align-items: center; gap: 16px; margin-bottom: 0; }
.inspector-icon {
  width: 56px; height: 56px; border-radius: 14px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--accent); flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3); border: 1px solid var(--border);
}
.inspector-header { flex: 1; }
.inspector-type { font-size: 0.72rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; margin-bottom: 6px; }
.inspector-name { font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.inspector-divider { height: 1px; background: var(--border); margin: 20px 0; }
.inspector-value-wrap { text-align: center; padding: 8px 0; }
.inspector-value { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.inspector-unit { font-size: 1.1rem; color: var(--text3); font-weight: 400; vertical-align: top; }
.inspector-desc { font-size: 0.88rem; color: var(--text2); margin: 12px 0 0; line-height: 1.6; text-align: center; }
.inspector-spark {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; margin: 20px 0 16px; box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
}
.inspector-spark-header { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text3); margin-bottom: 10px; font-weight: 600; letter-spacing: 0.04em; }
.inspector-spec { font-size: 0.82rem; color: var(--text3); font-style: italic; text-align: center; line-height: 1.5; }

/* TOAST */
.toast-container { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; width: 520px; max-width: 90vw; }
.toast {
  background: var(--bg2); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px;
  padding: 18px 22px; width: 100%;
  animation: slideDown 0.35s ease; box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  display: flex; gap: 16px; align-items: center;
}
.toast.warning { border-left: 5px solid var(--yellow); }
.toast.critical { border-left: 5px solid var(--red); }
.toast-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.toast.warning .toast-icon { background: rgba(245,158,11,0.18); color: var(--yellow); }
.toast.critical .toast-icon { background: rgba(239,68,68,0.18); color: var(--red); }
.toast-body { flex: 1; min-width: 0; }
.toast-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.toast-title { font-size: 1rem; font-weight: 700; }
.toast-title.warning { color: var(--yellow); }
.toast-title.critical { color: var(--red); }
.toast-msg { font-size: 0.88rem; color: var(--text2); margin-top: 4px; line-height: 1.4; }
.toast-time { font-size: 0.75rem; color: var(--text3); flex-shrink: 0; }
@keyframes slideDown { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* STATUS DOTS */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--green); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.dot-warning { background: var(--yellow); box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.dot-critical { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.dot-offline { background: var(--text3); }

/* LOGIN */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 48px 40px; width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}
.login-logo { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.login-logo span { color: var(--accent); }
.login-sub { font-size: 0.9rem; color: var(--text3); margin-bottom: 32px; }
.login-box .form-group { text-align: left; }
.login-box .btn-accent { width: 100%; padding: 12px; font-size: 1rem; border-radius: var(--radius-sm); }
.login-error { color: var(--red); font-size: 0.85rem; margin-bottom: 12px; display: none; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { border-left: none; border-top: 1px solid var(--border); }
  .radial-wrap { max-width: 420px; }
  .topbar-nav { display: none; }
  .topbar-title { display: none; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .modal { margin: 16px; padding: 24px; }
  .radial-wrap { max-width: 300px; }
  .sensor-node-card { display: none; }
  .sensor-node-icon { width: 40px; height: 40px; font-size: 1rem; }
}
