/* ========================================================================
   Authoritarian Interference Tracker — Silver/White Theme
   ======================================================================== */

:root {
  --bg-soft: #f8fafc;
  --text-strong: #3a3f45;       /* Based on ISD Dark Grey */
  --text-muted: #5C6771;        /* ISD Dark Grey */
  --card-radius: .75rem;
  --shadow: 0 2px 16px rgba(0,0,0,.06);
  --border-color: rgba(0,0,0,.08);

  /* ISD Primary */
  --primary-color: #C7074D;    /* ISD Red */
  --secondary-color: #5C6771;  /* ISD Dark Grey */

  /* ISD Secondary palette */
  --accent-blue: #0068B2;      /* ISD Blue */
  --accent-coral: #E76863;     /* ISD Coral */
  --accent-purple: #4C4193;    /* ISD Purple */
  --accent-gray: #B4B2B1;      /* ISD Light Grey */

  /* Derived accents (complement the ISD palette) */
  --accent-orange: #E76863;    /* = Coral */
  --accent-yellow: #D4A843;    /* Warm gold, complements red/coral */
  --accent-green: #3A8A6E;     /* Muted teal-green */
  --accent-teal: #2B7A6B;      /* Deeper teal */
  --accent-lightblue: #5B9FCC; /* Lighter ISD Blue */
  --accent-pink: #D4587A;      /* Softer ISD Red */

  /* Threat actors */
  --ta-russia: #0068B2;        /* ISD Blue */
  --ta-china: #C7074D;         /* ISD Red */
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-soft);
  color: var(--text-strong);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
}

.container { max-width: 1440px; margin: 0 auto; padding: 0 1rem; }

/* ---- Header ---- */
.page-header { padding-top: 1.25rem; padding-bottom: 0.5rem; }
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand h1 {
  margin: 0; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; font-size: clamp(18px, 2.6vw, 28px);
}
.isd-logo-img {
  height: 56px; width: auto; opacity: .85; transition: opacity 150ms;
}
.isd-logo-img:hover { opacity: 1; }
.meta-bar {
  font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: .08em;
  display: flex; gap: .5rem; align-items: center; opacity: .9; margin-top: .25rem;
}
.meta-bar .meta-sep { opacity: .45; }
.meta-bar .meta-link {
  color: inherit; text-decoration: none; border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.meta-bar .meta-link:hover { opacity: 1; border-bottom-color: var(--accent, #0068B2); }
.intro-blurb {
  font-size: 14px; line-height: 1.5; color: #5C6771; margin: .75rem 0 0;
}
.counts-note {
  font-size: 12.5px; line-height: 1.5; color: #6b7780;
  margin: .5rem 0 0;
  padding: .5rem .75rem; border-left: 3px solid #d6dde2;
  background: rgba(0,0,0,.02); border-radius: 3px;
}
.counts-note strong { color: #2c3e50; }
.counts-note em { font-style: italic; color: #2c3e50; }
.info-tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: .35em;
  font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700;
  color: #fff; background: #8a9aa3; border-radius: 50%;
  cursor: help; user-select: none; vertical-align: 1px;
  transition: background .15s ease;
}
.info-tip:hover, .info-tip:focus { background: #0068B2; outline: none; }
.info-tip[data-tip]:hover::after,
.info-tip[data-tip]:focus::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: #fff;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: normal;
  width: 280px;
  text-align: left;
  z-index: 100000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  letter-spacing: 0;
  text-transform: none;
}
.info-tip[data-tip]:hover::before,
.info-tip[data-tip]:focus::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #2c3e50;
  z-index: 100001;
  pointer-events: none;
}

/* ---- Filter bar (sticky) ---- */
.filter-bar-wrap {
  position: sticky; top: 0; z-index: 10000;
  background: rgba(248,250,252,0.97); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: .75rem 0;
}
.filter-bar { display: flex; flex-direction: column; gap: .5rem; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.filter-row--search { position: relative; }
.filter-row--search #search {
  width: 100%; padding: .4rem 2.5rem .4rem .9rem;
  border: 1px solid #ddd; border-radius: .5rem; background: white;
  font-size: .9rem; outline: none; transition: border-color 200ms;
}
.filter-row--search #search:focus { border-color: var(--primary-color); }

.filter-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--text-muted); padding: 4px 8px;
  transition: transform 200ms;
}
.filter-toggle.collapsed { transform: translateY(-50%) rotate(-90deg); }

.filter-collapsible {
  display: flex; flex-direction: column; gap: .5rem;
  overflow: hidden; transition: max-height 300ms ease, opacity 200ms ease;
  max-height: 500px; opacity: 1;
}
.filter-collapsible.collapsed {
  max-height: 0; opacity: 0; pointer-events: none;
}

@media (max-width: 900px) {
  .filter-collapsible { max-height: 0; opacity: 0; pointer-events: none; }
  .filter-collapsible.expanded { max-height: 500px; opacity: 1; pointer-events: auto; }
  .filter-toggle { transform: translateY(-50%) rotate(-90deg); }
  .filter-toggle.expanded { transform: translateY(-50%) rotate(0deg); }
}

.filter-label {
  font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted); margin-right: .25rem;
  white-space: nowrap;
}

