/* One stylesheet for every page: client form, team dashboard, client brief (with print rules). */
:root {
  --bg: #ffffff; --fg: #16181d; --muted: #5b616e; --line: #dfe2e8; --soft: #f5f7fa;
  --accent: #1d4ed8; --accent-dark: #173ea8; --accent-soft: #eaf0ff;
  --ok: #157f3b; --ok-soft: #e8f6ee; --warn: #9a5b00; --warn-soft: #fff4e0; --bad: #b42318; --bad-soft: #fdecea;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 17px; line-height: 1.55; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 14px; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.plain legend { padding: 0; }
legend.label { font-weight: 600; font-size: 16px; margin: 0 0 6px; }
.section-title { margin-top: 28px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 15px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.site-header .inner { max-width: 960px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--fg); text-decoration: none; letter-spacing: .01em; }
.brand span { color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--muted); }

.page { max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; }
.page.wide { max-width: 1040px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; font-weight: 600; margin: 0 0 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 20px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.danger { background: #fff; color: var(--bad); border-color: #e6b4ae; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 15px; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
:focus-visible { outline: 3px solid #93b4ff; outline-offset: 2px; }

/* Notices */
.notice { padding: 14px 16px; border-radius: var(--radius); background: var(--soft); border: 1px solid var(--line); margin: 0 0 18px; }
.notice.info { background: var(--accent-soft); border-color: #c9d7ff; }
.notice.ok { background: var(--ok-soft); border-color: #b9e2c8; }
.notice.warn { background: var(--warn-soft); border-color: #f3d39c; }
.notice.error { background: var(--bad-soft); border-color: #f2b8b1; color: #7a1a12; }
.notice p:last-child { margin: 0; }

/* Form fields */
label { display: block; }
.field { margin: 0 0 16px; }
.field > .label, .field > label { font-weight: 600; font-size: 16px; margin: 0 0 6px; display: block; }
input[type=text], input[type=email], input[type=url], input[type=password], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid #c4c9d4; border-radius: 8px; font: inherit; font-size: 17px; color: var(--fg); background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); outline: 3px solid #c9d7ff; outline-offset: 0; }
input:disabled, textarea:disabled { background: var(--soft); color: var(--fg); }
.hint { color: var(--muted); font-size: 15px; margin: -2px 0 10px; }

.choices { display: grid; gap: 8px; }
.choices.cols { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.choice { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 14px; border: 1px solid #c4c9d4; border-radius: 8px; cursor: pointer; background: #fff; }
.choice:hover { border-color: var(--accent); }
.choice input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:disabled) { cursor: default; }

.rows { display: grid; gap: 8px; }
.row-pair { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.row-pair.even { grid-template-columns: 1fr 1fr; }
.row-head { font-size: 14px; color: var(--muted); font-weight: 600; }

/* Question blocks */
.question { padding: 22px 0; border-top: 1px solid var(--line); }
.question:first-of-type { border-top: 0; padding-top: 4px; }
.q-title { font-size: 19px; font-weight: 650; margin: 0 0 6px; }
.q-num { color: var(--accent); margin-right: 6px; }
.req { display: inline-block; font-size: 13px; font-weight: 600; color: var(--bad); background: var(--bad-soft); padding: 1px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.question.missing { background: var(--bad-soft); border-radius: var(--radius); padding: 16px; margin: 8px -16px; border-top: 0; }

/* Form shell */
.form-top { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); }
.form-top .inner { max-width: 760px; margin: 0 auto; padding: 10px 20px; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.progress { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.save-state { font-weight: 600; }
.save-state.ok { color: var(--ok); }
.save-state.err { color: var(--bad); }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.nav .btn { min-width: 120px; }
.welcome-list { padding-left: 20px; margin: 0 0 20px; }
.welcome-list li { margin-bottom: 6px; }

/* Access checklist */
.access-item { padding: 18px 0; border-top: 1px solid var(--line); }
.access-item h3 { font-size: 18px; margin-bottom: 4px; }
.access-item .choices { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.invite-box { font-size: 18px; font-weight: 700; word-break: break-all; }

/* Upload */
.drop { border: 2px dashed #b9c1d0; border-radius: var(--radius); padding: 28px 18px; text-align: center; background: var(--soft); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.stat { flex: 1 1 140px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; }

/* Review */
.review-section { margin: 0 0 26px; }
.review-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.review-item .q { font-weight: 600; font-size: 16px; }
.review-item .a { grid-column: 1 / -1; white-space: pre-wrap; color: var(--fg); }
.review-item .a.empty { color: var(--muted); font-style: italic; }

/* Cards and tables (team) */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fff; margin: 0 0 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.client-list { display: grid; gap: 12px; }
.client { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.client h3 { margin: 0 0 4px; font-size: 18px; }
.client .meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.client .btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.in_progress { background: var(--warn-soft); color: var(--warn); border-color: #f3d39c; }
.badge.submitted { background: var(--ok-soft); color: var(--ok); border-color: #b9e2c8; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.login-box { max-width: 420px; margin: 40px auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #16181d; color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 15px; z-index: 50; max-width: calc(100% - 32px); }

dialog { border: 0; border-radius: 12px; padding: 24px; width: min(460px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 18, 25, .45); }

/* Brief */
.brief-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; }
.brief-head h1 { margin-bottom: 4px; }
.brief section { margin: 0 0 22px; break-inside: avoid; }
.brief h2 { font-size: 17px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 4px; margin-bottom: 10px; }
.brief h3 { font-size: 16px; margin: 12px 0 6px; }
.kv { display: grid; grid-template-columns: 210px 1fr; gap: 6px 16px; margin: 0; }
.kv dt { font-weight: 600; color: var(--muted); font-size: 15px; }
.kv dd { margin: 0; white-space: pre-wrap; }
.kv dd.empty { color: var(--muted); font-style: italic; }
.qa { margin: 0 0 10px; }
.qa .q { font-weight: 600; font-size: 15px; color: var(--muted); }
.qa .a { white-space: pre-wrap; }
.qa .a.empty { color: var(--muted); font-style: italic; }
table.simple { width: 100%; border-collapse: collapse; font-size: 15px; }
table.simple th, table.simple td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { background: var(--soft); font-weight: 600; }
.st-done { color: var(--ok); font-weight: 600; }
.st-week { color: var(--warn); font-weight: 600; }
.st-help, .st-none, .st-blank { color: var(--bad); font-weight: 600; }
.topics { margin: 0; padding-left: 20px; }
.topics li { margin-bottom: 6px; }
.topics .ref { font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* Phones */
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  .page { padding: 22px 16px 64px; }
  .row-pair, .row-pair.even, .grid-2 { grid-template-columns: 1fr; }
  .row-head { display: none; }
  .client { grid-template-columns: 1fr; }
  .client .btns { justify-content: flex-start; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .nav .btn { min-width: 0; flex: 1; }
  .question.missing { margin: 8px -8px; padding: 12px 8px; }
}

/* Print: the brief on as few pages as possible, no buttons or header */
@media print {
  @page { margin: 12mm; }
  body { font-size: 9pt; line-height: 1.32; }
  .site-header, .no-print, .actions, .toast { display: none !important; }
  .page, .page.wide { max-width: none; padding: 0; }
  .brief h2 { font-size: 11pt; margin-bottom: 6px; }
  .brief { columns: 2; column-gap: 8mm; }
  .brief > .brief-head { column-span: all; margin-bottom: 4mm; }
  .brief section { margin-bottom: 8px; }
  .brief .qa { margin-bottom: 5px; }
  .brief h3 { margin: 6px 0 3px; font-size: 10pt; }
  .brief .small, .brief .muted.small, .brief .badge { font-size: 8pt; }
  .brief .eyebrow { font-size: 8pt; margin-bottom: 2px; }
  .brief-head p { margin-bottom: 2px; }
  .brief h1 { font-size: 15pt; }
  .kv { grid-template-columns: 30mm 1fr; gap: 1px 6px; }
  .kv dt, .qa .q { font-size: 8pt; }
  table.simple { font-size: 8.5pt; }
  table.simple th, table.simple td { padding: 2px 4px; }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 640px) { .hide-sm { display: none; } }

/* Automation webhook status (dashboard row and brief) */
.wh.ok, .wh-line.ok { color: var(--ok); }
.wh.err, .wh-line.err { color: var(--bad); }
.wh-line { font-size: 15px; margin: -4px 0 14px; overflow-wrap: anywhere; }
