:root {
  --bg: #0f1216;
  --card: #171c23;
  --line: #232b35;
  --text: #e6e9ee;
  --muted: #8a93a0;
  --accent: #4c8dff;
  --ok: #34d399;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; }
.error { color: #f87171; min-height: 18px; margin: 8px 0 0; }

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

/* --- login --- */
.login { max-width: 320px; margin: 12vh auto; }
.login form { display: flex; flex-direction: column; gap: 10px; }
input, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 10px 12px;
}
input { background: #0d1117; color: var(--text); }
button {
  background: var(--accent); color: #fff; border-color: transparent;
  cursor: pointer; font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.active { background: var(--accent); color: #fff; }
.periods button:not(.active):not(.ghost) { background: #1f2630; color: var(--text); }

/* --- dashboard --- */
#dashboard, #panel { max-width: 1040px; margin: 0 auto; padding: 20px 16px 60px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.topbar strong { margin-left: 6px; font-family: ui-monospace, monospace; }
.periods { display: flex; gap: 8px; }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); margin-left: 8px; vertical-align: middle;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 26px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 760px) { .cards, .grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td { font-family: ui-monospace, monospace; font-size: 13px; }
.geo td:nth-child(2) { text-align: right; }
.funnel td:nth-child(2), .funnel td:nth-child(3), .funnel td:nth-child(4), .funnel td:nth-child(5) { text-align: right; }
.bar { height: 6px; background: var(--accent); border-radius: 4px; min-width: 2px; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.chart .col { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.chart .col:hover { opacity: 1; }

/* --- admin panel extras --- */
button.small { padding: 5px 10px; font-size: 12px; font-weight: 500; }
.cred {
  font-family: ui-monospace, monospace; display: inline-block; margin-top: 8px;
  background: #0d1117; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; user-select: all;
}
#new-adv-box { border-color: var(--accent); margin-bottom: 12px; }
table.adv tr.sel td { background: #1b2430; }
.detail-title { margin: 4px 0 12px; font-size: 15px; }
.detail-title strong { font-family: ui-monospace, monospace; }
#detail .geo td:nth-child(2), #detail .geo td:nth-child(3), #detail .geo td:nth-child(4) { text-align: right; }

.hits-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hits-filters { display: flex; gap: 8px; align-items: center; }
select {
  font: inherit; background: #0d1117; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer;
}
.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
button:disabled { opacity: .4; cursor: default; }
.lead-yes { color: var(--ok); font-weight: 600; }
.lead-no { color: var(--muted); }