/* Pills */
.pill-group { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill {
  padding: .3rem .7rem; border-radius: 4px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 150ms ease; border: 1.5px solid;
  user-select: none; letter-spacing: .02em; background: white;
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 220px;
}
.pill:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.pill.active { color: #fff !important; }

/* Selects and number inputs */
.filter-row--selects { gap: .75rem; align-items: flex-start; }
.filter-field { display: flex; flex-direction: column; gap: .2rem; }
.filter-field--inline { flex-direction: row; align-items: center; gap: .4rem; }
.filter-field select, .filter-field input[type="number"] {
  padding: .35rem .6rem; background: white;
  border: 1px solid #ddd; border-radius: .4rem;
  font-size: .85rem; min-width: 130px; outline: none;
}
.filter-field--inline input[type="number"] { min-width: 70px; width: 70px; }
.filter-field select:focus, .filter-field input[type="number"]:focus {
  border-color: var(--primary-color);
}
.applied { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  background: #fff; border: 1px solid var(--primary-color);
  color: var(--primary-color); padding: .2rem .5rem; border-radius: 4px;
  font-size: 12px; display: inline-flex; align-items: center; gap: .35rem;
}
.chip .x { cursor: pointer; font-weight: 700; }
.btn-clear {
  padding: .3rem .8rem; border: 1px solid #ddd; background: white;
  border-radius: .4rem; cursor: pointer; color: var(--text-muted); font-size: 12px;
}
.btn-clear:hover { border-color: var(--primary-color); color: var(--primary-color); }
.filter-actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; margin-left: auto; }
.btn-export {
  padding: .3rem .7rem; border: 1px solid #ddd; background: white;
  border-radius: .4rem; cursor: pointer; color: var(--text-muted); font-size: 12px;
  text-decoration: none; font-family: 'Space Mono', monospace; letter-spacing: .03em;
  transition: all 150ms;
}
.btn-export:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.btn-jump {
  padding: .3rem .7rem; border: 1px solid var(--primary-color); background: white;
  border-radius: .4rem; cursor: pointer; color: var(--primary-color); font-size: 12px;
  text-decoration: none; font-family: 'Space Mono', monospace; letter-spacing: .03em;
  transition: all 150ms;
}
.btn-jump:hover { background: var(--primary-color); color: white; }

/* ---- Cards ---- */
.card {
  background: #fff; border-radius: var(--card-radius);
  box-shadow: var(--shadow); border: 1px solid var(--border-color);
  position: relative; overflow: hidden;
}
.card-dark { background: #fff; } /* keep white in light theme */
.card-title {
  padding: .75rem 1rem; border-bottom: 1px solid var(--border-color);
  text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
  display: flex; align-items: baseline; gap: .5rem; font-size: .85rem;
}
.card-title .sub { font-size: 11px; opacity: .6; letter-spacing: .08em; }

/* ---- Viz grid ---- */
.viz-grid {
  display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; margin-top: 1rem;
  align-items: stretch;
}
.viz-grid > .card { display: flex; flex-direction: column; }
.viz-grid > .card > div:last-child { flex: 1; }
@media (max-width: 900px) { .viz-grid { grid-template-columns: 1fr; } }
.viz-volume #volume-chart { padding: .75rem; min-height: 300px; flex: 1; }

/* ---- Entity controls ---- */
.ent-controls {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted); font-weight: 400;
}
.ent-controls label { font-weight: 500; }
.ent-controls select {
  padding: 2px 6px; border: 1px solid var(--border-color); border-radius: 4px;
  font-size: 11px; background: #fff; color: var(--text-strong);
}
.ent-controls input[type="range"] { accent-color: var(--primary-color); }
.ent-controls input[type="checkbox"] { accent-color: var(--primary-color); vertical-align: middle; }
#ent-min-val { min-width: 14px; text-align: center; font-weight: 600; font-size: 12px; }

/* ---- Entity network + table ---- */
.entity-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 620px;
  align-items: stretch;
}
#entity-graph, #entity-chord {
  height: 100%; width: 100%;
  min-width: 0;          /* let grid track shrink, never overflow */
  overflow: hidden;
}
.ent-view { width: 100%; }
.ent-view-btn {
  font-family: 'Space Mono', monospace; font-size: 11px;
  padding: 3px 10px; border-radius: 3px; border: 1px solid var(--border-color);
  background: #fff; color: var(--text-muted); cursor: pointer;
  letter-spacing: .04em;
}
.ent-view-btn:hover { color: #0068B2; border-color: #0068B2; }
.ent-view-btn--active {
  background: #2c3e50; color: #fff; border-color: #2c3e50;
}
.ent-view-btn--active:hover { background: #37474F; color: #fff; border-color: #37474F; }

.entity-tbl .ent-co-list { display: flex; flex-wrap: wrap; gap: 3px 5px; }
.entity-tbl .ent-co-pill {
  font-size: 10.5px; padding: 1px 6px; border-radius: 10px;
  background: rgba(0,0,0,.05); color: var(--text-muted);
  white-space: nowrap;
}
.entity-tbl .ent-co-pill strong { color: var(--text-strong); font-weight: 600; }
.entity-tbl .ent-spark { display: block; }
#entity-table-wrap {
  height: 100%;
  width: 100%;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid var(--border-color);
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .entity-layout { grid-template-columns: 1fr; height: auto; }
  #entity-graph, #entity-chord { height: 480px; }
  #entity-table-wrap { border-left: none; border-top: 1px solid var(--border-color); height: 360px; }
}

/* ---- Entity table ---- */
.entity-tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
  table-layout: fixed;  /* fixed widths so cells can't push x-overflow */
}
.entity-tbl col.col-name   { width: 38%; }
.entity-tbl col.col-count  { width: 7%;  }
.entity-tbl col.col-co     { width: 36%; }
.entity-tbl col.col-spark  { width: 19%; }
.entity-tbl td, .entity-tbl th {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.entity-tbl th { position: sticky; top: 0; background: #f0f2f5; padding: 6px 10px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; }
.entity-tbl th:hover { color: var(--text-strong); }
.entity-tbl td { padding: 4px 10px; border-top: 1px solid var(--border-color); }
.entity-tbl tr:hover td { background: rgba(0,0,0,.02); }
.entity-tbl tr.ent-row--selected td { background: rgba(199,7,77,.08); font-weight: 600; }
.entity-tbl .ent-role { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.entity-tbl .ent-role--perpetrator { background: rgba(199,7,77,.12); color: #c7074d; }
.entity-tbl .ent-role--target { background: rgba(0,104,178,.12); color: #0068b2; }
.entity-tbl .ent-role--attributed_group { background: rgba(212,88,122,.12); color: #d4587a; }
.entity-tbl .ent-role--source { background: rgba(92,103,113,.12); color: #5c6771; }
.entity-tbl .ent-role--tool { background: rgba(155,89,182,.12); color: #9b59b6; }
.entity-tbl .ent-type { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; background: rgba(0,0,0,.05); color: var(--text-muted); }
#entity-graph svg .node-label { font-family: 'IBM Plex Sans', sans-serif; font-size: 10px; fill: var(--text-muted); pointer-events: none; }

/* ---- Sankey ---- */
.viz-sankey #sankey-chart { padding: .5rem; overflow: hidden; }

/* ---- Map ---- */
.mapcard { margin-top: 1rem; }
.mapcard #map {
  height: 520px; position: relative; overflow: hidden;
}
#map::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(rgba(0,0,0,.05) 1px, transparent 1px) 0 0 / 80px 80px,
    radial-gradient(rgba(0,0,0,.03) 1px, transparent 1px) 40px 40px / 80px 80px;
}

/* ---- Multilateral breakdown bar (attaches under the map) ---- */
.multilateral-bar {
  /* No top margin -- sits flush against the bottom of #map so the user
     reads it as a continuation of the country chart. */
  border-top: 1px solid rgba(0,0,0,.08);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  background: #fafafa;
  padding: .55rem .75rem .65rem;
}
.multilateral-bar-label {
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: #6b7280; margin-bottom: .35rem;
}
.multilateral-bar-track {
  display: flex; width: 100%; height: 26px;
  border-radius: 4px; overflow: hidden;
  background: #ececec;
}
.multilateral-bar-seg {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 0 .35rem; white-space: nowrap; overflow: hidden;
  min-width: 0;
  transition: filter 150ms;
}
.multilateral-bar-seg:hover { filter: brightness(1.08); }
.multilateral-bar-seg .seg-count { font-variant-numeric: tabular-nums; }
.multilateral-bar-seg .seg-name { margin-left: .3rem; opacity: .85; font-weight: 500; }

/* ---- Stacked bar ---- */
.stacked-section #stackedbar { padding: .75rem; min-height: 300px; }
.sb-seg { cursor: pointer; }
.sb-seg:hover { opacity: .85; }

/* ---- Incident list ---- */
.list-section { margin-top: 1rem; margin-bottom: 2rem; }
.list-section #list { padding: .75rem; }

.incident {
  border: 1px solid #eee; border-radius: .5rem;
  padding: .65rem .75rem; margin-bottom: .6rem; transition: background 150ms;
  position: relative;
}
.incident:hover { background: #f0f4f8; }
.incident .title { font-weight: 600; margin-bottom: .25rem; cursor: pointer; }
.incident .title:hover { color: var(--primary-color); }
.incident .meta {
  font-family: 'Space Mono', monospace; font-size: 12px; opacity: .9;
  display: flex; gap: .75rem; flex-wrap: wrap; color: var(--text-muted);
}
.incident .summary-text {
  font-size: .85rem; color: var(--text-muted); margin-top: .3rem;
  line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }
.tags-row { display: flex; gap: .5rem; align-items: flex-start; justify-content: space-between; margin-top: .35rem; }
.tags-right { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.tag {
  border: 1px solid #ddd; padding: .2rem .45rem; border-radius: 3px;
  font-size: 12px; cursor: pointer; transition: all 150ms ease;
  color: #111; font-weight: 500;
}
.tag:hover { box-shadow: 0 0 0 2px rgba(207,46,46,0.08); border-color: var(--primary-color); transform: translateY(-1px); }
.tag.selected { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.tag-ttp { background: rgba(0,0,0,.03); border-color: #ccc; color: #888; font-size: 10px; font-weight: 500; }
.tag-source { text-decoration: none; color: var(--accent-blue) !important; border-color: rgba(0,104,178,.3); font-size: 11px; }
.tag-source:hover { border-color: var(--accent-blue); }

/* Pill tags on incident cards (actors, tools) — match filter bar style */
.pill-tag {
  font-weight: 600; font-size: 11px; letter-spacing: .02em;
  border-radius: 4px; padding: .2rem .5rem; border-width: 1.5px;
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 180px;
}
.pill-tag:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* Separator between actor > country // type */
.tag-sep {
  font-family: 'Space Mono', monospace; font-size: 16px; font-weight: 700;
  color: #bbb; padding: 0 .15rem; user-select: none; align-self: center;
  line-height: 1;
}

.pager {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .75rem; border-top: 1px solid var(--border-color);
}
.pager button {
  padding: .4rem .75rem; border-radius: .5rem; border: 1px solid #ddd;
  background: white; cursor: pointer;
}
.pager button:hover { border-color: var(--primary-color); color: var(--primary-color); }
#pageinfo { font-family: 'Space Mono', monospace; font-size: 12px; }

/* ---- Incident Detail Modal ("top secret file") ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 20000; display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.incident-modal {
  background: #f5f0e8; max-width: 860px; width: 92%; max-height: 85vh;
  overflow-y: auto; border-radius: 4px; padding: 2.5rem 2rem 2rem;
  position: relative; box-shadow: 0 0 50px rgba(0,0,0,.4);
  font-family: 'IBM Plex Sans', sans-serif; color: #222;
}
.modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  font-size: 1.8rem; color: #666; cursor: pointer; line-height: 1; z-index: 2;
}
.modal-close:hover { color: #222; }
.incident-modal .stamp {
  font-family: 'Space Mono', monospace; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 3px; color: rgba(180,30,30,.4);
  border: 2px solid rgba(180,30,30,.25); display: inline-block;
  padding: .15rem .6rem; border-radius: 2px; margin-bottom: .75rem;
}
.incident-modal .file-header {
  border-bottom: 2px solid #333; padding-bottom: 1rem; margin-bottom: 1.25rem;
}
.incident-modal .file-header h2 {
  margin: 0; font-size: 1.2rem; font-weight: 700; color: #111; line-height: 1.3;
}
.incident-modal .file-header .date-range {
  font-family: 'Space Mono', monospace; font-size: .8rem; color: #666; margin-top: .4rem;
}
.incident-modal .field-label {
  font-family: 'Space Mono', monospace; font-size: .7rem;
  text-transform: uppercase; letter-spacing: 1.5px; color: #888;
  margin-top: 1.2rem; margin-bottom: .2rem;
}
.incident-modal .field-value {
  margin-top: .15rem; font-size: .9rem; line-height: 1.6; color: #333;
}
.incident-modal .field-value a { color: var(--accent-blue); word-break: break-all; }
.incident-modal .modal-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
.incident-modal .modal-tag {
  padding: .25rem .6rem; border-radius: 4px; font-size: .75rem;
  font-weight: 600; border: 1.5px solid #ccc; background: #fff;
}
.incident-modal .modal-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  margin-top: .75rem; padding-top: .75rem; border-top: 1px solid rgba(0,0,0,.06);
}
.incident-modal .modal-row > div { flex: 1; }
.incident-modal .modal-tag--ent-perp { background: rgba(199,7,77,.1); border-color: #c7074d; color: #c7074d; }
.incident-modal .modal-tag--ent-tgt { background: rgba(0,104,178,.1); border-color: #0068b2; color: #0068b2; }
.incident-modal .modal-tag--ent-tool { background: rgba(155,89,182,.1); border-color: #9b59b6; color: #9b59b6; }
.incident-modal .modal-tag--ent-src { background: rgba(92,103,113,.1); border-color: #999; color: #666; }
.incident-modal .modal-tag--ttp { background: rgba(0,0,0,.04); border-color: #ccc; color: #5c6771; font-weight: 500; }
.incident-modal .modal-related:hover { background: rgba(0,0,0,.03); }
.incident-modal .modal-footer {
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #ddd;
  display: flex; justify-content: space-between; align-items: center; font-size: .8rem;
}
.incident-modal .modal-footer a { color: var(--accent-blue); text-decoration: none; }
.incident-modal .btn-copy {
  padding: 3px 10px; border: 1px solid #ccc; border-radius: 4px; background: white;
  cursor: pointer; font-size: 12px; color: var(--text-muted); transition: all 150ms;
}
.incident-modal .btn-copy:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.incident-modal .modal-footer a:hover { text-decoration: underline; }
.incident-modal .modal-source {
  margin-bottom: .3rem; word-break: break-all; font-size: .85rem; line-height: 1.4;
}
.incident-modal .modal-source a {
  color: var(--accent-blue); text-decoration: none;
}
.incident-modal .modal-source a:hover { text-decoration: underline; }
.incident-modal .confidence-bar {
  display: inline-block; width: 80px; height: 8px; background: #ddd;
  border-radius: 4px; overflow: hidden; vertical-align: middle; margin-left: .4rem;
}
.incident-modal .confidence-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-teal));
}

/* ---- Cluster / donut markers ---- */
.lmc-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Space Mono', monospace; font-size: 11px; color: #fff; mix-blend-mode: multiply;
}

/* ---- Chart interactivity ---- */
.axis-click { cursor: pointer; text-decoration: none; }
.axis-click:hover { text-decoration: underline; }
.hm-cell { stroke: rgba(0,0,0,.06); cursor: pointer; }
.hm-cell:hover { filter: brightness(.90); }
#volume-chart .vol-bar { cursor: pointer; transition: opacity 150ms; }
#volume-chart .vol-bar:hover { opacity: .8; }

/* ---- Sankey ---- */
#sankey-chart .sankey-link { fill: none; stroke-opacity: .3; transition: stroke-opacity 150ms; }
#sankey-chart .sankey-link:hover { stroke-opacity: .55; }
#sankey-chart .sankey-node rect { cursor: pointer; transition: opacity 150ms; }
#sankey-chart .sankey-node rect:hover { opacity: .85; }
#sankey-chart .sankey-node text { font-family: 'Space Mono', monospace; font-size: 12px; fill: #222; font-weight: 500; }

/* ---- Admin ---- */
.admin-edit-link {
  text-decoration: none; font-size: 12px; opacity: .35;
  transition: opacity 150ms; position: absolute; top: .4rem; right: .6rem;
}
.admin-edit-link:hover { opacity: .9; }
.admin-footer { margin-top: .5rem; }
.admin-footer a {
  color: var(--text-muted); text-decoration: none; opacity: .4;
  font-size: 11px; transition: opacity 150ms;
}
.admin-footer a:hover { opacity: 1; color: var(--primary-color); }

/* ---- Footer ---- */
.footnote {
  opacity: .7; font-family: 'Space Mono', monospace; font-size: 12px;
  padding: 1.5rem 1rem 2.5rem; text-align: center;
}

.page-footer {
  margin-top: 4rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.footer-inner { display: flex; flex-direction: column; gap: 1.25rem; }
.footer-row {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: .9rem; }
.footer-logo { height: 38px; width: auto; opacity: .85; filter: grayscale(1); }
.footer-tag {
  font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .12em;
  color: var(--text-muted);
}
.footer-cities {
  font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .08em;
  color: var(--text-muted); text-transform: uppercase;
}
.footer-row--mid { border-top: 1px solid #e6ebef; padding-top: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.footer-links a {
  color: #2c3e50; text-decoration: none; font-size: 13px;
  border-bottom: 1px solid transparent; padding-bottom: 1px;
  transition: border-color .15s ease, color .15s ease;
}
.footer-links a:hover { border-bottom-color: #0068B2; color: #0068B2; }
.footer-social { display: flex; align-items: center; gap: .65rem; }
.footer-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  color: #5C6771; background: rgba(0,0,0,.04);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.footer-social a:hover { background: #0068B2; color: #fff; transform: translateY(-1px); }
.footer-row--bottom {
  border-top: 1px solid #e6ebef; padding-top: 1rem;
  font-size: 12px; color: var(--text-muted);
}
.footer-copyright a {
  color: var(--text-muted); text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 1px;
}
.footer-copyright a:hover { color: #0068B2; }
.footer-updated {
  font-family: 'Space Mono', monospace; font-size: 11px;
  letter-spacing: .04em; opacity: .8;
}
@media (max-width: 700px) {
  .footer-row { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .footer-row--bottom { gap: .5rem; }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .filter-row--selects { flex-direction: column; }
  .filter-field { width: 100%; }
  .filter-field select, .filter-field input[type="number"] { width: 100%; }
  .viz-grid { grid-template-columns: 1fr; }
  .mapcard #map { height: 350px; }
}
