/* Finplan — gaya bersama (landing, masuk, aplikasi, admin, persetujuan). Font sistem: tanpa unduhan font eksternal. */
:root {
  color-scheme: light;
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e3e6eb; --line-2: #d3d8df;
  --brand: #0f766e; --brand-2: #0d9488; --brand-soft: #e6f4f2; --brand-ink: #ffffff;
  --pos: #12813a; --neg: #c2312f; --warn: #a15c00; --info: #1d5fb8;
  --good-bg: #e7f6ec; --bad-bg: #fdeceb; --warn-bg: #fff4e0; --info-bg: #e8f0fb;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --grid: #e9ecf0;
  --st-good: #0ca30c; --st-warn: #fab219; --st-bad: #d03b3b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --r: 12px; --r-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1120; --surface: #121a2b; --surface-2: #19233a; --ink: #e8ecf3; --ink-2: #c3cad6; --muted: #8b97ab; --line: #222d44; --line-2: #2d3a55;
    --brand: #2bb3a3; --brand-2: #3cc7b6; --brand-soft: #0f2e2c; --brand-ink: #04211e;
    --pos: #4ccf7a; --neg: #f07a76; --warn: #f0b252; --info: #7fb0f0;
    --good-bg: #10301d; --bad-bg: #3a1716; --warn-bg: #3a2a0c; --info-bg: #13274a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --grid: #1e2840;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120; --surface: #121a2b; --surface-2: #19233a; --ink: #e8ecf3; --ink-2: #c3cad6; --muted: #8b97ab; --line: #222d44; --line-2: #2d3a55;
  --brand: #2bb3a3; --brand-2: #3cc7b6; --brand-soft: #0f2e2c; --brand-ink: #04211e;
  --pos: #4ccf7a; --neg: #f07a76; --warn: #f0b252; --info: #7fb0f0;
  --good-bg: #10301d; --bad-bg: #3a1716; --warn-bg: #3a2a0c; --info-bg: #13274a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --grid: #1e2840;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 .8em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.hidden, [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- tombol & formulir ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--line)); }
.btn.danger.solid { background: var(--neg); color: #fff; border-color: var(--neg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.sso { width: 100%; background: #0b1530; color: #fff; border-color: #0b1530; min-height: 50px; font-size: 15px; }
.btn.sso img { height: 22px; width: auto; border-radius: 4px; background: #fff; padding: 2px 4px; }
.btn.sso:hover { background: #142252; }
.iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 15px/1.4 var(--font); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 12px; cursor: pointer; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.error { color: var(--neg); font-size: 13px; min-height: 0; margin: 4px 0 0; }
.alert { padding: 10px 14px; border-radius: var(--r-sm); background: var(--bad-bg); color: var(--neg); font-size: 14px; margin: 0 0 14px; }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.good { background: var(--good-bg); color: var(--pos); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 7px 12px; font: 600 13px var(--font); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--brand-soft); color: var(--brand); }

/* ---------- kerangka aplikasi ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); padding: 4px 10px 14px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand .tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav a svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.side .foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.side .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .who span { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot .acts { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.main { min-width: 0; padding: 26px 30px 60px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.mbar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 40; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 280px; max-width: 86vw; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .mbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .mbar .brand { padding: 0; font-size: 16px; }
  .mbar .title { flex: 1; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: 18px 16px 80px; }
  h1 { font-size: 22px; }
}

/* ---------- kartu & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card > header h3 { margin: 0; }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 16px; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.stack > * + * { margin-top: 16px; }

.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: clamp(17px, 0.9vw + 8px, 23px); font-weight: 750; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hero .v { font-size: clamp(18px, 1vw + 9px, 25px); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--pos); }
.badge.bad { background: var(--bad-bg); color: var(--neg); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- daftar & tabel ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li.click { cursor: pointer; border-radius: var(--r-sm); }
.li.click:hover { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; flex: none; }
.tablewrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; flex: 1 1 140px; max-width: 240px; }
.toolbar .spacer { flex: 1; }

/* ---------- progres ---------- */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--s1); }
.bar > i.good { background: var(--st-good); } .bar > i.warn { background: var(--st-warn); } .bar > i.bad { background: var(--st-bad); }
.prog { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prog:last-child { border-bottom: 0; }
.prog .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.prog .top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog .bot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }

/* ---------- grafik ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .zero { stroke: var(--line-2); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12.5px; min-width: 140px; z-index: 5; opacity: 0; transition: opacity .1s; }
.tip.on { opacity: 1; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 84px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.hbar .n { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar .n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .bar { height: 10px; }
.hbar > .num { text-align: right; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 23, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.modal.wide { max-width: 760px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal header h3 { margin: 0; font-size: 17px; }
.modal .body { padding: 10px 18px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; flex-wrap: wrap; }
.modal footer .left { margin-right: auto; }
@media (max-width: 600px) { .overlay { place-items: end center; padding: 0; } .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; opacity: 0; transition: all .2s; z-index: 70; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--neg); color: #fff; }
.topbar { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--brand); z-index: 80; transition: width .3s; }
.topbar.on { width: 70%; } .topbar.done { width: 100%; opacity: 0; transition: width .2s, opacity .3s .2s; }

/* ---------- halaman masuk / persetujuan / landing ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }
.auth h1 { font-size: 24px; }
.auth .sub { color: var(--muted); margin-bottom: 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code-input { font: 700 24px/1 var(--mono); letter-spacing: .4em; text-align: center; }
.consent-app { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); margin-bottom: 16px; }
.consent-app .avatar { background: var(--brand); }
.scope { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.scope:last-child { border-bottom: 0; }
.scope input { margin-top: 2px; }
.mode-float { position: fixed; top: 14px; right: 14px; }

.landing header.top { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: 0 auto; padding: 18px 20px; }
.landing .hero { max-width: 1120px; margin: 0 auto; padding: 48px 20px 30px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.landing .hero h1 { font-size: 44px; letter-spacing: -.03em; line-height: 1.1; }
.landing .hero p.lead { font-size: 18px; color: var(--ink-2); max-width: 560px; }
.landing .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.landing .feats { max-width: 1120px; margin: 0 auto; padding: 20px 20px 60px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.landing .feat svg { width: 26px; height: 26px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.landing .feat p { color: var(--muted); font-size: 14px; margin: 0; }
.landing footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 16px 40px; border-top: 1px solid var(--line); }
.mock { padding: 18px; }
.mock .bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 14px; }
.mock .bars i { flex: 1; border-radius: 4px 4px 0 0; background: var(--s1); }
.mock .bars i:nth-child(even) { background: var(--s2); }
@media (max-width: 860px) { .landing .hero { grid-template-columns: 1fr; padding-top: 24px; } .landing .hero h1 { font-size: 32px; } .landing .feats { grid-template-columns: 1fr; } }

code, .mono { font-family: var(--mono); font-size: 13px; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; font: 12.5px/1.5 var(--mono); white-space: pre; margin: 0 0 12px; }
.copyrow { display: flex; gap: 8px; align-items: center; }
.copyrow input { font-family: var(--mono); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 9px; border-radius: 99px; background: var(--surface-2); font-size: 12px; color: var(--ink-2); }
.amount-in { font-size: 22px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
