@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --bg:       #09090d;
  --bg2:      #0f0f15;
  --bg3:      #15151e;
  --card:     #1a1a24;
  --card2:    #1f1f2e;
  --border:   #252535;
  --border2:  #2e2e42;
  --accent:   #7c5cfc;
  --accent-h: #9b7dfd;
  --accent-s: rgba(124,92,252,.12);
  --text:     #eeeaf8;
  --text2:    #9993b4;
  --text3:    #5c5878;
  --success:  #2ecc8a;
  --warning:  #f0a52e;
  --danger:   #e85555;
  --info:     #3db8e8;
  --font:     'Syne', sans-serif;
  --mono:     'DM Mono', monospace;
  --radius:   10px;
  --radius-lg:16px;
  --nav-h:    100px; /* row1:52px + row2:44px + borders */
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; min-height: 100vh; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: .95rem; font-weight: 600; }
p  { color: var(--text2); }
a  { color: var(--accent-h); text-decoration: none; }
a:hover { color: var(--text); }

/* ── TOPNAV 2 BARIS ── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

/* Baris 1: logo + saldo + user */
.topnav-row1 {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}
.topnav-logo {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; flex-shrink: 0;
}
.topnav-logo img { width: 26px; height: 26px; object-fit: contain; border-radius: 6px; }
.topnav-logo span { font-size: .95rem; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.topnav-right {
  display: flex; align-items: center; gap: .75rem;
}
.topnav-saldo {
  background: var(--accent-s);
  border: 1px solid rgba(124,92,252,.25);
  border-radius: var(--radius);
  padding: .3rem .85rem;
  font-size: .82rem; font-weight: 700;
  color: var(--accent-h); font-family: var(--mono);
  cursor: pointer;
}
.topnav-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer;
  transition: all .15s;
}
.topnav-icon-btn:hover { color: var(--text); border-color: var(--border2); }
.topnav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-s);
  border: 1px solid rgba(124,92,252,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: var(--accent-h);
  cursor: pointer;
}

