:root {
  color-scheme: dark;
  --app-bg: #090b10;
  --surface: #11151c;
  --surface-muted: #171c24;
  --surface-soft: #202734;
  --line: #28313d;
  --line-strong: #394555;
  --ink: #f2f5fa;
  --ink-soft: #d6deea;
  --muted: #99a6b7;
  --muted-soft: #738196;
  --brand: #a78bfa;
  --brand-dark: #c4b5fd;
  --brand-soft: #241c3a;
  --income: #55d6a0;
  --income-soft: #132b24;
  --expense: #fb7185;
  --expense-soft: #351a22;
  --warning: #fbbf24;
  --warning-soft: #302717;
  --violet: #b39aff;
  --violet-soft: #241c3a;
  --teal: #5eead4;
  --teal-soft: #12312f;
  --info: #7db7ff;
  --info-soft: #17283d;
  --radius-card: 1.5rem;
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.24);
  --shadow-hover: 0 22px 48px rgba(0, 0, 0, 0.38);
}

[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  min-width: 320px;
  overflow-x: hidden;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(139, 92, 246, 0.13), transparent 30rem),
    radial-gradient(circle at 100% 0, rgba(34, 211, 238, 0.07), transparent 26rem),
    var(--app-bg);
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(167, 139, 250, 0.42);
  outline-offset: 2px;
}

body > header {
  background: rgba(9, 11, 16, 0.9);
  border-color: var(--line);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 0 0, rgba(139, 92, 246, 0.15), transparent 30rem),
    radial-gradient(circle at 100% 0, rgba(34, 211, 238, 0.08), transparent 26rem),
    var(--app-bg);
}

[data-theme="dark"] body > header {
  background: rgba(9, 11, 16, 0.9);
}

body main {
  background: transparent;
}

/* Shared surfaces */
.card-glass,
.analytics-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.card-glass {
  border-radius: var(--radius-card);
}

.card-glass-hover {
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s ease;
}

.card-glass-hover:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
}

body .bg-white,
body .bg-white\/85,
body .bg-slate-50,
body .bg-slate-50\/60,
body .bg-slate-50\/70 {
  background-color: var(--surface);
}

body .bg-slate-100,
body .bg-slate-100\/90 {
  background-color: var(--surface-muted);
}

body .text-slate-900,
body .text-slate-800,
body .text-slate-700 {
  color: var(--ink);
}

body .text-slate-600,
body .text-slate-500 {
  color: var(--muted);
}

body .text-slate-400 {
  color: var(--muted-soft);
}

body input,
body select,
body textarea {
  color: var(--ink);
  background-color: var(--surface);
  border-color: var(--line);
}

body input::placeholder,
body textarea::placeholder {
  color: var(--muted-soft);
}

[data-theme="dark"] .chart-stage,
.chart-stage {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(23, 32, 51, 0.5));
}

[data-theme="dark"] .glass,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .table-shell,
.glass,
.stat-card,
.table-shell {
  background: var(--surface);
  border-color: var(--line);
}

.category-progress {
  background: #303846;
}

body .border-slate-100,
body .border-slate-200,
body .border-slate-200\/80,
body .border-slate-200\/90 {
  border-color: var(--line);
}

body .hover\:bg-slate-50:hover,
body .hover\:bg-slate-100:hover,
body .hover\:bg-slate-200:hover {
  background-color: var(--surface-muted);
}

/* Semantic utility colors used by the templates */
body .bg-indigo-50,
body .bg-indigo-100 {
  background-color: var(--brand-soft);
}

body .bg-emerald-50,
body .bg-emerald-100 {
  background-color: var(--income-soft);
}

body .bg-rose-50,
body .bg-rose-100 {
  background-color: var(--expense-soft);
}

body .bg-violet-50,
body .bg-violet-100 {
  background-color: var(--violet-soft);
}

body .bg-amber-50,
body .bg-amber-100 {
  background-color: var(--warning-soft);
}

body .bg-teal-50,
body .bg-teal-100 {
  background-color: var(--teal-soft);
}

body .bg-blue-50,
body .bg-blue-100 {
  background-color: var(--info-soft);
}

body .text-indigo-600,
body .text-indigo-700,
body .text-indigo-800 {
  color: var(--brand-dark);
}

body .text-emerald-600,
body .text-emerald-700,
body .text-emerald-800 {
  color: var(--income);
}

body .text-rose-600,
body .text-rose-700,
body .text-rose-800 {
  color: var(--expense);
}

body .text-violet-600,
body .text-violet-700,
body .text-violet-800 {
  color: var(--violet);
}

body .text-amber-600,
body .text-amber-700,
body .text-amber-800 {
  color: var(--warning);
}

body .text-teal-600,
body .text-teal-700,
body .text-teal-800 {
  color: var(--teal);
}

body .text-blue-600,
body .text-blue-700,
body .text-blue-800 {
  color: var(--info);
}

body .border-indigo-100,
body .border-indigo-200,
body .border-indigo-300 {
  border-color: #40345f;
}

body .border-emerald-100,
body .border-emerald-200,
body .border-emerald-300 {
  border-color: #244c3b;
}

body .border-rose-100,
body .border-rose-200,
body .border-rose-300 {
  border-color: #58303a;
}

body .border-violet-100,
body .border-violet-200,
body .border-violet-300 {
  border-color: #40345f;
}

body .border-amber-100,
body .border-amber-200,
body .border-amber-300 {
  border-color: #514326;
}

body .border-teal-100,
body .border-teal-200,
body .border-teal-300 {
  border-color: #244c4a;
}

body .border-blue-100,
body .border-blue-200,
body .border-blue-300 {
  border-color: #293f5a;
}

/* Branding */
.rainbow-logo-icon {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.22);
}

