:root {
  /* Palet sama dengan aplikasi desktop (bridge/ui/index.html) */
  --bg: #050914;
  --bg-2: #0a1124;
  --surface: rgba(15, 24, 48, .62);
  --surface-solid: #0d1630;
  --surface-2: rgba(30, 47, 92, .45);
  --line: rgba(96, 140, 255, .16);
  --line-2: rgba(96, 140, 255, .28);
  --text: #e8eeff;
  --text-2: #a9b6d8;
  --text-3: #6f7da3;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, .14);
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --purple: #8b5cf6;
  --grad-blue: linear-gradient(135deg, #2563eb 0%, #22d3ee 100%);
  --grad-red: linear-gradient(135deg, #e11d48 0%, #fb7185 100%);
  --up: #4ade80;
  --up-dim: rgba(34, 197, 94, .12);
  --down: #f87171;
  --down-dim: rgba(248, 113, 113, .12);
  --info: #60a5fa;
  --warn: #fbbf24;
  --radius: 14px;
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
/* Scrollbar tipis untuk halaman, tabel, log, modal */
/* Chrome/Edge 121+ mengabaikan ::-webkit-scrollbar kalau scrollbar-width diset,
   jadi scrollbar-width/color hanya untuk browser tanpa ::-webkit-scrollbar (Firefox). */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: rgba(96, 140, 255, .28) transparent; }
}
::-webkit-scrollbar { width: 2px; height: 2px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(96, 140, 255, .35); border-radius: 1px; }
::-webkit-scrollbar-thumb:hover { background: rgba(96, 140, 255, .5); }
::-webkit-scrollbar-corner { background: transparent; }
body {
  background:
    radial-gradient(900px 500px at 78% -10%, rgba(37, 99, 235, .22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(139, 92, 246, .16), transparent 60%),
    linear-gradient(180deg, #060b19 0%, #050914 100%) fixed;
  background-color: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.sidebar {
  background: linear-gradient(180deg, rgba(8, 14, 32, .92), rgba(6, 10, 24, .96));
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
}
/* Logo & kotak user tetap di tempat; hanya daftar menu yang di-scroll */
.sidebar > .brand, .sidebar > .sidebar-foot { flex: none; }
.sidebar > .nav {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -8px; padding: 0 8px 8px;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 18px), transparent);
}
.sidebar > .nav::-webkit-scrollbar { width: 1px; }
@supports not selector(::-webkit-scrollbar) {
  .sidebar > .nav { scrollbar-width: thin; scrollbar-color: rgba(96, 140, 255, .25) transparent; }
}
.sidebar > .nav::-webkit-scrollbar-thumb { background: rgba(96, 140, 255, .35); border-radius: 1px; }
.sidebar > .nav::-webkit-scrollbar-thumb:hover { background: rgba(96, 140, 255, .45); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(34, 211, 238, .35)); }
.brand-name { font: 600 17px/1.2 var(--display); letter-spacing: .02em; background: linear-gradient(90deg, #e8eeff 40%, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
.nav-label { font-size: 11px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; color: var(--text-2); border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(59, 130, 246, .08); color: var(--text); }
.nav a.active {
  color: #fff; background: linear-gradient(90deg, rgba(37, 99, 235, .95), rgba(37, 99, 235, .55));
  border-color: rgba(96, 165, 250, .5); box-shadow: 0 0 22px rgba(37, 99, 235, .4), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.nav svg { width: 16px; height: 16px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-foot .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--text-2); }
.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover { color: var(--down, #f05a5a); }
.who { font-size: 13px; }
.who small { display: block; color: var(--text-3); }

main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font: 600 24px/1.2 var(--display); margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .03);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font: 600 15px var(--display); }
.card-body { padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.stat { padding: 14px 16px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-family: var(--mono); font-size: 20px; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 12px; color: var(--text-3); margin-left: 4px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
/* Tabel panjang (mis. Audit Log): scroll di dalam kartu, judul kolom tetap terlihat */
.table-wrap.scroll-y th { z-index: 1; }
.table-wrap.scroll-y { overflow: auto; max-height: calc(100vh - 180px); max-height: calc(100dvh - 180px); }
@media (max-width: 900px) { .table-wrap.scroll-y { max-height: calc(100dvh - 240px); } }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; background: var(--bg-2); position: sticky; top: 0; }
td.r, th.r { text-align: right; }
td.trunc { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
th, td { padding: 10px 12px; }
tbody tr:hover { background: rgba(59, 130, 246, .05); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
.empty { padding: 36px 16px; text-align: center; color: var(--text-3); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: #dbe7ff;
  font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, filter .15s;
}
.btn:hover { background: rgba(37, 99, 235, .28); border-color: rgba(96, 165, 250, .55); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad-blue); border-color: rgba(125, 211, 252, .5); color: #fff; font-weight: 600; box-shadow: 0 6px 22px rgba(37, 99, 235, .4); }
.btn-primary:hover { background: var(--grad-blue); border-color: rgba(125, 211, 252, .7); filter: brightness(1.08); }
.btn-buy { background: linear-gradient(135deg, #16a34a, #4ade80); border-color: rgba(134, 239, 172, .45); color: #04140a; font-weight: 600; box-shadow: 0 6px 20px rgba(34, 197, 94, .3); }
.btn-sell { background: var(--grad-red); border-color: rgba(251, 113, 133, .45); color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(225, 29, 72, .3); }
.btn-buy:hover, .btn-sell:hover { filter: brightness(1.08); }
.btn-danger { color: var(--down); }
.btn-danger:hover { border-color: var(--down); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(59, 130, 246, .1); color: var(--text); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-2); }
.field .hint, .card-body > .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  height: 38px; padding: 0 12px; border-radius: 9px;
  background: rgba(5, 10, 24, .7); border: 1px solid var(--line-2); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
select.input option { background: var(--surface-solid); color: var(--text); }
textarea.input { height: auto; padding: 10px 11px; }
.input:focus { border-color: rgba(34, 211, 238, .7); box-shadow: 0 0 0 3px rgba(34, 211, 238, .14); }
.input.num { font-family: var(--mono); }
/* Input file: tombol "Pilih File" senada dengan .btn-sm, teks nama file rata tengah */
input[type="file"].input { padding: 0 5px; line-height: 36px; color: var(--text-2); font-size: 13px; cursor: pointer; }
input[type="file"].input::file-selector-button {
  height: 28px; margin-right: 12px; padding: 0 12px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: #dbe7ff;
  font: inherit; font-weight: 500; transition: background .15s, border-color .15s;
}
input[type="file"].input:hover::file-selector-button { background: rgba(37, 99, 235, .28); border-color: rgba(96, 165, 250, .55); }
.file-types { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; color: var(--text-3); }
.file-types .mono { color: var(--text-2); word-break: break-all; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 40px; height: 22px; border-radius: 11px; background: #1e293b; border: 1px solid var(--line-2); position: relative; transition: background .15s; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #94a3b8; transition: transform .15s; }
.switch input:checked + .track { background: var(--grad-blue); border-color: transparent; box-shadow: 0 0 12px rgba(37, 99, 235, .5); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }

.seg { display: inline-flex; background: rgba(5, 10, 24, .6); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; color: var(--text-2); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--grad-blue); color: #fff; font-weight: 600; box-shadow: 0 0 12px rgba(37, 99, 235, .45); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: #fff; border-bottom-color: var(--cyan); text-shadow: 0 0 12px rgba(34, 211, 238, .45); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { color: var(--up); background: var(--up-dim); border-color: transparent; }
.badge.bad { color: var(--down); background: var(--down-dim); border-color: transparent; }
.badge.warn { color: var(--warn); background: #f0a33a1c; border-color: transparent; }
.badge.info { color: var(--info); background: #6aa7ff1c; border-color: transparent; }
.badge.accent { color: var(--accent); background: var(--accent-dim); border-color: transparent; }
.tag-buy { color: var(--up); font-weight: 600; }
.tag-sell { color: var(--down); font-weight: 600; }

/* ---------- quote ---------- */
.quote { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quote .q { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line-2); background: rgba(5, 10, 24, .5); }
.quote .q span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.quote .q strong { font-family: var(--mono); font-size: 20px; font-weight: 500; }
.quote .q.bid strong { color: var(--down); }
.quote .q.ask strong { color: var(--up); }

.signal-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.signal-card:last-child { border-bottom: 0; }
.rsi-meter { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--up-dim), var(--surface-2) 40%, var(--surface-2) 60%, var(--down-dim)); width: 220px; }
.rsi-meter .zone { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.rsi-meter .dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px var(--bg); }

.log-box { font-family: var(--mono); font-size: 12px; line-height: 1.55; background: rgba(2, 6, 16, .75); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-all; color: #c7d2ee; }
.log-box .w { color: var(--warn); }
.log-box .e { color: var(--down); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 480px at 50% -12%, rgba(37, 99, 235, .25), transparent 65%); }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card h1 { font: 600 22px var(--display); margin: 18px 0 4px; }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 5, 14, .72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .12s ease-out; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface-solid); }
.modal .card-body { display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--surface-solid); border: 1px solid var(--line-2); border-left: 3px solid var(--cyan); border-radius: 10px; padding: 10px 14px; max-width: 380px; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); animation: fade .15s ease-out; }
.toast.ok { border-left-color: var(--up); }
.toast.err { border-left-color: var(--down); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--text-3); }

.mobile-top { display: none; }

@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .plan-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(2, 5, 14, .7); }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(6, 11, 25, .92); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30; }
  main { padding: 20px 16px 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .rsi-meter { width: 140px; }
}

/* ---------- sewa ---------- */
/* ---- Sewa MT5 ---- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head:first-child { margin-top: 0; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.section-head .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.invoice-alert { border-color: rgba(56, 189, 248, .45); background: linear-gradient(0deg, var(--accent-dim), var(--accent-dim)), var(--surface); margin-bottom: 8px; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; }
.step { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-right: 1px solid var(--line); }
.step:last-child { border-right: 0; }
.step-n { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-dim); color: var(--accent); font: 600 13px var(--mono); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 320px)); gap: 14px; }
.plan-card { transition: border-color .15s, transform .15s; }
.plan-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.plan-card.hl { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim), 0 10px 30px rgba(37, 99, 235, .25); }
.plan-name { font-weight: 600; font-size: 16px; }
.plan-price { font-size: 30px; font-weight: 600; line-height: 1.1; }
.plan-price span { font: 400 13px var(--sans); color: var(--text-3); margin-left: 6px; }
.plan-feats { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; align-content: start; flex: 1; font-size: 13px; color: var(--text-2); }
.plan-feats li { position: relative; padding-left: 22px; }
.plan-feats li::before { content: ''; position: absolute; left: 2px; top: 5px; width: 10px; height: 5px; border-left: 2px solid var(--up); border-bottom: 2px solid var(--up); transform: rotate(-45deg); }
.plan-cta { height: 40px; width: 100%; justify-content: center; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.slot-card.off { opacity: .7; }
.slot-acc { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: rgba(5, 10, 24, .5); border-radius: 8px; font-size: 13px; }
.slot-acc a { color: var(--accent); font-weight: 600; font-size: 15px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--grad-blue); border-radius: 3px; box-shadow: 0 0 10px rgba(34, 211, 238, .5); }
.nav a .badge { font-size: 11px; }

/* ---------- live ---------- */
.badge.live-dot::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---- Profil */
.profile { display: flex; flex-direction: column; gap: 16px; }
.pf-hero { padding: 0; overflow: hidden; }
.pf-id { display: flex; align-items: center; gap: 16px; padding: 20px; }
.pf-avatar { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(37, 99, 235, .35), rgba(5, 10, 24, .9) 72%); border: 1px solid rgba(96, 165, 250, .4); box-shadow: 0 0 18px rgba(37, 99, 235, .4); color: var(--accent); font-weight: 700; font-size: 20px; }
.pf-name { font-size: 18px; font-weight: 600; line-height: 1.3; }
.pf-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.pf-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.pf-stat { padding: 14px 20px; display: flex; flex-direction: column; gap: 4px; }
.pf-stat + .pf-stat { border-left: 1px solid var(--line); }
.pf-stat span { font-size: 12px; color: var(--text-2); }
.pf-stat b { font-size: 20px; font-weight: 500; }
.pf-stat small { font-size: 13px; color: var(--text-3); }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.kv-list { margin: 0; padding: 4px 16px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); font-size: 13px; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .pf-grid { grid-template-columns: 1fr; }
  .pf-stats { grid-template-columns: repeat(2, 1fr); }
  .pf-stat:nth-child(3) { border-left: 0; }
  .pf-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---- Authenticator (2FA) */
