:root {
  --grad-1: #6c5ce7;
  --grad-2: #00b894;
  --grad-3: #fd79a8;
  --ink: #1e1b2e;
  --muted: #8a8398;
  --surface: #ffffff;
  --bg: #f4f2fb;
  --radius: 18px;
}

* { font-family: 'Poppins', system-ui, sans-serif; }

body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 84px;
}

a { text-decoration: none; }

/* ---------- Form controls (свежи, заоблени) ---------- */
.form-control, .form-select {
  border: 1.5px solid rgba(108,92,231,.12);
  border-radius: 12px;
  background-color: #faf9ff;
  padding: .55rem .85rem;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control::placeholder { color: #b3aec2; }
.form-control:focus, .form-select:focus {
  border-color: var(--grad-1);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(108,92,231,.14);
}
.form-control-sm, .form-select-sm { border-radius: 10px; padding: .4rem .7rem; }
.form-label { color: var(--ink); }
.input-group-text { border-radius: 12px 0 0 12px !important; }
.input-group .form-control { border-radius: 0 12px 12px 0; }

/* Полета за дата/месец да не изглеждат "дървени" */
input[type="date"], input[type="month"] {
  border: 1.5px solid rgba(108,92,231,.12);
  border-radius: 12px;
  background-color: #faf9ff;
  color: var(--ink);
  cursor: pointer;
}
input[type="date"]:focus, input[type="month"]:focus {
  border-color: var(--grad-1);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(108,92,231,.14);
  outline: none;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(38%) sepia(54%) saturate(1878%) hue-rotate(226deg) brightness(97%) contrast(93%);
  cursor: pointer;
  border-radius: 6px;
  padding: 3px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  background: rgba(108,92,231,.12);
}

/* ---------- Top navbar ---------- */
.app-topbar {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: .6rem 0;
}
.navbar-brand { color: var(--ink); font-size: 1.05rem; }
.brand-icon {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; box-shadow: 0 6px 16px rgba(108,92,231,.35);
}
@media (min-width: 992px) {
  .app-topbar .navbar-collapse { flex: 1 1 auto; display: flex !important; }
  .app-topbar .navbar-nav { width: 100%; justify-content: center; }
}
.nav-link { color: var(--muted) !important; font-weight: 500; border-radius: 10px; padding: .5rem .9rem !important; white-space: nowrap; }
.nav-link.active, .nav-link:hover { color: var(--ink) !important; background: rgba(108,92,231,.08); }

.user-chip { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .85rem; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--chip-color, var(--grad-1));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.btn-icon { border: none; background: rgba(0,0,0,.04); border-radius: 10px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: rgba(0,0,0,.08); }

/* ---------- Buttons ---------- */
.btn-gradient {
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; border: none; border-radius: 12px;
  box-shadow: 0 8px 20px rgba(108,92,231,.3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-gradient:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(108,92,231,.4); color:#fff; }

/* ---------- Panels & cards ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(30,27,46,.05);
  border: 1px solid rgba(0,0,0,.03);
}
.panel-header { margin-bottom: 1rem; }
.border-bottom-dashed { border-bottom: 1px dashed rgba(0,0,0,.08); }
.border-bottom-dashed:last-child { border-bottom: none; }

.highlight-card { padding: 1rem 1.25rem; }
.highlight-icon {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff;
}
.highlight-max .highlight-icon { background: linear-gradient(135deg, #e17055, #d63031); }
.highlight-min .highlight-icon { background: linear-gradient(135deg, #00b894, #00cec9); }

/* ---------- Спестовна цел ---------- */
.goal-empty-icon {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}
.goal-card { position: relative; }
.goal-ring-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto; }
.goal-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring-track { fill: none; stroke: rgba(108,92,231,.1); stroke-width: 10; }
.goal-ring-progress {
  fill: none; stroke: #6c5ce7; stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset .5s ease;
}
.goal-ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.goal-ring-pct { font-size: 1.5rem; font-weight: 800; color: var(--ink); }

.stat-card {
  border-radius: var(--radius);
  padding: 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0,0,0,.08);
}
.stat-card .stat-icon { font-size: 1.4rem; opacity: .85; margin-bottom: .35rem; }
.stat-card .stat-label { font-size: .8rem; opacity: .9; font-weight: 500; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 800; margin: .15rem 0; }
.stat-card .stat-sub { font-size: .72rem; opacity: .85; }
.stat-income { background: linear-gradient(135deg, #00b894, #00cec9); }
.stat-expense { background: linear-gradient(135deg, #fd79a8, #e17055); }
.stat-balance-pos { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.stat-balance-neg { background: linear-gradient(135deg, #d63031, #e17055); }

.bar-gradient { background: linear-gradient(90deg, var(--grad-1), var(--grad-3)); }

.entry-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: .95rem;
}
.bg-income { background: linear-gradient(135deg, #00b894, #00cec9); }
.bg-expense { background: linear-gradient(135deg, #fd79a8, #e17055); }

.entry-type-switch .nav-link {
  border-radius: 12px; background: rgba(0,0,0,.04); color: var(--ink) !important; font-weight: 600;
}
.entry-type-switch .nav-link.active { background: linear-gradient(135deg, var(--grad-1), var(--grad-3)); color: #fff !important; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0,0,0,.06);
  display: flex; align-items: center;
  padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  z-index: 1030;
}
.bn-group { flex: 1 1 0; display: flex; align-items: center; justify-content: space-evenly; min-width: 0; }
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: .64rem; font-weight: 600;
  padding: .25rem .3rem; text-align: center; flex: 1 1 0; min-width: 0;
}
.bn-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bn-item i { font-size: 1.15rem; line-height: 1; }
.bn-item.active { color: var(--grad-1); }
.bn-fab {
  flex: 0 0 auto;
  width: 52px; height: 52px; border-radius: 50%; margin: 0 .35rem; margin-top: -26px;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; box-shadow: 0 10px 22px rgba(108,92,231,.45);
}

/* ---------- Search box ---------- */
.search-box { position: relative; }
.search-box i {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .9rem; pointer-events: none;
}
.search-box .form-control { padding-left: 2.2rem; }

/* ---------- Receipt scan ---------- */
.receipt-scan-box {
  border: 1.5px dashed rgba(108,92,231,.35);
  border-radius: 14px; padding: .9rem; background: rgba(108,92,231,.04);
}
.receipt-preview { max-width: 140px; max-height: 140px; border-radius: 10px; object-fit: cover; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.item-row .form-control { border-radius: 10px; }

/* ---------- Icon picker ---------- */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: .4rem;
  max-height: 220px;
  overflow-y: auto;
  padding: .5rem;
  background: rgba(0,0,0,.03);
  border-radius: 12px;
}
.icon-option {
  width: 42px; height: 42px; border: none; border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .1s ease;
}
.icon-option:hover { transform: translateY(-1px); }
.icon-option.selected {
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; box-shadow: 0 6px 14px rgba(108,92,231,.4);
}

/* ---------- Инсталиране на телефона ---------- */
.install-app-icon {
  width: 76px; height: 76px; border-radius: 20px;
  box-shadow: 0 10px 24px rgba(108,92,231,.3);
}
.install-modal-content { border-radius: 22px; border: none; }
.ios-step {
  display: flex; align-items: center; gap: .6rem;
  background: rgba(108,92,231,.06); border-radius: 12px;
  padding: .6rem .8rem; margin-bottom: .5rem; font-size: .85rem;
}
.ios-step-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Подкана за напомняния ---------- */
.push-prompt {
  position: fixed; left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 1040; background: #fff; border-radius: 18px;
  box-shadow: 0 14px 34px rgba(30,27,46,.18);
  padding: .85rem 1rem; display: flex; align-items: center; gap: .75rem;
  animation: pushSlideUp .35s ease;
}
@media (min-width: 992px) {
  .push-prompt { left: auto; right: 24px; bottom: 24px; max-width: 360px; }
}
@keyframes pushSlideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.push-prompt-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}

/* ---------- Bottom sheet "Още" ---------- */
.more-sheet {
  border-radius: 24px 24px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  max-height: 75vh;
}
.more-sheet-handle {
  width: 42px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.15);
  margin: .75rem auto 0;
}
.more-sheet-item {
  display: flex; align-items: center; gap: .9rem;
  padding: .8rem .25rem; border-bottom: 1px dashed rgba(0,0,0,.08);
  color: var(--ink); font-weight: 600; font-size: .95rem;
}
.more-sheet-item:last-child { border-bottom: none; }
.more-sheet-item.active { color: var(--grad-1); }
.more-sheet-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: rgba(108,92,231,.1); color: var(--grad-1);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.bg-danger-subtle { background: rgba(214,48,49,.1) !important; }

button.bn-item { background: none; border: none; }

/* ---------- Auth page ---------- */
.auth-body {
  min-height: 100vh; position: relative; overflow: hidden;
  background: radial-gradient(circle at top left, #efe9ff, #f4f2fb 60%);
  padding-bottom: 0;
}
.auth-card { border-radius: 24px; max-width: 420px; width: 92%; z-index: 2; }
.auth-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  box-shadow: 0 10px 24px rgba(108,92,231,.4);
}
.auth-blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 1; }
.blob1 { width: 320px; height: 320px; background: var(--grad-1); top: -80px; left: -80px; }
.blob2 { width: 280px; height: 280px; background: var(--grad-2); bottom: -60px; right: -60px; }
.auth-card .form-control { padding: .65rem .75rem; }

@media (min-width: 992px) {
  body { padding-bottom: 0; }
}