.rainbow-logo-text {
  color: transparent;
  background: linear-gradient(90deg, #ff4d8d, #ff9f43, #ffe45e, #52d681, #39c5ff, #7866ff, #e45bff, #ff4d8d);
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brandHueFlow 12s linear infinite;
}

.ledger-brand-name {
  color: transparent;
  background: linear-gradient(90deg, #ff4d8d, #ff9f43, #ffe45e, #52d681, #39c5ff, #7866ff, #e45bff, #ff4d8d);
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brandHueFlow 12s linear infinite;
}

@keyframes brandHueFlow {
  to { filter: hue-rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rainbow-logo-text,
  .ledger-brand-name {
    animation: none;
  }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.92); }
}

.storage-ready-dot {
  animation: pulseGlow 2s infinite ease-in-out;
}

/* Dashboard analytics */
.analytics-shell {
  align-items: stretch;
}

.analytics-panel {
  position: relative;
  overflow: hidden;
}

.analytics-panel-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.14), transparent 45%);
}

.analytics-panel-glow.income {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.14), transparent 45%);
}

.analytics-panel-glow.expense {
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.14), transparent 45%);
}

.analytics-panel-glow.vault {
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.14), transparent 45%);
}

.analytics-panel-glow.transfer {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.14), transparent 45%);
}

.analytics-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.analytics-switch {
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.analytics-switch button {
  white-space: nowrap;
}

.analytics-switch button.bg-white {
  color: var(--brand-dark);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 2px 6px rgba(51, 65, 85, 0.08);
}

.analytics-metric {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface-muted);
}

.analytics-metric.compact {
  padding: 0.75rem;
}

.analytics-metric .metric-label,
.analytics-metric span.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.analytics-metric strong {
  display: block;
  min-width: 0;
  margin-top: 0.2rem;
  font-size: clamp(0.84rem, 1.4vw, 1.08rem);
  line-height: 1.25;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.analytics-metric small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.chart-stage {
  z-index: 1;
  padding: 0.65rem 0.25rem 0;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(30, 37, 49, 0.9), rgba(17, 21, 28, 0.5));
}

.donut-stage {
  z-index: 1;
}

.donut-center-label {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(8.75rem, 58%);
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.donut-center-label span,
.analytics-mini-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.donut-center-label strong,
.analytics-mini-summary strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink);
  font-size: clamp(0.86rem, 1.4vw, 1.05rem);
  line-height: 1.2;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.analytics-mini-summary {
  position: relative;
  z-index: 1;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface-muted);
}

.analytics-mini-summary strong {
  font-size: 0.9rem;
  line-height: 1.3;
}

.category-row {
  gap: 0.75rem;
}

.category-progress {
  width: 7.5rem;
  max-width: 34vw;
  height: 0.35rem;
  margin-top: 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.category-progress span {
  display: block;
  height: 100%;
  min-width: 0.35rem;
  border-radius: inherit;
  background: linear-gradient(90deg, #10b981, #6366f1);
}

/* Vault and dashboard-specific panels */
#masterVaultCard {
  background: var(--surface);
  border-color: #40345f;
}

#masterVaultCard > .absolute {
  background: rgba(124, 58, 237, 0.08);
}

#masterVaultCard .bg-gradient-to-br {
  border-color: #40345f;
  background: var(--violet-soft);
}

#masterVaultCard .lg\:col-span-5 {
  background: var(--surface-muted);
  border-color: var(--line);
}

#masterVaultCard #btnOpenDepositModal {
  background: var(--violet);
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.2);
}

#masterVaultCard #btnOpenWithdrawModal,
#masterVaultCard #btnEditVaultTarget {
  background: var(--surface-muted);
  border-color: #40345f;
}

/* Embedded ledger controls on the dashboard */
body .card-glass:has(#btnLedgerQuickAdd) {
  background: var(--surface);
}

