/* ============================================================
   Catatan Keuangan — stylesheet
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f7fdfb;
  --card: #ffffff;
  --card-2: #fbfcff;
  --border: #e5e8f0;
  --border-strong: #d3d8e6;
  --text: #111827;
  --text-2: #344054;
  --muted: #6b7280;
  --income: #0f9f6e;
  --income-soft: #e6f8f1;
  --expense: #e5484d;
  --expense-soft: #fdeceb;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 28px -16px rgba(16, 24, 40, .22);
  --radius: 18px;
  --radius-sm: 12px;
  --ring: 0 0 0 4px rgba(79, 70, 229, .16);
  --topbar-h: 66px;
}

[data-theme="dark"] {
  --bg: #080c15;
  --bg-grad-1: #0d1324;
  --bg-grad-2: #0a1417;
  --card: #101725;
  --card-2: #131b2b;
  --border: #1e293b;
  --border-strong: #2b3a52;
  --text: #e8edf6;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --income: #34d399;
  --income-soft: rgba(52, 211, 153, .12);
  --expense: #fb7185;
  --expense-soft: rgba(251, 113, 133, .12);
  --brand: #818cf8;
  --brand-2: #a78bfa;
  --brand-soft: rgba(129, 140, 248, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -20px rgba(0, 0, 0, .8);
  --ring: 0 0 0 4px rgba(129, 140, 248, .22);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 12% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-grad-2), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

svg { display: block; }

::selection { background: var(--brand); color: #fff; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 22px;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; line-height: 1.5; }

/* ---------------- Boot ---------------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: var(--bg);
  z-index: 100;
}
.boot p { color: var(--muted); font-size: 13px; }
.boot-mark {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 26px;
  box-shadow: 0 12px 30px -10px rgba(79, 70, 229, .7);
}
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Brand ---------------- */
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .8);
}
.brand-mark img,
.boot-mark img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  border-radius: 6px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong {
  font-size: 15px;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 22px; }
.brand-lg .brand-text strong { font-size: 17px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(79, 70, 229, .9);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost {
  background: var(--card);
  border-color: var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--border-strong); background: var(--card-2); }
.btn.danger { color: var(--expense); }
.btn.danger:hover { background: var(--expense-soft); border-color: transparent; }
.btn.sm { padding: 8px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; padding: 12px 16px; }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  transition: background-color .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--card-2); border-color: var(--border-strong); }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  max-width: 190px;
}
.chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--income);
  box-shadow: 0 0 0 3px var(--income-soft);
  flex: 0 0 auto;
}
.chip.local .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-admin {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.chip-admin svg { flex: 0 0 auto; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 100%;
  min-width: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

/* ---------------- Layout ---------------- */
.app { padding-top: var(--topbar-h); }

.main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 40px;
}

/* ---------------- Periode ---------------- */
.period {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 13px;
}
[data-theme="dark"] .seg { background: #0b1220; }
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 9px;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.period-nav { display: flex; align-items: center; gap: 8px; }
.period-label { display: flex; flex-direction: column; min-width: 168px; text-align: center; }
.period-label strong { font-size: 14.5px; letter-spacing: -.01em; }
.period-label span { font-size: 11.5px; color: var(--muted); }

/* ---------------- Stats ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  padding: 16px 17px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 118px;
  position: relative;
  overflow: hidden;
}
.stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}
.stat-ico {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  flex: 0 0 auto;
}
.stat-ico.income { background: var(--income-soft); color: var(--income); }
.stat-ico.expense { background: var(--expense-soft); color: var(--expense); }
.stat-ico.neutral { background: var(--bg); color: var(--muted); }
[data-theme="dark"] .stat-ico.neutral { background: #0b1220; }
.stat-value {
  font-size: clamp(19px, 2.1vw, 23px);
  font-weight: 750;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: auto;
}
.stat-value.income { color: var(--income); }
.stat-value.expense { color: var(--expense); }
.stat-sub { font-size: 11.5px; color: var(--muted); }

.stat-balance {
  background: linear-gradient(140deg, #4f46e5 0%, #6d28d9 55%, #9333ea 100%);
  border-color: transparent;
  color: #fff;
}
.stat-balance .stat-top { color: rgba(255, 255, 255, .82); }
.stat-balance .stat-ico { background: rgba(255, 255, 255, .18); color: #fff; }
.stat-balance .stat-sub { color: rgba(255, 255, 255, .75); }
.stat-balance::after {
  content: "";
  position: absolute;
  width: 170px; height: 170px;
  right: -60px; top: -70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}

/* ---------------- Chart ---------------- */
.chart-card { padding: 18px 18px 10px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; letter-spacing: -.01em; }
.card-head p { margin-top: 3px; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 500; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.dot.income { background: var(--income); }
.dot.expense { background: var(--expense); }

.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0 4px;
  scrollbar-width: thin;
}
.chart-scroll::-webkit-scrollbar { height: 8px; }
.chart-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
.chart-scroll svg { display: block; }

/* ---------------- List ---------------- */
.list-card { padding: 18px; }
.list-head { align-items: center; margin-bottom: 14px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-2);
  color: var(--muted);
  min-width: 210px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--text);
}
.search input::placeholder { color: var(--muted); }

