/* =====================================================
   PANEL EBONI SPACE — Galaxy Elegant Theme (v12)
   Class & ID sama dengan versi lama, jadi app.js tidak berubah.
===================================================== */

:root {
  --bg: #03030c;
  --glass: rgba(13, 15, 38, 0.58);
  --glass-strong: rgba(16, 18, 44, 0.86);
  --glass-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(190, 196, 255, 0.13);
  --line-strong: rgba(214, 218, 255, 0.26);

  --ink: #eef0ff;
  --ink-soft: #d5d8f5;
  --muted: #9298bf;

  --gold: #f4d58d;
  --gold-deep: #c9973f;
  --violet: #a78bfa;
  --fuchsia: #e879f9;
  --cyan: #67e8f9;
  --blue: #60a5fa;
  --mint: #5eead4;
  --rose: #fb7185;
  --amber: #fbbf24;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;

  --shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-display: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  color: #0b0b1d;
  background: var(--gold);
}

.hidden {
  display: none !important;
}

/* =====================================================
   GALAXY BACKGROUND
===================================================== */
.galaxy-bg {
  position: fixed;
  z-index: -3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 50% 120%, #140a33 0%, transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% -20%, #0b1233 0%, transparent 60%),
    var(--bg);
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}

.nebula-1 {
  top: -18%;
  left: -12%;
  width: 62vmax;
  height: 48vmax;
  background: radial-gradient(circle at 40% 40%, rgba(124, 58, 237, 0.55), rgba(76, 29, 149, 0.15) 55%, transparent 70%);
  animation: nebulaDrift1 38s ease-in-out infinite alternate;
}

.nebula-2 {
  right: -18%;
  bottom: -20%;
  width: 70vmax;
  height: 52vmax;
  background: radial-gradient(circle at 60% 55%, rgba(14, 165, 233, 0.42), rgba(30, 64, 175, 0.14) 55%, transparent 72%);
  animation: nebulaDrift2 46s ease-in-out infinite alternate;
}

.nebula-3 {
  top: 30%;
  left: 35%;
  width: 45vmax;
  height: 35vmax;
  opacity: 0.32;
  background: radial-gradient(circle, rgba(232, 121, 249, 0.45), rgba(190, 24, 93, 0.12) 55%, transparent 72%);
  animation: nebulaDrift3 54s ease-in-out infinite alternate;
}

.nebula-4 {
  top: 8%;
  right: 12%;
  width: 26vmax;
  height: 22vmax;
  opacity: 0.28;
  background: radial-gradient(circle, rgba(244, 213, 141, 0.45), transparent 70%);
  animation: nebulaDrift1 60s ease-in-out infinite alternate-reverse;
}

#galaxyCanvas {
  position: fixed;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.galaxy-vignette {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(2, 2, 10, 0.72) 100%);
}

@keyframes nebulaDrift1 {
  0% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  100% { transform: translate3d(8vw, 6vh, 0) scale(1.15) rotate(12deg); }
}

@keyframes nebulaDrift2 {
  0% { transform: translate3d(0, 0, 0) scale(1.05) rotate(0deg); }
  100% { transform: translate3d(-10vw, -8vh, 0) scale(0.92) rotate(-15deg); }
}

@keyframes nebulaDrift3 {
  0% { transform: translate3d(-6vw, 4vh, 0) scale(0.9); }
  100% { transform: translate3d(6vw, -6vh, 0) scale(1.2); }
}

/* =====================================================
   KEYFRAMES UMUM
===================================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  0% { opacity: 0; transform: translate3d(0, 24px, 0) scale(0.94); }
  100% { opacity: 1; transform: none; }
}

@keyframes shimmer {
  from { transform: translateX(-120%) skewX(-18deg); }
  to { transform: translateX(320%) skewX(-18deg); }
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes orbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 213, 141, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(244, 213, 141, 0); }
}

@keyframes rippleOut {
  from { opacity: 0.45; transform: translate(-50%, -50%) scale(0); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

@keyframes spinBorder {
  to { --angle: 360deg; }
}

@keyframes valueFlash {
  0% { text-shadow: 0 0 0 transparent; }
  30% { text-shadow: 0 0 18px var(--accent, var(--gold)); }
  100% { text-shadow: 0 0 0 transparent; }
}

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Reveal saat scroll (kelas ditambahkan oleh fx.js) */
.fx-reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0) scale(0.985);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.fx-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* =====================================================
   FORM ELEMENT DASAR
===================================================== */
input,
select,
textarea,
button {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.3s ease, background 0.3s ease, filter 0.3s ease, border-color 0.3s ease;
}

button:active {
  transform: scale(0.965);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.4);
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--ink);
  background: rgba(8, 10, 28, 0.62);
  transition: border-color 0.25s ease, box-shadow 0.3s ease, background 0.25s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #6c7199;
}