body .card-glass:has(#btnLedgerQuickAdd) > div:first-child,
body .card-glass:has(#btnLedgerQuickAdd) > div:nth-child(2) {
  background: var(--surface-muted);
  border-color: var(--line);
}

body .card-glass:has(#btnLedgerQuickAdd) .table-filter-btn,
body .card-glass:has(#btnLedgerQuickAdd) .table-status-filter-btn {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

body .card-glass:has(#btnLedgerQuickAdd) .table-filter-btn:hover,
body .card-glass:has(#btnLedgerQuickAdd) .table-status-filter-btn:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

body .card-glass:has(#btnLedgerQuickAdd) .table-filter-btn.bg-white,
body .card-glass:has(#btnLedgerQuickAdd) .table-status-filter-btn.bg-white {
  color: var(--brand-dark);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 2px 6px rgba(51, 65, 85, 0.08);
}

body .card-glass:has(#btnLedgerQuickAdd) #ledgerFilterSummaryBar > div {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--muted);
}

body .card-glass:has(#btnLedgerQuickAdd) #ledgerFilterSummaryBar strong {
  color: var(--ink);
}

/* Ledger page helpers */
.glass {
  background: rgba(17, 21, 28, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
}

.panel-sheen {
  position: relative;
  overflow: hidden;
}

.panel-sheen::before {
  position: absolute;
  inset: -30% auto auto -20%;
  width: 180px;
  height: 180px;
  content: "";
  background: radial-gradient(circle, rgba(99, 102, 241, 0.14), transparent 65%);
  pointer-events: none;
}

.stat-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #151a23, #10141b);
  box-shadow: var(--shadow-card);
}

.stat-card .icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.table-filter-btn,
.table-status-filter-btn {
  transition: all 0.2s ease;
}

.table-filter-btn.active,
.table-status-filter-btn.active {
  color: var(--brand-dark);
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.18);
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: rgba(17, 21, 28, 0.95);
  box-shadow: var(--shadow-card);
}

#ledgerTableBody tr:hover {
  background: rgba(167, 139, 250, 0.07);
}

#ledgerTableBody td {
  vertical-align: middle;
}

#emptyState {
  background: linear-gradient(180deg, rgba(23, 28, 36, 0.75), rgba(17, 21, 28, 0.95));
}

/* Scrollbars and dialogs */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: #11151c;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: #465164;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Polished shared dark interface */
body {
  line-height: 1.55;
}

body > header {
  border-bottom-color: rgba(148, 163, 184, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

body .card-glass,
body .analytics-panel,
body .stat-card,
body .glass,
body .table-shell {
  border-color: rgba(148, 163, 184, 0.14);
  background-color: var(--surface);
  box-shadow: var(--shadow-card);
}

body .card-glass-hover:hover,
body .analytics-panel:hover,
body .stat-card:hover {
  border-color: rgba(167, 139, 250, 0.34);
}

body input,
body select,
body textarea {
  color-scheme: dark;
  caret-color: var(--brand);
  background-color: #0d1118;
  border-color: var(--line-strong);
}

body input:hover,
body select:hover,
body textarea:hover {
  border-color: #526074;
}

body input:focus,
body select:focus,
body textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.12);
}

body .bg-slate-50,
body .bg-slate-50\/60,
body .bg-slate-50\/70,
body .bg-slate-100,
body .bg-slate-100\/90 {
  color: var(--ink-soft);
}

body .analytics-switch,
body .analytics-metric,
body .analytics-mini-summary,
body #masterVaultCard .lg\:col-span-5,
body .card-glass:has(#btnLedgerQuickAdd) > div:first-child,
body .card-glass:has(#btnLedgerQuickAdd) > div:nth-child(2) {
  background-color: var(--surface-muted);
  border-color: var(--line);
}

body .table-shell thead,
body .table-shell th {
  color: var(--muted);
  background-color: #171c24;
}

body .table-shell tr {
  border-color: var(--line);
}

body .table-shell tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.018);
}

body .table-shell tbody tr:hover {
  background-color: rgba(167, 139, 250, 0.07);
}

body a,
body button {
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

#txModal,
#amountScannerModal,
#vaultActionModal,
#vaultTargetModal,
#confirmModal,
#backupCenterModal,
#excelPreviewModal {
  overflow-y: auto;
  overscroll-behavior: contain;
}

#txModal > div,
#amountScannerModal > div,
#vaultActionModal > div,
#vaultTargetModal > div,
#confirmModal > div {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.backup-center-panel {
  background: #11151c;
  border-color: #303a49;
  color: #f2f5fa;
}

.backup-center-header {
  border-color: #28313d;
  background: linear-gradient(110deg, #191d2b, #151923 60%, #1a1728);
}

.backup-center-header h3 {
  color: #f2f5fa;
}

.backup-center-header p,
.backup-center-content > div > h4 {
  color: #a8b3c4;
}

.backup-center-content > div > h4 i {
  color: #a78bfa;
}

.backup-info-card {
  border: 1px solid #303a49;
  background: linear-gradient(145deg, #171c25, #131820);
}

.backup-info-card h5 {
  color: #e7edf6;
  font-size: 0.75rem;
  font-weight: 800;
}

.backup-info-card p {
  color: #a8b3c4;
  font-size: 0.6875rem;
  line-height: 1.6;
}

.backup-card-number {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.backup-card-local {
  border-color: rgba(94, 234, 212, 0.22);
  background: linear-gradient(145deg, rgba(19, 49, 47, 0.45), #131820 80%);
}

.backup-card-local .backup-card-number {
  color: #5eead4;
  border-color: rgba(94, 234, 212, 0.2);
  background: #12312f;
}

.backup-card-json {
  border-color: rgba(167, 139, 250, 0.24);
  background: linear-gradient(145deg, rgba(36, 28, 58, 0.5), #131820 80%);
}

.backup-card-json .backup-card-number {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.22);
  background: #241c3a;
}

.backup-card-report {
  border-color: rgba(251, 191, 36, 0.22);
  background: linear-gradient(145deg, rgba(48, 39, 23, 0.5), #131820 80%);
}

.backup-card-report .backup-card-number {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.2);
  background: #302717;
}

.backup-action-card {
  border: 1px solid #303a49;
  background: #151a22;
}

.backup-action-card h5 {
  color: #e7edf6;
}

.backup-action-card p,
.backup-center-footer > span {
  color: #a8b3c4;
}

.backup-action-card #btnDownloadBackupJSONNow {
  border: 1px solid rgba(167, 139, 250, 0.38);
  background: #5b4ae8;
  box-shadow: 0 8px 20px rgba(91, 74, 232, 0.2);
}

.backup-action-card #btnTriggerRestoreFile {
  color: #5eead4;
  border: 1px solid rgba(94, 234, 212, 0.26);
  background: #12312f;
}

.backup-action-card #btnTriggerRestoreFile:hover {
  background: #173d39;
}

.backup-center-footer {
  border-color: #28313d;
  background: #0f131a;
}

.backup-center-footer #btnDoneBackupCenter {
  color: #e7edf6;
  border-color: #394555;
  background: #171c24;
}

.backup-center-footer #btnDoneBackupCenter:hover {
  background: #202734;
}

/* Cash and bank account overview */
.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-main > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.account-overview {
  order: -1;
}

.account-balance-card {
  min-width: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: linear-gradient(145deg, var(--surface-muted), var(--surface));
}

.account-balance-card.cash {
  border-color: rgba(94, 234, 212, 0.25);
  background: linear-gradient(145deg, rgba(19, 49, 47, 0.78), var(--surface));
}

.account-balance-card.bank {
  border-color: rgba(125, 183, 255, 0.25);
  background: linear-gradient(145deg, rgba(23, 40, 61, 0.78), var(--surface));
}