/* Baris 2: menu navigasi */
.topnav-row2 {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: .15rem;
  overflow-x: auto;
}
.topnav-row2::-webkit-scrollbar { display: none; }
.topnav-link {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: .84rem; font-weight: 600;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap; flex-shrink: 0;
}
.topnav-link:hover { background: var(--bg3); color: var(--text); }
.topnav-link.active { background: var(--accent); color: #fff; }
.topnav-link svg { flex-shrink: 0; }

/* Dropdown user */
.topnav-user { position: relative; }
.topnav-dropdown {
  position: absolute; top: calc(100% + .5rem); right: 0;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: .5rem;
  min-width: 170px; display: none; z-index: 300;
}
.topnav-user.open .topnav-dropdown { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .85rem; border-radius: var(--radius);
  color: var(--text2); font-size: .84rem; font-weight: 500;
  text-decoration: none; transition: all .15s;
  cursor: pointer; border: none; background: none;
  width: 100%; font-family: var(--font);
}
.dropdown-item:hover { background: var(--bg3); color: var(--text); }
.dropdown-item.danger:hover { background: rgba(232,85,85,.1); color: var(--danger); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: .35rem 0; }

/* Mobile hamburger */
.nav-hamburger { display: none; background: none; border: none; color: var(--text2); cursor: pointer; padding: .25rem; }
.mobile-menu { display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; background: var(--bg2); border-bottom: 1px solid var(--border); padding: .75rem 1rem; z-index: 199; flex-direction: column; gap: .25rem; }
.mobile-menu.open { display: flex; }
.mobile-menu .topnav-link { width: 100%; }

/* ── MAIN CONTENT ── */
.main { padding-top: var(--nav-h); min-height: 100vh; }
.content { padding: 1.75rem 1.5rem; max-width: 1200px; margin: 0 auto; }

/* ── CARDS ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.card-title { font-size: .95rem; font-weight: 700; color: var(--text); }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.stat-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); margin-bottom: .5rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.stat-sub { font-size: .75rem; color: var(--text3); margin-top: .25rem; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1.25rem; border-radius: var(--radius); font-family: var(--font); font-size: .875rem; font-weight: 600; cursor: pointer; border: none; transition: all .15s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.btn-secondary:hover { color: var(--text); background: var(--card2); }
.btn-danger { background: rgba(232,85,85,.12); color: var(--danger); border: 1px solid rgba(232,85,85,.2); }
.btn-danger:hover { background: rgba(232,85,85,.2); }
.btn-success { background: rgba(46,204,138,.12); color: var(--success); border: 1px solid rgba(46,204,138,.2); }
.btn-success:hover { background: rgba(46,204,138,.2); }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); margin-bottom: .45rem; }
.form-control { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius); padding: .65rem .9rem; color: var(--text); font-family: var(--font); font-size: .9rem; outline: none; transition: border-color .15s; appearance: none; -webkit-appearance: none; }
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
.form-control:disabled { opacity: .5; cursor: not-allowed; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c5878' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
select.form-control option { background: var(--bg3); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: .78rem; color: var(--text3); margin-top: .35rem; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: .75rem 1rem; text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); white-space: nowrap; }
td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); color: var(--text); }
.td-mono { font-family: var(--mono); font-size: .82rem; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: .2rem .65rem; border-radius: 100px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.badge-pending  { background: rgba(240,165,46,.12); color: var(--warning); }
.badge-process  { background: rgba(61,184,232,.12); color: var(--info); }
.badge-success  { background: rgba(46,204,138,.12); color: var(--success); }
.badge-error    { background: rgba(232,85,85,.12); color: var(--danger); }
.badge-partial  { background: rgba(124,92,252,.12); color: var(--accent-h); }
.badge-active   { background: rgba(46,204,138,.12); color: var(--success); }
.badge-inactive { background: rgba(92,88,120,.12); color: var(--text3); }
.badge-admin    { background: rgba(240,165,46,.12); color: var(--warning); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); z-index: 500; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius-lg); width: 100%; max-width: 440px; padding: 1.75rem; position: relative; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 1.25rem; line-height: 1; padding: .25rem; }
.modal-close:hover { color: var(--text); }

/* ── ALERT ── */
.alert { padding: .85rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert-success { background: rgba(46,204,138,.1); border: 1px solid rgba(46,204,138,.2); color: var(--success); }
.alert-error   { background: rgba(232,85,85,.1); border: 1px solid rgba(232,85,85,.2); color: var(--danger); }
.alert-info    { background: rgba(61,184,232,.1); border: 1px solid rgba(61,184,232,.2); color: var(--info); }
.alert-warning { background: rgba(240,165,46,.1); border: 1px solid rgba(240,165,46,.2); color: var(--warning); }

/* ── TOAST ── */
#toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: var(--card2); border: 1px solid var(--border2); border-radius: var(--radius); padding: .85rem 1.25rem; font-size: .875rem; z-index: 9999; transform: translateY(80px); opacity: 0; transition: all .3s; max-width: 320px; pointer-events: none; }
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: rgba(46,204,138,.4); color: var(--success); }
#toast.error   { border-color: rgba(232,85,85,.4); color: var(--danger); }
#toast.info    { border-color: rgba(61,184,232,.4); color: var(--info); }

/* ── MISC ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text3); }
.empty-state h4 { color: var(--text2); margin-bottom: .5rem; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-title { margin-bottom: 1.5rem; }
.page-title h2 { margin-bottom: .25rem; }
.page-title p { font-size: .875rem; color: var(--text3); }
.tabs { display: flex; gap: .25rem; background: var(--bg3); padding: .3rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.tab-btn { flex: 1; padding: .5rem; border: none; border-radius: 8px; background: none; color: var(--text2); font-family: var(--font); font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.tab-btn.active { background: var(--card); color: var(--text); }
.search-bar { position: relative; }
.search-bar input { padding-left: 2.25rem; }
.search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.saldo-badge { background: var(--accent-s); border: 1px solid rgba(124,92,252,.25); border-radius: var(--radius); padding: .35rem .85rem; font-size: .82rem; font-weight: 700; color: var(--accent-h); font-family: var(--mono); }

/* ── MOBILE ── */
@media(max-width:768px){
  :root { --nav-h: 52px; }
  .topnav-row2 { display: none; }
  .nav-hamburger { display: flex; }
  .topnav-saldo { font-size: .75rem; padding: .25rem .65rem; }
  .content { padding: 1.25rem 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
}
