/* Component frame and non-chart components: figure card, legend, tooltip, table view, fact-check labels, status counter, opinions, KPI tiles, number tables, proof quotes. */

/* every component sets its own type: inside a document it must not inherit the reading serif */
.nb-c { font: 400 var(--t-ui) / var(--lh-ui) var(--font-ui); color: var(--ink); }

/* ---------- figure frame ---------- */
.nb-fig {
  display: grid;
  gap: var(--s4);
  margin: 0;
  padding: var(--s5);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font: 400 var(--t-ui) / var(--lh-ui) var(--font-ui);
  color: var(--ink);
  min-width: 0;
}
.nb-fig-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.nb-fig-titles { display: grid; gap: 2px; min-width: 0; flex: 1 1 16rem; }
.nb-fig-title { font: 600 1.0625rem / 1.35 var(--font-ui); letter-spacing: -0.006em; }
.nb-fig-sub { color: var(--ink-3); font-size: var(--t-sm); }
.nb-fig-tools { display: flex; gap: var(--s2); }
.nb-fig-tools .nb-btn { height: 28px; padding: 0 10px; font-size: var(--t-xs); }
.nb-fig-body { min-width: 0; position: relative; }
.nb-fig-table { position: relative; overflow-x: auto; }
.nb-fig-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--s2);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: var(--t-xs);
  line-height: 1.5;
}
.nb-fig-foot .src { color: var(--ink-2); }
.nb-fig-foot a:not(.nb-id) { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 2px; }
.nb-chip-sample {
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--part-wash);
  color: var(--part-ink);
  font-weight: 600;
}
.nb-fig-error {
  padding: var(--s4);
  border-radius: var(--r);
  background: var(--no-wash);
  color: var(--no-ink);
  font: 500 var(--t-sm) / 1.5 var(--font-ui);
}
.nb-fig-error code { color: inherit; }

/* legend: swatch mirrors the mark — rect for bars, line for lines */
.nb-legend { display: flex; flex-wrap: wrap; gap: 6px var(--s4); margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--t-sm); }
.nb-legend li { display: inline-flex; align-items: center; gap: 7px; }
.nb-legend .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--sw); flex-shrink: 0; }
.nb-legend .sw.line { height: 2px; width: 16px; border-radius: 1px; }
.nb-legend .sw.dot { width: 10px; height: 10px; border-radius: 50%; }

