* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    "Inter",
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #fafaf8;
  color: #0b0d12;
  transition: 0.25s;
  -webkit-font-smoothing: antialiased;
}
.glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(11, 13, 18, 0.08);
  box-shadow: 0 10px 30px -10px rgba(11, 13, 18, 0.08);
}
.bento {
  border-radius: 24px;
}
.btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:active {
  transform: scale(0.96);
}
.risk-red {
  border-left: 4px solid #ef4444;
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.03) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
}
.risk-yellow {
  border-left: 4px solid #eab308;
  background: linear-gradient(
    135deg,
    rgba(234, 179, 8, 0.03) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
}
.risk-green {
  border-left: 4px solid #22c55e;
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.03) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
}
.hidden-page {
  display: none !important;
}
.fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
input,
select,
textarea {
  outline: none;
  min-width: 0;
}
.loader {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(225, 29, 72, 0.2);
  border-top-color: #e11d48;
  border-radius: 999px;
  animation: spin 0.7s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.safe-lock {
  background: linear-gradient(
    135deg,
    rgba(15, 157, 119, 0.08) 0%,
    rgba(15, 157, 119, 0.01) 100%
  );
}
.food-gap {
  background: linear-gradient(
    135deg,
    rgba(217, 119, 6, 0.08) 0%,
    rgba(217, 119, 6, 0.01) 100%
  );
}
.food-empty {
  background: linear-gradient(
    135deg,
    rgba(225, 29, 72, 0.08) 0%,
    rgba(225, 29, 72, 0.01) 100%
  );
}
.food-neutral {
  background: linear-gradient(
    135deg,
    rgba(113, 113, 122, 0.08) 0%,
    rgba(113, 113, 122, 0.01) 100%
  );
}
.float-slow {
  animation: floatY 5s ease-in-out infinite;
}
@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
.modern-insight-card {
  background: linear-gradient(
    135deg,
    rgba(225, 29, 72, 0.03) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
  border: 1px solid rgba(225, 29, 72, 0.12);
  box-shadow: 0 16px 36px -10px rgba(225, 29, 72, 0.08);
}

/* --- UPLOAD DROPZONE: FIX OVERFLOW NAMA FILE PANJANG --- */
.upload-dropzone {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border: 1.5px dashed rgba(11, 13, 18, 0.18);
  border-radius: 0.75rem;
  background: #fafaf8;
  color: #6b7280;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.upload-dropzone:hover {
  border-color: #e11d48;
  background: rgba(225, 29, 72, 0.03);
  color: #e11d48;
}
.upload-dropzone i,
.upload-dropzone svg {
  flex: 0 0 auto;
}
.upload-dropzone .upload-dropzone-filename {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  text-align: left;
}

.scrollbar-none {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.loader-shimmer {
  background: linear-gradient(
    90deg,
    rgba(225, 29, 72, 0.1) 25%,
    rgba(225, 29, 72, 0.35) 50%,
    rgba(225, 29, 72, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: shimmerMove 1.4s ease-in-out infinite;
}
@keyframes shimmerMove {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
#globalLoader {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}
#globalLoader.visible {
  opacity: 1;
  visibility: visible;
}

/* --- DIPERBARUI: SPLASH SCREEN / LOADER CARD SUPAYA TIDAK SIKU & ADA BORDER --- */
#globalLoaderCard {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .loader-shimmer {
    animation: none;
  }
  #globalLoader,
  #globalLoaderCard {
    transition: none;
  }
}

/* --- FIX MUTLAK IKON, JUDUL, & KELURUSAN NILAI RUPIAH --- */
#foodCardLabel {
  display: flex !important;
  align-items: flex-start !important;
  gap: 6px !important;
  font-size: 10px !important;
  letter-spacing: -0.01em !important;
  line-height: 1.25 !important;
  min-height: 42px !important;
}

#foodCardLabel svg,
#foodCardLabel i {
  flex: 0 0 14px !important;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  margin-top: 2px !important;
  object-fit: contain;
}

#foodCardLabel span {
  flex: 1 1 auto !important;
  line-height: 1.25 !important;
}

#dashboardPage .grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 > div .uppercase {
  font-size: 10px !important;
  letter-spacing: -0.01em !important;
  line-height: 1.25 !important;
  min-height: 42px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 6px !important;
}

@media (max-width: 380px) {
  .glass.bento {
    padding: 1.1rem !important;
  }
  #profileForm input,
  #profileForm select,
  #cashflowModal input,
  #cashflowModal select,
  #debtModal input,
  #debtModal select,
  #basicNeedForm input,
  #basicNeedForm select {
    font-size: 16px;
  }
  .font-display.text-3xl {
    font-size: 1.6rem !important;
  }
}

@media (max-width: 340px) {
  #profileForm .grid.grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

#app,
#app * {
  min-width: 0;
}
img,
svg {
  max-width: 100%;
}