.tfa { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tfa-text { flex: 1 1 380px; color: var(--text-2); line-height: 1.55; }
.tfa-steps { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); line-height: 1.7; }
.tfa-qr { display: grid; place-items: center; margin: 0 auto 12px; width: 216px; height: 216px; background: #fff; border-radius: 10px; }
.tfa-qr img { display: block; }
.tfa-secret { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; letter-spacing: .04em; overflow-wrap: anywhere; }
.otp-input { font-size: 20px; letter-spacing: .3em; text-align: center; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.recovery-grid span { text-align: center; padding: 4px 0; font-size: 15px; letter-spacing: .05em; }

/* ---- Admin: Authenticator */
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.av-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.av-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.av-logo { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--accent); font-weight: 700; }
.av-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.av-name b, .av-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-name span { font-size: 12px; color: var(--text-3); }
.av-menu { display: flex; gap: 2px; opacity: .55; transition: opacity .15s; }
.av-card:hover .av-menu { opacity: 1; }
.av-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.av-code { all: unset; cursor: pointer; font-size: 30px; font-weight: 600; letter-spacing: .06em; color: var(--accent); border-radius: 6px; padding: 2px 4px; margin-left: -4px; transition: background .15s, color .15s; }
.av-code:hover { background: var(--surface-2); }
.av-code.copied { color: var(--up, #3fb950); }
.av-low .av-code { color: var(--down, #f05a5a); }
.av-ring { width: 40px; height: 40px; flex-shrink: 0; }
.av-ring circle { fill: none; stroke-width: 3.5; }
.av-ring .bg { stroke: var(--line-2); }
.av-ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.av-low .av-ring .fg { stroke: var(--down, #f05a5a); }
.av-ring text { fill: var(--text-2); font-size: 12px; }
.av-next { font-size: 12px; }
.av-drop { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 18px; text-align: center; margin-bottom: 4px; }
.av-drop.ok { border-color: var(--up, #3fb950); }
.av-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--text-3); font-size: 12px; }
.av-or::before, .av-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.av-adv summary { cursor: pointer; font-size: 13px; margin-bottom: 4px; }

/* ---- Detail invoice */
.inv-back { display: inline-block; color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.inv-back:hover { color: var(--accent); }
.inv-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.inv-grid > * { min-width: 0; }
.inv-doc { overflow: hidden; }
.inv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(100deg, rgba(37, 99, 235, .16), transparent 60%); }
.inv-total-top { text-align: right; }
.inv-total-top span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.inv-total-top b { font-size: 24px; font-weight: 600; background: var(--grad-blue); -webkit-background-clip: text; background-clip: text; color: transparent; }
.inv-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.inv-meta > div { padding: 14px 22px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inv-meta > div + div { border-left: 1px solid var(--line); }
.inv-meta > div > span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.inv-meta b { font-weight: 600; overflow-wrap: anywhere; }
.inv-meta small { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.inv-items th { background: transparent; }
.inv-items td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }
.inv-sum { margin-left: auto; max-width: 340px; padding: 6px 22px 18px; display: grid; gap: 8px; font-size: 13.5px; }
.inv-sum > div { display: flex; justify-content: space-between; gap: 16px; color: var(--text-2); }
.inv-sum .inv-sum-total { padding-top: 10px; border-top: 1px solid var(--line-2); color: var(--text); font-weight: 600; font-size: 16px; }
.inv-sum .inv-sum-total .num { color: var(--accent); }
.inv-notes { display: grid; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.inv-notes span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.inv-amount { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, .3); background: linear-gradient(180deg, rgba(37, 99, 235, .14), rgba(5, 10, 24, .4)); }
.inv-amount span { width: 100%; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.inv-amount b { font-size: 26px; font-weight: 600; color: var(--accent); margin-right: auto; }
.inv-qr { align-self: center; background: #fff; border-radius: 12px; padding: 12px; line-height: 0; }
.inv-qr img { display: block; max-width: 100%; height: auto; }
.inv-paid { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 10px; border-radius: 12px; border: 1px solid rgba(34, 197, 94, .35); background: var(--up-dim); }
.inv-paid b { color: var(--up); font-size: 17px; }
.inv-paid-ic { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--up); background: rgba(34, 197, 94, .15); box-shadow: 0 0 16px rgba(34, 197, 94, .3); }
.inv-paid-ic svg { width: 22px; height: 22px; }
.btn svg { width: 15px; height: 15px; }

.timeline { list-style: none; margin: 0; padding: 16px 22px 18px; }
.timeline li { position: relative; padding: 0 0 18px 30px; display: flex; flex-direction: column; gap: 2px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--bg); }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 20px; bottom: 2px; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li span { font-size: 12.5px; color: var(--text-2); }
.timeline li.todo b, .timeline li.off b { color: var(--text-3); font-weight: 500; }
.timeline li.done::before { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px rgba(34, 211, 238, .6); }
.timeline li.done::after { background: linear-gradient(180deg, var(--cyan), var(--line)); }
.timeline li.now::before { border-color: var(--warn); box-shadow: 0 0 10px rgba(251, 191, 36, .5); animation: pulse 1.6s ease-in-out infinite; }
.timeline li.now b { color: var(--warn); }
.timeline li.bad::before { background: var(--down); border-color: var(--down); }
.timeline li.bad b { color: var(--down); }

@media (max-width: 1100px) {
  .inv-grid { grid-template-columns: minmax(0, 1fr); }
  .inv-grid.inv-open > :last-child { order: -1; } /* belum dibayar: QRIS di atas */
}
@media (max-width: 640px) {
  .inv-meta { grid-template-columns: minmax(0, 1fr); }
  .inv-meta > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .inv-head { flex-direction: column; align-items: flex-start; }
  .inv-total-top { text-align: left; }
  .inv-sum { max-width: none; }
}

/* ---- Audit log: detail sebagai label + nilai */
td.audit-detail { white-space: normal; min-width: 260px; max-width: 620px; }
.adets { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.adet { display: inline-flex; align-items: baseline; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  background: rgba(5, 10, 24, .45); border: 1px solid var(--line); color: var(--text); overflow-wrap: anywhere; max-width: 100%; }
.adet b { font-weight: 500; color: var(--text-3); white-space: nowrap; }
.adet-more { margin-top: 4px; font-size: 12px; }
.adet-more summary { cursor: pointer; color: var(--accent); width: max-content; }
.adet-more[open] summary { margin-bottom: 4px; }

/* ---- Bonus referal */
.ref-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; overflow: hidden; margin-bottom: 18px;
  background: linear-gradient(110deg, rgba(37, 99, 235, .22), rgba(139, 92, 246, .10) 55%, rgba(15, 24, 48, .62)); border-color: rgba(96, 165, 250, .3); }
.ref-hero-main { padding: 22px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ref-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; }
.ref-code { font-size: 34px; font-weight: 600; letter-spacing: .14em; background: var(--grad-blue); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, .25)); }
.ref-link { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ref-link .input { flex: 1 1 240px; min-width: 0; font-size: 12.5px; }
.ref-steps { list-style: none; margin: 0; padding: 18px 22px; display: grid; gap: 14px; counter-reset: rs; border-left: 1px solid var(--line); background: rgba(5, 10, 24, .3); }
.ref-steps li { position: relative; padding-left: 40px; display: flex; flex-direction: column; gap: 2px; counter-increment: rs; }
.ref-steps li::before { content: counter(rs); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 600 13px var(--mono); color: #fff; background: var(--grad-blue); box-shadow: 0 0 12px rgba(37, 99, 235, .5); }
.ref-steps li span { font-size: 13px; color: var(--text-2); }
.ref-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.3fr); gap: 14px; align-items: start; }
.ref-grid > *, .ref-hero > * { min-width: 0; }
.nav a .badge.warn { font-size: 11px; }
@media (max-width: 1000px) {
  .ref-hero, .ref-grid { grid-template-columns: minmax(0, 1fr); }
  .ref-steps { border-left: 0; border-top: 1px solid var(--line); }
  .ref-code { font-size: 28px; }
}

/* Cetak invoice: hanya dokumen, warna terang */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; color: #111; }
  .sidebar, .mobile-top, .no-print, #toasts, #rent-banner, .inv-back { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .inv-grid { display: block; }
  .card { background: #fff !important; border-color: #ddd !important; box-shadow: none !important; backdrop-filter: none !important; }
  .inv-head { background: none; border-color: #ddd; }
  .inv-meta, .inv-meta > div + div, .inv-notes, th, td { border-color: #ddd !important; }
  .inv-total-top b, .brand-name { background: none; -webkit-text-fill-color: #111; color: #111; }
  .inv-sum .inv-sum-total .num { color: #111; }
  .muted, .faint, .inv-meta small, .inv-meta > div > span, .inv-sum > div, .inv-notes, th { color: #555 !important; }
  .page-head h1 { color: #111; }
  .page-head .sub { color: #555; }
}
