/* ================================================================
   DompetKu — Stylesheet
   Tema: indigo tepercaya + aksen emerald, tipografi tabular untuk angka.
   ================================================================ */
:root {
  --bg:            #f4f5fb;
  --surface:       #ffffff;
  --surface-2:     #f9fafc;
  --border:        #e6e8f0;
  --text:          #1a1d2e;
  --text-muted:    #6b7089;
  --primary:       #4f46e5;
  --primary-600:   #4338ca;
  --primary-050:   #eef0fe;
  --success:       #059669;
  --success-050:   #e7f7f0;
  --warning:       #d97706;
  --warning-050:   #fdf3e4;
  --danger:        #dc2626;
  --danger-050:    #fdeaea;
  --shadow:        0 1px 3px rgba(20, 22, 45, .06), 0 8px 24px rgba(20, 22, 45, .05);
  --radius:        14px;
  --radius-sm:     9px;
}

[data-theme="dark"] {
  --bg:            #0e1018;
  --surface:       #171a26;
  --surface-2:     #1e2130;
  --border:        #2a2e40;
  --text:          #e8eaf2;
  --text-muted:    #9297b0;
  --primary:       #7c7bf5;
  --primary-600:   #6366f1;
  --primary-050:   #23233c;
  --success:       #34d399;
  --success-050:   #143024;
  --warning:       #fbbf24;
  --warning-050:   #34260f;
  --danger:        #f87171;
  --danger-050:    #3a1717;
  --shadow:        0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------- Auth pages ------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 100% -10%, var(--primary-050), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px;
}
.auth-card .brand { margin-bottom: 22px; }

/* --------------------------- Brand ---------------------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.01em;
}
.brand .logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}

/* --------------------------- Layout --------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { padding: 0 8px 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-050); color: var(--primary); font-weight: 600; }
.nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav .nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700;
  padding: 16px 12px 6px; opacity: .7;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--text-muted);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-050); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.content { padding: 26px; max-width: 1180px; width: 100%; }

/* ------------------------- Balance card ----------------------- */
.balance-card {
  background: linear-gradient(135deg, var(--primary-600), var(--primary));
  border-radius: var(--radius);
  padding: 26px 28px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(79, 70, 229, .28);
}
.balance-card::after {
  content: "";
  position: absolute; right: -40px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}
.balance-card .label { font-size: 13px; opacity: .82; letter-spacing: .02em; }
.balance-card .amount {
  font-size: 38px; font-weight: 700; margin-top: 6px;
  letter-spacing: -.02em; position: relative;
}
.balance-card .sub { margin-top: 14px; font-size: 13px; opacity: .8; }

/* --------------------------- Grid ----------------------------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* --------------------------- Cards ---------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.card-body { padding: 20px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat .stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stat .stat-value { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat .stat-value.sm { font-size: 21px; }

/* --------------------------- Badges --------------------------- */
.badge {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  line-height: 1.4;
}
.badge-success { background: var(--success-050); color: var(--success); }
.badge-warning { background: var(--warning-050); color: var(--warning); }
.badge-danger  { background: var(--danger-050);  color: var(--danger); }
.badge-muted   { background: var(--surface-2);   color: var(--text-muted); }

/* --------------------------- Tables --------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 11px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-muted); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
.amount-in  { color: var(--success); font-weight: 600; }
.amount-out { color: var(--danger);  font-weight: 600; }

.empty {
  text-align: center; padding: 44px 20px; color: var(--text-muted);
}
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 10px; }

/* --------------------------- Forms ---------------------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13.5px; font-weight: 550;
  margin-bottom: 6px; color: var(--text);
}
.field .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-050);
}
textarea { resize: vertical; min-height: 74px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .15s, opacity .15s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); text-decoration: none; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; text-decoration: none; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; text-decoration: none; color: #fff; }
.btn-ghost {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* --------------------------- Alerts --------------------------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-050); color: var(--success); border-color: var(--success); }
.alert-danger  { background: var(--danger-050);  color: var(--danger);  border-color: var(--danger); }
.alert-info    { background: var(--primary-050); color: var(--primary); border-color: var(--primary); }

/* --------------------------- Misc ----------------------------- */
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.02em; }
.page-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 22px; }
.row-actions { display: flex; gap: 6px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 18px; } .mt-3 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.tag-account { font-size: 13px; color: var(--text-muted); }
.tag-account strong { color: var(--text); font-weight: 600; }

/* --------------------------- Mobile --------------------------- */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .menu-toggle { display: grid; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .backdrop {
    display: none; position: fixed; inset: 0; z-index: 39;
    background: rgba(0, 0, 0, .4);
  }
  .backdrop.show { display: block; }
}
