:root {
  --bg: #0B0F1A;
  --surface: #111827;
  --surface-2: #161f30;
  --border: rgba(148,163,184,0.14);
  --blue: #638CFF;
  --green: #34D399;
  --orange: #F59E42;
  --red: #EF4444;
  --text: #E5E9F5;
  --muted: #8B93A7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg, rgba(99,140,255,0.10), rgba(11,15,26,0));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 22px;
}
.navbar-brand { font-weight: 700; font-size: 15px; }
.navbar-brand span { color: var(--blue); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; display: block; font-weight: 600; }
.navbar-links { display: flex; align-items: center; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.navbar-user { color: var(--muted); font-size: 13px; }
.btn-logout {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red) !important;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
}
.btn-logout:hover { text-decoration: none; background: rgba(239,68,68,0.2); }
.nav-active { color: var(--text) !important; border-bottom: 2px solid var(--blue); padding-bottom: 2px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

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

@media (max-width: 720px) {
  .grid-2, .grid-main { grid-template-columns: 1fr; }
}

/* KPI cards */
.kpi { position: relative; overflow: hidden; }
.kpi::before {
  content: "";
  position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--accent, var(--blue));
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 260px; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; resize: vertical; }
.field { margin-bottom: 16px; }
.row-fields { display: flex; gap: 14px; flex-wrap: wrap; }
.row-fields .field { flex: 1; min-width: 160px; }

button, .btn {
  background: var(--blue);
  color: #0B0F1A;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text) !important; }
.btn-danger { background: var(--red); color: #fff; }

/* Alerts */
.alert { border-radius: 12px; padding: 14px 18px; margin-bottom: 18px; font-size: 13.5px; line-height: 1.6; }
.alert-success { background: rgba(52,211,153,0.08); border: 1px solid rgba(52,211,153,0.3); color: var(--green); }
.alert-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.35); color: var(--red); }
.alert-warning { background: rgba(245,158,66,0.08); border: 1px solid rgba(245,158,66,0.35); color: var(--orange); }
.alert p { color: var(--text); margin: 4px 0 0; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); padding: 6px 8px; font-weight: 500; }
td { padding: 8px 8px; border-top: 1px solid var(--border); }
.mono { font-family: 'SFMono-Regular', Consolas, monospace; color: var(--blue); }

/* Pills / badges */
.pill {
  display: inline-block;
  font-size: 11px;
  font-family: monospace;
  background: rgba(99,140,255,0.12);
  color: var(--blue);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(99,140,255,0.25);
  margin: 2px 4px 2px 0;
}

/* History cards */
.hist-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.hist-card:hover { border-color: var(--blue); text-decoration: none; }
.hist-card.active { border-color: var(--blue); background: rgba(99,140,255,0.06); }
.hist-month { font-weight: 600; font-size: 14px; }
.hist-stats { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Trend cards */
.trend-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.trend-text { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* Legend */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend-dot { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dash { width: 12px; height: 0; border-top: 2px dashed var(--muted); display: inline-block; }

.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 24px;
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box { width: 100%; max-width: 380px; }
.login-title { text-align: center; margin-bottom: 20px; }
.login-title .eyebrow { color: var(--blue); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.login-title h1 { font-size: 20px; margin: 6px 0 0; }