select option {
  color: var(--ink);
  background: #10122b;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(214, 218, 255, 0.4);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(244, 213, 141, 0.75);
  background: rgba(12, 14, 36, 0.9);
  box-shadow: 0 0 0 4px rgba(244, 213, 141, 0.12), 0 0 24px rgba(167, 139, 250, 0.18);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.4;
}

/* =====================================================
   TOMBOL
===================================================== */
.btn-primary,
.btn-secondary,
.btn-danger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 700;
  letter-spacing: 0.1px;
  white-space: nowrap;
  isolation: isolate;
}

.btn-primary {
  color: #1a1206;
  background: linear-gradient(120deg, #f7e2a8, var(--gold) 35%, var(--gold-deep) 70%, #f7e2a8);
  background-size: 220% 100%;
  box-shadow: 0 10px 28px -8px rgba(244, 213, 141, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  animation: gradientFlow 6s linear infinite;
}

.btn-primary::after,
.btn-danger::after,
.btn-secondary::after {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  width: 35%;
  height: 100%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shimmer 3.6s ease-in-out infinite;
}

.btn-secondary::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  animation-duration: 5s;
}

.btn-primary:hover {
  box-shadow: 0 16px 36px -8px rgba(244, 213, 141, 0.7), 0 0 26px rgba(244, 213, 141, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
}

.btn-secondary {
  color: var(--ink);
  border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(103, 232, 249, 0.1));
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow: 0 10px 28px -10px rgba(167, 139, 250, 0.6);
  transform: translateY(-2px);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #be123c, var(--rose) 60%, #f9a8d4);
  box-shadow: 0 10px 28px -8px rgba(251, 113, 133, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 16px 34px -8px rgba(251, 113, 133, 0.75);
  transform: translateY(-2px);
}

.btn-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon:hover {
  border-color: rgba(244, 213, 141, 0.6);
  color: var(--gold);
  background: rgba(244, 213, 141, 0.08);
  transform: rotate(90deg);
}

#logoutBtn:hover {
  transform: translateX(2px);
}

.btn-mini {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
}

.btn-mini i {
  color: var(--gold);
  transition: transform 0.35s var(--ease-spring);
}

.btn-mini:hover {
  border-color: rgba(244, 213, 141, 0.55);
  color: #fff;
  background: rgba(244, 213, 141, 0.09);
  transform: translateY(-1px);
}

.btn-mini:hover i {
  transform: scale(1.2) rotate(-8deg);
}

.btn-action {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.btn-edit:hover {
  border-color: rgba(96, 165, 250, 0.7);
  color: #fff;
  background: linear-gradient(135deg, #2563eb, var(--blue));
  box-shadow: 0 6px 18px -6px rgba(96, 165, 250, 0.8);
  transform: translateY(-2px);
}

.btn-delete:hover {
  border-color: rgba(251, 113, 133, 0.7);
  color: #fff;
  background: linear-gradient(135deg, #be123c, var(--rose));
  box-shadow: 0 6px 18px -6px rgba(251, 113, 133, 0.8);
  transform: translateY(-2px);
}

.btn-pay-loan {
  border-color: rgba(94, 234, 212, 0.45);
  color: var(--mint);
  background: rgba(94, 234, 212, 0.1);
  animation: pulseGlow 2.6s ease-in-out infinite;
}

.btn-pay-loan:hover {
  color: #04211c;
  background: linear-gradient(135deg, #34d399, var(--mint));
  transform: translateY(-2px);
}

.btn-monthly-detail {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
}

.btn-monthly-detail:hover {
  border-color: rgba(167, 139, 250, 0.6);
  color: #fff;
  background: rgba(167, 139, 250, 0.16);
  transform: translateY(-1px);
}

.btn-monthly-download i {
  color: var(--gold);
}

/* Efek ripple (span ditambahkan oleh fx.js) */
.fx-ripple {
  position: absolute;
  z-index: 0;
  width: 240%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent 60%);
  animation: rippleOut 0.7s var(--ease-out) forwards;
}

/* =====================================================
   LOGIN
===================================================== */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
}

#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}

.login-card {
  position: relative;
  width: min(100%, 420px);
  padding: 44px 34px 32px;
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(160deg, rgba(22, 24, 58, 0.72), rgba(8, 9, 26, 0.82));
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  animation: popIn 1s var(--ease-out) both;
}

.login-card::before {
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  content: "";
  background: conic-gradient(from var(--angle), transparent 0deg, rgba(244, 213, 141, 0.9) 60deg, transparent 120deg, rgba(167, 139, 250, 0.8) 220deg, transparent 280deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spinBorder 7s linear infinite;
  pointer-events: none;
}

.logo {
  position: relative;
}

.logo > i {
  position: relative;
  display: inline-flex;
  width: 84px;
  height: 84px;
  align-items: center;
  justify-content: center;
  margin: 0 0 22px;
  border-radius: 50%;
  color: #1a1206;
  font-size: 34px;
  background: radial-gradient(circle at 32% 28%, #fff4d1, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: 0 0 40px rgba(244, 213, 141, 0.45), 0 0 90px rgba(167, 139, 250, 0.35);
  animation: floatY 5s ease-in-out infinite;
}

.logo > i::before {
  position: relative;
  z-index: 1;
}

.logo > i::after {
  position: absolute;
  inset: -16px;
  border: 1px dashed rgba(244, 213, 141, 0.35);
  border-radius: 50%;
  content: "";
  animation: orbit 16s linear infinite;
}

.logo::before {
  position: absolute;
  top: 38px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  content: "";
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  transform-origin: 4px 4px;
  animation: orbitDot 6s linear infinite;
}

@keyframes orbitDot {
  from { transform: rotate(0deg) translateX(66px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(66px) rotate(-360deg); }
}

.logo h1 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  background: linear-gradient(100deg, #fff 20%, var(--gold) 45%, #fff 60%, var(--violet) 90%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientFlow 7s linear infinite;
}

.logo p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.pin-input-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 30px;
}

#pinInput {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 10px;
  text-align: center;
}

.error-msg {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--rose);
  font-size: 13px;
  font-weight: 600;
}

.error-msg:not(:empty) {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.login-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

/* =====================================================
   HEADER
===================================================== */
.header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) max(20px, calc((100vw - 1180px) / 2)) 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 7, 20, 0.62);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  animation: fadeIn 0.8s ease both;
}

.header::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--violet), var(--gold), var(--cyan), transparent);
  background-size: 200% 100%;
  animation: gradientFlow 6s linear infinite;
  opacity: 0.8;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left {
  min-width: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-left > i {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #1a1206;
  background: radial-gradient(circle at 30% 25%, #fff4d1, var(--gold) 50%, var(--gold-deep));
  box-shadow: 0 0 22px rgba(244, 213, 141, 0.35);
  transition: transform 0.6s var(--ease-spring);
}

.header-left:hover > i {
  transform: rotate(-12deg) scale(1.08);
}

.header-left span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  position: relative;
  padding: 6px 12px 6px 22px;
  border: 1px solid rgba(244, 213, 141, 0.4);
  border-radius: 999px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: rgba(244, 213, 141, 0.07);
}

.badge::before {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  content: "";
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* =====================================================
   LAYOUT
===================================================== */
.main-content {
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto calc(64px + var(--safe-bottom));
}

.main-content > section {
  margin-bottom: 34px;
}

.month-banner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  padding: 15px 20px;
  border: 1px solid rgba(244, 213, 141, 0.22);
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  background: linear-gradient(100deg, rgba(244, 213, 141, 0.1), rgba(167, 139, 250, 0.08) 50%, rgba(103, 232, 249, 0.06));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 22px !important;
}

.month-banner::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 100%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: shimmer 6s ease-in-out infinite;
  pointer-events: none;
}

