/* Shared styling for the /admin dashboard — mobile-first, matches the
   clinic owner mostly checking this on a phone. Plain CSS, no build step. */

:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --good: #16a34a;
  --bad: #dc2626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
body.auth-pending { visibility: hidden; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-header .brand { font-weight: 700; font-size: 16px; }
.admin-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.admin-nav a {
  padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted);
  font-size: 14px; white-space: nowrap; font-weight: 500;
}
.admin-nav a.active { background: var(--accent-soft); color: var(--accent); }

.admin-main { padding: 16px; max-width: 1100px; margin: 0 auto; }

.range-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.range-bar button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 12px; border-radius: 20px; font-size: 13px; cursor: pointer;
}
.range-bar button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; }

.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.chart-card h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter-bar input, .filter-bar select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: var(--card);
}

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; cursor: pointer; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.confirmed, .badge.converted, .badge.active-agent { background: #dcfce7; color: var(--good); }
.badge.pending, .badge.active { background: #fef9c3; color: #a16207; }
.badge.failed, .badge.cancelled { background: #fee2e2; color: var(--bad); }
.badge.rescheduled, .badge.ended { background: #e0e7ff; color: #4338ca; }

.pagination { display: flex; justify-content: center; gap: 10px; padding: 14px; align-items: center; font-size: 13px; }
.pagination button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.pagination button:disabled { opacity: 0.4; cursor: default; }

.empty-state, .loading-state { text-align: center; color: var(--muted); padding: 30px; }

.login-wrap { max-width: 320px; margin: 15vh auto; padding: 24px; }
.login-wrap h1 { font-size: 18px; margin-bottom: 16px; }
.login-wrap input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.login-wrap button { width: 100%; padding: 10px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.login-wrap .error { color: var(--bad); font-size: 13px; margin-bottom: 10px; }

@media (min-width: 640px) {
  .admin-main { padding: 24px; }
}