/* tooltip: values lead, labels follow */
.nb-tip {
  position: fixed;
  z-index: 90;
  min-width: 9rem;
  max-width: 18rem;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--ink);
  font: 400 var(--t-sm) / 1.4 var(--font-ui);
  pointer-events: none;
}
.nb-tip-title { margin-bottom: 4px; color: var(--ink-3); font-size: var(--t-xs); font-weight: 500; }
.nb-tip-row { display: grid; grid-template-columns: 14px auto minmax(0, 1fr); align-items: center; gap: 6px; }
.nb-tip-row .k { width: 12px; height: 2px; border-radius: 1px; background: var(--sw); }
.nb-tip-row b { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-tip-row span { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-tip-note { margin-top: 4px; color: var(--ink-2); font-size: var(--t-xs); }

/* ---------- fact-check labels ---------- */
.nb-l {
  --i: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  height: 1.5em;
  padding: 0 0.42em;
  border-radius: 5px;
  font: 600 0.72em / 1 var(--font-ui);
  letter-spacing: 0.01em;
  vertical-align: 0.14em;
  white-space: nowrap;
  text-decoration: none;
}
.nb-l::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.nb-l.is-icon { padding: 0 0.3em; }
.nb-l[data-l="ok"] { background: var(--ok-wash); color: var(--ok-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4 6.6 11.4 12.6 4.8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.nb-l[data-l="part"] { background: var(--part-wash); color: var(--part-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 9.2c1.4-2.4 3-2.4 4.4-.9s3 1.5 4.6-.9' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.nb-l[data-l="no"] { background: var(--no-wash); color: var(--no-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 4.5l7 7M11.5 4.5l-7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.nb-l[data-l="unk"] { background: var(--unk-wash); color: var(--unk-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5.6 5.9a2.5 2.5 0 1 1 3.4 2.3c-.6.3-1 .8-1 1.5v.5' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='12.6' r='1.1'/%3E%3C/svg%3E"); }
.nb-l[data-l="op"] { background: var(--op-wash); color: var(--op-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 4.5h10v6H8l-3 2.5v-2.5H3z' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.nb-l[data-l="own"] { background: var(--own-wash); color: var(--own-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='5.6' r='2.6' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M3.2 13.4c.6-2.4 2.5-3.6 4.8-3.6s4.2 1.2 4.8 3.6' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E"); }
/* без основания: пустая рамка — в источнике нет ссылки, подтверждения нет */
.nb-l[data-l="unfounded"] { background: var(--unk-wash); color: var(--unk-ink); --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='3' y='3' width='10' height='10' rx='2' fill='none' stroke='black' stroke-width='1.7' stroke-dasharray='2.4 2'/%3E%3C/svg%3E"); }
button.nb-l { border: 0; cursor: help; }

/* label legend: chip + meaning */
.nb-legend-labels { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; font-size: var(--t-sm); }
.nb-legend-labels li { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s3); align-items: baseline; color: var(--ink-2); }
.nb-legend-labels .nb-l { font-size: var(--t-xs); justify-self: start; }

/* ---------- status counter ---------- */
.nb-counter { display: grid; gap: var(--s3); }
.nb-counter-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s3); }
.nb-counter-head .big { font: 600 var(--t-kpi) / 1 var(--font-ui); letter-spacing: -0.02em; }
.nb-counter-head .txt { color: var(--ink-2); font-size: var(--t-sm); }
.nb-stack { display: flex; gap: 2px; height: 10px; }
.nb-stack > i { min-width: 3px; background: var(--seg); }
.nb-stack > i:first-child { border-radius: 3px 0 0 3px; }
.nb-stack > i:last-child { border-radius: 0 3px 3px 0; }
.nb-stack > i:only-child { border-radius: 3px; }
.nb-stack.is-empty { background: var(--sunken); border-radius: 3px; }
.nb-counter-legend { display: flex; flex-wrap: wrap; gap: 6px var(--s4); margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--t-sm); }
.nb-counter-legend li { display: inline-flex; align-items: center; gap: 6px; }
.nb-counter-legend b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.nb-counter-legend .sep { width: 1px; height: 16px; background: var(--rule-2); }
.nb-counter.is-compact { gap: var(--s2); }
.nb-counter.is-compact .nb-stack { height: 6px; }
.nb-counter.is-compact .nb-counter-legend { gap: 4px var(--s3); font-size: var(--t-xs); }
.nb-counter.is-compact .nb-l { font-size: 0.68rem; }

/* ---------- opinions → check ---------- */
.nb-opinions { display: grid; gap: var(--s3); font-family: var(--font-ui); }
.nb-op-topic { color: var(--ink-3); font: 600 var(--t-xs) / 1.3 var(--font-ui); letter-spacing: 0.07em; text-transform: uppercase; }
.nb-op-topic span { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: var(--t-sm); }
.nb-op-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: var(--s3); }
.nb-op {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s3);
  padding: var(--s4) var(--s4) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
}
.nb-op.is-winner { border-color: color-mix(in srgb, var(--ok) 45%, var(--rule)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 25%, transparent); }
.nb-op-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s2); }
.nb-op-head .n { font: 650 var(--t-sm) / 1.3 var(--font-ui); }
.nb-op-head .src { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.nb-op-head .win { margin-left: auto; color: var(--ok-ink); font-size: var(--t-xs); font-weight: 600; }
.nb-op-text { font: 400 1.0625rem / 1.6 var(--font-read); color: var(--ink); }
.nb-op-check { display: grid; gap: 4px; padding-top: var(--s3); border-top: 1px solid var(--rule); color: var(--ink-2); font-size: var(--t-sm); line-height: 1.5; }
.nb-op-check .lbl { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font: 600 var(--t-xs) / 1.3 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }
.nb-op-check .lbl::before { content: "↓"; font-weight: 500; letter-spacing: 0; }
.nb-op-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  background: var(--sunken);
  font-size: var(--t-ui);
  line-height: 1.5;
}
.nb-op-verdict .lbl { color: var(--ink-3); font: 600 var(--t-xs) / 1.3 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }
.nb-prose .nb-opinions { margin-top: 1.6em; }

/* ---------- KPI tiles ---------- */
.nb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--s3); }
.nb-kpi {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 6px;
  min-width: 0;
  padding: var(--s4) var(--s4) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
}
.nb-kpi-label { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.35; }
.nb-kpi-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font: 600 var(--t-kpi) / 1.05 var(--font-ui); letter-spacing: -0.022em; }
.nb-kpi-value .u { color: var(--ink-3); font-size: var(--t-sm); font-weight: 500; letter-spacing: 0; }
.nb-kpi-value.is-pending { color: var(--ink-4); }
.nb-kpi-delta { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: var(--t-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.nb-kpi-delta.good { color: var(--good-ink); }
.nb-kpi-delta.bad { color: var(--bad-ink); }
.nb-kpi-delta.flat { color: var(--ink-2); }
.nb-kpi-delta span { color: var(--ink-3); font-weight: 400; }
.nb-kpi-spark { align-self: end; height: 32px; margin-top: 2px; }
.nb-kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding-top: var(--s2); border-top: 1px solid var(--rule); color: var(--ink-3); font-size: var(--t-xs); }
.nb-kpi-foot .nb-l { font-size: 0.68rem; }
.nb-kpi-note { color: var(--ink-3); font-size: var(--t-xs); }

/* ---------- number table ---------- */
.nb-t caption { caption-side: bottom; }
.nb-t td.lbl-cell .nb-l { font-size: 0.68rem; }
.nb-t .u { color: var(--ink-3); font-weight: 500; font-size: var(--t-xs); white-space: nowrap; }
.nb-t th.num .u { display: block; }
.nb-t tfoot td { border-top: 1px solid var(--rule-2); font-weight: 650; background: var(--sunken); }
.nb-t .pending { color: var(--ink-4); }
.nb-t .nb-calc-note { font-size: 0.65rem; color: var(--ink-3); font-weight: 500; margin-left: 4px; vertical-align: baseline; text-decoration: underline dotted; cursor: help; }
.nb-t .barcell { display: grid; grid-template-columns: minmax(3rem, 1fr) auto; gap: 10px; align-items: center; }
.nb-t .barcell i { display: block; height: 8px; width: calc(var(--v) * 100%); min-width: 2px; border-radius: 0 3px 3px 0; background: var(--c1); justify-self: start; }
.nb-t tr.is-self td { background: var(--accent-wash); font-weight: 600; }

/* ---------- proof quote ---------- */
.nb-quote {
  display: grid;
  gap: var(--s3);
  margin: 0;
  padding: var(--s5) var(--s5) var(--s4);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.nb-quote blockquote {
  position: relative;
  margin: 0;
  padding-left: 1.6rem;
  font: 400 1.1875rem / 1.55 var(--font-read);
  color: var(--ink);
}
.nb-quote blockquote::before {
  content: "«";
  position: absolute;
  left: -0.1rem;
  top: -0.35rem;
  color: var(--ink-4);
  font: 400 2.25rem / 1 var(--font-read);
}
.nb-quote figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s2); padding-left: 1.6rem; color: var(--ink-3); font: 400 var(--t-xs) / 1.5 var(--font-ui); }
.nb-quote .site { color: var(--ink); font-weight: 600; font-size: var(--t-sm); }
.nb-quote .claim { color: var(--ink-2); }
.nb-quote a.url { color: var(--accent); overflow-wrap: anywhere; }