.month-banner > i {
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(244, 213, 141, 0.6));
}

.month-banner strong {
  color: #fff;
  font-family: var(--font-display);
}

.month-banner small {
  margin-left: auto;
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2,
.form-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.section-heading h2 i,
.form-section h2 i {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(244, 213, 141, 0.3);
  border-radius: 11px;
  color: var(--gold);
  font-size: 15px;
  background: rgba(244, 213, 141, 0.07);
}

.section-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.heading-actions select {
  width: auto;
  min-width: 190px;
}

/* =====================================================
   KARTU ANGKA (TOTAL CARD)
===================================================== */
.totals-section,
.kas-grid,
.monthly-grid,
.expense-summary-grid {
  display: grid;
  gap: 16px;
}

.totals-section {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kas-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.monthly-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.expense-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.total-card {
  --accent: var(--gold);
  --accent-2: var(--violet);
  position: relative;
  display: flex;
  min-height: 122px;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 100% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 55%),
    linear-gradient(160deg, rgba(20, 22, 54, 0.72), rgba(8, 9, 26, 0.72));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  isolation: isolate;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s ease, border-color 0.5s ease;
}

/* Border berputar saat hover */
.total-card::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  content: "";
  background: conic-gradient(from var(--angle), transparent 0deg, var(--accent) 70deg, transparent 140deg, var(--accent-2) 230deg, transparent 300deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: spinBorder 4s linear infinite;
  pointer-events: none;
}

/* Spotlight mengikuti kursor */
.total-card::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: radial-gradient(260px circle at var(--mx, 80%) var(--my, 0%), color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.total-card:hover {
  border-color: transparent;
  box-shadow: 0 26px 60px -24px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow-soft);
  transform: translateY(-5px);
}

.total-card:hover::before,
.total-card:hover::after {
  opacity: 1;
}

.total-icon {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 16px;
  color: var(--accent);
  font-size: 19px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: 0 0 24px -4px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.6s var(--ease-spring);
}

.total-card:hover .total-icon {
  transform: rotate(-10deg) scale(1.1);
}

.total-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.total-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.total-value {
  overflow: hidden;
  color: #fff;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.total-value.fx-flash {
  animation: valueFlash 1.2s ease;
}

.total-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* Warna aksen tiap kartu */
.card-a { --accent: var(--violet); --accent-2: var(--fuchsia); }
.card-b { --accent: var(--cyan); --accent-2: var(--blue); }
.card-all { --accent: var(--gold); --accent-2: var(--amber); }
.card-gross { --accent: var(--fuchsia); --accent-2: var(--gold); }

.kas-saldo-card { --accent: var(--gold); --accent-2: var(--violet); }
.kas-masuk-card { --accent: var(--cyan); --accent-2: var(--mint); }
.kas-keluar-card { --accent: var(--rose); --accent-2: var(--fuchsia); }
.kas-loan-card { --accent: var(--mint); --accent-2: var(--cyan); }
.kas-loan-sisa-card { --accent: var(--amber); --accent-2: var(--rose); }

.expense-total-card { --accent: var(--rose); --accent-2: var(--amber); }
.net-income-card { --accent: var(--violet); --accent-2: var(--cyan); }

.monthly-income-card { --accent: var(--violet); --accent-2: var(--fuchsia); }
.monthly-kas-card { --accent: var(--cyan); --accent-2: var(--mint); }
.monthly-expense-card { --accent: var(--amber); --accent-2: var(--rose); }
.monthly-final-card { --accent: var(--gold); --accent-2: var(--violet); }

/* Saldo kas ditonjolkan */
.kas-saldo-card {
  border-color: rgba(244, 213, 141, 0.28);
}

.kas-saldo-card .total-value {
  background: linear-gradient(100deg, #fff, var(--gold) 50%, #fff);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientFlow 5s linear infinite;
}

/* =====================================================
   PANEL KACA (FORM & HISTORY)
===================================================== */
.form-section,
.history-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(18, 20, 50, 0.68), rgba(7, 8, 24, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.history-card::before,
.form-section::before {
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(244, 213, 141, 0.55), transparent);
  pointer-events: none;
}

.form-section {
  padding: 26px;
}

.form-section h2 {
  margin-bottom: 22px;
}

.history-card {
  padding: 22px;
}

.history-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.history-card h3 i {
  color: var(--gold);
}

.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.card-title-row h3 {
  padding-bottom: 0;
  border-bottom: 0;
}

.card-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.card-subtext {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* =====================================================
   FORM
===================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.full-width {
  grid-column: 1 / -1;
}

.durasi-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
}

.file-upload {
  position: relative;
}

.file-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-label {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border: 1px dashed rgba(244, 213, 141, 0.4);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  background: rgba(244, 213, 141, 0.04);
  transition: all 0.3s ease;
}

.file-label i {
  color: var(--gold);
  transition: transform 0.4s var(--ease-spring);
}

.file-label:hover {
  border-color: var(--gold);
  background: rgba(244, 213, 141, 0.09);
  box-shadow: 0 0 24px -8px rgba(244, 213, 141, 0.5);
}

.file-label:hover i {
  transform: translateY(-3px) scale(1.15);
}

.preview-container {
  position: relative;
  width: 160px;
  margin-top: 12px;
  animation: popIn 0.5s var(--ease-out);
}

.preview-container img {
  display: block;
  width: 160px;
  height: 112px;
  border: 1px solid rgba(244, 213, 141, 0.35);
  border-radius: 14px;
  object-fit: cover;
  box-shadow: var(--shadow-soft);
}

.btn-remove {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  background: var(--rose);
  box-shadow: 0 4px 14px -2px rgba(251, 113, 133, 0.7);
}

.btn-remove:hover {
  transform: rotate(90deg) scale(1.1);
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(103, 232, 249, 0.05);
}

.form-note i {
  margin-top: 3px;
  color: var(--cyan);
}

.btn-submit {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  font-size: 15px;
}

.readonly-box {
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  background: rgba(244, 213, 141, 0.05);
}

/* =====================================================
   LIST / HISTORY ITEM
===================================================== */
.history-list {
  min-height: 60px;
}

.empty {
  margin: 26px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.empty::before {
  display: block;
  margin-bottom: 6px;
  content: "✦";
  color: var(--gold);
  font-size: 16px;
  opacity: 0.6;
  animation: floatY 3s ease-in-out infinite;
}

.history-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 8px;
  border-bottom: 1px solid rgba(190, 196, 255, 0.07);
  border-radius: 12px;
  transition: background 0.3s ease, transform 0.35s var(--ease-out);
  animation: fadeUp 0.5s var(--ease-out) both;
}

.history-item:nth-child(1) { animation-delay: 0.02s; }
.history-item:nth-child(2) { animation-delay: 0.05s; }
.history-item:nth-child(3) { animation-delay: 0.08s; }
.history-item:nth-child(4) { animation-delay: 0.11s; }
.history-item:nth-child(5) { animation-delay: 0.14s; }
.history-item:nth-child(6) { animation-delay: 0.17s; }
.history-item:nth-child(7) { animation-delay: 0.2s; }
.history-item:nth-child(8) { animation-delay: 0.23s; }
.history-item:nth-child(9) { animation-delay: 0.26s; }
.history-item:nth-child(10) { animation-delay: 0.29s; }

.history-item:last-child {
  border-bottom: 0;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(3px);
}

.history-item img,
.no-photo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  object-fit: cover;
}

.no-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.rank-badge {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
}

.rank-badge.gold {
  border-color: rgba(244, 213, 141, 0.5);
  color: var(--gold);
  background: rgba(244, 213, 141, 0.1);
  box-shadow: 0 0 16px -4px rgba(244, 213, 141, 0.6);
}

.rank-badge.silver {
  border-color: rgba(203, 213, 225, 0.45);
  color: #e2e8f0;
  background: rgba(203, 213, 225, 0.08);
}

.rank-badge.bronze {
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--rose);
  background: rgba(251, 113, 133, 0.08);
}

