/* ==========================================================================
   UangKu — flat, quiet, hairline UI
   Theming: CSS custom properties. Default follows OS; manual override via
   [data-theme] on <html> (set by theme.js from localStorage).
   ========================================================================== */

:root {
  --bg:            #f9f9f7;
  --surface:       #fcfcfb;
  --surface-2:     #f0efec;
  --ink:           #0b0b0b;
  --ink-2:         #52514e;
  --muted:         #898781;
  --hairline:      #e1e0d9;
  --baseline:      #c3c2b7;
  --border:        rgba(11, 11, 11, 0.10);

  --accent:        #2a78d6;  /* income / primary action */
  --accent-ink:    #ffffff;
  --accent-hover:  #256abf;
  --income:        #2a78d6;
  --expense:       #e34948;
  --good:          #006300;
  --critical:      #d03b3b;

  --focus-ring:    rgba(42, 120, 214, 0.35);

  /* Palet avatar abstrak (identicon) — sama dengan palet kategorikal chart */
  --avatar-1: #2a78d6;
  --avatar-2: #1baf7a;
  --avatar-3: #eda100;
  --avatar-4: #008300;
  --avatar-5: #4a3aa7;
  --avatar-6: #e34948;
  --avatar-7: #e87ba4;
  --avatar-8: #eb6834;
}

:root[data-theme="dark"] {
  --bg:            #0d0d0d;
  --surface:       #1a1a19;
  --surface-2:     #242423;
  --ink:           #ffffff;
  --ink-2:         #c3c2b7;
  --muted:         #898781;
  --hairline:      #2c2c2a;
  --baseline:      #383835;
  --border:        rgba(255, 255, 255, 0.10);

  --accent:        #3987e5;
  --accent-ink:    #ffffff;
  --accent-hover:  #5598e7;
  --income:        #3987e5;
  --expense:       #e66767;
  --good:          #0ca30c;
  --critical:      #e66767;

  --focus-ring:    rgba(57, 135, 229, 0.45);

  --avatar-1: #3987e5;
  --avatar-2: #199e70;
  --avatar-3: #c98500;
  --avatar-4: #008300;
  --avatar-5: #9085e9;
  --avatar-6: #e66767;
  --avatar-7: #d55181;
  --avatar-8: #d95926;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0d0d0d;
    --surface:       #1a1a19;
    --surface-2:     #242423;
    --ink:           #ffffff;
    --ink-2:         #c3c2b7;
    --muted:         #898781;
    --hairline:      #2c2c2a;
    --baseline:      #383835;
    --border:        rgba(255, 255, 255, 0.10);

    --accent:        #3987e5;
    --accent-ink:    #ffffff;
    --accent-hover:  #5598e7;
    --income:        #3987e5;
    --expense:       #e66767;
    --good:          #0ca30c;
    --critical:      #e66767;

    --focus-ring:    rgba(57, 135, 229, 0.45);

    --avatar-1: #3987e5;
    --avatar-2: #199e70;
    --avatar-3: #c98500;
    --avatar-4: #008300;
    --avatar-5: #9085e9;
    --avatar-6: #e66767;
    --avatar-7: #d55181;
    --avatar-8: #d95926;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* Teks UI (navbar, header, label, dsb) tidak bisa diseleksi — hanya area
     transaksi & angka Rupiah yang boleh, lihat pengecualian di bawah.
     (Tidak berlaku untuk input/textarea — nilainya selalu tetap bisa diseleksi.) */
  user-select: none;
  -webkit-user-select: none;
}

.table-scroll table,
.stat-value,
.recent-amount,
.tt-val {
  user-select: text;
  -webkit-user-select: text;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }

/* :hover hanya untuk perangkat yang benar-benar punya hover (mouse/trackpad) —
   di layar sentuh, :hover normal akan "nyangkut" setelah tap sampai disentuh di tempat lain. */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 7px 14px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid transparent;
}

@media (hover: hover) and (pointer: fine) {
  button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn-secondary:hover { background: var(--surface-2); border-color: var(--baseline); }
  .btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
}

input, select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 7px 10px;
}
input::placeholder { color: var(--muted); }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ==========================================================================
   Auth pages (login / register / verify) + logged-out gate
   ========================================================================== */

