@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

:root {
  --bg: #050505;
  --bg-elevated: #0c0c0f;
  --surface: #111116;
  --surface2: #18181f;
  --surface-hover: #1f1f28;
  --text: #f4f4f5;
  --muted: #71717a;
  --muted2: #52525b;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --cyan: #22d3ee;
  --accent2: #34d399;
  --warn: #fbbf24;
  --crit: #f87171;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --font: "DM Sans", system-ui, sans-serif;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(34, 211, 238, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--cyan); text-decoration: none; transition: color 0.15s; }
a:hover { color: #67e8f9; text-decoration: none; }

.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0a0a0c 0%, #060606 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 0.85rem; padding: 0.25rem 0.5rem 0.5rem; }
.svg-logo { width: 44px; height: 44px; flex-shrink: 0; filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.25)); }
.brand-text { display: flex; flex-direction: column; }
.brand-mark {
  font-weight: 700; font-size: 1.15rem; letter-spacing: 0.12em;
  background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.brand-sub { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.1rem; }

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 1.75rem; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm); color: var(--muted); font-size: 0.9rem; font-weight: 500;
  border: 1px solid transparent; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item .nav-icon { width: 22px; height: 22px; opacity: 0.65; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(34, 211, 238, 0.08));
  border-color: rgba(59, 130, 246, 0.25); color: var(--text);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.08);
}
.nav-item.active .nav-icon { opacity: 1; color: var(--cyan); }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 0.5rem; }
.user-pill {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.65rem;
  background: var(--surface2); border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 0.65rem;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #000;
}
.user-mini { font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.logout-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--muted); padding: 0.35rem 0.5rem; }
.logout-link .nav-icon { width: 18px; height: 18px; }
.logout-link:hover { color: var(--crit); }

.main { flex: 1; padding: 1.75rem 2rem 2.5rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem; }
.page-head h1 { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; position: relative; overflow: hidden; transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-card::after {
  content: ""; position: absolute; top: 0; right: 0; width: 100px; height: 100px;
  background: radial-gradient(circle, var(--stat-glow, rgba(59,130,246,0.12)) 0%, transparent 70%); pointer-events: none;
}
.stat-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.stat-card h3 { margin: 0; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--stat-color, var(--cyan));
}
.stat-icon-wrap .nav-icon { width: 22px; height: 22px; }
.stat { font-size: 2.15rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stat-card.stat-green { --stat-color: var(--accent2); --stat-glow: rgba(52, 211, 153, 0.15); }
.stat-card.stat-amber { --stat-color: var(--warn); --stat-glow: rgba(251, 191, 36, 0.12); }
.stat-card.stat-blue { --stat-color: var(--accent); --stat-glow: rgba(59, 130, 246, 0.15); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.card-title { margin: 0 0 1rem; font-size: 0.95rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.card h3 { margin: 0 0 0.5rem; font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.75rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted2); font-weight: 600; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.55rem;
  border-radius: 999px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; border: 1px solid transparent;
}
.badge-online { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.25); }
.badge-offline { background: rgba(113, 113, 122, 0.15); color: #a1a1aa; border-color: rgba(113, 113, 122, 0.2); }
.badge-warning { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border-color: rgba(251, 191, 36, 0.25); }
.badge-maintenance { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }
.sev-critical { background: rgba(248, 113, 113, 0.12); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.sev-warning { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border-color: rgba(251, 191, 36, 0.25); }
.sev-info { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1.15rem; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none; font-size: 0.88rem; box-shadow: 0 4px 20px var(--accent-glow);
  transition: filter 0.15s, transform 0.15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: none; }
.btn-secondary:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }

.form-group { margin-bottom: 1.1rem; }
label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; font-weight: 500; }
input, textarea, select {
  width: 100%; padding: 0.65rem 0.85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  font-family: inherit; font-size: 0.9rem; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: rgba(59, 130, 246, 0.5); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
textarea { min-height: 120px; resize: vertical; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; position: relative; z-index: 1; }
.auth-visual {
  display: flex; flex-direction: column; justify-content: center; padding: 3rem;
  background: linear-gradient(160deg, #0a0a0f 0%, #050505 50%, #0c0c12 100%);
  border-right: 1px solid var(--border); position: relative; overflow: hidden;
}
.auth-visual::before {
  content: ""; position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.15), transparent 70%); top: 20%; left: -10%;
}
.auth-visual .svg-logo { width: 72px; height: 72px; margin-bottom: 1.5rem; }
.auth-visual h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 0.75rem; }
.auth-visual p { color: var(--muted); max-width: 360px; font-size: 0.95rem; line-height: 1.6; }
.auth-features { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 1rem; }
.auth-feature { display: flex; gap: 0.85rem; align-items: flex-start; font-size: 0.85rem; color: var(--muted); }
.auth-feature .nav-icon { width: 20px; height: 20px; color: var(--cyan); flex-shrink: 0; margin-top: 0.1rem; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 0; background: transparent; border: none; box-shadow: none; }
.auth-card-inner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; position: relative; z-index: 1; }
.auth-card-wide { width: 100%; max-width: 720px; }

.flash { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.88rem; }
.flash-success { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.3); color: #6ee7b7; }
.flash-error { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.3); color: #fca5a5; }

.meter { height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 0.35rem; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 4px; }

.legal-hero {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(34, 211, 238, 0.04));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.5rem;
}
.legal-hero h2 { margin: 0 0 0.5rem; font-size: 1.35rem; }
.legal-meta { color: var(--muted); font-size: 0.9rem; }
.public-nav { text-align: center; margin-bottom: 1.25rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.public-nav a { font-size: 0.85rem; color: var(--muted); }
.public-nav a:hover { color: var(--cyan); }

details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-bottom: 0.65rem; background: var(--bg-elevated); }
summary { cursor: pointer; font-weight: 500; }
pre { background: #000; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; }
code { font-size: 0.78rem; color: var(--muted); }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .app { flex-direction: column; }
  .main { padding: 1.25rem; }
}
@media (max-width: 768px) {
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item span { display: none; }
  .nav-item { padding: 0.65rem; }
}