.account-balance-card.total {
  border-color: rgba(167, 139, 250, 0.28);
  background: linear-gradient(145deg, rgba(36, 28, 58, 0.8), var(--surface));
}

.account-card-label {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.account-card-amount {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.25;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.account-balance-card small {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
}

.account-card-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.04);
}

.transfer-history-wrap {
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.transfer-history-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface-muted);
}

.transfer-direction {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.7rem;
  color: var(--warning);
  background: var(--warning-soft);
}

.transfer-history-item strong,
.transfer-history-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-history-item strong {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.transfer-history-item small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.transfer-history-item b {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 0.68rem;
}

.payment-method-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
}

.payment-method-cash {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.22);
  background: var(--teal-soft);
}

.payment-method-bank {
  color: var(--info);
  border-color: rgba(125, 183, 255, 0.22);
  background: var(--info-soft);
}

.payment-method-unclassified {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-muted);
}

#moneyAccountsModal,
#transferModal {
  overflow-y: auto;
  overscroll-behavior: contain;
}

#moneyAccountsModal > div,
#transferModal > div {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-width: 768px) {
  body.dashboard-with-sidebar > header.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    height: 100dvh;
    overflow: visible;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .app-sidebar .sidebar-inner {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    padding: 1.25rem 0.85rem;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 1.5rem;
  }

  .app-sidebar .sidebar-inner > div:first-child {
    min-width: 0;
    align-items: flex-start;
  }

  .app-sidebar .brand-copy {
    min-width: 0;
  }

  .app-sidebar .brand-copy h1 {
    font-size: 0.92rem;
    line-height: 1.3;
    letter-spacing: -0.035em;
  }

  .app-sidebar .brand-copy p {
    display: block;
    line-height: 1.5;
  }

  .app-sidebar #storageStatusBadge {
    display: inline-flex;
    margin-top: 0.35rem;
  }

  .app-sidebar .sidebar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .app-sidebar .sidebar-actions > a,
  .app-sidebar .sidebar-actions > button,
  .app-sidebar .sidebar-actions > .relative > button {
    width: 100%;
    min-height: 2.65rem;
    justify-content: flex-start;
    padding: 0.65rem 0.75rem;
    border-color: var(--line);
    border-radius: 0.9rem;
    background: var(--surface-muted);
    color: var(--ink-soft);
    box-shadow: none;
  }

  .app-sidebar .sidebar-actions > #btnOpenAddModal {
    color: #fff;
    background: #4f46e5;
    border-color: #6366f1;
  }

  .app-sidebar .sidebar-actions > a {
    order: 1;
  }

  .app-sidebar .sidebar-actions > #btnOpenAddModal {
    order: 2;
  }

  body.dashboard-with-sidebar > main.dashboard-main {
    width: calc(100% - 278px);
    max-width: 80rem;
    margin-right: 1.5rem;
    margin-left: 254px;
  }
}

