* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #1f2937;
}
.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.admin-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 20px 44px;
}
.card {
  background: white;
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.12);
  padding: 28px;
}
.query-card { width: min(620px, 100%); }
.admin-page .card { margin-top: 18px; }
h1, h2 { margin: 0 0 8px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
.sub, .hint { margin: 0 0 18px; color: #64748b; line-height: 1.6; }
.hint { font-size: 14px; }
.topbar, .admin-header, .section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.admin-header {
  align-items: center;
  padding: 4px 2px 10px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: #e0ecff;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}
.form label { display: block; margin-bottom: 8px; font-weight: 600; }
.row { display: flex; gap: 12px; }
.admin-token-row { max-width: 680px; }
input, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  background: white;
}
input { flex: 1; height: 46px; }
textarea {
  min-height: 180px;
  padding: 12px 14px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
}
input:focus, textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
button {
  height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 0 22px;
  background: #2563eb;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
button.secondary { background: #e2e8f0; color: #1f2937; }
button.danger { background: #dc2626; color: white; }
button.small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}
button:disabled { opacity: .65; cursor: wait; }
.result {
  margin-top: 28px;
  padding: 20px;
  border-radius: 14px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.label { color: #475569; font-weight: 600; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .18em;
  color: #1d4ed8;
}
.status { min-height: 22px; margin: 16px 0 0; color: #64748b; }
.status.ok { color: #15803d; }
.status.err, .err-text { color: #b91c1c; }
.format-box, .log-box {
  border-radius: 12px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.format-box { background: #f8fafc; color: #334155; border: 1px solid #e2e8f0; }
.log-box { margin-top: 14px; border: 1px solid #e2e8f0; background: #f8fafc; }
.ok-box { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.err-box { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.hidden { display: none; }
.options-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #334155;
}
.check-row input { width: auto; height: auto; flex: initial; }
.actions-row { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.pill, .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill { padding: 7px 12px; background: #e0ecff; color: #1d4ed8; }
.badge { padding: 4px 8px; background: #e2e8f0; color: #334155; margin-right: 4px; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.purple { background: #f3e8ff; color: #7e22ce; }
.badge.gray { background: #f1f5f9; color: #475569; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: middle; }
th { color: #475569; background: #f8fafc; font-weight: 800; }
.email-cell { font-weight: 700; color: #0f172a; }
.empty { text-align: center; color: #64748b; padding: 28px 10px; }
.op-cell { display: flex; gap: 8px; flex-wrap: wrap; }
code { background: #f1f5f9; padding: 2px 5px; border-radius: 5px; }
@media (max-width: 760px) {
  .card { padding: 22px; }
  .row, .topbar, .admin-header, .section-head { flex-direction: column; }
  button, .nav-link { width: 100%; }
  .options-grid { grid-template-columns: 1fr; }
  .code { font-size: 28px; }
}
