/* ============================================================
   PORTAL KAS NUANSA GRIYA FLAMBOYAN — Global Stylesheet
   ============================================================ */

:root {
  --bg: #F3F5EC;
  --surface: #FFFFFF;
  --surface-alt: #EAEEDE;
  --ink: #1E2A1F;
  --ink-soft: #57634F;
  --flame: #C1440E;
  --flame-dark: #8F3308;
  --leaf: #2F5233;
  --leaf-light: #DCE7DA;
  --gold: #B8842C;
  --border: #DCE1D2;
  --danger: #A5321B;
  --danger-bg: #F6E4DE;
  --ok: #2F5233;
  --ok-bg: #E1EADB;
  --warn: #7A5C10;
  --warn-bg: #FDF3D7;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30,42,31,.06), 0 8px 24px rgba(30,42,31,.05);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }
p { margin: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  line-height: 1.15;
}

/* ---------- LAYOUT ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(243,245,236,.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1120px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--flame);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
}
.nav-links a:hover { color: var(--ink); }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle svg { width: 24px; height: 24px; }

/* ---------- BUTTONS ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--flame); color: #fff; }
.btn-primary:hover { background: var(--flame-dark); }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--ink-soft); }
.btn-ghost { background: var(--surface-alt); color: var(--leaf); }
.btn-ghost:hover { background: var(--leaf-light); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f0c8be; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--flame);
  outline-offset: 2px;
}

/* ---------- HERO ---------- */
.hero { padding: 64px 0 48px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 48px;
  align-items: end;
}
.hero-eyebrow { color: var(--leaf); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.hero h1 { font-size: 42px; max-width: 15ch; letter-spacing: -.01em; }
.hero-sub { margin-top: 18px; color: var(--ink-soft); font-size: 16px; max-width: 46ch; }
.hero-updated { margin-top: 22px; font-size: 13px; color: var(--ink-soft); }

/* ---------- SALDO CARD ---------- */
.saldo-card {
  background: var(--leaf);
  color: #fff;
  border-radius: 16px;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.saldo-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.saldo-label { font-size: 14px; color: rgba(255,255,255,.75); font-weight: 500; }
.saldo-value {
  font-family: var(--font-display);
  font-size: 40px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.saldo-note { margin-top: 14px; font-size: 13px; color: rgba(255,255,255,.7); }

/* ---------- SECTION SHARED ---------- */
section { padding: 56px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 28px; }
.section-head .desc { color: var(--ink-soft); font-size: 15px; margin-top: 6px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ---------- DASHBOARD CARDS ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-label { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }
.card-value {
  font-family: var(--font-display);
  font-size: 26px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.card-value.pos { color: var(--leaf); }
.card-value.neg { color: var(--flame-dark); }

/* ---------- COMPARE BAR ---------- */
.compare {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.compare-title { font-size: 14px; color: var(--ink-soft); font-weight: 500; margin-bottom: 18px; }
.compare-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.compare-row:last-child { margin-bottom: 0; }
.compare-tag { width: 96px; font-size: 13.5px; font-weight: 600; flex-shrink: 0; }
.compare-track { flex: 1; background: var(--surface-alt); border-radius: 6px; height: 14px; overflow: hidden; }
.compare-fill { height: 100%; border-radius: 6px; transition: width .4s ease; }
.compare-fill.in { background: var(--leaf); }
.compare-fill.out { background: var(--flame); }
.compare-amt {
  width: 150px;
  text-align: right;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* ---------- TABLE ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters input[type="text"],
.filters select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.filters input[type="text"] { flex: 1; min-width: 200px; }
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbf7; }
td.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-row td { text-align: center; padding: 36px 16px; color: var(--ink-soft); }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  border-top: 1px solid var(--border);
}
.pager { display: flex; gap: 8px; }
.pager button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--ink);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager button:not(:disabled):hover { border-color: var(--ink-soft); }

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.in { background: var(--ok-bg); color: var(--ok); }
.badge.out { background: var(--danger-bg); color: var(--danger); }

/* ---------- FORM ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; color: var(--ink-soft); }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  transition: border-color .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--leaf);
}
.form-row textarea { resize: vertical; min-height: 90px; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 10px; display: none; }

/* ---------- KONTAK ---------- */
.kontak-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 20px; }
.wa-card {
  background: var(--leaf);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.wa-card h3 { font-size: 21px; margin-bottom: 10px; }
.wa-card p { color: rgba(255,255,255,.8); font-size: 14.5px; margin-bottom: 20px; }
.wa-btn { background: #fff; color: var(--leaf); align-self: flex-start; }
.wa-btn:hover { background: var(--leaf-light); }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ---------- FOOTER ---------- */
footer { border-top: 1px solid var(--border); padding: 32px 0; margin-top: 24px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

/* ---------- MODALS ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30,42,31,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  max-height: 90vh;
  overflow-y: auto;
}
.modal.wide { max-width: 520px; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-head h3 { font-size: 20px; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--ink-soft);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--surface-alt); }

/* ---------- PILLS ---------- */
.admin-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  color: var(--leaf);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
}
.warga-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--leaf-light);
  color: var(--leaf);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- BANNERS ---------- */
.setup-banner {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  margin-bottom: 24px;
  display: none;
  line-height: 1.5;
}
.setup-banner.show { display: block; }
.info-banner {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.success-banner {
  background: var(--ok-bg);
  color: var(--ok);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
}

/* ---------- ADMIN TABLE ACTIONS ---------- */
.action-btns { display: flex; gap: 6px; align-items: center; }

/* ---------- RIWAYAT ACTIONS ---------- */
.riwayat-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- TOAST ---------- */
#toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  max-width: 320px;
  animation: toastIn .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--leaf); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- LOGIN PAGE ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-brand .brand-mark { width: 40px; height: 40px; }
.login-brand .brand-mark svg { width: 20px; height: 20px; }
.login-title { font-size: 22px; margin-bottom: 6px; }
.login-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 28px; }

/* ---------- ADMIN PANEL EXTRAS ---------- */
.page-title-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}
.page-title-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title-inner h1 { font-size: 24px; }
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
}
.tab-btn {
  flex: 1;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.tab-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(30,42,31,.1); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .kontak-grid { grid-template-columns: 1fr; }
  .form-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: none;
    gap: 16px;
  }
  .nav-links.open { display: flex; }
  .menu-toggle { display: block; }
  .hero h1 { font-size: 32px; }
  .cards { grid-template-columns: 1fr; }
  .compare-tag { width: 80px; }
  .compare-amt { width: 110px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .tabs { flex-direction: column; }
  .form-grid2 { grid-template-columns: 1fr; }
}