.auth-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.container {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.auth-brand svg { color: var(--accent); }

.container h1 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.auth-sub {
  color: var(--ink-2);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); }

.error-msg {
  color: var(--critical);
  font-size: 0.85rem;
  margin: 0;
  min-height: 1.2em;
}

.auth-alt {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 0.88rem;
  color: var(--ink-2);
}

/* Pemisah "atau" antara form password & tombol Google */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  font-size: 0.8rem;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* Tombol "Masuk dengan Google" — logo G resmi inline (tanpa aset eksternal) */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.google-btn:hover { background: var(--surface-2); border-color: var(--ink-2); }
.google-btn svg { flex-shrink: 0; }

/* Halaman hubungkan Telegram: avatar user ↔ badge Telegram */
.link-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 24px 0 14px;
}
.tg-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #29a9eb;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.tg-badge svg { width: 36px; height: 36px; display: block; }
.link-connector {
  display: flex;
  align-items: center;
  gap: 6px;
}
.link-connector span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--baseline);
}
.link-visual.is-linked .link-connector span { background: var(--accent); }

.link-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 16px;
}
.link-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.link-username {
  font-size: 0.85rem;
  color: var(--muted);
}

.link-state {
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9rem;
  min-height: 1.3em;
  margin-bottom: 16px;
}
.link-state.is-error { color: var(--critical); }
.link-state.is-success { color: var(--good); }

.link-confirm { width: 100%; }

.claude-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #D97757;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.claude-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.claude-badge.generic-badge { background: var(--surface-2); color: var(--ink-2); }
.claude-badge.generic-badge svg { width: 32px; height: 32px; }

.link-deny {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 0.88rem;
  cursor: pointer;
}
.link-deny:hover { color: var(--ink); }

.link-hint {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

footer {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--hairline);
}

/* Gate (logged-out view of index) */
#gate-panel .action-panel {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
#gate-panel .action-panel a { text-decoration: none; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  display: none; /* JS reveals when logged in */
  min-height: 100vh;
}
.app.is-visible { display: block; }

.gate-wrap { display: none; }
.gate-wrap.is-visible {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 10px 18px;
  color: var(--ink);
}
.brand svg { color: var(--accent); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.92rem;
  text-align: left;
}
.nav-item svg { color: var(--muted); flex: none; }
.nav-item:active { background: var(--surface-2); }
.nav-item.is-active {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 500;
}
.nav-item.is-active svg { color: var(--accent); }
.nav-item[hidden] { display: none; } /* display:flex di atas mengalahkan [hidden] bawaan */

/* Tab admin: hanya boleh nongol di sidebar desktop, dan hanya untuk admin
   (JS mengatur atribut hidden berdasar role). Rule ini pengaman tambahan
   supaya #nav-admin-link tidak pernah tampil di bawah breakpoint desktop,
   apa pun state JS-nya. */
@media (max-width: 959px) {
  #nav-admin-link { display: none !important; }
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 10px;
  font-size: 0.88rem;
  color: var(--ink-2);
  overflow: hidden;
}
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Avatar: foto profil (img) atau identicon abstrak yang digambar (svg) */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  background: var(--surface-2);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 64px; height: 64px; }

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.profile-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-actions .btn-danger { height: 34px; }

/* Tombol ikon-saja (mis. hapus foto): persegi, ikon di tengah, tanpa teks */
.btn-icon {
  width: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon svg { flex: none; }

/* "Ganti foto": label yang berperilaku seperti tombol penuh (ikon + teks) */
.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.btn-upload svg { color: var(--muted); flex: none; }
.btn-upload:active { background: var(--surface-2); border-color: var(--baseline); }

/* Baris nama panggilan: input & tombol setinggi dan sejajar */
.profile-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.profile-form .form-group { flex: 1; min-width: 180px; gap: 4px; }
.profile-form input,
.profile-form button {
  height: 36px;
  padding-top: 0;
  padding-bottom: 0;
}

/* Mobile top header */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 10;
}
.mobile-header .brand { padding: 0; font-size: 1.08rem; gap: 10px; }
.mobile-header .brand svg { width: 22px; height: 22px; }
.mobile-user { display: flex; align-items: center; gap: 8px; }
/* Di mobile hanya foto yang tampil; elemen nama tetap di DOM (diisi script.js). */
.mobile-user #mobile-username { display: none; }

