:root {
  --bg: #0f1117;
  --panel: #171a23;
  --border: #262a36;
  --text: #e6e8ee;
  --muted: #9aa0ad;
  --accent: #4f7cff;
  --good: #2ecc71;
  --bad: #ff5c5c;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.login-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card h1 { margin: 0; font-size: 20px; }
.login-card .subtitle { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.login-card input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d0f15;
  color: var(--text);
}
.login-card button {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.error { color: var(--bad); font-size: 13px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.last-sync { color: var(--muted); font-size: 12px; }
.topbar button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 13px;
}
.topbar button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.tile-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.tile-value { font-size: 24px; font-weight: 700; }
.tile-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }

.range-form { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.range-form input {
  background: #0d0f15;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}
.range-form button {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.badge-good { color: var(--good); font-weight: 600; }
.badge-bad { color: var(--bad); font-weight: 600; }

/* Revenue and ROAS are the headline numbers, so they get a lift off the row. */
.tile-revenue { border-color: rgba(46, 204, 113, 0.35); }
.tile-roas { border-color: rgba(79, 124, 255, 0.45); }
.tile-roas .tile-value { font-size: 28px; }

.chart-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 32px;
}
.chart-section h2 { margin-top: 0; font-size: 15px; color: var(--muted); }

.leads-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}
.leads-header { display: flex; justify-content: space-between; align-items: center; }
.leads-header h2 { font-size: 15px; color: var(--muted); margin: 0; }
.filters a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 8px;
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.filters a:hover { color: var(--text); border-color: var(--muted); }
.filters a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.leads-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-left: 8px;
}

table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
tr.row-converted { background: rgba(46, 204, 113, 0.06); }
