/* The shared look for every page a client opens: the studios, the approval page, the progress page.
   One file, no outside fonts or scripts. The colours are the approval page's (n8n/batch-review/page.js), so the
   pages a client already knows and the new ones match. A client's own brand colour can replace --accent per site.
   Layout idea: the client's work sits on a sheet of "paper" in the middle; our controls stay quiet around it. */
:root {
  --bg: #F7F3EA; --card: #FFFDF8; --soft: #F1ECE1; --line: #E4DDCD;
  --ink: #26243A; --ink2: #4A4761; --muted: #69657E;
  --accent: #6754E9; --accent-soft: #ECE9FD; --on: #FFFFFF;
  --ok: #1C7B4B; --ok-soft: #E0F1E6; --no: #B12E3C; --no-soft: #F9E1E4; --warn: #935700; --warn-soft: #FAEDD3;
  --ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --read: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --r: 10px; --gap: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16141F; --card: #1F1C2C; --soft: #282537; --line: #332F47;
    --ink: #EEEBF7; --ink2: #CDC8DF; --muted: #A39EBA;
    --accent: #8F80F5; --accent-soft: #2B2647; --on: #14121C;
    --ok: #56C790; --ok-soft: #16301F; --no: #F27D8C; --no-soft: #3C1920; --warn: #EDB45C; --warn-soft: #382911;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16141F; --card: #1F1C2C; --soft: #282537; --line: #332F47;
  --ink: #EEEBF7; --ink2: #CDC8DF; --muted: #A39EBA;
  --accent: #8F80F5; --accent-soft: #2B2647; --on: #14121C;
  --ok: #56C790; --ok-soft: #16301F; --no: #F27D8C; --no-soft: #3C1920; --warn: #EDB45C; --warn-soft: #382911;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--ui); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- building blocks ---------- */
.bp-wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 96px; display: flex; flex-direction: column; gap: var(--gap); }
.bp-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.bp-muted { color: var(--muted); }
.bp-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 11px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.bp-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bp-pill.ok { background: var(--ok-soft); color: var(--ok); }
.bp-pill.no { background: var(--no-soft); color: var(--no); }
.bp-pill.quiet { background: var(--soft); color: var(--muted); }
.bp-btn { font: inherit; font-weight: 700; border-radius: 9px; padding: 9px 15px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.bp-btn:hover { border-color: var(--accent); }
.bp-btn.main { background: var(--accent); border-color: var(--accent); color: var(--on); }
.bp-btn.quiet { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 8px; }
.bp-btn.small { padding: 5px 11px; font-size: 13.5px; }
.bp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bp-note { background: var(--warn-soft); color: var(--warn); border-radius: var(--r); padding: 9px 12px; font-size: 14px; }
.bp-about { background: var(--soft); color: var(--ink2); border-radius: var(--r); padding: 9px 12px; font-size: 14px; margin: 0; }
.bp-field { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea.bp-field { min-height: 76px; resize: vertical; }
.bp-toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); z-index: 30; }

/* ---------- the head of a studio page: what it is, where it stands, when it goes live ---------- */
.bp-head { display: flex; flex-direction: column; gap: 10px; }
.bp-head .site { font-size: 13px; color: var(--muted); }
.bp-head h1 { font-size: clamp(21px, 3.2vw, 28px); line-height: 1.2; }
.bp-when { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; }
.bp-when strong { font-weight: 700; }
.bp-when .grow { flex: 1 1 220px; min-width: 0; }