/* Bottom tab bar (mobile) — frosted: blur di belakang, tint gradien surface
   di tengah, konten nav tetap tajam di depan.
   Urutan cat (depan → belakang): .nav-item (z:auto) → ::after gradien (z:-1)
   → ::before blur (z:-2). `isolation: isolate` mengunci stacking context
   sehingga z negatif pseudo-element tidak jatuh ke belakang halaman. */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  border-top: 1px solid var(--hairline);
  z-index: 10;
  isolation: isolate;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.tabbar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Anchor solid tipis di dasar, lalu memudar panjang & halus (banyak titik,
     kurva melengkung) sampai transparan penuh di puncak bar. */
  background: linear-gradient(
    to top,
    var(--surface) 0%,
    var(--surface) 8%,
    color-mix(in srgb, var(--surface) 92%, transparent) 20%,
    color-mix(in srgb, var(--surface) 75%, transparent) 35%,
    color-mix(in srgb, var(--surface) 55%, transparent) 50%,
    color-mix(in srgb, var(--surface) 35%, transparent) 65%,
    color-mix(in srgb, var(--surface) 18%, transparent) 80%,
    color-mix(in srgb, var(--surface) 6%, transparent) 92%,
    transparent 100%
  );
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: var(--surface); }
  .tabbar::before, .tabbar::after { content: none; }
}
.tabbar .nav-item {
  flex: 1;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  padding: 12px 4px 10px;
  font-size: 0.76rem;
  border-radius: 0;
}
.tabbar .nav-item svg { width: 23px; height: 23px; }
.tabbar .nav-item.is-active { background: transparent; }