/* Responsive layout */
@media (max-width: 767px) {
  body.dashboard-with-sidebar > header.app-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-sidebar .sidebar-inner {
    width: 100%;
    height: auto;
    margin-right: auto;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .app-sidebar .brand-copy h1 {
    font-size: clamp(0.7rem, 3.5vw, 0.95rem);
    overflow-wrap: normal;
    white-space: nowrap;
  }

  .app-sidebar .brand-copy > div {
    gap: 0.3rem;
  }

  .app-sidebar .brand-copy > div > span {
    padding-right: 0.35rem;
    padding-left: 0.35rem;
  }

  .app-sidebar .sidebar-actions {
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.3rem;
  }

  .app-sidebar .sidebar-actions > button,
  .app-sidebar .sidebar-actions > .relative > button,
  .app-sidebar .sidebar-actions > a {
    min-width: 2.35rem;
    min-height: 2.35rem;
    justify-content: center;
    padding: 0.5rem;
  }

  .app-sidebar .sidebar-actions > a .sidebar-label,
  .app-sidebar .sidebar-actions > #btnOpenAddModal .sidebar-label {
    display: none;
  }

  body.dashboard-with-sidebar > main.dashboard-main {
    width: 100%;
    max-width: 80rem;
    margin-right: auto;
    margin-left: auto;
  }

  body > header {
    position: relative;
  }

  body > header > div {
    min-height: 4.5rem;
    height: auto;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    align-items: flex-start;
    gap: 0.65rem;
  }

  body > header > div > div:first-child {
    min-width: 0;
  }

  body > header h1 {
    max-width: 100%;
    font-size: clamp(0.9rem, 4vw, 1.15rem);
    overflow-wrap: anywhere;
  }

  body > header p {
    display: none;
  }

  body > header > div > div:last-child {
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  body > header > div > div:last-child > button,
  body > header > div > div:last-child > .relative > button {
    min-height: 2.35rem;
    padding-right: 0.65rem;
    padding-left: 0.65rem;
  }

  body main {
    padding-top: 1rem;
    padding-bottom: 1.25rem;
  }

  body.dashboard-with-sidebar > main.dashboard-main {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  body .card-glass,
  body .analytics-panel {
    border-radius: 1.25rem;
  }

  .analytics-panel {
    padding: 1rem;
  }

  .analytics-switch {
    width: 100%;
  }

  .analytics-switch button {
    flex: 1 1 0;
    padding-right: 0.55rem;
    padding-left: 0.55rem;
  }

  #singleMonthPickerWrap,
  #singleMonthPickerWrap select {
    width: 100%;
  }

  #ledgerFilterSummaryBar > div {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 8.5rem;
  }

  #txModal > div,
  #amountScannerModal > div,
  #vaultActionModal > div,
  #vaultTargetModal > div,
  #confirmModal > div,
  #moneyAccountsModal > div,
  #transferModal > div,
  #backupCenterModal > div,
  #excelPreviewModal > div {
    max-height: calc(100dvh - 1rem);
    border-radius: 1.25rem;
  }

  #txForm,
  #backupCenterModal > div > div,
  #excelPreviewModal > div > div {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  body table {
    min-width: 42rem;
  }

  body .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  body canvas {
    max-height: 250px;
  }

  .analytics-panel > .flex.items-center.justify-between {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .analytics-panel .category-view-toggle,
  .analytics-panel #categoryPeriodMode,
  .analytics-panel #categoryYearSelect,
  .analytics-panel #categoryMonthSelect {
    min-height: 2.5rem;
  }

  .category-budget-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    align-items: start !important;
  }

  .category-budget-header > div:first-child {
    width: 100%;
    min-width: 0;
  }

  .category-budget-header > div:nth-child(2) {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .category-budget-header > div:nth-child(2) > div:last-child {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .category-budget-header select {
    max-width: 100%;
  }

  #embeddedLedgerSection .table-filter-btn,
  #embeddedLedgerSection .table-status-filter-btn,
  .table-filter-btn,
  .table-status-filter-btn {
    min-height: 2.5rem;
  }

  #txModal,
  #amountScannerModal,
  #vaultActionModal,
  #vaultTargetModal,
  #confirmModal,
  #moneyAccountsModal,
  #transferModal,
  #categoryModal,
  #backupCenterModal,
  #excelPreviewModal {
    align-items: flex-end;
    padding: 0.5rem;
  }

  #txModal > div,
  #amountScannerModal > div,
  #vaultActionModal > div,
  #vaultTargetModal > div,
  #confirmModal > div,
  #moneyAccountsModal > div,
  #transferModal > div,
  #categoryModal > div,
  #backupCenterModal > div,
  #excelPreviewModal > div {
    width: 100%;
    max-height: calc(100dvh - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .day-feed-block {
    min-width: 0;
  }

  .day-feed-block .bg-white {
    align-items: stretch;
  }
}

@media (min-width: 768px) and (max-width: 1100px) {
  body.dashboard-with-sidebar > header.app-sidebar {
    width: 76px;
  }

  .app-sidebar .sidebar-inner {
    align-items: center;
    padding-right: 0.65rem;
    padding-left: 0.65rem;
  }

  .app-sidebar .brand-copy {
    display: none;
  }

  .app-sidebar .sidebar-actions > a,
  .app-sidebar .sidebar-actions > button,
  .app-sidebar .sidebar-actions > .relative > button {
    min-width: 2.8rem;
    justify-content: center;
    padding: 0.65rem;
  }

  .app-sidebar .sidebar-actions > a span,
  .app-sidebar .sidebar-actions > button span,
  .app-sidebar .sidebar-actions > .relative > button span,
  .app-sidebar .sidebar-actions > .relative > button .fa-chevron-down,
  .app-sidebar .sidebar-actions::before {
    display: none;
  }

  .app-sidebar .sidebar-actions > .relative {
    width: auto;
  }

  body.dashboard-with-sidebar > main.dashboard-main {
    width: calc(100% - 104px);
    margin-right: 1rem;
    margin-left: 88px;
  }

  body > header > div {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  body > header > div > div:last-child > button span {
    display: none;
  }

  body main {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

/* Keep the Excel preview on a calm paper palette inside the dark app. */
#excelPreviewModal {
  background: rgba(15, 23, 42, 0.58) !important;
}

#excelPreviewModal > div {
  background: #ffffff !important;
  border-color: #dbe4ee !important;
  color: #1e293b !important;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28) !important;
}

#excelPreviewModal > div > div:first-child {
  background: linear-gradient(110deg, #ecfdf5, #ffffff 56%, #f0fdfa) !important;
  border-color: #e2e8f0 !important;
}

#excelPreviewModal > div > div:nth-child(2) {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

#excelPreviewModal > div > div:nth-child(3) {
  background: #f1f5f9 !important;
}

#excelPreviewModal > div > div:last-child {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

#excelPreviewModal #excelPaperView,
#excelPreviewModal .bg-white {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

#excelPreviewModal [class*="bg-slate-50/"],
#excelPreviewModal [class*="bg-slate-100/"] {
  background-color: #f8fafc !important;
}

#excelPreviewModal .text-slate-900,
#excelPreviewModal .text-slate-800,
#excelPreviewModal .text-slate-700 {
  color: #1e293b !important;
}

#excelPreviewModal .text-slate-600,
#excelPreviewModal .text-slate-500 {
  color: #64748b !important;
}

#excelPreviewModal .text-slate-400 {
  color: #94a3b8 !important;
}

#excelPreviewModal [class*="border-slate-"] {
  border-color: #dbe4ee !important;
}

#excelPreviewModal select {
  color: #1e293b !important;
  color-scheme: light;
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

#excelPreviewModal select:focus-visible,
#excelPreviewModal button:focus-visible {
  outline-color: rgba(16, 185, 129, 0.4) !important;
}

@media (max-width: 420px) {
  body.dashboard-with-sidebar .brand-copy {
    display: none;
  }

  body > header > div > div:first-child > div:first-child > span {
    display: none;
  }

  .app-sidebar .sidebar-inner {
    padding-right: 0.65rem;
    padding-left: 0.65rem;
  }

  .app-sidebar .rainbow-logo-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  body > header > div > div:last-child > button,
  body > header > div > div:last-child > .relative > button {
    width: 2.35rem;
    padding: 0;
  }

  #ledgerFilterSummaryBar > div {
    min-width: 100%;
  }
}

#ledgerSummaryBar > div {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-muted);
}

#ledgerSummaryBar strong {
  color: var(--ink);
}

