/* ─── Global Amount Masking ─── */
body.amounts-masked [data-monetary] {
  filter: blur(8px);
  -webkit-filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  transition: filter 0.2s ease;
}
body:not(.amounts-masked) [data-monetary] {
  transition: filter 0.2s ease;
}

/* ─── Filter Controls ─── */
.filter-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.filter-pill svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.75);
}

.filter-pill label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.filter-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* ─── Admin Toggle Button ─── */
.admin-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #94a3b8;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  border: none;
  cursor: pointer;
}

.admin-toggle-btn:hover {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}

.admin-toggle-btn.rotate-180 {
  transform: rotate(180deg);
}

/* ─── Desktop Nav ─── */
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
  color: #64748b;
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 50%;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 1px;
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.06);
}

.nav-link:hover::after {
  transform: translateX(-50%) scaleX(1);
}

.nav-link.active {
  color: #6366f1;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.06));
}

.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* ─── Mobile Nav ─── */
.nav-link-mobile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: #475569;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.nav-link-mobile:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.2);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.nav-link-mobile.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.12));
  color: #6366f1;
  font-weight: 600;
  border-color: rgba(99, 102, 241, 0.25);
}

.card {
  display: block;
  border-radius: 24px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card.no-hover:hover {
  transform: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

/* Always-visible scrollbar for expense table */
.expense-scroll-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.expense-scroll-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.expense-scroll-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.expense-scroll-container::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}
.expense-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Compact expense table */
.expense-table th,
.expense-table td {
  padding: 8px 10px;
  font-size: 13px;
}
.expense-table th {
  white-space: nowrap;
}

.input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 12px 16px;
  color: #1e293b;
  font-size: 14px;
  transition: all 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Searchable combobox */
.combobox {
  position: relative;
}
.combobox-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.combobox-item {
  padding: 10px 16px;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.15s;
}
.combobox-item:hover,
.combobox-item.active {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}
.combobox-empty {
  padding: 10px 16px;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

/* Fix dropdown options visibility and arrow overlap */
select {
  cursor: pointer;
  padding-right: 32px !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
}

.filter-pill select {
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: white;
  outline: none;
  border: none;
  cursor: pointer;
  letter-spacing: -0.01em;
  padding-right: 28px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 4px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}

select option {
  background: #fff;
  color: #1e293b;
  padding: 12px 16px;
  font-size: 14px;
}

.input-compact {
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}

.input-inline {
  width: 100%;
  border-radius: 0;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  background: transparent;
  padding: 0;
  color: #1e293b;
  font-size: inherit;
  line-height: inherit;
  box-sizing: border-box;
}

.input-inline:hover {
  border-bottom-color: #f59e0b;
  background: rgba(245, 158, 11, 0.04);
}

.input-inline:focus {
  outline: none;
  border-bottom: 2px solid #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

select.input-inline {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 10px;
  background-color: transparent;
}

select.input-inline:hover {
  background-color: rgba(245, 158, 11, 0.04);
}

.textarea-inline {
  display: block;
  min-height: 1.4em;
  height: auto;
  resize: none;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  field-sizing: content;
}

.login-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 12px 16px;
  color: #1e293b;
  font-size: 14px;
}

.login-input:focus {
  outline: none;
  border-color: #f59e0b;
  background: #fff;
}

.btn-primary,
.btn-yellow {
  border-radius: 12px;
  background: #fbbf24;
  padding: 12px 24px;
  font-weight: 600;
  color: #1e293b;
  transition: all 0.2s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.btn-primary:hover,
.btn-yellow:hover {
  background: #f59e0b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}



.btn-dark {
  border-radius: 12px;
  background: #1e293b;
  padding: 12px 24px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s ease;
  font-size: 14px;
}

.btn-dark:hover {
  background: #334155;
  transform: translateY(-2px);
}

.btn-danger {
  border-radius: 12px;
  background: #ef4444;
  padding: 12px 24px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
  border-radius: 12px;
  background: #f1f5f9;
  padding: 12px 24px;
  font-weight: 600;
  color: #475569;
  transition: all 0.2s ease;
  font-size: 14px;
  border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-indigo {
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  padding: 12px 24px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s ease;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-indigo:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

#expense-apply-btn,
#save-changes-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.year-input {
  border-radius: 12px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(168, 85, 247, 0.08) 100%);
  padding: 10px 40px 10px 16px;
  color: #1e293b;
  font-size: 14px;
  min-width: 140px;
  position: relative;
  z-index: 10;
  cursor: pointer;
  font-weight: 600;
  appearance: none;
  background-image: 
    linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(168, 85, 247, 0.08) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: left, right 8px center;
  background-size: cover, 20px;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
  transition: all 0.2s ease;
}

.year-input:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.12) 100%);
  background-image: 
    linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.12) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: left, right 8px center;
  background-size: cover, 20px;
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
  transform: translateY(-1px);
}

