/* Country Intel module styles — extends the existing OSINT theme. */

.ci-hero-icon {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(0, 229, 192, 0.2));
  color: #38bdf8;
}

.ci-narrow {
  max-width: 640px;
  margin: 0 auto;
}

.ci-back-link {
  color: var(--bs-secondary-color, #8b95a7);
  font-size: 0.85rem;
  text-decoration: none;
}

.ci-back-link:hover {
  color: #38bdf8;
}

.ci-iso {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7em;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
}

/* Case header + tab nav */
.ci-case-header {
  padding: 1.25rem 1.5rem 0;
}

.ci-case-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.ci-case-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.ci-tab-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: 0 -1.5rem;
  padding: 0.5rem 1rem;
}

.ci-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--bs-secondary-color, #8b95a7);
  text-decoration: none;
}

.ci-tab:hover {
  color: #e8ecf4;
  background: rgba(255, 255, 255, 0.05);
}

.ci-tab.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

/* Badges */
.ci-badge {
  font-size: 0.7rem;
}

.ci-badge-draft { background: rgba(139, 149, 167, 0.18); color: #aab3c5; }
.ci-badge-collecting { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.ci-badge-review { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.ci-badge-complete { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.ci-badge-rejected { background: rgba(251, 113, 133, 0.15); color: #fb7185; }
.ci-badge-digest { background: rgba(251, 191, 36, 0.22); color: #fbbf24; font-weight: 600; }

/* Evidence-digest reports carry no analysis — the notice must not be subtle. */
.ci-digest-notice {
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
}

/* Citation audit */
.ci-audit-blocked {
  border: 1px solid rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.1);
  color: #fb7185;
}

.ci-audit-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.5rem;
}

.ci-audit-stat {
  border: 1px solid rgba(139, 149, 167, 0.25);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
}

.ci-audit-stat-value { font-size: 1.25rem; font-weight: 600; }
.ci-audit-stat-label { font-size: 0.7rem; color: #aab3c5; }

.ci-audit-blockers li { color: #fb7185; }
.ci-audit-warnings li { color: #fbbf24; }

.ci-audit-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  background: rgba(139, 149, 167, 0.18);
  border-radius: 4px;
  padding: 0 0.3rem;
  margin-right: 0.35rem;
}

.ci-trust-high { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.ci-trust-medhigh { background: rgba(0, 229, 192, 0.12); color: #00e5c0; }
.ci-trust-medium { background: rgba(251, 191, 36, 0.14); color: #fbbf24; }

.ci-type-trusted { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.ci-type-wiki { background: rgba(250, 204, 21, 0.16); color: #facc15; border: 1px solid rgba(250, 204, 21, 0.35); }
.ci-wiki-notice { border: 1px solid rgba(250, 204, 21, 0.55); background: rgba(250, 204, 21, 0.1); color: #fef3c7; }
.ci-box-wiki { color: #facc15; }
.ci-type-social { background: rgba(255, 107, 53, 0.15); color: #ff6b35; }
.ci-type-note { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

/* Evidence table */
.ci-ev-title { font-size: 0.9rem; margin-bottom: 0.15rem; }
.ci-ev-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.ci-ev-excerpt { max-width: 46rem; }

.ci-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  margin: 0 0.15rem 0.15rem 0;
  color: #aab3c5;
}

.ci-cite {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  text-decoration: none;
}

a.ci-cite:hover { background: rgba(56, 189, 248, 0.25); }

.ci-source-disabled { opacity: 0.5; }

/* Search run progress */
.ci-progress { height: 6px; background: rgba(255, 255, 255, 0.08); }
.ci-progress .progress-bar { background: linear-gradient(90deg, #38bdf8, #00e5c0); }
.ci-run-log { max-height: 220px; overflow-y: auto; }

/* Acquisition board (24 boxes x 3 slots) */
.ci-board-grid { display: flex; flex-direction: column; gap: 0.6rem; }

.ci-board-row {
  display: grid;
  grid-template-columns: 9rem 1fr 1fr;
  gap: 0.6rem;
  align-items: start;
}

.ci-board-category { font-size: 0.85rem; font-weight: 600; padding-top: 0.5rem; }

.ci-box {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ci-box.collected { border-color: rgba(56, 189, 248, 0.4); }
.ci-box.ready { border-color: rgba(0, 229, 192, 0.5); }
.ci-box.incomplete { border-color: rgba(250, 204, 21, 0.35); }

.ci-box-open {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 0.68rem;
  padding: 0.15rem 0.2rem;
  cursor: pointer;
  text-align: left;
}

.ci-box-open:disabled { cursor: default; opacity: 0.6; }
.ci-box-open:not(:disabled):hover { background: rgba(56, 189, 248, 0.16); }
.ci-box-open:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }

.ci-box-kind {
  text-transform: uppercase;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.ci-box-kind-baseline { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
.ci-box-kind-current { background: rgba(167, 139, 250, 0.16); color: #a78bfa; }

.ci-box-counts { display: flex; flex-wrap: wrap; gap: 0.4rem; color: #8794ad; }
.ci-box-collected { color: #38bdf8; }
.ci-box-accepted { color: #00e5c0; }
.ci-box-missing { color: #facc15; }
.ci-box-review { color: #7dd3fc; }

.ci-box-slots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ci-box-slot {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 0.22rem 0.3rem;
  min-height: 2.4rem;
}

.ci-box-slot.empty {
  border-style: dashed;
  border-color: rgba(250, 204, 21, 0.35);
  display: flex;
  align-items: center;
}

.ci-box-slot.accepted { border-left: 3px solid rgba(0, 229, 192, 0.7); }
.ci-box-slot.pending { border-left: 3px solid rgba(250, 204, 21, 0.5); }

.ci-box-slot-empty { color: #facc15; font-size: 0.68rem; }

.ci-box-slot-link {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  color: #e2e8f0;
  text-decoration: none;
  text-align: left;
  width: 100%;
}

.ci-box-slot-link:hover .ci-box-slot-title { text-decoration: underline; }
.ci-box-slot-link:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }

/* Visual truncation only: the accessible name on the link keeps the full
   title, and the detail panel keeps the excerpt. */
.ci-box-slot-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  line-height: 1.25;
}

.ci-box-slot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.62rem;
  color: #8794ad;
}

.ci-box-slot-cite { font-size: 0.6rem; }

.ci-box-slot-domain,
.ci-box-slot-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 7.5rem;
}

.ci-box-context { color: #a78bfa; padding: 0.1rem 0.2rem; }

/* Why an incomplete box is still short — awaiting review, a provider outcome,
   or never collected. Rendered only when the server could say. */
.ci-box-gap { color: #fbbf24; padding: 0.1rem 0.2rem; }

/* Partial-acquisition banners on the report page: the PARTIAL digest notice
   and the analyst-override notice. Deliberately louder than the digest note. */
.ci-partial-notice { background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.45); color: #fcd34d; }
.ci-badge-override { background: rgba(251, 191, 36, 0.2); color: #fcd34d; }

.ci-box-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ci-box-item:last-child { border-bottom: 0; }

.ci-legacy-plan-notice {
  border-left: 3px solid #facc15;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .ci-board-row { grid-template-columns: 1fr; }
  .ci-board-category { padding-top: 0; }
}

/* Report */
.ci-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.75rem;
}

.ci-report-section { border: 1px solid rgba(255, 255, 255, 0.06); }

.ci-timeline { list-style: none; padding-left: 0; }

.ci-timeline li {
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 2px solid rgba(56, 189, 248, 0.35);
  margin-bottom: 0.15rem;
}

/* ── The ASCOPE/PMESII matrix ──
   A real 6 x 6 grid. It must LOOK like the doctrinal matrix at every width, so
   it is never collapsed into two unrelated lists: narrow screens scroll it
   horizontally inside its own container while the row and column headers stay
   stuck to the edges, and cell identity survives the scroll. */

.ci-matrix-scroll {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  /* The grid is the wide thing on the page; the page itself never scrolls
     sideways because of it. */
  -webkit-overflow-scrolling: touch;
}

.ci-matrix-scroll:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.8);
  outline-offset: -2px;
}

.ci-matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  /* 6 columns of ~15rem plus the row header. Below this the container scrolls
     rather than the cells becoming unreadably narrow. */
  min-width: 96rem;
  width: 100%;
}

.ci-matrix-table th,
.ci-matrix-table td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem;
  vertical-align: top;
  /* Never smaller than this: a 6x6 grid squeezed to unreadable type is not a
     usable matrix, and 200% zoom must stay workable. */
  font-size: 0.78rem;
}

.ci-matrix-corner,
.ci-matrix-colhead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #171a2b;
  text-align: left;
  font-weight: 600;
}

.ci-matrix-rowhead,
.ci-matrix-corner {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #171a2b;
  width: 9rem;
  text-align: left;
}

.ci-matrix-corner { z-index: 4; }

.ci-matrix-code {
  display: inline-block;
  min-width: 1.1rem;
  font-weight: 700;
  color: #7dd3fc;
}

.ci-matrix-axis-label { color: rgba(255, 255, 255, 0.82); }

.ci-matrix-cell {
  width: 15rem;
  background: rgba(255, 255, 255, 0.02);
  /* State is carried by a left bar AND by the words in the header line, never
     by colour alone. */
  border-left-width: 3px;
}

.ci-matrix-ready       { border-left-color: #22c55e; }
.ci-matrix-collected   { border-left-color: #38bdf8; }
.ci-matrix-incomplete  { border-left-color: #facc15; }
.ci-matrix-context-only{ border-left-color: #a78bfa; }
.ci-matrix-empty       { border-left-color: rgba(255, 255, 255, 0.18); }
.ci-matrix-wiki        { outline: 1px dashed rgba(224, 176, 0, 0.7); outline-offset: -3px; }

.ci-matrix-dimmed { opacity: 0.32; }

.ci-matrix-cell-open {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.ci-matrix-cell-open:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.9);
  outline-offset: 2px;
}

.ci-matrix-cell-title {
  display: block;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.ci-matrix-cell-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.62);
}

.ci-matrix-accepted { font-weight: 600; }
.ci-matrix-wiki-flag { color: #e0b000; font-weight: 700; }
/* Pending model suggestions are WORKFLOW information, not readiness: a distinct
   info-blue pill, deliberately unlike the accepted/ready colours, so it never
   reads as a filled slot. */
.ci-matrix-suggested-flag {
  color: #3ba7c4;
  font-weight: 700;
  border: 1px solid rgba(59, 167, 196, 0.5);
  border-radius: 0.5rem;
  padding: 0 0.35rem;
}

.ci-matrix-guidance {
  margin: 0.3rem 0;
  font-size: 0.68rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.48);
}

.ci-matrix-slots {
  list-style: decimal;
  margin: 0.35rem 0 0 1rem;
  padding: 0;
  font-size: 0.7rem;
}

.ci-matrix-slot { margin-bottom: 0.25rem; }

.ci-matrix-slot-empty {
  color: #facc15;
  font-style: italic;
}

.ci-matrix-slot-link {
  background: none;
  border: 0;
  padding: 0;
  color: #7dd3fc;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ci-matrix-slot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  color: rgba(255, 255, 255, 0.52);
}

.ci-matrix-gap {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
}

.ci-matrix-item,
.ci-matrix-suggestion {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ci-matrix-item:last-child { border-bottom: 0; }

/* Evidence-tab assignment chips. A confirmed assignment and a model suggestion
   must never look alike: one is a membership, the other is a proposal. */
.ci-matrix-chip {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  margin: 0 0.2rem 0.2rem 0;
  border-radius: 4px;
  font-size: 0.68rem;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.ci-matrix-chip-suggested {
  background: rgba(250, 204, 21, 0.12);
  border-style: dashed;
  border-color: rgba(250, 204, 21, 0.6);
}

.ci-matrix-unassigned-chip {
  font-size: 0.68rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.5);
}

.ci-matrix-suggest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  margin-top: 0.2rem;
}

.ci-matrix-suggest-rationale { flex-basis: 100%; }

.ci-matrix-assign-table th,
.ci-matrix-assign-table td { font-size: 0.72rem; }

/* Report matrix */
.ci-report-matrix-table .ci-matrix-cell { width: 15rem; }

.ci-report-matrix-assessment {
  margin: 0.25rem 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.78);
}

.ci-report-cell {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
}

.ci-report-cell > summary {
  cursor: pointer;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  /* Still a matrix, just scrolled. Sticky headers keep both identities. */
  .ci-matrix-table { min-width: 78rem; }
  .ci-matrix-cell { width: 12rem; }
}

/* Confidence is its own kind of badge. It used to share the draft-status class,
   which made a report's "Draft — not approved" indistinguishable from 36
   per-cell confidence chips. */
.ci-badge-confidence {
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: rgba(226, 232, 240, 0.9);
}

/* ── Automatic matrix research: provisional placements, bases, AI context ── */

/* A provisional slot is visibly a DRAFT: dashed border, its own label, never
   the filled style — it earns nothing until bulk approval promotes it. */
.ci-matrix-slot.provisional {
  border: 1px dashed rgba(96, 165, 250, 0.55);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  background: rgba(96, 165, 250, 0.07);
}

.ci-provisional-label {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(147, 197, 253, 0.95);
  border: 1px solid rgba(96, 165, 250, 0.5);
  border-radius: 4px;
  padding: 0 0.3rem;
  margin-right: 0.3rem;
}

/* The useful content every populated slot now carries. The link is secondary. */
.ci-matrix-slot-excerpt,
.ci-box-slot-excerpt {
  display: block;
  font-size: 0.72rem;
  color: rgba(226, 232, 240, 0.75);
  margin-top: 0.15rem;
}

.ci-matrix-slot-why,
.ci-box-slot-why {
  display: block;
  font-size: 0.72rem;
  color: rgba(226, 232, 240, 0.9);
  margin-top: 0.15rem;
}

.ci-matrix-slot-why.ci-basis-missing {
  color: rgba(251, 191, 36, 0.9);
}

.ci-matrix-slot-quote {
  display: block;
  font-size: 0.7rem;
  font-style: italic;
  color: rgba(148, 163, 184, 0.95);
  margin-top: 0.1rem;
}

.ci-matrix-slot-source-link {
  font-size: 0.7rem;
}

.ci-basis-confidence {
  font-size: 0.66rem;
  color: rgba(148, 163, 184, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 4px;
  padding: 0 0.25rem;
}

/* The deterministic cell summary, grounded in displayed approved evidence. */
.ci-matrix-cell-summary {
  font-size: 0.72rem;
  color: rgba(226, 232, 240, 0.85);
  margin: 0.3rem 0 0;
}

.ci-matrix-cell-summary-entry {
  display: block;
  margin-top: 0.12rem;
}

.ci-matrix-cell-summary[data-summary-state="mixed"] {
  border-left: 2px solid rgba(96, 165, 250, 0.45);
  padding-left: 0.3rem;
}

/* AI-produced context is STRUCTURALLY separate from evidence: amber, labelled,
   and never shaped like a slot. */
.ci-matrix-ai-context {
  display: block;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
}

.ci-ai-context-label {
  display: inline-block;
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: rgba(252, 211, 77, 0.95);
  margin-right: 0.3rem;
}

.ci-ai-cite {
  background: rgba(251, 191, 36, 0.18);
}

.ci-matrix-ai-summary {
  display: block;
  color: rgba(226, 232, 240, 0.85);
  margin-top: 0.15rem;
}

.ci-matrix-ai-generator {
  display: block;
  color: rgba(252, 211, 77, 0.9);
  margin-top: 0.12rem;
}

.ci-matrix-item-provisional {
  border-left: 2px dashed rgba(96, 165, 250, 0.55);
  padding-left: 0.5rem;
}
