/* ──────────────────────────────────────────────────────────────────────────────
   Event ROI Reports: shared stylesheet for /roi-reports and the public share
   page /r/{token}. Direction: sleek, minimal, elevated. Navy on white, hairline
   dividers instead of boxed cards, large quiet numerals, no shadows, no
   gradients, no persona colour fills. Size hierarchy does the work colour would.
   Both personas render from these classes; do not add persona-specific colours.
   ────────────────────────────────────────────────────────────────────────────── */

:root {
  --roi-ink: var(--grey-900, #09113B);
  --roi-ink-2: var(--grey-700, #303B5F);
  --roi-muted: var(--n-500, #71717a);
  --roi-faint: var(--n-400, #a1a1aa);
  --roi-hair: var(--n-200, #e4e4e7);
  --roi-hair-soft: var(--n-100, #f4f4f5);
  --roi-surface: #ffffff;
  --roi-pos: #4b7f63;         /* muted green, low saturation */
  --roi-neg: #a95a52;         /* muted red, low saturation */
  --roi-pos-soft: #eef4f0;
  --roi-neg-soft: #f6eeed;
  /* Monochrome chart ramp, navy to grey. Use in order. */
  --roi-ramp-1: #09113B;
  --roi-ramp-2: #303B5F;
  --roi-ramp-3: #5b6480;
  --roi-ramp-4: #8a90a3;
  --roi-ramp-5: #b9bcc8;
  --roi-ramp-6: #dcdee5;
  --roi-display: var(--font-display, 'Clash Grotesk', sans-serif);
  --roi-body: var(--font-body, 'Manrope', sans-serif);
}

/* ── Page frame ─────────────────────────────────────────────────────────────── */
.roi-page { padding: 32px 36px 120px; max-width: 1180px; font-family: var(--roi-body); color: var(--roi-ink); background: transparent; }
.roi-page--event { padding: 28px 28px 120px; max-width: none; }

/* Elevated cards (same treatment as the In-House overview): white, warm hairline border, soft
   navy shadow, hover lift expressed as a deeper shadow only (never a transform). */
.roi-card { background: var(--roi-surface); border: 1px solid #E5E3DD; border-radius: 12px; box-shadow: 0 1px 2px rgba(9, 17, 59, 0.05), 0 6px 18px rgba(9, 17, 59, 0.06); transition: box-shadow 180ms ease; }
.roi-card:hover { box-shadow: 0 2px 4px rgba(9, 17, 59, 0.06), 0 16px 38px rgba(9, 17, 59, 0.10); }
.roi-page-title { font-family: var(--roi-display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; color: var(--roi-ink); }
.roi-page-sub { font-size: 13px; color: var(--roi-muted); margin: 0 0 28px; }

/* Restrained motion: fade and settle only. */
@keyframes roi-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.roi-fade { animation: roi-fade 240ms ease-out both; }
@media (prefers-reduced-motion: reduce) { .roi-fade { animation: none; } }

/* ── Tabs (hairline underline, no pills) ───────────────────────────────────── */
/* Same inner tab strip as the other event pages (Volunteers, Notes, Team): full-width 1px rule,
   padded tabs, 13px medium, grey when idle, 2px navy underline when active. */
.roi-tabs { display: flex; gap: 4px; border-bottom: 1px solid #EDEFF5; margin-bottom: 24px; overflow-x: auto; }
.roi-tab { border: 0; background: transparent; cursor: pointer; padding: 8px 16px; font-family: var(--roi-body); font-size: 13px; font-weight: 500; color: #6B7191; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color 120ms ease, border-color 120ms ease; }
.roi-tab:hover { color: var(--roi-ink); border-bottom-color: #EDEFF5; }
.roi-tab-active, .roi-tab-active:hover { color: var(--roi-ink); border-bottom-color: var(--roi-ink); font-weight: 600; }
.roi-tab:focus-visible, .roi-btn:focus-visible, .roi-toggle:focus-visible, .roi-chip:focus-visible, .roi-link-btn:focus-visible { outline: 2px solid var(--roi-ink); outline-offset: 2px; }

/* ── Toolbar and buttons ───────────────────────────────────────────────────── */
.roi-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 24px; }
.roi-toolbar-spacer { flex: 1; }
.roi-btn { height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--roi-hair); background: var(--roi-surface); color: var(--roi-ink); font-family: var(--roi-body); font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.roi-btn:hover { border-color: var(--roi-ink-2); }
.roi-btn:disabled { opacity: 0.5; cursor: default; }
.roi-btn-primary { background: var(--roi-ink); border-color: var(--roi-ink); color: #fff; }
.roi-btn-primary:hover { background: var(--roi-ink-2); border-color: var(--roi-ink-2); }
.roi-btn-quiet { border-color: transparent; color: var(--roi-muted); }
.roi-btn-quiet:hover { color: var(--roi-ink); border-color: transparent; }
.roi-link-btn { background: none; border: 0; color: var(--roi-ink); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; margin-right: 12px; font-family: var(--roi-body); text-decoration: underline; text-decoration-color: var(--roi-hair); text-underline-offset: 3px; }
.roi-link-btn:hover { text-decoration-color: var(--roi-ink); }
.roi-chips { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.roi-chip { border: 1px solid var(--roi-hair); background: var(--roi-surface); color: var(--roi-muted); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; font-family: var(--roi-body); cursor: pointer; }
.roi-chip-active { color: var(--roi-ink); border-color: var(--roi-ink); }
.roi-select { height: 34px; border-radius: 6px; border: 1px solid var(--roi-hair); background: var(--roi-surface); padding: 0 10px; font-size: 12px; font-family: var(--roi-body); color: var(--roi-ink); max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.roi-toolbar > div { min-width: 0; max-width: 100%; }
.roi-input { height: 36px; border-radius: 6px; border: 1px solid var(--roi-hair); background: var(--roi-surface); padding: 0 10px; font-size: 13px; font-family: var(--roi-body); color: var(--roi-ink); width: 100%; box-sizing: border-box; }
.roi-input:focus, .roi-select:focus { outline: none; border-color: var(--roi-ink); }
.roi-label { display: block; font-size: 11px; font-weight: 600; color: var(--roi-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

/* Segmented toggle (Internal / Client view, Cost center / Revenue). Keyboard reachable. */
.roi-segment { display: inline-flex; border: 1px solid var(--roi-hair); border-radius: 6px; overflow: hidden; }
.roi-toggle { border: 0; background: transparent; padding: 0 12px; height: 32px; font-family: var(--roi-body); font-size: 12px; font-weight: 600; color: var(--roi-muted); cursor: pointer; }
.roi-toggle + .roi-toggle { border-left: 1px solid var(--roi-hair); }
.roi-toggle-active { color: #fff; background: var(--roi-ink); }

/* Menus (download) */
.roi-menu-wrap { position: relative; display: inline-block; }
.roi-menu { position: absolute; top: 40px; right: 0; min-width: 160px; background: var(--roi-surface); border: 1px solid var(--roi-hair); border-radius: 6px; padding: 6px 0; z-index: 20; }
.roi-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 14px; font-family: var(--roi-body); font-size: 12px; font-weight: 500; color: var(--roi-ink); cursor: pointer; }
.roi-menu button:hover { background: var(--roi-hair-soft); }

/* ── Report document ───────────────────────────────────────────────────────── */
.roi-report { max-width: 960px; background: var(--roi-surface); border: 1px solid #E5E3DD; border-radius: 12px; box-shadow: 0 1px 2px rgba(9, 17, 59, 0.05), 0 6px 18px rgba(9, 17, 59, 0.06); padding: 36px 40px 28px; }
.roi-report-head { padding: 8px 0 28px; border-bottom: 1px solid var(--roi-hair); margin-bottom: 8px; }
.roi-eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--roi-muted); margin-bottom: 10px; }
.roi-report-title { font-family: var(--roi-display); font-size: 34px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; margin: 0 0 8px; color: var(--roi-ink); overflow-wrap: anywhere; }
.roi-report-meta { font-size: 13px; color: var(--roi-muted); display: flex; gap: 18px; flex-wrap: wrap; }
.roi-projected { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--roi-muted); }
.roi-projected::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--roi-faint); }

/* One idea per section: a quiet label, generous space, hairline below. */
.roi-section { padding: 32px 0; border-bottom: 1px solid var(--roi-hair); }
.roi-section:last-child { border-bottom: 0; }
.roi-section-title { font-family: var(--roi-body); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--roi-muted); margin: 0 0 18px; }
.roi-section-note { font-size: 12px; color: var(--roi-muted); margin-top: 12px; }

/* Headline KPIs: large quiet numerals, hairline column dividers, no boxes. */
.roi-kpi-row { display: flex; flex-wrap: wrap; row-gap: 28px; overflow: hidden; }
.roi-kpi { position: relative; flex: 1 1 160px; min-width: max-content; padding: 4px 28px 4px 22px; }
.roi-kpi::before { content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 1px; background: var(--roi-hair); }
.roi-kpi-label { font-size: 12px; color: var(--roi-muted); margin-bottom: 8px; }
.roi-kpi-value { font-family: var(--roi-display); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; color: var(--roi-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.roi-kpi-value-sm { font-size: 28px; }
.roi-kpi-caption { font-size: 12px; color: var(--roi-muted); margin-top: 8px; }
.roi-kpi-delta { font-size: 12px; font-weight: 600; margin-top: 8px; }

/* Summary strip (Overview tab): same treatment as KPIs, smaller. */
.roi-summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.roi-summary-card { padding: 18px 20px 16px; background: var(--roi-surface); border: 1px solid #E5E3DD; border-radius: 12px; box-shadow: 0 1px 2px rgba(9, 17, 59, 0.05), 0 6px 18px rgba(9, 17, 59, 0.06); transition: box-shadow 180ms ease; }
.roi-summary-card:hover { box-shadow: 0 2px 4px rgba(9, 17, 59, 0.06), 0 16px 38px rgba(9, 17, 59, 0.10); }
.roi-summary-label { font-size: 12px; color: var(--roi-muted); margin-bottom: 8px; }
.roi-summary-value { font-family: var(--roi-display); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; color: var(--roi-ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roi-summary-sub { font-size: 12px; color: var(--roi-muted); margin-top: 6px; }

/* Deltas and statuses: muted tones, small dot instead of pills where possible. */
.roi-pos { color: var(--roi-pos); }
.roi-neg { color: var(--roi-neg); }
.roi-neutral { color: var(--roi-muted); }
.roi-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--roi-faint); margin-right: 8px; vertical-align: middle; }
.roi-dot-pos { background: var(--roi-pos); }
.roi-dot-neg { background: var(--roi-neg); }
.roi-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--roi-hair); color: var(--roi-muted); background: transparent; white-space: nowrap; }
.roi-pill-pos { color: var(--roi-pos); border-color: var(--roi-pos-soft); background: var(--roi-pos-soft); }
.roi-pill-neg { color: var(--roi-neg); border-color: var(--roi-neg-soft); background: var(--roi-neg-soft); }
.roi-manual-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--roi-muted); border: 1px solid var(--roi-hair); border-radius: 3px; padding: 1px 6px; margin-left: 8px; vertical-align: middle; }

/* Tables: hairline rows, no header background, numerals right-aligned and tabular. */
.roi-table-wrap { overflow-x: auto; background: var(--roi-surface); border: 1px solid #E5E3DD; border-radius: 12px; box-shadow: 0 1px 2px rgba(9, 17, 59, 0.05), 0 6px 18px rgba(9, 17, 59, 0.06); padding: 8px 22px 6px; margin-bottom: 24px; }
.roi-report .roi-table-wrap { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin-bottom: 0; }
.roi-table-wrap .roi-table th { padding-top: 12px; }
.roi-table { width: 100%; border-collapse: collapse; background: transparent; }
.roi-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--roi-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 12px 10px 0; border-bottom: 1px solid var(--roi-hair); white-space: nowrap; background: transparent; }
.roi-table td { padding: 12px 12px 12px 0; font-size: 13px; color: var(--roi-ink); border-bottom: 1px solid var(--roi-hair-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }
.roi-table tr:last-child td { border-bottom: 0; }
.roi-table td.roi-num, .roi-table th.roi-num { text-align: right; padding-right: 0; }
.roi-table td.roi-num:not(:last-child), .roi-table th.roi-num:not(:last-child) { padding-right: 18px; }
.roi-table td.roi-num { font-variant-numeric: tabular-nums; }
.roi-table tr.roi-total td { border-top: 1px solid var(--roi-hair); font-weight: 600; }
.roi-table a { color: var(--roi-ink); font-weight: 600; text-decoration: none; }
.roi-table a:hover { text-decoration: underline; text-underline-offset: 3px; }
.roi-table .roi-sub { display: block; font-size: 11px; color: var(--roi-muted); margin-top: 2px; }

/* Sparse bars: monochrome ramp, label on the data, no gridlines, no legend. */
.roi-bars { display: grid; gap: 10px; }
.roi-bar-row { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; align-items: center; gap: 14px; font-size: 13px; }
.roi-bar-label { color: var(--roi-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roi-bar-track { height: 8px; background: var(--roi-hair-soft); border-radius: 2px; overflow: hidden; }
.roi-bar-fill { height: 100%; background: var(--roi-ramp-1); border-radius: 2px; }
.roi-bar-fill-2 { background: var(--roi-ramp-2); }
.roi-bar-fill-3 { background: var(--roi-ramp-3); }
.roi-bar-fill-4 { background: var(--roi-ramp-4); }
.roi-bar-fill-5 { background: var(--roi-ramp-5); }
.roi-bar-fill-6 { background: var(--roi-ramp-6); }
.roi-bar-value { font-variant-numeric: tabular-nums; color: var(--roi-ink); white-space: nowrap; }

/* Attendance funnel: three quiet numerals with a thin connecting rule. */
.roi-funnel { display: flex; flex-wrap: wrap; row-gap: 22px; overflow: hidden; }
.roi-funnel-step { position: relative; flex: 1 1 140px; min-width: max-content; padding: 0 24px 0 20px; }
.roi-funnel-step::before { content: ""; position: absolute; left: -1px; top: 4px; bottom: 4px; width: 1px; background: var(--roi-hair); }
.roi-funnel-n { font-family: var(--roi-display); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; color: var(--roi-ink); font-variant-numeric: tabular-nums; }
.roi-funnel-l { font-size: 12px; color: var(--roi-muted); margin-top: 8px; }

/* Narrative and flags: plain prose, large leading, a single hairline rule. */
.roi-narrative { font-size: 16px; line-height: 1.65; color: var(--roi-ink); max-width: 720px; margin: 0; }
.roi-flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.roi-flag { font-size: 13px; color: var(--roi-ink-2); display: flex; align-items: flex-start; gap: 10px; }
.roi-flag .roi-dot { margin-top: 6px; flex: none; }
.roi-footnotes { margin-top: 24px; font-size: 11px; color: var(--roi-muted); line-height: 1.6; }
.roi-prepared { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--roi-hair); font-size: 12px; color: var(--roi-muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Empty states inside a section (data missing). */
.roi-empty { font-size: 13px; color: var(--roi-muted); padding: 8px 0; }
.roi-empty a { color: var(--roi-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Inline panels (share, email, manual revenue): hairline framed, no shadow. */
.roi-panel { border: 1px solid #E5E3DD; border-radius: 12px; padding: 20px 22px; background: var(--roi-surface); margin: 0 0 24px; box-shadow: 0 1px 2px rgba(9, 17, 59, 0.05), 0 6px 18px rgba(9, 17, 59, 0.06); }
.roi-panel-title { font-family: var(--roi-display); font-size: 16px; font-weight: 600; margin: 0 0 14px; color: var(--roi-ink); }
.roi-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.roi-row > div { flex: 1; min-width: 160px; }
.roi-modal-backdrop { position: fixed; inset: 0; background: rgba(9, 17, 59, 0.28); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.roi-modal { background: var(--roi-surface); border: 1px solid #E5E3DD; border-radius: 12px; width: 100%; max-width: 520px; padding: 24px 26px; box-shadow: 0 2px 4px rgba(9, 17, 59, 0.06), 0 16px 38px rgba(9, 17, 59, 0.10); }

/* ── Public share page ─────────────────────────────────────────────────────── */
.roi-share-root { min-height: 100vh; background: #F7F6F3; font-family: var(--roi-body); color: var(--roi-ink); }
.roi-share-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--roi-hair); background: var(--roi-surface); }
.roi-share-brand { font-family: var(--roi-display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--roi-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.roi-share-brand img { height: 22px; width: auto; }
.roi-share-body { max-width: 860px; margin: 0 auto; padding: 32px 20px 96px; }
.roi-share-state { min-height: 70vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; }
.roi-share-state h1 { font-family: var(--roi-display); font-size: 28px; font-weight: 600; margin: 0 0 10px; }
.roi-share-state p { font-size: 14px; color: var(--roi-muted); margin: 0; max-width: 420px; }
.roi-share-footer { text-align: center; font-size: 11px; color: var(--roi-faint); padding: 24px; }
.roi-share-footer a { color: var(--roi-ink); font-weight: 700; text-decoration: none; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .roi-page { padding: 20px 16px 96px; }
  .roi-report { padding: 24px 20px 20px; }
  .roi-table-wrap { padding: 4px 14px 2px; }
  .roi-kpi-value { font-size: 30px; }
  .roi-kpi { padding: 4px 20px 4px 16px; }
  .roi-summary-row { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .roi-summary-card:nth-child(2n) { border-right: 0; margin-right: 0; }
  .roi-report-title { font-size: 28px; }
  .roi-bar-row { grid-template-columns: 1fr auto; }
  .roi-bar-label { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .roi-kpi-row, .roi-funnel { display: grid; grid-template-columns: 1fr; row-gap: 18px; }
  .roi-kpi, .roi-funnel-step { padding-left: 0; min-width: 0; }
  .roi-kpi::before, .roi-funnel-step::before { display: none; }
  .roi-select { width: 100%; }
  .roi-kpi-value { font-size: 32px; }
  .roi-tabs { gap: 0; }
}

/* ── Print: matches the PDF layout, reads well in black and white ─────────── */
@media print {
  @page { margin: 16mm; }
  body { background: #fff !important; }
  .roi-no-print, .roi-toolbar, .roi-tabs, .roi-menu, .roi-share-header .roi-btn { display: none !important; }
  .roi-share-body, .roi-page { padding: 0; max-width: none; }
  .roi-section { page-break-inside: avoid; padding: 18px 0; border-bottom: 1px solid #ccc; }
  .roi-report, .roi-card, .roi-summary-card, .roi-table-wrap, .roi-panel { box-shadow: none !important; border: 0 !important; padding: 0 !important; background: #fff !important; }
  .roi-share-root { background: #fff; }
  .roi-kpi-value, .roi-summary-value, .roi-funnel-n, .roi-report-title { color: #000; }
  .roi-table th, .roi-table td { border-color: #ddd; }
  .roi-bar-fill { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .roi-pos, .roi-neg { color: #000; }
  .roi-pos::after { content: " (up)"; }
  .roi-neg::after { content: " (down)"; }
  .roi-pill { border-color: #999; color: #000; background: transparent; }
  a { text-decoration: none; color: inherit; }
}
