/* ============================================================
   Trader Rebahan — Design System
   Palet berlapis biru-kehitaman + emas merek + teal/coral fungsional
   CATATAN PENTING: seluruh nama kelas dipertahankan sama seperti
   versi lama, sehingga semua halaman lama otomatis ikut berganti
   tampilan tanpa perlu mengubah file .ejs mana pun.
   ============================================================ */
:root {
  /* dasar berlapis — memberi kedalaman, bukan hitam datar */
  --bg: #07110A;
  --surface: #0E1A12;
  --surface-2: #142319;
  --surface-3: #1A2D20;

  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.12);
  --border-hover: rgba(255,255,255,.20);

  /* emas — identitas merek */
  --gold: #78BC1E;
  --gold-light: #9BD34F;
  --gold-strong: #5A9214;
  --gold-dim: rgba(120,188,30,.14);

  /* warna fungsional untuk data trading */
  --teal: #5EEAD4;     /* profit / live / aktif */
  --coral: #FB7185;    /* drawdown / risiko */
  --sky: #5AB3F0;      /* informasi */

  --text: #E9EDF3;
  --muted: #8A94A4;
  --muted-2: #5D6675;
  --muted-3: rgba(255,255,255,.28);

  --shadow-soft: 0 4px 20px -6px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 46px -12px rgba(0,0,0,.62);

  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
}

