/* Dr. Notes Marketing Hub, styled with the drnotesapp.com design system: warm near-white ground,
   one slate-teal accent, muted semantic colours, and the device's own font (SF Pro / Segoe / Roboto),
   exactly as the website and the apps render it. */

:root {
  color-scheme: light;
  --paper: #FAF9F7;
  --surface: #ffffff;
  --surface-2: #F1EFEB;
  --ink: #20272B;
  --ink-2: #384247;
  --muted: #6F777C;
  --subtle: #9EA5A9;
  --line: #E5E3DF;
  --line-strong: #D3D0CB;
  --brand: #3F6F87;
  --brand-dark: #2D5163;
  --brand-soft: #EBF1F5;
  --amber: #8A5F24;
  --amber-soft: #F6EEE0;
  --red: #A34C42;
  --red-soft: #F7E9E6;
  --side: #1C262C;
  --bar: 60px;
  --brand-hover: #355F74;
  --ring: 0 0 0 3px rgb(63 111 135 / 28%);
  --side-ink: #384247;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(32 39 43 / 4%);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Older rules still use these names. */
  --card: var(--surface);
  --canvas: var(--paper);
  --warning: var(--amber);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand-dark); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { color: var(--ink); }
h2 { margin: 0 0 12px; font-size: 1.2rem; font-weight: 650; letter-spacing: -.01em; }
h3 { margin: 0 0 8px; font-size: 1.02rem; font-weight: 650; }
h4 { margin: 0 0 6px; font-size: .95rem; font-weight: 650; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.section { margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Buttons and fields ---- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--brand); border-radius: 8px;
  color: #fff; background: var(--brand);
  font-weight: 600; letter-spacing: .005em; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button:active { background: var(--brand-dark); border-color: var(--brand-dark); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none; box-shadow: var(--ring);
}
button.secondary { color: var(--brand); border-color: var(--line); background: var(--surface); }
button.secondary:hover { border-color: var(--line-strong); background: var(--paper); }
button.danger { color: var(--red); border-color: #EBCFCA; background: var(--surface); }
button.danger:hover { background: var(--red-soft); }
button.link-button { min-height: 0; padding: 4px 2px; border: 0; border-radius: 4px; color: var(--muted); background: none; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
button.link-button:hover { color: var(--ink); background: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
/* A button whose request is running shows a small spinner. */
button[aria-busy="true"] { opacity: .8; cursor: progress; }
button[aria-busy="true"]::before {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

label { display: grid; gap: 6px; color: var(--ink-2); font-size: .9rem; font-weight: 600; }
input, textarea, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-weight: 400;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--subtle); }
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: var(--ring); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.actions:empty { display: none; }
.error { color: var(--red); }

/* ---- Shell ---- */
/* One slim bar across the top: the Hub has five pages, so a full-height sidebar was mostly empty
   space and took width from the board. */
#shell { display: flex; flex-direction: column; min-height: 100vh; }
#shell[hidden], #login[hidden] { display: none; }
aside {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: stretch; gap: 28px;
  height: var(--bar); padding: 0 24px; background: var(--paper); color: var(--side-ink);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand b { display: block; color: var(--ink); font-size: 1.06rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
img.mark { display: block; width: 24px; height: auto; }
.login-card img.mark { width: 32px; }
nav { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button {
  position: relative; flex: none; gap: 8px; height: 100%; min-height: 0; padding: 0 13px;
  border: 0; border-radius: 0; color: var(--side-ink); background: transparent;
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
nav button::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
nav button:hover { color: var(--ink); background: transparent; }
nav button:hover::after { background: var(--line-strong); }
nav button.active { color: var(--ink); font-weight: 600; background: transparent; box-shadow: none; }
nav button.active::after { background: var(--brand); }
nav button:focus-visible { box-shadow: inset 0 0 0 2px rgb(63 111 135 / 40%); border-radius: 8px; }
nav .count { min-width: 20px; padding: 1px 6px; border-radius: 999px; color: var(--amber); background: var(--amber-soft); font-size: 11.5px; font-weight: 700; text-align: center; }
.aside-foot { align-self: center; margin: 0 0 0 auto; padding: 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.aside-foot:empty, body.is-board .aside-foot { display: none; }

main { flex: 1; min-width: 0; padding: 34px clamp(18px, 4vw, 52px) 64px; }
main > header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; max-width: 1240px; margin: 0 auto 22px; }
h1#heading { margin: 0; font-family: var(--serif); font-size: clamp(1.75rem, 2.4vw, 2.25rem); font-weight: 650; line-height: 1.05; letter-spacing: -.02em; }
.page-description { margin: 8px 0 0; color: var(--muted); font-size: 1rem; max-width: 60ch; }
.page-description:empty { display: none; }
.header-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.header-right #refresh { min-height: 36px; padding: 6px 14px; font-size: .85rem; }
#content { max-width: 1240px; margin: 0 auto; }
/* The draft page uses the full width on large screens. */
body.is-wide main > header, body.is-wide #content { max-width: 1480px; }
#content.page-enter > * { animation: fade .18s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Surfaces ---- */
.card { min-width: 0; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card > h2:first-child, .card > .row-title:first-child h2 { margin-top: 0; }
.row-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; }
.row-title h2, .row-title h3 { margin-bottom: 6px; }
.notice { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); }
.notice.error-notice { color: #7A3830; border-color: #EBCFCA; border-left-color: var(--red); background: var(--red-soft); }
.notice.resurfaced { border-color: #E6D5B5; border-left-color: var(--amber); background: var(--amber-soft); }
.notice .actions { margin-top: 10px; }
.empty { padding: 26px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; background: var(--surface-2); }
.tag, .pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: .78rem; font-weight: 650; vertical-align: middle; }
.tag.demo { background: var(--amber-soft); color: var(--amber); }
.tag.warning { background: var(--amber-soft); color: var(--amber); }
.tag.main-source { margin-left: 6px; }
.disclosure { margin-top: 12px; border-top: 1px solid var(--line); }
.disclosure > summary { padding: 12px 0 4px; color: var(--ink-2); font-weight: 650; cursor: pointer; }
.disclosure > summary:hover { color: var(--brand-dark); }
.disclosure[open] > summary { margin-bottom: 8px; }
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { padding: 10px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: .8rem; font-weight: 650; text-align: left; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td:first-child { font-weight: 600; }
.row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.draft-body { white-space: pre-wrap; line-height: 1.6; color: var(--ink-2); }

/* ---- Toasts ---- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 10px; background: var(--side); color: #EDECEA; box-shadow: 0 4px 12px rgb(32 39 43 / 6%), 0 28px 56px -20px rgb(32 39 43 / 22%); font-size: .92rem; line-height: 1.45; animation: rise .25s ease both; }
.toast::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #8AB3C8; }
.toast.is-error::before { background: #E0A097; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }

/* ---- Login ---- */
.login { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--paper); }
.login-card { display: grid; gap: 14px; width: min(400px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 2px 4px rgb(32 39 43 / 4%), 0 12px 28px -12px rgb(32 39 43 / 14%); }
.login-card h1 { margin: 6px 0 0; font-family: var(--serif); font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.login-card > p { margin: 0; color: var(--muted); }
.login-card button { margin-top: 4px; }

/* ---- To do: the desk ---- */
.feed { max-width: 820px; }
.desk-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-bottom: 16px; }
.desk-intro h2 { margin: 0; font-family: var(--serif); font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; }
.desk-intro .muted { font-size: .92rem; }
/* Steps double as filters: Decide → Review → Publish, plus anything that needs fixing. */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 22px; }
button.step {
  display: grid; justify-items: start; justify-content: stretch; align-content: start; gap: 4px; min-height: 0; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface);
  text-align: left; font-weight: 500; box-shadow: var(--shadow);
}
button.step:hover { border-color: var(--line-strong); background: var(--surface); }
button.step strong { font-size: 1.75rem; font-weight: 650; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
button.step span { color: var(--muted); font-size: .88rem; }
button.step.has-work strong { color: var(--brand-dark); }
button.step.is-attention.has-work strong { color: var(--red); }
button.step.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.filter-row { display: flex; justify-content: flex-end; margin: -8px 0 14px; }
.filter-type select { width: auto; min-width: 180px; padding: 7px 12px; border-radius: 999px; font-size: .88rem; }
.review-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 24px; padding: 12px 16px; border-radius: var(--radius); background: var(--brand-soft); color: var(--ink-2); font-size: .92rem; }
.review-status b { color: var(--brand-dark); }
.review-status.is-waiting { background: var(--surface-2); border: 1px dashed var(--line-strong); }

.content-list { margin-top: 26px; }
.content-list:first-child { margin-top: 0; }
.content-list > h2, .content-list > summary { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 1.05rem; font-weight: 650; }
.content-list > h2 span, .content-list > summary span { color: var(--muted); font-weight: 500; font-size: .9rem; }
.content-list > p.lane-help { margin: -6px 0 12px; color: var(--muted); font-size: .9rem; }
.feed-history > summary { cursor: pointer; list-style: none; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.feed-history > summary::-webkit-details-marker { display: none; }
.feed-history > summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: .85rem; color: var(--muted); }
.feed-history[open] > summary::before { content: "–"; }
.feed-history > p { color: var(--muted); font-size: .9rem; }

.feed-card {
  position: relative; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.feed-card + .feed-card { margin-top: 12px; }
.feed-card[data-open] { cursor: pointer; }
.feed-card[data-open]:hover { border-color: var(--line-strong); box-shadow: 0 2px 4px rgb(32 39 43 / 4%), 0 12px 28px -12px rgb(32 39 43 / 14%); }
.feed-card h3 { margin: 0 0 6px; font-size: 1.08rem; line-height: 1.35; }
.feed-card h3 a { color: var(--ink); text-decoration: none; }
.feed-card h3 a:hover { color: var(--brand-dark); }
.feed-card.is-problem h3 { font-family: var(--serif); font-size: 1.5rem; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; }
.feed-preview { margin: 0 0 10px; color: var(--ink-2); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0; color: var(--muted); font-size: .86rem; }
.feed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.feed-actions form { margin: 0; }
.feed-card.is-waiting { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.feed-card.is-waiting h3, .feed-card.is-waiting h3 a { color: var(--ink-2); }
.feed-card.is-waiting::after { content: ""; position: absolute; top: 22px; right: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
@keyframes breathe { 50% { opacity: .25; } }
.feed-card.is-attention { border-color: #EBCFCA; box-shadow: inset 3px 0 0 var(--red), var(--shadow); }
.feed-card.is-attention .feed-preview { color: #7A3830; }
.recommend { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 10px; color: var(--ink-2); font-size: .95rem; }
.recommend b { color: var(--brand-dark); }
.kind { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: .8rem; font-weight: 600; }
/* Evidence meter: three bars, filled by how often the problem has been seen. */
.meter { display: inline-flex; align-items: center; gap: 6px; }
.meter i { display: inline-flex; gap: 2px; }
.meter i::before, .meter i::after, .meter i b { content: ""; width: 5px; height: 12px; border-radius: 2px; background: var(--line-strong); }
.meter i b { display: block; }
.meter.level-1 i::before, .meter.level-2 i::before, .meter.level-2 i b, .meter.level-3 i::before, .meter.level-3 i b, .meter.level-3 i::after { background: var(--brand); }
.feed-done { margin: 26px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.feed-done li { display: flex; gap: 8px; padding: 4px 0; }
.feed-done li::before { content: "✓"; color: var(--brand); font-weight: 700; }

/* Compact rows for older items, watchlist and lists. */
.cell-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
a.cell { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: background .12s ease; }
a.cell:first-child { border-top: 0; }
a.cell:hover { background: var(--surface-2); color: var(--ink); }
.cell-main { display: grid; gap: 2px; min-width: 0; }
.cell-main b { font-weight: 600; line-height: 1.35; }
.cell-main small { color: var(--muted); font-size: .84rem; }
.cell-status { flex: none; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: .8rem; font-weight: 600; }

/* Filters on Content. */
.content-filters { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.filter-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
button.chip { min-height: 32px; padding: 4px 13px; border: 0; border-radius: 999px; color: var(--ink-2); background: transparent; font-size: .88rem; font-weight: 600; }
button.chip span { margin-left: 4px; color: var(--muted); font-weight: 500; }
button.chip:hover { background: var(--surface-2); color: var(--ink); }
button.chip.is-active { color: #fff; background: var(--ink); }
button.chip.is-active span { color: rgb(255 255 255 / 75%); }

/* ---- Full pages: drafts, steps, problems ---- */
.brief-detail { display: grid; gap: 16px; max-width: 860px; }
.brief-detail > p:first-child { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; }
.item-detail .content-item h3, .problem-head h2 { font-family: var(--serif); font-size: 2rem; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 8px; }
.content-item { padding: 0; border: 0; }
.item-detail { padding: 26px 28px; }
.draft-meta { color: var(--muted); }
.md-body { max-width: 70ch; color: var(--ink-2); line-height: 1.7; font-size: 1.02rem; }
.md-body h1, .md-body h2, .md-body h3 { margin: 26px 0 8px; line-height: 1.3; }
.md-body h1 { font-family: var(--serif); font-weight: 650; letter-spacing: -.02em; font-size: 1.9rem; }
.md-body h4 { margin: 20px 0 6px; }
.md-body ul, .md-body ol { padding-left: 1.3rem; }
.md-body li { margin-bottom: 6px; }
.task h4 { font-family: var(--serif); font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; margin-bottom: 4px; }
.task > p.muted { margin-top: 0; }
.task .actions { margin-top: 10px; }
.copy-box { display: grid; gap: 8px; margin: 16px 0; }
.copy-box label { font-weight: 650; color: var(--ink); }
.copy-box textarea { font-size: .95rem; background: var(--surface-2); }
.copy-box button { justify-self: start; }
.task-footer { display: grid; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.task-link { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.task-link label { flex: 1 1 260px; }
.finished-list { margin: 6px 0 0; padding: 0; list-style: none; }
.finished-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.finished-list li:last-child { border-bottom: 0; }
.validation-form, .problem-form, .lesson-form, .fact-form { display: grid; gap: 14px; }
.validation-form label span.muted, .problem-form label span.muted, .profile-edit label span.muted { display: block; font-weight: 400; font-size: .85rem; }
.reviseForm { display: grid; gap: 12px; margin-top: 14px; }

.problem-head { padding: 28px 30px; }
.problem-head > p.muted { margin: 0; }
.problem-fields { display: grid; grid-template-columns: 210px 1fr; gap: 16px 24px; margin: 0; }
.problem-fields dt { color: var(--muted); font-size: .88rem; font-weight: 650; padding-top: 2px; }
.problem-fields dd { margin: 0; }
.problem-fields dd p { margin: 0 0 6px; line-height: 1.55; }
.problem-evidence, .evidence-items { margin: 8px 0 0; padding: 0; list-style: none; }
.problem-evidence li, .evidence-items li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.problem-evidence li:last-child, .evidence-items li:last-child { border-bottom: 0; }
.problem-evidence p, .evidence-items p { margin: 4px 0; line-height: 1.5; }
.evidence-items small { display: block; color: var(--muted); font-size: .82rem; }
.problem-history { margin: 0; padding: 0; list-style: none; }
.problem-history li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.problem-history li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.problem-history p { margin: 2px 0 0; }

/* Morning research page. */
.brief-head h2 { font-family: var(--serif); font-size: 2rem; font-weight: 650; letter-spacing: -.02em; margin-bottom: 4px; }
.brief-summary, .brief-idea p { line-height: 1.6; }
.brief-steps { margin: 4px 0 0; padding-left: 1.3rem; display: grid; gap: 10px; line-height: 1.55; color: var(--ink-2); }
.brief-steps b { color: var(--ink); }
.brief-basis { margin: 14px 0 0; }
.evidence { border-top: 1px solid var(--line); }
.evidence:last-child { border-bottom: 1px solid var(--line); }
.evidence summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 14px 4px; cursor: pointer; }
.evidence summary:hover .evidence-name { color: var(--brand-dark); }
.evidence-name { font-weight: 650; }
.evidence-status { color: var(--muted); font-size: .875rem; }
.evidence-status.status-found { color: var(--brand-dark); }
.evidence-status.status-failed { color: var(--red); }
.evidence-body { padding: 0 4px 18px; }
.evidence-text { line-height: 1.6; color: var(--ink-2); max-width: 72ch; }
.evidence-text h4 { margin: 18px 0 6px; }
.evidence-text ul, .evidence-text ol { padding-left: 1.25rem; }
.evidence-body > h4 { margin: 20px 0 6px; color: var(--muted); }

/* ---- Settings ---- */
.source-settings h3 { margin: 18px 0 2px; color: var(--muted); font-size: .85rem; font-weight: 650; }
.source-setting { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.source-setting:last-child { border-bottom: 0; }
.source-setting b { font-weight: 650; }
.source-setting p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; max-width: 62ch; }
.source-switch { display: flex; flex: none; align-items: center; gap: 12px; }
.source-switch > span { color: var(--muted); font-size: .86rem; font-weight: 600; }
.source-switch > span.is-on { color: var(--brand-dark); }
button.switch { position: relative; width: 44px; min-height: 26px; height: 26px; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); }
button.switch:hover { background: var(--subtle); }
button.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); transition: transform .18s ease; }
button.switch[aria-checked="true"] { background: var(--brand); }
button.switch[aria-checked="true"]:hover { background: var(--brand-dark); }
button.switch[aria-checked="true"] span { transform: translateX(18px); }
.limit-form { display: flex; align-items: center; gap: 8px; }
.limit-form input { width: 110px; }
.limit-prefix { color: var(--muted); font-weight: 600; }
.product-facts h3 { margin: 0 0 8px; font-size: 1.05rem; }
.product-facts h4 { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.fact-form { margin: 16px 0 8px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.fact-form h3 { margin: 0; }
.fact-form button { justify-self: start; }
.fact-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fact-group { margin-top: 26px; }
.fact-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.fact-row:last-child { border-bottom: 0; }
.fact-row p { margin: 0 0 4px; line-height: 1.5; }
.fact-row small { color: var(--muted); }
.fact-row .actions { flex: none; margin: 0; }
.fact-row button { min-height: 32px; padding: 4px 12px; font-size: .85rem; }
.profile { margin: 6px 0 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.profile > .row-title { margin-bottom: 10px; }
.profile .actions { margin: 0; }
.profile-fields { display: grid; grid-template-columns: 190px 1fr; gap: 10px 18px; margin: 0; }
.profile-fields dt { color: var(--muted); font-size: .88rem; font-weight: 650; }
.profile-fields dd { margin: 0; }
.profile-fields ul { margin: 0; padding-left: 18px; }
.profile-fields li { margin: 0 0 3px; line-height: 1.45; }
.profile-edit { margin-top: 12px; }
.profile-edit summary { cursor: pointer; font-weight: 650; color: var(--brand-dark); }
.profile-edit .check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.profile-edit .check input { width: auto; }
.ingest { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin: 14px 0 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.ingest h3 { margin: 0 0 4px; }
.ingest p { margin: 0 0 6px; }
.ingest button { flex: none; }
.ingest-note ul { margin: 4px 0 0; padding-left: 18px; }
.ingest-note.error { color: var(--red); }
.system-details > summary { color: var(--muted); }

/* ---- Results ---- */
.lesson-list { margin: 4px 0 16px; padding: 0; list-style: none; }
.lesson-list li { padding: 8px 0 8px 14px; border-left: 2px solid var(--brand); margin-bottom: 6px; line-height: 1.5; }

/* ---- Research library ---- */
.reddit-list { max-width: 56rem; }
.reddit-post { padding: 14px 0; border-top: 1px solid var(--line); }
.reddit-post h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.reddit-post h3 a { color: var(--ink); text-decoration: none; }
.reddit-post h3 a:hover { text-decoration: underline; }
.reddit-post p { margin: 6px 0 0; line-height: 1.55; color: var(--ink-2); font-size: .95rem; }
.reddit-post .feed-meta { margin-top: 4px; }
.reddit-idea { color: var(--brand-dark) !important; }

.sample-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 18px; max-width: 820px; border-left-color: var(--amber); background: var(--amber-soft); }
.sample-banner button { min-height: 32px; padding: 4px 14px; font-size: .85rem; }

/* ---- Older tool pages (overview, automation runs) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.metric { display: grid; gap: 4px; }
.metric strong { font-size: 2rem; font-weight: 650; letter-spacing: -.02em; }
.metric small { color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stage { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.stage b { display: block; }
.stage small { color: var(--muted); }
.stage p { margin: 6px 0 0; }
.stage.complete { border-color: #C9D8E1; background: var(--brand-soft); }
.stage.warning, .stage.waiting { border-color: #E6D5B5; background: var(--amber-soft); }
.stage.skipped { opacity: .6; }

/* ---- Boards: To do and Content, laid out like a Trello board ---- */
.board-page { display: grid; gap: 14px; }
.board-wrap { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); overflow: hidden; }
.board-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .9rem; }
.board-note { display: inline-flex; align-items: center; gap: 8px; }
.board-note .live { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.board-link { padding: 3px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--brand); font-weight: 600; text-decoration: none; }
.board-link:hover { border-color: var(--line-strong); background: var(--paper); color: var(--brand-dark); }
.board { display: flex; align-items: flex-start; gap: 12px; padding: 14px; min-height: 280px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 14px; }
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line-strong); }
.bcol { flex: 1 0 210px; max-width: 300px; max-height: calc(100vh - 230px); display: flex; flex-direction: column; padding: 10px 8px 8px; border-radius: 12px; background: var(--surface-2); box-shadow: none; scroll-snap-align: start; }
.bcol h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 6px 11px; color: var(--ink); font-size: .92rem; font-weight: 650; }
.bcol h2 span { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .75rem; text-align: center; }
.bcol h2 span:empty { display: none; }
.bcol-cards { display: grid; gap: 8px; overflow-y: auto; padding: 3px; margin: -3px -1px 0; }
.bcol-empty { margin: 0; padding: 14px 8px; color: var(--muted); font-size: .85rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; }
.bcard {
  display: grid; gap: 8px; padding: 10px 12px; border-radius: 8px; background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(32 39 43 / 4%);
  transition: box-shadow .12s ease, transform .12s ease;
}
.bcard[data-open] { cursor: pointer; }
.bcard[data-open]:hover { box-shadow: 0 0 0 1.5px var(--brand), 0 2px 6px rgb(32 39 43 / 6%); }
.bcard-title { color: var(--ink); font-size: .93rem; font-weight: 500; line-height: 1.4; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
a.bcard-title:hover { color: var(--ink); }
.bcard-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.label { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 6px; font-size: .74rem; font-weight: 650; line-height: 20px; }
.label-green { background: #E8F1EC; color: #3F6B54; }
.label-purple { background: #EEF0F6; color: #4F5D95; }
.label-blue { background: #EBF1F5; color: #355F74; }
.label-yellow { background: #F6EEE0; color: #8A5F24; }
.label-orange { background: #F5EAE1; color: #8C5532; }
.label-red { background: #F7E9E6; color: #A34C42; }
.label-pink { background: #F6ECEF; color: #A8546B; }
.label-grey { background: #F1EFEB; color: #596267; }
.badge { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .78rem; }
.badge svg { width: 14px; height: 14px; flex: none; }
.bcard-foot form { margin: 0 0 0 auto; }
.bcard-foot > button { margin-left: auto; }
button.small { min-height: 28px; padding: 3px 11px; border-radius: 6px; font-size: .78rem; }
.bcard.is-waiting { background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.bcard.is-waiting .bcard-title { color: var(--ink-2); }
.bcard.is-waiting .badge svg { color: var(--brand); }
.bcard.is-quiet .bcard-title { color: var(--ink-2); }
.bcard.is-attention { grid-template-columns: 1fr auto; align-items: center; background: var(--red-soft); box-shadow: 0 0 0 1px #EBCFCA; }
.bcard.is-attention .bcard-title { color: #7A3830; -webkit-line-clamp: 2; }
.bcard.is-attention .bcard-foot { flex-wrap: nowrap; }
.bcol-more { flex: none; margin: 8px 0 0; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .84rem; font-weight: 600; text-align: left; cursor: pointer; }
.bcol-more:hover { background: var(--surface); color: var(--ink); }
.bcol-more:focus-visible { outline: none; box-shadow: var(--ring); }
.board-more summary { cursor: pointer; padding: 6px; color: var(--muted); font-size: .84rem; font-weight: 600; list-style: none; border-radius: 6px; }
.board-more summary::-webkit-details-marker { display: none; }
.board-alerts { display: grid; gap: 8px; }
.board-links { display: grid; gap: 4px; }
.board-more summary { display: inline-flex; gap: 6px; color: var(--ink-2); }
.board-more summary span { color: var(--muted); font-weight: 500; }
.board-more summary::before { content: "›"; display: inline-block; transition: transform .15s ease; }
.board-more[open] summary::before { transform: rotate(90deg); }
.board-more .cell-list { margin: 6px 0 10px; }

/* ---- Draft review: the document in the centre, the decision beside it ---- */
.draft-page { display: grid; gap: 14px; }
.draft-page > p { margin: 0; }
.draft-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 380px); gap: 24px; align-items: start; }
.paper { padding: 44px clamp(24px, 5vw, 64px) 52px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.paper-inner { max-width: 760px; margin: 0 auto; }
.paper .md-body { max-width: none; font-size: 1.05rem; line-height: 1.75; color: var(--ink-2); }
.paper-title { margin: 0 0 10px; font-family: var(--serif); font-size: clamp(1.9rem, 2.6vw, 2.5rem); font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.paper-meta { margin: 0 0 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.paper .md-body > :first-child { margin-top: 0; }
.paper .md-body a { word-break: break-word; }
form.paper { display: grid; gap: 14px; }
form.paper textarea { min-height: 60vh; font-size: .98rem; line-height: 1.65; }
form.paper button { justify-self: start; }
.draft-side { position: sticky; top: calc(var(--bar) + 20px); display: grid; gap: 12px; max-height: calc(100vh - 40px - var(--bar)); overflow-y: auto; }
.side-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.side-card h3 { margin: 0 0 10px; }
.side-card label { margin-bottom: 12px; }
.side-card label .muted { display: block; font-weight: 400; font-size: .82rem; }
.side-actions { display: grid; gap: 8px; }
.side-actions button { width: 100%; }
button.danger-link { justify-self: center; color: var(--red); }
.side-fold > summary { cursor: pointer; font-weight: 650; list-style: none; }
.side-fold > summary::-webkit-details-marker { display: none; }
.side-fold > summary::after { content: " ›"; color: var(--muted); }
.side-fold[open] > summary { margin-bottom: 10px; }
.md-body.small, .draft-body.small { font-size: .88rem; line-height: 1.55; }
.draft-side .card { padding: 18px; }
.draft-side .card h3 { margin-top: 0; }
@media (max-width: 980px) {
  .draft-layout { grid-template-columns: 1fr; }
  .draft-side { position: static; max-height: none; overflow: visible; }
}

/* ---- Smaller screens ---- */
@media (max-width: 980px) {
  .aside-foot { display: none; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  aside { gap: 12px; padding: 0 0 0 14px; }
  .brand div { display: none; }
  nav button { padding: 0 11px; }
  nav button::after { left: 11px; right: 11px; }
  main { padding: 22px 16px 48px; }
  main > header { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 20px; }
  .card, .item-detail, .problem-head { padding: 18px; }
  .paper { padding: 24px 18px 30px; }
  .feed-card { padding: 17px 18px; }
  .feed-card.is-problem h3 { font-size: 1.3rem; }
  .steps { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
  .board { padding: 10px; gap: 10px; scroll-snap-type: x mandatory; }
  .bcol { flex: 0 0 84vw; max-width: none; max-height: none; }
  .board { scroll-padding: 0 10px; }
  .board-wrap { margin: 0 -16px; border-radius: 0; }
  button.step { padding: 12px; }
  .problem-fields, .profile-fields { grid-template-columns: 1fr; gap: 4px; }
  .problem-fields dd, .profile-fields dd { margin-bottom: 12px; }
  .fact-fields { grid-template-columns: 1fr; }
  .source-setting, .fact-row, .ingest { flex-direction: column; align-items: flex-start; }
  a.cell { flex-direction: column; align-items: flex-start; gap: 6px; }
  .filter-chips { border-radius: 14px; }
  .filter-row { justify-content: flex-start; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- Automation runs page (unchanged rules) ---- */
.workflow-card {
  overflow: hidden;
  border: 1px solid #304847;
  border-radius: 15px;
  background: #142b2b;
  color: #e9f5f3;
}
.workflow-bar, .workflow-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 19px 22px;
}
.workflow-bar { border-bottom: 1px solid #38504f; }
.workflow-bar h2, .workflow-detail h3 { color: #f5fbfa; margin: 0 0 5px; }
.workflow-bar p, .workflow-detail p { color: #b5ccc9; margin: 0; line-height: 1.5; }
.workflow-link { color: #d3eae6; white-space: nowrap; font-weight: 650; }
.workflow-canvas {
  padding: 58px 22px;
  background: radial-gradient(circle, #476361 1px, transparent 1px) 0 0 / 18px 18px, #182f30;
}
.workflow-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
}
.workflow-node {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 7px;
  min-height: 112px;
  padding: 12px 9px;
  background: #203b3d;
  border: 1px solid #597775;
  color: #eef7f5;
  text-align: left;
  font-size: .875rem;
}
.workflow-node:hover { background: #294749; border-color: #a5c0bc; }
.workflow-node[aria-pressed="true"] { outline: 2px solid #9dc8c3; outline-offset: 3px; }
.workflow-node strong { line-height: 1.2; overflow-wrap: anywhere; }
.workflow-node span:last-child { color: #c4d7d4; font-size: .8125rem; font-weight: 500; }
.workflow-node:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(100% + 1px);
  top: 50%;
  width: 20px;
  height: 2px;
  background: #688784;
  pointer-events: none;
}
.node-indicator { width: 10px; height: 10px; border: 1px solid #a5bfbb; border-radius: 50%; }
.is-complete .node-indicator, .is-complete:not(:last-child)::after { background: #75d5a9; }
.is-running { border-color: #9de9d9; background: #284d49; }
.is-running .node-indicator { background: #9de9d9; animation: workflow-pulse 1s infinite alternate; }
.is-warning .node-indicator, .is-waiting .node-indicator { background: #f0c173; }
.is-error .node-indicator { background: #f8a396; }
.is-skipped { border-style: dashed; }
.workflow-detail { border-top: 1px solid #38504f; min-height: 90px; }
.workflow-detail .error { color: #ffc7be !important; }
.workflow-run-meta { display: grid; justify-items: end; gap: 8px; color: #c4d7d4; font-size: .875rem; text-align: right; }
.workflow-controls { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px 20px; }
.workflow-controls h2, .workflow-controls p, .workflow-controls label { margin: 0; }
.workflow-controls p { line-height: 1.5; }
.workflow-feedback:empty { display: none; }
@keyframes workflow-pulse { to { box-shadow: 0 0 0 5px rgb(157 233 217 / 22%); } }
@media (max-width: 1050px) {
  .workflow-track { grid-template-columns: 1fr; gap: 17px; }
  .workflow-node { min-height: 56px; grid-template-columns: auto 1fr auto; align-items: center; padding: 10px 14px; }
  .workflow-node:not(:last-child)::after { top: calc(100% + 1px); left: 19px; width: 2px; height: 17px; }
  .workflow-canvas { padding: 22px; }
  .workflow-controls { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .workflow-bar, .workflow-detail { align-items: start; flex-direction: column; }
  .workflow-run-meta { justify-items: start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .is-running .node-indicator { animation: none; }
}

/* The main workspace puts editorial decisions ahead of supporting detail. */

/* ---- Full-screen board (To do, Content) ---- */
body.is-board main { display: flex; flex-direction: column; min-height: calc(100vh - var(--bar)); padding: 0; background: var(--paper); }
body.is-board main > header { max-width: none; width: 100%; margin: 0; padding: 14px 22px; align-items: center; }
body.is-board h1#heading { font-size: 1.75rem; }



body.is-board #content { flex: 1; display: flex; flex-direction: column; max-width: none; width: 100%; margin: 0; }
body.is-board .board-page { flex: 1; display: flex; flex-direction: column; gap: 0; }
body.is-board .board-wrap { flex: 1; display: flex; flex-direction: column; border: 0; border-radius: 0; background: none; overflow: visible; }
body.is-board .board-bar { position: relative; z-index: 5; padding: 10px 24px; }
body.is-board .board { flex: 1; align-items: flex-start; padding: 18px 24px 24px; scroll-padding: 0 24px; }
body.is-board .bcol { flex: 0 0 280px; max-width: 280px; max-height: calc(100vh - 86px - var(--bar)); }
/* The tab already names the board and it refreshes itself, so its heading row is left out. */
body.is-board main > header { display: none; }
body.is-board .board-alerts { padding: 14px 22px 0; }
body.is-board .sample-banner { margin: 14px 22px 0; }
.bcard-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.bcard .label { min-height: 16px; line-height: 16px; padding: 0 7px; font-size: .7rem; }
/* Extra lists open from the board bar as a small panel. */
.board-bar .board-more { position: relative; }
.board-bar .board-more summary { padding: 3px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-weight: 600; }
.board-bar .board-more summary:hover { border-color: var(--line-strong); }
.board-bar .board-more summary span { color: var(--muted); }
.board-bar .board-more .cell-list { position: absolute; right: 0; top: calc(100% + 6px); width: min(440px, 86vw); max-height: 60vh; overflow-y: auto; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 12px rgb(32 39 43 / 6%), 0 28px 56px -20px rgb(32 39 43 / 22%); }
@media (max-width: 760px) {
  body.is-board main { padding: 0; }
  body.is-board main > header { padding: 14px 16px; flex-direction: row; }
  body.is-board .board-wrap { margin: 0; }
  body.is-board .board { padding: 12px 16px 18px; }
  body.is-board .bcol { flex: 0 0 84vw; max-width: none; max-height: none; }
  body.is-board .board-bar { padding: 9px 16px; }
}

/* ---- Drag and drop ---- */
.bcard[draggable="true"] { cursor: grab; }
.bcard[draggable="true"]:active { cursor: grabbing; }
.bcard.is-dragging { opacity: .35; box-shadow: none; outline: 2px dashed var(--line-strong); }
.bcol { transition: box-shadow .12s ease, opacity .12s ease, background-color .12s ease; }
body.is-dragging .bcol.no-drop { opacity: .55; }
body.is-dragging .bcol.can-drop { box-shadow: 0 0 0 2px rgb(255 255 255 / 55%); }
.bcol.is-over { background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand) !important; }
.move-dialog { width: min(440px, calc(100vw - 32px)); padding: 22px 24px; border: 0; border-radius: 12px; background: var(--card, #fff); color: var(--ink); box-shadow: 0 24px 60px rgb(9 30 66 / 30%); }
.move-dialog::backdrop { background: rgb(15 30 32 / 45%); }
.move-dialog h2 { margin: 0 0 6px; font-size: 1.15rem; }
.move-dialog p { margin: 0 0 14px; color: var(--muted); }
.move-dialog label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
.move-dialog .actions { display: flex; gap: 8px; }

.board-run { min-height: 32px; padding: 4px 13px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; font-size: .85rem; font-weight: 600; }
.board-run:hover { border-color: var(--brand-hover); background: var(--brand-hover); color: #fff; }

.board-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.board-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }

/* ---- Label filters and lists that share the width ---- */
.board-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .84rem; font-weight: 600; }
.filter-chip:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.filter-chip.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.filter-chip span { opacity: .7; font-weight: 500; }
.filter-chip i { width: 10px; height: 10px; border-radius: 3px; }
.board-filters + .board-status { padding-left: 14px; border-left: 1px solid var(--line); }
body.is-board .bcol { flex: 1 1 0; min-width: 232px; max-width: 340px; }
.bcard[hidden], .bcol-more[hidden] { display: none; }
@media (max-width: 760px) {
  .board-filters { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .board-filters + .board-status { padding-left: 0; border-left: 0; }
  body.is-board .bcol { flex: 0 0 84vw; min-width: 0; max-width: none; }
}

/* ---- Research library ---- */
.run-list { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.run-row + .run-row { border-top: 1px solid var(--line); }
.run-row summary { display: grid; grid-template-columns: minmax(190px, 260px) 1fr; gap: 6px 18px; align-items: center; padding: 12px 16px; cursor: pointer; list-style: none; }
.run-row summary::-webkit-details-marker { display: none; }
.run-row summary:hover { background: var(--paper); }
.run-row[open] summary { background: var(--paper); }
.run-when { display: grid; gap: 2px; }
.run-trigger { color: var(--muted); font-size: .82rem; }
.run-summary { color: var(--ink-2); font-size: .92rem; }
.run-row.is-failed .run-summary { color: var(--red); }
.run-body { padding: 4px 16px 16px; }
.run-body h3 { margin: 14px 0 6px; font-size: .95rem; }
.link-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
.link-list .muted { font-size: .8rem; }
.lib-tools { display: grid; gap: 10px; margin: 6px 0 14px; }
.lib-tools input[type=search] { max-width: 420px; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-chip { min-height: 30px; padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .84rem; font-weight: 600; }
.lib-chip span { color: var(--muted); font-weight: 500; }
.lib-chip.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.lib-chip.is-on span { color: var(--brand); }
.resource-list { display: grid; border-top: 1px solid var(--line); margin-bottom: 12px; }
.resource-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.resource-main { min-width: 0; }
.resource-main > a { font-weight: 600; overflow-wrap: anywhere; }
.resource-main p { margin: 3px 0 0; font-size: .84rem; }
.resource-used { color: var(--ink-2); }
.resource-row .label { flex: none; }
.disclosure-card > summary { cursor: pointer; font-weight: 650; }
.disclosure-card[open] > summary { margin-bottom: 12px; }
.disclosure-card > .card, .disclosure-card .section.card { box-shadow: none; border: 0; padding: 0; margin-top: 18px; }
@media (max-width: 760px) {
  .run-row summary { grid-template-columns: 1fr; }
  .resource-row { flex-direction: column; gap: 6px; }
}
.log-list .row { overflow-wrap: anywhere; }

/* ---- Problem score ---- */
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-high { --score: #3F6B54; --score-soft: #E9F0EB; }
.score-mid { --score: #8A5F24; --score-soft: #F6EEE0; }
.score-low { --score: #596267; --score-soft: #F1EFEB; }
.score { color: var(--score); background: var(--score-soft); }
.problem-title p.muted { margin: 0; }
.score-block { padding: 16px 18px; border-radius: 10px; background: var(--score-soft); }
.score-total { display: flex; align-items: baseline; gap: 3px; margin: 0 0 10px; color: var(--score); }
.score-total b { font-family: var(--serif); font-size: 2.4rem; font-weight: 650; letter-spacing: -.02em; line-height: 1; }
.score-total span { font-size: .9rem; font-weight: 600; }
.score-parts { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: .82rem; }
.score-parts li { display: grid; grid-template-columns: 78px 1fr 44px; align-items: center; gap: 4px 8px; }
.score-parts li > small { grid-column: 1 / -1; margin-top: -3px; font-size: .74rem; }
.score-parts b { text-align: right; font-variant-numeric: tabular-nums; }
.score-parts b small { color: var(--muted); font-weight: 500; }
.score-bar { height: 6px; border-radius: 3px; background: rgb(32 39 43 / 8%); overflow: hidden; }
.score-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--score); }

/* ---- Problem page: centred, two columns ---- */
.problem-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "back back" "head side" "body side";
  align-items: start; gap: 16px 24px; max-width: 1240px; margin: 0 auto; }
.problem-back { grid-area: back; }
.problem-back p { margin: 0; }
.problem-main-head { grid-area: head; }
.problem-side { grid-area: side; align-self: stretch; }
.problem-side-inner { position: sticky; top: calc(var(--bar) + 16px); display: grid; gap: 16px;
  /* Stays in view while the evidence scrolls; scrolls itself on short screens so the buttons stay reachable. */
  max-height: calc(100vh - var(--bar) - 32px); overflow-y: auto; scrollbar-width: thin; padding: 2px; margin: -2px; }
.problem-body { grid-area: body; display: grid; gap: 16px; min-width: 0; }
.score-card { padding: 0; overflow: hidden; }
.score-card .score-block { border-radius: 0; padding: 18px 22px; }
.decision-card h3 { margin-top: 0; }
.decision-card .actions button:first-child { flex: 1 0 100%; }
.decision-card textarea[name=note] { min-height: 64px; }
@media (max-width: 1080px) {
  .problem-page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "back" "head" "side" "body"; }
  .problem-side-inner { position: static; max-height: none; overflow: visible; }
}

/* ---- Dr. Notes channels ---- */
.channel-list { display: grid; margin: 4px 0 14px; }
.channel-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.channel-row a { font-weight: 600; }
.channel-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.channel-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.channel-form label { margin: 0; }
.task-where { margin: 4px 0 10px; font-size: .9rem; }
@media (max-width: 760px) {
  .channel-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .channel-url { display: none; }
  .channel-form { grid-template-columns: 1fr; }
}

/* ---- Luna's knowledge ---- */
.knowledge-card .row-title { align-items: center; }
.rebuild-steps { display: grid; gap: 0; margin: 6px 0 0; padding: 0; list-style: none; }
.rebuild-steps li { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.rebuild-steps li span { color: var(--muted); }
.rebuild-steps li.is-failed span { color: var(--red); }
.rebuild-steps li b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--brand); vertical-align: 1px; }
.rebuild-steps li.is-failed b::before { background: var(--red); }
@media (max-width: 760px) { .rebuild-steps li { grid-template-columns: 1fr; gap: 2px; } }
.lib-search-note { margin: 0 0 10px; font-size: .85rem; }

/* ---- Source of truth ---- */
.knowledge-jump { position: sticky; top: calc(var(--bar) + 8px); z-index: 5; margin: 0 auto 16px; max-width: 1240px; padding: 8px 10px; border-radius: 12px; background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.knowledge-section { scroll-margin-top: calc(var(--bar) + 70px); }
.knowledge-accounts { margin: -4px 0 12px; font-size: .9rem; }
.knowledge-list { display: grid; margin-bottom: 12px; border-top: 1px solid var(--line); }
.knowledge-item { border-bottom: 1px solid var(--line); }
.knowledge-item > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 11px 4px; cursor: pointer; list-style: none; }
.knowledge-item > summary::-webkit-details-marker { display: none; }
.knowledge-item > summary:hover .knowledge-title { color: var(--brand); }
.knowledge-item > summary small { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.knowledge-item[open] > summary { background: var(--surface-2, #f6f5f1); }
.knowledge-item.is-removed .knowledge-title { color: var(--muted); text-decoration: line-through; }
.knowledge-form { display: grid; gap: 12px; padding: 12px 4px 16px; }
.knowledge-form label { margin: 0; }
.knowledge-form textarea { font-size: .9rem; line-height: 1.5; }
.knowledge-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.knowledge-add { margin-top: 4px; }
.button-link { align-self: center; font-weight: 600; }
@media (max-width: 760px) { .knowledge-fields { grid-template-columns: 1fr; } .knowledge-jump { top: calc(var(--bar) + 4px); } }

/* ---- Run research for one platform ---- */
.run-group { display: inline-flex; gap: 6px; }
.board-run-alt { border-color: var(--line); background: var(--surface); color: var(--brand); }
.board-run-alt:hover { border-color: var(--line-strong); background: var(--paper); color: var(--brand-dark); }
.platform-dialog .platform-choice { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; margin: 0 0 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.platform-dialog .platform-choice:has(input:checked) { border-color: var(--brand); background: #eef6f4; }
.platform-dialog .platform-choice input { margin-top: 3px; accent-color: var(--brand); }
.platform-dialog .platform-choice b { display: block; }
.platform-dialog .platform-choice small { color: var(--muted); }
.platform-dialog .actions { margin-top: 16px; }
@media (max-width: 760px) { .run-group { flex-wrap: wrap; } }
.also-works { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: .9rem; color: var(--muted); }

/* ---- Board colour: a cool slate ground and one accent per list (all from the drnotesapp.com palette) ---- */
body.is-board main { background: #E3EAEE; }
body.is-board .board-bar { border-bottom-color: #C9D8E1; background: #EBF1F5; }
.bcol { --col: var(--brand); --col-soft: #EBF1F5; background: color-mix(in srgb, var(--col-soft) 70%, #FFFFFF); border-top: 3px solid var(--col); box-shadow: 0 1px 2px rgb(32 39 43 / 6%); }
.bcol[data-col="decide"] { --col: #3F6F87; --col-soft: #EBF1F5; }
.bcol[data-col="review"] { --col: #4F5D95; --col-soft: #EEF0F6; }
.bcol[data-col="publish"] { --col: #A8546B; --col-soft: #F6ECEF; }
.bcol[data-col="done"] { --col: #3F7A63; --col-soft: #E8F1EC; }
.bcol[data-col="watch"] { --col: #8A5F24; --col-soft: #F6EEE0; }
.bcol h2 { color: color-mix(in srgb, var(--col) 55%, var(--ink)); }
.bcol h2 span { background: #FFFFFF; color: var(--col); font-weight: 650; }
.bcard { box-shadow: 0 1px 2px rgb(32 39 43 / 6%), 0 2px 8px rgb(32 39 43 / 5%); }
.bcol-empty { border-color: color-mix(in srgb, var(--col) 25%, transparent); background: rgb(255 255 255 / 60%); color: color-mix(in srgb, var(--col) 70%, var(--muted)); }

/* ---- Page colour: the board's slate ground on every page, and one accent per page ---- */
body { --page: #3F6F87; --page-soft: #EBF1F5; background: #E9EEF1; }
body[data-page="Analytics"] { --page: #3F7A63; --page-soft: #E8F1EC; }
body[data-page="Research"] { --page: #4F5D95; --page-soft: #EEF0F6; }
body[data-page="Sources"] { --page: #8A5F24; --page-soft: #F6EEE0; }
body[data-page="Logs"] { --page: #596267; --page-soft: #F1EFEB; }
main { background: #E9EEF1; }
.card { border-color: #DCE3E7; border-top: 3px solid var(--page); box-shadow: 0 1px 2px rgb(32 39 43 / 6%), 0 2px 8px rgb(32 39 43 / 4%); }
.card > h2:first-child, .card > .row-title h2, .card > h3:first-child { color: color-mix(in srgb, var(--page) 55%, var(--ink)); }
nav button.active::after { background: var(--page); }
.lib-chip.is-on { border-color: var(--page); background: var(--page-soft); color: color-mix(in srgb, var(--page) 70%, var(--ink)); }
.lib-chip.is-on span { color: var(--page); }
.empty { border-color: color-mix(in srgb, var(--page) 25%, transparent); background: color-mix(in srgb, var(--page-soft) 55%, #FFFFFF); }
.notice { border-left-color: var(--page); background: color-mix(in srgb, var(--page-soft) 60%, #FFFFFF); }

/* ---- Research schedule ---- */
.schedule-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; margin-top: 6px; }
.schedule-form label { margin: 0; }
.schedule-form label[hidden], .schedule-times[hidden] { display: none; }
.schedule-times { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 190px)); gap: 12px; }
.schedule-time.is-hidden { display: none; }
.schedule-form .actions { grid-column: 1 / -1; margin-top: 0; }

/* Search optimisation card beside a blog draft */
.seo-card p { margin: 0 0 10px; font-size: .9rem; }
.seo-card .side-actions { margin-top: 4px; }

/* A failed job's reason can be long: let it wrap beside the Try again button. */
.bcard-foot .badge { min-width: 0; }
.bcard.is-attention .bcard-foot .badge { flex: 1; line-height: 1.35; }

/* "What you published": the final text per channel, pasted back for Luna to learn from */
.published-card { margin-top: 20px; }
.published-card h3 { margin: 0 0 6px; }
.published-card > .muted { margin: 0 0 14px; }
.final-item { border-top: 1px solid var(--line); padding: 10px 0; }
.final-item summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; cursor: pointer; }
.final-item summary .muted { font-size: .85rem; }
.final-item[open] summary { margin-bottom: 10px; }
.final-form textarea { width: 100%; font: inherit; }
.final-form label { display: block; margin-bottom: 12px; }
.final-remove { margin-top: 6px; }
.published-card > .final-form { border-top: 1px solid var(--line); padding-top: 14px; }

/* ---- Results: marketing analytics ---- */
.analytics-head .row-title { align-items: center; }
.period-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.period-switch button { min-height: 32px; padding: 4px 12px; border: 0; border-radius: 0; background: transparent; color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.period-switch button + button { border-left: 1px solid var(--line-strong); }
.period-switch button.is-on { background: var(--page-soft); color: color-mix(in srgb, var(--page) 75%, var(--ink)); }
.collect-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 6px; }
.rebuild-steps li.is-off b { color: var(--muted); font-weight: 600; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.metric-grid .metric { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--page-soft) 45%, #FFFFFF); }
.metric-grid .metric strong { font-size: 1.7rem; color: var(--ink); }
.metric-grid .metric small:first-child { color: var(--ink-2); font-weight: 600; }
.delta { display: inline-block; margin-right: 4px; padding: 0 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 650; }
.delta.is-up { background: #E8F1EC; color: #2F6650; }
.delta.is-down { background: var(--red-soft); color: var(--red); }
.chart-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.chart-box { margin: 0; }
.chart-box figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 6px; font-size: .9rem; }
.chart-key { color: var(--muted); font-size: .82rem; }
.chart-key::before { content: ""; display: inline-block; width: 10px; height: 3px; margin: 0 6px 3px 0; border-radius: 2px; vertical-align: middle; background: currentColor; }
.chart-key.is-a::before { background: #3F6F87; }
.chart-key.is-b::before { background: #3F7A63; }
.chart { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.is-a { stroke: #3F6F87; }
.chart-line.is-b { stroke: #3F7A63; }
.chart-grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart-axis { stroke: var(--line-strong); }
.funnel { display: grid; gap: 8px; margin: 4px 0 12px; padding: 0; list-style: none; }
.funnel li { display: grid; grid-template-columns: 130px minmax(0, 1fr) 80px; align-items: center; gap: 12px; font-size: .92rem; }
.funnel b { text-align: right; }
.funnel-bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.funnel-bar i { display: block; width: 0; height: 100%; border-radius: 6px; background: var(--page); }
.works-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 24px; }
.works-grid h3 { margin: 6px 0 8px; font-size: .95rem; }
.works { display: grid; gap: 6px; margin: 0; padding-left: 20px; }
.works li span { display: block; }
.works li .muted { font-size: .84rem; }
.seo-table td:first-child { font-weight: 500; min-width: 260px; }
.queries { margin-top: 6px; font-size: .85rem; }
.queries summary { cursor: pointer; color: var(--brand); }
.queries ul { margin: 6px 0 0; padding-left: 18px; }
.hint { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; background: var(--amber-soft); color: #6B4A1C; font-size: .84rem; }
.muted.small, .small.muted { font-size: .82rem; }
.manual-form, .analytics-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; margin-top: 10px; }
.analytics-form fieldset { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 4px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.analytics-form legend { padding: 0 6px; font-weight: 600; font-size: .9rem; }
.analytics-form .actions { grid-column: 1 / -1; }
.analytics-form label .muted, .manual-form label .muted { display: block; font-weight: 400; font-size: .8rem; }
@media (max-width: 640px) {
  .funnel li { grid-template-columns: 100px minmax(0, 1fr) 60px; }
  .rebuild-steps li { grid-template-columns: 1fr; gap: 2px; }
}
.rebuild-steps li.is-off b::before { background: var(--subtle); }