.skeleton-block {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    100deg,
    rgba(11, 13, 18, 0.055) 8%,
    rgba(11, 13, 18, 0.09) 18%,
    rgba(11, 13, 18, 0.055) 33%
  );
  background-size: 200% 100%;
  animation: skeletonSweep 1.6s ease-in-out infinite;
}
.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 40%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  animation: skeletonSweep 1.6s ease-in-out infinite;
  animation-delay: 0.05s;
}
@keyframes skeletonSweep {
  0% {
    background-position: 150% 0;
  }
  100% {
    background-position: -50% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-block,
  .skeleton-block::after {
    animation: none;
    background-position: 0 0;
  }
}

.skeleton-line {
  border-radius: 8px;
  height: 0.85em;
}

.is-refreshing {
  position: relative;
  transition: opacity 0.2s ease;
}
.is-refreshing::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(1px);
  pointer-events: none;
  animation: refreshPulse 1s ease-in-out infinite;
}
@keyframes refreshPulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.15;
  }
}

.bn-freq-btn {
  border-color: #e4e4e7;
  background: #ffffff;
  color: #71717a;
}
.bn-freq-btn:hover {
  border-color: #fda4af;
  background: #fff1f2;
}
.bn-freq-btn.bn-freq-active {
  border-color: #e11d48;
  background: #fff1f2;
  color: #be123c;
  box-shadow: 0 4px 14px -6px rgba(225, 29, 72, 0.35);
}
.bn-freq-btn .bn-freq-check {
  color: #e11d48;
}

#basicNeedsList {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.scroll-fade-y {
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 14px,
    black calc(100% - 14px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 14px,
    black calc(100% - 14px),
    transparent 100%
  );
}
.bn-need-row {
  padding: 0.9rem 0.85rem;
}
@media (max-width: 420px) {
  .bn-need-row {
    padding: 1rem 0.9rem;
  }
  .bn-need-row .bn-need-name {
    font-size: 0.95rem;
  }
  .bn-need-row .bn-need-amount {
    font-size: 0.95rem;
  }
}

.ch-filter-btn {
  background: #ffffff;
  border-color: #e4e4e7;
  color: #52525b;
}
.ch-filter-btn:hover {
  background: #fafafa;
  border-color: #d4d4d8;
}
.ch-filter-active {
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px -4px rgba(225, 29, 72, 0.45);
}
.cf-kategori-badge {
  max-width: 108px;
}
@media (min-width: 640px) {
  .cf-kategori-badge {
    max-width: 160px;
  }
}

@media (max-width: 640px) {
  #profileForm input,
  #profileForm select {
    font-size: 16px;
  }
}
#profileForm input[type="date"],
#profileForm select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  line-height: 1.3;
  background-color: #fff;
}
#profileForm select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}
#profileForm input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-dropzone-done {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.06);
  color: #047857;
}
.upload-dropzone-done:hover {
  border-color: #e11d48;
  background: rgba(225, 29, 72, 0.03);
  color: #e11d48;
}

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.post-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(11, 13, 18, 0.08);
}
.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post-thumb button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: rgba(11, 13, 18, 0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-carousel {
  scroll-snap-type: x mandatory;
}
.post-carousel > img {
  scroll-snap-align: start;
}

.post-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 13, 18, 0.45);
}
.post-thumb-error {
  color: #fff;
  cursor: pointer;
}
.post-thumb-done {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #10b981;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================================== */
/* PERBAIKAN PRESISI KHUSUS iOS (SAFE AREA, DATE, & HEADER)  */
/* ========================================================== */

/* 1. Perbaikan Posisi Navbar Bawah di iOS */
#mobileNavbar {
  left: 1rem;
  right: 1rem;
  width: auto;
}
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #mobileNavbar {
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}

/* 2. Perbaikan Field Tanggal Supaya Tidak Keluar Container di iOS */
input[type="date"] {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  min-width: 0 !important;
}

.grid input[type="date"],
.space-y-3 input[type="date"],
.space-y-4 input[type="date"],
.space-y-5 input[type="date"] {
  min-width: 0;
  max-width: 100%;
}

/* 3. Perbaikan Header Atas agar Tidak Tertutup Notch / Kamera Depan iOS */
@supports (padding-top: env(safe-area-inset-top)) {
  header.sticky {
    padding-top: env(safe-area-inset-top);
  }
}

/* 4. PERBAIKAN (kendala #3): pastikan tombol Google Sign-In (iframe dari
   Google Identity Services) tidak pernah melebihi lebar containernya di
   layar sempit -- lapisan pertahanan terakhir di atas fix width dinamis
   yang sudah dilakukan di app.js (initializeGoogleLogin). */
#googleButton {
  max-width: 100%;
  overflow: hidden;
}
#googleButton > div {
  max-width: 100% !important;
}
