/* Member screens: home, the chat thread, the page editor, pages and brand. */

/* Segmented choice: links or radio labels in one soft pill */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.seg > :is(a, button, span, label) { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; margin: 0; padding: 3px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 400; text-decoration: none; cursor: pointer; }
.seg > a:hover { color: var(--ink); text-decoration: none; }
.seg > [aria-current="page"], .seg > .on, .seg > label:has(:checked) { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font-weight: 600; }
.seg > label:has(:focus-visible) { outline: 2px solid var(--violet-ink); outline-offset: 1px; }
.seg > span { cursor: default; }
.spacer { flex: 1; }
.spin { flex: none; display: inline-block; width: 16px; height: 16px; border: 2.5px solid #e2dcff; border-top-color: var(--violet); border-radius: 50%; animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* Screen header: title, one muted line, the action on the right */
.screen-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: 18px; }
.screen-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 24px; }
.sub { margin: 0; color: var(--muted); }
.count { color: var(--ink-2); font-weight: 400; }

/* Pills: a page's stage, a review's state */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: #f1f0f5; color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.pill[data-stage="live"], .pill.live { background: var(--positive-bg); color: var(--positive); }
.pill[data-stage="live"]::before, .pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #1fb866; }
.pill[data-stage="awaiting_release"], .pill.wait { background: var(--warning-bg); color: var(--warning); }
.pill[data-stage="building"] { background: #efebfc; color: var(--violet-ink); }

/* Home: one prompt over the lavender wash */
#main.washed { background: var(--wash), var(--surface); padding: 0 24px 48px; }
.home { width: 100%; max-width: 720px; margin: 0 auto; }
.hero { margin: clamp(48px, 14vh, 150px) 0 28px; text-align: center; font-size: 34px; letter-spacing: -.01em; }
.opener { display: flex; align-items: baseline; gap: 12px; margin: clamp(48px, 14vh, 150px) 4px 0; }
.opener a { flex: none; font-size: 13px; }
.opener + .hero { margin-top: 28px; }
.opener + .opener { margin-top: 12px; }
.chipline { margin: 22px 4px 10px; color: var(--ink-2); font-size: 13px; }
.home .chips { gap: 8px; margin: 0; }
.fixture-requests { margin: 14px 4px 0; }
.fixture-requests > summary { min-height: 0; color: var(--muted); font-size: 12.5px; }
.recent { margin-top: 64px; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.recent-head h2 { margin: 0; font-size: 15px; }
.recent-head a { font-size: 13px; }

/* The prompt box: the composer on every screen */
.prompt { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 14px 14px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lift); }
.prompt:focus-within { border-color: #c9bff5; }
.prompt textarea { width: 100%; min-height: 46px; max-height: 240px; padding: 2px; border: 0; border-radius: 0; background: transparent; field-sizing: content; resize: none; }
.prompt textarea:focus-visible { outline: none; }
.prompt-row { display: flex; align-items: center; gap: 10px; }
.prompt-mode { display: flex; align-items: center; gap: 6px; margin: 0; }
.prompt-mode[hidden] { display: none; }
.prompt-refusal { margin: 0; color: var(--negative); font-size: var(--fs-small); }
.prompt-refusal:empty { display: none; }
.ctx { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); color: var(--ink); font-size: 12.5px; }
.ctx .sq { flex: none; width: 12px; height: 12px; border: 1.5px solid var(--violet); border-radius: 3px; }
.send { flex: none; width: 34px; min-height: 34px; height: 34px; margin-left: auto; padding: 0; border: 0; border-radius: 10px; background: var(--brand) !important; color: #fff; font-size: 16px; }
.prompt-row > .ctx { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.prompt .prompt-tool { flex: none; min-height: 32px; height: 32px; padding: 0 10px; border-radius: 9px; font-size: 13px; }
.prompt .prompt-tool[aria-label] { width: 32px; padding: 0; font-size: 19px; font-weight: 400; }
.prompt .prompt-tool[aria-pressed="true"] { border-color: var(--violet); background: var(--soft); color: var(--violet-ink); }

/* Context items: a message's images, PDFs and the parts of the page it points at, as chips */
.prompt-context, .msg-context { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; margin: 0; padding: 0; list-style: none; }
.prompt-context[hidden] { display: none; }
.msg-context { justify-content: flex-end; }
.prompt-context .ctx, .msg-context .ctx { max-width: 100%; }
.prompt-context .ctx { padding-right: 4px; }
.ctx-label, .msg-context .ctx { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg-context a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: inherit; }
.ctx-thumb { flex: none; width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.ctx-kind { flex: none; padding: 0 4px; border-radius: 4px; background: var(--violet-ink); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; letter-spacing: .02em; }
.prompt .prompt-context .ctx-remove { flex: none; width: 22px; min-height: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; }
.prompt .prompt-context .ctx-remove:hover { background: var(--line); color: var(--ink); }
.checked-shot { max-width: 280px; margin: 10px 0 0; }
.checked-shot a { display: block; }
.checked-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.checked-shot figcaption { margin-top: 5px; color: var(--muted); font-size: 12px; }

/* Page cards: the pages grid and recent pages */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.page-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.page-card:hover { border-color: #d9d2f7; text-decoration: none; }
.thumb { display: block; height: 120px; padding: 14px; background: linear-gradient(180deg, #f6f3ff, #fff); }
.thumb i { display: block; height: 7px; margin-bottom: 7px; border-radius: 4px; background: #e3def7; }
.thumb i.h { width: 70%; height: 12px; background: #cfc6f5; }
.thumb i.w { width: 80%; }
.thumb i.b { width: 34%; height: 16px; margin-top: 12px; background: var(--brand); opacity: .75; }
.thumb.shot { height: 140px; padding: 0; overflow: hidden; border-bottom: 1px solid var(--line-soft); background: #f3f2f7; }
.thumb.shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.page-card-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 12px; }
.page-card-meta b { font-size: 13.5px; overflow-wrap: anywhere; }
.chat-card { border-style: dashed; border-color: #d9d2f7; }
.chat-card .thumb i { animation: thumb-draft 1.6s ease-in-out infinite alternate; }
.chat-card .thumb i:nth-child(2) { animation-delay: .2s; }
.chat-card .thumb i:nth-child(3) { animation-delay: .4s; }
.chat-card:not([data-activity="working"]) .thumb i { animation: none; }
@keyframes thumb-draft { from { opacity: .45; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chat-card .thumb i { animation: none; } }
.chat-card .page-card-meta b { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.chat-card .spin { width: 11px; height: 11px; border-width: 2px; }
.chat-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chat-list li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 10px 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); }
.chat-list a { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.chat-list small { color: var(--muted); font-size: 12px; }
.pill[data-activity="working"] { background: #efebfc; color: var(--violet-ink); }
.pill[data-activity="waiting_on_you"] { background: var(--warning-bg); color: var(--warning); }
.pill[data-activity="failed"] { background: var(--negative-bg); color: var(--negative); }
.page-card-meta small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
@media (max-width: 899px) {
  .hero { font-size: 26px; }
  .recent { margin-top: 40px; }
}

/* The chat: a centered thread over the wash, the composer pinned below */
#main.chat-screen { padding: 0 24px; }
.chat { display: flex; flex-direction: column; width: 100%; max-width: 720px; min-height: 100%; margin: 0 auto; }
.chathead { position: sticky; top: 14px; z-index: 3; display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgb(255 255 255 / .85); backdrop-filter: blur(6px); }
.chathead-new, .panehead-new { margin-left: auto; color: var(--ink-2); font-size: 13px; text-decoration: none; white-space: nowrap; }
.chat .thread { flex: 1; padding: 22px 0 24px; }
.chat-dock { position: sticky; bottom: 0; z-index: 3; padding: 12px 0 18px; background: linear-gradient(180deg, transparent, rgb(255 255 255 / .92) 30%); }
.chat-dock .prompt textarea { min-height: 24px; }

/* Thread turns: the person's bubble on the right, Aristokrat in plain text */
.thread { display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow-anchor: none; }
.me { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 78%; }
.me .bubble { margin: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); line-height: 1.55; white-space: pre-wrap; }
.me .by { margin: 0 4px; color: var(--muted); font-size: 11.5px; }
.me.pending { opacity: .6; }
.turn { min-width: 0; }
.ai-text { margin: 0; line-height: 1.6; }
.ai-text > :is(p, ul, ol) { margin: 0 0 8px; }
.ai-text > .table-region { margin: 4px 0 8px; }
.ai-text > :last-child { margin-bottom: 0; }
.ai-text :is(ul, ol) { padding-left: 22px; }
.ai-text ul { list-style: disc; }
.ai-text ol { list-style: decimal; }
.ai-text code { padding: 1px 4px; border-radius: 4px; background: var(--surface); font-size: .92em; }
.thinking { margin: 0; color: var(--muted); font-size: 13px; }
.thinking-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.thinking-line .thinking { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thinking-line .run-cancel { flex: none; }
@media (max-width: 600px) { .thinking:has(.thinking-doing) .thinking-word { display: none; } }

/* A run: Thought process, then one line per step with its Result */
.run { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.thought { margin: 0; }
.thought > summary, .progress-children > summary, .decision-details > summary, .publish-more > summary { list-style: none; }
:is(.thought, .progress-children, .decision-details, .pop, .person) > summary::-webkit-details-marker { display: none; }
.thought > summary { display: inline-flex; min-height: 24px; padding: 0; color: var(--muted); font-size: 12.5px; }
.thought > summary::after { content: " ›"; margin-left: 3px; }
.thought[open] > summary::after { content: " ⌄"; }
.trace { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; padding: 10px 12px; border-left: 2px solid var(--line); color: var(--ink-2); font-size: 12.5px; }
.thought-steps { display: flex; flex-direction: column; gap: 2px; margin: 0 0 4px; padding-left: 18px; color: var(--ink); font-size: 13px; line-height: 1.45; }
.run-session, .run-usage-details { margin: 0; }
:is(.run-session, .run-usage-details) > summary { min-height: 24px; padding: 0; color: var(--muted); }
.run-transcript { margin: 6px 0; padding-left: 18px; }
.run-line pre, .admin-only pre { max-height: 320px; overflow: auto; }
.run-call { margin: 2px 0; }
.admin-only { border: 1px dashed color-mix(in srgb, var(--warning) 50%, var(--line)); border-radius: var(--radius-sm); padding: 0 var(--space-2); }
.admin-only > summary { color: var(--warning); }
/* A progress list (shared/_progress): a mark per step on one thread, the
   step's words and timer, one line of detail, and named sub-steps */
.progress { list-style: none; display: flex; flex-direction: column; margin: 0; padding: 0; }
.progress-step { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 10px; margin: 0; padding: 0 0 10px; }
.progress-step:not(:last-child)::before { content: ""; position: absolute; left: 11.5px; top: 26px; bottom: 2px; border-left: 1px solid var(--line); }
.progress-step[data-state="done"]:not(:last-child)::before { border-left-color: color-mix(in srgb, var(--positive) 35%, var(--line)); }
.progress-mark { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 1px dashed var(--control-line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1; }
[data-state="done"] > .progress-mark { border: 0; background: var(--positive-bg); color: var(--positive); }
[data-state="failed"] > .progress-mark { border: 0; background: var(--negative-bg); color: var(--negative); }
[data-state="needs_you"] > .progress-mark, [data-state="unverified"] > .progress-mark { border: 0; background: var(--warning-bg); color: var(--warning); }
[data-state="running"] > .progress-mark { border: 0; background: transparent; }
[data-state="running"] > .progress-mark .spin { width: 18px; height: 18px; border-width: 2.5px; }
[data-state="queued"] > .progress-mark { border: 1px solid #cfc4ff; }
[data-state="queued"] > .progress-mark > span::before { content: ""; display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); animation: queued-pulse 1.4s ease-in-out infinite; }
@keyframes queued-pulse { 50% { opacity: .25; transform: scale(.7); } }
.progress-body { min-width: 0; padding-top: 2px; }
.progress-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0; font-size: 13.5px; line-height: 1.45; }
.progress-label { color: var(--ink); }
[data-state="waiting"] .progress-label { color: var(--muted); }
[data-state="running"] > .progress-body > .progress-line .progress-label, [data-state="queued"] > .progress-body > .progress-line .progress-label { font-weight: 600; }
.progress-state { color: var(--muted); font-size: 12.5px; }
[data-state="needs_you"] .progress-state { color: var(--warning); font-weight: 600; }
[data-state="queued"] .progress-state { color: var(--accent); }
.progress-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-state + .progress-time::before { content: "· "; }
.progress-detail { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
/* A long detail shows two lines until clicked open */
.progress-detail-more > summary { display: -webkit-box; overflow: hidden; cursor: pointer; list-style: none; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.progress-detail-more > summary::-webkit-details-marker { display: none; }
.progress-detail-more > summary:hover { text-decoration: underline dotted; }
.progress-detail-more[open] > summary { display: block; }
[data-state="failed"] > .progress-body > .progress-detail { color: var(--negative); }
.progress-children { margin: 4px 0 0; }
.progress-children > summary { display: inline-flex; min-height: 24px; align-items: center; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.progress-children > summary::after { content: " ›"; margin-left: 4px; }
.progress-children[open] > summary::after { content: " ⌄"; }
.progress-children ol { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; margin: 4px 0 0; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fcfbff; }
.progress-child { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 8px; align-items: center; margin: 0; font-size: 12.5px; }
.progress-child .progress-mark { width: 18px; height: 18px; font-size: 10px; }
.progress-child[data-state="running"] .progress-mark .spin { width: 12px; height: 12px; border-width: 2px; }
.progress-child .progress-detail { grid-column: 2; margin: 0; color: var(--ink-2); }
.progress-child[data-state="failed"] .progress-detail { color: var(--negative); }
@media (prefers-reduced-motion: reduce) { [data-state="queued"] > .progress-mark > span::before { animation: none; } }
.run-produced { margin: 4px 0 0; font-size: 13px; }
.run-intent { margin: 2px 0 4px; color: var(--ink); font-size: 14px; line-height: 1.5; }
.run-changes { margin: 4px 0 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: #fcfbff; font-size: 13px; }
.run-changes-head { margin: 0 0 4px; font-weight: 600; }
.run-changes ul { margin: 0; padding-left: 18px; }
.run-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; color: var(--ink-2); font-size: 12px; }
.run-status { font-weight: 600; }
.run-cancel { display: inline-block; margin: 0 0 0 auto; }
.run-usage { font-size: 12px; }

/* The decision card: plan, question or any review, with one action row */
.decision { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.decision-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.decision-head h3 { flex: 1; margin: 0; color: var(--ink); font-size: 15px; letter-spacing: 0; text-transform: none; line-height: 1.4; }
.pill[data-tone="warn"], .pill[data-tone="active"] { background: var(--warning-bg); color: var(--warning); }
.pill[data-tone="ok"] { background: var(--positive-bg); color: var(--positive); }
.pill[data-tone="bad"] { background: var(--negative-bg); color: var(--negative); }
.decision-body { container-type: inline-size; padding: 4px 16px 14px; color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.decision-lead { margin: 0 0 8px; }
.facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 10px 0 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); }
.facts ul { margin: 0; padding-left: 18px; }
.facts .form-rules { margin-top: 2px; font-size: 12.5px; }
.facts .form-rules :is(th, td) { min-width: 0; padding: 4px 8px 4px 0; }
.form-rules td { overflow-wrap: break-word; }
.form-rules .form-reason td { padding-top: 0; border-top: 0; color: var(--muted); }
@container (max-width: 480px) { .facts dd:has(> :is(.form-rules, .chat-preview)) { grid-column: 1 / -1; } }
.facts .form-fields summary { color: var(--violet-ink); cursor: pointer; }
.facts dd:has(> .form-format-change) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.form-format-change { margin: 0; }
.form-format-change[open] { flex-basis: 100%; }
.form-format-change > summary { width: fit-content; min-height: 0; padding: 0; color: var(--violet-ink); font-size: 12.5px; }
.facts .form-format-change ul { display: grid; gap: 8px; margin: 6px 0 2px; padding: 0; list-style: none; }
.form-format-option { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; }
.form-format-option > span { flex: 1 1 16em; }

/* A chat form's opening as a still, drawn as the live chat page draws it: plain bot lines, a tapped answer as its question's chips with the answer marked, then the current options and the composer */
.chat-preview { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 460px; margin: 4px 0 0; padding: 14px 12px 12px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--side); font-size: 13px; line-height: 1.5; }
.chat-preview > [data-says="bot"] { max-width: 85%; margin: 0; color: var(--ink); }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chat-chips > [aria-hidden], .chat-choices > span { padding: 4px 11px; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); border-radius: 999px; color: var(--ink); font-size: 12.5px; }
.chat-chips > [aria-hidden] { opacity: .7; }
.chat-chips > [data-chosen] { border-color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); opacity: 1; }
.chat-composer { align-self: stretch; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.chat-composer > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-composer > i { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--soft); font-style: normal; }
.chat-composer > i::before { content: "↑"; }
.drawer-body .chat-preview { max-width: none; }
.decision-details { margin: 10px 0 0; }
.decision-details > summary { min-height: 24px; padding: 0; color: var(--violet-ink); font-size: 12.5px; font-weight: 600; }
.decision-details > summary::after { content: " ›"; }
.decision-details[open] > summary::after { content: " ⌄"; }
.decision-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; border-top: 1px solid var(--line-soft); background: #fcfbff; }
.decision-actions .decision-answer { display: flex; flex: 1; flex-wrap: wrap; gap: 8px; }
.decision-changes { margin: 0 !important; }
.decision-changes > summary { list-style: none; }
.decision-changes > summary::-webkit-details-marker { display: none; }
.decision-changes[open] { order: 9; flex-basis: 100%; }
.decision-changes[open] > summary { display: none; }
.decision-reason { display: flex; flex-direction: column; gap: var(--space-2); }
.decision-reason-first { flex-basis: 100%; }
.decision-reason label { margin: 0; }
.decision-withdraw { margin: 0 16px 12px; }
.decision-error { margin: 8px 0 0; color: var(--negative); }
.decision-outcome { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line-soft); color: var(--muted); }

/* The page editor: the chat pane on the left, the canvas on the right */
#main.editor-screen { padding: 0; }
.editor { flex: none; display: grid; grid-template-columns: 380px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; height: calc(100dvh - 18px - var(--banner, 0px)); }
.frame:has(.admin-banner) { --banner: 42px; }
.editor-switch { display: none; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line-soft); background: linear-gradient(180deg, #faf9ff, #f6f3ff); }
.panehead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.panehead h1 { min-width: 0; margin: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.panehead-back { color: var(--ink); text-decoration: none; }
.panethread { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; padding: 16px 16px 8px; font-size: 13.5px; }
.panethread .me { max-width: 90%; }
.panethread .facts { grid-template-columns: 88px minmax(0, 1fr); }
.pane-empty { margin: 8px 0; color: var(--muted); }
.panedock { padding: 10px 12px 14px; }
.panedock .prompt { padding: 12px; border-radius: 14px; }
.panedock .prompt textarea { min-height: 40px; }
.publish-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 10px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font-size: 12.5px; }
.publish-bar b { flex: 1 1 auto; white-space: nowrap; }
.publish-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.publish-bar .btn { min-height: 30px; padding: 5px 9px; font-size: 12.5px; white-space: nowrap; }
.publish-bar .btn.ghost { padding: 5px 6px; }
.publish-more { display: contents; }
.publish-more > summary { min-height: 24px; padding: 0 4px; color: var(--ink-2); }
.publish-more[open] > summary { transform: rotate(90deg); }
.publish-more > .facts { order: 9; flex-basis: 100%; margin: 4px 0 2px; }
.canvaswrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
.toolbar .drawers { display: flex; align-items: center; }
.pop { position: relative; margin: 0; }
.pop > summary { list-style: none; }
.select { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font-size: 13px; }
.select::after { content: "⌄"; margin-top: -4px; color: var(--muted); }
.btn.checks-state { min-height: 32px; padding: 4px 8px; font-size: 12.5px; }
.btn.checks-state[data-tone="ok"] { color: var(--positive); }
.btn.checks-state[data-tone="warn"] { color: var(--warning); }
.btn.checks-state[data-tone="bad"] { color: var(--negative); }
.checks-note > summary::after { content: "⌄"; margin: -4px 0 0 6px; color: var(--muted); }
.checks-note .pop-body p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; }
@media (max-width: 600px) { .checks-note .pop-body { position: fixed; top: auto; left: 16px; right: 16px; width: auto; } }
.pop-body { position: absolute; z-index: 8; top: calc(100% + 6px); left: 0; width: 320px; max-height: 70vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lift); }
.ver { margin: 0 0 6px calc(var(--depth, 0) * 12px); padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 12px; }
.ver.on { border-color: var(--violet); }
.ver p { margin: 3px 0 0; }
.ver-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13.5px; }
.ver .work-from { margin-top: 8px; }
:is(.settings, .checks-pop, .form-pop, .results) .drawer { width: min(600px, 100vw); }
.results-skeleton { display: grid; gap: 10px; margin-top: 16px; }
.results-skeleton span:not(.sr-only) { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--line-soft) 25%, #fbfaff 50%, var(--line-soft) 75%); background-size: 200% 100%; animation: results-shimmer 1.2s linear infinite; }
.results-skeleton span:nth-child(3) { width: 70%; }
@keyframes results-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .results-skeleton span { animation: none; } }
.results-deployment { margin: 12px 0 22px; }
.results-deployment h4 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 14px; }
.results-totals { margin: 0 0 8px; font-size: 13px; }
:is(.results-deployment, .results-leads, .results-lead) table { width: 100%; margin: 6px 0 10px; border-collapse: collapse; font-size: 13px; }
:is(.results-deployment, .results-leads, .results-lead) :is(th, td) { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line-soft); text-align: left; }
:is(.results-deployment, .results-leads) :is(th, td):not(:first-child) { white-space: nowrap; }
.results-lead h3 { margin: 12px 0 4px; overflow-wrap: anywhere; }
.results-lead h4 { margin: 18px 0 2px; font-size: 14px; }
.results-lead-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; color: var(--muted); font-size: 13px; }
.results-journey { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.results-journey li { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 8px; align-items: baseline; }
.results-journey-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.results-turns { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.results-turns li { display: grid; gap: 2px; }
#operation:has(.operation) { margin: 10px 16px 0; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 12.5px; background: #fcfbff; }
#operation p { margin: 0 0 4px; }
.canvas { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 22px; background: #f3f2f7; }
.canvas .preview-frame { margin: 0; }
.canvas .preview-viewport { overflow: hidden; border-radius: 10px; background: var(--surface); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.canvas .preview-viewport iframe { display: block; max-width: none; border: 0; transform-origin: 0 0; }
.preview-mobile { max-width: 390px; margin: 0 auto !important; }
.editor:has(#preview_view [value="desktop"]:checked) .canvas .preview-mobile,
.editor:has(#preview_view [value="mobile"]:checked) .canvas .preview-frame:not(.preview-mobile) { display: none; }
/* Try it shows only for a version with a form; the permanent radio group can outlive one, so a checked Try it with no form shows Desktop. */
.editor:not(:has(.canvas .try-it)) #preview_view label:has([value="try"]),
.editor:has(#preview_view [value="try"]:checked) .canvas:has(.try-it) > .preview-frame,
.editor:has(#preview_view [value="try"]:checked) .canvas:not(:has(.try-it)) .preview-mobile,
.editor:not(:has(#preview_view [value="try"]:checked)) .canvas .try-it { display: none; }
.canvas .try-it { display: grid; grid-template-columns: minmax(0, 390px) 280px; justify-content: center; gap: 16px; align-items: start; height: 100%; }
.try-frame { height: 100%; margin: 0; }
.try-frame iframe { display: block; width: 100%; height: 100%; min-height: 480px; border: 0; border-radius: 10px; background: var(--surface); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.try-panel { position: sticky; top: 0; padding: 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); font-size: 13px; }
.try-head { display: flex; align-items: flex-start; gap: 8px; }
.try-head p { margin: 2px 0 0; }
.try-head h2 { margin: 0; font-size: 14px; }
.try-head .btn { margin-left: auto; }
.try-panel h3 { margin: 14px 0 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.try-values { margin: 8px 0 0; }
.try-values dt { margin-top: 8px; color: var(--muted); font-size: 12px; }
.try-values dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.try-heading { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .canvas .try-it { grid-template-columns: minmax(0, 390px); height: auto; }
  .try-panel { order: -1; position: static; padding: 10px 12px; }
  .try-panel h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .try-panel :is(.try-values, [data-try-it-target="empty"]) { display: none; }
  .try-head p { margin: 0; }
  .try-panel h3 { margin-top: 8px; }
  .try-frame iframe { height: calc(100dvh - 250px); }
}
.working { display: grid; place-items: center; min-height: 100%; border-radius: 10px; background: var(--wash), #fbfaff; text-align: center; }
.working .win { position: relative; width: 260px; max-width: 70vw; height: 130px; margin: 0 auto 26px; border: 1px solid rgb(123 92 255 / .25); border-radius: 16px; background: rgb(255 255 255 / .5); }
.working .win::before { content: "● ● ●"; position: absolute; left: 14px; top: 8px; color: #ff6b6b; font-size: 9px; letter-spacing: 2px; }
.working-title { margin: 0; font-size: 26px; font-weight: 600; }
.working .muted { margin: 4px 0 0; }
.working.idle { padding: 24px; }
@media (max-width: 899px) {
  .editor { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - 56px); }
  .editor-switch { display: inline-flex; align-self: center; margin: 10px auto; }
  .editor:has(#editor_view [value="chat"]:checked) .canvaswrap, .editor:has(#editor_view [value="page"]:checked) .pane { display: none; }
  .pane { flex: 1; border-right: 0; }
  .panethread { overflow: visible; }
  .canvas { padding: 12px; scrollbar-gutter: auto; }
  .toolbar { padding: 10px 12px; }
}

/* Brand: the shell beside logos, colors and fonts */
.brand-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 8px; }
.brand-side { display: grid; gap: 18px; min-width: 0; }
.panel-card { min-width: 0; padding: 18px; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.panel-card h2 { margin: 0 0 12px; font-size: 14px; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.shell-panel .preview-viewport { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 10px; }
.shell-panel .preview-viewport iframe { display: block; max-width: none; border: 0; transform-origin: 0 0; }
.shell-panel:has(#shell_view [value="desktop"]:checked) .preview-mobile, .shell-panel:has(#shell_view [value="mobile"]:checked) .preview-frame:not(.preview-mobile) { display: none; }
.shell-panel .preview-frame { margin: 0; }
.shell-meta { margin: 12px 0 0; }
.logo-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.logo-row .logo-tile { margin: 0; height: 64px; border: 1px solid var(--line-soft); border-radius: 10px; }
.logo-row .logo-tile.empty { border: 1px dashed var(--line); background: var(--surface); color: var(--muted); text-align: center; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.swatches .swatch { border: 0; background: none; }
.swatches .swatch > div { height: 54px; border: 1px solid rgb(0 0 0 / .06); border-radius: 10px; }
.swatches .swatch small { display: block; margin-top: 6px; color: var(--ink-2); font-size: 11.5px; }
.font-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.font-row:last-of-type { border-bottom: 0; }
#brand-tags .row { justify-content: space-between; }
.fonts .font-sample { font-size: 20px; line-height: 1.3; }
#decisions { margin: 0 0 18px; }
@media (max-width: 1100px) { .brand-grid { grid-template-columns: minmax(0, 1fr); } }

/* Brand's setup while it runs: the steps, then the captured header and footer */
.setup-progress { margin-bottom: 18px; }
.setup-end { margin: 0 0 18px; color: var(--muted); }
.setup-progress .progress-step .button_to, .setup-progress .progress-step form { margin: 6px 0 0; }
.capture-shots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.capture-shots figure { width: min(320px, 100%); margin: 0; }
.capture-shots img { display: block; width: 100%; height: 96px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--soft); }
.capture-shots [data-part="footer"] img { object-position: bottom; }
.capture-shots figcaption { margin-top: 3px; color: var(--muted); font-size: 11.5px; }

/* The checks panel (pages/_checks): a verdict, Lighthouse rings that fill
   to their score, a badge per check revealed in turn, and the proof line.
   The animations run each time the drawer opens, since the closed dialog's
   content is not rendered. */
.checks-panel { display: flex; flex-direction: column; gap: 18px; margin-top: 14px; }
.checks-hero { --hero: var(--positive); --hero-bg: var(--positive-bg); display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--hero) 22%, var(--line-soft)); border-radius: var(--radius); background: radial-gradient(420px 160px at 0% 0%, color-mix(in srgb, var(--hero-bg) 90%, #fff), transparent 70%), linear-gradient(135deg, color-mix(in srgb, var(--hero-bg) 60%, #fff), var(--surface)); }
.checks-hero[data-tone="warn"] { --hero: var(--warning); --hero-bg: var(--warning-bg); }
.checks-hero[data-tone="bad"] { --hero: var(--negative); --hero-bg: var(--negative-bg); }
.checks-seal { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--hero) 70%, #fff), var(--hero)); box-shadow: 0 6px 18px color-mix(in srgb, var(--hero) 35%, transparent), inset 0 1px 0 rgb(255 255 255 / .35); color: #fff; font-size: 22px; font-weight: 700; animation: seal-pop .55s cubic-bezier(.2, 1.5, .4, 1) both; }
.checks-verdict { margin: 0; color: var(--ink); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.checks-sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
@keyframes seal-pop { from { opacity: 0; transform: scale(.4) rotate(-20deg); } }

.score-rings { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; }
.score { --dial: var(--positive); display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; text-align: center; }
.score[data-passed="false"] { --dial: var(--negative); }
.dial { position: relative; display: grid; place-items: center; width: 78px; height: 78px; margin-bottom: 4px; }
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.dial circle { fill: none; stroke-width: 6; }
.dial .dial-track { stroke: color-mix(in srgb, var(--dial) 12%, #eeedf3); fill: color-mix(in srgb, var(--dial) 6%, #fff); }
.dial-value { stroke: var(--dial); stroke-linecap: round; stroke-dasharray: 100; filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--dial) 35%, transparent)); animation: ring-fill 1.1s cubic-bezier(.2, .8, .2, 1) .1s both; }
.dial-number { position: relative; color: var(--dial); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.score-name { color: var(--ink); font-size: 12.5px; font-weight: 600; }
.score-needs { color: var(--muted); font-size: 11.5px; }
@keyframes ring-fill { from { stroke-dashoffset: 100; } }

.check-badges { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; }
.check-badge { --badge: var(--positive); --badge-bg: var(--positive-bg); position: relative; display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 2px rgb(23 21 31 / .04); animation: badge-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.35s + var(--i, 0) * 70ms); }
.check-badge[data-state="failed"] { --badge: var(--negative); --badge-bg: var(--negative-bg); border-color: color-mix(in srgb, var(--negative) 40%, var(--line-soft)); background: color-mix(in srgb, var(--negative-bg) 45%, var(--surface)); }
.check-badge[data-state="unverified"] { --badge: var(--warning); --badge-bg: var(--warning-bg); }
.check-badge[data-state="none"] { --badge: var(--muted); --badge-bg: var(--soft); }
.check-badge-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--badge-bg); color: var(--badge); }
.check-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.check-badge-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding-right: 18px; }
.check-badge-text b { color: var(--ink); font-size: 13px; line-height: 1.35; }
.check-badge-message { color: var(--negative); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.check-badge[data-state="unverified"] .check-badge-message { color: var(--ink-2); }
.check-badge-override { color: var(--warning); font-size: 11.5px; font-weight: 600; }
.check-badge-tick { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--positive); color: #fff; font-size: 10px; font-weight: 700; animation: tick-pop .35s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: calc(.6s + var(--i, 0) * 70ms); }
@keyframes badge-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes tick-pop { from { opacity: 0; transform: scale(0); } }

.checks-proof { margin: 0; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; line-height: 1.6; }
@media (max-width: 480px) {
  .score-rings { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .check-badges { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .checks-seal, .dial-value, .check-badge, .check-badge-tick { animation: none; }
}

/* Four Lighthouse scores in a row: the editor bar, the chat's build line, page cards */
.score-strip { display: inline-flex; align-items: baseline; gap: 3px; margin-left: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-strip b { color: var(--positive); font-weight: 700; }
.score-strip b[data-passed="false"] { color: var(--negative); }
.score-strip i { font-style: normal; }
.checks-state .score-strip { gap: 2px; margin-left: 2px; font-size: 11.5px; }