* { box-sizing: border-box; }
html, body {
  background: var(--bg); color: var(--text);
  font-family: Inter, 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body { overflow-x: hidden; }
h1, h2, h3, h4 {
  font-family: Archivo, 'Space Grotesk', sans-serif;
  letter-spacing: -0.022em;
}
::selection { background: rgba(120,188,30,.28); color: #fff; }

/* angka rata rapi — penting untuk kolom profit / harga */
.stat-value, .mono, code, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

button, a.btn, .side-item { min-height: 38px; }
@media (max-width: 768px) { button, a.btn, .side-item { min-height: 44px; } }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- latar berpendar ---------- */
.bg-blobs::before, .bg-blobs::after {
  content: ''; position: fixed; pointer-events: none; border-radius: 9999px;
  filter: blur(110px); z-index: 0;
}
.bg-blobs::before { width: 520px; height: 520px; left: -12%; top: -14%; background: rgba(120,188,30,.10); }
.bg-blobs::after  { width: 440px; height: 440px; right: -10%; top: 22%; background: rgba(94,234,212,.055); }
@media (max-width: 768px) {
  .bg-blobs::before, .bg-blobs::after { filter: blur(80px); opacity: .65; }
  .bg-blobs::before { width: 300px; height: 300px; }
  .bg-blobs::after  { width: 260px; height: 260px; }
}

/* ---------- kartu ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); transition: border-color .16s, background .16s;
}
.card-soft { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.card-hover:hover { border-color: var(--border-strong); background: var(--surface-2); }
@media (max-width: 640px) {
  .card { border-radius: 20px; }
  .card-soft { border-radius: 14px; }
}

/* ---------- input ---------- */
.input,
input.input, select.input, textarea.input,
input[type="text"].input, input[type="email"].input, input[type="password"].input,
input[type="tel"].input, input[type="number"].input, input[type="url"].input,
input[type="search"].input, input[type="date"].input, input[type="month"].input,
input[type="file"].input {
  background: var(--surface-2) !important;
  background-color: var(--surface-2) !important;
  background-image: none;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
  border-radius: var(--r-sm);
  padding: 12px 16px; width: 100%; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  font-size: 15px; font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
.input:focus, input.input:focus, select.input:focus, textarea.input:focus {
  border-color: rgba(120,188,30,.55) !important;
  background: var(--surface-3) !important;
  background-color: var(--surface-3) !important;
  box-shadow: 0 0 0 3px rgba(120,188,30,.12);
}
.input::placeholder { color: var(--muted-2) !important; }
.input:disabled { opacity: .5; cursor: not-allowed; }
select.input option, select option { background-color: #142319 !important; color: #E9EDF3 !important; padding: 8px 12px; }
@media (max-width: 640px) { .input { font-size: 16px !important; padding: 13px 16px !important; } }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A94A4' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}

/* ---------- tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; transition: all .16s; cursor: pointer; border: 0;
  font-family: inherit; white-space: nowrap;
}
.btn-gold { background: var(--gold); color: #07110A; }
.btn-gold:hover:not(:disabled) { background: var(--gold-light); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn-gold:active { transform: translateY(0); }
.btn-outline { background: rgba(255,255,255,.02); border: 1px solid var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: rgba(255,255,255,.07); border-color: var(--border-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.loading { color: transparent; position: relative; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
  top: 50%; left: 50%; margin: -9px 0 0 -9px; color: #07110A;
}
.btn-outline.loading::after { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- pill / badge ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: 4px 12px; font-size: 11px; border-radius: 9999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); letter-spacing: .02em; white-space: nowrap;
}
.pill-gold  { border-color: rgba(120,188,30,.30); background: rgba(120,188,30,.12); color: var(--gold); }
.pill-green { border-color: rgba(94,234,212,.28);  background: rgba(94,234,212,.11);  color: var(--teal); }
.pill-red   { border-color: rgba(251,113,133,.28); background: rgba(251,113,133,.11); color: var(--coral); }
.pill-blue  { border-color: rgba(90,179,240,.28);  background: rgba(90,179,240,.11);  color: var(--sky); }

.text-muted { color: var(--muted); }
.text-muted-2 { color: var(--muted-2); }

/* ---------- tabel ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 12px 14px; color: var(--muted-2); font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
  font-size: 10.5px; letter-spacing: .10em; text-transform: uppercase;
}
.tbl td { padding: 14px; border-bottom: 1px solid var(--border); color: rgba(233,237,243,.9); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(255,255,255,.025); }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) { .tbl-mobile-hide { display: none; } .tbl-mobile-cards { display: block; } }
@media (min-width: 769px) { .tbl-mobile-cards { display: none; } }

.row-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
.row-card:last-child { margin-bottom: 0; }
.row-card .row-label { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .09em; }
.row-card .row-value { font-size: 14px; color: rgba(233,237,243,.92); margin-top: 2px; }

/* ---------- sidebar ---------- */
.side-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm); color: var(--muted); font-size: 14px; transition: all .15s; }
.side-item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.side-item.active { background: var(--gold); color: #07110A; font-weight: 600; }

/* ---------- statistik ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; transition: border-color .15s; }
.stat:hover { border-color: var(--border-strong); }
.stat-label { color: var(--muted-2); font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; font-family: Archivo, 'Space Grotesk', sans-serif; letter-spacing: -0.025em; }
.stat-trend { font-size: 11px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--teal); }
.stat-trend.down { color: var(--coral); }
@media (max-width: 640px) { .stat { padding: 14px; border-radius: 16px; } .stat-value { font-size: 22px; } }

/* ---------- toast ---------- */
.toast-container { position: fixed; right: 16px; top: 16px; z-index: 100; max-width: calc(100vw - 32px); width: 380px; pointer-events: none; }
@media (max-width: 480px) { .toast-container { right: 8px; top: 8px; left: 8px; width: auto; } }
.toast {
  background: rgba(20,35,25,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 10px; pointer-events: auto; box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.22,1,.36,1); font-size: 14px; color: var(--text);
}
.toast.success { border-color: rgba(94,234,212,.4); }
.toast.error   { border-color: rgba(251,113,133,.4); }
.toast.info    { border-color: rgba(90,179,240,.4); }
.toast-icon { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.toast.success .toast-icon { background: rgba(94,234,212,.18); color: var(--teal); }
.toast.error .toast-icon   { background: rgba(251,113,133,.18); color: var(--coral); }
.toast.info .toast-icon    { background: rgba(90,179,240,.18); color: var(--sky); }
.toast-body { flex: 1; line-height: 1.5; }
.toast-close { background: none; border: 0; color: var(--muted-2); cursor: pointer; padding: 0; font-size: 18px; line-height: 1; transition: color .15s; }
.toast-close:hover { color: var(--text); }
.toast.hide { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 284px; max-width: 86vw;
  background: var(--surface); border-right: 1px solid var(--border-strong);
  z-index: 95; transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.22,1,.36,1);
  display: flex; flex-direction: column; padding: 20px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; top: 16px; right: 16px; background: none; border: 0; color: var(--text); font-size: 24px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.hamburger { display: none; background: none; border: 0; cursor: pointer; padding: 10px; color: var(--text); }
.hamburger svg { width: 24px; height: 24px; }
@media (max-width: 1023px) { .hamburger { display: inline-flex; } }
@media (min-width: 1024px) { .drawer-backdrop, .drawer { display: none; } }

/* ---------- empty state ---------- */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state .empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--muted-2); font-size: 26px;
}
.empty-state .empty-icon svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.empty-state h2 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.fade-in { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.line-glow { filter: drop-shadow(0 0 10px rgba(120,188,30,.4)); }

code, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.otp-input { text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 28px; letter-spacing: 0.4em; padding: 18px 12px; font-weight: 600; }
@media (max-width: 480px) { .otp-input { font-size: 22px; letter-spacing: 0.3em; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #20362A; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #364353; }
body.drawer-open { overflow: hidden; }

@media (max-width: 640px) { h1.text-3xl { font-size: 24px; } h1.text-4xl { font-size: 28px; } }

/* Chrome autofill */
input:-webkit-autofill, input:-webkit-autofill:hover,
input:-webkit-autofill:focus, input:-webkit-autofill:active,
select:-webkit-autofill, textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #142319 inset !important;
  box-shadow: 0 0 0 1000px #142319 inset !important;
  -webkit-text-fill-color: #E9EDF3 !important;
  caret-color: #E9EDF3 !important;
  border: 1px solid var(--border-strong) !important;
  transition: background-color 999999s ease-out 0s !important;
}
input:-webkit-autofill::first-line { color: #E9EDF3 !important; font-family: inherit; }

/* MyFxbook / FXBlue embed */
.myfx-embed { overflow-x: auto; max-width: 100%; }
.myfx-embed img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.myfx-embed iframe { max-width: 100%; border: 0; }
.myfx-embed a { display: inline-block; max-width: 100%; }
.myfx-card { overflow: hidden; max-width: 100%; max-height: 160px; position: relative; border-radius: var(--r-sm); }
.myfx-card iframe { width: 100%; max-width: 100%; height: 140px; border: 0; }
.myfx-card img { width: 100%; max-height: 140px; object-fit: contain; display: block; }
.myfx-card a { display: inline-block; max-width: 100%; }

/* ============================================================
   IKON — pengganti emoji
   Pakai: <%- ic('rocket') %> atau <span class="ic-box gold">…</span>
   ============================================================ */
.ic { display: inline-grid; place-items: center; flex-shrink: 0; line-height: 0; vertical-align: -.18em; }
.ic svg { width: 1.1em; height: 1.1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-fill svg { fill: currentColor; stroke: none; }
.ic-gold { color: var(--gold); }
.ic-teal { color: var(--teal); }
.ic-coral { color: var(--coral); }
.ic-sky { color: var(--sky); }
.ic-muted { color: var(--muted); }

.ic-box { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--muted); }
.ic-box svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic-box.gold { background: var(--gold-dim); color: var(--gold); }
.ic-box.teal { background: rgba(94,234,212,.13); color: var(--teal); }
.ic-box.coral { background: rgba(251,113,133,.13); color: var(--coral); }
.ic-box.sky { background: rgba(90,179,240,.13); color: var(--sky); }
.ic-box.lg { width: 50px; height: 50px; border-radius: 16px; }
.ic-box.lg svg { width: 23px; height: 23px; }

/* ---------- penanda live ---------- */
.live-dot { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 9999px; background: rgba(94,234,212,.12); color: var(--teal); font-size: 11px; font-weight: 600; border: 1px solid rgba(94,234,212,.28); }
.live-dot::before { content: ''; width: 6px; height: 6px; border-radius: 9999px; background: currentColor; animation: blip 2.4s ease-in-out infinite; }
@keyframes blip { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- bottom nav (mobile, ala aplikasi) ---------- */
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: rgba(7,17,10,.96);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-strong); display: flex;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
@media (min-width: 1024px) { .bnav { display: none; } }
.bnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; color: var(--muted-2); font-size: 10.5px; font-weight: 500; min-height: 0; }
.bnav a.active { color: var(--gold); }
.bnav svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
body.has-bnav { padding-bottom: 78px; }
@media (min-width: 1024px) { body.has-bnav { padding-bottom: 0; } }

/* ---------- bilah aksi lengket ---------- */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 66px; z-index: 90;
  background: rgba(7,17,10,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-strong);
  padding: 11px 16px; display: flex; gap: 12px; align-items: center;
}
@media (min-width: 1024px) { .sticky-bar { display: none; } }

/* ---------- link hub ---------- */
.hub-logo {
  width: 82px; height: 82px; border-radius: 26px; margin: 0 auto 16px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--gold), var(--gold-strong));
  box-shadow: 0 12px 40px rgba(120,188,30,.22);
}
.hub-logo img { width: 54px; height: 54px; }
.lk { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 15px; transition: .16s; }
.lk:hover { border-color: var(--border-strong); background: var(--surface-2); }
.lk-b { flex: 1; min-width: 0; }
.lk-b b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 2px; }
.lk-b small { color: var(--muted-2); font-size: 12px; line-height: 1.4; display: block; }
.lk-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; flex-shrink: 0; }
.lk-go { color: var(--muted-2); flex-shrink: 0; }
.lk-go svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* ---------- daftar menu sidebar yang bisa digulir ---------- */
.sidebar-scroll { scrollbar-width: thin; scrollbar-color: #20362A transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #20362A; border-radius: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: #3A4757; }
/* sembunyikan batang gulir sampai kursor mendekat, agar tidak mengganggu */
.sidebar-scroll { scrollbar-gutter: stable; }

/* ============================================================
   PENGAMAN LEBAR — mencegah halaman melebar melewati layar
   Penyebab tersering di layar sempit adalah teks panjang tanpa
   spasi (kode pesanan, nomor akun, nama server) di dalam flex/grid.
   Bawaannya flex item tidak boleh menyusut di bawah lebar isinya,
   sehingga isi yang panjang mendorong seluruh halaman melebar.
   ============================================================ */
html, body { max-width: 100%; overflow-x: hidden; }

/* Teks berkode boleh dipenggal di mana saja daripada mendorong lebar */
.mono, code { overflow-wrap: anywhere; word-break: break-word; }

/* Kartu dan isi utama tidak boleh melampaui wadahnya */
main, main > *, .card, .card-soft, .stat, .row-card { max-width: 100%; }

/* Anak langsung grid & flex boleh menyusut */
.grid > *, .flex > * { min-width: 0; }

/* Angka besar pada kartu statistik ikut mengecil di layar sempit */
@media (max-width: 400px) {
  .stat { padding: 12px; }
  .stat-value { font-size: 19px; }
  .stat-label { font-size: 9.5px; letter-spacing: .06em; }
}

/* Tabel tetap boleh digulir sendiri, bukan mendorong halaman */
.tbl-wrap { max-width: 100%; }
