/* ==========================================================================
   RISLY Money Manager — application styles
   Design tokens are CSS variables so light/dark stay consistent.
   ========================================================================== */

:root {
  --bg: #f5f7fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e6ebf3;
  --border-strong: #d7dfeb;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #2563eb;
  --brand-2: #4f46e5;
  --brand-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #ecfdf5;
  --red: #f04452;
  --red-soft: #fff1f2;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --violet: #7c3aed;
  --cyan: #0891b2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -18px rgba(15, 23, 42, .22);
  --shadow-md: 0 2px 5px rgba(15, 23, 42, .04), 0 20px 45px -26px rgba(15, 23, 42, .3);
  --shadow-lg: 0 28px 70px -30px rgba(15, 23, 42, .45);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.dark {
  --bg: #08101e;
  --bg-soft: #0b1424;
  --surface: #0e1728;
  --surface-2: #111c31;
  --surface-3: #16223a;
  --border: #1c2a43;
  --border-strong: #263653;
  --text: #f8fafc;
  --text-soft: #dbe4f0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --brand: #60a5fa;
  --brand-2: #818cf8;
  --brand-soft: rgba(59, 130, 246, .12);
  --green: #34d399;
  --green-soft: rgba(16, 185, 129, .12);
  --red: #fb7185;
  --red-soft: rgba(244, 63, 94, .12);
  --amber: #fbbf24;
  --amber-soft: rgba(245, 158, 11, .12);
  --violet: #a78bfa;
  --cyan: #22d3ee;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .18), 0 8px 24px -16px rgba(0, 0, 0, .5);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .22), 0 24px 50px -28px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body.modal-open { overflow: hidden; }

[hidden] { display: none !important; }

::selection { background: rgba(37, 99, 235, .2); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

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

/* ==========================================================================
   Splash
   ========================================================================== */

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 600px at 70% -10%, rgba(59, 130, 246, .18), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(124, 58, 237, .14), transparent 60%),
    var(--bg);
  transition: opacity .4s ease, visibility .4s ease;
}
.app-splash.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.app-splash-inner { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px; }
.app-splash-mark { width: 70px !important; height: 70px !important; border-radius: 22px !important; box-shadow: none !important; background: transparent !important; }
.app-splash-name { margin: 18px 0 0; font-size: 25px; font-weight: 800; letter-spacing: .16em; }
.app-splash-tag { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.app-splash-loader {
  margin-top: 26px; width: 150px; height: 3px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.app-splash-loader i {
  display: block; width: 40%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--violet));
  animation: splashSlide 1.15s ease-in-out infinite;
}
@keyframes splashSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(280%); }
}

.noscript-card {
  position: fixed; inset: 0; z-index: 400; display: grid; place-content: center;
  text-align: center; padding: 30px; background: var(--bg);
}
.noscript-card h1 { font-size: 22px; margin: 0 0 8px; }
.noscript-card p { color: var(--muted); max-width: 380px; margin: 0; }

/* ==========================================================================
   Brand & avatars
   ========================================================================== */

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: transparent !important;
    box-shadow: none !important;
}
.brand-mark-sm { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; }
.brand-mark-lg { width: 48px; height: 48px; border-radius: 15px; font-size: 22px; }

.brand-name { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.brand-caption { margin: 1px 0 0; font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted-2); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--avatar-color, #2563eb);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 6px 16px -10px var(--avatar-color, #2563eb);
}

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

.app-shell { min-height: 100dvh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 252px;
  padding: 22px 16px calc(18px + var(--safe-bottom));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .6), transparent 180px),
    var(--surface);
  border-right: 1px solid var(--border);
}
.dark .sidebar { background: linear-gradient(180deg, rgba(96, 165, 250, .035), transparent 220px), var(--surface); }

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 0; }
.sidebar-nav { margin-top: 30px; overflow-y: auto; flex: 1; padding-bottom: 14px; }
.nav-section-label {
  margin: 0 0 8px; padding: 0 11px;
  font-size: 9px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted-2);
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; margin-bottom: 3px; padding: 9px 11px;
  border-radius: 12px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.is-active { color: var(--brand); background: var(--brand-soft); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -16px; top: 50%;
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--brand); transform: translateY(-50%);
}
.nav-icon { display: inline-flex; color: currentColor; opacity: .9; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 11px; }
.sidebar-sync { padding: 0 4px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); transition: border-color .18s ease, transform .18s ease;
}
.sidebar-user:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.sidebar-version { margin: 0; text-align: center; font-size: 9px; letter-spacing: .06em; color: var(--muted-2); }

.app-main { min-height: 100dvh; padding-left: 252px; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: calc(64px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 28px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--bg); }
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-date { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; color: var(--muted); }
.mobile-brand { display: none; align-items: center; gap: 9px; }
.topbar-avatar { border: 0; background: transparent; padding: 0; border-radius: 999px; }
.topbar-avatar:hover { transform: translateY(-1px); }
.topbar-bell { position: relative; }
.notification-dot {
  position: absolute; top: -3px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 9px; font-weight: 800; border: 2px solid var(--bg);
}

.page-content {
  width: 100%; max-width: 1420px; margin: 0 auto;
  padding: 26px 30px calc(48px + var(--safe-bottom));
  flex: 1;
}
.page-content:focus { outline: none; }
.page-enter { animation: pageIn .32s cubic-bezier(.22, .8, .3, 1); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 35;
  width: 56px; height: 56px; border: 0; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 18px 36px -14px rgba(37, 99, 235, .7), 0 3px 8px rgba(15, 23, 42, .16);
  transition: transform .18s ease, box-shadow .18s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 22px 42px -14px rgba(37, 99, 235, .8); }
.fab:active { transform: scale(.96); }

.bottom-nav { display: none; }

/* ==========================================================================
   Page primitives
   ========================================================================== */

.page-stack { display: flex; flex-direction: column; gap: 20px; }

