/* The quick sign-up before a catalog PDF (templates/products/_gate_box.html, static/catalog-gate.js).
   Site tokens from atlas.css: --bg, --text, --muted, --red, --glass, --border. */

.cg-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(460px, 100% - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text, #f4f5f7);
  overflow: visible;
}
.cg-dialog::backdrop { background: rgba(4, 5, 8, .72); }
.cg-dialog[open] .cg-sheet { animation: cg-in .22s ease-out; }
@keyframes cg-in { from { opacity: 0; transform: translateY(10px); } }

.cg-sheet {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 26px 24px 22px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 22px;
  background: #101116;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}
.cg-sheet h1, .cg-sheet h2 { margin: 0; font-size: 22px; line-height: 1.35; text-wrap: balance; }
.cg-sheet--page { max-width: 520px; width: 100%; margin-inline: auto; }
.cg-page { padding-block: 130px 70px; gap: 24px; }

.cg-close {
  position: absolute; inset-inline-end: 14px; top: 14px;
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border, rgba(255,255,255,.12));
  background: transparent; color: var(--muted, #a3a7b3); cursor: pointer;
}
.cg-close:hover { color: var(--text, #fff); border-color: rgba(255,255,255,.3); }

.cg { display: grid; gap: 14px; }

/* the file being asked for */
.cg-file {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border, rgba(255,255,255,.1));
}
.cg-file-ico {
  flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px;
  color: var(--red, #ff1f1f); background: rgba(255, 31, 31, .1); border: 1px solid rgba(255, 31, 31, .25);
}
.cg-file-copy { min-width: 0; display: grid; gap: 2px; }
.cg-file-copy strong { font-size: 15px; line-height: 1.5; }
.cg-file-copy small { color: var(--muted, #a3a7b3); font-size: 12.5px; }

/* where they are */
.cg-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cg-steps li { font-size: 12px; color: var(--muted, #a3a7b3); padding-top: 8px; border-top: 3px solid rgba(255,255,255,.1); transition: border-color .2s, color .2s; }
.cg[data-step="details"] .cg-s1,
.cg[data-step="code"] :is(.cg-s1, .cg-s2),
.cg[data-step="done"] :is(.cg-s1, .cg-s2, .cg-s3) { border-color: var(--red, #ff1f1f); color: var(--text, #f4f5f7); }

/* one step on screen at a time */
.cg-panel { display: none; }
.cg[data-step="details"] .cg-details,
.cg[data-step="code"] .cg-code,
.cg[data-step="done"] .cg-done { display: grid; gap: 12px; }
.cg[data-step="code"] .cg-code-tools { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cg-code-tools form { margin: 0; }

.cg-lead { margin: 0; color: var(--muted, #a3a7b3); font-size: 14.5px; line-height: 1.8; }
.cg-lead b { color: var(--text, #f4f5f7); }
.cg-fine { margin: 0; color: var(--muted, #a3a7b3); font-size: 12.5px; text-align: center; }

.cg-field { display: grid; gap: 6px; }
.cg-label { font-size: 13px; font-weight: 700; }
.cg input[type="text"], .cg input[type="tel"], .cg select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .04);
  color: var(--text, #f4f5f7); font: inherit; font-size: 16px;
  transition: border-color .15s, background .15s;
}
.cg input:focus, .cg select:focus { outline: none; border-color: var(--red, #ff1f1f); background: rgba(255, 255, 255, .06); }
.cg input[aria-invalid="true"] { border-color: #ff6b6b; }
.cg-phone { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.cg-dial { display: grid; place-items: center; min-height: 48px; border-radius: 12px; font-weight: 700; font-size: 15px;
           border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .07); color: var(--text, #f4f5f7); }
.cg select option { background: #15161c; color: #f4f5f7; }
.cg-otp { text-align: center; letter-spacing: .5em; font-size: 22px !important; font-weight: 700; font-variant-numeric: tabular-nums; }

.cg-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.7; color: var(--muted, #a3a7b3); cursor: pointer; flex-wrap: wrap; }
.cg-check > input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--red, #ff1f1f); flex: 0 0 auto; }
.cg-check > span { flex: 1; min-width: 0; }
.cg-check a { color: var(--text, #f4f5f7); text-decoration: underline; text-underline-offset: 3px; }
.cg-check .cg-err { flex-basis: 100%; }

.cg-err { color: #ff8a8a; font-size: 12.5px; }
.cg-msg, .cg-notice { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.7; }
.cg-msg { background: rgba(255, 70, 70, .1); border: 1px solid rgba(255, 70, 70, .3); color: #ffb3b3; }
.cg-notice { background: rgba(40, 200, 120, .1); border: 1px solid rgba(40, 200, 120, .3); color: #a6ecc6; }

.cg .cg-go { width: 100%; justify-content: center; min-height: 50px; }
.cg.is-busy .cg-go { opacity: .7; cursor: progress; }
.cg.is-busy .cg-go::after {
  content: ""; width: 16px; height: 16px; margin-inline-start: 10px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: cg-spin .7s linear infinite;
}
@keyframes cg-spin { to { transform: rotate(360deg); } }

.cg-link {
  padding: 4px 0; border: 0; background: none; color: var(--muted, #a3a7b3); font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.cg-link:hover:not(:disabled) { color: var(--text, #f4f5f7); }
.cg-link:disabled { cursor: default; text-decoration: none; opacity: .7; }

.cg-done { justify-items: center; text-align: center; }
.cg-done-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; color: #2bd27f; background: rgba(43, 210, 127, .12); border: 1px solid rgba(43, 210, 127, .35); }
.cg-done-title { margin: 0; font-size: 18px; font-weight: 800; }
.cg-done-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.cg-done-actions a { flex: 1 1 160px; justify-content: center; }
.cg-book { text-decoration: none; color: var(--red, #ff1f1f); font-weight: 700; }

@media (max-width: 520px) {
  .cg-dialog { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh; }
  .cg-dialog .cg-sheet { border-radius: 22px 22px 0 0; padding: 22px 16px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 92dvh; }
}
@media (prefers-reduced-motion: reduce) { .cg-dialog[open] .cg-sheet, .cg.is-busy .cg-go::after { animation: none; } }
