/* Merck Dashboard v2 (v3.59) — interactive whole-portfolio analytics.
   Brand tokens with fallbacks (MSD teal/navy); reuses app.css variables where present. */
.md2 { padding: 20px 24px 40px; max-width: 1280px; margin: 0 auto; position: relative; }
.md2-loading, .md2-drawer-loading { padding: 40px; text-align: center; color: var(--text-muted, #6b7682); }
.md2-error { padding: 24px; color: var(--text-muted, #6b7682); }
.md2-error-sub { font-size: 12px; opacity: .7; margin-top: 6px; }
.md2-retry { margin-left: 8px; border: 1px solid var(--teal, #00857C); color: var(--teal, #00857C); background: transparent; border-radius: 6px; padding: 3px 10px; cursor: pointer; }

/* tabs */
.md2-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border, #e3e7ea); margin-bottom: 18px; flex-wrap: wrap; }
.md2-tab { background: none; border: none; padding: 10px 16px; font: inherit; font-weight: 600; color: var(--text-muted, #6b7682); cursor: pointer; border-bottom: 2px solid transparent; }
.md2-tab:hover { color: var(--ink, #0C2340); }
.md2-tab.active { color: var(--teal, #00857C); border-bottom-color: var(--teal, #00857C); }
.md2-tab:focus-visible { outline: 2px solid var(--teal, #00857C); outline-offset: 2px; }

.md2-lead { font-size: 14px; color: var(--ink-2, #2a3744); margin-bottom: 16px; line-height: 1.5; }
.md2-sub { font-size: 13px; color: var(--text-muted, #6b7682); margin-bottom: 14px; }

/* KPI strip */
.md2-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 20px; }
.md2-kpi { background: var(--card-bg, #fff); border: 1px solid var(--border, #e3e7ea); border-radius: 12px; padding: 14px; text-align: center; }
.md2-kpi-v { font-family: var(--serif, Georgia, serif); font-size: 24px; font-weight: 700; color: var(--ink, #0C2340); }
.md2-kpi-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #6b7682); margin-top: 4px; }
.md2-kpi-s { font-size: 11px; color: var(--text-muted, #6b7682); opacity: .8; }

/* card grid */
.md2-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.md2-card { background: var(--card-bg, #fff); border: 1px solid var(--border, #e3e7ea); border-radius: 14px; padding: 16px 18px; min-height: 120px; }
.md2-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.md2-card-title { font-size: 13px; font-weight: 700; color: var(--ink, #0C2340); }
.md2-expand { background: none; border: none; cursor: pointer; color: var(--text-muted, #6b7682); font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.md2-expand:hover { background: var(--bg-cream-2, #f2f4f5); color: var(--ink, #0C2340); }
.md2-card.md2-fs { position: fixed; inset: 4vh 4vw; z-index: 1200; overflow: auto; box-shadow: 0 24px 80px rgba(12,35,64,.28); }
.md2-empty { padding: 20px; text-align: center; color: var(--text-muted, #6b7682); font-size: 13px; font-style: italic; }

/* bars */
.md2-bars { display: flex; flex-direction: column; gap: 7px; }
.md2-bar { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 10px; cursor: pointer; border-radius: 6px; padding: 2px 4px; }
.md2-bar:hover { background: var(--bg-cream-2, #f2f4f5); }
.md2-bar:focus-visible { outline: 2px solid var(--teal, #00857C); outline-offset: 1px; }
.md2-bar-l { font-size: 12px; color: var(--ink-2, #2a3744); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md2-bar-track { background: var(--bg-cream-2, #eef1f2); border-radius: 6px; height: 14px; overflow: hidden; }
.md2-bar-fill { height: 100%; background: var(--teal, #00857C); border-radius: 6px; min-width: 2px; }
.md2-bar-n { font-size: 12px; font-weight: 600; text-align: right; color: var(--ink, #0C2340); }

/* donut */
.md2-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.md2-donut { width: 150px; height: 150px; flex: 0 0 auto; }
.md2-wedge { cursor: pointer; transition: opacity .12s; }
.md2-wedge:hover { opacity: .8; }
.md2-donut-c { font-family: var(--serif, Georgia, serif); font-size: 22px; font-weight: 700; fill: var(--ink, #0C2340); }
.md2-donut-s { font-size: 9px; fill: var(--text-muted, #6b7682); text-transform: uppercase; letter-spacing: .06em; }
.md2-legend { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.md2-leg-row { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 6px; border-radius: 6px; font-size: 12px; }
.md2-leg-row:hover { background: var(--bg-cream-2, #f2f4f5); }
.md2-leg-row:focus-visible { outline: 2px solid var(--teal, #00857C); outline-offset: 1px; }
.md2-leg-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.md2-leg-l { flex: 1; color: var(--ink-2, #2a3744); }
.md2-leg-n { font-weight: 600; color: var(--ink, #0C2340); }

.md2-cap-total { font-family: var(--serif, Georgia, serif); font-size: 18px; font-weight: 700; color: var(--ink, #0C2340); margin-bottom: 10px; }
.md2-cap-total span { font-family: inherit; font-size: 12px; font-weight: 400; color: var(--text-muted, #6b7682); }

/* activity rail */
.md2-activity { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.md2-act-row { padding: 6px 8px; border-radius: 6px; cursor: pointer; border-left: 2px solid var(--teal-light, #6ECEB2); }
.md2-act-row:hover { background: var(--bg-cream-2, #f2f4f5); }
.md2-act-row:focus-visible { outline: 2px solid var(--teal, #00857C); }
.md2-act-name { font-size: 12px; font-weight: 600; color: var(--ink, #0C2340); }
.md2-act-meta { font-size: 11px; color: var(--text-muted, #6b7682); }

/* unified pipeline */
.md2-pipe { display: flex; flex-direction: column; gap: 6px; }
.md2-pipe-row { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 10px; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.md2-pipe-row:hover { background: var(--bg-cream-2, #f2f4f5); }
.md2-pipe-row:focus-visible { outline: 2px solid var(--teal, #00857C); }
.md2-pipe-label { font-size: 12px; font-weight: 600; color: var(--ink-2, #2a3744); }
.md2-pipe-bar { display: flex; height: 16px; border-radius: 6px; overflow: hidden; background: var(--bg-cream-2, #eef1f2); }
.md2-pipe-s { background: var(--teal, #00857C); display: inline-block; }
.md2-pipe-i { background: var(--ink, #0C2340); display: inline-block; }
.md2-pipe-n { font-size: 12px; font-weight: 600; text-align: right; }
.md2-pipe-legend { font-size: 11px; color: var(--text-muted, #6b7682); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.md2-pipe-legend .md2-pipe-s, .md2-pipe-legend .md2-pipe-i { width: 10px; height: 10px; border-radius: 3px; }

/* footer */
.md2-footer { margin-top: 22px; font-size: 11px; color: var(--text-muted, #6b7682); text-align: center; letter-spacing: .03em; }

/* drill drawer */
.md2-drawer { position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh; background: var(--card-bg, #fff); border-left: 1px solid var(--border, #e3e7ea); box-shadow: -12px 0 40px rgba(12,35,64,.14); z-index: 1100; display: flex; flex-direction: column; transform: translateX(0); }
.md2-drawer[aria-hidden="true"] { display: none; }
.md2-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border, #e3e7ea); font-weight: 700; color: var(--ink, #0C2340); }
.md2-drawer-body { overflow: auto; padding: 8px 12px; flex: 1; }
.md2-x { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted, #6b7682); padding: 4px 8px; border-radius: 6px; }
.md2-x:hover:not([disabled]) { background: var(--bg-cream-2, #f2f4f5); color: var(--ink, #0C2340); }
.md2-x[disabled] { opacity: .35; cursor: default; }
.md2-drow { padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.md2-drow:hover { background: var(--bg-cream-2, #f2f4f5); border-color: var(--border, #e3e7ea); }
.md2-drow:focus-visible { outline: 2px solid var(--teal, #00857C); }
.md2-drow-name { font-size: 13px; font-weight: 600; color: var(--ink, #0C2340); display: flex; align-items: center; gap: 8px; }
.md2-drow-type { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 8px; font-weight: 700; }
.md2-t-startup { background: var(--teal-light, #6ECEB2); color: var(--teal-dark, #0a5c55); }
.md2-t-idea { background: #d9e0ee; color: var(--ink, #0C2340); }
.md2-drow-meta { font-size: 11px; color: var(--text-muted, #6b7682); margin-top: 2px; }

/* record modal */
.md2-modal { position: fixed; inset: 0; background: rgba(12,35,64,.42); z-index: 1300; display: flex; align-items: center; justify-content: center; padding: 4vh 4vw; }
.md2-modal[aria-hidden="true"] { display: none; }
.md2-modal-card { background: var(--card-bg, #fff); border-radius: 14px; width: 760px; max-width: 100%; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(12,35,64,.32); }
.md2-modal-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border, #e3e7ea); }
.md2-modal-head .md2-x:last-child { margin-left: auto; }
.md2-modal-pos { font-size: 12px; color: var(--text-muted, #6b7682); }
.md2-modal-body { overflow: auto; padding: 16px 20px; }

/* filter bar (Phase 3) */
.md2-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 10px 0 16px; margin-bottom: 6px; border-bottom: 1px solid var(--border, #e3e7ea); }
.md2-f { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted, #6b7682); }
.md2-f select { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border, #e3e7ea); border-radius: 8px; background: var(--card-bg, #fff); color: var(--ink, #0C2340); max-width: 180px; }
.md2-f select:focus-visible { outline: 2px solid var(--teal, #00857C); }
.md2-clearf { align-self: flex-end; background: none; border: 1px solid var(--teal, #00857C); color: var(--teal, #00857C); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.md2-clearf:hover { background: var(--teal, #00857C); color: #fff; }

/* trend line */
.md2-trend { width: 100%; height: auto; }
.md2-trend-lbl { font-size: 9px; fill: var(--text-muted, #6b7682); }
.md2-trend-note { font-size: 11px; color: var(--text-muted, #6b7682); margin-top: 6px; }

/* stacked composition */
.md2-stack { display: flex; height: 26px; border-radius: 8px; overflow: hidden; }
.md2-stack-seg { display: inline-block; cursor: pointer; transition: opacity .12s; min-width: 3px; }
.md2-stack-seg:hover { opacity: .82; }
.md2-stack-seg:focus-visible { outline: 2px solid var(--ink, #0C2340); outline-offset: 1px; }
.md2-stack-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--ink-2, #2a3744); }
.md2-stack-li { display: inline-flex; align-items: center; gap: 5px; }

/* segment compare */
.md2-cmp-toggle { margin-left: 8px; background: none; border: 1px solid var(--teal, #00857C); color: var(--teal, #00857C); border-radius: 8px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.md2-cmp-toggle:hover { background: var(--teal, #00857C); color: #fff; }
.md2-cmp-host { min-height: 80px; }
.md2-cmp-legend { display: flex; gap: 14px; margin-bottom: 10px; font-size: 12px; }
.md2-cmp { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.md2-cmp-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.md2-cmp-bars { display: flex; gap: 3px; align-items: flex-end; height: 64px; }
.md2-cmp-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.md2-cmp-bar span { width: 12px; border-radius: 3px 3px 0 0; min-height: 2px; }
.md2-cmp-bar em { font-size: 9px; font-style: normal; color: var(--text-muted, #6b7682); }
.md2-cmp-label { font-size: 10px; color: var(--ink-2, #2a3744); text-align: center; max-width: 70px; }

/* responsive */
@media (max-width: 900px) {
  .md2-kpis { grid-template-columns: repeat(3, 1fr); }
  .md2-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .md2 { padding: 14px 12px 32px; }
  .md2-kpis { grid-template-columns: repeat(2, 1fr); }
  .md2-bar { grid-template-columns: 96px 1fr 40px; }
  .md2-drawer { width: 100vw; max-width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  .md2-wedge, .md2-bar-fill { transition: none; }
}
