/* intelligence — FlatNine theme, dark + light */

:root,
:root[data-theme="dark"] {
    --bg:      #0e0f12;
    --bg-2:    #15171c;
    --fg:      #e8e9ed;
    --muted:   #8a8f99;
    --accent:  #d8a657;
    --red:     #ea6962;
    --green:   #a9b665;
    --yellow:  #d8a657;
    --border:  #2a2d33;
    --card:    #15171c;
    --logo-filter: invert(1) hue-rotate(180deg);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

:root[data-theme="light"] {
    --bg:      #ffffff;
    --bg-2:    #f7f7f8;
    --fg:      #15171c;
    --muted:   #6b7280;
    --accent:  #9b111e;
    --red:     #c0392b;
    --green:   #6b8e23;
    --yellow:  #9b111e;
    --border:  #e5e7eb;
    --card:    #f5f5f6;
    --logo-filter: none;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }
.muted { color: var(--muted); }
code {
    background: var(--card);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

/* Nav */
.nav {
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--fg);
}
.brand-logo {
    height: 22px;
    width: auto;
    display: block;
    filter: var(--logo-filter);
}
.brand-text {
    font-weight: 500;
}
.nav .cats { display: flex; gap: 12px; flex: 1; }
.nav .cats a {
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
}
.nav .cats a:hover { color: var(--fg); }
.nav .cats a.active { color: var(--fg); background: var(--card); }
.nav .cats a.disabled { opacity: 0.4; cursor: not-allowed; }
.nav .cats a.disabled:hover { color: var(--muted); }

/* Regional sub-nav: shown below the main nav when a parent category is active.
   Mirrors .nav exactly (outer padding, gap, link padding, font-size) so the
   invisible brand-placeholder pushes the first link to the same x as the
   main nav's "All". */
.subcats {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding: 6px 24px 12px;
    border-bottom: 1px solid var(--border);
    max-width: 1200px;
    margin: 0 auto;
}
.subcats .brand-placeholder {
    visibility: hidden;
    pointer-events: none;
}
.subcats > a {
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
}
.subcats > a:hover { color: var(--fg); }
.subcats > a.active { color: var(--fg); background: var(--card); }

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.theme-toggle .theme-icon { line-height: 1; }
:root[data-theme="dark"]  .theme-toggle .light-icon { display: none; }
:root[data-theme="light"] .theme-toggle .dark-icon  { display: none; }

main { max-width: 920px; margin: 0 auto; padding: 24px; }

h1, h2, h3 { font-weight: 500; }

/* Filters */
.filters {
    display: flex;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    color: var(--muted);
    flex-wrap: wrap;
    align-items: center;
}
.filters select {
    background: var(--card);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 5px 26px 5px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    /* Strip the native chrome and replace with a tight custom caret */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.filters select:hover { border-color: var(--accent); }
.filters select:focus { outline: none; border-color: var(--accent); }

.empty-state {
    padding: 48px 0;
    text-align: center;
}
.empty-state h2 { margin: 0 0 8px; font-weight: 500; }

/* Claim feed */
.claims { list-style: none; padding: 0; margin: 0; }
.claim {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.claim .sentence {
    font-size: 16px;
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
    color: var(--fg);
}
.claim .meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}
.claim-summary-excerpt {
    margin: 4px 0 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}
.claim .meta .conf { color: var(--fg); font-weight: 700; }

/* Confidence pill colour conveys directional sentiment per the plan:
   tension → red, stabilizing → green, neutral leaves the default fg. */
.conf.tension      { color: var(--red); }
.conf.stabilizing  { color: var(--green); }

/* Anything carrying a tooltip gets a help cursor so the hover affordance
   is discoverable (the meta-line spans, calibration tier badge, sparkline). */
.claim .meta [title],
.meta-large [title],
.sparkline { cursor: help; }

.sentence-large {
    font-size: 22px;
    line-height: 1.4;
    margin: 16px 0 8px;
    font-weight: 500;
}
.meta-large {
    color: var(--muted);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    font-size: 13px;
}
.meta-large .conf { color: var(--fg); font-weight: 700; }

/* About note (homepage) */
.about {
    display: flex;
    gap: 24px;
    align-items: center;
    margin: 64px 0 24px;
    padding: 24px;
    border-top: 1px solid var(--border);
}
.about-photo {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--card);
    filter: grayscale(1);
}
.about-text { flex: 1; }
.about-text p { margin: 0 0 8px; line-height: 1.6; }
.about-text p:last-child { margin-bottom: 0; font-size: 13px; }
.about-text a { color: var(--accent); }
@media (max-width: 600px) {
    .about { flex-direction: column; text-align: center; }
}

/* Footer */
.foot {
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    color: var(--muted);
    font-size: 12px;
    margin-top: 48px;
}

/* Detail pages: claim.php, entity.php */
.block {
    margin: 32px 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.block h3 {
    margin: 0 0 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 500;
}
.entities, .signals, .events {
    list-style: none;
    padding: 0;
    margin: 0;
}
.entities li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.entities li:last-child { border-bottom: 0; }
.entity-link {
    font-weight: 500;
    margin-right: 8px;
}
.signals li {
    display: flex;
    gap: 16px;
    padding: 4px 0;
    align-items: baseline;
}
.signals .key {
    color: var(--muted);
    min-width: 220px;
}
.signals .value { color: var(--fg); }
.events li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.events li:last-child { border-bottom: 0; }
.event-meta { font-size: 12px; margin-bottom: 4px; }
.event-title { color: var(--fg); margin-bottom: 4px; font-weight: 400; }
.event-entities { font-size: 12px; }
.trajectory {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--muted);
}
.trajectory .point {
    background: var(--card);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

/* nav extras */
.nav-link {
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
}
.nav-link:hover { color: var(--fg); }

/* Info icon — same circle as .theme-toggle, just an "i" inside. */
.nav-info {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    font-style: italic;
    font-family: 'Georgia', 'Times New Roman', serif;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.nav-info:hover { color: var(--accent); border-color: var(--accent); }

/* Tools dropdown — built on <details>/<summary> so it works without JS. */
.nav-tools { position: relative; }
.nav-tools summary {
    list-style: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    user-select: none;
}
.nav-tools summary::-webkit-details-marker { display: none; }
.nav-tools summary:hover { color: var(--fg); }
.nav-tools[open] summary { color: var(--fg); background: var(--card); }
.nav-tools-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-tools-menu a {
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
}
.nav-tools-menu a:hover { color: var(--fg); background: var(--bg); }

/* How-it-works page (paper style) */
main.how { max-width: 880px; }
.how-title { font-size: 32px; font-weight: 500; margin: 24px 0 8px; }
.how .lede {
    font-size: 16px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 32px;
    max-width: 720px;
}
.how-section { margin-top: 48px; }
.how-section h2 {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.how-section h3 {
    font-size: 14px;
    font-weight: 500;
    margin: 24px 0 12px;
}
.how-section p { margin: 12px 0; line-height: 1.65; }
.how-section q { font-style: italic; }
.how-list { margin: 12px 0 12px 18px; padding: 0; line-height: 1.7; }
.how-list li { margin-bottom: 8px; }

.toc {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 24px;
    margin: 24px 0 32px;
}
.toc ol {
    margin: 0;
    padding-left: 24px;
    columns: 2;
    column-gap: 32px;
    font-size: 13px;
    line-height: 1.9;
}
.toc a { color: var(--muted); }
.toc a:hover { color: var(--accent); }

.formula {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 20px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
    color: var(--fg);
}
.sample-row {
    font-size: 12px;
    line-height: 1.55;
    margin-top: 4px;
}
.sample-step {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 500;
    margin: 24px 0 6px;
}
.sample-step code { color: var(--accent); }

.patterns-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}
.patterns-table th,
.patterns-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.patterns-table th {
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
}
.patterns-table code {
    color: var(--accent);
    background: transparent;
    padding: 0;
    font-size: 12px;
}
.patterns-table tr:hover td { background: var(--card); }

figure.diagram {
    margin: 24px 0;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}
figure.diagram svg {
    width: 100%;
    height: auto;
    display: block;
    color: var(--fg);
}
figure.diagram figcaption {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: left;
}

/* SVG diagram styling — themed via current colors */
.dia-box rect {
    fill: var(--bg);
    stroke: var(--border);
    stroke-width: 1.5;
}
.dia-box.dia-input rect    { stroke: var(--muted); }
.dia-box.dia-graph rect    { stroke: var(--accent); stroke-width: 2; }
.dia-box.dia-process rect  { stroke: var(--fg); }
.dia-box.dia-llm rect      { stroke: var(--accent); stroke-dasharray: 4 3; }
.dia-box.dia-enrich rect   { stroke: var(--muted); stroke-dasharray: 4 3; }
.dia-box.dia-output rect   { stroke: var(--green); stroke-width: 2; }
.dia-box text {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    fill: var(--fg);
}
.dia-box .dia-strong { font-weight: 500; font-size: 13px; }
.dia-box .dia-sub    { fill: var(--muted); font-size: 11px; }
.dia-arrow line {
    stroke: var(--muted);
    stroke-width: 1.2;
    fill: none;
}
.dia-label {
    fill: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Roboto', sans-serif;
}
.dia-forbidden line {
    stroke: var(--red);
    stroke-width: 1.5;
}
.dia-forbidden-label { fill: var(--red); font-size: 10px; font-weight: 500; }

/* Entity-graph illustration */
.g-edge line { stroke: var(--accent); opacity: 0.6; }
.g-node circle {
    fill: var(--bg);
    stroke: var(--fg);
    stroke-width: 2;
}
.g-node text {
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 500;
    fill: var(--fg);
}
.g-node .g-sub {
    font-size: 10px;
    font-weight: 400;
    fill: var(--muted);
}

/* Calibration curve */
.axis line { stroke: var(--muted); stroke-width: 1; }
.ax-label  { fill: var(--muted); font-size: 11px; font-family: 'Roboto', sans-serif; }
.cal-perfect { stroke: var(--muted); stroke-width: 1; }
.cal-points circle { fill: var(--accent); }
.cal-curve {
    stroke: var(--accent);
    stroke-width: 2;
}
.cal-legend {
    fill: var(--muted);
    font-size: 11px;
    font-family: 'Roboto', sans-serif;
}

/* References list */
.references {
    list-style: decimal inside;
    padding: 0;
    margin: 16px 0 0;
    font-size: 13px;
    line-height: 1.7;
}
.references li {
    padding: 10px 0 10px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
}
.references li em { color: var(--fg); font-style: normal; font-weight: 500; }
.references li a { color: var(--accent); }

/* Homepage feed-level summary */
.feed-summary {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 16px 20px;
    margin: 0 0 20px;
}
.feed-summary p { margin: 0; line-height: 1.6; font-size: 14px; }
.feed-summary-meta { font-size: 11px; margin-top: 10px !important; }

/* Claim detail: AI-written summary block */
.claim-summary {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 18px 22px;
    margin: 16px 0 28px;
}
.claim-summary p { margin: 0 0 12px; line-height: 1.65; font-size: 14px; }
.claim-summary p:last-child { margin-bottom: 0; }
.claim-summary .summary-meta { font-size: 11px; margin-top: 14px; }

/* Sparklines (homepage feed) */
.spark { display: inline-flex; align-items: center; }
.sparkline {
    width: 64px;
    height: 18px;
    overflow: visible;
}
.sparkline polyline {
    stroke: var(--accent);
    stroke-width: 1.4;
    fill: none;
}
.sparkline circle {
    fill: var(--accent);
    stroke: var(--bg);
    stroke-width: 0.5;
}

/* Trajectory chart on claim detail */
.trajectory-chart svg .axis line { stroke: var(--border); stroke-width: 1; }
.trajectory-chart svg .ax-label  { fill: var(--muted); font-size: 11px; font-family: 'Roboto', sans-serif; }

/* Maps */
.map-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--card);
    margin: 16px 0;
}
.map-container { width: 100%; height: 100%; }
.map-meta {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
    z-index: 1;
}
/* MapLibre popup theming */
.maplibregl-popup-content {
    background: var(--bg) !important;
    color: var(--fg) !important;
    border: 1px solid var(--border) !important;
    font-family: inherit !important;
    font-size: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
    padding: 10px 12px !important;
    border-radius: 4px !important;
}
.maplibregl-popup-tip { display: none !important; }
.maplibregl-popup-close-button {
    color: var(--muted) !important;
    font-size: 16px !important;
}
.map-popup-meta { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.map-popup-title { color: var(--fg); margin-bottom: 4px; font-weight: 500; }
.map-popup-ent { color: var(--accent); font-size: 11px; margin-bottom: 4px; }
.map-popup-link { color: var(--accent); font-size: 11px; }

/* Force the MapLibre attribution control to stay minimized (just the ⓘ badge)
   regardless of viewport width. Click the badge to see full attribution. */
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) {
    min-height: 24px;
    padding: 0;
    margin: 6px;
    background-color: rgba(255,255,255,0.85);
}
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner {
    display: none !important;
}

/* Review page */
.review .filters a {
    margin-right: 8px;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--muted);
}
.review .filters a.active { background: var(--card); color: var(--fg); }
.review-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.review-signals { margin-top: 8px; }
.review-signals summary { cursor: pointer; font-size: 12px; }
.review-signals[open] summary { color: var(--accent); }

