/* =========================================================================
   HFM Market — stylesheet
   Struktur: 1. Tokens  2. Base  3. Layout shell  4. Topbar & brand
             5. Components  6. Pages  7. Utilities  8. Responsive
   ========================================================================= */

/* 1. Tokens -------------------------------------------------------------- */
:root {
  --bg: #07090c;
  --surface: #0f1319;
  --surface-2: #151a22;
  --surface-3: #1b212b;
  --border: #212833;
  --border-strong: #2c3542;

  --text: #e8ebf0;
  --text-muted: #8b95a5;
  --text-faint: #5d6776;

  --brand: #e3262d;
  --brand-hover: #f23a40;
  --up: #26a69a;
  --down: #ef5350;
  --warn: #f0b429;
  --info: #4c8dff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);

  --sidebar-w: 248px;
  --topbar-h: 64px;
  --gap: 16px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

/* 2. Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img, svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* 3. Layout shell -------------------------------------------------------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 100dvh; }
.content {
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--gap) var(--gap) calc(var(--gap) + var(--safe-bottom));
  outline: none;
}

/* Sidebar: drawer di mobile, statis di desktop */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: min(84vw, var(--sidebar-w));
  display: flex; flex-direction: column; gap: 8px;
  padding: calc(16px + var(--safe-top)) 12px calc(16px + var(--safe-bottom));
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform .25s ease;
  overflow-y: auto;
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow); }
.sidebar__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 16px; }
.sidebar__foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }

.backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
}

.nav { display: grid; gap: 4px; }
.nav__link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link.is-active { background: rgba(227, 38, 45, .12); color: var(--text); }
.nav__link.is-active .icon { color: var(--brand); }
.nav__link .pill { margin-left: auto; }

/* 4. Topbar & brand ------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "brand brand" "menu actions";
  align-items: center;
  gap: 10px 12px;
  padding: calc(10px + var(--safe-top)) var(--gap) 10px;
  background: rgba(7, 9, 12, .9);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  grid-area: menu;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff;
  transition: background .15s;
}
.menu-btn:hover { background: var(--brand-hover); }
.menu-btn .icon { width: 24px; height: 24px; }
.topbar .brand--topbar { grid-area: brand; justify-self: center; }
.topbar__actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }

.brand { display: inline-flex; flex-direction: column; align-items: center; line-height: .9; user-select: none; }
.brand__top { font-weight: 900; font-size: 26px; letter-spacing: .02em; color: #fff; }
.brand__bottom { font-weight: 800; font-size: 13px; letter-spacing: .32em; margin-right: -.32em; color: var(--brand); }
.brand--lg .brand__top { font-size: 44px; }
.brand--lg .brand__bottom { font-size: 21px; }

.brand--logo { flex-direction: row; justify-content: center; }
.brand__logo {
  display: block;
  height: 38px;
  width: auto;
  max-width: min(210px, 58vw);
  object-fit: contain;
  object-position: center;
}
.brand--lg .brand__logo { height: 60px; max-width: min(280px, 85vw); }
.sidebar .brand__logo { height: 42px; }
.topbar .brand__logo { height: 34px; max-width: min(180px, 42vw); }

.balance {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn--bordered { background: var(--surface-2); border: 1px solid var(--border); }

.dot-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid var(--bg);
  box-sizing: content-box;
}
.dot-badge.is-bump { animation: bump .4s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

.user-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 10px 0 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.user-btn:hover { border-color: var(--border-strong); }
.user-btn__name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.user-btn .icon { width: 16px; height: 16px; color: var(--text-muted); }
.avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #8e1418);
  color: #fff; font-size: 12px; font-weight: 700;
}

/* Ticker */
.ticker { border-bottom: 1px solid var(--border); background: #131722; min-height: 46px; overflow: hidden; }
.ticker iframe { color-scheme: normal; }
.ticker .tradingview-widget-copyright { display: none; }

.offline-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px; font-size: 13px;
  background: rgba(240, 180, 41, .12); color: var(--warn);
  border-bottom: 1px solid rgba(240, 180, 41, .25);
}
.offline-bar .icon { width: 16px; height: 16px; }

