:root {
  --primary: #1368ce;
  --primary-dark: #0f4fa0;
  --green: #26890c;
  --red: #e21b3c;
  --yellow: #ffa602;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e1e5ee;
  --text: #1a1f2e;
  --muted: #6b7280;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef0f5; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* AUTH PAGES */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1368ce 0%, #864cbf 100%);
  padding: 20px;
}
.auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  text-align: center;
}
.auth-card h1 { margin: 12px 0 6px; font-size: 24px; }
.auth-card p { color: var(--muted); margin: 6px 0; }
.auth-card .small { font-size: 12px; }
.logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, #1368ce, #864cbf);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 22px;
  margin: 0 auto 8px;
}
.logo.pending-icon { font-size: 32px; background: var(--yellow); }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: white; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; font-weight: 600; color: var(--text);
  width: 100%; margin-top: 12px;
  cursor: pointer; font-family: inherit; font-size: 15px;
}
.btn-google:hover { background: #f8f9fc; }

/* TOPBAR */
.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 18px;
  padding: 10px 20px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #1368ce, #864cbf);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 12px;
}
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a {
  padding: 8px 14px; border-radius: 8px; color: var(--text);
}
.topnav a.active { background: #eef0f5; }
.topnav a:hover { text-decoration: none; background: #f4f6fa; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px; background: #f4f6fa; border-radius: 999px;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }

.badge {
  background: var(--red); color: white; font-size: 11px;
  padding: 2px 7px; border-radius: 999px; margin-left: 4px; font-weight: 700;
}

/* PAGE LAYOUT */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: -8px 0 12px;
}
.card-header h2 { margin: 0; font-size: 18px; }
.card-header h3 { margin: 12px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.banner {
  background: linear-gradient(90deg, #fff3cd, #ffd9d9);
  border: 1px solid var(--yellow);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* TABLE */
.table {
  width: 100%; border-collapse: collapse;
}
.table th, .table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th { font-size: 12px; text-transform: uppercase; color: var(--muted); }

/* PILLS */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #eef0f5; color: var(--text);
}
.pill-live { background: #ffe9ed; color: var(--red); }
.pill-ok   { background: #e3f4d6; color: var(--green); }
.pill-warn { background: #fff3cd; color: #b07700; }
.pill-bad  { background: #ffe9ed; color: var(--red); }

/* BUTTONS */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-primary.big { font-size: 18px; padding: 14px 22px; }
.btn-secondary { background: white; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f4f6fa; text-decoration: none; }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { filter: brightness(.92); }
.btn-link {
  background: none; border: none; color: var(--primary);
  cursor: pointer; padding: 4px 6px; font: inherit;
}
.btn-link.danger { color: var(--red); }
.btn-primary.small, .btn-secondary.small, .btn-danger.small { padding: 5px 10px; font-size: 13px; }

/* MODAL */
.modal {
  border: none; border-radius: 14px; padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-width: 90vw; width: 460px;
}
.modal::backdrop { background: rgba(0,0,0,.4); }
.modal form { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.modal h3 { margin: 0 0 6px; }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.modal input, .modal select, .modal textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: white;
  font-size: 15px;
}
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* GRID */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.qr {
  width: 100%; max-width: 280px; height: auto;
  background: white; border: 1px solid var(--border); border-radius: 10px;
}

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0 18px; }
.kpi {
  background: linear-gradient(135deg, #1368ce 0%, #864cbf 100%);
  color: white;
  border-radius: 10px;
  padding: 14px 18px;
}
.kpi-label { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1.1; margin-top: 2px; }

/* QUESTION LIST */
.qlist { padding-left: 22px; }
.qlist li { margin: 12px 0; }
.qlist ul { list-style: none; padding-left: 0; margin: 6px 0; }
.qlist ul li {
  background: #f4f6fa; padding: 6px 12px; border-radius: 6px;
  margin: 4px 0; font-size: 14px;
}
.qlist ul li.correct {
  background: #e3f4d6; color: var(--green); font-weight: 700;
}
.qlist.editable .qline { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qlist.editable .qactions { display: flex; gap: 4px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.error-banner {
  background: #ffe9ed; color: var(--red);
  border: 1px solid #f5b5be; border-radius: 8px;
  padding: 10px 14px; margin: 8px 0; font-size: 14px;
}
.status-pill { display: flex; align-items: center; gap: 8px; }

form { display: flex; flex-direction: column; gap: 10px; }
form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
form input, form select, form textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white; color: var(--text);
  font-size: 15px;
}
