/* App shell and screens */
body.app { min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(246, 243, 236, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0.7rem 1.25rem; display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.topbar .brand { gap: 0.55rem; }
.topbar .wordmark { font-size: 1.3rem; }
.nav { display: flex; gap: 0.1rem; flex: 1; }
.nav a {
  padding: 0.45rem 0.7rem; border-radius: 999px; text-decoration: none; color: var(--navy);
  font-weight: 500; font-size: 0.92rem; display: inline-flex; align-items: center; white-space: nowrap;
}
.nav a:hover { background: rgba(11, 16, 32, 0.06); }
.nav a[aria-current="page"] { background: var(--navy); color: var(--white); }
.who { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.who .email { font-size: 0.82rem; color: var(--slate-ink); max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main.wrap { max-width: 1180px; margin: 0 auto; padding: 1.8rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); margin: 0; }
.page-head p { margin: 0.3rem 0 0; color: var(--slate-ink); }

/* login screen */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; position: relative; overflow: hidden; }
.login-card { position: relative; z-index: 2; max-width: 460px; width: 100%; padding: 2.2rem; }
.login-card h1 { font-size: 2rem; }
.login .orb { width: 460px; height: 460px; right: -120px; top: -120px; }
.login .orb.b { width: 280px; height: 280px; left: -90px; bottom: -80px; top: auto; right: auto; opacity: 0.55; }

/* dashboard */
.hello { padding: 1.8rem; min-height: 190px; display: flex; flex-direction: column; justify-content: center; }
.hello h2 { color: var(--white); font-size: clamp(1.4rem, 3vw, 2rem); position: relative; z-index: 2; margin-bottom: 0.4rem; }
.hello p { position: relative; z-index: 2; max-width: 560px; margin: 0; }
.hello .orb { width: 300px; height: 300px; right: -60px; top: -80px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin: 1.1rem 0 1.6rem; }
.stat { padding: 1.1rem 1.2rem; }
.stat .label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate-ink); }
.stat .value { font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; letter-spacing: -0.03em; margin-top: 0.25rem; }
.stat .note { font-size: 0.82rem; color: var(--slate-ink); }
.stat.is-hot { background: var(--navy); color: var(--white); border-color: var(--navy); }
.stat.is-hot .label, .stat.is-hot .note { color: #B8C0D6; }
.stat.is-hot .value { color: var(--teal); }
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.2rem; align-items: start; }
.roadmap li { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.roadmap { list-style: none; margin: 0; padding: 0; }
.roadmap li:last-child { border-bottom: 0; }

/* lists */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters button {
  min-height: 36px; padding: 0 1rem; border-radius: 999px; border: 1.5px solid var(--navy); background: transparent;
  color: var(--navy); font: 600 0.85rem var(--font-body); cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.lead-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1rem; padding: 1rem 1.2rem; text-decoration: none; color: inherit; }
.lead-row:hover { border-color: var(--navy); }
.lead-row .title { font-weight: 600; }
.lead-row .sub { color: var(--slate-ink); font-size: 0.88rem; grid-column: 1 / -1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-row .meta { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--slate-ink); }

/* lead detail */
.crumbs { margin-bottom: 1rem; font-size: 0.9rem; }
.detail-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1.2rem; }
.detail-head h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin-bottom: 0.2rem; }
.tracker { margin: 0 0 1.4rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.stack { display: grid; gap: 1.2rem; min-width: 0; }
.cols > *, .split > * { min-width: 0; }
/* The AI's risk flags are full sentences, so they must wrap instead of stretching the page. */
.chip--wrap { white-space: normal; border-radius: 12px; line-height: 1.35; padding: 0.35rem 0.8rem; }
.message { white-space: pre-wrap; overflow-wrap: anywhere; background: #FBFAF6; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem 1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.8rem 1rem; margin: 0.8rem 0 1rem; }
.facts .fact { margin: 0; }
#body { min-height: 300px; line-height: 1.6; }
.facts dt { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate-ink); }
.facts dd { margin: 0.15rem 0 0; font-weight: 600; }
.notice { border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.88rem; margin: 0.9rem 0; }
.notice--amber { background: var(--amber-tint); color: var(--amber-ink); }
.notice--ok { background: var(--mint); color: var(--teal-ink); }
.notice--danger { background: var(--danger-tint); color: var(--danger-ink); }
.notice--info { background: var(--cobalt-tint); color: var(--cobalt-ink); }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.reject-box { margin-top: 0.8rem; display: grid; gap: 0.5rem; }
.sources li { margin-bottom: 0.3rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 0.8rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-family: var(--font-mono); color: var(--slate-ink); font-size: 0.78rem; }

/* playbook */
.prose { max-width: 760px; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: 1.5rem; margin: 0 0 0.8rem; }
.prose h3 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.prose h4 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }
.prose p { white-space: pre-line; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.3rem; }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--mint); color: var(--teal-ink); padding: 0.05em 0.35em; border-radius: 6px; }
.pb-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; margin-bottom: 1.2rem; }
.pb-text { min-height: 520px; font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6; tab-size: 2; }
.pb-preview { max-height: 600px; overflow: auto; }
.label-like { font-weight: 600; font-size: 0.9rem; margin: 0 0 0.35rem; }
.pb-publish { max-width: 760px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--cobalt-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.version-row { display: grid; gap: 0.2rem; padding: 1rem 1.2rem; }
.version-row .title { font-weight: 600; font-size: 1.05rem; }
.version-row .note { margin-top: 0.2rem; }
.compare-head { margin-bottom: 0.6rem; }

/* line by line comparison */
.diff { font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.55; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.diff-line { display: grid; grid-template-columns: 1.8rem 1fr; }
.diff-mark { text-align: center; user-select: none; }
.diff-text { white-space: pre-wrap; overflow-wrap: anywhere; padding-right: 0.8rem; }
.diff-add { background: var(--mint); color: var(--teal-ink); }
.diff-del { background: var(--danger-tint); color: var(--danger-ink); }
.diff-del .diff-text { text-decoration: line-through; text-decoration-thickness: 1px; }
.diff-fold { padding: 0.25rem 0.8rem; background: #F1EEE4; color: var(--slate-ink); font-size: 0.76rem; }

/* campaigns: popup, screenshot and footer preview */
.dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(620px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--white); color: var(--navy); box-shadow: 0 24px 60px rgba(11, 16, 32, 0.35); }
.dialog::backdrop { background: rgba(11, 16, 32, 0.55); }
.dialog-body { padding: 1.5rem; max-height: calc(100vh - 2rem); overflow: auto; }
.dialog-body h2 { margin-bottom: 0.8rem; }
.dialog textarea { min-height: 72px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.fieldset legend { font-weight: 600; font-size: 0.9rem; padding: 0; margin-bottom: 0.35rem; }
.radio { display: flex; align-items: flex-start; gap: 0.6rem; font-weight: 500; margin: 0.35rem 0; cursor: pointer; }
.radio input { width: auto; margin-top: 0.3rem; accent-color: var(--navy); }
.shot { margin: 0 0 1rem; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.shot figcaption { margin-top: 0.3rem; }
.reading summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.reading[open] summary { margin-bottom: 0.8rem; }
.footer-preview { background: #FBFAF6; border: 1px dashed #CFCABB; border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin-bottom: 1rem; }

/* media monitor: stories and sources */
/* The progress arrows scroll sideways on a phone; on a laptop they fit, so the scrollbar is not drawn. */
.tracker { scrollbar-width: none; }
.tracker::-webkit-scrollbar { display: none; }
.nav-badge {
  display: inline-block; min-width: 1.3rem; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 999px;
  background: var(--danger-ink); color: var(--white); font: 600 0.72rem/1.25rem var(--font-body); text-align: center; vertical-align: 1px;
}
.nav-badge[hidden] { display: none; }
.subnav { display: flex; gap: 1.6rem; border-bottom: 1px solid var(--line); margin: -0.4rem 0 1.4rem; }
.subnav a { padding: 0.5rem 0.1rem; text-decoration: none; color: var(--slate-ink); font-weight: 600; font-size: 0.95rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--navy); }
.subnav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--teal); }
.filter-bar { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.filter-bar .filters { margin-bottom: 0; }
.select-wrap select { min-height: 36px; padding: 0 0.9rem; border-radius: 999px; font-size: 0.88rem; width: auto; min-width: 190px; }
.story-row .story-reason { margin-top: -0.2rem; font-style: italic; }
.story-summary { font-size: 1.02rem; line-height: 1.6; margin-bottom: 0.9rem; }
.story-summary mark, .post-note mark { background: #CFF6EF; color: var(--teal-ink); padding: 0.05em 0.25em; border-radius: 5px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.cols.cols--story { grid-template-columns: 5fr 6fr; }
#post { min-height: 360px; line-height: 1.65; font-size: 1rem; }
.post-meta { margin-top: 0.3rem; }
.words-off { color: var(--amber-ink); font-weight: 600; }
.first-version { margin: 0.9rem 0; }
.first-version summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.first-version .message { margin-top: 0.4rem; }
.section-title { font-size: 1.15rem; margin: 1.6rem 0 0.7rem; }
.how-read { margin-bottom: 1.2rem; }
.how-read ul { margin: 0 0 0.8rem; padding-left: 1.2rem; }
.source-row { display: grid; gap: 0.35rem; padding: 1rem 1.2rem; }
.source-row.is-off { background: #FBFAF6; }
.source-main { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; align-items: baseline; }
.source-main .title { font-weight: 600; }
.source-main .meta { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
.source-row .sub { color: var(--slate-ink); font-size: 0.88rem; }
.source-row p { margin: 0; }
.source-problem { color: var(--danger-ink); }
.source-url { overflow-wrap: anywhere; font-size: 0.78rem; }
.source-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; }
.dialog--small { width: min(460px, calc(100vw - 2rem)); }
#notify-to { min-height: 84px; }

/* wiki */
.wiki-tools { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.wiki-search { max-width: 380px; }
.wiki-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem 1.1rem; align-items: center; padding: 1rem 1.2rem; }
.file-kind { width: 54px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font: 600 0.7rem var(--font-mono); letter-spacing: 0.04em; background: var(--mint); color: var(--teal-ink); }
.file-kind--pdf { background: var(--danger-tint); color: var(--danger-ink); }
.file-kind--doc { background: var(--cobalt-tint); color: var(--cobalt-ink); }
.file-kind--ppt { background: var(--amber-tint); color: var(--amber-ink); }
.file-kind--img, .file-kind--txt { background: #ECE8DD; color: var(--slate-ink); }
.wiki-main { display: grid; gap: 0.1rem; min-width: 0; }
.wiki-title { font-weight: 600; overflow-wrap: anywhere; }
.wiki-meta { color: var(--slate-ink); font-size: 0.84rem; overflow-wrap: anywhere; }
.wiki-note { margin: 0.25rem 0 0; font-size: 0.9rem; }
.wiki-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.dropzone { border: 2px dashed #CFCABB; border-radius: var(--radius-sm); padding: 1.3rem 1rem; text-align: center; cursor: pointer; background: #FBFAF6; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--teal-ink); background: var(--mint); outline: 0; }
.dropzone .drop-text { margin: 0 0 0.2rem; font-weight: 600; overflow-wrap: anywhere; }
progress { width: 100%; height: 10px; accent-color: var(--teal-ink); }
@media (max-width: 900px) { .wiki-row { grid-template-columns: auto 1fr; } .wiki-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* toast */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; z-index: 60; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--navy); color: var(--white); padding: 0.8rem 1.1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 0.92rem; }
.toast.is-error { background: var(--danger-ink); }

.skeleton { background: linear-gradient(90deg, #ECE8DD, #F7F4EC, #ECE8DD); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); min-height: 90px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Four menu items no longer fit a phone at the default size: wrap onto the next line and tighten the links. */
@media (max-width: 640px) {
  .nav { flex-wrap: wrap; gap: 0.15rem; flex: 1 1 100%; order: 3; }
  .nav a { padding: 0.4rem 0.75rem; font-size: 0.88rem; }
  .topbar-inner { gap: 0.6rem; }
}

@media (max-width: 900px) {
  .split, .cols, .cols.cols--story, .pb-edit, .field-row { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 0.1rem; }
  .who .email { display: none; }
}
