/* ===== OPPORTUNITY DOSSIER DASHBOARD =====
   Loaded only on /investments/<slug> pages, on top of portal.css.
   Reuses portal.css design tokens (:root vars, .card, .badge, .kpi-*,
   .stage-*, .bar-*, .data-table, .dec-box, .tl-item). */

/* ----- exec hero banner ----- */
.dossier-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #2563eb 130%);
  color: #fff; border-radius: var(--radius); padding: 26px 30px;
  margin: 14px 0 6px; position: relative; overflow: hidden; box-shadow: var(--shadow-md);
}
.dossier-hero::before {
  content: ""; position: absolute; top: -60%; right: -8%; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(96,165,250,.25) 0%, transparent 70%);
  pointer-events: none;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; position: relative; }
.hero-headline { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.45; max-width: 62ch; }
.hero-flag { flex-shrink: 0; }
.flag-draft { background: rgba(245, 158, 11, .92); color: #1c1917; font-size: 10.5px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.flag-current { background: rgba(5, 150, 105, .92); color: #fff; font-size: 10.5px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.hero-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 16px; position: relative; }
.hero-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; opacity: .6; font-weight: 700; margin-bottom: 4px; }
.hero-line { font-size: 13.5px; line-height: 1.55; opacity: .95; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; position: relative; }
.hero-chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  padding: 4px 13px; border-radius: 999px; font-size: 12px; font-weight: 600; backdrop-filter: blur(4px); }
.hero-chip strong { font-weight: 800; }

/* ----- sticky tab bar ----- */
.dz-tabs {
  position: sticky; top: 66px; z-index: 60; scroll-margin-top: 66px;
  background: rgba(240,242,245,.94); backdrop-filter: blur(8px);
  padding: 9px 0 8px; margin: 12px 0 14px; border-bottom: 1px solid var(--line);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.dz-tab { font: 600 12.5px/1.4 "Segoe UI", system-ui, sans-serif; padding: 6px 14px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; cursor: pointer; transition: all var(--transition); }
.dz-tab:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--info-bg); }
.dz-tab.active { background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.dz-panel { scroll-margin-top: 118px; }
.dz-panel[hidden] { display: none; }

/* ----- sections ----- */
.sec { margin-top: 6px; scroll-margin-top: 118px; }
#panel-overview.sec { margin-top: 0; }
.sec-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--line);
  padding-bottom: 8px; }
.sec-icon { font-size: 19px; }
.sec-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.sec-count { font-size: 11px; font-weight: 700; color: var(--muted); background: #f3f4f6;
  border-radius: 999px; padding: 2px 9px; }
.sec-exec { font-size: 13px; color: var(--muted); margin: 8px 0 16px; max-width: 980px; line-height: 1.6; }

