:root {
  --bg-base: #0a0e17;
  --bg-panel: #101728;
  --bg-panel-raised: #151d33;
  --bg-hover: #1b2440;
  --border-subtle: #232d47;

  --accent: #22d3c9;        /* teal — primary brand accent */
  --accent-dim: #158f88;
  --accent-glow: rgba(34, 211, 201, 0.15);

  --text-primary: #eef1f8;
  --text-secondary: #9aa4c0;
  --text-muted: #626e8f;

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --radius: 10px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

/* ---------- Guest layout (login) ---------- */
.guest-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, var(--accent-glow), transparent 40%),
    var(--bg-base);
}

.guest-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 36px 32px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-mark .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.brand-mark .name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-mark .name span { color: var(--accent); }

.guest-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.guest-card p.sub {
  color: var(--text-secondary);
  margin: 0 0 24px;
  font-size: 13px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  border: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #06161a;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-dim); }

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

/* ---------- App layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand-mark { padding: 0 6px; margin-bottom: 32px; }

.nav-group { margin-bottom: 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
}

.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.user-chip .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 6px;
}
.logout-btn:hover { color: var(--danger); }

.main {
  padding: 28px 36px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 20px; margin: 0; }
.page-header .sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* ---------- Metric cards ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.metric-card .label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-card .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.metric-card .value.accent { color: var(--accent); }

/* ---------- Panels / tables ---------- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.panel h2 {
  font-size: 14px;
  margin: 0 0 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13.5px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pending { background: rgba(251, 191, 36, 0.12); color: var(--warning); }
.badge-completed { background: rgba(52, 211, 153, 0.12); color: var(--success); }
.badge-researching { background: var(--accent-glow); color: var(--accent); }
.badge-failed { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.badge-unknown { background: rgba(154, 164, 192, 0.12); color: var(--text-secondary); }

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  background: var(--accent-glow);
  color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-box {
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  width: 260px;
}

.pipeline-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-stage {
  min-width: 120px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.pipeline-stage .count {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.pipeline-stage .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  justify-content: flex-end;
}

.pagination a, .pagination span {
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #06161a; border-color: var(--accent); }

/* The closed dropdown box picks up our dark theme fine, but the actual
   pop-open list of options is drawn by the browser itself and ignores
   most of our styling — it was showing white text on its own white
   background, invisible until hovered. Forcing plain dark text on every
   option fixes it everywhere a dropdown is used across the app. */
select option {
  color: #111111;
  background: #ffffff;
}