#ledgerSummaryBar .text-emerald-700,
#ledgerSummaryBar .text-emerald-800 {
  color: var(--income);
}

#ledgerSummaryBar .text-rose-700,
#ledgerSummaryBar .text-rose-800 {
  color: var(--expense);
}

#ledgerSummaryBar .text-indigo-700,
#ledgerSummaryBar .text-indigo-800 {
  color: var(--brand-dark);
}

#ledgerSummaryBar .text-teal-700,
#ledgerSummaryBar .text-teal-800 {
  color: var(--teal);
}

#ledgerSummaryBar .text-blue-700,
#ledgerSummaryBar .text-blue-800 {
  color: var(--info);
}

.payment-badge-cash {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.25);
  background: var(--teal-soft);
}

.payment-badge-bank {
  color: var(--info);
  border-color: rgba(125, 183, 255, 0.25);
  background: var(--info-soft);
}

.payment-badge-unclassified {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-muted);
}

.stat-card .text-emerald-600,
.stat-card .text-emerald-700 {
  color: var(--income);
}

.stat-card .text-rose-600,
.stat-card .text-rose-700 {
  color: var(--expense);
}

.stat-card .text-indigo-600,
.stat-card .text-indigo-700 {
  color: var(--brand-dark);
}

.stat-card .text-amber-500 {
  color: var(--warning);
}

.stat-card .text-violet-400 {
  color: var(--violet);
}

.stat-card .icon-box.bg-emerald-50 {
  color: var(--income);
  background: var(--income-soft);
}

.stat-card .icon-box.bg-rose-50 {
  color: var(--expense);
  background: var(--expense-soft);
}

.stat-card .icon-box.bg-indigo-50 {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.stat-card .icon-box.bg-amber-50 {
  color: var(--warning);
  background: var(--warning-soft);
}

.stat-card .icon-box.bg-violet-50 {
  color: var(--violet);
  background: var(--violet-soft);
}

#deleteTransactionModal > div,
#editTransactionModal > div {
  border-color: var(--line);
  background: var(--surface);
}

#deleteTransactionModal > div > div:first-child {
  border-color: var(--line);
  background: var(--expense-soft);
}

#deleteTransactionModal .text-rose-800 {
  color: var(--expense);
}

#deleteTransactionModal .text-rose-600 {
  color: #fda4af;
}

#deleteTransactionModal > div > div:last-child,
#editTransactionActions {
  border-color: var(--line);
}

