:root {
  --bg: #0b0e14;
  --surface: #131822;
  --surface-2: #1a2130;
  --border: #252f42;
  --text: #e6edf7;
  --muted: #93a1b8;
  --accent: #60a5fa;
  --green: #34d399;
  --orange: #fb923c;
  --red: #f87171;
  --purple: #a78bfa;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.lock-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(96, 165, 250, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type="password"],
.search-input,
.select-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
}

#login-btn {
  background: var(--accent);
  color: #06101e;
}

.error-msg {
  color: var(--red);
  font-size: 13px;
  margin: 12px 0 0;
}

.footnote {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* App Shell */
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.14);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0;
}

.tab {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  color: #06101e;
  border-color: var(--accent);
}

.banner {
  background: rgba(251, 146, 60, 0.14);
  border: 1px solid rgba(251, 146, 60, 0.35);
  color: #fed7aa;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}

.pill-green {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
}

.pill-muted {
  color: var(--muted);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.project-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-decoration: none;
  color: var(--text);
}

.project-item:hover {
  border-color: var(--accent);
}

.project-title {
  font-weight: 600;
  font-size: 14px;
}

.project-meta {
  font-size: 12px;
  color: var(--muted);
}

.num-pos { color: var(--green); }
.num-neg { color: var(--red); }

a.ext-link {
  color: var(--accent);
  text-decoration: none;
}
