:root {
  --bg: #0b0e14;
  --bg2: #11151f;
  --panel: #151a26;
  --panel2: #1a2130;
  --border: #232b3d;
  --text: #e6ebf5;
  --muted: #8b95ab;
  --green: #16c784;
  --red: #ea3943;
  --amber: #f0b90b;
  --blue: #3b82f6;
  --purple: #a855f7;
  --cyan: #22d3ee;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3347; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; background: var(--bg2);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, #16c784, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #06121d; font-weight: 800;
}
.brand-text h1 { font-size: 16px; letter-spacing: .3px; }
.brand-text span { font-size: 11px; color: var(--muted); }
.clocks { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.clock-wib { text-align: right; }
.cl-label { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.cl-time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.session { font-size: 11px; padding: 5px 10px; border-radius: 20px; background: var(--panel2); border: 1px solid var(--border); color: var(--amber); font-weight: 600; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.status.on .dot { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* ---------- Alert controls ---------- */
.alert-ctl { display: flex; align-items: center; gap: 6px; }
.ac-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--muted); font-size: 16px; cursor: pointer;
  transition: all .15s; display: flex; align-items: center; justify-content: center;
}
.ac-btn:hover { border-color: #3b4a6b; }
.ac-btn.on { color: #fff; border-color: var(--blue); background: rgba(59,130,246,.18); box-shadow: 0 0 8px rgba(59,130,246,.35); }
.ac-badge {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; font-size: 11px; font-weight: 700;
  background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center;
}

/* ---------- Alert log ---------- */
.alert-log { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.alert-item { padding: 8px 10px; background: var(--panel); border-radius: 8px; border-left: 3px solid var(--amber); }
.alert-item.buy { border-left-color: var(--green); }
.alert-item.sell { border-left-color: var(--red); }
.alert-item .a-top { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.alert-item .a-sym { font-size: 11px; }
.alert-item .a-desc { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.alert-item .a-time { font-size: 10px; color: #5b6577; margin-top: 3px; }

/* ---------- Toast stack ---------- */
.toast-stack { position: fixed; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: 340px; }
.toast {
  padding: 12px 14px; border-radius: 10px; background: #1c2436; border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: toastIn .25s ease; cursor: pointer;
}
.toast.buy { border-left: 3px solid var(--green); }
.toast.sell { border-left: 3px solid var(--red); }
.toast .t-head { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.toast .t-body { font-size: 12px; color: #c3cbd9; margin-top: 4px; line-height: 1.45; }
.toast .t-close { margin-left: auto; color: var(--muted); font-size: 15px; cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(-20px); } }

/* ---------- Ticker strip ---------- */
.ticker-strip {
  display: flex; gap: 2px; overflow-x: auto; padding: 0;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.ticker-strip::-webkit-scrollbar { display: none; }
.ticker {
  flex: 0 0 auto; min-width: 148px; padding: 8px 14px; cursor: pointer;
  border-right: 1px solid var(--border); transition: background .15s;
}
.ticker:hover { background: var(--panel); }
.ticker.active { background: var(--panel); box-shadow: inset 0 -2px 0 var(--blue); }
.ticker .tk-sym { font-size: 12px; font-weight: 700; }
.ticker .tk-price { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 1px 0; }
.ticker .tk-chg { font-size: 11px; font-weight: 600; }
.up { color: var(--green); }
.down { color: var(--red); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr 340px; gap: 0; height: calc(100vh - 104px); }
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); overflow-y: auto; padding: 14px; }
.rightbar { background: var(--bg2); border-left: 1px solid var(--border); overflow-y: auto; }
.center { display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Sidebar symbols ---------- */
.side-section { margin-bottom: 18px; }
.side-section h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 8px; }
.sym-list { display: flex; flex-direction: column; gap: 2px; }
.sym-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; transition: background .12s;
}
.sym-item:hover { background: var(--panel); }
.sym-item.active { background: var(--panel2); box-shadow: inset 2px 0 0 var(--blue); }
.sym-item .s-name { font-weight: 600; font-size: 13px; }
.sym-item .s-px { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- Chart ---------- */
.chart-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
.chart-title { display: flex; align-items: baseline; gap: 12px; }
.chart-title h2 { font-size: 18px; }
.price-big { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chg { font-size: 13px; font-weight: 600; }
.tf-switch { display: flex; gap: 4px; background: var(--panel); padding: 3px; border-radius: 8px; }
.tf-btn { padding: 6px 11px; border: none; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; }
.tf-btn:hover { color: var(--text); }
.tf-btn.active { background: var(--blue); color: #fff; }
.chart-wrap { flex: 1; min-height: 320px; position: relative; margin: 0 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 12px 16px 0; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); border-radius: 8px 8px 0 0; cursor: pointer; font-weight: 600; font-size: 13px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel2); color: var(--text); border-bottom: 2px solid var(--blue); }
.strategy-panels { padding: 12px 16px 20px; overflow-y: auto; }

/* ---------- Strategy panels ---------- */
.panel { display: none; animation: fade .2s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.signal-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.signal-card {
  flex: 1 1 140px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.signal-card .sc-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.signal-card .sc-val { font-size: 18px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.signal-card .sc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.badge.buy { background: rgba(22,199,132,.15); color: var(--green); border: 1px solid rgba(22,199,132,.4); }
.badge.sell { background: rgba(234,57,67,.15); color: var(--red); border: 1px solid rgba(234,57,67,.4); }
.badge.wait { background: rgba(240,185,11,.12); color: var(--amber); border: 1px solid rgba(240,185,11,.35); }

.desc { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; line-height: 1.55; color: #c3cbd9; font-size: 13px; }
.desc b { color: var(--text); }
.desc ul { margin: 6px 0 0 18px; }
.desc li { margin: 3px 0; }
.desc .ok { color: var(--green); }
.desc .bad { color: var(--red); }
.desc .hint2 { color: var(--amber); }

.legend-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font-size: 11px; padding: 4px 9px; border-radius: 20px; background: var(--panel2); border: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.chip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------- Right bar ---------- */
.news-panel { padding: 14px; border-bottom: 1px solid var(--border); }
.news-panel h3 { font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.news-panel .hint { font-size: 10px; color: var(--muted); font-weight: 400; }
.impact-legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.impact-legend span { display: flex; align-items: center; gap: 5px; }
.ic { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ic.high { background: var(--red); }
.ic.med { background: var(--amber); }
.ic.low { background: #6b7280; }

.next-event {
  background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(168,85,247,.12));
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px;
}
.next-event .ne-title { font-weight: 700; font-size: 13px; }
.next-event .ne-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.next-event .ne-count { font-size: 26px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--cyan); }

.calendar-list { display: flex; flex-direction: column; gap: 6px; }
.cal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border-radius: 8px; }
.cal-item .c-flag { font-weight: 800; font-size: 11px; width: 34px; }
.cal-item .c-body { flex: 1; min-width: 0; }
.cal-item .c-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item .c-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-item .c-cd { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cyan); white-space: nowrap; }

.news-list { display: flex; flex-direction: column; gap: 8px; }
.news-item { padding: 9px 10px; background: var(--panel); border-radius: 8px; }
.news-item a { color: var(--text); text-decoration: none; font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.news-item a:hover { color: var(--blue); }
.news-item .n-meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; display: flex; justify-content: space-between; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 180px 1fr; }
  .rightbar { display: none; }
}

/* ============ MOBILE (Android / iPhone) ============ */
.mobile-nav { display: none; }

@media (max-width: 760px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; padding-bottom: 56px; }

  /* topbar ringkas */
  .topbar { flex: 0 0 auto; padding: 8px 12px; gap: 8px; }
  .brand-text h1 { font-size: 14px; }
  .brand-text span { display: none; }
  .session { display: none; }
  .status span:not(.dot) { display: none; }
  .clock-wib .cl-time { font-size: 16px; }
  .cl-label { font-size: 9px; }
  .logo { width: 30px; height: 30px; font-size: 16px; }
  .ac-btn { width: 30px; height: 30px; font-size: 14px; }

  .ticker-strip { flex: 0 0 auto; }
  .ticker { min-width: 128px; padding: 6px 12px; }

  /* layout jadi satu kolom penuh */
  .layout {
    flex: 1 1 auto;
    min-height: 0;
    display: block;
    position: relative;
    overflow: hidden;
  }
  .center { height: 100%; }

  /* sidebar & rightbar jadi panel geser (overlay) */
  .sidebar, .rightbar {
    display: block;
    position: absolute;
    top: 0; bottom: 0; width: 100%;
    background: var(--bg2);
    z-index: 45;
    overflow-y: auto;
    transition: transform .25s ease;
  }
  .sidebar { left: 0; transform: translateX(-100%); border-right: none; padding: 16px; }
  .rightbar { right: 0; transform: translateX(100%); border-left: none; }
  body.view-symbols .sidebar { transform: translateX(0); }
  body.view-info .rightbar { transform: translateX(0); }

  /* item simbol lebih besar utk jari */
  .sym-item { padding: 12px 12px; }
  .sym-item .s-name { font-size: 14px; }

  /* chart head ringkas */
  .chart-head { padding: 8px 10px; }
  .chart-title h2 { font-size: 15px; }
  .price-big { font-size: 17px; }
  .chg { font-size: 12px; }
  .tf-switch { gap: 2px; }
  .tf-btn { padding: 5px 8px; font-size: 11px; }
  /* chart tinggi TETAP (tidak memakan semua layar), sisakan ruang utk
     tab analisa + panel sinyal di bawahnya */
  .center .chart-wrap { flex: 0 0 auto; height: 300px; min-height: 0; margin: 0 8px; }
  .center .strategy-panels { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

  /* tabs: tampilkan SEMUA 5 tab (wrap, bukan scroll) */
  .tabs { padding: 8px 8px 0; flex-wrap: wrap; gap: 4px; }
  .tab { flex: 0 0 auto; font-size: 12px; padding: 7px 10px; border-radius: 7px; }
  .strategy-panels { padding: 10px 10px 24px; }

  /* bottom navigation */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 16px rgba(0,0,0,.4);
  }
  .mn-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mn-btn .mn-ic { font-size: 20px; line-height: 1; }
  .mn-btn.active { color: var(--blue); }
}
