/* "Connect your phone" component. Shared by the portal and the cockpit; shared tokens only.
   The one loud element is the pairing code, set large in the serif like a key cut in brass. Everything else stays quiet. */
.ch { display: flex; flex-direction: column; gap: 18px; }
.ch .ic { width: 16px; height: 16px; }
.ch-mono { font-family: var(--mono); font-size: 0.9em; letter-spacing: -0.01em; }
.ch-h { font-size: 17px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.005em; }
.ch-lede { color: var(--text-2); margin: 0 0 14px; max-width: 62ch; line-height: 1.55; }
.ch-hint { color: var(--muted); font-size: 13.5px; margin: 10px 0 0; max-width: 60ch; line-height: 1.5; }

/* ---------- the key: pairing code ---------- */
.ch-key {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: center;
  padding: 24px 26px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.ch-key::before { /* a single brass hairline: the "cut" edge of the key */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.ch-key-title { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; margin: 0 0 8px; }
.ch-key-lede { color: var(--text); max-width: 52ch; line-height: 1.5; }
.ch-key-note { color: var(--muted); font-size: 13.5px; margin-top: 8px; max-width: 52ch; }
.ch-code { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.ch-slot {
  padding: 6px 22px 2px; border-radius: 16px; background: var(--sunk);
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--text) 10%, transparent), 0 0 0 1px var(--line);
}
.ch-digits {
  display: inline-flex; align-items: baseline; font-family: var(--serif); font-weight: 400; line-height: 1;
  font-size: clamp(54px, 9vw, 84px); letter-spacing: 0.06em; color: var(--text); font-variant-numeric: lining-nums tabular-nums;
  user-select: all;
}
.ch-digits-gap { display: inline-block; width: 0.32em; } /* a plain gap, never a character people might type */
.ch-code-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ch-code-inline {
  font-family: var(--mono); font-size: 0.95em; font-weight: 500; letter-spacing: 0.08em; padding: 0.12em 0.5em; border-radius: 6px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); white-space: nowrap;
}

.ch-primary { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 14.5px; margin: -4px 2px 0; }
.ch-primary .ic { color: var(--accent); margin-top: 3px; flex: none; }
.ch-primary b { color: var(--text); }

