/*
 * Sign-in pages (layouts/guest) and the Security page (layouts/portal).
 * Colours, radius, shadow and font come only from the tokens in /css/app.css.
 * Class prefix: .pt-
 */

/* ── Tabs: Parent | Kid ───────────────────────────────────────────────── */
.pt-auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 6px;
  border-radius: 999px;
  background: var(--crm-bg);
}
.pt-auth-tab {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--crm-body-text);
  font-weight: 600;
  text-decoration: none;
}
.pt-auth-tab i { font-size: 1.3rem; }
.pt-auth-tab:hover { color: var(--crm-primary); }
.pt-auth-tab.is-active {
  background: var(--crm-surface);
  color: var(--crm-primary);
  box-shadow: var(--crm-card-shadow);
}

/* ── Headings, notes and links ──────────────────────────────────────────── */
.pt-auth-title {
  margin: 0 0 8px;
  color: var(--crm-heading);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}
.pt-auth-sub { margin: 0 0 20px; opacity: .85; }
.pt-auth-note { margin: 12px 0 0; font-size: .875rem; opacity: .75; }
.pt-auth-form { margin: 0 0 8px; }
.pt-auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0 0;
}
.pt-auth-links a,
.pt-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--crm-primary);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.pt-auth-links a:hover,
.pt-link-btn:hover { text-decoration: underline; }

.pt-btn-block { width: 100%; }

.pt-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
}
.pt-alert i { flex-shrink: 0; font-size: 1.3rem; }
.pt-alert-miss { background: var(--rb-miss-bg); color: var(--rb-miss); }
.pt-alert-ok { background: var(--rb-ok-bg); color: var(--rb-ok); }

/* ── Codes ──────────────────────────────────────────────────────────────── */
.pt-code-input {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2em;
  text-align: center;
}
.pt-code-input::placeholder { letter-spacing: .08em; opacity: .5; }

.pt-auth-more { margin: 12px 0 0; }
.pt-auth-more > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--crm-primary);
  font-weight: 600;
  cursor: pointer;
}
.pt-auth-more[open] > summary { margin-bottom: 8px; }

/* ── Kid form: big and friendly ─────────────────────────────────────────── */
.pt-kid-form .pt-label { font-size: 1.05rem; }
.pt-kid-form .pt-input {
  min-height: var(--rb-tap);
  font-size: 1.3rem;
}
.pt-kid-form .pt-btn {
  min-height: var(--rb-tap);
  font-size: 1.2rem;
}

.pt-turnstile { min-height: 65px; margin: 4px 0 16px; }

/* ── Setup progress ─────────────────────────────────────────────────────── */
.pt-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.pt-progress-label { font-size: .8rem; font-weight: 600; opacity: .75; }
.pt-progress-bar { display: flex; gap: 6px; }
.pt-progress-dot {
  width: 28px;
  height: 6px;
  border-radius: 999px;
  background: var(--crm-border);
}
.pt-progress-dot.is-done { background: var(--crm-primary); }

.pt-steps-list { margin: 0 0 16px; padding-left: 20px; }
.pt-steps-list li { margin-bottom: 4px; }

/* ── The QR and the key ─────────────────────────────────────────────────── */
.pt-qr {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
  padding: 12px;
  max-width: 260px;
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-card-radius);
  background: var(--crm-surface);
}
.pt-qr-svg { display: block; width: 100%; max-width: 232px; height: auto; }
.pt-secret {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--crm-bg);
  color: var(--crm-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: center;
  word-break: break-all;
}

/* ── Recovery codes ─────────────────────────────────────────────────────── */
.pt-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.pt-codes code {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--crm-border);
  border-radius: 10px;
  background: var(--crm-bg);
  color: var(--crm-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
}
.pt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.pt-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 12px;
  cursor: pointer;
}
.pt-check input {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  accent-color: var(--crm-primary);
}

/* ── Waiting tablet ─────────────────────────────────────────────────────── */
.pt-wait { text-align: center; }
.pt-wait-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--crm-primary-soft);
  color: var(--crm-primary);
  font-size: 3.2rem;
}
.pt-wait .pt-btn { min-height: var(--rb-tap); font-size: 1.15rem; }
.pt-wait-status { margin: 0 0 16px; }
.pt-wait + .pt-auth-links { justify-content: center; }

/* ── Security page ──────────────────────────────────────────────────────── */
.pt-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 0 16px;
  align-items: start;
}
.pt-narrow { max-width: 640px; }
.pt-card-attention { border-color: var(--rb-almost); box-shadow: 0 0 0 2px var(--rb-almost-bg); }
.pt-section-title {
  margin: 8px 0 12px;
  color: var(--crm-heading);
  font-size: 1.2rem;
  font-weight: 700;
}
.pt-muted { font-size: .85rem; opacity: .7; }
.pt-stack-form { margin: 0 0 8px; }
.pt-card-action { margin-top: 12px; }

.pt-list { margin: 0; padding: 0; list-style: none; }
.pt-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 0;
  border-top: 1px solid var(--crm-border);
}
.pt-list-item:first-child { border-top: 0; padding-top: 0; }
.pt-list-item form { margin: 0; }
.pt-list-top { align-items: flex-start; }
.pt-list-icon { flex-shrink: 0; color: var(--crm-primary); font-size: 1.6rem; }
.pt-list-main {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.pt-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.pt-reset-2fa { margin-top: 4px; }

.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 16px;
  border: 1px solid var(--crm-border);
  border-radius: 999px;
  background: var(--crm-surface);
  color: var(--crm-body-text);
  font-weight: 600;
  text-decoration: none;
}
.pt-chip:hover { border-color: var(--crm-primary); color: var(--crm-primary); }
.pt-chip.is-active { border-color: var(--crm-primary); background: var(--crm-primary); color: var(--crm-surface); }
.pt-chip-tag { font-size: .72rem; font-weight: 500; opacity: .8; }

.pt-facts { display: grid; gap: 8px; margin: 0 0 16px; }
.pt-facts div { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pt-facts dt { min-width: 80px; font-weight: 600; opacity: .75; }
.pt-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.pt-table-wrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pt-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--crm-border);
  color: var(--crm-heading);
  font-weight: 600;
  text-align: start;
}
.pt-table td { padding: 10px; border-bottom: 1px solid var(--crm-border); vertical-align: top; }
.pt-table td .pt-muted { display: block; }

@media (max-width: 640px) {
  .pt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pt-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--crm-border); }
  .pt-table td { display: flex; gap: 12px; padding: 4px 0; border: 0; }
  .pt-table td::before { flex: 0 0 96px; content: attr(data-label); font-weight: 600; opacity: .7; }
}

/* ── Print the recovery codes ───────────────────────────────────────────── */
@media print {
  .login-bg-panel,
  .pt-auth-tabs,
  .login-footer,
  .sidebar,
  .topbar,
  .crm-bottom-nav,
  .pt-actions,
  form,
  details { display: none !important; }
  .pt-codes code { border-color: currentColor; }
}