/* ---------- the three buttons that are always there ---------- */
.bp-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
.bp-actions .in { max-width: 1148px; margin: 0 auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bp-actions .say { flex: 1 1 200px; min-width: 0; color: var(--muted); font-size: 13.5px; }
.bp-actions .bp-btn { flex: 0 1 auto; }
@media (max-width: 560px) { .bp-actions .say { flex-basis: 100%; } .bp-actions .bp-btn { flex: 1 1 0; padding-inline: 8px; } }

/* ---------- two columns: the work, and what is known about it ---------- */
.bp-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 22px; align-items: start; }
@media (max-width: 900px) { .bp-cols { grid-template-columns: minmax(0, 1fr); } }
.bp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.bp-tabs::-webkit-scrollbar { display: none; }
.bp-tabs button { font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 10px; cursor: pointer; white-space: nowrap; flex: 1 1 auto; }
.bp-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.bp-panel { display: flex; flex-direction: column; gap: 12px; padding-block: 14px; }
/* Beside the article the side column has its own scroll bar (Alvin, 2 Oct): reading the brief or the checks never waits
   for the article to scroll, and the tabs stay in view. On a phone it is one column and the page scrolls as usual. */
.bp-rail { position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); min-width: 0; display: flex; flex-direction: column;
  max-height: calc(100vh - 24px - 76px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
.bp-rail .bp-tabs { flex: none; }
.bp-rail .bp-panel { overflow-y: auto; min-height: 0; padding-right: 8px; overscroll-behavior: contain; }
@media (max-width: 900px) { .bp-rail { position: static; max-height: none; } .bp-rail .bp-panel { overflow-y: visible; padding-right: 0; } }
.bp-fact { display: flex; flex-direction: column; gap: 2px; }
.bp-fact p, .bp-fact li { color: var(--ink2); overflow-wrap: anywhere; }
.bp-fact ul, .bp-fact ol { margin: 0; padding-left: 20px; }

/* ---------- the paper: the client's article as a reader meets it ---------- */
.bp-view { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.bp-view button { font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.bp-view button[aria-pressed="true"] { color: var(--ink); background: var(--card); border-color: var(--line); }
.bp-paper { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: clamp(18px, 4vw, 44px); min-width: 0; margin-inline: auto; width: 100%; }
.bp-paper.phone { max-width: 400px; padding: 20px 18px; border-radius: 26px; border-width: 6px; }
.bp-article { font: 18px/1.65 var(--read); color: var(--ink); max-width: 66ch; margin-inline: auto; display: flex; flex-direction: column; gap: 14px; }
.bp-paper.phone .bp-article { font-size: 16.5px; }
.bp-article h1 { font-size: 1.7em; line-height: 1.2; }
.bp-body { display: flex; flex-direction: column; gap: 14px; outline: none; min-width: 0; }
.bp-article h2 { font: 700 1.25em/1.3 var(--ui); margin-top: 14px; }
.bp-article h3 { font: 700 1.05em/1.35 var(--ui); margin-top: 6px; }
.bp-article ul, .bp-article ol { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 6px; }
.bp-article blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--ink2); }
.bp-article table { border-collapse: collapse; font: 15px/1.4 var(--ui); display: block; overflow-x: auto; }
.bp-article th, .bp-article td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.bp-article [data-b] { border-radius: 6px; cursor: pointer; transition: background .12s; scroll-margin-top: 90px; }
.bp-article [data-b]:hover { background: var(--soft); }
.bp-article [data-b].picked { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); }
.bp-article [data-b].flagged { background: var(--no-soft); box-shadow: 0 0 0 6px var(--no-soft); }
.bp-article [data-b].look { background: var(--warn-soft); box-shadow: 0 0 0 6px var(--warn-soft); }
.bp-article.editing { outline: 2px dashed var(--accent); outline-offset: 10px; border-radius: 4px; }
.bp-article.editing [data-b] { cursor: text; }
.bp-article.editing [data-b]:hover { background: none; }

