/* ============================================================================
 * iv-monitor.css — Project Monitoring Hub (post-funding view)
 *
 * Three-tab dashboard: Verification Ledger / Milestone Tracker / Sovereign
 * Treasury Pipeline. Institutional / Bloomberg feel — deep slate panels,
 * emerald success, amber warnings, narrow data type. Uses iv-tokens.css
 * variables so it inherits theme switches.
 * ========================================================================== */

.iv-mon-page {
  padding-block: 24px 80px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

/* ── Back link ──────────────────────────────────────────────────────────── */
.iv-mon-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--ink-4);
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  font: inherit;
}
.iv-mon-back:hover { color: var(--ink-2); }

/* ── Deal header ────────────────────────────────────────────────────────── */
.iv-mon-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 22px;
  margin-bottom: 22px;
}
.iv-mon-header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}
.iv-mon-header-title {
  font-family: var(--font-display, 'Plus Jakarta Sans');
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-1);
  margin: 8px 0 18px;
  line-height: 1.15;
}
.iv-mon-header-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px 24px;
  align-items: end;
}
.iv-mon-header-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.iv-mon-header-stats span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.iv-mon-header-stats strong {
  font-family: var(--font-display, 'Plus Jakarta Sans');
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}
@media (max-width: 800px) {
  .iv-mon-header-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* ── Tab strip ──────────────────────────────────────────────────────────── */
.iv-mon-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.iv-mon-tabs::-webkit-scrollbar { display: none; }
.iv-mon-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-4);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease;
}
.iv-mon-tab:hover { color: var(--ink-2); }
.iv-mon-tab.active {
  color: var(--ink-1);
  border-bottom-color: var(--primary);
}

/* ── Card chrome ───────────────────────────────────────────────────────── */
.iv-mon-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 18px;
}
.iv-mon-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.iv-mon-card-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}
.iv-mon-card-head .small.mute2 {
  margin: 0;
  font-size: 13px;
  color: var(--ink-4);
  max-width: 580px;
}
.iv-mon-progress-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
}

/* ── Status pills ──────────────────────────────────────────────────────── */
.iv-mon-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.iv-mon-pill.ok      { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.iv-mon-pill.active  { background: var(--info-bg);    color: var(--info);    border-color: var(--info-bd); }
.iv-mon-pill.pending { background: var(--bg-alt);     color: var(--ink-4);   border-color: var(--border); }
.iv-mon-pill.warn    { background: var(--warn-bg);    color: var(--warn);    border-color: var(--warn-bd); }

/* ── Verification ledger ───────────────────────────────────────────────── */
.iv-mon-ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.iv-mon-ledger-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel);
}
.iv-mon-ledger-ico {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--ink-5);
}
.iv-mon-ledger-row.cleared .iv-mon-ledger-ico {
  background: var(--success-bg);
  color: var(--success);
}
.iv-mon-ledger-row.flagged .iv-mon-ledger-ico {
  background: var(--warn-bg);
  color: var(--warn);
}
.iv-mon-ledger-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
}
.iv-mon-ledger-meta {
  font-size: 12px;
  color: var(--ink-4);
  margin-top: 2px;
}
.iv-mon-ledger-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.iv-mon-pdf {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.iv-mon-pdf:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .iv-mon-ledger-row {
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
  }
  .iv-mon-ledger-right { grid-column: 2; }
}

/* ── Phase strip ───────────────────────────────────────────────────────── */
.iv-mon-phases {
  display: grid;
  grid-template-columns: repeat(var(--phases, 4), 1fr);
  gap: 14px;
}
.iv-mon-phase {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  transition: border-color 150ms ease, background 150ms ease;
}
.iv-mon-phase.active {
  background: var(--info-bg);
  border-color: var(--info-bd);
}
.iv-mon-phase.complete {
  background: var(--success-bg);
  border-color: var(--success-bd);
}
.iv-mon-phase-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.iv-mon-phase.complete .iv-mon-phase-num { color: var(--success); }
.iv-mon-phase.active .iv-mon-phase-num   { color: var(--info); }
.iv-mon-phase-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-1);
  margin: 4px 0 10px;
  letter-spacing: -0.005em;
}
.iv-mon-phase-bar {
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.iv-mon-phase-bar > span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 380ms cubic-bezier(.2,.9,.3,1);
}
.iv-mon-phase.complete .iv-mon-phase-bar > span { background: var(--success); }
.iv-mon-phase.active .iv-mon-phase-bar > span   { background: var(--info); }
.iv-mon-phase-pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  margin-top: 6px;
  text-align: right;
}
@media (max-width: 800px) {
  .iv-mon-phases { grid-template-columns: 1fr 1fr; }
}