.main {
  padding: 20px 16px 100px; /* room for bottom tabbar yang lebih besar */
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

/* Mobile: header & tabbar dilepas dari scroll dokumen supaya tidak ikut efek
   "overscroll stretch" Chrome saat konten ditarik melewati batas atas/bawah.
   Hanya .main yang jadi elemen scroll; header & tabbar jadi item flex diam
   di kolom yang tingginya dikunci sebesar viewport. */
@media (max-width: 959px) {
  html, body { height: 100%; overscroll-behavior: none; }

  .content-col {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .mobile-header { position: static; flex: none; }

  .main {
    flex: 1 1 auto;
    min-height: 0; /* wajib agar flex child ini bisa scroll internal, bukan meluap */
    /* padding-bottom tetap dari rule dasar (100px) — .tabbar kembali fixed
       overlay di bawah ini, jadi konten tetap butuh ruang supaya tak
       ketutupan olehnya. */
    overflow-y: auto;
    overscroll-behavior-y: contain; /* redam efek stretch di sini saja, tak menjalar ke luar */
    -webkit-overflow-scrolling: touch;
  }

  /* .tabbar SENGAJA dibiarkan fixed (warisan rule dasar) walau .main sudah
     jadi elemen scroll sendiri — supaya konten yang di-scroll di .main tetap
     lewat *di belakang* tabbar dan efek frosted blur+gradien (::before/::after
     di atas) punya sesuatu untuk diburamkan. Mengunci scroll dokumen
     (html/body di atas) sudah cukup untuk menghentikan bug "overscroll
     stretch" Chrome — tidak perlu mengubah positioning tabbar juga. */
}

/* Desktop layout */
@media (min-width: 960px) {
  .app.is-visible {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .sidebar {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .mobile-header, .tabbar { display: none; }
  .main { padding: 28px 32px 40px; }

  /* Scrollbar custom, tipis & senada dengan palet halaman (track menyatu ke
     bg, thumb pakai warna hairline yang sama dipakai untuk border tipis di
     seluruh UI — jadi kelihatan pas dipakai, tapi tidak mencolok saat diam).
     scrollbar-gutter: stable mencadangkan lebar space-nya secara konsisten,
     supaya .main yang di-center dengan margin:auto tidak geser antara
     halaman yang kontennya lebih pendek dari viewport (tak perlu scroll) vs
     yang lebih panjang (perlu scroll). Hanya berlaku desktop (di dalam
     media query ini) — mobile pakai scrollbar bawaan OS seperti biasa. */
  html {
    scrollbar-gutter: stable;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--hairline) var(--bg); /* Firefox: thumb track */
  }
  html::-webkit-scrollbar { width: 10px; }
  html::-webkit-scrollbar-track { background: var(--bg); }
  html::-webkit-scrollbar-thumb {
    background: var(--hairline);
    border-radius: 8px;
    border: 2px solid var(--bg);
  }
  html::-webkit-scrollbar-thumb:hover { background: var(--muted); }
}

/* ==========================================================================
   Tabs & common blocks
   ========================================================================== */

.tab { display: none; }
.tab.is-active { display: block; }

.page-head { margin-bottom: 20px; }
.page-head h2 { font-size: 1.25rem; }
.page-head p { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-head h3 { font-size: 0.95rem; font-weight: 600; }
.card-head .card-note { font-size: 0.8rem; color: var(--muted); }

/* Stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 560px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 600; color: var(--ink); }
.stat-sub { font-size: 0.78rem; color: var(--muted); }

.stat-key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: baseline;
}
.stat-key.key-income { background: var(--income); }
.stat-key.key-expense { background: var(--expense); }

/* Charts */
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; }

.chart-legend {
  list-style: none;
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; }
.swatch-income { background: var(--income); }
.swatch-expense { background: var(--expense); }

.chart-tooltip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 8px));
  background: var(--ink);
  color: var(--bg);
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.chart-tooltip .tt-title { color: var(--surface-2); font-size: 0.72rem; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.chart-tooltip .tt-key { width: 10px; height: 2px; border-radius: 1px; }
.chart-tooltip .tt-val { font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Tables */
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ket { white-space: normal; min-width: 140px; }

.amount-in  { color: var(--income); font-weight: 600; }
.amount-out { color: var(--expense); font-weight: 600; }

.jenis-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 1px 7px;
}
.jenis-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.jenis-badge.badge-masuk::before  { background: var(--income); }
.jenis-badge.badge-keluar::before { background: var(--expense); }

.hapus {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px;
  border-radius: 5px;
  line-height: 0;
}
.hapus:active { background: var(--surface-2); color: var(--critical); }

@media (hover: hover) and (pointer: fine) {
  .hapus:hover { background: var(--surface-2); color: var(--critical); }
}

.kosong { padding: 28px 12px; text-align: center; color: var(--muted); white-space: normal; }

/* Recent list (Ringkasan) */
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9rem;
}
.recent-list li:last-child { border-bottom: none; }
.recent-main { flex: 1; min-width: 0; }
.recent-ket { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-waktu { display: block; font-size: 0.76rem; color: var(--muted); }
.recent-amount { font-variant-numeric: tabular-nums; font-weight: 600; }

.link-more { font-size: 0.85rem; }

/* Transaksi: form & toolbar */
.tx-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.tx-form .form-group { gap: 4px; }
.tx-form button { height: 36px; }

/* FAB tambah transaksi — hidup di luar .tab; visibilitas per-tab diatur JS
   (bukaTab) lewat atribut `hidden`: tampil di Ringkasan/Transaksi/Laporan.
   `--fab-clear` diisi oleh JS (measureFabClearance() di script.js) dari tinggi
   .tabbar yang SUNGGUHAN (getBoundingClientRect), bukan angka tebakan — jadi
   tidak pernah meleset walau address bar Chrome berubah-ubah tinggi viewport.
   Fallback 78px hanya jaga-jaga sebelum JS sempat jalan. */
.fab {
  position: fixed;
  right: 16px;
  bottom: var(--fab-clear, 78px);
  width: 54px;
  height: 54px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid var(--accent-hover);
  color: var(--accent-ink);
  z-index: 45;
  transition: background 0.15s ease, transform 0.18s ease;
}
.fab[hidden] { display: none; } /* display:flex di atas mengalahkan [hidden] bawaan */
.fab:active { transform: scale(0.94); }
.fab svg { transition: transform 0.25s ease; }
.fab.is-open svg { transform: rotate(45deg); } /* "+" berputar jadi "×" */

.tx-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 26, 0.32);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.tx-overlay.is-open { opacity: 1; }

/* Panel form melayang: tumbuh dari arah FAB (transform-origin kanan-bawah). */
.tx-sheet {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--fab-clear, 78px) + 54px + 12px);
  max-width: 380px;
  margin-left: auto;
  max-height: calc(100dvh - var(--fab-clear, 78px) - 54px - 90px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 16px;
  z-index: 44;
  opacity: 0;
  transform: scale(0.9) translateY(10px);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.tx-sheet.is-open { opacity: 1; transform: none; }

/* Kunci scroll di belakang panel saat terbuka (html menutupi kedua skema:
   document-level di desktop, .main di mobile). */
html.tx-modal-open,
html.tx-modal-open .main {
  overflow: hidden;
}

.tx-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.tx-sheet-head h3 { font-size: 1rem; }
.tx-sheet-close {
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  border-radius: 6px;
}
.tx-sheet-close:hover { background: var(--surface-2); border-color: var(--hairline); color: var(--ink); }

.tx-jenis-seg { display: flex; }
.tx-jenis-seg button { flex: 1; }

@media (min-width: 960px) {
  .fab { right: 32px; bottom: 32px; }
  .tx-sheet {
    left: auto;
    right: 32px;
    bottom: calc(32px + 54px + 12px);
    width: 380px;
    max-height: calc(100vh - 130px);
  }
}

/* Jendela konfirmasi melayang: bahasa visual sama dengan .tx-sheet
   (surface + hairline + skala/fade), tapi berlabuh di tengah layar. */
.cf-sheet {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 50%;
  max-width: 400px;
  margin: 0 auto;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 16px;
  z-index: 48;
  opacity: 0;
  transform: translateY(-50%) scale(0.94);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.cf-sheet.is-open { opacity: 1; transform: translateY(-50%); }
.cf-sheet .tx-form[hidden] { display: none; } /* display:grid mengalahkan [hidden] bawaan */

/* Overlay konfirmasi harus menutupi FAB juga (FAB z-index 45) */
#cf-overlay { z-index: 47; }

.cf-desc { font-size: 0.9rem; color: var(--ink-2); margin-bottom: 14px; }
.cf-sheet .tx-form .cf-desc { margin-bottom: 0; }
.cf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

/* Severity Zona Merah dipertahankan di jendela hapus akun */
.cf-danger { border-color: var(--critical); }
.cf-danger .tx-sheet-head h3 { color: var(--critical); }
.cf-danger .btn-danger { border-color: var(--critical); }

/* Baris email: nilai ter-masking + tombol ubah berdampingan */
.settings-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mcp-intro { margin-bottom: 4px; }
.mcp-docs-link {
  display: inline-block;
  font-size: 0.85rem;
  margin: 0 14px 10px 0;
}
.mcp-url {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 4px 8px;
  color: var(--ink);
  white-space: nowrap;
}

.form-msg { font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }
.form-msg.is-error { color: var(--critical); }
.form-msg.is-ok { color: var(--good); }

.tx-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tx-toolbar .search-wrap { position: relative; flex: 1; min-width: 180px; }
.tx-toolbar .search-wrap svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.tx-toolbar input[type="search"] { width: 100%; padding-left: 32px; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.segmented button {
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 7px 12px;
  font-size: 0.85rem;
}
.segmented button + button { border-left: 1px solid var(--hairline); }
.segmented button:active { background: var(--surface-2); }
.segmented button.is-active {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 500;
}

@media (hover: hover) and (pointer: fine) {
  .segmented button:hover { background: var(--surface-2); }
}

.tx-count { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }

/* Laporan */
.laporan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 700px) {
  .laporan-grid { grid-template-columns: repeat(3, 1fr); }
}

details.table-view { margin-top: 12px; border-top: 1px solid var(--hairline); padding-top: 10px; }
details.table-view summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink-2);
  user-select: none;
}
details.table-view[open] summary { margin-bottom: 8px; }