/* ---------- channel rows ---------- */
.ch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ch-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); transition: border-color .2s, box-shadow .2s; min-width: 0; }
.ch-row.is-open { border-color: var(--line-2); box-shadow: var(--shadow); }
.ch-row-head {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--r-lg);
}
.ch-row-head:focus-visible { outline: 2px solid var(--ring, var(--accent)); outline-offset: 2px; }
.ch-row-head:hover .ch-row-name b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.ch-row.is-feature .ch-row-head { padding-top: 18px; padding-bottom: 18px; }
.ch-row-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ch-row-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-row-name b { font-size: 16px; font-weight: 600; color: var(--text); }
.ch-row-sum { color: var(--muted); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ch-row-sum b { color: var(--text-2); font-weight: 600; }
.ch-tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--sunk); color: var(--text-2); border: 1px solid var(--line); }
.ch-tag-rec { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.ch-chev { color: var(--muted); transition: transform .18s; }
.ch-row.is-open .ch-chev { transform: rotate(180deg); }
.ch-logo { color: var(--text-2); }
.ch-logo-sms, .ch-logo-email { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.ch-logo-imessage svg, .ch-logo-whatsapp svg, .ch-logo-telegram svg { width: 62%; height: 62%; }

.ch-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px 3px 9px; border-radius: 999px; white-space: nowrap; }
.ch-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ch-tone-ok { color: var(--ok); background: var(--ok-soft); }
.ch-tone-err { color: var(--err); background: var(--err-soft); }
.ch-tone-idle { color: var(--muted); background: var(--sunk); }
.ch-tone-ready { color: var(--text); background: var(--accent-soft); }
.ch-tone-ready .ch-dot { background: var(--accent); animation: ch-breathe 1.8s ease-in-out infinite; }

.ch-body { padding: 4px 18px 20px; border-top: 1px dashed var(--line); margin: 0 18px; padding-left: 0; padding-right: 0; padding-top: 18px; animation: ch-in .22s ease-out; }
.ch-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.ch-actions-end { justify-content: flex-end; margin-top: 16px; }
.ch-danger { color: var(--err) !important; }
.ch-alt { margin: 14px 0 0; display: inline-block; }
.ch-adv { margin-top: 18px; }
.ch-form { display: flex; flex-direction: column; gap: 12px; }
.ch-form .ac-form-err { margin-bottom: 2px; }

/* steps (a real sequence, so numbered) */
.ch-steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; counter-reset: none; }
.ch-step { display: flex; align-items: center; gap: 10px; min-width: 0; padding-bottom: 10px; border-bottom: 2px solid var(--line); color: var(--muted); font-size: 13.5px; }
.ch-step-n { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 600; font-size: 13px; border: 1.5px solid var(--line-2); color: var(--text-2); }
.ch-step-n .ic { width: 14px; height: 14px; }
.ch-step-t { min-width: 0; line-height: 1.3; }
.ch-step.is-now { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.ch-step.is-now .ch-step-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ch-step.is-done { color: var(--text-2); border-bottom-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.ch-step.is-done .ch-step-n { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

/* step 1: options */
.ch-options { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 64ch; }
.ch-options li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); }
.ch-options li > .ic { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; flex: none; }
.ch-options li div { display: flex; flex-direction: column; gap: 2px; }
.ch-options li span { color: var(--text-2); font-size: 14px; line-height: 1.45; }
.ch-options li.is-no { background: transparent; border-style: dashed; }
.ch-options li.is-no > .ic { color: var(--err); }

/* step 2: QR stage */
.ch-link { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; }
.ch-stage { width: min(344px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ch-plate {
  position: relative; width: min(344px, 100%); aspect-ratio: 1; border-radius: 18px; background: #fff; padding: 12px;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -26px rgba(0, 0, 0, 0.55); display: grid; place-items: center;
}
.ch-plate img, .ch-plate .qr-svg { width: 100%; height: 100%; display: block; image-rendering: pixelated; border-radius: 6px; }
.ch-ring { position: absolute; inset: -7px; width: calc(100% + 14px); height: calc(100% + 14px); pointer-events: none; overflow: visible; }
.ch-ring rect { fill: none; stroke: var(--accent); stroke-width: 1.1; vector-effect: non-scaling-stroke; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; opacity: .9; }
.ch-ring.is-run rect { animation: ch-deplete 20s linear forwards; }
.ch-stage-cap { color: var(--muted); font-size: 13px; text-align: center; min-height: 1.4em; }
.ch-plate-wait, .ch-plate-msg { background: var(--panel-2); box-shadow: 0 0 0 1px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; color: var(--text-2); font-size: 14px; }
.ch-plate-wait b, .ch-plate-msg b { color: var(--text); font-size: 16px; }
.ch-plate-msg > .ic { width: 28px; height: 28px; color: var(--warn); }
.ch-plate-msg span { max-width: 30ch; line-height: 1.45; }
.ch-halo { margin-bottom: 6px; }
.ch-halo::before { animation: ch-halo 1.6s ease-in-out infinite; }
.ch-halo > span { animation: ch-breathe 1.6s ease-in-out infinite; }
.ch-how { margin: 0 0 6px; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 10px; color: var(--text); line-height: 1.5; max-width: 52ch; }
.ch-how li::marker { color: var(--accent); font-weight: 600; }
.ch-how-wide { max-width: 64ch; margin-bottom: 16px; }
.ch-link-how { padding-top: 4px; min-width: 0; }

/* step 3: send the code */
.ch-send { min-width: 0; }
.ch-linked { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--text); font-size: 14px; margin-bottom: 16px; }
.ch-linked .ic { color: var(--ok); }
.ch-send-lede { color: var(--text-2); margin-bottom: 8px; }
.ch-send-big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.ch-send-big .ch-code-inline { font-size: 28px; padding: 4px 14px; letter-spacing: 0.14em; border-radius: 10px; }
.ch-send-to { color: var(--text-2); font-size: 17px; }
.ch-send-to b { color: var(--text); }
.ch-wait { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--text-2); font-size: 14px; }
.ch-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-soft); animation: ch-pulse 1.6s ease-out infinite; flex: none; }

/* paired + success */
.ch-paired { display: flex; flex-direction: column; gap: 12px; }
.ch-paired-line { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.ch-paired-line .ic { color: var(--ok); margin-top: 3px; flex: none; }
.ch-paired-line b { color: var(--text); }
.ch-success { display: flex; gap: 16px; align-items: flex-start; padding: 18px; border-radius: var(--r-lg); background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); animation: ch-in .3s ease-out; }
.ch-success-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; flex: none; animation: ch-pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.ch-success-mark .ic { width: 22px; height: 22px; stroke-width: 2.4; }
.ch-success h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; margin: 2px 0 6px; }
.ch-success p { color: var(--text-2); max-width: 56ch; margin-bottom: 12px; }
.ch-result { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r); font-size: 14px; margin-top: 10px; background: var(--sunk); color: var(--text-2); animation: ch-in .2s ease-out; }
.ch-result.ch-tone-ok { background: var(--ok-soft); color: var(--text); }
.ch-result.ch-tone-ok .ic { color: var(--ok); }
.ch-result.ch-tone-err { background: var(--err-soft); color: var(--text); }
.ch-result.ch-tone-err .ic { color: var(--err); }

