/* Kalkulator Keuangan — mobile-first, gaya app keuangan (teal + netral sejuk) */
:root {
    --bg: #f3f6f6; --surface: #fff; --text: #0f1f1e; --muted: #5a6b6a; --line: #e2e9e8;
    --primary: #0f766e; --fill: #0d9488; --primary-600: #0f766e; --primary-50: #e6f4f2; --on-primary: #fff;
        --accent: #f59e0b; --danger: #dc2626; --warn: #b45309; --warn-bg: #fef3c7;
    --radius: 20px; --radius-sm: 14px;
    --shadow: none;
    --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a1211; --surface: #121c1b; --text: #e7f1ef; --muted: #8fa3a1; --line: #223130;
        --primary: #14b8a6; --fill: #14b8a6; --primary-600: #2dd4bf; --primary-50: #12302d; --on-primary: #04211e;
        --accent: #fbbf24; --danger: #f87171; --warn: #fbbf24; --warn-bg: #3b2a0a; --shadow: none;
    }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.015em; }
[hidden] { display: none !important; }
.k-container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.k-icon { width: 22px; height: 22px; flex: none; }

/* App bar */
.k-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.k-header__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.k-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.k-brand:hover { text-decoration: none; }
.k-brand__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--fill); color: var(--on-primary); }
.k-brand__mark .k-icon { width: 19px; height: 19px; }
.k-brand__sub { color: var(--muted); font-weight: 500; }
.k-nav { display: none; gap: 4px; }
.k-nav a { color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.k-nav a.is-active { background: var(--primary-50); color: var(--primary); }
.k-nav a:hover { background: var(--primary-50); color: var(--primary); text-decoration: none; }

/* Sidebar (drawer) mobile */
.k-menu-btn { display: grid; place-items: center; width: 40px; height: 40px; margin-right: 4px; margin-left: -8px; border: 0; border-radius: 12px; background: none; color: var(--text); cursor: pointer; }
.k-menu-btn:active { background: var(--primary-50); }
.k-header__start { display: flex; align-items: center; }
.k-drawer-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden; transition: opacity .25s; }
.k-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(82vw, 300px); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); transform: translateX(-100%); visibility: hidden; transition: transform .25s, visibility .25s; padding-bottom: env(safe-area-inset-bottom); }
.k-drawer__head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.k-drawer__close { width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
.k-drawer__nav { display: flex; flex-direction: column; gap: 4px; padding: 12px; overflow-y: auto; }
.k-drawer__nav a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; color: var(--text); font-weight: 600; }
.k-drawer__nav a:hover { text-decoration: none; background: var(--primary-50); }
.k-drawer__nav a.is-active { background: var(--primary-50); color: var(--primary); }
.k-drawer__sep { height: 1px; margin: 8px 0; background: var(--line); }
body.k-drawer-open { overflow: hidden; }
body.k-drawer-open .k-drawer { transform: none; visibility: visible; }
body.k-drawer-open .k-drawer-overlay { opacity: 1; visibility: visible; }

/* Tab bar bawah (mobile) */
.k-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
.k-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.k-tabbar a:hover { text-decoration: none; }
.k-tabbar a.is-active { color: var(--primary); }
.k-tabbar a.is-active .k-icon { stroke-width: 2.2; }