.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  flex-wrap: wrap;
}
.page-eyebrow {
  margin: 0 0 4px; font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2);
}
.page-title {
  margin: 0; font-size: clamp(23px, 3vw, 31px);
  line-height: 1.15; font-weight: 800; letter-spacing: -.035em; color: var(--text);
}
.page-subtitle { margin: 6px 0 0; max-width: 640px; font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  position: relative;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-kicker {
  margin: 0 0 2px; font-size: 9px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase; color: var(--muted-2);
}
.section-title { margin: 0; font-size: 15px; font-weight: 750; letter-spacing: -.015em; color: var(--text); }
.period-chip {
  padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 10px; font-weight: 700; color: var(--muted);
}
.wave { display: inline-block; animation: waveHand 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes waveHand {
  0%, 60%, 100% { transform: rotate(0deg); }
  70% { transform: rotate(16deg); }
  80% { transform: rotate(-8deg); }
  90% { transform: rotate(10deg); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 15px;
  border: 1px solid transparent; border-radius: 11px;
  font-size: 12.5px; font-weight: 700; line-height: 1.2;
  white-space: nowrap; user-select: none;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; transform: none; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 12px 24px -14px rgba(37, 99, 235, .8);
}
.btn-primary:hover { box-shadow: 0 16px 28px -14px rgba(37, 99, 235, .9); }
.btn-secondary {
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-danger-soft { color: #dc2626; background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 18%, transparent); }
.dark .btn-danger-soft { color: #fb7185; }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--red-soft) 70%, var(--red) 8%); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 33px; padding: 6px 11px; border-radius: 9px; font-size: 11px; }
.btn.is-pressed { transform: scale(.97); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--muted);
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.95); }

.card-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted-2);
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.card-icon-btn:hover { background: var(--surface-3); color: var(--text); }
.card-icon-btn.active, .card-icon-btn.is-active { color: var(--brand); background: var(--brand-soft); }
.card-icon-btn.danger:hover { color: var(--red); background: var(--red-soft); }

.link-button {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; padding: 2px;
  font-size: 11px; font-weight: 700; color: var(--brand);
}
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Forms */
.field-label {
  display: block; font-size: 10.5px; font-weight: 700;
  letter-spacing: .015em; color: var(--muted);
}
.field {
  width: 100%; min-height: 41px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 13px; outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.field:hover { border-color: var(--muted-2); }
.field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field::placeholder { color: var(--muted-2); }
.field:disabled { opacity: .65; background: var(--surface-3); }
.field-compact { min-height: 34px; padding: 6px 9px; font-size: 11.5px; border-radius: 9px; }
.textarea { min-height: 72px; resize: vertical; line-height: 1.55; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type="date"].field, input[type="month"].field, input[type="datetime-local"].field {
  min-height: 41px;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 13px; }
.modal-body > .field-label, .modal-body > .form-grid + .field-label { margin-top: 13px; }
.form-error {
  margin: 14px 0 0; padding: 9px 12px; border-radius: 9px;
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 20%, transparent);
  color: #dc2626; font-size: 11.5px; font-weight: 600;
}
.dark .form-error { color: #fb7185; }
.input-with-prefix {
  display: flex; align-items: center;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); overflow: hidden;
}
.input-with-prefix > span {
  padding: 0 10px; height: 39px; display: flex; align-items: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border-right: 1px solid var(--border);
}
.input-with-prefix .field { border: 0; border-radius: 0; box-shadow: none; min-height: 39px; }
.input-with-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.search-field {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 0 11px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); color: var(--muted-2);
}
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.search-field .field { border: 0; box-shadow: none; padding-left: 0; background: transparent; min-height: 39px; }

/* Switch */
.switch {
  position: relative; display: inline-flex; width: 38px; height: 22px;
  border-radius: 999px; background: var(--border-strong); flex: 0 0 auto;
  transition: background .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform .2s cubic-bezier(.2, .8, .3, 1);
}
.switch.is-on { background: var(--brand); }
.switch.is-on::after { transform: translateX(16px); }

/* Badges & pills */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 7px; border-radius: 999px;
  font-size: 9.5px; font-weight: 700; line-height: 1.4;
  white-space: nowrap;
}
.badge-soft { font-weight: 650; }
.badge-slate { background: var(--surface-3); color: var(--muted); }
.badge-blue { background: var(--brand-soft); color: var(--brand); }
.badge-green { background: var(--green-soft); color: #15803d; }
.dark .badge-green { color: #34d399; }
.badge-red { background: var(--red-soft); color: #dc2626; }
.dark .badge-red { color: #fb7185; }
.badge-amber { background: var(--amber-soft); color: #b45309; }
.dark .badge-amber { color: #fbbf24; }
.badge-purple { background: rgba(124, 58, 237, .09); color: #6d28d9; }
.dark .badge-purple { color: #c4b5fd; }
.badge-pink { background: rgba(219, 39, 119, .09); color: #be185d; }
.dark .badge-pink { color: #f9a8d4; }
.badge-cyan { background: rgba(8, 145, 178, .09); color: #0e7490; }
.dark .badge-cyan { color: #67e8f9; }

.avatar { display: inline-flex; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 27px; padding: 4px 9px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 9.5px; font-weight: 700;
  transition: border-color .16s ease, background .16s ease;
}
.sync-pill:hover { border-color: var(--border-strong); background: var(--surface-2); }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.sync-local { color: var(--muted); }
.sync-idle { color: var(--brand); }
.sync-syncing { color: var(--amber); }
.sync-synced { color: #16a34a; }
.dark .sync-synced { color: #34d399; }
.sync-error { color: var(--red); }
.sync-offline { color: var(--amber); }
.sync-syncing svg { animation: spin 1.2s linear infinite; }

/* Progress */
.progress-track {
  position: relative; height: 8px; width: 100%;
  border-radius: 999px; background: var(--surface-3); overflow: hidden;
}
.progress-thin { height: 5px; }
.progress-lg { height: 11px; }
.progress-fill {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width .5s cubic-bezier(.2, .8, .3, 1);
}
.progress-safe { background: linear-gradient(90deg, #22c55e, #10b981); }
.progress-warning { background: linear-gradient(90deg, #f59e0b, #f97316); }
.progress-danger { background: linear-gradient(90deg, #f97316, #ef4444); }
.progress-over { background: linear-gradient(90deg, #ef4444, #be123c); }
.progress-info { background: linear-gradient(90deg, #3b82f6, #6366f1); }

/* Loading */
.spinner {
  display: inline-block; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; opacity: .75;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty states */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 34px 20px; text-align: center;
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin-bottom: 12px;
  border-radius: 15px; background: var(--surface-3); color: var(--muted);
}
.empty-state h3 { margin: 0; font-size: 14px; font-weight: 750; color: var(--text); }
.empty-state p { margin: 6px 0 0; max-width: 340px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.empty-state .btn { margin-top: 14px; }

/* Amounts */
.amount-income { color: #15803d; font-weight: 700; }
.dark .amount-income { color: #34d399; }
.amount-expense { color: #dc2626; font-weight: 700; }
.dark .amount-expense { color: #fb7185; }
.amount-transfer { color: var(--brand); font-weight: 700; }

/* ==========================================================================
   Auth
   ========================================================================== */

body.is-auth { background: var(--bg); }

.auth-screen {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(28px + var(--safe-top)) 18px calc(28px + var(--safe-bottom));
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(59, 130, 246, .18), transparent 55%),
    radial-gradient(900px 700px at -10% 100%, rgba(124, 58, 237, .15), transparent 55%),
    linear-gradient(180deg, #f7f9fd, #eef3fb);
}
.dark .auth-screen {
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(59, 130, 246, .2), transparent 55%),
    radial-gradient(900px 700px at -10% 100%, rgba(124, 58, 237, .16), transparent 55%),
    linear-gradient(180deg, #08101e, #0a1322);
}
.auth-orb {
  position: absolute; border-radius: 50%; filter: blur(2px); pointer-events: none;
  opacity: .55;
}
.auth-orb-one { width: 320px; height: 320px; left: -120px; top: -70px; background: radial-gradient(circle at 35% 35%, rgba(59, 130, 246, .32), transparent 68%); }
.auth-orb-two { width: 380px; height: 380px; right: -150px; bottom: -120px; background: radial-gradient(circle at 60% 40%, rgba(124, 58, 237, .28), transparent 68%); }
.auth-orb-three { width: 240px; height: 240px; right: 15%; top: 8%; background: radial-gradient(circle at 50% 50%, rgba(14, 165, 233, .18), transparent 70%); }

.auth-shell { position: relative; z-index: 2; width: 100%; max-width: 430px; }
.auth-shell-setup { max-width: 580px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 18px; }
.auth-brand .brand-name { font-size: 18px; }
.auth-brand .brand-caption { font-size: 9px; }
.auth-card {
  padding: 26px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 26px;
  box-shadow: 0 30px 80px -36px rgba(15, 23, 42, .4);
  backdrop-filter: blur(16px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .auth-card { background: var(--surface); }
}
.auth-heading { text-align: center; margin-bottom: 20px; }
.auth-kicker { display: inline-block; margin-bottom: 7px; font-size: 9px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--brand); }
.auth-heading h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 800; letter-spacing: -.035em; color: var(--text); }
.auth-heading p { margin: 7px auto 0; max-width: 340px; font-size: 11.5px; line-height: 1.65; color: var(--muted); }
.auth-users { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.auth-user {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 13px;
  background: var(--surface); text-align: left;
  font-size: 12px; font-weight: 700; color: var(--muted);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.auth-user:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.auth-user.is-selected { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-soft); }
.auth-form { display: flex; flex-direction: column; }
.auth-form .field-label { margin-bottom: 6px; }
.pin-input-wrap { position: relative; }
.pin-input {
  width: 100%; height: 49px; padding: 8px 46px 8px 16px;
  border: 1px solid var(--border-strong); border-radius: 13px;
  background: var(--surface); color: var(--text);
  font-size: 21px; font-weight: 700; letter-spacing: .35em;
  outline: none; transition: border-color .16s ease, box-shadow .16s ease;
}
.pin-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.pin-input:disabled { opacity: .6; }
.pin-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.pin-eye:hover { background: var(--surface-2); color: var(--text); }
.auth-error { margin: 8px 0 0; font-size: 10.5px; font-weight: 650; color: #dc2626; }
.dark .auth-error { color: #fb7185; }
.pin-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.pin-keypad button {
  height: 43px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 700;
  transition: background .14s ease, transform .14s ease, border-color .14s ease;
}
.pin-keypad button:hover { background: var(--surface-2); border-color: var(--border-strong); }
.pin-keypad button:active { transform: scale(.96); background: var(--surface-3); }
.pin-keypad .pin-key-muted { color: var(--muted); background: var(--surface-2); }
.auth-submit { width: 100%; margin-top: 14px; min-height: 46px; }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.auth-links button, .auth-cloud-link {
  border: 0; background: transparent; padding: 0;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; color: var(--muted);
}
.auth-links button:hover, .auth-cloud-link:hover { color: var(--brand); }
.auth-google-wrap { margin-top: 16px; }
.auth-google {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--border-strong); border-radius: 11px;
  background: var(--surface); color: var(--text);
  font-size: 11.5px; font-weight: 700;
  transition: background .14s ease, border-color .14s ease;
}
.auth-google:hover { background: var(--surface-2); }
.auth-google:disabled { opacity: .65; cursor: progress; }
.auth-google.is-ghost { border-color: var(--border); background: transparent; color: var(--muted); font-weight: 650; }
.auth-google.is-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.auth-stack { display: flex; flex-direction: column; gap: 8px; }
.auth-google-hint { margin: 6px 0 0; font-size: 9px; line-height: 1.5; text-align: center; color: var(--muted-2); }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted-2); font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-install-tip {
  display: flex; gap: 6px; align-items: flex-start;
  margin: 14px 0 0; padding: 9px 10px; border-radius: 10px;
  background: var(--brand-soft); color: var(--muted);
  font-size: 9.5px; line-height: 1.55;
}
.auth-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; padding: 0 4px; font-size: 9px; color: var(--muted-2); }
.auth-private { display: inline-flex; align-items: center; gap: 4px; }
.setup-card { max-height: none; }
.setup-user-card { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.setup-check { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--muted); font-size: 9.5px; line-height: 1.55; }
.setup-check input { margin-top: 2px; accent-color: var(--brand); }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.networth-card {
  position: relative; overflow: hidden;
  padding: 24px; border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(700px 320px at 100% 0%, rgba(96, 165, 250, .28), transparent 65%),
    linear-gradient(135deg, #0b1d3a 0%, #102a57 48%, #1e3a8a 100%);
  box-shadow: 0 26px 55px -30px rgba(15, 23, 42, .65);
}
.networth-glow { position: absolute; width: 260px; height: 260px; right: -100px; bottom: -140px; border-radius: 50%; background: radial-gradient(circle, rgba(99, 102, 241, .5), transparent 68%); filter: blur(6px); }
.networth-label { margin: 0; font-size: 9px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .62); }
.networth-eye { border: 0; background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .75); width: 25px; height: 25px; border-radius: 8px; display: inline-grid; place-items: center; }
.networth-eye:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.networth-value { margin: 7px 0 0; font-size: clamp(29px, 4.2vw, 40px); line-height: 1.1; font-weight: 800; letter-spacing: -.045em; }
.networth-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12); font-size: 9px; font-weight: 700; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.networth-filter { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); font-size: 9px; font-weight: 700; color: #fff; white-space: nowrap; cursor: pointer; }
.networth-filter:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .4); }
.networth-flow { display: flex; align-items: center; gap: 17px; margin-top: 24px; flex-wrap: wrap; }
.networth-flow-label { display: block; font-size: 9px; color: rgba(255, 255, 255, .5); }
.networth-flow-value { display: block; margin-top: 2px; font-size: 13px; font-weight: 750; }
.networth-flow-value.income { color: #6ee7b7; }
.networth-flow-value.expense { color: #fda4af; }
.networth-divider { width: 1px; height: 28px; background: rgba(255, 255, 255, .13); }
.networth-accounts { display: flex; align-items: center; gap: 7px; margin-top: 22px; flex-wrap: wrap; }
.networth-account {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 9px;
  background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .85);
  font-size: 9.5px; transition: background .16s ease;
}
.networth-account:hover { background: rgba(255, 255, 255, .13); }
.networth-account strong { font-weight: 700; color: #fff; }
.networth-account-icon { display: inline-flex; color: #93c5fd; }
.networth-more { border: 0; background: transparent; color: rgba(255, 255, 255, .55); display: inline-grid; place-items: center; width: 24px; height: 24px; }
.networth-owners { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; }
.networth-owner { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 9.5px; color: rgba(255, 255, 255, .85); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.networth-owner-name { display: block; font-size: 9px; color: rgba(255, 255, 255, .55); margin-bottom: 1px; }
.networth-owner-balance { font-weight: 700; color: #fff; }
.networth-actions { display: flex; gap: 7px; margin-top: 18px; flex-wrap: wrap; }
.networth-actions button {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px;
  background: rgba(255, 255, 255, .08); color: #fff;
  font-size: 9.5px; font-weight: 650;
}
.networth-actions button:hover { background: rgba(255, 255, 255, .16); }

.budget-card { display: flex; flex-direction: column; }
.budget-scale { display: flex; justify-content: space-between; margin-top: 5px; font-size: 8.5px; font-weight: 650; color: var(--muted-2); }
.budget-scale span { transition: color .2s ease; }
.budget-alert, .budget-alert-safe, .budget-alert-warning {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 9px; border-radius: 8px;
  font-size: 9.5px; font-weight: 650;
}
.budget-alert, .budget-alert-danger { background: var(--red-soft); color: #dc2626; }
.dark .budget-alert { color: #fb7185; }
.budget-alert-warning { background: var(--amber-soft); color: #b45309; }
.dark .budget-alert-warning { color: #fbbf24; }
.budget-alert-safe { background: var(--green-soft); color: #15803d; }
.dark .budget-alert-safe { color: #34d399; }
.budget-mini-list { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.budget-mini-row { display: flex; flex-direction: column; gap: 4px; }
.budget-empty { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 0; }
.budget-empty .empty-icon { width: 42px; height: 42px; margin-bottom: 9px; }
.budget-empty p { margin: 0 0 12px; font-size: 11px; line-height: 1.6; color: var(--muted); }
.budget-footer-link {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin: 16px -20px -20px; padding: 11px 20px;
  border: 0; border-top: 1px solid var(--border);
  background: transparent; color: var(--muted);
  font-size: 10px; font-weight: 700;
}
.budget-footer-link:hover { color: var(--brand); background: var(--surface-2); }

.chart-card { min-width: 0; }
.chart-box { position: relative; height: 225px; min-width: 0; }
.chart-box-bars { height: 240px; }
.donut-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 18px; align-items: center; }
.chart-box-donut { height: 205px; }
.donut-legend { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.legend-row {
  display: grid; grid-template-columns: 9px minmax(0, 1fr) auto auto; align-items: center; gap: 7px;
  width: 100%; padding: 7px 6px; border: 0; border-radius: 8px; background: transparent;
  text-align: left; transition: background .15s ease;
}
.legend-row:hover { background: var(--surface-2); }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--legend-color, #94a3b8); flex: 0 0 auto; }
.legend-name { font-size: 10px; font-weight: 600; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-size: 9.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.legend-percent { font-size: 8.5px; font-weight: 600; color: var(--muted-2); width: 31px; text-align: right; }

/* Transaction rows */
.tx-list { display: flex; flex-direction: column; }
.tx-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 7px; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; text-align: left;
  border-radius: 9px; transition: background .15s ease;
}
.tx-row:last-child { border-bottom: 0; }
.tx-row:hover { background: var(--surface-2); }
.tx-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 35px; height: 35px; flex: 0 0 auto;
  border-radius: 11px;
  color: var(--tx-color, var(--brand));
  background: color-mix(in srgb, var(--tx-color, var(--brand)) 10%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .tx-icon { background: var(--surface-3); }
}
.tx-main { min-width: 0; flex: 1; }
.tx-title-line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.tx-title { display: block; font-size: 12px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-repeat { display: inline-flex; color: var(--muted-2); }
.tx-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tx-meta > span { overflow: hidden; text-overflow: ellipsis; }
.tx-creator { display: inline-flex; align-items: center; gap: 4px; max-width: 92px; }
.tx-creator::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--creator-color, #64748b); flex: 0 0 auto; }
.tx-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.tx-amount { font-size: 12px; font-weight: 750; white-space: nowrap; letter-spacing: -.01em; }
.tx-account-dot { display: inline-flex; align-items: center; gap: 3px; font-size: 8.5px; color: var(--muted-2); }
.tx-account-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--dot-color, #64748b); }
.tx-row-compact { padding: 8px 4px; }

.attention-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
.attention-strip button {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--muted);
  font-size: 9.5px; font-weight: 650;
}
.attention-strip button:hover { color: var(--text); border-color: var(--border-strong); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-tile {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text-soft);
  font-size: 10.5px; font-weight: 700; text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.quick-tile:hover { transform: translateY(-1px); border-color: var(--border-strong); background: var(--surface-2); }
.quick-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; }
.quick-expense .quick-icon { background: var(--red-soft); color: #dc2626; }
.quick-income .quick-icon { background: var(--green-soft); color: #15803d; }
.quick-transfer .quick-icon { background: var(--brand-soft); color: var(--brand); }
.quick-note .quick-icon { background: rgba(245, 158, 11, .11); color: #b45309; }

.mini-list { display: flex; flex-direction: column; gap: 3px; }
.mini-list-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 5px; border: 0; border-radius: 9px; background: transparent;
  text-align: left;
}
.mini-list-row:hover { background: var(--surface-2); }
.mini-list-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 auto; border-radius: 9px; background: color-mix(in srgb, var(--mini-color, #3b82f6) 11%, transparent); color: var(--mini-color, #3b82f6); }
.mini-check { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: 0 0 auto; border: 1.5px solid var(--border-strong); border-radius: 5px; color: #fff; }
.mini-check.is-done { background: var(--green); border-color: var(--green); }
.mini-empty { margin: 0; padding: 8px 4px; font-size: 10px; line-height: 1.6; color: var(--muted); }

/* Stat cards */
.stat-card {
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; font-size: 9px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.stat-value { margin-top: 7px; font-size: clamp(16px, 2.4vw, 21px); line-height: 1.15; font-weight: 800; letter-spacing: -.035em; color: var(--text); }
.stat-hint { margin-top: 3px; font-size: 8.5px; color: var(--muted-2); }
.stat-green .stat-icon { background: var(--green-soft); color: #15803d; }
.stat-red .stat-icon { background: var(--red-soft); color: #dc2626; }
.stat-blue .stat-icon { background: var(--brand-soft); color: var(--brand); }
.stat-amber .stat-icon { background: var(--amber-soft); color: #b45309; }
.stat-slate .stat-icon { background: var(--surface-3); color: var(--muted); }

/* ==========================================================================
   Transactions page
   ========================================================================== */

.filter-card { padding: 15px 16px; }
.filter-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.filter-title { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 750; color: var(--muted); }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.filter-search { grid-column: span 2; }
.filter-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.day-group { display: flex; flex-direction: column; gap: 2px; }
.day-group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 5px 7px; }
.day-group-label { display: block; font-size: 11px; font-weight: 750; color: var(--text); }
.day-group-date { display: block; margin-top: 1px; font-size: 8.5px; color: var(--muted-2); }
.day-group-totals { display: flex; align-items: center; gap: 9px; font-size: 9.5px; white-space: nowrap; }
.day-group .tx-list { padding: 0 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Calendar
   ========================================================================== */

.calendar-card { padding: 18px; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.month-nav { display: inline-flex; align-items: center; gap: 5px; }
.month-nav-label { min-width: 116px; text-align: center; font-size: 12px; font-weight: 750; color: var(--text); }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 16px; padding: 0 2px 5px; }
.calendar-weekdays span { text-align: center; font-size: 8.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-2); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-cell {
  position: relative; display: flex; flex-direction: column; min-height: 88px;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); text-align: left; overflow: hidden;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.calendar-cell:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.calendar-cell.is-outside { opacity: .42; background: transparent; }
.calendar-cell.is-weekend { background: color-mix(in srgb, var(--surface-2) 65%, transparent); }
.calendar-cell.is-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.calendar-cell.is-today .calendar-day-number { color: #fff; background: var(--brand); }
.calendar-day-number { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 7px; font-size: 10px; font-weight: 750; color: var(--muted); }
.calendar-day-data { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; min-height: 0; }
.calendar-amount { font-size: 7.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-amount.income { color: #15803d; }
.calendar-amount.expense { color: #dc2626; }
.dark .calendar-amount.income { color: #34d399; }
.dark .calendar-amount.expense { color: #fb7185; }
.calendar-cell-footer { display: flex; align-items: center; gap: 3px; margin-top: auto; padding-top: 3px; }
.calendar-count { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 5px; background: var(--surface-3); font-size: 7px; font-weight: 750; color: var(--muted); }
.calendar-due { display: inline-flex; color: var(--amber); }
.calendar-legend { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--border); font-size: 8.5px; color: var(--muted); }
.calendar-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.insight-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* ==========================================================================
   Notes
   ========================================================================== */

.notes-overview {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(59, 130, 246, .06), rgba(124, 58, 237, .06));
}
.notes-overview-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.notes-overview-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; color: var(--violet); background: rgba(124, 58, 237, .1); }
.notes-toolbar { padding: 13px 15px; }
.notes-tabs { display: flex; align-items: center; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.notes-tab {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 6px 9px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 10px; font-weight: 700;
}
.notes-tab span { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 5px; background: var(--surface-3); font-size: 8px; color: var(--muted-2); }
.notes-tab:hover { background: var(--surface-2); color: var(--text); }
.notes-tab.is-active { background: var(--brand-soft); color: var(--brand); }
.notes-tab.is-active span { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.notes-controls { display: flex; align-items: center; gap: 7px; margin-top: 11px; }
.notes-search-field { flex: 1; min-width: 0; }
.notes-tag-bar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tag-filter { padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted); font-size: 8.5px; font-weight: 650; }
.tag-filter:hover { border-color: var(--border-strong); color: var(--text); }
.tag-filter.is-active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand); }
.view-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.view-toggle button { width: 27px; height: 27px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-2); display: grid; place-items: center; }
.view-toggle button.is-active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.notes-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 13px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-2); color: var(--muted); font-size: 10px; line-height: 1.55;
}
.notes-banner > div, .notes-banner:not(.notes-banner-danger) { display: flex; align-items: center; gap: 7px; }
.notes-banner-danger { border-color: color-mix(in srgb, var(--red) 18%, transparent); background: var(--red-soft); color: #dc2626; }
.dark .notes-banner-danger { color: #fb7185; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 12px; align-items: start; }
.note-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  min-height: 174px; padding: 13px;
  border: 1px solid var(--note-border, #fde68a); border-radius: 15px;
  background: var(--note-bg, #fef3c7); color: var(--note-ink, #78350f);
  box-shadow: 0 8px 22px -18px rgba(15, 23, 42, .35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.note-card:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -22px rgba(15, 23, 42, .45); }
.note-card.is-archived { opacity: .78; }
.note-card.is-trashed { opacity: .7; filter: grayscale(.3); }
.note-card-top { display: flex; align-items: flex-start; gap: 7px; }
.note-card-title-wrap { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 0; color: inherit; }
.note-title { display: block; font-size: 12.5px; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere; }
.note-subline { display: flex; align-items: center; gap: 3px; margin-top: 2px; font-size: 8.5px; font-weight: 650; opacity: .68; }
.note-card-actions { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; opacity: .68; transition: opacity .15s ease; }
.note-card:hover .note-card-actions { opacity: 1; }
.note-card .card-icon-btn { color: inherit; }
.note-card .card-icon-btn:hover { background: rgba(255, 255, 255, .35); color: inherit; }
.note-card .card-icon-btn.active { color: inherit; background: rgba(255, 255, 255, .4); }
.note-card .card-icon-btn.danger:hover { background: rgba(220, 38, 38, .12); color: #b91c1c; }
.note-kind-icon { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; flex: 0 0 auto; border-radius: 6px; background: rgba(255, 255, 255, .45); }
.todo-check { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 auto; border: 1.5px solid currentColor; border-radius: 6px; background: transparent; color: inherit; opacity: .55; }
.todo-check.is-done { background: rgba(22, 163, 74, .16); border-color: #16a34a; color: #15803d; opacity: 1; }
.note-preview {
  display: block; flex: 1; margin: 9px 0 0; padding: 0; border: 0;
  background: transparent; color: inherit; text-align: left;
  font-size: 10px; line-height: 1.55; overflow-wrap: anywhere;
  white-space: pre-line; max-height: 96px; overflow: hidden;
  opacity: .84;
}
.note-preview p { margin: 0 0 5px; }
.note-preview ul, .note-preview ol { margin: 3px 0; padding-left: 14px; }
.note-preview h1, .note-preview h2, .note-preview h3 { margin: 4px 0; font-size: 11px; }
.note-preview blockquote { margin: 4px 0; padding-left: 7px; border-left: 2px solid currentColor; opacity: .8; }
.todo-preview { display: flex; flex-direction: column; gap: 6px; }
.todo-progress { display: flex; align-items: center; gap: 6px; }
.todo-progress .progress-track { flex: 1; background: rgba(255, 255, 255, .45); }
.todo-progress span { font-size: 8px; font-weight: 750; opacity: .7; }
.todo-preview-list { display: flex; flex-direction: column; gap: 2px; }
.todo-preview-item { display: flex; align-items: flex-start; gap: 5px; padding: 1px 0; border: 0; background: transparent; color: inherit; font-size: 9px; text-align: left; opacity: .85; }
.todo-preview-item .mini-check { width: 13px; height: 13px; border-color: currentColor; opacity: .6; }
.todo-preview-item .mini-check.is-done { background: rgba(22, 163, 74, .2); border-color: #16a34a; }
.todo-preview-item.is-done > span:last-child { text-decoration: line-through; opacity: .6; }
.todo-more { font-size: 8px; opacity: .65; }
.note-card-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.note-badges { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.note-badges .badge { background: rgba(255, 255, 255, .45); color: inherit; }
.note-badges .badge-red { background: rgba(220, 38, 38, .14); color: #b91c1c; }
.note-tags { display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
.note-tag { padding: 2px 5px; border-radius: 5px; background: rgba(255, 255, 255, .38); font-size: 7.5px; font-weight: 650; opacity: .85; }
.note-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(15, 23, 42, .08); font-size: 7.5px; opacity: .55; }
.notes-list-view { grid-template-columns: 1fr; }
.note-card-list { min-height: 0; }
.note-card-list .note-preview { max-height: 52px; }
.task-sheet-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; }
.task-sheet-row:hover { background: var(--surface-2); }

/* Note editor */
.note-editor-body { background: linear-gradient(180deg, var(--note-editor-tint, rgba(254, 243, 199, .26)), transparent 180px); }
.note-title-row { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.note-title-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 20px; font-weight: 800; letter-spacing: -.025em; outline: none; padding: 4px 0; }
.note-title-input::placeholder { color: var(--muted-2); font-weight: 700; }
.note-flag.is-active { color: var(--amber); background: var(--amber-soft); }
.note-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px; margin-bottom: 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.note-toolbar button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: grid; place-items: center; font-size: 11px; }
.note-toolbar button:hover { background: var(--surface); color: var(--text); }
.note-toolbar span { width: 1px; height: 17px; background: var(--border); margin: 0 2px; }
.note-content-editor {
  min-height: 150px; padding: 12px; border: 1px solid var(--border-strong);
  border-radius: 11px; background: var(--surface); color: var(--text);
  font-size: 13px; line-height: 1.65; outline: none;
}
.note-content-editor:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.note-content-editor:empty::before { content: attr(data-placeholder); color: var(--muted-2); pointer-events: none; }
.note-content-editor ul, .note-content-editor ol { padding-left: 20px; margin: 5px 0; }
.note-content-editor blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.note-editor-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; padding-top: 9px; border-top: 1px solid var(--border); font-size: 8.5px; color: var(--muted-2); flex-wrap: wrap; }
.note-save-status { font-size: 8.5px; font-weight: 650; color: var(--muted-2); white-space: nowrap; }
.note-color-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note-color-dot { width: 24px; height: 24px; border: 2px solid var(--note-swatch-border, #e2e8f0); border-radius: 8px; background: var(--note-swatch, #fef3c7); transition: transform .15s ease, box-shadow .15s ease; }
.note-color-dot:hover { transform: scale(1.07); }
.note-color-dot.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.todo-editor { margin-top: 14px; }
.todo-items { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.todo-item-row { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.todo-item-check { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 auto; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: #fff; }
.todo-item-check.is-done { background: var(--green); border-color: var(--green); }
.todo-item-input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 11.5px; color: var(--text); }
.todo-item-actions { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }
.todo-item-actions .card-icon-btn { width: 23px; height: 23px; }

/* ==========================================================================
   Accounts
   ========================================================================== */

.accounts-hero {
  position: relative; overflow: hidden; padding: 24px; border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(600px 280px at 95% 10%, rgba(56, 189, 248, .25), transparent 60%),
    linear-gradient(135deg, #0f172a, #1e3a8a 70%, #312e81);
  box-shadow: 0 24px 52px -30px rgba(15, 23, 42, .65);
}
.accounts-hero-value { margin: 7px 0 0; font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -.04em; }
.accounts-hero-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 17px; font-size: 9.5px; color: rgba(255, 255, 255, .68); }
.accounts-hero-meta span { display: inline-flex; align-items: center; gap: 4px; }
.accounts-hero-ring { position: absolute; width: 230px; height: 230px; right: -90px; bottom: -120px; border: 1px solid rgba(255, 255, 255, .13); border-radius: 50%; }
.accounts-hero-ring-two { width: 340px; height: 340px; right: -150px; bottom: -170px; }
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.account-card {
  padding: 15px; border: 1px solid var(--border); border-left: 3px solid var(--account-color, var(--brand));
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
}
.account-card.is-archived { opacity: .72; }
.account-card-top { display: flex; align-items: center; gap: 9px; }
.account-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; color: var(--account-color, var(--brand)); background: color-mix(in srgb, var(--account-color, var(--brand)) 11%, transparent); }
.account-name { margin: 0; font-size: 12px; font-weight: 750; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-type { margin: 1px 0 0; font-size: 8.5px; color: var(--muted); }
.account-balance { margin-top: 15px; font-size: 22px; font-weight: 800; letter-spacing: -.035em; color: var(--text); }
.account-balance.is-negative { color: #dc2626; }
.dark .account-balance.is-negative { color: #fb7185; }
.account-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 8px; color: var(--muted-2); }
.account-bar { height: 4px; margin-top: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.account-bar span { display: block; height: 100%; border-radius: inherit; background: var(--account-color, var(--brand)); }
.account-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.info-tile { padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.info-tile span { display: inline-flex; color: var(--brand); }
.info-tile strong { display: block; margin-top: 6px; font-size: 10.5px; color: var(--text); }
.info-tile p { margin: 2px 0 0; font-size: 9px; line-height: 1.5; color: var(--muted); }
.account-form-balance { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 10px; color: var(--muted); }
.account-form-balance strong { font-size: 14px; color: var(--text); }

/* ==========================================================================
   Budgets
   ========================================================================== */

.budget-hero { padding: 15px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.budget-hero-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.budget-hero-value { margin: 4px 0 0; font-size: clamp(24px, 3.5vw, 32px); font-weight: 800; letter-spacing: -.04em; color: var(--text); }
.budget-set-form { display: flex; align-items: flex-end; gap: 7px; }
.budget-set-form .field-label { width: 150px; }
.budget-hero-progress { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border); }
.budget-percent { font-size: 9px; }
.budget-scale-four { margin-top: 5px; }
.budget-metric { padding: 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.budget-metric span { display: block; font-size: 8px; color: var(--muted-2); }
.budget-metric strong { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text); }
.budget-category-list { display: flex; flex-direction: column; gap: 12px; }
.budget-category-row { padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.budget-cat-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.budget-input { display: flex; align-items: center; gap: 3px; padding: 3px 7px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.budget-input span { font-size: 8.5px; font-weight: 700; color: var(--muted-2); }
.budget-input input { width: 92px; border: 0; background: transparent; outline: none; font-size: 10.5px; text-align: right; color: var(--text); }
.budget-cat-over { margin: 4px 0 0; text-align: right; font-size: 8.5px; font-weight: 700; color: #dc2626; }
.dark .budget-cat-over { color: #fb7185; }
.threshold-preview { display: flex; align-items: center; gap: 4px; padding: 8px; border-radius: 8px; background: var(--surface-2); }
.threshold-preview span { flex: 1; padding: 5px 6px; border-radius: 5px; color: #fff; text-align: center; font-size: 7.5px; font-weight: 750; }

/* ==========================================================================
   Recurring
   ========================================================================== */

.recurring-alert {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 22%, transparent);
  border-radius: var(--radius); background: var(--amber-soft);
}
.recurring-alert-icon { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; flex: 0 0 auto; border-radius: 10px; background: color-mix(in srgb, var(--amber) 18%, transparent); color: #b45309; }
.recurring-list { display: flex; flex-direction: column; }
.recurring-row { display: flex; align-items: center; gap: 10px; padding: 11px 3px; border-bottom: 1px solid var(--border); }
.recurring-row:last-child { border-bottom: 0; }
.recurring-row.is-paused { opacity: .62; }
.recurring-main { flex: 1; min-width: 0; }
.recurring-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.recurring-actions { display: flex; align-items: center; gap: 0; }
.recurring-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.recurring-steps li { display: flex; gap: 9px; }
.recurring-steps li > span { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; flex: 0 0 auto; border-radius: 7px; background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 800; }
.recurring-steps strong { display: block; font-size: 10.5px; color: var(--text); }
.recurring-steps p { margin: 1px 0 0; font-size: 9.5px; line-height: 1.5; color: var(--muted); }

/* ==========================================================================
   Categories
   ========================================================================== */

.category-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 15px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented-control { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.segmented-control button { display: inline-flex; align-items: center; gap: 4px; padding: 6px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 9.5px; font-weight: 700; }
.segmented-control button.is-active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .09); }
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.category-card { padding: 14px; border: 1px solid var(--border); border-top: 3px solid var(--category-color, var(--brand)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.category-card-head { display: flex; align-items: center; gap: 8px; }
.category-icon { display: inline-flex; align-items: center; justify-content: center; width: 37px; height: 37px; flex: 0 0 auto; border-radius: 11px; color: var(--category-color, var(--brand)); background: color-mix(in srgb, var(--category-color, var(--brand)) 11%, transparent); }
.category-name { margin: 0; font-size: 11.5px; font-weight: 750; color: var(--text); }
.category-meta { margin: 1px 0 0; font-size: 8px; color: var(--muted-2); }
.category-total { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; padding: 8px 9px; border-radius: 8px; background: var(--surface-2); font-size: 8.5px; color: var(--muted); }
.category-total strong { font-size: 11.5px; }
.subcategory-list { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.subcategory-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 8px; font-weight: 600; }
.subcategory-chip button { width: 13px; height: 13px; border: 0; border-radius: 4px; background: transparent; color: var(--muted-2); display: grid; place-items: center; padding: 0; }
.subcategory-chip button:hover { background: var(--red-soft); color: #dc2626; }
.subcategory-add { display: inline-flex; align-items: center; gap: 2px; padding: 3px 6px; border: 1px dashed var(--border-strong); border-radius: 6px; background: transparent; color: var(--muted-2); font-size: 8px; font-weight: 650; }
.subcategory-add:hover { color: var(--brand); border-color: var(--brand); }
.category-note { display: flex; align-items: center; gap: 3px; margin: 9px 0 0; font-size: 7.5px; color: var(--muted-2); }
.category-preview { display: flex; align-items: center; gap: 9px; margin-top: 13px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--preview-color, #64748b) 7%, var(--surface)); }
.category-preview > span { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; border-radius: 10px; color: var(--preview-color, var(--brand)); background: color-mix(in srgb, var(--preview-color, #64748b) 14%, transparent); }
.category-preview strong { display: block; font-size: 11px; color: var(--text); }
.category-preview small { display: block; font-size: 8.5px; color: var(--muted); }
.categories-usage { display: flex; flex-direction: column; gap: 9px; }
.color-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.color-dot { width: 25px; height: 25px; border: 2px solid transparent; border-radius: 8px; background: var(--pick-color, var(--brand)); transition: transform .15s ease, box-shadow .15s ease; }
.color-dot:hover { transform: scale(1.08); }
.color-dot.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* ==========================================================================
   Reports
   ========================================================================== */

.report-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.report-month-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.report-category-list { display: flex; flex-direction: column; gap: 9px; }
.report-category-row { display: grid; grid-template-columns: minmax(90px, 1.1fr) minmax(70px, 1fr) auto auto; align-items: center; gap: 8px; }
.report-category-bar .progress-track { height: 5px; }
.report-category-amount { font-size: 9.5px; font-weight: 700; color: var(--text); text-align: right; white-space: nowrap; }
.report-category-percent { width: 38px; font-size: 8.5px; color: var(--muted-2); text-align: right; }
.report-highlight { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding: 9px 10px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); }
.report-highlight p { margin: 0; font-size: 9px; line-height: 1.5; color: var(--text-soft); }
.creator-row { display: flex; align-items: center; gap: 8px; }
.creator-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 999px; color: #fff; background: var(--creator-color, var(--brand)); font-size: 10px; font-weight: 750; }
.report-divider { height: 1px; margin: 12px 0; background: var(--border); }
.table-wrap { overflow-x: auto; margin: 0 -5px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.report-table th { padding: 7px 5px; border-bottom: 1px solid var(--border); text-align: left; font-size: 8px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.report-table td { padding: 8px 5px; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.report-table tr:last-child td { border-bottom: 0; }
.export-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 20px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  background: linear-gradient(135deg, var(--brand-soft), rgba(124, 58, 237, .06));
}
.dark .export-card { background: linear-gradient(135deg, rgba(37, 99, 235, .12), rgba(124, 58, 237, .08)); }

/* ==========================================================================
   Settings
   ========================================================================== */

.settings-profile {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-list { display: flex; flex-direction: column; }
.settings-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 2px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: inherit; }
.settings-row:last-child { border-bottom: 0; }
.settings-row:hover { background: var(--surface-2); }
.settings-row-icon { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; flex: 0 0 auto; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.settings-row strong { display: block; font-size: 10.5px; font-weight: 700; color: var(--text); }
.settings-row small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--muted-2); }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 6px; }
.theme-option { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 650; }
.theme-option:hover { border-color: var(--border-strong); }
.theme-option.is-active { border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-soft); color: var(--brand); }
.cloud-provider-select { margin-bottom: 13px; }
.cloud-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.cloud-security-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 13px; padding: 10px; border-radius: 9px; background: var(--amber-soft); color: #b45309; }
.dark .cloud-security-note { color: #fbbf24; }
.cloud-security-note p { margin: 0; font-size: 8.5px; line-height: 1.55; }
.cloud-status-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.gdrive-account { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.gdrive-account.is-empty { color: var(--muted-2); }
.gdrive-account strong { display: block; font-size: 10px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gdrive-account small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--muted-2); }
.gdrive-avatar { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 999px; object-fit: cover; background: var(--surface-3); }
.gdrive-avatar.is-fallback { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.cloud-origin { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); font-size: 9px; word-break: break-all; }
.drive-backup-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.drive-backup-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); text-align: left; }
.drive-backup-row:hover { border-color: var(--border-strong); background: var(--surface-3); }
.drive-backup-row strong { display: block; font-size: 10px; font-weight: 700; color: var(--text); word-break: break-all; }
.drive-backup-row small { display: block; margin-top: 2px; font-size: 8.5px; color: var(--muted-2); }
.drive-backup-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; background: var(--brand-soft); color: var(--brand); }
.btn.is-disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }
.data-usage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.data-usage > div { padding: 8px; border-radius: 8px; background: var(--surface-2); }
.data-usage span { display: block; font-size: 8px; color: var(--muted-2); }
.data-usage strong { display: block; margin-top: 2px; font-size: 12px; font-weight: 750; color: var(--text); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.about-card { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.install-step { display: flex; gap: 9px; }
.install-step > span { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.install-step strong { display: block; font-size: 11px; color: var(--text); }
.install-step p { margin: 2px 0 0; font-size: 9.5px; line-height: 1.55; color: var(--muted); }

/* ==========================================================================
   Modals
   ========================================================================== */

#modal-root {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#modal-root.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 15, 30, .52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn .2s ease;
}
.modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-height: calc(100dvh - 40px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px) scale(.985);
  transition: opacity .22s ease, transform .22s cubic-bezier(.2, .8, .3, 1);
}
.modal-panel.modal-in { opacity: 1; transform: translateY(0) scale(1); }
.modal-sm { max-width: 400px; }
.modal-md { max-width: 520px; }
.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }
.modal-full { max-width: 1080px; }
.form-modal { overflow: hidden; display: flex; flex-direction: column; }
.form-modal.modal-panel { overflow-y: auto; }
.modal-form { display: flex; flex-direction: column; min-height: 0; }
.modal-header {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 13px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.modal-kicker { margin: 0 0 2px; font-size: 8.5px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }
.modal-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.025em; color: var(--text); }
.modal-body { padding: 16px 18px; }
.modal-footer {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  padding: 12px 18px calc(12px + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.sheet-handle { width: 38px; height: 4px; margin: 8px auto 0; border-radius: 999px; background: var(--border-strong); }
.sheet-panel { max-width: 520px; }
.confirm-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Modal form internals */
.type-segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.type-segment-btn { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 5px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.type-segment-btn:hover { color: var(--text); }
.type-segment-btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.type-segment-btn.type-expense.is-active { color: #dc2626; }
.type-segment-btn.type-income.is-active { color: #15803d; }
.type-segment-btn.type-transfer.is-active { color: var(--brand); }
.dark .type-segment-btn.type-expense.is-active { color: #fb7185; }
.dark .type-segment-btn.type-income.is-active { color: #34d399; }
.note-kind-segment { grid-template-columns: 1fr 1fr; }
.calculator-card { padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.calc-display {
  width: 100%; margin-top: 5px; padding: 7px 4px;
  border: 0; border-bottom: 1px dashed var(--border-strong);
  background: transparent; color: var(--text);
  font-size: 28px; font-weight: 800; letter-spacing: -.035em; outline: none;
}
.calc-display::placeholder { color: var(--muted-2); }
.calc-result { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 2px 9px; font-size: 9px; font-weight: 650; color: var(--muted-2); }
.calc-result span { display: inline-flex; align-items: center; gap: 4px; }
.calc-result strong { font-size: 12px; font-weight: 750; }
.calc-keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.calc-key { min-height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 650; transition: background .12s ease, transform .12s ease; }
.calc-key:hover { background: var(--surface-3); }
.calc-key:active { transform: scale(.96); }
.calc-key-muted { background: var(--surface-3); color: var(--muted); }
.calc-key-op { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.calc-key-equal { grid-row: span 2; background: linear-gradient(135deg, #2563eb, #4f46e5); border-color: transparent; color: #fff; font-size: 18px; }
.tx-form-meta { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 8.5px; color: var(--muted-2); flex-wrap: wrap; }
.creator-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 5px; background: var(--surface-3); font-size: 8.5px; font-weight: 700; color: var(--text-soft); }
.creator-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--creator-color, var(--brand)); }
.tx-edit-note { display: flex; align-items: center; gap: 5px; margin-top: 10px; padding: 7px 9px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 8.5px; }
.recurring-box { margin-top: 14px; padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.recurring-extra { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.toggle-row strong { display: block; font-size: 10.5px; color: var(--text); }
.toggle-row small { display: block; margin-top: 1px; font-size: 8.5px; color: var(--muted-2); }
.compact-toggle { padding: 7px 0; }
.profile-menu { display: flex; flex-direction: column; }
.profile-menu-item { display: flex; align-items: center; gap: 9px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text-soft); font-size: 11px; font-weight: 600; text-align: left; }
.profile-menu-item:last-child { border-bottom: 0; }
.profile-menu-item:hover { color: var(--brand); }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.more-tile { display: flex; align-items: center; gap: 8px; padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--muted); }
.more-tile:hover { border-color: var(--border-strong); color: var(--text); }
.more-tile > span { display: inline-flex; color: var(--brand); }
.more-tile strong { font-size: 10.5px; }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-root {
  position: fixed; z-index: 200; right: 18px; bottom: calc(18px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 7px; width: min(370px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); box-shadow: var(--shadow-md);
  color: var(--text-soft); font-size: 10.5px; font-weight: 550;
  opacity: 0; transform: translateY(8px) scale(.985);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: auto; cursor: pointer;
}
.toast.toast-in { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 auto; border-radius: 7px; background: var(--green-soft); color: #15803d; }
.toast-error .toast-icon { background: var(--red-soft); color: #dc2626; }
.toast-info .toast-icon { background: var(--brand-soft); color: var(--brand); }
.toast-message { flex: 1; min-width: 0; }
.toast-action { border: 0; border-radius: 6px; padding: 4px 7px; background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 750; white-space: nowrap; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1279px) {
  .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-search { grid-column: span 2; }
}

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .app-main { padding-left: 0; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .mobile-brand { display: flex; }
  .topbar-date { display: none; }
  .page-content { padding: 20px 16px calc(106px + var(--safe-bottom)); }
  .fab { right: 16px; bottom: calc(82px + var(--safe-bottom)); width: 52px; height: 52px; border-radius: 16px; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; align-items: stretch; justify-content: space-around;
    padding: 6px 8px calc(6px + var(--safe-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  @supports not (background: color-mix(in srgb, red 50%, blue)) {
    .bottom-nav { background: var(--surface); }
  }
  .bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    flex: 1; min-height: 46px; padding: 3px;
    border: 0; border-radius: 9px; background: transparent;
    color: var(--muted-2); font-size: 8px; font-weight: 650;
    text-decoration: none;
  }
  .bottom-nav-item.is-active { color: var(--brand); }
  .bottom-nav-item.is-active svg { stroke-width: 2.15; }
  .toast-root { bottom: calc(92px + var(--safe-bottom)); right: 12px; left: 12px; width: auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .chart-box { height: 210px; }
}

@media (max-width: 767px) {
  /* Kunci pembungkus utama agar aplikasi tidak melebar ke kanan */
  html, body, .app-shell, .app-main, .page-content {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Mencegah card, grid, dan elemen flex mendorong lebar layar */
  .page-stack,
  .card,
  .stat-card,
  .day-group,
  .networth-card,
  .accounts-hero,
  .tx-row,
  .schedule-item {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Perbaikan Aksi Cepat / Quick Actions agar tidak overflow */
  .quick-grid,
  .quick-actions-grid,
  .actions-wrapper {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .quick-tile,
  .quick-actions-grid .btn,
  .actions-wrapper .btn {
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px !important;
    font-size: 9.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Pemotongan teks judul & catatan pada baris transaksi agar tidak memanjangkan kontainer */
  .tx-title,
  .tx-meta,
  .schedule-title {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    min-width: 0 !important;
  }

  /* Perbaikan input & select agar ukurannya pas & tidak memaksa melebarkan kontainer */
  input[type="date"].field,
  input[type="month"].field,
  input[type="datetime-local"].field,
  select.field,
  .filter-grid .field,
  .filter-grid select,
  .filter-grid input {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    text-overflow: ellipsis !important;
  }

  .page-stack { gap: 14px; }
  .page-title { font-size: 23px; }
  .page-subtitle { font-size: 11.5px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .card { padding: 15px; border-radius: 16px; }
  .networth-card { padding: 18px; border-radius: 20px; }
  .accounts-hero { padding: 18px; border-radius: 20px; }
  .networth-flow { gap: 12px; margin-top: 18px; }
  .networth-flow-value { font-size: 11.5px; }
  .networth-accounts { margin-top: 16px; }
  .networth-account { max-width: 100%; }
  .networth-actions { margin-top: 14px; }
  .donut-layout { grid-template-columns: 1fr; gap: 6px; }
  .chart-box-donut { height: 184px; }
  .chart-box-bars { height: 205px; }

  /* Grid filter transaksi pada tampilan mobile */
  .filter-card { overflow: hidden !important; }
  .filter-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .filter-search { grid-column: span 2 !important; }

  .calendar-card { padding: 12px; }
  .calendar-grid { gap: 2px; }
  .calendar-cell { min-height: 66px; padding: 4px; border-radius: 8px; }
  .calendar-day-number { width: 18px; height: 18px; font-size: 9px; }
  .calendar-amount { font-size: 6.5px; }
  .calendar-legend { gap: 9px; }
  .calendar-weekdays { margin-top: 12px; }
  .notes-controls { flex-wrap: wrap; }
  .notes-search-field { flex-basis: 100%; }
  .notes-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .note-card { min-height: 158px; padding: 10px; }
  .note-title { font-size: 11.5px; }
  .note-card-actions { opacity: .8; }
  .note-preview { font-size: 9px; max-height: 72px; }
  .settings-profile { padding: 13px; }
  .settings-profile > .flex { width: 100%; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .budget-hero-main { align-items: stretch; }
  .budget-set-form { width: 100%; }
  .budget-set-form .field-label { flex: 1; width: auto; }
  .budget-category-row { padding: 9px; }
  .recurring-side { align-items: flex-end; }
  .recurring-actions .card-icon-btn:nth-child(2) { display: none; }
  .reports .report-category-row { grid-template-columns: minmax(80px, 1fr) auto auto; }
  .report-category-bar { display: none; }
  .export-card { padding: 16px; }
  .modal-panel { border-radius: 18px; }
  #modal-root { padding: 10px; align-items: flex-end; }
  .modal-panel { max-height: calc(100dvh - 20px); }
  .sheet-panel { border-radius: 20px 20px 0 0; }
  .modal-header { padding: 14px 15px 11px; }
  .modal-body { padding: 14px 15px; }
  .modal-footer { padding: 10px 15px calc(10px + var(--safe-bottom)); }
  .modal-footer .btn { padding-left: 11px; padding-right: 11px; }
  .type-segment-btn { font-size: 9px; }
  .calc-display { font-size: 24px; }
  .auth-card { padding: 20px; border-radius: 22px; }
  .auth-heading h1 { font-size: 21px; }
  .auth-shell { max-width: 430px; }
}

@media (max-width: 420px) {
  .notes-grid { grid-template-columns: 1fr; }
  .quick-tile { padding: 8px; font-size: 9.5px; }
  .stat-card { padding: 11px; }
  .stat-value { font-size: 15px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-search { grid-column: span 1; }
  .calendar-cell { min-height: 57px; }
  .calendar-amount { font-size: 6px; }
  .calendar-cell-footer { display: none; }
  .auth-links { justify-content: center; }
  .auth-footer { flex-direction: column; gap: 4px; }
  .more-grid { grid-template-columns: 1fr; }
  .theme-options { grid-template-columns: 1fr; }
  .data-usage { grid-template-columns: 1fr 1fr; }
}

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

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .toast-root, #modal-root { display: none !important; }
  .app-main { padding: 0 !important; }
  .page-content { padding: 0 !important; max-width: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .stat-card, .accounts-hero, .networth-card { box-shadow: none !important; break-inside: avoid; }
  .page-actions, .link-button, .btn { display: none !important; }
}

/* Cegah Auto-Zoom pada Form Input */
input, select, textarea {
  font-size: 16px !important; /* Mencegah Safari auto-zoom saat fokus */
}

/* Matikan Behavior Gesture bawaan iOS & Kunci Geser Horizontal */
html, body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  position: relative;
  touch-action: pan-y; /* HANYA izinkan scroll atas-bawah (mati geser kiri-kanan) */
  overscroll-behavior-x: none; /* Mencegah efek bounce geser samping */
  overscroll-behavior-y: none; /* Mencegah efek bounce saat scroll habis */
  -webkit-user-select: none;
  user-select: none;
}

/* Izinkan seleksi teks khusus di elemen input */
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* Kunci pembungkus utama app shell */
.app-shell,
.app-main,
.page-content {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