/* notices, mode picker, copy rows, telegram */
.ch-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--sunk); border: 1px dashed var(--line-2); }
.ch-notice > .ic { width: 18px; height: 18px; color: var(--muted); margin-top: 2px; flex: none; }
.ch-notice div { display: flex; flex-direction: column; gap: 3px; }
.ch-notice span { color: var(--text-2); font-size: 14px; }
.ch-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.ch-mode { position: relative; cursor: pointer; }
.ch-mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ch-mode span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); height: 100%; box-sizing: border-box; }
.ch-mode small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.ch-mode input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ch-mode input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ch-copy { display: flex; gap: 6px; min-width: 0; }
.ch-copy input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--sunk); color: var(--text); font-size: 12.5px; }
.ch-hook { margin-top: 14px; max-width: 640px; }
.ch-tg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: start; }
.ch-tg-qr { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 200px; }
.ch-plate-sm { width: 200px; padding: 8px; border-radius: 14px; }
.ch-tg-qr figcaption { color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.4; }

@keyframes ch-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes ch-deplete { to { stroke-dashoffset: 100; } }
@keyframes ch-breathe { 50% { opacity: .35; } }
@keyframes ch-halo { 50% { transform: scale(1.12); opacity: .55; } }
@keyframes ch-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
@keyframes ch-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .ch-body, .ch-success, .ch-result { animation: none; }
  .ch-success-mark, .ch-halo::before, .ch-halo > span, .ch-pulse, .ch-tone-ready .ch-dot { animation: none; }
  .ch-ring.is-run rect { animation-duration: 20s; }
}

@media (max-width: 760px) {
  .ch-key { grid-template-columns: 1fr; padding: 20px 18px 20px 20px; }
  .ch-code { align-items: stretch; }
  .ch-slot { text-align: center; }
  .ch-code-actions { justify-content: flex-start; }
  .ch-code-actions .btn { flex: 1 1 auto; }
  .ch-link, .ch-tg { grid-template-columns: 1fr; gap: 18px; }
  .ch-stage { margin: 0 auto; }
  .ch-tg-qr { display: none; }
}
@media (max-width: 640px) {
  .ch-row-head { grid-template-columns: auto minmax(0, 1fr) auto; padding: 14px; gap: 12px; }
  .ch-row-head .ch-state { grid-column: 2 / 4; grid-row: 2; justify-self: start; margin-top: -4px; }
  .ch-row-head .ch-chev { grid-column: 3; grid-row: 1; }
  .ch-body { margin: 0 14px; padding-bottom: 16px; }
  .ch-steps { gap: 6px; }
  .ch-step { flex-direction: column; align-items: flex-start; gap: 6px; font-size: 12.5px; }
  .ch-send-big .ch-code-inline { font-size: 24px; }
  .ch-actions .btn-primary { width: 100%; }
  .ch-success { flex-direction: column; gap: 10px; padding: 16px; }
}

/* Pairing key text column, intro blocks and Telegram setup: plain stacks */
.ch-key-text { min-width: 0; }
.ch-intro, .ch-tg-setup { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ch-how-line { margin-bottom: 10px; }

/* WhatsApp link QR code: fixed size, quiet white plate so phones can read it in dark mode too */
.ch-qr-img { display: block; width: 260px; max-width: 100%; height: auto; aspect-ratio: 1; padding: 12px;
  background: #fff; border-radius: var(--r-sm, 10px); border: 1px solid var(--line); image-rendering: pixelated; }

/* were inline style="" attributes; the CSP allows none */
.ch-send.ch-mb { margin-bottom: 16px; }
.ch-send.ch-my { margin: 12px 0; }
.ch-lede.ch-steps-ol { margin: 8px 0 0 18px; }
.ch-lede.ch-dim { opacity: .75; }
.ch-mono.ch-paircode { font-size: 2rem; letter-spacing: .15em; }
form[data-wa-paircode] { align-items: end; }

/* phone calls with the assistant */
.ch-calls { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 20px 22px; margin-bottom: 18px; }
.ch-calls header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.ch-calls h2 { font-size: 19px; margin: 0 0 2px; }
.ch-calls-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }
.ch-calls-sub, .ch-calls-hint { color: var(--muted); font-size: 14px; margin: 0; }
.ch-calls-form { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.ch-calls-num { font-size: 17px; margin: 0 0 4px; }
.ch-calls-num a { font-weight: 600; }
.ch-calls-on { display: flex; flex-direction: column; gap: 10px; }
.ch-calls-toggle { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ch-calls-toggle input { margin-top: 4px; accent-color: var(--accent); }
.ch-calls-toggle small { display: block; color: var(--muted); font-size: 13px; }
.ch-reading { display: grid; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.ch-reading input:disabled + span { opacity: .55; }
.ch-calls-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ch-calls-err { color: var(--err); font-size: 14px; margin: 0; }
.ch-calls-pin { display: grid; grid-template-columns: minmax(0, 260px) auto; gap: 6px 10px; align-items: end; margin-top: 4px; }
.ch-calls-pin .ch-calls-hint, .ch-calls-pin .ch-calls-count { grid-column: 1 / -1; }
.ch-calls-pin > .btn { justify-self: start; }
.ch-calls-count { color: var(--muted); font-size: 13px; margin-top: -2px; }
.ch-calls-count.ok { color: var(--ok, var(--text)); }
.ch-calls-pin em { font-style: normal; color: var(--muted); font-weight: 400; margin-left: 6px; }