@media (max-width: 767px) {
  body.dashboard-with-sidebar > header.app-sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    padding: 0.45rem 0 calc(0.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    border-right: 0;
    border-bottom: 0;
    border-radius: 1.15rem 1.15rem 0 0;
    background: rgba(10, 13, 19, 0.96);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(22px);
  }

  .app-sidebar .sidebar-inner {
    width: 100%;
    max-width: 32rem;
    min-height: 0;
    height: auto;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0 0.55rem;
    justify-content: center;
  }

  .app-sidebar .sidebar-inner > div:first-child {
    display: flex;
    width: 100%;
    min-width: 0;
    justify-content: center;
    gap: 0.4rem;
  }

  .app-sidebar .rainbow-logo-icon {
    display: none;
  }

  body.dashboard-with-sidebar .app-sidebar .brand-copy {
    display: block;
  }

  body.dashboard-with-sidebar .app-sidebar .brand-copy h1 {
    color: #f8fafc;
    font-size: clamp(0.68rem, 3.7vw, 0.9rem);
    letter-spacing: -0.045em;
    white-space: nowrap;
  }

  body.dashboard-with-sidebar .app-sidebar .brand-copy > div > span {
    display: none;
  }

  .app-sidebar .sidebar-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.4rem;
  }

  .app-sidebar .sidebar-actions > button,
  .app-sidebar .sidebar-actions > .relative > button,
  .app-sidebar .sidebar-actions > a {
    display: flex;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 3.45rem;
    flex-direction: column;
    justify-content: center;
    gap: 0.28rem;
    padding: 0.4rem 0.15rem;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: linear-gradient(145deg, #1a202b, #121720);
    color: var(--ink-soft);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
  }

  .app-sidebar .sidebar-actions > button > span,
  .app-sidebar .sidebar-actions > .relative > button > span,
  .app-sidebar .sidebar-actions > a > .sidebar-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 0.57rem;
    font-weight: 750;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-sidebar .sidebar-actions > a {
    color: #cbd5e1;
  }

  .app-sidebar .sidebar-actions > #btnOpenAddModal .sidebar-label {
    display: block;
  }

  .app-sidebar .sidebar-actions > a > i,
  .app-sidebar .sidebar-actions > #btnOpenAddModal > i {
    font-size: 1rem;
  }

  .app-sidebar .sidebar-actions > #btnOpenAddModal {
    border-color: rgba(129, 140, 248, 0.72);
    background: linear-gradient(145deg, #7562f5, #4f46e5);
    color: #fff;
    box-shadow: 0 5px 13px rgba(79, 70, 229, 0.34);
  }

  body.dashboard-with-sidebar > main.dashboard-main {
    padding: 0.85rem 0.7rem calc(7.5rem + env(safe-area-inset-bottom));
    gap: 0.8rem;
  }

  body.dashboard-with-sidebar > main.dashboard-main > .grid:first-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  body.dashboard-with-sidebar > main.dashboard-main > .grid:first-child > .card-glass:first-child {
    grid-column: 1 / -1;
  }

  body.dashboard-with-sidebar > main.dashboard-main > .grid:first-child > .card-glass {
    min-width: 0;
    padding: 0.9rem;
    border-radius: 1.15rem;
  }

  body.dashboard-with-sidebar > main.dashboard-main > .grid:first-child > .card-glass:first-child h2 {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
  }

  body.dashboard-with-sidebar > main.dashboard-main > .grid:first-child > .card-glass:not(:first-child) h2 {
    font-size: clamp(1rem, 4vw, 1.3rem);
    overflow-wrap: anywhere;
  }

  #moneyAccountsSection {
    padding: 1rem;
    gap: 0.8rem;
  }

  #moneyAccountsSection > div:first-child > div:last-child {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #moneyAccountsSection > div:first-child > div:last-child button {
    min-height: 2.7rem;
    padding: 0.55rem 0.4rem;
    font-size: 0.68rem;
  }

  #moneyAccountsSection > .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  #moneyAccountsSection > .grid > .account-balance-card.total {
    grid-column: 1 / -1;
  }

  .account-balance-card {
    padding: 0.8rem;
    border-radius: 1rem;
  }

  .account-balance-card .account-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.7rem;
    font-size: 0.8rem;
  }

  .account-card-amount {
    font-size: clamp(0.82rem, 3.8vw, 1.15rem);
    white-space: nowrap;
    overflow-wrap: normal;
  }

  .account-balance-card > div > div:first-child {
    min-width: 0;
    flex: 1;
  }

  .account-card-label {
    font-size: 0.58rem;
    letter-spacing: 0.025em;
  }

  .account-balance-card small {
    font-size: 0.59rem;
  }

  .transfer-history-wrap {
    min-width: 0;
  }

  body.dashboard-with-sidebar > main.dashboard-main > .grid:has(.analytics-panel) {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
  }

  .analytics-panel {
    min-width: 0;
    padding: 1rem;
    border-radius: 1.2rem;
  }

  .category-analytics-panel .category-budget-header {
    gap: 0.6rem;
    padding-bottom: 0.7rem;
    margin-bottom: 0.75rem;
  }

  .category-analytics-panel .category-budget-header h3 {
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: nowrap;
  }

  .category-analytics-panel .category-budget-header p {
    font-size: 0.62rem;
    line-height: 1.35;
  }

  .category-analytics-panel .category-view-toggle,
  .category-analytics-panel #categoryPeriodMode,
  .category-analytics-panel #categoryYearSelect,
  .category-analytics-panel #categoryMonthSelect {
    min-height: 2.25rem;
  }

  .category-analytics-panel .donut-stage {
    height: 12.5rem;
  }

  .category-analytics-panel .donut-center-label {
    width: min(8rem, 62%);
  }

  .category-analytics-panel .donut-center-label span {
    font-size: 0.58rem;
  }

  .category-analytics-panel .donut-center-label strong {
    font-size: clamp(0.78rem, 3.5vw, 0.95rem);
  }

  .category-analytics-panel .analytics-mini-summary {
    margin-top: 0.65rem;
    padding: 0.7rem;
  }

  .category-analytics-panel #categoryBreakdownList {
    max-height: 13rem;
    margin-top: 0.65rem;
  }

  .category-analytics-panel .category-row {
    min-height: 3.1rem;
    gap: 0.5rem;
    padding: 0.55rem 0.25rem;
  }

  .category-analytics-panel .category-row > div:last-child {
    margin-left: 0.35rem;
    font-size: 0.68rem;
  }

  .category-analytics-panel .category-row > div:last-child > span:first-child {
    font-size: 0.68rem;
  }

  .analytics-panel h3 {
    font-size: 1.05rem;
    line-height: 1.35;
  }

  .analytics-metrics,
  #singleMonthStatsBar {
    gap: 0.5rem;
  }

  .analytics-metric {
    min-width: 0;
    padding: 0.7rem;
    border-radius: 0.9rem;
  }

  .analytics-metric strong {
    max-width: 100%;
    font-size: clamp(0.88rem, 3.8vw, 1.15rem);
    overflow-wrap: anywhere;
  }

  .chart-stage {
    min-height: 15rem;
  }

  #singleMonthPickerWrap,
  #singleDayPickerWrap {
    min-width: 0;
  }

  #singleDayPickerWrap input,
  #singleMonthPickerWrap select {
    width: 100%;
    min-height: 2.65rem;
  }

  #embeddedLedgerSection {
    border-radius: 1.2rem;
  }

  #embeddedLedgerSection > div:first-child {
    padding: 0.85rem;
  }

  #embeddedLedgerSection > div:first-child > div:first-child {
    align-items: stretch;
    flex-direction: column;
    gap: 0.65rem;
  }

  #embeddedLedgerSection > div:first-child > div:first-child > div {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  #embeddedLedgerSection > div:first-child > div:first-child > div::-webkit-scrollbar {
    display: none;
  }

  #embeddedLedgerSection .table-filter-btn,
  #embeddedLedgerSection .table-status-filter-btn {
    flex: 0 0 auto;
    padding-right: 0.65rem;
    padding-left: 0.65rem;
    font-size: 0.68rem;
    white-space: nowrap;
  }

  #embeddedLedgerSection > div:first-child > .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  #embeddedLedgerSection > div:first-child > .grid > div {
    min-width: 0;
  }

  #embeddedLedgerSection > div:first-child > .grid > div:last-child {
    grid-column: 1 / -1;
  }

  #embeddedLedgerSection select,
  #embeddedLedgerSection input {
    min-width: 0;
    min-height: 2.7rem;
    font-size: 0.7rem;
  }

  #ledgerFilterSummaryBar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  #ledgerFilterSummaryBar > div {
    min-width: 0;
    flex: initial;
    gap: 0.35rem;
    margin-left: 0;
    padding: 0.5rem 0.55rem;
    border-radius: 0.8rem;
    font-size: 0.64rem;
    line-height: 1.35;
  }

  #ledgerFilterSummaryBar > div strong {
    overflow-wrap: anywhere;
  }

  #ledgerFeedContainer {
    min-height: 0;
    padding: 0.8rem;
  }

  #ledgerFeedContainer .day-feed-block {
    margin: 0;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(23, 28, 36, 0.92), rgba(17, 21, 28, 0.96));
  }

  #ledgerFeedContainer .day-feed-block > .bg-white {
    gap: 0.7rem;
    padding: 0.8rem;
    border-radius: 0.9rem;
  }

  #ledgerFeedContainer .day-feed-block > .bg-white > div:first-child {
    min-width: 0;
    align-items: flex-start;
  }

  #ledgerFeedContainer .day-feed-block > .bg-white > div:first-child > div:first-child {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.8rem;
  }

  #ledgerFeedContainer .day-feed-block > .bg-white > div:first-child > div:last-child {
    min-width: 0;
  }

  #ledgerFeedContainer .day-feed-block > .bg-white > div:last-child {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  #ledgerFeedContainer .day-feed-block > .bg-white > div:last-child > div:first-child {
    min-width: 0;
  }

  #ledgerFeedContainer .day-feed-block > .bg-white > div:last-child > div:first-child > span:first-child {
    font-size: 0.9rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #txModal,
  #amountScannerModal,
  #vaultActionModal,
  #vaultTargetModal,
  #confirmModal,
  #moneyAccountsModal,
  #transferModal,
  #categoryModal,
  #backupCenterModal,
  #excelPreviewModal,
  #transactionImageModal {
    padding: max(0.5rem, env(safe-area-inset-top)) 0.5rem max(0.5rem, env(safe-area-inset-bottom));
  }

  #txModal > div,
  #amountScannerModal > div,
  #vaultActionModal > div,
  #vaultTargetModal > div,
  #confirmModal > div,
  #moneyAccountsModal > div,
  #transferModal > div,
  #categoryModal > div,
  #backupCenterModal > div,
  #excelPreviewModal > div,
  #transactionImageModal > div {
    width: 100%;
    max-height: calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 1.2rem;
  }

  #txForm,
  #backupCenterModal > div > div,
  #excelPreviewModal > div > div {
    padding-right: 0.9rem;
    padding-left: 0.9rem;
  }
}