.item-info {
  min-width: 0;
  flex: 1;
}

.nomor {
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.item-amount {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.kas-amount-col {
  flex-shrink: 0;
  text-align: right;
}

.kas-saldo-after {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kas-row-number {
  flex: 0 0 auto;
  min-width: 28px;
  color: #5d6290;
  font-family: var(--font-display);
  font-size: 11px;
  text-align: right;
}

.loan-progress {
  position: relative;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
}

.loan-progress span {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  border-radius: 99px;
  background: linear-gradient(90deg, #10b981, var(--mint), var(--cyan));
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.55);
  animation: growBar 1.2s var(--ease-out) both;
  transform-origin: left;
}

.loan-progress span::after {
  position: absolute;
  inset: 0;
  width: 40%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 2.4s ease-in-out infinite;
}

@keyframes growBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.loan-badge {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  vertical-align: middle;
}

.loan-badge.lunas {
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: var(--mint);
  background: rgba(94, 234, 212, 0.1);
}

.loan-badge.belum {
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--amber);
  background: rgba(251, 191, 36, 0.1);
}

/* Scroll list panjang */
.kas-history-scroll,
.history-sewa-list {
  max-height: 560px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 213, 141, 0.45) transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
}

.kas-history-scroll::-webkit-scrollbar,
.history-sewa-list::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
  width: 6px;
}