select#type-filter {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-2);
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--text-2);
  outline: none;
}

.tx-list-plain { list-style: none; margin: 0; padding: 0; }

.day-group + .day-group { margin-top: 16px; }
.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 8px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 4px;
}
.day-head span:first-child {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.day-total { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-total.income { color: var(--income); }
.day-total.expense { color: var(--expense); }

.tx {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 6px;
  border-radius: 12px;
  transition: background-color .13s;
}
.tx:hover { background: var(--card-2); }
[data-theme="dark"] .tx:hover { background: #0d1421; }

.tx-ico {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 11px;
}
.tx-ico.income { background: var(--income-soft); color: var(--income); }
.tx-ico.expense { background: var(--expense-soft); color: var(--expense); }

.tx-main { flex: 1 1 auto; min-width: 0; }
.tx-cat {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-amount {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tx-amount.income { color: var(--income); }
.tx-amount.expense { color: var(--expense); }

.tx-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .13s; }
.tx:hover .tx-actions, .tx:focus-within .tx-actions { opacity: 1; }
.tx-actions button {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
}
.tx-actions button:hover { background: var(--bg); color: var(--text); }
.tx-actions button.del:hover { color: var(--expense); background: var(--expense-soft); }
[data-theme="dark"] .tx-actions button:hover { background: #1a2436; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 46px 20px;
  text-align: center;
}
.empty-ico {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 18px;
  background: var(--brand-soft);
  color: var(--brand);
}
.empty h3 { font-size: 14.5px; }
.empty p { font-size: 12.5px; color: var(--muted); max-width: 300px; }

/* ---------------- Footer ---------------- */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 6px 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------------- FAB ---------------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: 22px;
  width: 54px; height: 54px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 16px 30px -12px rgba(79, 70, 229, .9);
  z-index: 45;
}

/* ---------------- Auth ---------------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  position: relative;
  overflow: hidden;
}
.auth-bg { position: absolute; inset: 0; pointer-events: none; }
.auth-bg span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
}
.auth-bg span:nth-child(1) { width: 380px; height: 380px; background: #818cf8; top: -120px; left: -90px; }
.auth-bg span:nth-child(2) { width: 320px; height: 320px; background: #34d399; bottom: -120px; right: -80px; opacity: .3; }
.auth-bg span:nth-child(3) { width: 260px; height: 260px; background: #f472b6; top: 40%; right: 20%; opacity: .18; }

.auth-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 30px 70px -30px rgba(16, 24, 40, .35);
  backdrop-filter: blur(18px);
}
.auth-card h1 { font-size: 21px; margin-top: 24px; letter-spacing: -.02em; }
.auth-card > .muted { margin-top: 6px; font-size: 13px; line-height: 1.55; }
.seg-auth { display: flex; width: 100%; margin: 20px 0 16px; }
.seg-auth button { flex: 1; }

.auth-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  text-align: center;
}

/* ---------------- Fields ---------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 14px;
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); font-weight: 400; }
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
.field input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
}
[data-theme="dark"] .field input[type="date"] { color-scheme: dark; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field-amount .amount-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: 13px;
  padding: 0 14px;
  transition: border-color .15s, box-shadow .15s;
}
.field-amount .amount-wrap:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.field-amount .amount-wrap span { font-size: 15px; font-weight: 700; color: var(--muted); }
.field-amount input {
  border: 0;
  background: transparent;
  box-shadow: none !important;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.02em;
  padding: 12px 8px;
  font-variant-numeric: tabular-nums;
}
.field-amount input:focus { border: 0; }

.form-error {
  background: var(--expense-soft);
  color: var(--expense);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 10px;
  margin: 0 0 12px;
}
.form-error.ok {
  background: var(--income-soft);
  color: var(--income);
}

/* ---------------- Dialog ---------------- */
.dialog {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .5);
}
.dialog::backdrop {
  background: rgba(10, 14, 25, .5);
  backdrop-filter: blur(4px);
}
.dialog[open] { animation: pop .18s ease-out; }
.dialog-wide { width: min(880px, calc(100vw - 28px)); }
.dialog-inner { padding: 22px; }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.dialog form { padding: 22px; }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.dialog-head h2 { font-size: 16.5px; letter-spacing: -.015em; }

.seg-type { display: flex; width: 100%; margin-bottom: 16px; }
.seg-type button { flex: 1; }
.seg-type button[data-type="income"].active {
  color: var(--income);
  box-shadow: var(--shadow-sm);
  background: var(--income-soft);
}
.seg-type button[data-type="expense"].active {
  color: var(--expense);
  box-shadow: var(--shadow-sm);
  background: var(--expense-soft);
}

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.spacer { flex: 1 1 auto; }

/* ---------------- Panel superadmin ---------------- */
.admin-content { margin-top: 16px; }
.admin-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table tbody tr:hover { background: var(--card-2); }
[data-theme="dark"] .admin-table tbody tr:hover { background: #0d1421; }
.admin-table tfoot td { border-bottom: 0; padding-top: 12px; font-weight: 700; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .income { color: var(--income); }
.admin-table .expense { color: var(--expense); }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user-text { display: flex; flex-direction: column; line-height: 1.3; }
.avatar {
  width: 32px; height: 32px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
[data-theme="dark"] .badge { background: #0b1220; }
.badge.admin { background: var(--brand-soft); color: var(--brand); }
.badge.admin-role { background: #e0f2fe; color: #0369a1; }
[data-theme="dark"] .badge.admin-role { background: #082f49; color: #7dd3fc; }
.admin-note { margin-top: 12px; }

/* ---------------- Tambah akun (superadmin) ---------------- */
.auth-note { margin-top: 14px; text-align: center; line-height: 1.55; }
.admin-create {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-2);
}
[data-theme="dark"] .admin-create { background: #0b1220; }
.admin-create h3 { margin: 0 0 4px; font-size: 13px; }
.admin-create-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.admin-create-form .field { margin: 0; }
.admin-create-form .field input,
.admin-create-form .field select { width: 100%; }
.pass-row { display: flex; gap: 6px; }
.pass-row input { flex: 1 1 auto; min-width: 0; }
.pass-row .btn { flex: 0 0 auto; }
.admin-create-form .form-error,
.admin-create-form #create-submit { grid-column: 1 / -1; justify-self: start; }
.admin-create-form .form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.field-full { grid-column: 1 / -1; }
.logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#logo-preview { width: 48px; height: 48px; border-radius: 14px; font-size: 20px; }
.logo-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-pick { cursor: pointer; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.logo-field .tiny { font-weight: 500; }
@media (max-width: 560px) {
  .admin-create-form { grid-template-columns: 1fr; }
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 18px);
  background: #111827;
  color: #f9fafb;
  font-size: 13px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 80;
  max-width: min(440px, calc(100vw - 32px));
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b42318; }
.toast.success { background: #067647; }
.toast.warn { background: #b54708; }
[data-theme="dark"] .toast { background: #1f2937; }
[data-theme="dark"] .toast.error { background: #b42318; }
[data-theme="dark"] .toast.success { background: #067647; }
[data-theme="dark"] .toast.warn { background: #b54708; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }

  .container { padding: 0 14px; }
  .topbar-inner { gap: 8px; }
  .brand { gap: 9px; }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 14px; }

  .topbar-actions { gap: 6px; }
  .icon-btn { width: 34px; height: 34px; }
  .chip { padding: 6px 9px; max-width: none; }
  #admin-btn,
  #mode-chip {
    width: 34px; height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
    flex: 0 0 auto;
  }
  #admin-btn span,
  #mode-chip #mode-text { display: none; }

  .hide-sm { display: none; }
  .fab { display: grid; }
  .main { padding-top: 14px; gap: 14px; padding-bottom: 90px; }

  .period { padding: 10px; gap: 10px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .period-nav { flex: 1 1 100%; justify-content: space-between; }
  .period-label { flex: 1; min-width: 0; }

  .chart-card, .list-card { padding: 14px; }
  .chart-card .card-head { gap: 8px; }
  .list-head { flex-direction: column; align-items: stretch; }
  .toolbar { width: 100%; }
  .search { flex: 1 1 100%; min-width: 0; }
  select#type-filter { flex: 1; }

  .tx-actions { opacity: 1; }
  .tx { gap: 10px; }
  .tx-amount { font-size: 13px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .stat { min-height: 104px; padding: 14px; }
  .auth-card { padding: 22px; border-radius: 20px; }
  .toast { bottom: 88px; }

  .dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
  }
  .dialog form,
  .dialog-inner { padding: 16px; }
  .dialog-head { margin-bottom: 12px; }
  .dialog-foot { flex-wrap: wrap; }
  .dialog-foot .spacer { display: none; }
  .dialog-foot .btn { flex: 1 1 auto; }
  .admin-scroll { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 420px) {
  :root { --topbar-h: 56px; }

  .container { padding: 0 12px; }
  .topbar-actions { gap: 5px; }
  .icon-btn,
  #admin-btn,
  #mode-chip { width: 32px; height: 32px; }
  .brand-text strong { font-size: 13.5px; }
  .stat-value { font-size: 17px; }
  .tx-ico { width: 34px; height: 34px; }
  .dialog {
    width: calc(100vw - 14px);
    max-height: calc(100vh - 14px);
    max-height: calc(100dvh - 14px);
  }
}

@media (max-width: 380px) {
  .brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
