/* =====================================================================
   INSIGHTS pages (Discipleship, Mentoring, Events, Bible Study, Summary)
   Builds on the dashboard styles in app.css.
   ===================================================================== */
.ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.ins-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.ins-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; max-width: 620px; }
.ins-error { border-color: #EF4444; color: #B91C1C; }
.ins-gap { margin-bottom: 20px; }
.panel-sub { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.panel-title .panel-sub { margin-left: 6px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ins-table-wrap { overflow-x: auto; }
.ins-row { cursor: pointer; }
.ins-row:hover td { background: #F8FAFC; }

/* Period filter */
.range-filter { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.range-presets { display: inline-flex; background: #E9EEF5; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.range-presets button { border: none; background: transparent; font: inherit; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.range-presets button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.range-custom { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.range-custom input { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.range-apply { border: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.range-label { font-size: 11px; color: var(--text-soft); font-weight: 600; }

/* KPI cards */
.ins-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.ins-kpi { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.ins-kpi.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ins-kpi.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,.06); border-color: #93C5FD; }
.ins-kpi .kpi-value { font-size: 26px; margin: 4px 0 4px; }
.ins-kpi.good .kpi-value { color: #047857; }
.ins-kpi.bad .kpi-value { color: #B91C1C; }
.ins-kpi.warn .kpi-value { color: #B45309; }
.ins-kpi-go { display: block; margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--accent); opacity: 0; transition: opacity .15s; }
.ins-kpi.clickable:hover .ins-kpi-go { opacity: 1; }

/* Journey funnel */
.journey { display: flex; flex-direction: column; gap: 8px; }
.journey-row { display: grid; grid-template-columns: 150px 1fr 56px 96px; gap: 12px; align-items: center; font: inherit; font-size: 13px; text-align: left; background: transparent; border: none; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.journey-row:hover { background: #F1F5F9; }
.journey-name { font-weight: 600; color: var(--text); }
.journey-track { height: 22px; background: #F1F5F9; border-radius: 6px; overflow: hidden; }
.journey-fill { display: block; height: 100%; border-radius: 6px; transition: width .4s ease; }
.journey-count { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.journey-conv { font-size: 11px; color: var(--text-muted); text-align: right; }

/* Attention list */
.ins-alert { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; background: #F8FAFC; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; margin-bottom: 8px; }
.ins-alert:hover { border-color: #93C5FD; background: #fff; }
.ins-alert .alert-text { flex: 1; font-size: 13px; font-weight: 500; }
.ins-alert-count { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.alert-icon.ok { background: var(--green-soft); color: #047857; }

/* Drill-down (action list) */
.drill-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 300; display: flex; justify-content: flex-end; }
.drill { width: 460px; max-width: 100%; height: 100%; background: #fff; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.2); animation: drill-in .2s ease; }
@keyframes drill-in { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drill-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.drill-title { font-size: 17px; font-weight: 800; }
.drill-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drill-close { border: none; background: #F1F5F9; width: 34px; height: 34px; border-radius: 10px; font-size: 20px; cursor: pointer; }
.drill-list { overflow-y: auto; padding: 8px 12px 24px; }
.drill-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 10px; border-bottom: 1px solid #F1F5F9; color: inherit; }
.drill-row.link:hover { background: #F8FAFC; border-radius: 8px; }
.drill-name { font-weight: 700; }
.drill-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drill-go { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* Leadership summary */
.sum-controls { display: flex; gap: 8px; align-items: center; }
.sum-nav { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 18px; cursor: pointer; }
.sum-nav:disabled { opacity: .4; cursor: default; }
.sum-month { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; }
.sum-print { border: none; background: var(--accent); color: #fff; font-weight: 700; padding: 10px 16px; border-radius: 10px; cursor: pointer; }
.summary-sheet { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 32px 36px; max-width: 1000px; }
.sum-title { display: flex; align-items: center; gap: 20px; border-bottom: 3px solid #036BB5; padding-bottom: 16px; margin-bottom: 20px; }
.sum-logo { height: 54px; width: auto; }
.sum-title h1 { font-size: 22px; font-weight: 800; }
.sum-title p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; margin-bottom: 20px; }
.sum-section h3 { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #036BB5; margin-bottom: 8px; }
.sum-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sum-table th { font-size: 11px; color: var(--text-muted); font-weight: 700; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.sum-table td { padding: 6px; border-bottom: 1px solid #F1F5F9; }
.sum-table small { color: var(--text-soft); }
.sum-diff { font-weight: 700; color: var(--text-muted); }
.sum-diff.up { color: #047857; }
.sum-diff.down { color: #B91C1C; }
.sum-attn { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sum-attn li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #F8FAFC; border-radius: 8px; }
.sum-attn li.warn { background: #FEF3C7; }
.sum-attn li.ok strong { color: #047857; }
.sum-empty { font-size: 13px; color: var(--text-muted); }
.sum-quote { margin: 0 0 10px; padding: 10px 14px; border-left: 3px solid #47A491; background: #F3FAF8; border-radius: 0 8px 8px 0; font-style: italic; font-size: 13px; }
.sum-quote cite { display: block; font-style: normal; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.sum-foot { margin-top: 16px; font-size: 11px; color: var(--text-soft); text-align: right; }

@media print {
    @page { size: A4; margin: 12mm; }
    body { background: #fff !important; }
    .sidebar, .topbar, .hamburger, .sidebar-backdrop, .no-print, #nav-progress, #nav-slow { display: none !important; }
    .app-shell { display: block !important; }
    .content { padding: 0 !important; }
    .summary-sheet { border: none; padding: 0; max-width: none; }
    .sum-section { break-inside: avoid; }
}

/* Responsive */
@media (max-width: 1199px) { .ins-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
    .ins-kpis { grid-template-columns: repeat(2, 1fr); }
    .range-filter { align-items: flex-start; }
    .journey-row { grid-template-columns: 110px 1fr 44px; }
    .journey-conv { display: none; }
    .sum-grid { grid-template-columns: 1fr; }
    .summary-sheet { padding: 20px; }
}
@media (max-width: 600px) {
    .ins-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .ins-kpi .kpi-value { font-size: 22px; }
    .ins-kpi-go { opacity: 1; }
    .drill { width: 100%; }
    .sum-controls { flex-wrap: wrap; }
}