/* Pengaturan */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.settings-row:last-child { border-bottom: none; }
/* Elemen kanan (tombol/segmented/nilai) selalu menempel ke kanan — baik
   muat sebaris dengan label maupun terpaksa turun ke baris sendiri saat
   sempit (space-between saja tak cukup: baris yang isinya cuma 1 item
   jatuh ke kiri secara default). Konsisten di semua .settings-row. */
.settings-row > *:last-child { margin-left: auto; }
.settings-row .settings-label { font-size: 0.92rem; }
.settings-row .settings-desc { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.settings-value { font-size: 0.92rem; color: var(--ink-2); font-weight: 500; }

.btn-danger {
  background: transparent;
  color: var(--critical);
  border: 1px solid var(--hairline);
}
.btn-danger:active { background: var(--surface-2); border-color: var(--critical); }

@media (hover: hover) and (pointer: fine) {
  .btn-danger:hover { background: var(--surface-2); border-color: var(--critical); }
}

/* Header profil (Pengaturan): avatar besar + nama + @username, selalu tampil */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.avatar-xl { width: 84px; height: 84px; }
.profile-ident { flex: 1; min-width: 140px; }
.profile-nama {
  font-size: 1.15rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-username { font-size: 0.85rem; color: var(--muted); margin-top: 1px; }

/* Sub-tab Pengaturan: baris pill horizontal; scroll menyamping bila sempit */
.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button {
  flex: none;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  padding: 7px 14px;
  font-size: 0.85rem;
}
.subtabs button:active { background: var(--surface-2); }
.subtabs button.is-active {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
  .subtabs button:hover { background: var(--surface-2); }
}

.subtab-panel { display: none; }
.subtab-panel.is-active { display: block; }

/* Zona merah: bingkai hairline merah, tetap flat */
.card-danger { border-color: var(--critical); }
.card-danger .card-head h3 { color: var(--critical); }
.card-danger .btn-danger { border-color: var(--critical); }

/* Tentang */
.about-desc { font-size: 0.88rem; color: var(--ink-2); margin-bottom: 4px; }
.about-link { font-size: 0.92rem; font-weight: 500; color: var(--ink-2); text-decoration: underline; }
.about-link:active { color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .about-link:hover { color: var(--ink); }
}

/* Token API (Personal Access Token) */
.pat-list { list-style: none; margin: 4px 0 0; padding: 0; }
.pat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.pat-row:last-child { border-bottom: none; }
.pat-row-info { min-width: 0; }
.pat-row-label { font-size: 0.92rem; font-weight: 500; overflow-wrap: anywhere; }
.pat-row-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.pat-row-revoke {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--critical);
  font-size: 0.82rem;
  padding: 6px 10px;
  margin-left: auto;
}
.pat-row-revoke:active { background: var(--surface-2); border-color: var(--critical); }
@media (hover: hover) and (pointer: fine) {
  .pat-row-revoke:hover { background: var(--surface-2); border-color: var(--critical); }
}
.pat-empty { font-size: 0.85rem; color: var(--muted); margin: 4px 0 0; }

.cf-desc-warn { color: var(--critical); font-weight: 500; }
.pat-reveal-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--surface-2);
}
.pat-reveal-box code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 0.85rem;
}