/* ---------- proof shot: thumbnail at the proof link, full image in a dialog ---------- */
.nb-shot-thumb {
  display: inline-block;
  width: 44px;
  height: 26px;
  margin-left: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--sunken);
  overflow: hidden;
  vertical-align: middle;
  line-height: 0;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}
.nb-shot-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nb-shot-thumb:hover { border-color: var(--rule-2); opacity: 0.86; }

.nb-modal-shot {
  display: grid;
  gap: var(--s2);
  max-width: 90vw;
  max-height: 90vh;
  padding: var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--ink);
  font: 400 var(--t-sm) / 1.4 var(--font-ui);
}
.nb-modal-shot:not([open]) { display: none; }
/* the same veil as the search dialog: one backdrop for every modal layer of the notebook */
.nb-modal-shot::backdrop { background: rgba(10, 10, 9, 0.32); }
.nb-modal-shot-head { display: flex; align-items: center; gap: var(--s3); color: var(--ink-3); }
.nb-modal-shot-head span { flex: 1; }
.nb-modal-shot-close { margin: -6px -6px -6px 0; }
.nb-modal-shot img {
  display: block;
  max-width: calc(90vw - 2 * var(--s3));
  max-height: calc(90vh - 4.5rem);
  border-radius: var(--r-sm);
  background: var(--sunken);
  object-fit: contain;
}

@media (max-width: 640px) {
  .nb-fig { padding: var(--s4); border-radius: var(--r); }
  .nb-quote { padding: var(--s4); }
  .nb-quote blockquote { font-size: 1.0625rem; }
  .nb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .nb-kpi { padding: var(--s3); }
  .nb-kpi-value { font-size: 1.5rem; }
  .nb-counter-head .big { font-size: 1.625rem; }
}