/* ----- overview (exec brief) ----- */
.dec-brief { border-left: 4px solid var(--info); }
.dec-brief.tone-ok { border-left-color: var(--ok); }
.dec-brief.tone-warn { border-left-color: var(--warn); }
.dec-brief.tone-danger { border-left-color: var(--danger); }
.dec-brief-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 10px; }
.badge-lg { font-size: 13px; padding: 6px 16px; }
.ov-gate { font-size: 13.5px; color: var(--ink); display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ov-headline { font-size: 15px; line-height: 1.6; font-weight: 600; max-width: 100ch; margin-bottom: 14px; }
.ov-advisor { font-size: 13px; color: #374151; background: #f9fafb; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 12px; }
.ov-row { display: grid; grid-template-columns: 66px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.ov-row:last-child { border-bottom: 0; }
.ov-text { line-height: 1.5; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kpi-value.kv-sm { font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
@media (max-width: 960px) { .grid-3 { grid-template-columns: 1fr; } }
.rail-link { font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
  transition: all var(--transition); }
.rail-link:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--info-bg); text-decoration: none; }

/* ----- drill-down (details/summary) ----- */
details.dd { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fafbfc;
  margin: 8px 0; transition: border-color var(--transition); }
details.dd:hover { border-color: #cbd5e1; }
details.dd > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 13px;
  list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd > summary::before { content: "▸"; color: var(--muted); font-size: 11px; transition: transform var(--transition); }
details.dd[open] > summary::before { transform: rotate(90deg); }
details.dd[open] > summary { border-bottom: 1px solid var(--line); }
.dd-body { padding: 10px 16px 12px 30px; font-size: 13px; }
.dd-body ul { margin-left: 16px; }
.dd-body li { margin: 4px 0; }
.dd-tag { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ----- placeholder for unfinished content ----- */
.todo-slot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--warn); background: var(--warn-bg); border: 1px dashed #fcd34d; border-radius: 6px;
  padding: 3px 11px; margin: 3px 0; }
.todo-block { border: 1px dashed #fcd34d; background: var(--warn-bg); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 12.5px; color: #92400e; margin-top: 10px; }

/* ----- scope: in / out columns ----- */
.io-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.io-col { border-radius: 10px; border: 1px solid var(--line); padding: 14px 18px; }
.io-col h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.io-in { background: var(--ok-bg); border-color: #a7f3d0; }
.io-in h4 { color: var(--ok); }
.io-out { background: #f8fafc; }
.io-out h4 { color: var(--muted); }
.io-col ul { margin-left: 16px; }
.io-col li { margin: 5px 0; font-size: 13px; }
.constraint-chip { font-size: 12px; background: #f3f4f6; color: var(--ink); border: 1px solid var(--line);
  padding: 4px 12px; border-radius: 999px; display: inline-block; margin: 2px 3px 2px 0; }

/* ----- objectives ----- */
.obj-row { display: grid; grid-template-columns: 62px 1fr auto; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #f3f4f6; align-items: baseline; }
.obj-row:last-child { border-bottom: 0; }
.obj-id { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.obj-text { font-size: 13.5px; }
.obj-measure { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ----- pain points (problem severity bars) ----- */
.pain-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(120px, 220px) 44px;
  gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.pain-row:last-child { border-bottom: 0; }
.pain-track { height: 12px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
.pain-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #fbbf24, #ef4444); }

/* ----- value drivers ----- */
.driver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.driver-card { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  transition: all var(--transition); }
.driver-card:hover { border-color: var(--accent); background: #fff; box-shadow: var(--shadow-sm); }
.driver-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.driver-mag { font-size: 15px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.driver-detail { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ----- cost-benefit comparison ----- */
.cb-headline { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.cb-stat { background: #f9fafb; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 12.5px; }
.cb-stat strong { display: block; font-size: 15px; font-weight: 800; }
.cb-stat.cost strong { color: var(--danger); }
.cb-stat.benefit strong { color: var(--ok); }
.cb-fill-cost { background: linear-gradient(90deg, #f87171, #ef4444); }
.cb-fill-ben { background: linear-gradient(90deg, #34d399, #059669); }

/* ----- development process flow ----- */
.phase-flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; }
.phase-desc { font-size: 12.5px; color: var(--muted); margin: 4px 0 2px; }

/* ----- actualisation roadmap ----- */
.rm-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 6px 0; }
.rm-num { width: 26px; height: 26px; border-radius: 50%; background: #e5e7eb; color: var(--muted);
  font-weight: 800; font-size: 11.5px; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.rm-step.status-done .rm-num { background: var(--ok); color: #fff; }
.rm-step.status-active .rm-num { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-light); }
.rm-step.status-planned .rm-num { background: #e5e7eb; color: var(--muted); }
.rm-title { font-size: 13.5px; font-weight: 600; }
.rm-meta { font-size: 11.5px; color: var(--muted); margin: 1px 0 4px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ----- timeline gantt ----- */
.gantt { margin-top: 8px; }
.gantt-scale { display: grid; grid-template-columns: 170px 1fr; gap: 12px; margin-bottom: 4px; }
.gantt-months { display: flex; font-size: 10px; color: var(--muted); font-weight: 600; }
.gantt-months span { flex: 1; text-align: left; border-left: 1px solid #e5e7eb; padding-left: 4px; }
.gantt-row { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: center; margin: 5px 0; }
.gantt-label { font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: right; }
.gantt-track { position: relative; height: 24px; background: #f3f4f6; border-radius: 6px; }
.gantt-bar { position: absolute; top: 3px; height: 18px; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), #818cf8); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; padding: 0 7px; overflow: hidden; white-space: nowrap; }
.gantt-bar.done { background: linear-gradient(90deg, #34d399, #059669); }
.gantt-bar.current { background: linear-gradient(90deg, #f59e0b, #d97706); }
.gantt-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--danger); opacity: .7; border-radius: 2px; }

/* ----- budget ----- */
.bud-track { position: relative; height: 20px; background: #f3f4f6; border-radius: 6px; overflow: hidden; flex: 1; }
.bud-alloc { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, #bfdbfe, #93c5fd);
  border-radius: 6px 0 0 6px; }
.bud-spent { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, #f59e0b, #d97706); border-radius: 6px; }

/* ----- stakeholders quadrants ----- */
.quad-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.quad { border-radius: 10px; padding: 12px 15px; border: 1px solid var(--line); min-height: 86px; }
.quad h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 7px; color: var(--muted); }
.quad-stake { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.85);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600;
  margin: 2px 3px 2px 0; }
.quad.q-manage { background: var(--info-bg); border-color: #bfdbfe; }
.quad.q-keep { background: var(--ok-bg); border-color: #a7f3d0; }
.quad.q-inform { background: var(--warn-bg); border-color: #fde68a; }
.quad.q-monitor { background: #f8fafc; }
.quad-empty { font-size: 11.5px; color: var(--muted); font-style: italic; }

/* ----- risk heat grid (single aligned grid: axis + 5x5 cells) ----- */
.heat-all { display: grid; grid-template-columns: 26px repeat(5, minmax(60px, 1fr)); gap: 3px; max-width: 620px; }
.heat-all .ax { font-size: 10.5px; font-weight: 700; color: var(--muted); display: flex;
  align-items: center; justify-content: center; }
.heat-cell { border-radius: 5px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 2px; padding: 2px; font-size: 10px; font-weight: 700; min-height: 32px; }
.heat-cell.empty-sev-low { background: #f0fdf4; }
.heat-cell.empty-sev-med { background: #fafff7; }
.heat-cell.empty-sev-high { background: #fffdfa; }
.heat-cell.empty-sev-critical { background: #fffafa; }
.heat-cell.sev-low { background: #d1fae5; color: #065f46; }
.heat-cell.sev-med { background: #fef3c7; color: #92400e; }
.heat-cell.sev-high { background: #fecaca; color: #991b1b; }
.heat-cell.sev-critical { background: #dc2626; color: #fff; }
.heat-chip { background: rgba(255,255,255,.75); border-radius: 4px; padding: 0 4px; line-height: 1.5; }

/* ----- svg flowcharts ----- */
.flow-wrap { overflow-x: auto; background: #f9fafb; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 10px 10px; }
.flow-wrap svg { display: block; margin: 0 auto; min-width: 620px; max-width: 100%; height: auto; }
.flow-wrap text { user-select: none; }
.flow-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px;
  font-size: 11.5px; color: var(--muted); }
.fl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.fl i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.fl-done i { background: #ecfdf5; border: 2px solid #059669; }
.fl-current i { background: #eff6ff; border: 2px solid #2563eb; }
.fl-planned i { background: #f8fafc; border: 2px solid #94a3b8; }
.fl-gate i { background: #fffbeb; border: 2px solid #d97706; transform: rotate(45deg); border-radius: 2px; }
.fl-park i { background: #fffbeb; border: 2px dashed #d97706; }
.fl-kill i { background: #fef2f2; border: 2px dashed #dc2626; }

/* ----- shared tweaks on dossier pages ----- */
.card h3 { font-size: 13.5px; font-weight: 700; color: var(--ink); margin: 16px 0 8px; }
.card > h3:first-of-type { margin-top: 4px; }
.cb-row .bar-label { width: 220px; text-align: right; display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: flex-end; align-items: baseline; }
.cb-row .bar-val { width: auto; min-width: 70px; font-size: 12px; }
.bud-track { margin: 0 12px; }

/* ----- strategic options ----- */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.opt-card { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  border-top: 3px solid var(--line); }
.opt-card.stance-adopted { border-top-color: var(--ok); }
.opt-card.stance-watching { border-top-color: var(--info); }
.opt-card.stance-rejected { border-top-color: var(--danger); }
.opt-card h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.opt-card p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* ----- upside opportunity cards ----- */
.opp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.opp-card { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  position: relative; transition: all var(--transition); }
.opp-card:hover { border-color: var(--accent); background: #fff; }
.opp-card h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 5px; padding-right: 60px; }
.opp-card p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.opp-flag { position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 800;
  letter-spacing: .05em; padding: 2px 8px; border-radius: 5px; text-transform: uppercase; }
.opp-flag.prime { background: var(--ok-bg); color: var(--ok); border: 1px solid #a7f3d0; }
.opp-flag.good { background: var(--info-bg); color: var(--info); border: 1px solid #bfdbfe; }
.opp-flag.later { background: #f3f4f6; color: var(--muted); border: 1px solid var(--line); }

/* ----- assumptions ----- */
.asm-row { display: grid; grid-template-columns: 66px 1fr auto; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid #f3f4f6; align-items: baseline; }
.asm-row:last-child { border-bottom: 0; }
.asm-id { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.asm-text { font-size: 13.5px; }
.asm-validation { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ----- responsive ----- */
@media (max-width: 960px) {
  .hero-cols { grid-template-columns: 1fr; }
  .io-cols { grid-template-columns: 1fr; }
  .quad-wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .dz-tabs { top: 60px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding: 7px 0 6px; }
  .gantt-row, .gantt-scale { grid-template-columns: 100px 1fr; }
  .gantt-label { font-size: 11px; }
  .quad-wrap { grid-template-columns: 1fr; }
  .pain-row { grid-template-columns: 1fr; gap: 4px; }
}