/* what opens under a picked paragraph */
.bp-on { font: 14.5px/1.5 var(--ui); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.bp-on .old { background: var(--no-soft); border-radius: 8px; padding: 8px 10px; text-decoration: line-through; color: var(--ink2); }
.bp-on .new { background: var(--ok-soft); border-radius: 8px; padding: 8px 10px; }

/* the score and the checks, in plain words */
.bp-score { display: flex; gap: 14px; align-items: center; }
.bp-score .n { font: 700 40px/1 var(--ui); font-variant-numeric: tabular-nums; }
.bp-score .n small { font-size: 15px; font-weight: 600; color: var(--muted); }
.bp-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bp-checks li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: start; padding: 7px 9px; border-radius: 8px; }
.bp-checks li.fail { background: var(--warn-soft); }
.bp-checks li.stop { background: var(--no-soft); }
.bp-checks .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--ok); }
.bp-checks li.fail .dot { background: var(--warn); }
.bp-checks li.stop .dot { background: var(--no); }
.bp-checks li.skip .dot { background: var(--line); }
.bp-checks b { font-weight: 600; }
.bp-checks p { color: var(--ink2); font-size: 14px; }
.bp-checks button { margin-top: 4px; }
details.bp-more > summary { cursor: pointer; font-weight: 600; color: var(--muted); padding-block: 4px; }

/* versions */
.bp-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bp-versions li { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r); padding: 9px 12px; background: var(--card); }
.bp-versions li.now { border-color: var(--accent); }

/* ---------- while the writer works, and when a new version waits ---------- */
.bp-busy .bp-btn { pointer-events: none; opacity: .65; }
.bp-back { padding-left: 0; }
.bp-new { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; display: flex; flex-direction: column; gap: 8px; }
.bp-new ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bp-new li { display: flex; flex-direction: column; background: var(--card); border-radius: 8px; padding: 7px 10px; }
.bp-new .q { color: var(--muted); font-size: 13px; font-style: italic; }
.bp-article .was { background: var(--no-soft); box-shadow: 0 0 0 6px var(--no-soft); text-decoration: line-through; color: var(--ink2); border-radius: 6px; }
.bp-article .now { background: var(--ok-soft); box-shadow: 0 0 0 6px var(--ok-soft); border-radius: 6px; }
.bp-article [data-b].noted { box-shadow: -9px 0 0 -6px var(--accent); }
.bp-sumbox { font: 16px/1.5 var(--ui); background: var(--soft); border-left: 4px solid var(--muted); border-radius: 8px; padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; }
.bp-sumbox ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
a.bp-btn { text-decoration: none; display: inline-block; }
.bp-article .look { background: var(--warn-soft); box-shadow: 0 0 0 6px var(--warn-soft); border-radius: 6px; }
.bp-view { flex-wrap: wrap; }

/* ---------- the plan screen: every article, its date, where it stands ---------- */
.bp-wrap.narrow { max-width: 880px; }
.bp-group { display: flex; flex-direction: column; gap: 8px; }
.bp-group h2 { font-size: 16px; }
.bp-group h2 span { font-weight: 400; }
.bp-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bp-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; }
.bp-item .what { grid-column: 2; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; min-width: 0; }
.bp-item .title { font: inherit; font-weight: 700; font-size: 16px; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.bp-item .title:hover { color: var(--accent); }
.bp-item .what p { font-size: 13.5px; }
.bp-item .do { grid-column: 3; justify-content: flex-end; }
.bp-item .bp-ask { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 9px; }
.bp-tick, .bp-sitting input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
@media (max-width: 640px) { .bp-item { grid-template-columns: auto minmax(0, 1fr); } .bp-item .do { grid-column: 1 / -1; justify-content: flex-start; } }
.bp-sitting { background: var(--soft); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.bp-empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- the brief form ---------- */
.bp-form { display: flex; flex-direction: column; gap: 14px; }
.bp-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bp-f label { font-weight: 700; }
.bp-f p { font-size: 13px; }
.bp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .bp-two { grid-template-columns: minmax(0, 1fr); } }
details.bp-more > .bp-form { padding-top: 10px; }
select.bp-field { appearance: auto; }
.bp-card { max-width: 520px; margin: 12vh auto 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 560px) { .bp-wrap { padding-block-end: 170px; } }   /* the bar of buttons is taller on a phone */