/* MFA: daftar kode cadangan (grid dua kolom, chip monospace) */
.mfa-uri-label { margin: 12px 0 4px; }
.mfa-backup-list {
  list-style: none;
  margin: 4px 0 10px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}
.mfa-backup-list li {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-align: center;
}
.mfa-backup-copy-btn { margin-bottom: 4px; }
.mfa-confirm-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

/* Turnstile container spacing */
#turnstile-container:not(:empty) { margin: 2px 0; }

/* ==========================================================================
   Landing page (logged-out gate)
   ========================================================================== */

.landing-shell {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Top nav */
.landing-nav {
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.landing-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.landing-brand { margin-bottom: 0; }
.landing-nav-actions { display: flex; align-items: center; gap: 8px; }
.landing-nav-actions a { text-decoration: none; }

.landing { flex: 1; }

/* Hero */
.landing-hero {
  padding-top: 72px;
  padding-bottom: 72px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(1.9rem, 5.5vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}
.hero-sub {
  max-width: 620px;
  margin: 0 auto 28px;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.hero-cta {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-cta a { text-decoration: none; }
.hero-cta button { padding: 9px 20px; font-weight: 500; }

/* Hero chart card */
.hero-chart {
  margin: 48px auto 0;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px 16px 8px;
  text-align: left;
}
.hero-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.hero-chart-tag { font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.hero-chart svg { width: 100%; height: 150px; }
.hc-grid { stroke: var(--hairline); stroke-width: 1; }
.hc-line {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: hc-draw 2.4s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}
.hc-dot {
  fill: var(--accent);
  opacity: 0;
  animation: hc-dot-in 0.4s ease 2.7s forwards, hc-dot-pulse 2.4s ease-in-out 3.2s infinite;
  transform-origin: 640px 30px;
}
@keyframes hc-draw { to { stroke-dashoffset: 0; } }
@keyframes hc-dot-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes hc-dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.6); }
}

/* Entrance reveal (staggered, on load) */
.landing-reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: landing-rise 0.55s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
.landing-reveal:nth-child(1) { animation-delay: 0.05s; }
.landing-reveal:nth-child(2) { animation-delay: 0.15s; }
.landing-reveal:nth-child(3) { animation-delay: 0.25s; }
.landing-reveal:nth-child(4) { animation-delay: 0.35s; }
.landing-reveal:nth-child(5) { animation-delay: 0.45s; }
@keyframes landing-rise {
  to { opacity: 1; transform: translateY(0); }
}

/* Sections */
.landing-section {
  padding-top: 56px;
  padding-bottom: 64px;
  border-top: 1px solid var(--hairline);
}
.section-title {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 6px;
}
.section-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 20px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.feature-card h3 {
  font-size: 1rem;
  color: var(--ink);
  margin: 14px 0 6px;
}
.feature-card p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--accent);
  background: var(--surface-2);
}
@media (hover: hover) and (pointer: fine) {
  .feature-card:hover {
    transform: translateY(-3px);
    border-color: var(--baseline);
  }
}

/* Steps */
.steps {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 0;
}
.step + .step { border-top: 1px solid var(--hairline); }
.step-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.step h3 { font-size: 0.98rem; color: var(--ink); margin-bottom: 4px; }
.step p { font-size: 0.9rem; line-height: 1.55; color: var(--ink-2); }

/* Closing CTA */
.closing-cta {
  border-top: 1px solid var(--hairline);
  padding: 56px 0 72px;
  text-align: center;
}
.closing-cta h2 {
  font-size: clamp(1.3rem, 3.4vw, 1.8rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 10px;
}
.closing-cta p {
  color: var(--ink-2);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Mobile: header tenang — hero sudah punya pasangan CTA sendiri persis di bawahnya,
   jadi di layar sempit nav cukup menawarkan "Masuk" sebagai tautan teks yang sunyi.
   (Tombol "Daftar" header disembunyikan; "Mulai gratis" di hero mengambil peran itu.
   Toggling guest-only/auth-only dari landing.js memakai atribut `hidden`, jadi
   display:none tambahan di sini tidak mengganggu logika itu.) */
@media (max-width: 639px) {
  .landing-nav-actions a.guest-only[href="/register"] { display: none; }
  .landing-nav-actions a.guest-only[href="/login"] button {
    background: transparent;
    border-color: transparent;
    color: var(--ink-2);
    font-weight: 500;
    padding: 10px 4px;
    min-height: 44px;
  }
  .landing-nav-actions a.auth-only button { padding: 7px 12px; }

  /* Hero lebih rapat di bawah nav sticky, CTA jadi tombol lebar penuh
     yang mudah ditekan, dan kartu grafik tidak terlalu tinggi/curam. */
  .landing-hero { padding-top: 52px; padding-bottom: 60px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta a:not([hidden]) { display: block; }
  .hero-cta button { width: 100%; min-height: 44px; }
  .hero-chart { margin-top: 36px; padding: 14px 12px 6px; }
  .hero-chart svg { height: 112px; }
  .landing-section { padding-top: 44px; padding-bottom: 52px; }
  .closing-cta { padding: 44px 0 56px; }
}

/* Wider layouts */
@media (min-width: 640px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr 1fr; gap: 0 24px; }
  .step { flex-direction: column; gap: 12px; padding: 0; }
  .step + .step { border-top: none; border-left: 1px solid var(--hairline); padding-left: 24px; }
}
@media (min-width: 900px) {
  .landing-hero { padding-top: 96px; padding-bottom: 88px; }
}

/* Scroll-linked reveal for feature cards (progressive enhancement) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .feature-card, .step {
      animation: landing-rise 1ms linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}

/* Reduced motion: show everything instantly, no loops */
@media (prefers-reduced-motion: reduce) {
  .landing-reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .hc-line { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .hc-dot { opacity: 1; animation: none; }
  .feature-card { transition: none; }
  @media (hover: hover) and (pointer: fine) {
    .feature-card:hover { transform: none; }
  }
  .fab, .fab svg, .tx-overlay, .tx-sheet, .cf-sheet { transition: none; }
  .tx-sheet { transform: none; }
  .cf-sheet { transform: translateY(-50%); }
  .fab:active { transform: none; }
}

/* ==========================================================================
   Antigravity Premium Subscription System Styles
   ========================================================================== */

/* Subscription Badges next to usernames */
.badge-sub {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border-radius: 4px;
  line-height: 1;
  vertical-align: middle;
  margin-left: 6px;
}

.badge-sub-lite {
  background: #2563eb;
  color: #ffffff;
}

.badge-sub-max {
  background: #7c3aed;
  color: #ffffff;
}

/* Sidebar Upgrade Button */
.btn-upgrade-sidebar {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  padding: 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}
@media (hover: hover) and (pointer: fine) {
  .btn-upgrade-sidebar:hover { background: var(--accent-hover); }
}
.btn-upgrade-sidebar svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Mobile Upgrade Banners inside tabs */
.mobile-upgrade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  gap: 10px;
}
.mobile-upgrade-banner .banner-text {
  display: flex;
  align-items: center;
  color: var(--ink);
}
.btn-mobile-upgrade-trigger {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) {
  .btn-mobile-upgrade-trigger:hover { background: var(--accent-hover); }
}

@media (min-width: 960px) {
  .mobile-upgrade-banner {
    display: none !important; /* Hide on desktop! */
  }
}

/* Plan Cards Grid Layout inside Modal */
#cf-subscription.cf-sheet {
  max-width: 100%;
}
@media (min-width: 768px) {
  #cf-subscription.cf-sheet {
    max-width: 900px;
  }
  #cf-subscription .plans-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 15px;
}

.plan-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  background: var(--surface);
  position: relative;
}