.kas-history-scroll::-webkit-scrollbar-thumb,
.history-sewa-list::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: linear-gradient(var(--gold), var(--violet));
}

.kas-history-scroll::-webkit-scrollbar-track,
.history-sewa-list::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track {
  background: transparent;
}

.history-sewa-list .history-item {
  flex-wrap: wrap;
}

.history-sewa-list .item-info {
  min-width: 120px;
}

.history-sewa-list .item-amount {
  min-width: 82px;
  margin-left: auto;
}

.history-sewa-list .item-actions {
  width: 100%;
  justify-content: flex-end;
  margin-top: 2px;
}

/* =====================================================
   MODAL
===================================================== */
.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 2, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.35s ease both;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 620px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  color: var(--ink);
  background: linear-gradient(165deg, rgba(20, 22, 56, 0.96), rgba(7, 8, 22, 0.97));
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.95), 0 0 60px -20px rgba(167, 139, 250, 0.35);
  animation: popIn 0.5s var(--ease-out) both;
}

.modal-card::before {
  position: absolute;
  top: 0;
  right: 10%;
  left: 10%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.modal-header h3 i {
  color: var(--gold);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.monthly-detail-modal-card {
  width: min(920px, calc(100vw - 28px));
}

.monthly-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 4px 0 24px;
}

.detail-summary-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  animation: fadeUp 0.5s var(--ease-out) both;
  transition: border-color 0.3s ease, transform 0.3s var(--ease-out);
}

.detail-summary-item:nth-child(2) { animation-delay: 0.05s; }
.detail-summary-item:nth-child(3) { animation-delay: 0.1s; }
.detail-summary-item:nth-child(4) { animation-delay: 0.15s; }
.detail-summary-item:nth-child(5) { animation-delay: 0.2s; }
.detail-summary-item:nth-child(6) { animation-delay: 0.25s; }
.detail-summary-item:nth-child(7) { animation-delay: 0.3s; }

.detail-summary-item:hover {
  border-color: rgba(244, 213, 141, 0.4);
  transform: translateY(-2px);
}

.detail-summary-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.detail-summary-item strong {
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.monthly-detail-content h4 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 26px 0 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 15px;
}

.monthly-detail-content h4 i {
  color: var(--gold);
}

.month-detail-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(190, 196, 255, 0.07);
  animation: fadeUp 0.45s var(--ease-out) both;
}

.month-detail-item:last-child {
  border-bottom: none;
}

.month-detail-left {
  min-width: 0;
  flex: 1;
}

