/* Threadpull Lite. One stylesheet for the website, the workspace and the client view.
   --accent is replaced per studio by /app/brand.css or /c/<link>/brand.css. */

:root {
  --ink: #171d28;
  --paper: #f5f4f0;
  --card: #ffffff;
  --line: #e3e0d8;
  --muted: #5d6675;
  --pink: #f3456b;
  --sky: #b3eaf3;
  --accent: #f3456b;
  --ok: #1f7a4d;
  --ok-bg: #dff3e7;
  --warn: #8a5a00;
  --warn-bg: #fdefc8;
  --bad: #a3243f;
  --bad-bg: #fde3e8;
  --radius: 14px;
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.5; color: var(--ink); background: var(--paper); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.3rem; margin-top: 1.8em; }
h3 { font-size: 1.08rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow, main.narrow { max-width: 720px; }
main { padding-bottom: 64px; }
.hint { color: var(--muted); font-size: 0.88rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; color: var(--muted); margin: 0 0 6px; }
.small-print { font-size: 0.82rem; color: var(--muted); }

/* ---- Brand ---- */
.wordmark { font-weight: 800; font-size: 1.45rem; letter-spacing: -0.05em; }
.wordmark .dot { color: var(--pink); }
.brand { text-decoration: none; }

/* ---- Buttons and forms ---- */
.button, button.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--ink); color: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 10px 20px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.button:hover { opacity: 0.9; }
.button.secondary { background: transparent; color: var(--ink); border-color: #c9c5ba; }
.button.small { padding: 7px 14px; font-size: 0.9rem; }
.button.danger { background: var(--bad); border-color: var(--bad); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.link-button.danger { color: var(--bad); }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
label { display: block; font-weight: 600; font-size: 0.95rem; }
input[type="text"], input[type="email"], input[type="url"], input[type="date"], input[type="number"], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #cfcabd; border-radius: 10px; }
textarea { resize: vertical; min-height: 3em; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; margin-bottom: 10px; }
.stack > * + * { margin-top: 16px; }
.stack.tight > * + * { margin-top: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--ink); }
.field-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---- Cards and common pieces ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.empty { text-align: center; color: var(--muted); padding: 36px 22px; }
.card.list { padding: 0; overflow: hidden; }
.form-card { margin-top: 48px; }
.wide-form { max-width: 860px; }
.flash { border-radius: 12px; padding: 12px 16px; margin: 16px 0; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.chip { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: 0.8rem; font-weight: 600; background: #ece9e1; color: var(--muted); white-space: nowrap; }
.chip-submitted { background: var(--sky); color: #0f4a55; }
.chip-changes { background: var(--warn-bg); color: var(--warn); }
.chip-approved { background: var(--ok-bg); color: var(--ok); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 12px; border: 0; border-radius: 999px; background: #e6e2d8; overflow: hidden; display: block; }
progress::-webkit-progress-bar { background: #e6e2d8; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress-block { margin: 18px 0; }
.progress-text { margin-bottom: 8px; }
details > summary { cursor: pointer; }
.dev-note { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px 16px; }
.message-page { padding-top: 80px; text-align: center; }
.message-page h1 { margin-top: 32px; }

/* ---- Headers ---- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 68px; flex-wrap: wrap; }
.site-header, .app-header { background: var(--ink); color: #fff; }
.site-nav, .app-nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.site-nav a, .app-nav a { text-decoration: none; color: #d7dbe3; font-weight: 500; font-size: 0.95rem; }
.site-nav a:hover, .app-nav a:hover, .app-nav a.current { color: #fff; }
.app-nav a.current { box-shadow: 0 2px 0 var(--pink); }
.site-header .button { background: var(--pink); border-color: var(--pink); color: #fff; }
.who { display: flex; gap: 14px; align-items: center; font-size: 0.9rem; color: #d7dbe3; }
.dev-link { color: var(--sky) !important; }
.trial-banner { background: var(--sky); color: #0f4a55; text-align: center; padding: 8px 16px; font-size: 0.92rem; font-weight: 500; }
.trial-banner.ended { background: var(--warn-bg); color: var(--warn); }

/* ---- Workspace ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 36px 0 20px; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumbs { margin: 28px 0 -24px; font-size: 0.9rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat strong { display: block; font-size: 2rem; letter-spacing: -0.03em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.9rem; }
.stat.attention { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.columns > section > h2:first-child, .columns > aside > h2:first-child { margin-top: 1.2em; }
.project-row, .owed-row, .outbox-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 20px; text-decoration: none; border-bottom: 1px solid var(--line); }
.project-row:last-child, .owed-row:last-child, .outbox-row:last-child { border-bottom: 0; }
.project-row:hover, .owed-row:hover { background: #faf9f6; }
.project-main strong { display: block; }
.project-bar progress { height: 8px; margin-bottom: 4px; }
.project-flags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.outbox-row { grid-template-columns: minmax(0, 1fr) auto; }
.activity ul { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; display: grid; gap: 2px; }
.activity li:last-child { border-bottom: 0; }
.side-card { margin-bottom: 16px; }
.side-card h3 { margin-bottom: 12px; }
.side-card form + form, .side-card form + p, .side-card details + form { margin-top: 10px; }
.link-box { font-size: 0.82rem !important; color: var(--muted) !important; background: var(--paper) !important; }
.inline-form { margin-top: 8px; }
.inline-form > summary { list-style: none; display: inline-flex; }
.inline-form > summary::-webkit-details-marker { display: none; }
.inline-form:not(:has(.button)) > summary { text-decoration: underline; font-size: 0.9rem; color: var(--muted); }
.inline-form[open] > form { margin-top: 12px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(23, 29, 40, 0.14); min-width: 260px; z-index: 5; overflow: hidden; }
.menu-items a { display: block; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.menu-items a:last-child { border-bottom: 0; }
.menu-items a:hover { background: var(--paper); }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.template-option input { position: absolute; opacity: 0; }
.template-card { display: grid; gap: 6px; height: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; font-weight: 400; }
.template-card strong { font-size: 1.02rem; }
.template-option input:checked + .template-card { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #faf9f6; }
.template-option input:focus-visible + .template-card { outline: 3px solid var(--sky); }

/* ---- Questions (both views) ---- */
.page-title { display: flex; align-items: baseline; gap: 10px; }
.question { margin-bottom: 16px; }
.question-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.question-head h3 { margin: 0 0 6px; }
.optional { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.help { color: var(--muted); margin-bottom: 10px; }
.changes-note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-weight: 500; }
.example { background: var(--paper); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 0.93rem; }
.example p { margin: 8px 0 0; color: var(--muted); }
.example summary { font-weight: 600; }
.save-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; min-height: 28px; }
.js .save-row [data-save-button] { display: none; }
.save-state { font-size: 0.88rem; color: var(--muted); }
.save-state.saved { color: var(--ok); font-weight: 600; }
.save-state.failed { color: var(--bad); font-weight: 600; }
.choices { display: grid; gap: 8px; margin-top: 4px; }
.choice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1.5px solid #cfcabd; border-radius: 10px; font-weight: 500; cursor: pointer; background: #fff; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.colour-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; }
.colour-row input[type="color"] { width: 56px; height: 46px; padding: 2px; border: 1.5px solid #cfcabd; border-radius: 10px; background: #fff; margin-top: 6px; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); vertical-align: middle; }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-button { display: inline-block; margin-right: 10px; }
.upload-button input:focus-visible + .button { outline: 3px solid var(--sky); outline-offset: 2px; }
.upload-progress { margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
.upload-progress.failed { color: var(--bad); font-weight: 600; }
.note-label { margin-top: 14px; font-weight: 500; font-size: 0.9rem; color: var(--muted); }
.files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.file { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--paper); border-radius: 10px; padding: 8px; }
.thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #e6e2d8; display: block; }
.thumb.doc { display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.file-info { display: grid; gap: 2px; min-width: 0; }
.file-info a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn { color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; font-size: 0.86rem; }
.comments { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.comment { border-radius: 12px; padding: 10px 14px; background: var(--paper); font-size: 0.95rem; }
.comment p { margin: 4px 0 0; }
.comment-studio { background: #eef9fb; border-left: 3px solid var(--sky); }
.comment-meta { font-size: 0.82rem; color: var(--muted); }
.add-comment, .ai-help { margin-top: 14px; font-size: 0.93rem; }
.add-comment summary, .ai-help summary { color: var(--muted); text-decoration: underline; }
.add-comment form, .ai-help > * + * { margin-top: 10px; }
.ai-help[open] { background: #eef9fb; border-radius: 12px; padding: 14px; }
.answer { white-space: normal; }
.answer p { margin: 0 0 0.6em; }
.empty-answer { color: var(--muted); font-style: italic; }
.chosen { margin: 0 0 8px; padding-left: 20px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.review-actions .inline-form { margin-top: 0; }
.review-actions .inline-form[open] { flex: 1 1 100%; }
.review[data-status="approved"] { border-left: 4px solid var(--ok); }
.review[data-status="submitted"] { border-left: 4px solid var(--sky); }
.review[data-status="changes"] { border-left: 4px solid #f2c94c; }

/* ---- Client view ---- */
.client-header { background: #fff; border-bottom: 3px solid var(--accent); }
.client-header .bar { min-height: 72px; }
.studio-logo { max-height: 44px; max-width: 220px; display: block; }
.studio-name { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; }
.client-intro { padding: 32px 0 8px; }
.client-intro h1 { margin-bottom: 12px; }
.client .button:not(.secondary):not(.danger) { background: var(--accent); border-color: var(--accent); }
.page-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 14px; margin: 8px -20px 0; padding-left: 20px; padding-right: 20px; scrollbar-width: none; }
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs a { flex: none; text-decoration: none; padding: 9px 15px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-weight: 600; font-size: 0.92rem; }
.page-tabs a.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-tabs a.complete:not(.current) { border-color: var(--ok); color: var(--ok); }
.tab-count { font-weight: 500; opacity: 0.75; margin-left: 4px; }
.page-nav { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; flex-wrap: wrap; }
.finish-card { text-align: center; margin-top: 28px; }
.finish-card.ready { border-color: var(--ok); background: var(--ok-bg); }
.finish-card h2 { margin-top: 0; }
.client-footer { padding: 24px 0 40px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.demo-banner { background: var(--ink); color: #fff; text-align: center; padding: 10px 16px; font-size: 0.92rem; }
.demo-banner a { color: var(--sky); font-weight: 600; }

/* ---- Editor ---- */
.editor-page { margin-bottom: 22px; }
.editor-page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.editor-page-head form { display: flex; gap: 8px; align-items: center; }
.editor-page-head input { margin: 0; font-weight: 700; font-size: 1.05rem; min-width: 200px; }
.editor-question { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; background: #fff; }
.editor-question > summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; list-style: none; }
.editor-question > summary::-webkit-details-marker { display: none; }
.editor-question[open] > summary { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.type-tag { font-size: 0.78rem; background: var(--paper); border-radius: 999px; padding: 3px 10px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.mini-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.mini-actions form { display: inline; }
.add-question { border: 2px dashed #cfcabd; border-radius: 12px; padding: 12px 14px; }
.add-question[open] { border-style: solid; background: #fff; }
[data-for-types] { display: none; }
[data-for-types].show { display: block; }

/* ---- Public website ---- */
.hero { background: var(--ink); color: #fff; padding: 72px 0 84px; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); max-width: 14ch; letter-spacing: -0.04em; }
.hero h1 em { font-style: normal; color: var(--pink); }
.hero p.lead { font-size: 1.25rem; max-width: 52ch; color: #d7dbe3; }
.hero .button { background: var(--pink); border-color: var(--pink); }
.hero .button.secondary { background: transparent; border-color: #56607a; color: #fff; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero .hint { color: #a9b1c2; margin-top: 14px; }
.section { padding: 64px 0; }
.section.alt { background: #fff; }
.section h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin-top: 0; max-width: 24ch; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 28px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.section.alt .feature { background: var(--paper); }
.feature h3 { margin-bottom: 8px; }
.feature p { margin: 0; color: var(--muted); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--sky); font-weight: 800; margin-bottom: 12px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; margin-top: 28px; max-width: 760px; }
.plan { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 28px; }
.plan.featured { border-color: var(--ink); }
.plan .price { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 10px 0 4px; }
.plan .price span { font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan ul { padding-left: 20px; margin: 16px 0 22px; }
.plan li { margin-bottom: 6px; }
.cta-band { background: var(--sky); padding: 56px 0; text-align: center; }
.cta-band h2 { margin: 0 auto 16px; }
.prose { padding-top: 40px; }
.prose h2 { font-size: 1.2rem; }
.draft-banner { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 14px 18px; font-weight: 600; margin: 24px 0; }
.site-footer { background: var(--ink); color: #d7dbe3; padding: 40px 0; }
.footer-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer-grid nav { display: grid; gap: 6px; }
.footer-grid p { margin: 8px 0 0; font-size: 0.9rem; }
.site-footer .small-print { color: #a9b1c2; }
.mock { background: #fff; color: var(--ink); border-radius: 18px; padding: 20px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35); max-width: 420px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 48px; align-items: center; }
.mock-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.mock-row:last-child { border-bottom: 0; }

/* ---- Small screens ---- */
@media (max-width: 860px) {
  .columns, .hero-grid { grid-template-columns: 1fr; }
  .project-row, .owed-row { grid-template-columns: 1fr; gap: 8px; }
  .project-flags { justify-content: flex-start; }
  .bar { padding: 10px 0; }
  .app-nav, .site-nav { gap: 14px; }
  .who span { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16.5px; }
  .card { padding: 18px 16px; }
  .wrap { padding: 0 16px; }
  .page-tabs { margin: 8px -16px 0; padding-left: 16px; padding-right: 16px; }
  .question-head { flex-direction: column-reverse; gap: 6px; }
  .file { grid-template-columns: 52px minmax(0, 1fr); }
  .file .link-button { grid-column: 2; justify-self: start; }
  .thumb { width: 52px; height: 52px; }
  .page-nav .button { flex: 1 1 100%; }
  .site-nav a:not(.button) { font-size: 0.88rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Admin: invite codes are read out on the phone, so make them easy to read. */
.invite-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.05rem; letter-spacing: 0.06em; margin-right: 8px; }
.narrow-card { max-width: 640px; }
.prose table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 0.92rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line, #e5e1d8); }
.prose th { font-weight: 600; }
@media (max-width: 640px) { .prose th, .prose td { min-width: 150px; } }

/* ---- Logo ---- */
.wordmark-img { display: block; height: 32px; width: auto; }
.message-page .wordmark-img { margin: 0 auto; height: 38px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sample-note { background: #eef6f3; border: 1px solid #cfe5dc; color: var(--ink); }
