:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c232c;
  --border: #26303b;
  --text: #e6edf3;
  --muted: #8b98a5;
  --green: #2ea043;
  --green-bg: rgba(46, 160, 67, 0.15);
  --red: #f85149;
  --red-bg: rgba(248, 81, 73, 0.15);
  --yellow: #d29922;
  --yellow-bg: rgba(210, 153, 34, 0.15);
  --blue: #58a6ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; }
h1 { font-size: 18px; font-weight: 700; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.header-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--muted); font-size: 12px; }
#clock { font-variant-numeric: tabular-nums; }

main { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 240px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 14px;
  overflow-y: auto;
}
.search { display: flex; gap: 6px; margin-bottom: 12px; }
.search input {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  text-transform: uppercase;
}
.search input:focus { outline: none; border-color: var(--blue); }
button {
  background: var(--blue);
  border: none;
  border-radius: 6px;
  color: #04121f;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { filter: brightness(1.1); }

.watchlist { list-style: none; }
.watchlist li {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.watchlist li:hover { background: var(--panel2); }
.watchlist li.active { background: var(--panel2); border-left: 3px solid var(--blue); }
.watchlist li .t { font-weight: 600; }
.watchlist li .p { color: var(--muted); font-size: 12px; }

.content { flex: 1; padding: 20px 24px; overflow-y: auto; }
.loading { color: var(--muted); padding: 40px; text-align: center; }
.error { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); padding: 14px 16px; border-radius: 8px; margin-bottom: 16px; }
.hidden { display: none !important; }

.summary { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; align-items: stretch; }
.price-block { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; min-width: 220px; }
.price-block h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.price-row { display: flex; align-items: baseline; gap: 10px; }
.price { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.change { font-size: 15px; font-weight: 600; }
.change.up { color: var(--green); }
.change.down { color: var(--red); }
.spark-wrap { margin-top: 10px; height: 48px; }

.signal-block { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; justify-content: center; gap: 10px; min-width: 170px; }
.badge { font-size: 20px; font-weight: 800; padding: 8px 14px; border-radius: 8px; text-align: center; }
.badge.buy { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.badge.sell { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.badge.hold { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }
.signal-sub { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.signal-sub b { color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; flex: 1; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.card .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.card .v { font-size: 18px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .v.pos { color: var(--green); }
.card .v.neg { color: var(--red); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.panel h3 { font-size: 14px; margin-bottom: 12px; color: var(--text); }
.panel h3 small { color: var(--muted); font-weight: 400; }

.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.level { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.level .k { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.level .v { font-size: 17px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.level.entry .v { color: var(--blue); }
.level.stop .v { color: var(--red); }
.level.target .v { color: var(--green); }
.level.support .v { color: var(--green); }
.level.resistance .v { color: var(--red); }
.level .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.votes { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.votes li { display: flex; justify-content: space-between; padding: 7px 10px; background: var(--panel2); border-radius: 6px; font-size: 13px; }
.votes li .w { font-weight: 700; }
.votes li .w.b { color: var(--green); }
.votes li .w.s { color: var(--red); }
.votes li .w.n { color: var(--muted); }

.chart-panel { position: relative; }
/* Kotak grafik bertinggi tetap: tanpa ini Chart.js mengukur ulang terus-menerus
   (canvas mengubah tinggi induk -> memicu render ulang) dan terasa sangat lambat. */
.chart-box { position: relative; height: 200px; width: 100%; }
.chart-box.sm { height: 152px; }
.chart-box canvas { display: block; }
@media (max-width: 820px) {
  .chart-box { height: 178px; }
  .chart-box.sm { height: 142px; }
}
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; border-top: 1px solid var(--border); background: var(--panel); }

/* ---------- Rencana Trading & Portofolio ---------- */
.plan-panel { border-color: var(--blue); }
.plan-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-form { display: flex; flex-direction: column; gap: 12px; }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.field-row:last-of-type { grid-template-columns: 1fr 1fr; }
.plan-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.plan-form input, .plan-form textarea {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 9px 10px; font-size: 13px; font-family: inherit;
}
.plan-form input:focus, .plan-form textarea:focus { outline: none; border-color: var(--blue); }
.plan-actions { display: flex; gap: 8px; }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.ghost:hover { background: var(--panel2); }
.plan-results { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.plan-results .muted { color: var(--muted); font-size: 13px; }
.pr-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 13px; }
.pr-item:last-child { border-bottom: none; }
.pr-item .k { color: var(--muted); }
.pr-item .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.pr-item .v.pos { color: var(--green); }
.pr-item .v.neg { color: var(--red); }
.pr-item .v.warn { color: var(--yellow); }
.pr-note { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.pr-note b { color: var(--text); }

/* ---------- Panel head & tombol zoom ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.panel-head h3 { margin-bottom: 0; }
.zoom-btns { display: flex; gap: 4px; }
.zbtn {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  width: 26px; height: 26px; padding: 0; border-radius: 6px;
  font-size: 14px; line-height: 1; cursor: pointer; font-weight: 700;
}
.zbtn:hover { border-color: var(--blue); color: var(--blue); }
.chart-hint { color: var(--muted); font-size: 11px; margin: -6px 0 8px; }

/* ---------- Bandarmologi & Capital Flow ---------- */
.bandar-panel { border-color: var(--purple); }
.bandar-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .bandar-grid { grid-template-columns: 1fr; } }
.bandar-phase, .flow-status { display: flex; flex-direction: column; gap: 8px; }
.bandar-phase .k, .flow-status .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.phase-badge {
  font-size: 18px; font-weight: 800; padding: 10px 14px; border-radius: 8px; text-align: center;
  border: 1px solid var(--border);
}
.phase-badge.buy { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.phase-badge.sell { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.phase-badge.hold { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow); }
.bandar-rec { font-size: 13px; line-height: 1.5; color: var(--text); }
.flow-badge {
  font-size: 15px; font-weight: 700; padding: 9px 12px; border-radius: 8px; text-align: center; border: 1px solid var(--border);
}
.flow-badge.in { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.flow-badge.out { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.flow-badge.flat { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow); }
.flow-mini { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.flow-mini b { color: var(--text); }
.flow-metrics { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Alasan sinyal berkelompok ---------- */
.votes li.vote-group {
  background: transparent; padding: 8px 2px 2px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border);
}
.votes li.vote-item { background: var(--panel2); }

/* ---------- Portofolio & Saran Recovery ---------- */
.portfolio-panel { border-color: var(--teal); }
.pf-table-wrap { overflow-x: auto; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pf-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.pf-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.pf-table input {
  width: 100%; min-width: 70px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 7px 8px; font-size: 13px;
}
.pf-table input.pf-ticker { text-transform: uppercase; }
.pf-table input:focus { outline: none; border-color: var(--blue); }
.pf-pl { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-pl .pos { color: var(--green); }
.pf-pl .neg { color: var(--red); }
.pf-pl small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.pf-del { background: transparent; border: 1px solid var(--border); color: var(--red); width: 26px; height: 26px; padding: 0; border-radius: 6px; cursor: pointer; }
.pf-del:hover { border-color: var(--red); }
.pf-actions { display: flex; gap: 8px; margin-top: 10px; }
.pf-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.pf-recovery { margin-top: 14px; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.rec-line { font-size: 13px; line-height: 1.5; color: var(--text); }
.rec-line b { color: var(--text); }
.pf-rotation { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.rotation-results { display: flex; flex-direction: column; gap: 6px; }
.rot-item {
  display: grid; grid-template-columns: 1.6fr 0.7fr 0.7fr 1.1fr 1fr; gap: 10px; align-items: center;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13px;
}
@media (max-width: 760px) { .rot-item { grid-template-columns: 1fr 1fr; } }
.rot-main { display: flex; flex-direction: column; }
.rot-ticker { font-weight: 800; }
.rot-name { color: var(--muted); font-size: 11px; }
.rot-price { font-variant-numeric: tabular-nums; font-weight: 600; }
.rot-sig { font-weight: 800; }
.rot-sig.pos { color: var(--green); }
.rot-sig.neg { color: var(--red); }
.rot-sig.warn { color: var(--yellow); }
.rot-phase { color: var(--muted); }
.rot-rsi { color: var(--muted); font-size: 11px; }
.rot-tp { font-size: 12px; color: var(--text); white-space: nowrap; }
.rot-tp b { color: var(--green); }

/* ---------- Tab navigasi ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab {
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.tab:hover { color: var(--text); border-color: var(--blue); }
.tab.active { background: var(--blue); color: #04121f; border-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Screener ---------- */
.screener-panel { border-color: var(--green); }
.screener-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.screener-controls label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.screener-controls input {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 8px 10px; font-size: 13px; width: 110px;
}
.screener-controls input:focus { outline: none; border-color: var(--green); }
.scr-note { font-size: 13px; margin-bottom: 10px; color: var(--text); }
.scr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.scr-table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.scr-table td { padding: 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.scr-table tr:hover { background: var(--panel2); }

/* ---------- Sinyal di portofolio ---------- */
.pf-sig { min-width: 110px; }
.sig-badge {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.sig-badge.buy { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.sig-badge.sell { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.sig-badge.hold { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }

/* ---------- Hyperlink kode saham ---------- */
.tick-link { color: var(--blue); text-decoration: none; cursor: pointer; font-weight: 700; }
.tick-link:hover { text-decoration: underline; }
.pf-ticker-cell { display: flex; align-items: center; gap: 6px; }
.pf-ticker-cell input { flex: 1; min-width: 0; }
.pf-open { color: var(--blue); text-decoration: none; font-weight: 800; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.pf-open:hover { text-decoration: underline; background: var(--panel2); }
#watchlist li { cursor: pointer; }
#watchlist li .t { text-decoration: none; }
#watchlist li:hover .t { text-decoration: underline; color: var(--blue); }

/* ---------- Money Management ---------- */
.mm-panel { border-color: var(--teal); }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.mm-block { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.mm-block .k { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.mm-setup { font-weight: 800; font-size: 13px; margin-bottom: 8px; color: var(--yellow); }
.mm-setup.active { color: var(--green); }
.mm-mini { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.mm-mini b { color: var(--text); }
.mm-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.mm-row:last-child { border-bottom: none; }
.mm-row span { color: var(--muted); }
.mm-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.mm-row input { width: 130px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 6px 8px; font-size: 12.5px; }
.mm-row input:focus { outline: none; border-color: var(--teal); }

/* ---------- Setup Harian ---------- */
.setup-panel { margin-top: 16px; border-color: var(--teal); }

/* ---------- Jurnal ---------- */
.journal-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.journal-form input, .journal-form select, .journal-form textarea {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 8px 10px; font-size: 13px; width: 100%;
}
.journal-form input:focus, .journal-form select:focus, .journal-form textarea:focus { outline: none; border-color: var(--blue); }
.journal-list { display: flex; flex-direction: column; gap: 8px; }
.jr-item { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.jr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.jr-head .pf-del { margin-left: auto; }
.jr-row { font-size: 12.5px; color: var(--text); padding: 2px 0; font-variant-numeric: tabular-nums; }
.jr-row.muted { color: var(--muted); }

/* ---------- Tab: CRYPTO ---------- */
.crypto-hero { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.crypto-hero-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.crypto-hero-head h3 { font-size: 15px; }
.crypto-hero-head h3 small { color: var(--muted); font-weight: 400; }
.crypto-hero-actions { display: flex; align-items: center; gap: 10px; }
.crypto-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cp-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.cp-card .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.cp-card b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cp-bias-labels { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.cp-bias-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--panel2); }
.cp-bias-long { background: var(--green); height: 100%; transition: width .4s; }
.cp-bias-short { background: var(--red); height: 100%; transition: width .4s; }
.cp-bias-note { font-size: 11px; margin-top: 6px; }
.cp-list { display: flex; flex-direction: column; }
.cp-row { display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.cp-row:last-child { border-bottom: none; }
.cp-coin { font-weight: 700; }
.cp-coin small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.cp-bars { display: flex; flex-direction: column; gap: 5px; }
.cp-ls { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--panel2); }
.cp-ls .l { background: var(--green); height: 100%; }
.cp-ls .s { background: var(--red); height: 100%; }
.cp-meta { display: flex; gap: 12px; font-size: 11px; color: var(--muted); flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.cp-alerts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cp-alert { background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--yellow); border-radius: 8px; padding: 10px 12px; }
.cp-alert.long { border-left-color: var(--green); }
.cp-alert.short { border-left-color: var(--red); }
.cp-alert .t { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.cp-alert b { font-size: 14px; }
.cp-alert .row { font-size: 12px; color: var(--muted); margin-top: 4px; }

.cp-live { margin-top: 4px; }
.cp-live-head { font-size: 11px; color: var(--green); margin-bottom: 6px; font-weight: 600; }
.cp-live-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cp-live-item { flex: 0 0 auto; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.cp-live-coin { color: var(--muted); font-size: 11px; font-weight: 600; }
.cp-live-item b { font-size: 13px; }
.cp-live-item span.pos, .cp-live-item span.neg { font-size: 11px; }

/* ---------- Cache meta bar + modal konfirmasi ---------- */
.meta-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.meta-when { font-size: 12px; color: var(--muted); }
.meta-when b { color: var(--text); font-variant-numeric: tabular-nums; }
.cache-tag { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 10px; margin-left: 6px; border: 1px solid var(--border); color: var(--muted); }
.cache-tag.fresh { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.cache-tag.stale { color: var(--yellow); border-color: var(--yellow); background: var(--yellow-bg); }
.btn-refresh { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer; }
.btn-refresh:hover { border-color: var(--blue); color: var(--blue); }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; max-width: 440px; width: 92%; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.modal h4 { font-size: 16px; margin-bottom: 10px; }
.modal p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.modal p b { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions button { border-radius: 6px; padding: 8px 16px; font-size: 13px; cursor: pointer; }

/* ---------- Forex: kekuatan mata uang ---------- */
.fx-strength { display: grid; grid-template-columns: 46px 1fr 70px; gap: 10px; align-items: center; padding: 4px 0; font-variant-numeric: tabular-nums; }
.fx-ccy { font-weight: 700; font-size: 12px; }
.fx-bar-wrap { background: var(--panel2); border-radius: 6px; height: 14px; overflow: hidden; }
.fx-bar { height: 100%; border-radius: 6px; transition: width .4s; }
.fx-bar.pos { background: var(--green); }
.fx-bar.neg { background: var(--red); }
.fx-strength > span:last-child { text-align: right; font-size: 12px; }

/* ---------- Prediksi Paus ---------- */
.pred-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.pred-card { background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 10px; padding: 12px 14px; }
.pred-card.BELI { border-left-color: var(--green); }
.pred-card.JUAL { border-left-color: var(--red); }
.pred-card.TUNGGU { border-left-color: var(--yellow); }
.pred-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.pred-sym { font-weight: 800; font-size: 15px; }
.pred-head .sig-badge { font-size: 11px; padding: 2px 10px; }
.pred-conf { font-size: 11px; color: var(--muted); margin-left: auto; }
.pred-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.pred-levels { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.pred-eta { font-size: 12px; margin-bottom: 6px; }
.pred-reasons { font-size: 11px; line-height: 1.5; }

/* ---------- Alarm Buy/Sell ---------- */
.alarm-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alarm-list { display: flex; flex-direction: column; gap: 10px; }
.alarm-row { background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 10px; padding: 10px 12px; }
.alarm-row.BELI { border-left-color: var(--green); }
.alarm-row.JUAL { border-left-color: var(--red); }
.alarm-row.TUNGGU { border-left-color: var(--yellow); }
.alarm-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.alarm-st { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); }
.alarm-st.fired { color: var(--green); border-color: var(--green); background: var(--green-bg); animation: alarmPulse 1.2s infinite; }
.alarm-st.wait { color: var(--muted); }
.alarm-detail { font-size: 11px; margin: 6px 0; line-height: 1.5; }
.alarm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alarm-actions button { font-size: 11px; padding: 4px 10px; }
.btn-alarm { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; margin-top: 8px; }
.btn-alarm:hover { border-color: var(--yellow); color: var(--yellow); }
.pred-actions { display: flex; justify-content: flex-end; }
@keyframes alarmPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* Toast alarm */
.alarm-toast { position: fixed; right: 20px; bottom: 20px; z-index: 1000; max-width: 420px; }
.alarm-toast.hidden { display: none; }
.alarm-toast-inner { background: var(--panel); border: 2px solid var(--yellow); border-radius: 12px; padding: 16px 18px; box-shadow: 0 14px 44px rgba(0,0,0,.6); animation: alarmPulse 1s infinite; }
.alarm-toast-inner.BELI { border-color: var(--green); }
.alarm-toast-inner.JUAL { border-color: var(--red); }
.alarm-toast-title { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.alarm-toast-body { font-size: 12.5px; line-height: 1.6; color: var(--text); }
.alarm-toast button { margin-top: 12px; background: var(--red); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; font-size: 13px; cursor: pointer; }

/* ---------- Header actions (server & install) ---------- */
.hdr-actions { display: flex; gap: 6px; margin-top: 4px; }
.hdr-btn { background: var(--panel2); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
.hdr-btn:hover { color: var(--text); border-color: var(--blue); }
.hdr-btn.hidden { display: none; }
#srv-input { width: 100%; background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 9px 10px; font-size: 13px; margin: 10px 0 4px; }
#srv-input:focus { outline: none; border-color: var(--blue); }
.modal .ghost, .modal .modal-actions button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }

/* ---------- Mode ringan (HP spek rendah) ---------- */
body.lite *, body.lite *::before, body.lite *::after {
  animation: none !important;
  transition: none !important;
}
body.lite .modal, body.lite .alarm-toast-inner, body.lite .panel, body.lite .pred-card {
  box-shadow: none !important;
}
body.lite .cp-bias-long, body.lite .cp-bias-short, body.lite .fx-bar { transition: none !important; }
body.lite .chart-hint, body.lite .zoom-btns { display: none !important; }
body.lite .chart-box.hide-lite { display: none !important; }
#lite-badge { color: var(--yellow); border-color: var(--yellow); }

/* ==========================================================================
   MOBILE (<= 820px): fokus ke DASHBOARD UTAMA
   Sebelumnya sidebar (daftar saham) memakan 240px dari 390px sehingga konten
   hanya 150px dan tombol tab menumpuk setinggi ~530px menutupi layar.
   Sekarang: daftar saham jadi drawer yang tersembunyi (dibuka lewat tombol ☰),
   tab menjadi satu baris yang bisa digeser, dashboard tampil penuh.
   ========================================================================== */
#btn-menu { display: none; }

@media (max-width: 820px) {
  /* ---------- Header ringkas ---------- */
  header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .brand { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .brand h1 { font-size: 15px; }
  .brand .sub { display: none; }
  .logo { font-size: 22px; }
  .header-meta { flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; font-size: 11px; }
  .hdr-actions { margin-top: 2px; flex-wrap: wrap; }
  #btn-menu { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; padding: 4px 10px; }

  /* ---------- Daftar saham jadi drawer ---------- */
  main { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 84%; max-width: 330px;
    transform: translateX(-103%);
    transition: transform .22s ease;
    z-index: 70;
    box-shadow: 6px 0 40px rgba(0, 0, 0, .6);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 65;
    background: rgba(0, 0, 0, .55);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

  /* ---------- Konten penuh lebar ---------- */
  .content { padding: 12px; width: 100%; }

  /* ---------- Tab: satu baris, bisa digeser ---------- */
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    margin-bottom: 12px; padding-bottom: 8px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 8px 12px; font-size: 12px; white-space: nowrap; }

  /* ---------- Panel & kontrol ---------- */
  .panel { padding: 12px; border-radius: 8px; }
  .summary { gap: 10px; }
  .price { font-size: 26px; }
  .screener-controls { flex-direction: column; align-items: stretch; gap: 10px; }
  .screener-controls label,
  .screener-controls input,
  .screener-controls select,
  .screener-controls button { width: 100%; }
  .pred-list { grid-template-columns: 1fr; }
  .crypto-cards { grid-template-columns: 1fr 1fr; }
  .bandar-grid, .mm-grid { grid-template-columns: 1fr; }
  .fx-strength { grid-template-columns: 42px 1fr 64px; gap: 8px; }
  .alarm-toast { left: 8px; right: 8px; bottom: 8px; max-width: none; }
  .modal { width: 94%; padding: 16px; }
  .pf-table-wrap, .scr-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .plan-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
}

/* HP sangat kecil (<= 380px) */
@media (max-width: 380px) {
  .crypto-cards { grid-template-columns: 1fr; }
  .tab { padding: 7px 10px; font-size: 11px; }
}

/* ---------- Membership di dashboard ---------- */
a.hdr-btn { text-decoration: none; display: inline-flex; align-items: center; }
.hdr-btn.pro { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.tab.locked { opacity: .55; position: relative; }
.tab.locked::after { content: " 🔒"; font-size: 10px; }
.tab.locked:hover { color: var(--yellow); border-color: var(--yellow); }
.upgrade-note { font-size: 12px; color: var(--yellow); }
