/* SQ site shell (screen, phone, pairing, enrollment). aicp's tokens; no external fonts or code. */
:root {
  --bg: #faf9f5; --bg-side: #f3f1ea; --panel: #ffffff; --text: #1f1e1d; --muted: #6f6d66; --faint: #a3a198;
  --border: #e6e3da; --border-strong: #d6d2c6; --hover: rgba(31, 30, 29, .055); --active: rgba(31, 30, 29, .09);
  --accent: #c96442; --accent-hover: #b4563a; --accent-soft: rgba(201, 100, 66, .12);
  --user-bubble: #efebe2; --ok: #3f8f5a; --warn: #c58a1b; --bad: #c2453a;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262624; --bg-side: #1f1e1d; --panel: #30302e; --text: #ecebe6; --muted: #a3a198; --faint: #75736c;
    --border: #3a3936; --border-strong: #4a4945; --hover: rgba(255,255,255,.055); --active: rgba(255,255,255,.09);
    --accent: #d97757; --accent-hover: #e48a6c; --accent-soft: rgba(217, 119, 87, .16);
    --user-bubble: #1c1c1a; --shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 28px rgba(0,0,0,.28);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }
#app { min-height: 100%; }
.sq-boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 24px; height: 24px; border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; font-weight: 500; border: 1px solid var(--border-strong); background: var(--panel);
  text-decoration: none; color: var(--text); transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- brand mark ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand .addr { font-family: var(--mono); font-weight: 500; font-size: 14px; color: var(--muted); }
.brand .addr b { color: var(--text); font-weight: 600; }

/* ---- QR screen ---- */
.qr-stage { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.qr-card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow); padding: 28px 28px 22px; text-align: center; }
.qr-card h1 { font: 500 26px/1.2 var(--serif); margin: 18px 0 6px; letter-spacing: -.01em; }
.qr-card p { margin: 0; color: var(--muted); }
.qr-tile { margin: 22px auto 0; width: min(300px, 74vw); aspect-ratio: 1; background: #fff; border-radius: 18px;
  padding: 6px; border: 1px solid var(--border); position: relative; }
.qr-tile img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-tile .qr-dot { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 12px; border: 4px solid #fff; background: #c96442; display: grid; place-items: center; }
.qr-tile .qr-dot img { width: 26px; height: 26px; }
.qr-meter { height: 3px; border-radius: 3px; background: var(--border); margin: 18px auto 0; width: min(300px, 74vw);
  overflow: hidden; }
.qr-meter i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.qr-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px;
  font-size: 13px; color: var(--faint); }
.qr-foot a { color: var(--muted); }
.closed-card .lock { width: 54px; height: 54px; margin: 6px auto 0; border-radius: 16px; display: grid;
  place-items: center; background: var(--bg-side); color: var(--muted); }
.closed-card .lock svg { width: 26px; height: 26px; }

/* ---- the page (public), with the corner QR ---- */
.frame-wrap { position: fixed; inset: 0; background: var(--bg); }
.frame-wrap.with-bar { top: 52px; }
.frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.qr-corner { position: fixed; right: 16px; bottom: 16px; z-index: 5; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 10px; display: flex; align-items: center; gap: 10px; }
.qr-corner .mini { display: block; width: 92px; height: 92px; background: #fff; border-radius: 9px; padding: 3px; }
.qr-corner .mini img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-corner .txt { font-size: 12px; color: var(--muted); max-width: 110px; line-height: 1.35; }
.qr-corner .txt b { display: block; color: var(--text); font-size: 13px; }
.qr-corner .x { position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); padding: 0; }
.qr-corner .x svg { width: 12px; height: 12px; }
.qr-pill { position: fixed; right: 16px; bottom: 16px; z-index: 5; width: 44px; height: 44px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); display: grid; place-items: center;
  color: var(--accent); }
.qr-pill svg { width: 22px; height: 22px; }

