@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg:       #0f172a;
  --surface:  #1e293b;
  --surface2: #263348;
  --border:   #334155;
  --text:     #f1f5f9;
  --muted:    #94a3b8;
  --blue:     #2563eb;
  --blue-h:   #1d4ed8;
  --green:    #16a34a;
  --red:      #ef4444;
  --orange:   #f97316;
  --purple:   #7c3aed;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.admin-header {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}
.admin-logo svg { color: var(--blue); }

.admin-badge {
  background: rgba(37,99,235,0.15);
  border: 1px solid rgba(37,99,235,0.35);
  color: #93c5fd;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.admin-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s;
}
.admin-header a:hover { color: var(--text); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Main content ── */
.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 28px 60px;
}

.admin-page-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}
.admin-page-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

/* ── Stats cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Plan badges section ── */
.plans-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.plans-row-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-right: 4px;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid;
}

.plan-badge.scout   { background: rgba(148,163,184,0.1); border-color: rgba(148,163,184,0.3); color: #94a3b8; }
.plan-badge.starter { background: rgba(37,99,235,0.12);  border-color: rgba(37,99,235,0.3);  color: #93c5fd; }
.plan-badge.closer  { background: rgba(124,58,237,0.12); border-color: rgba(124,58,237,0.3); color: #c4b5fd; }
.plan-badge.agency  { background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.3); color: #fdba74; }
.plan-badge.partner { background: rgba(22,163,74,0.12);  border-color: rgba(22,163,74,0.3);  color: #86efac; }

/* ── Table section ── */
.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

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

.table-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.table-search {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  width: 220px;
  transition: border-color 0.15s;
}
.table-search::placeholder { color: #475569; }
.table-search:focus { border-color: var(--blue); }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}

tbody tr {
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

tbody td {
  padding: 11px 14px;
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}

.td-email { color: var(--text); font-weight: 500; }
.td-muted { color: var(--muted); }

/* inline plan select */
.plan-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}
.plan-select:focus { border-color: var(--blue); }

/* action buttons */
.btn-action {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-action:hover { border-color: var(--blue); color: var(--blue); }
.btn-action.danger:hover { border-color: var(--red); color: var(--red); }
.btn-action.admin-active { border-color: var(--purple); color: #c4b5fd; }

/* subscription status chip */
.sub-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}
.sub-chip.active   { background: rgba(22,163,74,0.15);   color: #86efac; }
.sub-chip.inactive { background: rgba(148,163,184,0.1);  color: #94a3b8; }
.sub-chip.canceled { background: rgba(239,68,68,0.12);   color: #fca5a5; }

/* ── Loading / error states ── */
.state-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.state-message h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 8px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .admin-main { padding: 20px 16px 40px; }
  .table-search { width: 100%; }
  .table-header { flex-direction: column; align-items: flex-start; }
}