.month-detail-title {
  display: block;
  color: #fff;
  font-weight: 700;
}

.month-detail-title i {
  color: var(--muted);
}

.month-detail-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.month-detail-right {
  flex-shrink: 0;
  text-align: right;
}

.month-detail-price {
  display: block;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
}

.month-detail-subprice {
  display: block;
  margin-top: 4px;
  color: var(--mint);
  font-size: 12px;
}

.month-detail-expense,
.month-detail-kas-out {
  color: var(--rose);
}

.month-detail-kas-in {
  color: var(--mint);
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 1060px) {
  .totals-section,
  .monthly-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .main-content {
    width: calc(100% - 24px);
    margin-top: 16px;
  }

  .main-content > section {
    margin-bottom: 28px;
  }

  .header {
    padding: calc(12px + var(--safe-top)) 14px 12px;
  }

  .header-left {
    font-size: 15px;
  }

  .header-left span {
    max-width: 170px;
  }

  .month-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .month-banner small {
    margin-left: 0;
  }

  .totals-section,
  .kas-grid,
  .expense-summary-grid,
  .history-grid,
  .monthly-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .totals-section,
  .kas-grid,
  .monthly-grid,
  .expense-summary-grid {
    gap: 12px;
  }

  .total-card {
    min-height: 96px;
    padding: 18px;
  }

  .total-icon {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    font-size: 17px;
  }

  .total-value {
    font-size: 21px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading h2,
  .form-section h2 {
    font-size: 19px;
  }

  .heading-actions {
    width: 100%;
  }

  .heading-actions > * {
    flex: 1 1 auto;
  }

  .heading-actions select {
    min-width: 0;
  }

  .form-section,
  .history-card {
    padding: 18px;
    border-radius: 20px;
  }

  .pin-input-group {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 40px 24px 28px;
  }

  .durasi-row {
    grid-template-columns: 1fr 96px;
  }

  .kas-row-number {
    display: none;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92dvh;
    padding: 22px 18px calc(22px + var(--safe-bottom));
    border-radius: 24px 24px 0 0;
    animation: sheetUp 0.5s var(--ease-out) both;
  }

  .modal-card::after {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    content: "";
    background: rgba(255, 255, 255, 0.2);
  }

  .monthly-detail-modal-card {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }

  .month-detail-item {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .history-item {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .history-item .item-info {
    flex: 1 1 0;
  }

  .history-item .item-actions {
    order: 5;
    width: 100%;
    justify-content: flex-end;
  }

  .history-item .btn-monthly-detail {
    order: 5;
  }

  #monthlyHistory .history-item .item-info {
    flex-basis: calc(100% - 160px);
  }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@media (hover: none) {
  .total-card:hover {
    transform: none;
  }

  .history-item:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fx-reveal {
    opacity: 1;
    transform: none;
  }
}

.modal-header .heading-actions {
  width: auto;
  flex-wrap: nowrap;
}

.modal-header .heading-actions > * {
  flex: 0 0 auto;
}

/* =====================================================
   v13 — TAMPILAN CLEAN MULTI-HALAMAN
   Home (ringkasan) · Sewa · Kas · Loan · Pengeluaran · Rekap
===================================================== */
.page[hidden] { display: none !important; }

.page > section,
.page > .page-head,
.page > .group-title {
  margin-bottom: 22px;
}

.page { animation: pageIn 0.45s var(--ease-out) both; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Header + menu atas ---------- */
.header {
  flex-wrap: wrap;
  gap: 10px 18px;
}

.top-nav {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.25s ease, background 0.25s ease;
}

.nav-link i { font-size: 13px; }

.nav-link:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }

.nav-link.active {
  color: #1a1206;
  background: linear-gradient(135deg, #fff1c9, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 6px 18px -8px rgba(244, 213, 141, 0.7);
}

/* ---------- Menu bawah (HP) ---------- */
.bottom-nav { display: none; }

/* ---------- Judul halaman ---------- */
.page-head h2,
.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.page-head h2 i,
.group-title i { color: var(--gold); }

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: none;
}

.group-title {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--muted);
}

/* ---------- Home: kartu utama ---------- */
.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dash-hero .hero-main {
  min-height: 150px;
}

.dash-hero .hero-main .total-value {
  font-size: clamp(28px, 4vw, 40px);
}

.dash-hero .hero-main .total-icon {
  width: 62px;
  height: 62px;
  flex-basis: 62px;
  font-size: 24px;
}

.card-gross { --accent: var(--mint); --accent-2: var(--cyan); }

/* Bar perbandingan Aldo vs Glena */
.share-card { padding: 20px 22px; }

.share-bar {
  display: flex;
  height: 14px;
  margin: 18px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.share-bar span { height: 100%; transition: width 0.9s var(--ease-out); }
.share-aldo { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.share-glena { background: linear-gradient(90deg, var(--violet), var(--fuchsia)); }

.share-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 18px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}

.share-legend b { margin-left: 4px; color: #fff; font-family: var(--font-display); }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
}

.dot-aldo { background: var(--cyan); }
.dot-glena { background: var(--fuchsia); }

/* Tombol pintas */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.quick-btn i { color: var(--gold); }

.quick-btn:hover {
  border-color: rgba(244, 213, 141, 0.45);
  background: rgba(244, 213, 141, 0.07);
  transform: translateY(-2px);
}

/* Grid kas / loan per halaman */
.kas-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kas-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.page .form-section .card-title-row {
  margin-bottom: 20px;
}

.page .form-section .card-title-row h2 { margin: 0; }

.page .form-section .modal-actions { margin-top: 18px; }

/* Lebih tenang: efek hover dikurangi supaya terasa clean */
.total-card:hover { transform: translateY(-2px); }
.total-card:hover .total-icon { transform: none; }

@media (max-width: 1060px) {
  .top-nav { order: 3; flex-basis: 100%; }
  .dash-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-hero .hero-main { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .top-nav { display: none; }

  .bottom-nav {
    position: fixed;
    z-index: 45;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 6px 4px calc(6px + var(--safe-bottom));
    border-top: 1px solid var(--line);
    background: rgba(6, 7, 20, 0.86);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
  }

  .bottom-nav .nav-link {
    flex-direction: column;
    gap: 4px;
    padding: 7px 2px;
    border-radius: 12px;
    font-size: 10px;
    letter-spacing: 0.2px;
  }

  .bottom-nav .nav-link i { font-size: 17px; }

  .bottom-nav .nav-link.active {
    color: var(--gold);
    background: rgba(244, 213, 141, 0.1);
    box-shadow: none;
  }

  .main-content {
    margin-bottom: calc(96px + var(--safe-bottom));
  }

  .dash-hero,
  .kas-grid-3,
  .kas-grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .dash-hero .hero-main { min-height: 120px; }

  .dash-hero .total-card:not(.hero-main),
  .page[data-page="dashboard"] .totals-section .total-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 0;
    padding: 16px;
  }

  .page[data-page="dashboard"] .totals-section {
    grid-template-columns: 1fr 1fr;
  }

  .dash-hero .total-card:not(.hero-main) .total-value,
  .page[data-page="dashboard"] .totals-section .total-value {
    font-size: 18px;
  }

  .kas-grid-3 .kas-saldo-card { grid-column: 1 / -1; }

  .kas-grid-2 .total-card,
  .kas-grid-3 .total-card:not(.kas-saldo-card) {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
  }

  .kas-grid-2 .total-value,
  .kas-grid-3 .total-card:not(.kas-saldo-card) .total-value { font-size: 18px; }

  .quick-actions { grid-template-columns: 1fr 1fr; }

  .page-head h2 { font-size: 19px; }

  .page .form-section .modal-actions { flex-direction: column-reverse; }
  .page .form-section .modal-actions button { width: 100%; }
}

/* ---------- Foto: kecil di daftar, penuh saat diketuk ---------- */
img.foto-thumb { cursor: zoom-in; }

.foto-viewer {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 2, 10, 0.9);
}

.foto-viewer.hidden { display: none; }

.foto-viewer-box { text-align: center; }

.foto-viewer-box img {
  max-width: min(92vw, 900px);
  max-height: 80vh;
  border-radius: 14px;
  object-fit: contain;
}

.foto-viewer-msg { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.foto-viewer-close { position: absolute; top: calc(16px + var(--safe-top)); right: 16px; }

/* =====================================================
   v15 — SEMUA KARTU TRANSPARAN (±10–15%) + BAYANGAN TIPIS
===================================================== */
.total-card,
.form-section,
.history-card,
.month-banner,
.quick-btn {
  background: rgba(16, 18, 44, 0.13);
  border-color: rgba(214, 218, 255, 0.14);
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* sentuhan warna aksen tetap ada, tapi sangat tipis */
.total-card {
  background:
    radial-gradient(120% 100% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 55%),
    rgba(16, 18, 44, 0.12);
}

.total-card:hover {
  border-color: rgba(214, 218, 255, 0.22);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.history-item,
.detail-summary-item {
  background: rgba(255, 255, 255, 0.03);
}

.bottom-nav,
.header {
  background: rgba(6, 7, 20, 0.55);
}

/* =====================================================
   v16 — PROGRAM BONUS JAM
===================================================== */
.loyalty-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(244, 213, 141, 0.3);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 12.5px;
  background: rgba(244, 213, 141, 0.06);
  text-transform: none;
}

.loyalty-hint.hidden { display: none; }
.loyalty-hint i { color: var(--gold); }
.loyalty-hint strong { color: var(--gold); }

.loyalty-search {
  min-width: 0;
  max-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
}

.loyalty-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
  max-height: 620px;
  overflow-y: auto;
}

.loyalty-row,
.loyalty-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.loyalty-summary { margin-bottom: 14px; }

.loyalty-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loyalty-head strong { font-size: 14px; }
.loyalty-head span { color: var(--muted); font-size: 12px; }

.loyalty-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.loyalty-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}

.loyalty-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}

.loyalty-bonus { color: var(--muted); }
.loyalty-bonus.has { color: var(--mint); }

.loyalty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-claim {
  border-color: rgba(94, 234, 212, 0.45) !important;
  color: var(--mint) !important;
}

#loyaltyModal textarea { width: 100%; text-transform: none; }

#loyaltyModalSend { text-decoration: none; }

@media (max-width: 720px) {
  .loyalty-search { max-width: none; width: 100%; }
  .loyalty-list { grid-template-columns: 1fr; }
}

/* ---------- Bot WA ---------- */
.bot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: none;
}