.year-input:focus {
  outline: none;
  border-color: #8b5cf6;
  z-index: 100;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 4px 12px rgba(139, 92, 246, 0.15);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(168, 85, 247, 0.1) 100%);
  background-image: 
    linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(168, 85, 247, 0.1) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: left, right 8px center;
  background-size: cover, 20px;
}

.year-input option {
  background: #fff;
  color: #1e293b;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
}

.year-input option:hover {
  background: #fef3c7;
  color: #92400e;
}

.cursive-title {
  font-family: "Brush Script MT", "Segoe Script", cursive;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════════
   POLISHED DATE INPUTS
   ═══════════════════════════════════════════════ */
input[type="date"].input {
  position: relative;
  cursor: pointer;
}

input[type="date"].input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  transition: background 0.15s ease;
}

input[type="date"].input::-webkit-calendar-picker-indicator:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* ═══════════════════════════════════════════════
   GLOBAL SMOOTH TRANSITIONS
   ═══════════════════════════════════════════════ */
* {
  scroll-behavior: smooth;
}

a, button, input, select, textarea {
  transition-property: color, background-color, border-color, box-shadow, transform, opacity;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* Smooth page-level transitions */
.space-y-6 > *, .space-y-8 > * {
  animation: fadeInUp 0.3s ease both;
}

.space-y-6 > *:nth-child(1) { animation-delay: 0s; }
.space-y-6 > *:nth-child(2) { animation-delay: 0.05s; }
.space-y-6 > *:nth-child(3) { animation-delay: 0.1s; }
.space-y-6 > *:nth-child(4) { animation-delay: 0.15s; }
.space-y-6 > *:nth-child(5) { animation-delay: 0.2s; }
.space-y-6 > *:nth-child(6) { animation-delay: 0.25s; }

.space-y-8 > *:nth-child(1) { animation-delay: 0s; }
.space-y-8 > *:nth-child(2) { animation-delay: 0.05s; }
.space-y-8 > *:nth-child(3) { animation-delay: 0.1s; }
.space-y-8 > *:nth-child(4) { animation-delay: 0.15s; }
.space-y-8 > *:nth-child(5) { animation-delay: 0.2s; }
.space-y-8 > *:nth-child(6) { animation-delay: 0.25s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Receipt modal open animation — eliminates compositor flash */
#receipt-modal:not(.hidden) {
  animation: receiptOverlayIn 0.18s ease both;
}
#receipt-modal:not(.hidden) > div {
  animation: receiptPanelIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}
/* Prevent global fadeInUp from stacking inside the receipt modal */
#receipt-modal .space-y-6 > *,
#receipt-modal tbody tr {
  animation: none;
}
@keyframes receiptOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes receiptPanelIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Smooth table row loading */
tbody tr {
  animation: fadeInUp 0.2s ease both;
}

/* Polished focus ring for all interactive elements */
.input:focus,
select:focus,
input[type="date"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* Dashboard chart SVGs only */
#monthly-chart,
#category-chart,
#spending-heatmap {
  width: 100%;
  height: 280px;
}

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #fef9f0;
}

thead {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.expense-sort-header {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.expense-sort-header:hover {
  color: #1e293b;
}

.duplicate-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.duplicate-modal.hidden {
  display: none;
}

.duplicate-modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  animation: slideUp 0.3s ease;
}

.duplicate-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
}

.duplicate-modal-message {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 12px;
}

.duplicate-modal-list {
  list-style: none;
  padding: 16px;
  background: #fef3c7;
  border-radius: 12px;
  margin-bottom: 20px;
  max-height: 200px;
  overflow-y: auto;
}

.duplicate-modal-list li {
  padding: 8px 0;
  color: #92400e;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid #fde68a;
}

.duplicate-modal-list li:last-child {
  border-bottom: none;
}

.duplicate-modal-question {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 20px;
}

.duplicate-modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.duplicate-modal-actions button {
  flex: 1;
  min-width: 120px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.notification-modal,
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.notification-modal.hidden,
.confirm-modal.hidden {
  display: none;
}



.notification-modal-content,
.confirm-modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  animation: slideUp 0.3s ease;
  text-align: center;
}

.notification-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.notification-icon.success {
  background: #dcfce7;
  color: #16a34a;
}

.notification-icon.success::before {
  content: "✓";
}