@media (max-width: 420px) {
  .app-sidebar .sidebar-actions > button > span,
  .app-sidebar .sidebar-actions > .relative > button > span,
  .app-sidebar .sidebar-actions > a > .sidebar-label {
    font-size: 0.53rem;
  }

  #ledgerFilterSummaryBar > div {
    font-size: 0.6rem;
  }
}

@media (max-width: 360px) {
  #moneyAccountsSection > .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #moneyAccountsSection > .grid > .account-balance-card.total {
    grid-column: auto;
  }

  .analytics-switch button {
    padding-right: 0.3rem;
    padding-left: 0.3rem;
    font-size: 0.62rem;
  }
}

@media (max-width: 767px) {
  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls,
  body.ledger-page header.ledger-page-header .mobile-nav-controls,
  body nav.mobile-nav-bar.mobile-nav-controls {
    column-gap: 0.4rem;
  }

  body nav.mobile-nav-bar {
    inset: auto 0 0;
    padding: 0.45rem 0.55rem calc(0.35rem + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1.15rem 1.15rem 0 0;
    background: rgba(10, 13, 19, 0.96);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(22px);
  }

  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > a,
  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > button,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > a,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > button,
  body nav.mobile-nav-bar.mobile-nav-controls > a,
  body nav.mobile-nav-bar.mobile-nav-controls > button {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 3.45rem;
    height: 3.45rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    padding: 0.4rem 0.15rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.85rem;
    background: linear-gradient(145deg, #1a202b, #121720);
    color: #cbd5e1;
    font-size: 0.57rem;
    font-weight: 750;
    line-height: 1.1;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
    text-align: center;
    white-space: nowrap;
  }

  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > a > span,
  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > button > span,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > a > span,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > button > span,
  body nav.mobile-nav-bar.mobile-nav-controls > a > span,
  body nav.mobile-nav-bar.mobile-nav-controls > button > span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 0.57rem;
    font-weight: 750;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > a > i,
  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > button > i,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > a > i,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > button > i,
  body nav.mobile-nav-bar.mobile-nav-controls > a > i,
  body nav.mobile-nav-bar.mobile-nav-controls > button > i {
    margin: 0;
    font-size: 1rem;
  }

  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > a[aria-current="page"],
  body.ledger-page header.ledger-page-header .mobile-nav-controls > a[aria-current="page"],
  body nav.mobile-nav-bar.mobile-nav-controls > a[aria-current="page"] {
    border-color: rgba(167, 139, 250, 0.3);
    background: linear-gradient(145deg, rgba(117, 98, 245, 0.22), rgba(79, 70, 229, 0.14));
    color: #c4b5fd;
  }

  body.dashboard-with-sidebar header.app-sidebar .mobile-nav-controls > #btnOpenAddModal {
    border-color: rgba(129, 140, 248, 0.72);
    background: linear-gradient(145deg, #7562f5, #4f46e5);
    color: #fff;
    box-shadow: 0 5px 13px rgba(79, 70, 229, 0.34);
  }

  body.ledger-page header.ledger-page-header .mobile-nav-controls > #btnReset {
    margin-top: 0;
    border-color: rgba(148, 163, 184, 0.16);
    background: linear-gradient(145deg, #1a202b, #121720);
    color: #cbd5e1;
    cursor: pointer;
  }

  body.ledger-page header.ledger-page-header .mobile-nav-controls {
    display: flex;
    justify-content: center;
  }

  body.ledger-page header.ledger-page-header .mobile-nav-controls > a,
  body.ledger-page header.ledger-page-header .mobile-nav-controls > button {
    flex: 0 1 5.5rem;
    max-width: 5.5rem;
  }
}