.bot-pill.on { color: var(--mint); border-color: rgba(94, 234, 212, 0.45); }
.bot-pill.off { color: var(--muted); }

.loyalty-toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 14px;
  color: var(--ink);
  font-size: 13px;
  text-transform: none;
  background: rgba(8, 10, 28, 0.95);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.loyalty-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================
   v18 — FOLLOW-UP WA
===================================================== */
.fu-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
}

.fu-field { margin-top: 14px; }
.fu-field textarea { text-transform: none; min-height: 190px; }
.fu-hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

.fu-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
}

.fu-check input,
.fu-row input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--gold);
}

.fu-image-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fu-image-box img {
  max-width: 140px;
  max-height: 140px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.fu-image-empty { color: var(--muted); font-size: 12.5px; }
.fu-image-empty i { color: var(--gold); margin-right: 4px; }

.fu-upload {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.fu-actions { display: flex; gap: 8px; margin-top: 14px; }

/* pratinjau gaya WhatsApp */
.fu-phone {
  margin-top: 14px;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 20% 10%, rgba(94, 234, 212, 0.06), transparent 40%),
    #0b141a;
  min-height: 220px;
}

.fu-bubble {
  position: relative;
  max-width: 92%;
  margin-left: auto;
  padding: 5px 5px 8px;
  border-radius: 10px 0 10px 10px;
  color: #e9edef;
  font-size: 13.5px;
  line-height: 1.45;
  text-transform: none;
  background: #005c4b;
  word-wrap: break-word;
}

.fu-bubble img {
  display: block;
  width: 100%;
  border-radius: 7px;
  margin-bottom: 4px;
}

.fu-bubble-text { padding: 3px 6px 0; }
.fu-bubble-text.muted { color: rgba(233, 237, 239, 0.55); font-style: italic; }

/* penerima */
.fu-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 18px;
  margin-top: 14px;
}

