/*
 * BlockerIQ Beta — download portal dark theme
 *
 * Background recipe is taken verbatim from the desktop app's first
 * loading/onboarding screen (src/app/onboarding/page.tsx, SetupFrame):
 *
 *   background: radial-gradient(circle at 18% 0%, rgba(255,178,63,0.16), transparent 32%),
 *               linear-gradient(180deg, #33343b, #24252b);
 *
 * All other tokens (cards, accent, text, success, danger) match the
 * onboarding palette so the portal feels like the same product.
 */
:root {
  color-scheme: dark;
  --biq-bg-1: #33343b;
  --biq-bg-2: #24252b;
  --biq-card: linear-gradient(180deg, rgba(55, 56, 64, 0.97), rgba(39, 40, 47, 0.95));
  --biq-card-flat: rgba(255, 255, 255, 0.06);
  --biq-card-flat-hover: rgba(255, 255, 255, 0.09);
  --biq-border: rgba(255, 255, 255, 0.12);
  --biq-border-strong: rgba(255, 255, 255, 0.18);
  --biq-border-warm: rgba(255, 178, 63, 0.32);
  --biq-text: #f7f8fb;
  --biq-text-muted: rgba(247, 248, 251, 0.74);
  --biq-text-faint: rgba(247, 248, 251, 0.5);
  --biq-accent: #ffb23f;
  --biq-accent-hi: #ffc35a;
  --biq-accent-lo: #ff8f1f;
  --biq-success: #4bd69b;
  --biq-success-bg: rgba(75, 214, 155, 0.18);
  --biq-danger: #ff6b6b;
  --biq-danger-bg: rgba(255, 107, 107, 0.16);
  --biq-shadow: 0 18px 44px rgba(255, 143, 31, 0.18);
  --biq-shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 34px 90px rgba(0, 0, 0, 0.34);
  --biq-radius: 18px;
  --biq-radius-sm: 10px;
  --biq-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--biq-text);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 178, 63, 0.16), transparent 32%),
    linear-gradient(180deg, var(--biq-bg-1), var(--biq-bg-2));
  background-attachment: fixed;
}

a { color: var(--biq-accent); text-decoration: none; }
a:hover { color: var(--biq-accent-hi); }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Admin variant — wide, scroll-safe container for the multi-column users table. */
.page.page-wide {
  max-width: min(1680px, calc(100vw - 48px));
  justify-content: flex-start;
  padding-top: 110px;
}
body.admin-page .brand { position: fixed; top: 24px; left: 24px; }
body.admin-page .brand-logo { width: 220px; }

/* Top-left BlockerIQ full brand logo (spade + wordmark).
   Pinned to the viewport corner on desktop, collapses inline on mobile. */
.brand {
  position: fixed;
  top: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  margin-bottom: 28px;
}

.brand-logo {
  width: 220px;
  max-width: min(46vw, 240px);
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 40px rgba(255, 143, 31, 0.22));
}


.card {
  background: var(--biq-card);
  border: 1px solid var(--biq-border);
  border-radius: var(--biq-radius);
  padding: 26px 28px;
  box-shadow: var(--biq-shadow-card);
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--biq-text-muted);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 540px) {
  .form-row-2col { grid-template-columns: 1fr; gap: 0; }
}

.reg-stage {
  display: block;
  animation: stage-fade-in 180ms ease;
}
.reg-stage.hidden { display: none; }
@keyframes stage-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.16s ease, width 0.16s ease;
}
.progress-dot.is-active {
  background: var(--biq-accent);
  width: 22px;
}
.progress-dot.is-done {
  background: rgba(255, 178, 63, 0.55);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--biq-text-muted);
}

.field input,
.field textarea {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--biq-border);
  border-radius: var(--biq-radius-sm);
  color: var(--biq-text);
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--biq-border-warm);
  box-shadow: 0 0 0 3px rgba(255, 178, 63, 0.10);
}

.field textarea { min-height: 70px; resize: vertical; }
.field-hint {
  color: var(--biq-text-faint);
  font-size: 12px;
}

