/* DCBC Social Intelligence
   Direction: an evidence ledger. Every number carries where it came from.
   What the app cannot see is drawn, not hidden: hatched cells. */

:root {
  --paper: #F1F2EE;
  --surface: #FFFFFF;
  --ink: #14161B;
  --graphite: #5E636B;
  --faint: #8B9097;
  --rule: #DADCD4;
  --rule-strong: #B9BCB2;
  --cobalt: #1F3FE0;
  --cobalt-deep: #142C9E;
  --cobalt-wash: #E6EAFD;
  --marker: #FFD84A;
  --green: #1C7A4C;
  --green-wash: #E2F2E8;
  --amber: #A86A00;
  --amber-wash: #FBF0D6;
  --red: #C2381E;
  --red-wash: #FBE6E0;
  --hatch: repeating-linear-gradient(135deg, transparent 0 6px, rgba(20, 22, 27, .09) 6px 7px);
  --radius-sm: 4px;
  --radius: 8px;
  --side: 236px;
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 var(--font); font-feature-settings: "tnum" 1;
}
a { color: var(--cobalt); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--cobalt-deep); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; }
small, .muted { color: var(--graphite); }
.faint { color: var(--faint); }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 24px 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.shell > * { min-width: 0; }
.side {
  background: var(--ink); color: #E9EAE6; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
}
.wordmark { font-weight: 800; letter-spacing: -.02em; font-size: 15px; line-height: 1.15; padding: 0 10px; color: inherit; text-decoration: none; display: block; }
.wordmark span { display: block; font-size: 26px; letter-spacing: -.04em; }
.wordmark.lg { font-size: 18px; margin-bottom: 28px; color: var(--ink); }
.wordmark.lg span { font-size: 40px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: #C9CBC5; text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm);
  font-weight: 500; display: flex; justify-content: space-between; align-items: center;
}
.nav a:hover { background: #22252C; color: #fff; }
.nav a.on { background: var(--cobalt); color: #fff; }
.nav .group { color: #7E828A; font-size: 12px; padding: 14px 10px 4px; }
.side-foot { margin-top: auto; font-size: 13px; color: #8E929A; padding: 0 10px; }
.side-foot form { display: inline; }
.side-foot button { background: none; border: 0; color: #C9CBC5; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cta-side { background: var(--marker) !important; color: var(--ink) !important; font-weight: 700 !important; }

.main { min-width: 0; padding: 28px 40px 80px; max-width: 1240px; }
.topline { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.h1 { font-size: 34px; line-height: 1.08; letter-spacing: -.03em; font-weight: 800; margin: 0; }
.h2 { font-size: 20px; letter-spacing: -.015em; font-weight: 700; margin: 0 0 12px; }
.h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.lede { font-size: 17px; color: var(--graphite); max-width: 62ch; }
.crumb { font-size: 13px; color: var(--graphite); margin-bottom: 6px; }
.crumb a { color: inherit; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; }
.panel + .panel { margin-top: 16px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head .h2 { margin: 0; }
.stack { display: grid; gap: 16px; }
.cols { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.cols > * { min-width: 0; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }

/* ---------- Figures with provenance ---------- */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.fig { padding: 16px 18px 14px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; min-height: 112px; display: flex; flex-direction: column; }
.fig .k { font-size: 13px; color: var(--graphite); }
.fig .v { font-size: 34px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 4px 0 auto; }
.fig .v small { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.fig .src { font-size: 11.5px; color: var(--faint); margin-top: 10px; line-height: 1.35; }
.fig.na { background: var(--hatch), #FAFAF8; }
.fig.na .v { font-size: 15px; font-weight: 600; color: var(--graphite); letter-spacing: 0; margin-top: 10px; }

/* ---------- Coverage ledger ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th { text-align: left; font-weight: 600; color: var(--graphite); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--rule-strong); }
.ledger td { padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger tr.unavailable td { background: var(--hatch); color: var(--graphite); }
.ledger tr.group td { background: var(--paper); font-weight: 700; font-size: 12.5px; color: var(--ink); padding-top: 12px; }
.state { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.state.available { background: var(--green-wash); color: var(--green); }
.state.partial { background: var(--amber-wash); color: var(--amber); }
.state.unavailable { background: transparent; color: var(--graphite); border: 1px solid var(--rule-strong); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--graphite); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--rule-strong); background: var(--surface); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #F8F9F6; }
.table .num { text-align: right; white-space: nowrap; }
.rowlink { font-weight: 700; color: var(--ink); text-decoration: none; }
.rowlink:hover { color: var(--cobalt); }
.handle { color: var(--graphite); font-size: 13px; }
.table-wrap { overflow-x: auto; }

/* ---------- Chips and badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); white-space: nowrap; }
.chip.blue { background: var(--cobalt-wash); border-color: transparent; color: var(--cobalt-deep); }
.chip.green { background: var(--green-wash); border-color: transparent; color: var(--green); }
.chip.amber { background: var(--amber-wash); border-color: transparent; color: var(--amber); }
.chip.red { background: var(--red-wash); border-color: transparent; color: var(--red); }
.chip.dark { background: var(--ink); color: #fff; border-color: transparent; }
.demo-tag { display: inline-block; background: var(--marker); color: var(--ink); font-weight: 800; font-size: 11px; padding: 1px 6px; border-radius: 3px; letter-spacing: .02em; }
.demo-band {
  background: repeating-linear-gradient(135deg, var(--marker) 0 14px, #14161B 14px 16px);
  padding: 4px; border-radius: var(--radius); margin-bottom: 18px;
}
.demo-band > div { background: var(--marker); border-radius: 5px; padding: 10px 14px; font-weight: 600; }

/* ---------- Buttons and forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14.5px/1 var(--font);
  padding: 11px 16px; border-radius: var(--radius-sm); border: 1px solid var(--rule-strong); background: var(--surface);
  color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.primary:hover { background: var(--cobalt-deep); border-color: var(--cobalt-deep); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--graphite); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { color: var(--ink); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

.form label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; }
.form label small { font-weight: 400; }
.form .hint { display: block; font-weight: 400; color: var(--graphite); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px; font: 400 15px/1.4 var(--font); color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: #fff;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-wash); }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 800; font-size: 16px; letter-spacing: -.01em; margin-bottom: 12px; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 500 !important; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters input, .filters select { margin-top: 0; width: auto; min-width: 160px; }
.filters .grow { flex: 1 1 240px; }
.filters .grow input { width: 100%; }

/* ---------- The analyse box (hero of the app) ---------- */
.probe { background: var(--ink); color: #fff; border-radius: 12px; padding: 34px 34px 30px; position: relative; overflow: hidden; }
.probe h1 { font-size: 44px; line-height: 1.02; letter-spacing: -.04em; font-weight: 800; margin: 0 0 10px; max-width: 18ch; }
.probe p { color: #B9BCC3; max-width: 60ch; }
.probe form { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.probe .at { position: relative; flex: 1 1 340px; }
.probe .at input { margin: 0; font-size: 22px; font-weight: 700; padding: 16px 16px 16px 44px; border: 0; border-radius: 6px; }
.probe .at::before { content: "@"; position: absolute; left: 16px; top: 50%; transform: translateY(-52%); font-size: 22px; font-weight: 800; color: var(--faint); z-index: 1; }
.probe .btn.primary { font-size: 17px; padding: 0 26px; background: var(--marker); border-color: var(--marker); color: var(--ink); min-height: 58px; }
.probe .btn.primary:hover { background: #fff; border-color: #fff; }
.probe details { margin-top: 14px; color: #C9CBC5; }
.probe summary { cursor: pointer; font-size: 14px; }
.probe .more { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; max-width: 620px; }
.probe .more label { color: #C9CBC5; font-size: 13px; font-weight: 600; }
.probe .more input, .probe .more select { border: 0; }
.truths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); margin-top: 16px; }
.truths > div { padding: 16px 18px; border-right: 1px solid var(--rule); }
.truths > div:last-child { border-right: 0; }
.truths .na-cell { background: var(--hatch); }
.truths b { display: block; margin-bottom: 4px; }
.truths p { font-size: 13.5px; color: var(--graphite); margin: 0; }

/* ---------- Client header and tabs ---------- */
.client-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.client-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--graphite); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--cobalt); }

/* ---------- Observations ---------- */
.obs { list-style: none; margin: 0; padding: 0; }
.obs li { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--rule); }
.obs li:first-child { border-top: 0; padding-top: 4px; }
.obs .kind { font-size: 12.5px; font-weight: 700; }
.obs .kind.weakness { color: var(--red); } .obs .kind.strength { color: var(--green); } .obs .kind.gap, .obs .kind.pattern { color: var(--cobalt-deep); } .obs .kind.limit { color: var(--graphite); }
.obs .t { font-weight: 700; }
.obs .ev { font-size: 13.5px; color: var(--graphite); margin-top: 2px; }
.obs .fix { font-size: 13.5px; margin-top: 6px; padding-left: 10px; border-left: 3px solid var(--marker); }
.obs .conf { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* ---------- Bars ---------- */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 128px 1fr 84px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar .track { height: 12px; background: var(--paper); border-radius: 2px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--cobalt); }
.bar .fill.alt { background: var(--ink); }
.bar .val { text-align: right; color: var(--graphite); white-space: nowrap; }
.cols7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 120px; }
.cols7 .col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 12px; color: var(--graphite); }
.cols7 .stick { width: 100%; max-width: 34px; background: var(--ink); border-radius: 2px 2px 0 0; min-height: 2px; }
.note { font-size: 12.5px; color: var(--graphite); margin-top: 10px; }
.formula { font-size: 13px; background: var(--paper); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 10px; }

/* ---------- Posts ---------- */
.posts { display: grid; gap: 0; }
.post { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); align-items: start; }
.post:first-child { border-top: 0; }
.post .rank { font-weight: 800; font-size: 18px; color: var(--faint); }
.post .cap { font-size: 14px; }
.post .m { font-size: 12.5px; color: var(--graphite); margin-top: 3px; }
.post .score { font-weight: 800; font-size: 18px; text-align: right; white-space: nowrap; }
.post .score small { display: block; font-size: 11.5px; font-weight: 500; color: var(--faint); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; border-left: 4px solid; }
.flash.success { background: var(--green-wash); border-color: var(--green); }
.flash.error { background: var(--red-wash); border-color: var(--red); }
.flash.info { background: var(--cobalt-wash); border-color: var(--cobalt); }

/* ---------- Run progress ---------- */
.progress { display: flex; gap: 18px; align-items: center; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--cobalt); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }

/* ---------- Empty states ---------- */
.empty { padding: 34px 24px; text-align: left; }
.empty .h2 { margin-bottom: 6px; }

/* ---------- Memory ---------- */
.mem-group { margin-bottom: 22px; }
.mem { padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px; }
.mem .body { white-space: pre-wrap; }
.mem .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.mem details summary { cursor: pointer; color: var(--cobalt); font-size: 13px; }

/* ---------- Bare layout ---------- */
.bare { display: grid; place-items: start center; min-height: 100vh; }
.bare-wrap { width: min(440px, 100% - 32px); padding: 9vh 0 60px; }
.bare-wrap.wide { width: min(720px, 100% - 32px); }
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 4px; font-size: 14px; }
.checks span { display: inline-block; width: 36px; font-weight: 800; }
.checks .ok span { color: var(--green); } .checks .bad span { color: var(--red); }

.danger-zone { border-color: var(--red); }
.danger-zone .h2 { color: var(--red); }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--graphite); } .kv dd { margin: 0; }
.spark { display: block; width: 100%; height: 64px; }
.mobile-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 14px 16px; flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
  .side .wordmark span { font-size: 20px; display: inline; margin-right: 6px; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; gap: 4px; padding-bottom: 2px; }
  .nav a { white-space: nowrap; }
  .nav .group { display: none; }
  .side-foot { margin: 0 0 0 auto; }
  .main { padding: 20px 16px 60px; }
  .c4, .c5, .c6, .c7, .c8 { grid-column: span 12; }
  .grid2, .grid3, .probe .more { grid-template-columns: 1fr; }
  .truths { grid-template-columns: 1fr; }
  .truths > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .probe { padding: 24px 18px; }
  .probe h1 { font-size: 32px; }
  .h1 { font-size: 27px; }
  .obs li { grid-template-columns: 1fr; gap: 4px; }
  .bar { grid-template-columns: 96px 1fr 70px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .table .hide-sm, .ledger .hide-sm { display: none; }
  .side-foot { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
}
@media print {
  .side, .tabs, .actions, .btn { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
