/* ===== Laporan (renderReport) + view Hasil + cetak. Dimuat global dari index.html ===== */
.report { display: flex; flex-direction: column; gap: 20px; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.report h2.rh { font-size: 1.25rem; margin-top: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); letter-spacing: -.015em; scroll-margin-top: 14px; }
.report h2.rh:first-child { margin-top: 0; }
.report h3.rh { font-size: 1.05rem; margin-top: 6px; color: var(--text-2); scroll-margin-top: 14px; }
.report h4.rh { font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; scroll-margin-top: 14px; }
.report .rtext, .acc-body .rtext { color: var(--text-2); margin: 0; line-height: 1.7; max-width: 76ch; font-size: 1rem; }
.report .rtext code, .report .rcall-body code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.rbtn { color: var(--muted); } .rbtn:hover { color: var(--text); }

/* menu popup (Ekspor, tabel, grafik, aksi lain) */
.ex-menu { position: fixed; z-index: 2000; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--border-strong, var(--border)); border-radius: 12px; box-shadow: var(--shadow-3); padding: 6px; animation: pop .14s; }
.ex-menu .ex-it { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; font: inherit; color: var(--text); text-align: left; cursor: pointer; min-height: 40px; }
.ex-menu .ex-it:hover, .ex-menu .ex-it:focus-visible { background: var(--accent-soft); outline: none; }
.ex-menu .ex-it .ex-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-text); flex: none; }
.ex-menu .ex-it b { display: block; font-size: .94rem; font-weight: 600; } .ex-menu .ex-it small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.ex-menu .ex-it.danger b, .ex-menu .ex-it.danger .ex-ic { color: var(--danger); } .ex-menu .ex-it.danger:hover { background: var(--danger-soft); }
.ex-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.ex-menu .ex-cap { padding: 6px 10px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

/* ---- tabel ---- */
.rtable { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.rtable .rt-title { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 18px; font-weight: 650; font-size: 1rem; border-bottom: 1px solid var(--border); min-height: 52px; }
.rtable .rt-scroll { overflow-x: auto; }
.rtable table { border-collapse: collapse; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; font-size: .94rem; }
.rtable th { text-align: left; font-weight: 600; padding: 10px 14px; height: 44px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; color: var(--muted); font-size: .86rem; background: var(--surface-2); }
.rtable th .th-in { display: inline-flex; align-items: center; gap: 6px; }
.rtable th i.info { width: 16px; height: 16px; font-size: .66rem; opacity: .75; } .rtable th:hover i.info, .rtable th i.info:focus { opacity: 1; }
.rtable td { text-align: left; padding: 9px 14px; height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rtable th.n, .rtable td.n { text-align: right; } .rtable th.n .th-in { justify-content: flex-end; }
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.rtable td:first-child { font-weight: 550; }
.rtable td.key { font-weight: 700; background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.rtable td.key.sig { color: var(--ok); background: var(--ok-soft); }
.rtable td.key.ns { color: var(--text); }
.rtable .rt-note { padding: 10px 18px; font-size: .84rem; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.rtable td:first-child, .rtable th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.rtable th:first-child { background: var(--surface-2); }
.rtable tbody tr:hover td:first-child { background: color-mix(in srgb, var(--accent-soft) 100%, var(--surface)); }
.rtable .rt-scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.rtable .rt-scroll:focus-visible { box-shadow: inset var(--ring); }
@supports (animation-timeline: scroll(x)) {
  .rtable { timeline-scope: --rts; }
  .rtable .rt-scroll { scroll-timeline: --rts x; }
  .rtable::after { content: ""; position: absolute; top: 52px; bottom: 0; right: 0; width: 22px; pointer-events: none; opacity: 0; z-index: 2;
    background: linear-gradient(to left, color-mix(in srgb, var(--text) 14%, transparent), transparent); animation: rts-fade linear both; animation-timeline: --rts; }
  @keyframes rts-fade { 0% { opacity: 1; } 96% { opacity: 1; } 100% { opacity: 0; } }
}

/* tombol "⋯" tabel dan "Unduh ▾" grafik: tampil saat hover/fokus (selalu di layar sentuh) */
.rmore { opacity: 0; transition: opacity .12s; color: var(--muted); min-width: 34px; justify-content: center; }
.rmore .dots { font-size: 1.3rem; line-height: 1; letter-spacing: 1px; transform: translateY(-3px); }
.rtable:hover .rmore, .rplot:hover .rmore, .rmore:focus-visible, .rmore[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .rmore { opacity: .85; } }

/* ---- grafik ---- */
.rplot { margin: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--r); padding: 4px 16px 16px; color: #161a20; overflow: hidden; max-width: 100%; min-width: 0; }
.rplot .rp-head { display: flex; align-items: center; gap: 6px; padding: 4px 0 6px; font-weight: 650; font-size: 1rem; min-height: 48px; }
.rplot .rmore { color: #5d6675; } .rplot .rmore:hover { background: #eef1f5; color: #161a20; }
.rplot svg, .rplot img, .rplot canvas { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.rplot-full svg { width: 100%; height: auto; background: #fff; border-radius: 8px; }

/* ---- hitung manual ---- */
.requation { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 18px 8px; overflow-x: auto; max-width: 100%; }
.requation .rq-head { display: flex; align-items: center; gap: 8px; font-family: var(--font); color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; min-height: 28px; }
.requation pre { margin: 0; white-space: pre-wrap; font: inherit; font-size: .92rem; line-height: 1.8; color: var(--text); overflow-wrap: anywhere; }
.requation .rq-foot { display: flex; justify-content: flex-end; font-family: var(--font); margin-top: 4px; }

/* callout (dalam Grafik/ekspor/halaman lain) */
.rcall { position: relative; max-width: 100%; min-width: 0; }
.rcall .rcall-body { line-height: 1.65; overflow-wrap: anywhere; }
.rcall.prom { padding: 14px 18px; } .rcall.prom .rcall-act { position: absolute; top: 8px; right: 8px; opacity: .8; } .rcall.prom:hover .rcall-act { opacity: 1; }
.rcall.report { border: 1px solid var(--border); border-left: 5px solid var(--muted); background: var(--surface); }
.rcall.report .rcall-body { font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; padding-right: 80px; max-width: 78ch; }
.rcall.interpret .rcall-body { max-width: 78ch; }

/* ===== View Hasil ===== */
.out { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: calc(100vh - var(--top-h)); }
.out-nav { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.out-nav-h { padding: 16px 14px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.out-nav-h h3 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.out-nav-h .cnt { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.out-sel { display: none; }
.out-nav-list { overflow-y: auto; padding: 2px 8px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.out-item { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; padding: 9px 12px; border-radius: 9px; border: 0; background: transparent; text-align: left; font: inherit; color: var(--text); cursor: pointer; width: 100%; }
.out-item:hover { background: var(--surface-3); }
.out-item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.out-item .oi-t { font-weight: 600; font-size: .92rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.out-item .oi-s { font-size: .78rem; color: var(--muted); } .out-item .oi-pin { margin-left: 4px; color: var(--warn); }
.out-nav .prune { margin: 0 12px 10px; align-self: flex-start; }
.out-toc { border-top: 1px solid var(--border); padding: 12px 12px 14px; max-height: 42%; overflow-y: auto; }
.out-toc h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; padding-left: 8px; }
.out-toc a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: .88rem; cursor: pointer; }
.out-toc a:hover { background: var(--surface-3); color: var(--accent-text); }
.out-main { overflow-y: auto; min-width: 0; scroll-behavior: smooth; }
.out-main:focus-visible { box-shadow: none; }
.out-wrap { max-width: 960px; margin: 0 auto; padding: 36px 40px 100px; display: flex; flex-direction: column; gap: 24px; }

.out-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.out-head .oh-main { min-width: 0; flex: 1 1 320px; }
.out-head h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.out-head .sub { color: var(--muted); font-size: .9rem; display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.out-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.out-actions .btn.sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.more-btn .dots { font-size: 1.5rem; line-height: 1; transform: translateY(-4px); letter-spacing: 1px; }
.more-btn { border: 1px solid var(--border); background: var(--surface); }

/* kartu kesimpulan */
.concl { border: 1px solid var(--border); border-left: 6px solid var(--muted); background: var(--surface); border-radius: var(--r-lg); padding: 24px 28px 22px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 12px; }
.concl.ok { border-left-color: var(--ok); } .concl.none { border-left-color: var(--faint); } .concl.neutral { border-left-color: var(--accent); }
.concl-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; padding: 4px 12px 4px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.concl.ok .concl-badge { background: var(--ok-soft); color: var(--ok); } .concl.neutral .concl-badge { background: var(--accent-soft); color: var(--accent-text); }
.concl-head { font-size: 1.65rem; line-height: 1.25; letter-spacing: -.02em; }
.concl-plain { margin: 0; font-size: 1.06rem; line-height: 1.65; color: var(--text-2); max-width: 70ch; }
.concl-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.chip-k { display: flex; flex-direction: column; gap: 1px; padding: 8px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.chip-k span { font-size: .75rem; color: var(--muted); } .chip-k b { font-size: 1.02rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chip-k.ok { background: var(--ok-soft); border-color: transparent; } .chip-k.ok b { color: var(--ok); }
.concl-rep { margin-top: 6px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.concl-rep-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.concl-rep-h .btn { text-transform: none; letter-spacing: 0; font-weight: 600; }
.concl-rep p { margin: 6px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.06rem; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }

/* pita peringatan */
.ribbon { display: flex; align-items: center; gap: 12px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--text); border-radius: 12px; padding: 10px 14px; font-size: .92rem; line-height: 1.5; }
.ribbon svg.ic { color: var(--warn); flex: none; width: 20px; height: 20px; } .rib-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rib-go { border: 0; background: none; font: inherit; font-weight: 700; color: var(--accent-text); cursor: pointer; text-decoration: underline; padding: 6px 4px; flex: none; }

/* pilih tingkat rincian */
.out-mode { display: flex; justify-content: center; margin: 6px 0 -4px; }
.out-mode .seg { padding: 4px; border-radius: 12px; }
.out-mode .seg button { padding: 8px 22px; font-size: .95rem; border-radius: 9px; }
.sum-body { display: flex; flex-direction: column; gap: 24px; }
.more-hint { text-align: center; color: var(--muted); font-size: .92rem; margin: 8px 0 0; }
.link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; text-decoration: underline; }

/* akordeon rincian */
.acc { display: flex; flex-direction: column; gap: 12px; }
.acc-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); scroll-margin-top: 16px; }
.acc-sec > summary { display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; list-style: none; font-weight: 650; font-size: 1.05rem; border-radius: var(--r-lg); min-height: 56px; }
.acc-sec > summary::-webkit-details-marker { display: none; }
.acc-sec > summary:hover { background: var(--surface-2); }
.acc-sec > summary > .ic { color: var(--muted); transition: transform .15s; flex: none; } .acc-sec[open] > summary > .ic { transform: rotate(180deg); }
.acc-sec > summary .acc-t { min-width: 0; overflow-wrap: anywhere; }
.acc-no { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-grid; place-items: center; font-size: .85rem; font-weight: 700; flex: none; }
.acc-body { padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.acc-body .rtable { border-radius: 12px; }

.onote { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--r); padding: 12px 16px; position: relative; white-space: pre-wrap; }
.onote .x { position: absolute; top: 4px; right: 4px; }
.onote textarea { width: 100%; background: transparent; border: 0; resize: vertical; min-height: 54px; padding: 0 28px 0 0; font: inherit; color: var(--text); }
.onote textarea:focus { box-shadow: none; }
.out-loading { display: grid; place-items: center; padding: 90px 20px; gap: 14px; text-align: center; color: var(--muted); }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.out-err { border: 1px solid var(--danger); background: var(--danger-soft); border-radius: var(--r-lg); padding: 20px 24px; max-width: 640px; margin: 40px auto; }
.out-err h3 { color: var(--danger); display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.out-err .msg { font-size: 1.02rem; margin-bottom: 4px; white-space: pre-wrap; }
.out-empty { max-width: 460px; margin: 12vh auto 0; text-align: center; padding: 0 16px; }
.out-empty .out-art { margin-bottom: 8px; } .out-empty h2 { font-size: 1.5rem; margin-bottom: 6px; } .out-empty p { line-height: 1.6; }
.out-empty .acts { display: flex; justify-content: center; margin-top: 22px; }
.out.is-empty { grid-template-columns: 1fr; } .out.is-empty .out-nav { display: none; }

@media (max-width: 1199px) { .out-toc { display: none; } .out-wrap { padding: 28px 28px 80px; } }
@media (max-width: 999px) { .out { grid-template-columns: 210px minmax(0, 1fr); } .out-wrap { padding: 24px 20px 70px; } }

@media (max-width: 800px) {
  .out { display: flex; flex-direction: column; grid-template-columns: none; height: auto; min-height: calc(100vh - var(--top-h)); }
  .out-nav { flex: none; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 12px 12px; gap: 8px; }
  .out-nav-h { padding: 12px 0 0; } .out-nav-list { display: none; }
  .out-sel { display: block; width: 100%; min-height: 42px; }
  .out-main { flex: 1; min-height: 0; overflow: visible; }
  .out-wrap { padding: 20px 16px 60px; gap: 20px; }
  .out-head h1 { font-size: 1.4rem; }
  .concl { padding: 18px 16px 16px; border-radius: 14px; } .concl-head { font-size: 1.3rem; } .concl-plain { font-size: 1rem; }
  .concl-rep-h { flex-wrap: wrap; }
  .out-actions { width: 100%; } .out-actions .btn.sm { flex: 1 1 auto; justify-content: center; } .out-actions .more-btn { flex: none; }
  .acc-sec > summary { padding: 14px 14px; } .acc-body { padding: 2px 12px 16px; }
  .rtable th { padding: 8px 12px; } .rtable td { padding: 8px 12px; font-size: .9rem; }
  .rtable td:first-child, .rtable th:first-child { white-space: normal; min-width: 96px; max-width: 150px; }
  .rtable .rt-title { padding-left: 14px; } .rtable .rt-note { padding: 8px 14px; }
  .rtable td:first-child, .rtable th:first-child { box-shadow: 1px 0 0 var(--border), 6px 0 8px -6px rgba(16, 24, 40, .25); }
  .rcall.prom { padding: 12px 14px; } .rcall.prom .rcall-act { position: static; display: inline-flex; margin: 0 0 4px -6px; }
  .rcall.report .rcall-body { padding-right: 0; }
  .requation { padding: 10px 12px 6px; } .requation pre { white-space: pre; overflow-wrap: normal; font-size: .85rem; width: max-content; min-width: 100%; }
  .rplot { padding: 2px 10px 10px; }
  .out-empty { margin-top: 8vh; } .out-err { margin: 20px 14px; padding: 16px; } .out-loading { padding: 60px 16px; }
}

/* ===== Cetak / PDF ===== */
#print-host { display: none; }
@media print {
  body.printing #app, body.printing #modals, body.printing #toasts, body.printing #tip { display: none !important; }
  body.printing #print-host { display: block; }
  body { background: #fff !important; color: #000; overflow: visible !important; }
  #print-host { font-size: 11pt; padding: 0; }
  #print-host .doc-sec { page-break-after: always; margin-bottom: 0; }
  #print-host .doc-sec:last-child { page-break-after: auto; }
  #print-host .doc-meta { color: #555; font-size: 9pt; margin-bottom: 8pt; }
  #print-host .report { gap: 10pt; }
  #print-host .rtable, #print-host .rplot, #print-host .requation, #print-host .callout { break-inside: avoid; box-shadow: none; }
  #print-host .rtable table { font-size: 9.5pt; }
  #print-host .rtable tbody tr:nth-child(even) td { background: #f5f6f8 !important; }
  #print-host .rtable tbody tr:hover td { background: transparent; }
  #print-host .rt-scroll { overflow: visible; }
  #print-host h2.rh, #print-host h3.rh { break-after: avoid; }
  #print-host .callout, #print-host .requation, #print-host .rtable th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-host svg { max-width: 100% !important; height: auto !important; }
  .out { display: block; height: auto; }
  @page { margin: 16mm 14mm; }
}

/* Area cetak/ekspor selalu terang agar hemat tinta */
#print-host, .doc { --bg:#fff; --surface:#fff; --surface-2:#f8f9fb; --surface-3:#eef1f5; --border:#dfe3ea; --border-strong:#c3c9d4; --text:#161a20; --text-2:#444c59; --muted:#6a7382; --faint:#98a0ad;
  --accent:#0f62fe; --accent-soft:#e8f0ff; --accent-text:#0043ce; --ok:#198038; --ok-soft:#e6f5ea; --warn:#8a6100; --warn-soft:#fff6d6; --warn-line:#f1c21b; --info:#0f62fe; --info-soft:#e8f0ff; --tip:#6929c4; --tip-soft:#f1eaff; --danger:#da1e28; --danger-soft:#ffe9ea; color:#161a20; background:#fff; }