.field .select {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--biq-border);
  border-radius: var(--biq-radius-sm);
  color: var(--biq-text);
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(247,248,251,0.5) 50%),
    linear-gradient(135deg, rgba(247,248,251,0.5) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.field .select:focus {
  border-color: var(--biq-border-warm);
  box-shadow: 0 0 0 3px rgba(255, 178, 63, 0.10);
}
.field .select option { background: #2a2b32; color: var(--biq-text); }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--biq-radius-sm);
  border: 1px solid var(--biq-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--biq-text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.check:hover { background: rgba(255, 255, 255, 0.07); color: var(--biq-text); }
.check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--biq-border-strong);
  background: rgba(0, 0, 0, 0.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  position: relative;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.check input[type="checkbox"]:checked {
  background: linear-gradient(180deg, var(--biq-accent-hi), var(--biq-accent-lo));
  border-color: var(--biq-accent-lo);
}
.check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 8px;
  border: solid #1f2024;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.check input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--biq-accent);
  outline-offset: 2px;
}
.check:has(input:checked) {
  border-color: var(--biq-border-warm);
  background: rgba(255, 178, 63, 0.10);
  color: var(--biq-text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

/* Used inside multi-stage forms: secondary on the left, primary on the right. */
.actions.stage-actions {
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
}
@media (max-width: 480px) {
  .actions.stage-actions { gap: 8px; }
  .actions.stage-actions .btn { flex: 1 1 0; }
}

.btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(180deg, var(--biq-accent-hi), var(--biq-accent-lo));
  color: #202124;
  box-shadow: 0 18px 44px rgba(255, 143, 31, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.40);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:focus-visible { outline: 2px solid var(--biq-accent); outline-offset: 2px; }
.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(247, 248, 251, 0.5);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--biq-border);
  color: var(--biq-text-muted);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.10); color: var(--biq-text); }
.btn-ghost:focus-visible { outline: 2px solid var(--biq-accent); outline-offset: 2px; }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.30);
  color: #ffb6b6;
}
.btn-danger:hover { background: rgba(255, 107, 107, 0.18); color: #ffe1e1; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border: 1px solid var(--biq-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--biq-text-muted);
}
.badge.is-pending  { background: rgba(255, 178, 63, 0.16); border-color: rgba(255, 178, 63, 0.32); color: #ffd58a; }
.badge.is-approved { background: var(--biq-success-bg); border-color: rgba(75, 214, 155, 0.32); color: var(--biq-success); }
.badge.is-rejected,
.badge.is-revoked  { background: var(--biq-danger-bg); border-color: rgba(255, 107, 107, 0.30); color: #ffb6b6; }

.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--biq-radius-sm);
  border: 1px solid var(--biq-border-warm);
  background: rgba(255, 178, 63, 0.08);
  color: var(--biq-text);
  font-size: 13px;
  line-height: 1.5;
}
.notice.is-success { border-color: rgba(75, 214, 155, 0.32); background: var(--biq-success-bg); color: #c8f7df; }
.notice.is-error   { border-color: rgba(255, 107, 107, 0.30); background: var(--biq-danger-bg); color: #ffd1d1; }

.code {
  font-family: var(--biq-mono);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--biq-border);
  border-radius: var(--biq-radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  word-break: break-all;
  color: #eef0f6;
}

.muted { color: var(--biq-text-muted); }
.faint { color: var(--biq-text-faint); }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { justify-content: space-between; }

.admin-summary {
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.admin-table-shell {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scrollbar-color: rgba(255, 178, 63, 0.45) rgba(255, 255, 255, 0.06);
}

table.users {
  width: 100%;
  min-width: 1580px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
table.users th, table.users td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--biq-border);
  vertical-align: top;
}
table.users tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
table.users th {
  color: var(--biq-text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
table.users th:nth-child(1),  table.users td:nth-child(1)  { width: 250px; }
table.users th:nth-child(2),  table.users td:nth-child(2)  { width: 150px; }
table.users th:nth-child(3),  table.users td:nth-child(3)  { width: 80px; }
table.users th:nth-child(4),  table.users td:nth-child(4)  { width: 110px; }
table.users th:nth-child(5),  table.users td:nth-child(5)  { width: 90px; }
table.users th:nth-child(6),  table.users td:nth-child(6)  { width: 125px; }
table.users th:nth-child(7),  table.users td:nth-child(7)  { width: 130px; }
table.users th:nth-child(8),  table.users td:nth-child(8)  { width: 125px; }
table.users th:nth-child(9),  table.users td:nth-child(9)  { width: 145px; }
table.users th:nth-child(10), table.users td:nth-child(10) { width: 210px; }
table.users th:nth-child(11), table.users td:nth-child(11) { width: 130px; }
table.users th:nth-child(12), table.users td:nth-child(12) { width: 140px; }
table.users th:nth-child(13), table.users td:nth-child(13) { width: 250px; }

table.users .btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}
.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: flex-start;
}
table.users td .pill {
  display: inline-block;
  padding: 2px 8px;
  margin: 1px 3px 1px 0;
  border-radius: 999px;
  border: 1px solid var(--biq-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--biq-text-muted);
  font-size: 11px;
  font-weight: 700;
}
table.users td.identity .nick {
  font-size: 12px;
  color: var(--biq-text-faint);
  margin-top: 2px;
}
.email-chip {
  display: inline-block;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--biq-border);
  background: rgba(0, 0, 0, 0.26);
  color: #eef0f6;
  font-family: var(--biq-mono);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
.cell-truncate {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-main { line-height: 1.35; }
.cell-date,
.cell-meta {
  display: block;
  color: var(--biq-text-faint);
  font-size: 11px;
  line-height: 1.45;
  margin-top: 4px;
}
.cell-date {
  margin-top: 0;
  white-space: nowrap;
}
.cell-meta.mono { font-family: var(--biq-mono); }
.admin-empty {
  text-align: center;
  padding: 22px !important;
  color: var(--biq-text-faint);
}

.hidden { display: none !important; }

/* Legal documents (terms / privacy / beta conditions). Same dark theme
 * as the rest of the portal; readable line-height and a slightly wider
 * card. */
.legal-page .card.legal {
  max-width: 760px;
  margin: 0 auto;
}
.legal-page .card.legal h3 {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--biq-text);
}
.legal-page .card.legal p {
  margin: 0 0 12px;
  color: var(--biq-text-muted);
  line-height: 1.65;
}
.legal-page .card.legal ul {
  margin: 4px 0 14px 18px;
  color: var(--biq-text-muted);
  line-height: 1.6;
}

/* Terms gate links + checkbox */
ul.legal-links {
  margin: 4px 0 0 18px;
  padding: 0;
  font-size: 14px;
}
ul.legal-links a {
  color: var(--biq-accent);
  text-decoration: underline;
}
.check.check-block {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--biq-card-flat);
  border: 1px solid var(--biq-border);
  border-radius: var(--biq-radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}
.check.check-block input[type="checkbox"] {
  margin-top: 2px;
  flex: 0 0 auto;
}
.check.check-block span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--biq-text);
}

/* Access code reveal modal — overlays the admin panel after generate/reset.
 * Plaintext code is shown exactly once, then wiped from the DOM on close. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal .modal-card {
  width: min(520px, 100%);
  background: var(--biq-card);
  border: 1px solid var(--biq-border-warm);
  border-radius: var(--biq-radius);
  box-shadow: var(--biq-shadow-card), var(--biq-shadow);
  padding: 22px 22px 18px;
}
.modal .modal-card .code {
  display: block;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--biq-radius-sm);
  border: 1px solid var(--biq-border);
  font-family: var(--biq-mono);
  word-break: break-all;
}

@media (max-width: 720px) {
  .page { padding: 32px 16px 60px; }
  .brand { position: static; align-items: flex-start; margin-bottom: 24px; }
  .brand-logo { width: 180px; max-width: 72vw; }
  .card { padding: 18px 18px; }
}


.download-product {
  border: 1px solid var(--biq-border);
  border-radius: var(--biq-radius-sm);
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 16px;
}

.download-product-name {
  font-weight: 900;
  font-size: 17px;
  margin-bottom: 6px;
}

.download-product-meta {
  color: var(--biq-muted);
  font-size: 14px;
  line-height: 1.6;
}
