/* Smart Finance Manager — custom styling on top of Tailwind */
* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.tabular-nums { font-variant-numeric: tabular-nums; }
.font-display { font-family: 'Fraunces', Georgia, serif; }

/* Tab buttons */
.tab-btn {
  position: relative;
  white-space: nowrap;
  padding: 0.55rem 1.1rem;
  border-radius: 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.tab-btn:active:not(.active) { transform: scale(0.97); }

/* Tab alert badges */
.tab-badge {
  position: absolute;
  top: 1px;
  right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 9999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 15px;
  color: #fff;
  text-align: center;
  pointer-events: none;
  animation: popIn 0.2s ease;
}
.tab-badge.red { background: #DC2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.28); }
.tab-badge.amber { background: #D97706; box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.28); }
.tab-btn:hover { background: rgba(100,116,139,0.12); color: #0f172a; }
.dark .tab-btn:hover { background: rgba(100,116,139,0.15); color: #f1f5f9; }
.tab-btn.active {
  background: #0f172a;
  color: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,0.3);
}
.dark .tab-btn.active { background: #f8fafc; color: #0f172a; }

/* Cards */
.card {
  background: #FFFFFF;
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.dark .card {
  background: #151C28;
  border-color: rgba(148,163,184,0.14);
}

/* Range inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #E2E8F0;
  outline: none;
  transition: background 0.15s ease;
}
.dark input[type="range"] { background: #334155; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0F172A;
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.dark input[type="range"]::-webkit-slider-thumb { background: #F8FAFC; border-color: #0F172A; }
input[type="range"].slider-grow::-webkit-slider-thumb { background: #059669; }
input[type="range"].slider-sea::-webkit-slider-thumb { background: #0D9488; }
input[type="range"].slider-amber::-webkit-slider-thumb { background: #D97706; }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #0F172A; border: 2.5px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(15,23,42,0.25); cursor: pointer;
}

/* Number / text / select inputs */
.field {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(148,163,184,0.35);
  background: #FFFFFF;
  color: #0f172a;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field:focus { border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.15); }
.dark .field { background: #1E2738; border-color: rgba(100,116,139,0.4); color: #f1f5f9; }
.dark .field:focus { border-color: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 1rem 1rem;
  overflow-y: auto;
  z-index: 50;
  animation: fadeIn 0.14s ease;
}
.modal-panel {
  width: 100%; max-width: 640px;
  border-radius: 1.25rem;
  background: #fff;
  border: 1px solid rgba(148,163,184,0.25);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.28);
  animation: popIn 0.18s ease;
}
.dark .modal-panel { background: #151C28; border-color: rgba(148,163,184,0.15); }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(0.98) } to { opacity: 1; transform: none } }

/* Toast */
.toast {
  background: #0f172a; color: #fff;
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.8125rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(2,6,23,0.35);
  animation: popIn 0.18s ease;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(148,163,184,0.1); }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.35); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,0.55); }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Progress bars */
.bar-track { background: rgba(148,163,184,0.2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s cubic-bezier(0.22,1,0.36,1); }

/* Insight cards */
.insight { border-left-width: 4px; border-radius: 1rem; }
.insight.good { border-left-color: #059669; }
.insight.warn { border-left-color: #D97706; }
.insight.bad  { border-left-color: #DC2626; }
.insight.info { border-left-color: #0284C7; }

/* Calendar */
.cal-cell {
  min-height: 84px;
  border-radius: 0.6rem;
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(248,247,244,0.6);
  padding: 0.35rem;
}
.dark .cal-cell { background: rgba(21,28,40,0.55); }
.cal-cell.today { border-color: #059669; box-shadow: inset 0 0 0 1.5px rgba(5,150,105,0.5); }
.bill-chip {
  display: flex; align-items: center; gap: 0.3rem;
  width: 100%;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 0.45rem;
  padding: 0.25rem 0.35rem;
  margin-top: 0.2rem;
  cursor: pointer;
  text-align: left;
  border: 1px solid transparent;
  transition: transform 0.1s ease;
}
.bill-chip:hover { transform: translateY(-1px); }

/* Tables */
.tbl th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: #64748b; font-weight: 700; padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(148,163,184,0.25);
  white-space: nowrap;
}
.dark .tbl th { color: #94a3b8; border-color: rgba(148,163,184,0.15); }
.tbl td { padding: 0.6rem 0.75rem; font-size: 0.82rem; border-bottom: 1px solid rgba(148,163,184,0.12); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(100,116,139,0.05); }

/* Category pill */
.cat-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
}