/* ── Split bar (physical vs capital) ────────────────────────────────────── */
.iv-mon-split {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.iv-mon-split-row {
  display: grid;
  grid-template-columns: 160px 1fr 56px;
  gap: 14px;
  align-items: center;
}
.iv-mon-split-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.iv-mon-split-bar {
  height: 10px;
  background: var(--bg-alt);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.iv-mon-split-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 380ms cubic-bezier(.2,.9,.3,1);
}
.iv-mon-split-bar.physical > span { background: var(--success); }
.iv-mon-split-bar.capital  > span { background: var(--primary); }
.iv-mon-split-pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  text-align: right;
}
.iv-mon-tranche-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.iv-mon-tranche-row > div { display: flex; flex-direction: column; gap: 2px; }
.iv-mon-tranche-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.iv-mon-tranche-row strong {
  font-family: var(--font-display, 'Plus Jakarta Sans');
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-1);
}
@media (max-width: 700px) {
  .iv-mon-split-row { grid-template-columns: 1fr 56px; }
  .iv-mon-split-label { grid-column: 1 / -1; }
}

/* ── Field media grid ──────────────────────────────────────────────────── */
.iv-mon-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.iv-mon-media {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease;
}
.iv-mon-media:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.iv-mon-media-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--ink-1);
  overflow: hidden;
}
.iv-mon-media-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.iv-mon-media-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.65);
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.iv-mon-media figcaption {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.iv-mon-media-kind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
}
.iv-mon-media figcaption strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  line-height: 1.35;
}
.iv-mon-media-meta {
  font-size: 11.5px;
  color: var(--ink-4);
}
.iv-mon-media-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 24px;
  color: var(--ink-4);
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 13px;
}

/* ── Treasury pipeline ─────────────────────────────────────────────────── */
.iv-mon-treasury-card { background: var(--panel); }
.iv-mon-eta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 14px;
  background: var(--primary);
  border-radius: 10px;
  color: #fff;
}
.iv-mon-eta-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}
.iv-mon-eta-val {
  font-family: var(--font-display, 'Plus Jakarta Sans');
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.iv-mon-pipeline {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.iv-mon-pipe-step {
  position: relative;
  flex: 1 1 0;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 8px 4px;
}
.iv-mon-pipe-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-4);
  background: var(--bg-alt);
  border: 2px solid var(--border);
  position: relative;
  z-index: 1;
}
.iv-mon-pipe-step.complete .iv-mon-pipe-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.iv-mon-pipe-step.active .iv-mon-pipe-dot {
  background: var(--info);
  border-color: var(--info);
  color: #fff;
}
.iv-mon-pipe-step.active .iv-mon-pipe-dot::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--info);
  opacity: 0.4;
  animation: ivMonPing 1.6s ease-out infinite;
}
@keyframes ivMonPing {
  0%   { transform: scale(0.85); opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}
.iv-mon-pipe-spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ivMonSpin 0.9s linear infinite;
}
@keyframes ivMonSpin {
  to { transform: rotate(360deg); }
}
.iv-mon-pipe-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
}
.iv-mon-pipe-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-1);
  line-height: 1.25;
}
.iv-mon-pipe-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}
.iv-mon-pipe-conn {
  position: absolute;
  top: 24px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.iv-mon-pipe-conn.complete { background: var(--success); }
.iv-mon-treasury-note {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--info-bg);
  border: 1px solid var(--info-bd);
  border-radius: 10px;
  color: var(--info);
  font-size: 13px;
  line-height: 1.5;
}
.iv-mon-treasury-note strong { color: var(--info); }
@media (max-width: 700px) {
  .iv-mon-pipeline { padding-bottom: 8px; }
}
