:root {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --bg-elevated-2: #263449;
  --bg-elevated-3: #2d3d54;
  --border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: #1d3a63;
  --danger: #ef4444;
  --danger-soft: #4c1d1d;
  --success: #22c55e;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --nav-height: 64px;
  --fab-size: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

/* Atributul `hidden` trebuie să învingă orice `display` din regulile de mai jos.
   Fără asta, elemente ca `.btn` (display:block) sau `#app` (display:flex) rămân
   vizibile deși sunt marcate `hidden` din JavaScript. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

a { color: var(--accent); }

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}


.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 14px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

#viewContainer {
  flex: 1;
  padding: 16px 16px calc(var(--nav-height) + var(--safe-bottom) + 90px);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn .18s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-header-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---------- Detaliu categorie (modal) ---------- */

.cat-detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
/* Când totalurile generale sunt ascunse, rămâne o singură căsuță pe toată lățimea. */
.cat-detail-stats.is-single { grid-template-columns: 1fr; }

.cat-detail-stat {
  background: var(--bg-elevated-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.cat-detail-stat .stat-value { font-size: 18px; font-weight: 700; margin-top: 4px; }
.cat-detail-stat .stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Dashboard stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- Chart ---------- */

.chart-wrap {
  position: relative;
  height: 220px;
  margin: 0 auto;
  max-width: 320px;
}

/* ---------- Navigare între luni (grafic dashboard) ---------- */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

/* Varianta de sine stătătoare, deasupra cardurilor pe care le controlează. */
.month-nav-standalone {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 16px;
}
.month-nav-standalone .month-nav-label { font-size: 15px; }

.month-nav-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.month-nav-btn:disabled {
  color: var(--text-tertiary);
  opacity: .45;
  cursor: default;
}

.month-nav-label {
  flex: 1;
  text-align: center;
  font-size: 14.5px;
  font-weight: 600;
  text-transform: capitalize;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name { flex: 1; color: var(--text-primary); }
.legend-amount { font-weight: 600; }
.legend-pct { color: var(--text-tertiary); font-size: 12px; width: 40px; text-align: right; }

.empty-inline {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 30px 0;
}

/* ---------- Transaction list ---------- */

.tx-list { display: flex; flex-direction: column; gap: 2px; }

.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.tx-row:last-child { border-bottom: none; }

.tx-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: #334155;
}

.tx-main { flex: 1; min-width: 0; }
.tx-desc { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }
.tx-amount { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* ---------- Filter bar (Transactions) ---------- */

.filter-bar { margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; gap: 10px; }
.filter-row .select { flex: 1; min-width: 0; }

/* ---------- Category grid ---------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

@media (min-width: 640px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .category-grid { grid-template-columns: repeat(4, 1fr); }
}

.category-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
}

.category-card .cat-emoji {
  font-size: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.category-card .cat-name { font-weight: 600; font-size: 14px; }
.category-card .cat-count { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ---------- Reports ---------- */

.top-cat-list { display: flex; flex-direction: column; gap: 14px; }

.top-cat-row .top-cat-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 6px;
}
.top-cat-row .top-cat-head .name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.top-cat-row .top-cat-head .amount { color: var(--text-secondary); }

.progress-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: #334155;
  overflow: hidden;
}
.progress-fill { height: 100%; border-radius: var(--radius-pill); }

.monthly-summary-list { display: flex; flex-direction: column; }
.monthly-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.monthly-summary-row:last-child { border-bottom: none; }
.monthly-summary-row .m-name { font-weight: 600; font-size: 14.5px; text-transform: capitalize; }
.monthly-summary-row .m-count { font-size: 12.5px; color: var(--text-tertiary); }
.monthly-summary-row .m-total { font-weight: 700; }

/* ---------- Forms ---------- */

.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 14px 0 6px;
}
.field-label:first-child { margin-top: 0; }

/* 16px NU e o alegere estetică: sub această valoare, Safari pe iPhone mărește
   automat pagina când atingi câmpul și NU o micșorează la loc după ce închizi
   tastatura. Rezultatul e o foaie modală ieșită pe jumătate din ecran. */
.input, .select, textarea.input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
}

/* iOS dă câmpului de dată o lățime intrinsecă proprie, care poate depăși cardul.
   Fără asta, foaia modală capătă scroll pe orizontală. */
input[type="date"].input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
}

input[type="date"].input::-webkit-date-and-time-value {
  text-align: left;
  min-width: 0;
  margin: 0;
}

.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent);
}

select.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input { resize: vertical; min-height: 70px; }

.field-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 6px 0 0;
  line-height: 1.4;
}

/* ---------- Toggle switch ---------- */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  font-size: 14.5px;
  cursor: pointer;
}

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: background .15s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform .15s ease, background .15s ease;
}

.toggle-switch input:checked ~ .toggle-track { background: var(--accent-soft); border-color: var(--accent); }
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { transform: translateX(18px); background: var(--accent); }