.plan-card.active-plan {
  border: 2px solid var(--accent);
}

.plan-featured-lite {
  border: 1px solid var(--hairline);
}

.plan-featured-max {
  border: 1px solid var(--hairline);
}

.plan-badge-top {
  position: absolute;
  top: -10px;
  right: 20px;
  background: var(--accent);
  color: var(--surface);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

.plan-featured-max .plan-badge-top {
  background: #7c3aed;
}

.plan-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}

.plan-price {
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--ink);
  white-space: nowrap;
}

.plan-period {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-2);
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  flex-grow: 1;
}

.plan-features li {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--ink);
  display: flex;
  align-items: center;
}

.plan-features li svg {
  flex-shrink: 0;
}

.plan-btn {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  font-weight: 700;
  text-align: center;
}

/* Premium locking for Connections */
.premium-lock-card {
  border: 1px dashed var(--hairline);
  background: var(--surface);
}
.icon-lock {
  display: block;
  margin: 0 auto;
}

/* Fitur terkunci per-tier (tab Laporan, ekspor, bahasa Indonesia) — masih
   bisa diklik (buka modal upgrade), cuma ditandai visual biar jelas ini
   premium-only, bukan cuma dihilangkan diam-diam. */
.is-locked-feature {
  opacity: 0.55;
}
.is-locked-feature::after {
  content: '';
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 5px;
  vertical-align: -1px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.segmented .is-locked-feature {
  opacity: 0.45;
}