/* Hero beranda */
.k-hero { padding: 28px 0 8px; }
.k-hero__box { padding: 24px 20px; border-radius: 24px; color: var(--on-primary); background: var(--fill); }
.k-hero h1 { font-size: 26px; font-weight: 800; margin: 12px 0 8px; }
.k-hero h1 em { font-style: normal; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.k-lead { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.k-hero .k-lead { color: rgba(255,255,255,.88); margin-bottom: 18px; }
.k-lead--sm { margin: 6px 0 18px; font-size: 14px; }
.k-pill { display: inline-block; padding: 4px 12px; border-radius: 99px; background: rgba(255,255,255,.2); color: inherit; font-size: 12px; font-weight: 600; }
.k-hero .k-btn--primary { background: var(--surface); color: var(--primary); }
.k-hero .k-btn--primary:hover { background: #f0fdfa; }

/* Tombol */
.k-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer; font: inherit; font-weight: 700; min-height: 44px; padding: 10px 18px; border-radius: 14px; transition: background .15s, transform .05s; }
.k-btn:active { transform: scale(.98); }
.k-btn--primary { background: var(--primary); color: var(--on-primary); }
.k-btn--primary:hover { background: var(--primary); text-decoration: none; }
.k-btn--lg { min-height: 50px; padding: 12px 24px; font-size: 16px; }
.k-btn--block { width: 100%; }
.k-btn--ghost { background: var(--primary-50); color: var(--primary); min-height: 36px; padding: 6px 14px; font-size: 13px; }
.k-btn--ghost:hover { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Beranda */
.k-hero__cta { display: flex; flex-wrap: wrap; gap: 10px; }
.k-hero__cta .k-btn { flex: 1 1 140px; }
.k-btn--outline { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7); }
.k-btn--outline:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.k-section { padding: 20px 16px 8px; }
.k-section__title { font-size: 18px; margin-bottom: 12px; }
.k-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.k-card { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.k-card h3 { font-size: 16px; grid-column: 2; }
.k-card p { margin: 2px 0 0; color: var(--muted); font-size: 13px; grid-column: 2; }
.k-card__icon { grid-column: 1; grid-row: 1 / span 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--primary-50); color: var(--primary); }
.k-card__cta { grid-column: 2; color: var(--primary); font-weight: 600; font-size: 13px; margin-top: 6px; }
.k-card--link { transition: transform .15s, border-color .15s; }
.k-card--link:active { transform: scale(.99); }
.k-card--soon { opacity: .65; }
.k-badge { align-self: flex-start; justify-self: start; grid-column: 2; margin-top: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--muted); }
.k-badge--info { margin: 0; background: var(--primary-50); color: var(--primary); }
.k-badge--info:empty { display: none; }
.k-badge--warn { background: var(--warn-bg); color: var(--warn); }
.k-features { display: grid; gap: 10px; }
.k-features div { display: flex; flex-direction: column; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.k-features span { color: var(--muted); font-size: 13px; }

/* Halaman kalkulator */
.k-page { padding-top: 16px; padding-bottom: 32px; }
.k-crumb { font-size: 12px; color: var(--muted); display: flex; gap: 6px; }
.k-title { font-size: 24px; font-weight: 800; margin-top: 6px; }
.k-calc { display: grid; gap: 14px; align-items: start; }
.k-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px; }
.k-field { margin-bottom: 18px; }
.k-field:last-child { margin-bottom: 0; }
.k-field label, .k-label { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.k-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.k-label-row label { margin: 0; }
.k-input-group { display: flex; align-items: stretch; min-height: 52px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.k-input-group:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-50); }
.k-input-group input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; font-weight: 600; padding: 0 14px; }
.k-input-group input:focus { outline: 0; }
.k-input-group__pre, .k-input-group__post { display: grid; place-items: center; padding: 0 14px; color: var(--muted); font-size: 14px; font-weight: 600; }
.k-input-group__pre { padding-right: 0; }
input[type=range] { width: 100%; margin: 12px 0 0; accent-color: var(--primary); height: 28px; }
.k-hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.k-error { color: var(--danger); font-size: 12px; margin: 6px 0 0; }
.k-chips { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.k-chips::-webkit-scrollbar { display: none; }
.k-chip { flex: none; min-height: 36px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); padding: 0 16px; border-radius: 99px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.k-chip.is-active { background: var(--fill); border-color: var(--fill); color: var(--on-primary); }
.k-segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--bg); border-radius: var(--radius-sm); }
.k-segment label { margin: 0; }
.k-segment input { position: absolute; opacity: 0; pointer-events: none; }
.k-segment span { display: grid; place-items: center; min-height: 40px; text-align: center; padding: 4px; font-size: 13px; font-weight: 600; border-radius: 11px; cursor: pointer; color: var(--muted); line-height: 1.2; }
.k-segment input:checked + span { background: var(--surface); color: var(--primary); box-shadow: 0 0 0 1px var(--line); }
.k-segment input:focus-visible + span { outline: 2px solid var(--primary); }
.k-only-mobile { display: inline-flex; margin-top: 18px; }