.notification-icon.error {
  background: #fee2e2;
  color: #dc2626;
}

.notification-icon.error::before {
  content: "✕";
}

.notification-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

.notification-message {
  font-size: 15px;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.confirm-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

.confirm-message {
  font-size: 15px;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-modal-actions button {
  min-width: 120px;
}

.prompt-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.prompt-modal.hidden {
  display: none;
}

.prompt-modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  animation: slideUp 0.3s ease;
  text-align: center;
}

.prompt-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.prompt-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

.prompt-message {
  font-size: 15px;
  color: #64748b;
  margin-bottom: 20px;
  line-height: 1.5;
}

.prompt-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.prompt-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.prompt-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.prompt-modal-actions button {
  min-width: 120px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e293b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.file-input-label {
  position: relative;
  display: inline-block;
  cursor: pointer;
  flex: 1;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-input-text {
  display: block;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  transition: all 0.2s ease;
  font-size: 14px;
}

.file-input-label:hover .file-input-text {
  border-color: #f59e0b;
  background: #fef9f0;
}

.file-input-label.file-drop-active .file-input-text {
  border-color: #f59e0b;
  background: #fef3c7;
}

.progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
  transition: width 0.2s ease;
}

.progress-text {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #92400e;
  font-weight: 600;
}

.progress-bar.indeterminate {
  width: 35%;
  animation: progress-slide 1.1s ease-in-out infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(260%);
  }
}

.file-input:focus + .file-input-text {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.stat-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

/* Sticky table header */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sticky-header th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

/* Filter icon button */
.filter-icon {
  padding: 2px 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #94a3b8;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.filter-icon:hover {
  background: #e2e8f0;
  color: #f59e0b;
}

.filter-icon.active {
  color: #f59e0b;
  background: #fef3c7;
}

/* Filter dropdown modal */
.filter-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.filter-dropdown.hidden {
  display: none !important;
}

.filter-dropdown-content {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  min-width: 280px;
  max-width: 400px;
  width: 100%;
  animation: slideDown 0.2s ease;
  z-index: 1001;
  position: relative;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Note Modals */
.note-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.note-modal.hidden {
  display: none;
}

.note-modal-content {
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  max-width: 520px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  animation: slideUp 0.3s ease;
}

.note-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.note-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.note-modal-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.note-modal-close {
  border: none;
  background: transparent;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.2s;
}

.note-modal-close:hover {
  color: #0f172a;
}

.note-empty {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 12px;
  text-align: center;
  padding: 20px;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.note-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e2e8f0;
}

.note-text {
  font-size: 13px;
  color: #0f172a;
  white-space: pre-wrap;
  line-height: 1.5;
}

.note-timestamp {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.note-delete {
  background: transparent;
  border: none;
  color: #e11d48;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.note-delete:hover {
  background: #fef2f2;
}

.note-add {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Context Menus */
.context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  border: 1px solid #e2e8f0;
  padding: 6px;
  animation: fadeIn 0.15s ease;
}

.context-menu.hidden {
  display: none;
}

.context-menu-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #0f172a;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-menu-item:hover {
  background: #f1f5f9;
}

/* Note indicators */
.note-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #f59e0b;
  margin-left: 4px;
  vertical-align: middle;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════
   MOBILE OPTIMIZATIONS
   ═══════════════════════════════════════════════ */

/* Touch-friendly tap targets (min 44px) */
@media (max-width: 767px) {
  .nav-link-mobile {
    padding: 14px 16px;
    font-size: 16px;
    min-height: 48px;
  }

  .card {
    border-radius: 16px;
    padding: 16px;
  }

  .card:hover {
    transform: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  }

  /* Remove desktop hover transforms on mobile */
  .group:hover {
    transform: none !important;
  }

  /* Buttons: larger touch targets */
  .btn-primary,
  .btn-yellow,
  .btn-dark,
  .btn-danger {
    padding: 12px 20px;
    font-size: 15px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Inputs: prevent iOS zoom (keep font-size >= 16px) */
  .input,
  .login-input,
  select,
  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="email"],
  input[type="date"],
  textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  /* Table cells: tighter padding */
  th, td {
    padding: 8px 6px;
    font-size: 13px;
  }

  /* Stat cards */
  .stat-number {
    font-size: 1.75rem;
  }

  /* Fixed action buttons: position for thumb reach */
  #expense-apply-btn,
  #save-changes-btn {
    right: 16px;
    bottom: 16px;
    padding: 14px 20px;
    font-size: 15px;
  }

  /* Override the global SVG rule that sets all SVGs to 280px height */
  svg {
    height: auto;
  }

  /* Modal content — full width on mobile */
  .note-modal-content,
  .duplicate-modal-content,
  .notification-modal-content,
  .confirm-modal-content,
  .prompt-modal-content {
    width: 95%;
    padding: 20px;
    border-radius: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Context menu — wider on mobile for easier tapping */
  .context-menu {
    min-width: 220px;
  }

  .context-menu-item {
    padding: 14px 12px;
    font-size: 15px;
  }

  /* Filter dropdowns */
  .filter-dropdown-content {
    width: 92%;
    max-width: none;
    min-width: auto;
  }

  /* Year input */
  .year-input {
    min-width: 120px;
    padding: 10px 36px 10px 12px;
  }

  /* File upload */
  .file-input-text {
    font-size: 15px;
    padding: 14px 16px;
  }

  /* Spending heatmap: scroll horizontally */
  #heatmap-container {
    -webkit-overflow-scrolling: touch;
  }

  /* Dashboard chart containers: slightly shorter on mobile */
  #monthly-chart,
  #category-chart {
    height: 220px !important;
  }

  /* Month detail panel: tighter spacing */
  #month-detail-panel .card {
    padding: 14px;
  }

  #month-detail-panel h4 {
    font-size: 13px;
  }
}