.fu-filters > label:first-child {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}

.fu-filters .fu-check { margin: 0 0 12px; }

.fu-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.fu-toolbar strong { color: var(--gold); }

.fu-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 10px;
  max-height: 460px;
  overflow-y: auto;
}

.fu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  text-transform: none;
}

.fu-row.off { opacity: 0.5; cursor: default; }

.fu-row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.fu-row-main strong {
  overflow: hidden;
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fu-row-main span { color: var(--muted); font-size: 11.5px; }

.fu-badge {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.fu-badge.stop { color: var(--rose); border-color: rgba(251, 113, 133, 0.45); }

.fu-send {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.fu-send .card-subtext { margin: 0; flex: 1; min-width: 200px; }

/* riwayat */
.fu-history { display: grid; gap: 10px; margin-top: 14px; }

.fu-hist {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  text-transform: none;
}

.fu-hist-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
}

.fu-hist-head i { color: var(--gold); }
.fu-hist-head span { color: var(--muted); font-size: 12px; }

.fu-hist-text {
  margin: 6px 0 8px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.fu-hist-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fu-hist-stats .ok { color: var(--mint); }
.fu-hist-stats .bad { color: var(--rose); }

@media (max-width: 720px) {
  .fu-grid { grid-template-columns: 1fr; }
  .fu-list { grid-template-columns: 1fr; max-height: 380px; }
  .fu-filters > label:first-child { min-width: 0; width: 100%; }
  .fu-send .btn-primary { width: 100%; justify-content: center; }
}

/* v19 — nomor manual */
.fu-manual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  margin-top: 10px;
}

.fu-manual textarea { text-transform: none; min-height: 110px; }

.fu-manual-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}

.fu-manual-side .btn-secondary { justify-content: center; margin-top: auto; }
#fuManualResult:empty { display: none; }

.fu-badge.manual { color: var(--cyan); border-color: rgba(103, 232, 249, 0.4); }

.fu-del {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.fu-del:hover { color: var(--rose); border-color: rgba(251, 113, 133, 0.45); }

@media (max-width: 720px) {
  .fu-manual { grid-template-columns: 1fr; }
}

.fu-hist-why { margin: 8px 0 0; color: var(--rose); font-size: 12px; line-height: 1.5; }