/* === Entity browser === */
.entities-browse {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}
.entities-header h1 { margin: 0 0 6px; }
.entities-header p { margin: 0 0 16px; }

.entities-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin: 16px 0;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.entities-filters input[type="text"] {
    flex: 1 1 200px;
    min-width: 160px;
    padding: 6px 10px;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
}
.entities-filters select {
    padding: 6px 28px 6px 10px;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.entities-filters button {
    padding: 6px 12px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.entities-view-toggle { margin-left: auto; display: flex; gap: 4px; }
.entities-view-toggle a {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    font-size: 13px;
}
.entities-view-toggle a.active { color: var(--fg); background: var(--bg); border-color: var(--accent); }

.entities-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.entities-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.entities-row:hover { background: var(--bg-2); }
.entities-name {
    font-weight: 500;
    color: var(--fg);
    flex: 0 0 auto;
    min-width: 200px;
}
.entities-type {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--bg-2);
    color: var(--muted);
    border: 1px solid var(--border);
}
.entities-type.type-place     { color: #5d8aa8; border-color: #5d8aa8aa; }
.entities-type.type-person    { color: #9b111e; border-color: #9b111eaa; }
.entities-type.type-org       { color: #c08552; border-color: #c08552aa; }
.entities-type.type-topic     { color: #7ac74f; border-color: #7ac74faa; }
.entities-type.type-indicator { color: #3e9d72; border-color: #3e9d72aa; }
.entities-region { font-size: 11px; text-transform: capitalize; color: var(--muted); }
.entities-flag { font-size: 11px; color: var(--accent); }
.entities-flag.threat-critical { color: #c0392b; }
.entities-flag.threat-high     { color: #e67e22; }
.entities-flag.threat-elevated { color: #b8860b; }
.entities-flag.threat-low      { color: var(--muted); }
.entities-grav, .entities-mom { font-size: 11px; }
.entities-qid { font-size: 11px; color: var(--muted); margin-left: auto; }

/* Graph view — force-graph (vasturiano/force-graph) renders into a
   <canvas> inside .entity-graph and handles its own theme via JS. */
.graph-wrap {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    overflow: hidden;
}
.entity-graph {
    width: 100%;
    height: 720px;
    background: var(--bg);
    cursor: grab;
}
.entity-graph canvas { display: block; }
.graph-legend {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    background: var(--bg-2);
}

@media (max-width: 700px) {
    .entity-graph { height: 480px; }
    .entities-name { min-width: auto; flex: 1 1 100%; }
}

/* === API docs === */
.api-docs { max-width: 900px; }
.api-docs-header h1 { margin: 0 0 8px; }
.api-docs-header p { margin: 0 0 16px; line-height: 1.6; }
.api-docs-conventions { margin: 24px 0 32px; }
.api-docs-conventions h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 8px; }

.api-endpoint {
    margin: 32px 0;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.api-endpoint h3 {
    margin: 0 0 6px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 16px;
    font-weight: 500;
}
.api-endpoint h4 {
    margin: 16px 0 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 500;
}
.api-method        { color: var(--accent); }
.api-sep           { color: var(--muted); margin: 0 4px; }
.api-endpoint-name { color: var(--fg); }
.api-params {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 18px;
    margin: 0;
}
.api-params dt { font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; }
.api-params dd { margin: 0; font-size: 13px; line-height: 1.5; }
.api-example, .api-response {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.5;
}
.api-example code, .api-response code {
    background: transparent;
    padding: 0;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    color: var(--fg);
    white-space: pre;
}
.api-footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); }
.api-footer h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

/* Calibration evidence panel on /claim/<id> */
.calib-evidence { margin: 12px 0 8px; line-height: 1.6; }
.calib-yes { color: var(--green); }
.calib-no  { color: var(--red); }
.calib-markets { margin-top: 8px; }
.calib-markets summary { cursor: pointer; font-size: 13px; }
.calib-markets[open] summary { color: var(--accent); }
.calib-markets ul { list-style: none; padding: 8px 0 0; margin: 0; }
.calib-markets li { padding: 4px 0; font-size: 13px; line-height: 1.55; }
.calib-mkt-outcome {
    display: inline-block;
    min-width: 38px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    margin-right: 8px;
    vertical-align: middle;
}
.calib-mkt-outcome.calib-yes { background: rgba(106,142,35,0.18); color: var(--green); }
.calib-mkt-outcome.calib-no  { background: rgba(192,57,43,0.18); color: var(--red); }
.calib-mkt-q { color: var(--fg); }