/* ---------- Buttons ---------- */

.btn {
  display: block;
  width: auto;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-block { width: 100%; margin-bottom: 10px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-elevated-2); color: var(--text-primary); border: 1px solid var(--border); }

.btn-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.35); }

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  padding: 8px 4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 18px);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.45);
  z-index: 30;
  cursor: pointer;
}
.fab:active { background: var(--accent-hover); }

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(30, 41, 59, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 25;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px 2px;
}

.nav-btn span { font-size: 10.5px; font-weight: 600; }

.nav-btn.active { color: var(--accent); }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  animation: overlayIn .16s ease;
}

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom: none;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  /* Plasă de siguranță: nimic din foaie nu trebuie să producă scroll lateral. */
  overflow-x: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  animation: sheetUp .2s cubic-bezier(.32, .72, 0, 1);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--border);
    animation: sheetPop .16s ease;
  }
  @keyframes sheetPop {
    from { transform: scale(.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
}

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border);
  margin: 0 auto 14px;
}
@media (min-width: 640px) { .modal-handle { display: none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 { margin: 0; font-size: 18px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; margin-bottom: 0; }

.modal-body-text { color: var(--text-secondary); font-size: 14.5px; line-height: 1.5; }

/* ---------- Emoji / color pickers ---------- */

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.emoji-option {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg-elevated-2);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.emoji-option.selected { border-color: var(--accent); background: var(--accent-soft); }

.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.color-option.selected { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-elevated); }

.color-native {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  padding: 0;
  background: none;
  cursor: pointer;
}

/* ---------- Toast ---------- */

.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  animation: toastIn .18s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-tertiary);
}
.empty-state .empty-emoji { font-size: 40px; margin-bottom: 10px; }
.empty-state .empty-title { color: var(--text-secondary); font-weight: 600; margin-bottom: 4px; }
.empty-state .empty-sub { font-size: 13.5px; }

.app-version {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  margin: 20px 0 4px;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ---------- Auth screen ---------- */

.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}


.auth-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.auth-logo { font-size: 48px; margin-bottom: 10px; }

.auth-card h1 { margin: 0 0 8px; font-size: 26px; }

.auth-tagline {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.5;
  margin-bottom: 28px;
}

.google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 800;
  font-size: 13px;
  margin-right: 6px;
  vertical-align: -4px;
}

.auth-error {
  color: var(--danger);
  font-size: 13.5px;
  margin-top: 14px;
  line-height: 1.45;
}

.auth-info {
  color: var(--success);
  font-size: 13.5px;
  margin-top: 14px;
  line-height: 1.45;
}

/* ---------- Auth: separator + login prin cod pe email ---------- */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 18px;
  color: var(--text-tertiary);
  font-size: 12.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-form { text-align: left; }
.auth-form .input { margin-bottom: 10px; }
.auth-form .btn-block { margin-bottom: 0; }

