/* Big4 Bank Radar - CSS ringan (pengganti Tailwind CDN) */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #0f172a;
  --ink2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --soft: #f1f5f9;
  --green: #059669;
  --green-bg: #ecfdf5;
  --green-ink: #065f46;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-ink: #991b1b;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --amber-ink: #92400e;
  --sky: #0369a1;
  --sky-bg: #f0f9ff;
  --sky-ink: #075985;
  --violet-bg: #f5f3ff;
  --violet-ink: #5b21b6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
a { color: var(--sky); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.up { color: var(--green); }
.down { color: var(--red); }
.hide { display: none !important; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-start { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.stack-sm > * + * { margin-top: 6px; }

/* ---------- Header & tab ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-inner { max-width: 1180px; margin: 0 auto; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand h1 { font-size: 17px; }
.brand .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { color: var(--red); font-weight: 700; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  height: 36px; min-width: 36px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.icon-btn:active { background: var(--soft); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  border: 0; background: none; padding: 8px 2px 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11.5px; color: var(--muted); font-weight: 600;
}
.tabs button .ic { font-size: 19px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--ink); }
.tabs button.on .ic { filter: none; opacity: 1; }
@media (min-width: 820px) {
  body { padding-bottom: 24px; }
  .tabs {
    position: sticky; top: 57px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line);
    grid-template-columns: repeat(4, auto); justify-content: center; gap: 4px; background: var(--bg); z-index: 15;
  }
  .tabs button { flex-direction: row; gap: 6px; font-size: 14px; padding: 10px 16px; border-bottom: 2px solid transparent; }
  .tabs button.on { border-bottom-color: var(--ink); }
}

/* ---------- Layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 720px) and (max-width: 1279px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-stats { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .grid-stats { grid-template-columns: repeat(4, 1fr); } }
.section-title { font-size: 16px; font-weight: 800; margin: 18px 2px 8px; }
.section-title:first-child { margin-top: 2px; }

/* ---------- Card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card.buy { border: 2px solid var(--green); }
.card.cicil { background: #fbfdff; border-color: #bae6fd; }
.card.wait { background: #fffdf8; border-color: #fde68a; }
.box { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; background: var(--soft); border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink2); }
.lines > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-top: 1px solid var(--soft); font-size: 13.5px; }
.lines > div:first-child { border-top: 0; }
.lines .k { color: var(--muted); }
.lines .v { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.status { font-size: 18px; font-weight: 900; letter-spacing: .04em; border-radius: 10px; padding: 6px 14px; }
.s-BUY { background: var(--green); color: #fff; }
.s-CICIL { background: var(--sky-bg); color: var(--sky-ink); box-shadow: inset 0 0 0 1px #7dd3fc; }
.s-WAIT { background: var(--amber-bg); color: var(--amber-ink); box-shadow: inset 0 0 0 1px #fcd34d; }
.t-good { background: var(--green-bg); color: var(--green-ink); }
.t-ok { background: var(--sky-bg); color: var(--sky-ink); }
.t-warn { background: var(--amber-bg); color: var(--amber-ink); }
.t-bad { background: var(--red-bg); color: var(--red-ink); }
.t-gray { background: var(--soft); color: var(--ink2); }
.t-solid-red { background: var(--red); color: #fff; }
.lv-good { color: var(--green); }
.lv-ok { color: var(--amber); }
.lv-bad { color: var(--red); }
.lv-na { color: var(--faint); }

.flag { border-radius: 8px; padding: 6px 9px; font-size: 12.5px; font-weight: 600; }
.flag.danger { background: var(--red-bg); color: var(--red-ink); }
.flag.warn { background: var(--amber-bg); color: var(--amber-ink); }
.flag.info { background: var(--soft); color: var(--ink2); }
.tip { background: var(--violet-bg); color: var(--violet-ink); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.note { background: var(--amber-bg); color: var(--amber-ink); border-radius: 12px; padding: 10px 12px; font-size: 13px; }

/* ---------- Stock card ---------- */
.tick { font-size: 22px; font-weight: 900; letter-spacing: -.01em; }
.price { font-size: 19px; font-weight: 800; }
.headline { font-weight: 700; font-size: 14.5px; }
.spark { width: 100%; height: 86px; display: block; }
.legend { display: flex; gap: 4px 8px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 3px; }
details > summary { cursor: pointer; list-style: none; font-size: 13px; font-weight: 700; color: var(--ink2); padding: 6px 0; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--faint); }
details[open] > summary::before { content: "▾ "; }
.cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cell { background: var(--soft); border-radius: 8px; padding: 5px 7px; }
.cell .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cell .v { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.fund-row { padding: 6px 0; border-top: 1px solid var(--soft); }
.fund-row:first-child { border-top: 0; }
.fund-vals { font-size: 12.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.arrow-up::after { content: " ↑"; }
.arrow-down::after { content: " ↓"; }

/* ---------- Market strip ---------- */
.market { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.market .big { font-size: 24px; font-weight: 800; }

/* ---------- Forms ---------- */
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.input, select.input {
  width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.input:focus { outline: 2px solid #94a3b8; outline-offset: 0; }
.btn { border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 700; cursor: pointer; font-size: 14px; }
.btn:active { background: var(--soft); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-dark:active { background: #1e293b; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.form-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } .form-grid.cols-7 { grid-template-columns: repeat(7, 1fr); } }
.seg { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; margin-top: 4px; }
.seg button { border: 0; background: #fff; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.seg button.on-buy { background: var(--green); color: #fff; }
.seg button.on-sell { background: var(--red); color: #fff; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--soft); vertical-align: top; white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 140px; }
.tbl td.r, .tbl th.r { text-align: right; }

/* ---------- Stats ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: 11.5px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11.5px; color: var(--muted); }
.alloc { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--soft); }
.alloc span { display: block; height: 100%; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .card { width: 100%; max-width: 380px; }

/* ---------- Skeleton ---------- */
.skel { height: 300px; border-radius: var(--radius); background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%); background-size: 400% 100%; animation: sh 1.4s ease infinite; }
@keyframes sh { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Report (cetak) ---------- */
#printArea { display: none; }
@media print {
  body.printing { background: #fff; padding: 0; }
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; }
}
.report { font-size: 12.5px; color: #111; }
.report h2 { font-size: 18px; margin: 0 0 2px; }
.report h3 { font-size: 14px; margin: 16px 0 6px; border-bottom: 1px solid #ddd; padding-bottom: 3px; }
.report table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.report th, .report td { border: 1px solid #ddd; padding: 4px 6px; text-align: left; vertical-align: top; }
.report th { background: #f3f4f6; }
.report .muted { color: #555; }
@media (max-width: 520px) { .hide-sm { display: none; } .top-inner { padding: 8px 12px; } }

.newv { background: #fef08a; border-radius: 4px; padding: 0 3px; }
.input.newv { background: #fef9c3; padding: 9px 10px; }
.oldv { color: var(--faint); }