/* ---- unlocked screen: bar + tabs ---- */
.bar { position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 4; display: flex; align-items: center; gap: 12px;
  padding: 0 14px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.bar .grow { flex: 1; }
.tabs { display: inline-flex; padding: 3px; background: var(--bg-side); border: 1px solid var(--border); border-radius: 11px; }
.tabs button { border: 0; background: transparent; padding: 5px 16px; border-radius: 8px; font-weight: 500; color: var(--muted); }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tabs button .badge { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  margin-left: 6px; vertical-align: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px;
  background: var(--bg-side); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.chip.warn .dot { background: var(--warn); }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; }
.empty h2 { font: 500 24px/1.25 var(--serif); margin: 14px 0 6px; }
.empty p { color: var(--muted); margin: 0 0 16px; max-width: 420px; }
.empty .glyph { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin: 0 auto; }
.empty .glyph svg { width: 26px; height: 26px; }

/* ---- prompt (screen tab and phone) ---- */
.prompt-pane { position: fixed; top: 52px; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; background: var(--bg); }
.thread { flex: 1; overflow-y: auto; padding: 22px 16px 10px; }
.thread-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.thread .hello { text-align: center; color: var(--muted); padding: 40px 10px; }
.thread .hello h2 { font: 500 26px/1.2 var(--serif); color: var(--text); margin: 0 0 6px; }
.msg-user { align-self: flex-end; max-width: 82%; background: var(--user-bubble); border-radius: 18px 18px 4px 18px;
  padding: 10px 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg-user .src { display: block; font-size: 11.5px; color: var(--faint); margin-bottom: 2px; }
.msg-agent { align-self: flex-start; max-width: 92%; display: flex; gap: 10px; }
.msg-agent .av { width: 26px; height: 26px; border-radius: 8px; flex: none; margin-top: 2px; }
.msg-agent .body { white-space: pre-wrap; word-wrap: break-word; padding-top: 3px; }
.msg-agent .body.working { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.msg-agent .body.err { color: var(--bad); }
.composer { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); }
.composer form { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: 18px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; min-height: 26px; max-height: 180px;
  padding: 5px 0; line-height: 1.45; font-size: 16px; }
.composer .send { width: 36px; height: 36px; border-radius: 11px; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: none; }
.composer .send:disabled { opacity: .4; }
.composer .hint { max-width: 760px; margin: 6px auto 0; font-size: 12px; color: var(--faint); text-align: center; }

/* ---- phone ---- */
.phone { max-width: 560px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px 0; min-height: 100dvh;
  display: flex; flex-direction: column; }
.phone header { display: flex; align-items: center; gap: 10px; padding: 4px 0 14px; }
.phone header .grow { flex: 1; min-width: 0; }
.phone header h1 { font: 500 22px/1.2 var(--serif); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone header .sub { font-size: 13px; color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .wide { grid-column: 1 / -1; }
.act { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; min-height: 86px;
  border-radius: 16px; border: 1px solid var(--border); background: var(--panel); text-align: left; box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); }
.act svg { width: 22px; height: 22px; color: var(--accent); }
.act b { font-weight: 600; font-size: 15px; }
.act span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.act.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.act.primary svg, .act.primary span { color: rgba(255,255,255,.88); }
.act.live { border-color: var(--ok); }
.act:disabled { opacity: .55; }
.phone .section-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
  margin: 22px 2px 8px; }
.phone .thread { padding: 4px 0 10px; overflow: visible; }
.phone .composer { position: sticky; bottom: 0; padding-left: 0; padding-right: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ---- pairing / enrollment cards ---- */
.center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow); padding: 26px; text-align: center; }
.card h1 { font: 500 24px/1.25 var(--serif); margin: 16px 0 6px; }
.card p { color: var(--muted); margin: 0 0 18px; }
.card .btn { width: 100%; }
.card input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg);
  padding: 0 14px; margin-bottom: 12px; font-size: 16px; }
.face { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; }
.face svg { width: 32px; height: 32px; }
.face.ok { background: rgba(63, 143, 90, .14); color: var(--ok); }
.face.bad { background: rgba(194, 69, 58, .12); color: var(--bad); }
.err { color: var(--bad); font-size: 14px; margin: 10px 0 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; background: var(--text);
  color: var(--bg); padding: 9px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .bar .chip.time, .bar .brand .addr { display: none; }
  .qr-corner .txt { display: none; }
  .qr-corner .mini { width: 72px; height: 72px; }
}