.auth-switch {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.auth-switch .btn-text { font-size: 13.5px; padding: 0 0 0 4px; }

.auth-setup-warning {
  margin-top: 20px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #eab308;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-align: left;
}
.auth-setup-warning code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- Account / sync status (Settings) ---------- */

.account-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.account-info .account-email { color: var(--text-primary); font-weight: 600; }

.sync-status {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-top: 10px;
  text-align: center;
}
.sync-status.sync-pending { color: #eab308; }
.sync-status.sync-error { color: var(--danger); }
.sync-status.sync-ok { color: var(--success); }

/* ---------- Metode de autentificare (Setări) ---------- */

.auth-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elevated-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.auth-method-name { display: flex; align-items: center; gap: 9px; font-weight: 600; }

.auth-method-status { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.auth-method-status.is-active { color: var(--success); }
.auth-method-status.is-inactive { color: var(--text-tertiary); }

#setPasswordForm { margin-top: 4px; }

/* ---------- Buget ---------- */

.budget-alloc-list { display: flex; flex-direction: column; gap: 8px; }

.budget-alloc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 12px;
}

.budget-alloc-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-alloc-amount {
  font-size: 12.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.budget-alloc-input {
  width: 68px;
  flex-shrink: 0;
  padding: 8px 10px;
  text-align: right;
  font-size: 14px;
}

.budget-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0 0;
  text-align: center;
  line-height: 1.5;
}
.budget-summary.is-over { color: var(--danger); }

/* ---------- Comparația pe ultimele 3 luni (detaliu categorie) ---------- */

.cat-trend {
  background: var(--bg-elevated-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.cat-trend-title {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.cat-trend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cat-trend-row:last-child { margin-bottom: 0; }

.cat-trend-month {
  font-size: 12.5px;
  color: var(--text-secondary);
  width: 72px;
  flex-shrink: 0;
  text-transform: capitalize;
}

.cat-trend-bar {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: #334155;
  overflow: hidden;
}
.cat-trend-fill { display: block; height: 100%; border-radius: var(--radius-pill); }

.cat-trend-value {
  font-size: 13px;
  font-weight: 600;
  width: 88px;
  text-align: right;
  flex-shrink: 0;
}

/* Acțiune discretă în josul unui card — mai ușoară vizual decât un buton lat. */
.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.card-actions .btn-text { font-size: 13.5px; padding: 6px 0; }

/* ---------- Totaluri generale (Rapoarte) ---------- */

.lifetime-list { display: flex; flex-direction: column; }

.lifetime-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.lifetime-row:last-child { border-bottom: none; }

.lifetime-label {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lifetime-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lifetime-value { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* Indiciul de buget din formularul de tranzacție */
.budget-hint {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--success);
  margin: 8px 0 0;
}
.budget-hint.is-over { color: var(--danger); font-weight: 600; }

.budget-dash-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 10px 0 0;
}

/* Bara de buget de pe cardul unei categorii */
.cat-budget { margin-top: 10px; }
.cat-budget .progress-track { height: 5px; }
.cat-budget-text {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 5px;
}
.cat-budget-text.is-over { color: var(--danger); font-weight: 600; }

.password-warning {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #eab308;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 14px 0 0;
}

/* ---------- Import: proveniența datelor ---------- */

/* Bulina care marchează o tranzacție intrată printr-un import. Discretă intenționat:
   după un import de câteva sute de rânduri, un badge pe fiecare linie ar fi zgomot. */
.tx-import-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  margin-right: 6px;
  vertical-align: middle;
}

/* Cele două variante de import, ca opțiuni pe care le poți atinge cu degetul */
.import-option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px;
  margin-top: 12px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.import-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.import-option input[type="radio"] {
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.import-option-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.import-option-title { font-size: 14.5px; font-weight: 600; }
.import-option-sub { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Lista de importuri recente din Setări */
.import-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.import-entry:last-child { border-bottom: none; }
.import-entry-main { flex: 1; min-width: 0; }
.import-entry-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-entry-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.btn-small {
  width: auto;
  padding: 7px 14px;
  font-size: 13px;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Istoricul stă între butoanele de date și cel de ștergere totală, despărțit de ele. */
#importHistory {
  margin: 4px 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
#importHistory .field-label { margin-top: 0; }

/* ---------- Observațiile lunii ---------- */

.insight-list { display: flex; flex-direction: column; gap: 9px; }

.insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-elevated-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-tertiary);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Culoarea marchează tipul observației, nu doar decorează: roșu = ai depășit ceva,
   galben = ești aproape, verde = ai cheltuit mai puțin. */
.insight.is-over { border-left-color: var(--danger); }
.insight.is-warn { border-left-color: #eab308; }
.insight.is-up   { border-left-color: #f59e0b; }
.insight.is-down { border-left-color: var(--success); }

.insight-mark { font-weight: 700; flex-shrink: 0; line-height: 1.5; }
.insight.is-over .insight-mark { color: var(--danger); }
.insight.is-warn .insight-mark { color: #eab308; }
.insight.is-up   .insight-mark { color: #f59e0b; }
.insight.is-down .insight-mark { color: var(--success); }
.insight.is-neutral .insight-mark { color: var(--text-tertiary); }

.insight-copy { margin-top: 14px; margin-bottom: 6px; }

/* ---------- Rezumat lunar: fiecare lună se poate deschide ---------- */

.monthly-summary-item { border-bottom: 1px solid var(--border); }
.monthly-summary-item:last-child { border-bottom: none; }

/* Rândul a devenit buton, deci trebuie readus la aspectul de rând de listă. */
button.monthly-summary-row {
  width: 100%;
  background: none;
  border: none;
  border-bottom: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 12px 0;
  font-size: inherit;
}

.monthly-summary-row .m-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.monthly-summary-row .m-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.monthly-summary-row .m-chevron { color: var(--text-tertiary); font-size: 13px; }
.monthly-summary-item.is-open .m-name { color: var(--accent); }

.month-detail { padding: 4px 0 16px; }
.month-detail-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
  margin: 16px 0 10px;
}
.month-detail-title:first-child { margin-top: 4px; }
.month-detail .top-cat-list { display: flex; flex-direction: column; gap: 12px; }
.month-detail-copy { margin-top: 18px; margin-bottom: 0; }

/* Nume lungi de categorie nu trebuie să strivească suma din dreapta. */
.top-cat-row .top-cat-head .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-cat-row .top-cat-head .amount { flex-shrink: 0; white-space: nowrap; padding-left: 10px; }
.monthly-summary-row .m-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toast cu acțiune (ex. „Anulează" după o ștergere) ---------- */

/* Containerul de toast-uri e transparent la clic, ca să nu blocheze pagina.
   Doar toast-ul care chiar are un buton devine atingibil. */
.toast.has-action {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 8px;
}

.toast-action {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  flex-shrink: 0;
}
.toast-action:active { background: var(--accent-soft); }