/* 5. Components ---------------------------------------------------------- */

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 18px; font-weight: 700; }
.card__body { padding: 20px; }
.card--narrow { max-width: 760px; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn--ghost { background: var(--surface-2); border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { border-color: var(--border-strong); }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.link-btn { background: none; border: 0; padding: 4px 0; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.link-btn:hover { color: var(--text); }

.pill { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; text-align: center; }
.pill--red { background: var(--brand); color: #fff; }

/* Chips (pemilih simbol) */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 13px; font-weight: 600;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Notice */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid; font-size: 14px; color: var(--text);
}
.notice .icon { margin-top: 1px; }
.notice--warn { background: rgba(240, 180, 41, .08); border-color: rgba(240, 180, 41, .28); }
.notice--warn .icon { color: var(--warn); }
.notice--danger { background: rgba(239, 83, 80, .08); border-color: rgba(239, 83, 80, .3); }
.notice--danger .icon { color: var(--down); }
.notice--success { background: rgba(38, 166, 154, .08); border-color: rgba(38, 166, 154, .3); }
.notice--success .icon { color: var(--up); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 220px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.dropdown__meta { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown__meta small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.dropdown__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; text-align: left; font-size: 14px;
}
.dropdown__item .icon { width: 18px; height: 18px; color: var(--text-muted); }
.dropdown__item:hover { background: var(--surface-3); }
.dropdown__item--danger, .dropdown__item--danger .icon { color: var(--down); }

/* Panel notifikasi */
.notif-panel { width: 380px; padding: 0; overflow: hidden; }
.notif-panel__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-panel .notif-list { max-height: min(60vh, 440px); overflow-y: auto; }
.notif-panel__foot { display: block; padding: 12px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-muted); border-top: 1px solid var(--border); }
.notif-panel__foot:hover { color: var(--text); background: var(--surface-3); }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
  position: relative;
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-3); }
.notif-item.is-unread::after {
  content: ""; position: absolute; right: 14px; top: 18px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}
.notif-item.is-new { animation: flash 1.6s ease; }
@keyframes flash { from { background: rgba(227, 38, 45, .18); } }
.notif-item__icon {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(76, 141, 255, .12); color: var(--info);
}
.notif-item__icon .icon { width: 18px; height: 18px; }
.notif-item[data-type="success"] .notif-item__icon { background: rgba(38, 166, 154, .12); color: var(--up); }
.notif-item[data-type="warning"] .notif-item__icon { background: rgba(240, 180, 41, .12); color: var(--warn); }
.notif-item[data-type="danger"] .notif-item__icon { background: rgba(239, 83, 80, .12); color: var(--down); }
.notif-item__title { font-weight: 600; font-size: 14px; padding-right: 16px; }
.notif-item__body { color: var(--text-muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.notif-item__time { color: var(--text-faint); font-size: 12px; margin-top: 4px; }
.notif-item:not(.is-unread) .notif-item__title { color: var(--text-muted); font-weight: 500; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }
.notif-list--card .notif-item { padding-left: 20px; padding-right: 20px; }

/* Toast */
.toast-stack {
  position: fixed; z-index: 90;
  right: 16px; bottom: calc(16px + var(--safe-bottom));
  display: grid; gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: toast-in .25s ease;
  cursor: pointer;
}
.toast[data-type="success"] { border-left-color: var(--up); }
.toast[data-type="warning"] { border-left-color: var(--warn); }
.toast[data-type="danger"] { border-left-color: var(--down); }
.toast.is-leaving { animation: toast-out .2s ease forwards; }
.toast__title { font-weight: 600; font-size: 14px; }
.toast__body { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.toast__close { background: none; border: 0; color: var(--text-muted); padding: 0; }
.toast__close .icon { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* Form */
.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(227, 38, 45, .2); }
textarea.input { resize: vertical; }

/* Stats */
.stats { display: grid; gap: 14px; margin: 0; }
.stat dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.stat dd { margin: 2px 0 0; font-weight: 500; }
.stat__value { font-size: 26px; font-weight: 700 !important; font-variant-numeric: tabular-nums; }

/* 6. Pages --------------------------------------------------------------- */
.page-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.side-col { display: grid; gap: var(--gap); align-content: start; }

.card--chart .card__body { padding: 16px; }
.chart-frame {
  position: relative;
  height: clamp(420px, 62vh, 640px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.chart-frame .tradingview-widget-container { height: 100%; width: 100%; }
.chart-frame .tradingview-widget-container__widget { height: 100%; }
.chart-frame .tradingview-widget-copyright { display: none; }
.chart-offline {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  color: var(--text-muted); background: var(--surface);
}
.chart-offline .icon { width: 32px; height: 32px; }

.push-card { display: grid; gap: 14px; }
.push-card [data-push-status] { font-size: 14px; }
.push-card [data-push-status].is-on { color: var(--up); }
.hint { display: flex; gap: 10px; font-size: 13px; color: var(--text-muted); padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.hint .icon { width: 18px; height: 18px; }

/* Login */
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(227, 38, 45, .18), transparent 70%),
    var(--bg);
}
.auth__card {
  width: 100%; max-width: 400px;
  display: grid; gap: 20px; justify-items: stretch;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.auth__card .brand { justify-self: center; }
.auth__title { font-size: 20px; text-align: center; }
.auth__card .notice { margin: 0; }
.auth__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.auth__tab { display: flex; align-items: center; justify-content: center; min-height: 38px; border-radius: 6px; color: var(--text-muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.auth__tab:hover { color: var(--text); }
.auth__tab.is-active { background: var(--surface-3); color: var(--text); }
.auth__tab:focus-visible { outline: 2px solid var(--brand); }
.auth__switch { font-size: 13px; color: var(--text-muted); text-align: center; }
.auth__switch a { color: var(--brand); font-weight: 600; }

/* 7. Utilities ----------------------------------------------------------- */
.muted { color: var(--text-muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 8. Responsive ---------------------------------------------------------- */

/* Ponsel kecil: sembunyikan nama user, cukup avatar */
@media (max-width: 479px) {
  .user-btn__name, .user-btn .icon { display: none; }
  .user-btn { padding: 0 6px; }
  .balance { padding: 0 10px; font-size: 14px; }
  .balance .icon { width: 18px; height: 18px; }
  .card__head { padding: 14px 16px; }
  .card__body { padding: 16px; }
  .card--chart .card__body { padding: 12px; }
}

/* Panel notifikasi jadi "sheet" penuh lebar di layar sempit */
@media (max-width: 639px) {
  .notif-panel {
    position: fixed; left: 8px; right: 8px; top: calc(118px + var(--safe-top));
    width: auto;
  }
  .toast-stack { left: 16px; right: 16px; width: auto; }
}

/* Tablet: kartu samping 2 kolom */
@media (min-width: 720px) {
  .side-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-col > :last-child { grid-column: 1 / -1; }
  :root { --gap: 20px; }
}

/* Topbar satu baris mulai tablet */
@media (min-width: 640px) {
  .topbar {
    grid-template-columns: auto auto 1fr;
    grid-template-areas: "menu brand actions";
    gap: 16px;
  }
  .topbar .brand--topbar { justify-self: start; }
}

/* Desktop: sidebar permanen */
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    width: var(--sidebar-w);
    transform: none; box-shadow: none;
  }
  .sidebar__close, .menu-btn, .backdrop, .topbar .brand--topbar { display: none !important; }
  .topbar { grid-template-columns: 1fr; grid-template-areas: "actions"; min-height: var(--topbar-h); }
  .content { padding: 24px; }
}

/* Desktop lebar: kolom samping di kanan */
@media (min-width: 1280px) {
  .page-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .side-col { grid-template-columns: minmax(0, 1fr); position: sticky; top: calc(var(--topbar-h) + 24px); }
  .side-col > :last-child { grid-column: auto; }
  .chart-frame { height: clamp(520px, calc(100dvh - 300px), 820px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Mode aplikasi terinstal (standalone) */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* =========================================================================
   9. Payments — deposit, withdraw & admin
   ========================================================================= */
.nav__label {
  margin: 16px 12px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint);
}
.pill--warn { background: var(--warn); color: #1a1300; }

.balance { transition: border-color .15s; }
.balance:hover { border-color: var(--border-strong); }
[data-balance].is-updated { animation: balance-flash 1.4s ease; }
@keyframes balance-flash { 0%, 30% { color: var(--up); } }

.flash-stack { display: grid; gap: 8px; margin-bottom: var(--gap); }
.flash-stack .notice { margin: 0; }

/* Judul halaman */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px;
  margin-bottom: var(--gap);
}
.page-head p { max-width: 640px; margin-top: 4px; font-size: 14px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.page-head__stat { display: grid; text-align: right; font-size: 13px; }
.page-head__stat strong { font-size: 22px; font-variant-numeric: tabular-nums; }

.pay-layout, .admin-layout { display: grid; gap: var(--gap); margin-bottom: var(--gap); align-items: start; }

.step {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; margin-right: 6px;
  border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 800; vertical-align: 2px;
}

/* Pilihan metode */
.method-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 16px; }
.method { position: relative; display: block; cursor: pointer; }
.method input { position: absolute; opacity: 0; pointer-events: none; }
.method__card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; height: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.method:hover .method__card { border-color: var(--text-faint); }
.method input:checked + .method__card { border-color: var(--brand); background: rgba(227, 38, 45, .08); }
.method input:focus-visible + .method__card { outline: 2px solid var(--brand); outline-offset: 2px; }
.method__text { display: grid; min-width: 0; flex: 1; }
.method__text small { color: var(--text-muted); font-size: 12px; }
.method__check {
  display: grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--border-strong); color: transparent;
}
.method__check .icon { width: 14px; height: 14px; }
.method input:checked + .method__card .method__check { background: var(--brand); border-color: var(--brand); color: #fff; }
.method__icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(76, 141, 255, .12); color: var(--info);
}
.method__icon--qris { background: rgba(38, 166, 154, .12); color: var(--up); }

.pay-detail { display: grid; gap: 12px; }
.kv { display: grid; gap: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kv > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: center; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--text-muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.kv__copy { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kv__copy .mono { font-size: 17px; letter-spacing: .04em; }
.kv--compact > div { grid-template-columns: 120px 1fr; padding: 8px 12px; }
.kv--compact dd { font-weight: 500; font-size: 14px; }
.mono { font-family: var(--mono); }

.qris { display: grid; justify-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.qris img { width: min(280px, 100%); aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: var(--radius-sm); padding: 8px; }

.btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn--sm .icon { width: 15px; height: 15px; }
.btn--success { background: var(--up); color: #fff; }
.btn--success:hover:not(:disabled) { filter: brightness(1.1); }
.btn--danger { background: transparent; color: var(--down); border-color: rgba(239, 83, 80, .45); }
.btn--danger:hover:not(:disabled) { background: rgba(239, 83, 80, .1); }
.btn-row--split { margin-top: 14px; }
.btn-row--split .btn { flex: 1; }
.icon-btn--danger { color: var(--down); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; }
.link-btn .icon { width: 16px; height: 16px; }
.link-btn--danger { color: var(--down); }

.input--lg { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 54px; }
.input--sm { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.field__help { color: var(--text-muted); font-size: 12px; }
.card__body.form { gap: 18px; }

/* Area unggah */
.dropzone {
  position: relative; display: grid; place-items: center;
  min-height: 150px; padding: 16px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg); cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: rgba(227, 38, 45, .05); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__empty { display: grid; justify-items: center; gap: 8px; color: var(--text-muted); font-size: 14px; pointer-events: none; }
.dropzone__empty .icon { width: 28px; height: 28px; }
.dropzone__empty strong { color: var(--text); }
.dropzone__preview { max-height: 260px; max-width: 100%; border-radius: var(--radius-sm); pointer-events: none; }
.dropzone--square .dropzone__preview { width: 200px; height: 200px; object-fit: contain; background: #fff; padding: 6px; }

/* Segmented & switch */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border-radius: 6px; color: var(--text-muted); font-weight: 600; font-size: 14px; }
.segmented .icon { width: 18px; height: 18px; }
.segmented input:checked + span { background: var(--surface-3); color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; align-self: end; min-height: 44px; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch__track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--border-strong); transition: background .15s; flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--up); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Status badge */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid; }
.badge--pending   { color: var(--warn); border-color: rgba(240, 180, 41, .4); background: rgba(240, 180, 41, .1); }
.badge--approved  { color: var(--up);   border-color: rgba(38, 166, 154, .4); background: rgba(38, 166, 154, .1); }
.badge--rejected  { color: var(--down); border-color: rgba(239, 83, 80, .4);  background: rgba(239, 83, 80, .1); }
.badge--cancelled { color: var(--text-muted); border-color: var(--border-strong); background: var(--surface-2); }

/* Riwayat transaksi */
.tx-list, .admin-tx-list, .pm-list { list-style: none; margin: 0; padding: 0; }
.tx { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.tx:last-child { border-bottom: 0; }
.tx__main { display: flex; gap: 12px; align-items: center; min-width: 0; }
.tx__info { display: grid; min-width: 0; }
.tx__info small { font-size: 12px; }
.tx__icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; }
.tx__icon .icon { width: 18px; height: 18px; }
.tx__icon--deposit { background: rgba(38, 166, 154, .12); color: var(--up); }
.tx__icon--withdraw { background: rgba(239, 83, 80, .12); color: var(--down); }
.tx__side { display: grid; justify-items: end; gap: 4px; }
.tx__amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx__amount--deposit { color: var(--up); }
.tx__amount--withdraw { color: var(--text); }
.tx__extra { grid-column: 1 / -1; display: grid; gap: 6px; padding-left: 48px; }
.tx__note { font-size: 13px; color: var(--text-muted); padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.tx__actions { display: flex; gap: 16px; flex-wrap: wrap; }
.tx__actions form { margin: 0; }

.empty-state { display: grid; justify-items: center; gap: 10px; padding: 40px 20px; color: var(--text-muted); text-align: center; }
.empty-state .icon { width: 32px; height: 32px; color: var(--text-faint); }

.stats--row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.stat__value--muted { color: var(--text-muted); font-size: 20px !important; }

/* Admin: metode pembayaran */
.pm { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.pm:last-child { border-bottom: 0; }
.pm.is-inactive > :not(.pm__actions) { opacity: .55; }
.pm.is-editing { background: rgba(227, 38, 45, .06); box-shadow: inset 3px 0 var(--brand); }
.pm__thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.pm__info { display: grid; min-width: 0; }
.pm__info small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 4px; }
.pm__actions form { margin: 0; }
.pm__actions .icon-btn { width: 38px; height: 38px; }
.pm__actions .icon { width: 18px; height: 18px; }

/* Admin: pengguna */
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.user-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.login-mini { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.login-mini__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.login-mini__title { margin: 0; font-size: 14px; font-weight: 700; }
.login-mini__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.login-mini__list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.login-mini__list li span:nth-child(2) { grid-column: 2; grid-row: 1 / 3; align-self: center; text-align: right; }
.login-mini__list li span:nth-child(3) { grid-column: 1; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.card__head--toolbar { flex-wrap: wrap; gap: 12px; }
.filters--inline { margin-left: auto; }

.login-list { list-style: none; margin: 0; padding: 0; }
.login-item {
  display: grid;
  gap: 8px 12px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  grid-template-columns: 1fr;
}
.login-item:last-child { border-bottom: 0; }
.login-item__user { display: grid; min-width: 0; }
.login-item__user small { font-size: 12px; }
.login-item__when { font-size: 13px; color: var(--text-muted); }
.login-item__ip { font-size: 13px; }
.login-item__device { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-item__links { display: flex; justify-content: flex-end; }

@media (min-width: 720px) {
  .login-item {
    grid-template-columns: minmax(140px, 1.1fr) minmax(150px, 1fr) 120px minmax(120px, 1fr) auto;
  }
  .login-item__user { grid-column: auto; }
}

/* Admin: transaksi */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: 14px; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { color: var(--text); background: var(--surface-3); }
.tab__count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--border-strong); font-size: 11px; line-height: 18px; text-align: center; }
.tab.is-active .tab__count { background: var(--brand); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .input { width: auto; }
.filters input[type="search"] { min-width: 200px; }

.admin-tx { display: grid; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.admin-tx:last-child { border-bottom: 0; }
.admin-tx.is-pending { box-shadow: inset 3px 0 var(--warn); }
.admin-tx__head { display: flex; align-items: center; gap: 12px; }
.admin-tx__title { display: grid; flex: 1; min-width: 0; }
.admin-tx__title small { font-size: 12px; }
.admin-tx__amount { display: grid; justify-items: end; gap: 4px; }
.admin-tx__amount .tx__amount { font-size: 18px; }
.admin-tx__body { display: grid; gap: 12px; }
.receipt { position: relative; display: block; width: 140px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); background: #fff; }
.receipt img { width: 100%; height: 140px; object-fit: cover; }
.receipt span { position: absolute; inset: auto 0 0; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 12px; font-weight: 600; }
.receipt span .icon { width: 14px; height: 14px; }
.receipt:hover { border-color: var(--brand); }
.admin-tx__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-tx__actions .input { flex: 1 1 240px; }

/* Responsif */
@media (max-width: 639px) {
  .page-head__stat { text-align: left; }
  .kv > div, .kv--compact > div { grid-template-columns: 1fr; gap: 2px; }
  .tx { padding: 14px 16px; }
  .tx__extra { padding-left: 0; }
  .pm { padding: 14px 16px; }
  .admin-tx { padding: 16px; }
  .admin-tx__head { flex-wrap: wrap; }
  .admin-tx__amount { justify-items: start; width: 100%; grid-template-columns: auto auto; justify-content: space-between; align-items: center; padding-left: 48px; }
  .admin-tx__actions .btn-row { width: 100%; }
  .admin-tx__actions .btn { flex: 1; }
  .filters, .filters .input, .filters input[type="search"] { width: 100%; min-width: 0; }
  .page-title { font-size: 21px; }
}
@media (min-width: 900px) {
  .pay-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .admin-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); }
  .admin-layout > :last-child { position: sticky; top: calc(var(--topbar-h) + 24px); }
  .admin-tx__body { grid-template-columns: 1fr auto; align-items: start; }
  .pm { grid-template-columns: auto 1fr auto auto; }
  .pm__actions { grid-column: auto; }
}

/* =========================================================================
   10. Portfolio & charts
   ========================================================================= */
:root {
  /* Slot kategorikal (dark) — divalidasi pada --surface (#0f1319): CVD ΔE 27.5, kontras ≥ 3:1 */
  --viz-1: #338ced;   /* saldo / deposit */
  --viz-2: #e76624;   /* withdraw */
}

.kpi-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--gap); }
.kpi {
  display: grid; gap: 4px; align-content: start;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  min-width: 0;
}
.kpi__label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.kpi__value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi__sub { font-size: 12px; color: var(--text-muted); }
.kpi--hero { grid-column: 1 / -1; padding: 20px; background: linear-gradient(135deg, rgba(227, 38, 45, .14), transparent 60%), var(--surface); }
.kpi--hero .kpi__value { font-size: 34px; letter-spacing: -.01em; }

.portfolio-grid { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.portfolio-grid .card__head { min-height: 64px; }

.viz { position: relative; min-height: 220px; }
.viz-svg { display: block; overflow: visible; touch-action: pan-y; }
.viz-svg:focus { outline: none; }
.viz-svg:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.viz-grid { stroke: var(--border); stroke-width: 1; }
.viz-baseline { stroke: var(--border-strong); stroke-width: 1; }
.viz-axis { fill: var(--text-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-dot--focus { pointer-events: none; }
.viz-crosshair { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.viz-hit { fill: transparent; cursor: pointer; }
.viz-hit:hover, .viz-hit:focus { fill: rgba(255, 255, 255, .04); outline: none; }
.viz-tip {
  position: absolute; z-index: 5; pointer-events: none;
  display: grid; gap: 2px; min-width: 140px;
  padding: 8px 10px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.viz-tip strong { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

.viz-table { margin-top: 12px; font-size: 13px; }
.viz-table summary { cursor: pointer; color: var(--text-muted); font-weight: 600; width: fit-content; }
.viz-table summary:hover { color: var(--text); }
.viz-table table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.viz-table th, .viz-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.viz-table th { color: var(--text-faint); font-weight: 600; font-size: 12px; }
.viz-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viz-table[open] { max-height: 340px; overflow: auto; }

.card__foot { display: flex; gap: 20px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* Ponsel: kotak terakhir melebar agar tidak tersisa sendirian */
@media (max-width: 719px) {
  .kpi-grid .kpi:last-child:nth-child(even) { grid-column: 1 / -1; }
}
@media (min-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi--hero { grid-column: auto; }
}
@media (min-width: 1280px) {
  .kpi-grid { grid-template-columns: 1.6fr repeat(5, minmax(0, 1fr)); }
  .kpi--hero { grid-column: auto; }
  .portfolio-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
}