/* Hasil */
.k-result { display: grid; gap: 12px; }
.k-hero-result { background: var(--fill); color: var(--on-primary); border: 0; display: flex; flex-direction: column; gap: 2px; padding: 20px; }
.k-hero-result__label { font-size: 13px; font-weight: 600; }
.k-hero-result__value { font-size: clamp(28px, 9vw, 38px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.k-hero-result__sub { font-size: 12px; font-weight: 600; }
.k-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.k-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.k-stat span { font-size: 12px; color: var(--muted); }
.k-stat strong { font-size: 15px; overflow-wrap: anywhere; }
.k-split__bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--line); }
.k-split__bar span:first-child { background: var(--primary); transition: width .3s; }
.k-split__bar span:last-child { background: var(--accent); transition: width .3s; }
.k-split__legend { display: flex; justify-content: space-between; font-size: 13px; margin-top: 10px; color: var(--muted); }
.k-split__legend b { color: var(--text); margin-left: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot--p { background: var(--primary); } .dot--i { background: var(--accent); }

/* Tabel */
.k-table-panel { margin-top: 14px; padding: 0; overflow: hidden; }
.k-table-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; }
.k-table-head h2 { font-size: 16px; }
.k-table-wrap { overflow-x: auto; max-height: 480px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.k-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.k-table th, .k-table td { padding: 10px 14px; text-align: right; white-space: nowrap; }
.k-table th:first-child, .k-table td:first-child { text-align: left; }
.k-table thead th { position: sticky; top: 0; background: var(--primary-50); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.k-table tbody tr + tr td { border-top: 1px solid var(--line); }

/* Cara menghitung & FAQ (blok info di bawah kalkulator) */
.k-info { margin: 48px auto 0; max-width: 760px; display: grid; gap: 32px; padding-top: 32px; border-top: 1px dashed var(--line); }
.k-how { background: var(--primary-50); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); border-left: 4px solid var(--fill); border-radius: var(--radius); padding: 20px; }
.k-how__head, .k-faqs__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.k-how__head h2, .k-faqs__head h2 { font-size: 18px; margin: 0; }
.k-how__icon, .k-faqs__icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; }
.k-how__icon { background: var(--fill); color: var(--on-primary); }
.k-faqs__icon { background: var(--surface); border: 1px solid var(--line); color: var(--primary); }
.k-how__body p { margin: 0 0 10px; font-size: 14px; line-height: 1.7; }
.k-how__body p:last-child { margin-bottom: 0; }
.k-info > .k-note { margin: 0; }

/* Teks */
.k-prose { margin: 28px auto 0; max-width: 760px; }
.k-prose h2 { font-size: 18px; margin-bottom: 12px; }
.k-faq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; transition: border-color .15s; }
.k-faq[open] { border-color: var(--primary); }
.k-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; line-height: 1.4; }
.k-faq summary::-webkit-details-marker { display: none; }
.k-faq summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s, border-color .2s; }
.k-faq[open] summary { color: var(--primary); }
.k-faq[open] summary::after { transform: rotate(-135deg); border-color: var(--primary); margin-top: 4px; }
.k-faq p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0; padding: 0 16px 16px; }
.k-note { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* Footer */
.k-footer { border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted); font-size: 12px; }
.k-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }
.k-footer p { margin: 0; }

/* Checkbox */
.k-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; color: var(--text); cursor: pointer; }
.k-check input { width: 22px; height: 22px; accent-color: var(--primary); }

/* Bar hasil menempel (mobile) + tombol bagikan */
.k-sticky-result { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); z-index: 25; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px; border: 0; border-radius: 16px; background: var(--fill); color: var(--on-primary); font: inherit; text-align: left; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.22); }
.k-sticky-result__label { font-size: 12px; font-weight: 600; opacity: .9; }
.k-sticky-result__value { flex: 1; text-align: right; font-size: 18px; font-weight: 800; white-space: nowrap; }
.k-sticky-result__go { font-size: 12px; font-weight: 700; opacity: .9; }
.k-share { align-self: flex-start; margin-top: 12px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 99px; background: rgba(255,255,255,.2); color: inherit; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.k-share:active { background: rgba(255,255,255,.32); }
.k-only-mobile { display: none !important; }
@media (min-width: 860px) { .k-sticky-result { display: none !important; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Tablet & desktop */
@media (min-width: 600px) {
    .k-grid { grid-template-columns: repeat(2, 1fr); }
    .k-card { grid-template-columns: 1fr; row-gap: 6px; padding: 20px; }
    .k-card h3, .k-card p, .k-card__cta, .k-badge { grid-column: 1; }
    .k-card__icon { grid-column: 1; grid-row: auto; margin-bottom: 4px; }
    .k-features { grid-template-columns: repeat(3, 1fr); }
    .k-hero__box { padding: 40px 32px; }
    .k-hero h1 { font-size: 36px; max-width: 20ch; }
    .k-title { font-size: 30px; }
    .k-panel { padding: 22px; }
}
@media (min-width: 860px) {
    body { padding-bottom: 0; font-size: 16px; }
    .k-tabbar { display: none; }
    .k-nav { display: flex; }
    .k-menu-btn, .k-drawer, .k-drawer-overlay { display: none !important; }
    .k-header__inner { height: 64px; }
    .k-grid { grid-template-columns: repeat(3, 1fr); }
    .k-calc { grid-template-columns: 1.05fr 1fr; gap: 20px; }
    .k-result { position: sticky; top: 80px; }
    .k-only-mobile { display: none; }
    .k-hero-result { padding: 24px; }
}