/* Small phones (< 375px) */
@media (max-width: 374px) {
  .card {
    padding: 12px;
    border-radius: 14px;
  }

  .btn-primary,
  .btn-yellow,
  .btn-dark,
  .btn-danger {
    padding: 10px 14px;
    font-size: 14px;
  }

  th, td {
    padding: 6px 4px;
    font-size: 12px;
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover transforms — they trigger on tap and stay stuck */
  .card:hover {
    transform: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  }

  .btn-primary:hover,
  .btn-yellow:hover,
  .btn-dark:hover,
  .btn-danger:hover {
    transform: none;
  }

  /* Add active state feedback instead */
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
  }

  .btn-primary:active,
  .btn-yellow:active,
  .btn-dark:active,
  .btn-danger:active {
    transform: scale(0.95);
    transition: transform 0.1s;
  }

  /* Scrollable containers: momentum scrolling */
  .overflow-x-auto,
  .overflow-y-auto {
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent text selection on interactive elements */
  button, a, .context-menu-item, .nav-link, .nav-link-mobile {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    -webkit-user-select: none;
    user-select: none;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .note-modal-content,
  .notification-modal-content,
  .confirm-modal-content,
  .prompt-modal-content,
  .duplicate-modal-content {
    max-height: 85vh;
    overflow-y: auto;
  }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #expense-apply-btn,
  #save-changes-btn {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  main {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Mobile chart responsiveness */
@media (max-width: 640px) {
  #trends-chart,
  #category-donut,
  #merchants-chart,
  #budget-chart {
    min-height: 220px;
    height: auto !important;
  }
  
  #trends-chart svg,
  #category-donut svg,
  #merchants-chart svg,
  #budget-chart svg {
    max-width: 100%;
    height: auto;
  }

  /* Fix filter bar wrapping on mobile */
  .card.flex.flex-wrap {
    gap: 0.5rem;
  }
  
  .card.flex.flex-wrap > div {
    min-width: 0;
    flex: 1 1 calc(50% - 0.5rem);
  }

  /* Ensure smooth touch scroll on tables */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent hero headers from causing horizontal overflow */
  .relative.overflow-hidden.rounded-2xl,
  .relative.overflow-hidden.rounded-3xl {
    max-width: 100%;
  }

  /* Filter pills: smaller on mobile */
  .filter-pill {
    padding: 6px 10px;
    gap: 4px;
    font-size: 12px;
    border-radius: 10px;
  }
  .filter-pill svg {
    width: 14px;
    height: 14px;
  }
  .filter-pill select {
    font-size: 12px;
  }

  /* Filter buttons: smaller on mobile */
  .filter-btn {
    padding: 6px 12px;
    font-size: 12px;
    gap: 4px;
    border-radius: 10px;
  }
  .filter-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Tab buttons: prevent overflow, smaller on mobile */
  .flex.flex-wrap.gap-2 > button {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  .flex.flex-wrap.gap-2 > button svg {
    display: none;
  }

  /* Cards: prevent width inconsistency */
  .card, .card.no-hover {
    max-width: 100%;
    overflow: visible;
  }

  /* Import section: stack vertically */
  .mt-4.flex.flex-col.gap-3 {
    flex-direction: column;
  }
}

/* ─── Analytics Tabs ─── */
.analytics-tab {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.analytics-panel {
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
