/* BudżetApp - Main Stylesheet */
/* Fonts loaded via <link> in layout.php and login.php */

:root {
  --bg: #0f1117;
  --surface: #181c27;
  --surface2: #1e2333;
  --border: #2a3050;
  --accent: #4f8ef7;
  --accent2: #38e8b0;
  --warn: #f7a94f;
  --danger: #f75f5f;
  --text: #e8ecf5;
  --muted: #6b7494;
  --green: #38e8b0;
  --red: #f75f5f;
  --yellow: #f7d24f;
  --sans: 'Outfit', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==================== SIDEBAR ==================== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  padding: 0 0 24px 0;
}
.logo {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.logo-text {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo-text span { color: var(--accent); }
.logo-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}
.nav-section {
  padding: 0 12px;
  margin-bottom: 8px;
}
.nav-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 6px;
  font-family: var(--mono);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--muted);
  transition: all 0.15s;
  font-weight: 400;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(79,142,247,0.12); color: var(--accent); font-weight: 700; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.month-selector {
  margin: 0 12px 16px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
}
.month-label { font-size: 10px; color: var(--muted); font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.month-val {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
  display: flex; align-items: center; justify-content: space-between;
}
.month-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}
.month-dropdown.open { display: block; }
.month-option {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
}
.month-option:hover { background: var(--surface2); }
.month-option.active { background: rgba(79,142,247,0.12); color: var(--accent); font-weight: 700; }

.sidebar-bottom {
  padding: 0 12px;
}
.ai-status {
  padding: 12px;
  background: rgba(79,142,247,0.07);
  border-radius: 10px;
  border: 1px solid rgba(79,142,247,0.15);
}
.ai-status-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ai-status-val { font-size: 12px; color: var(--accent); font-weight: 700; }

/* ==================== MAIN ==================== */
.main {
  margin-left: 220px;
  padding: 32px 36px;
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.page-title {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.page-title span { color: var(--accent); }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* ==================== BUTTONS ==================== */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d7ef6; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: rgba(247,95,95,0.1); color: var(--red); border: 1px solid rgba(247,95,95,0.2); }
.btn-danger:hover { background: rgba(247,95,95,0.2); }
.btn-warn { background: rgba(247,169,79,0.1); color: var(--warn); border: 1px solid rgba(247,169,79,0.2); }
.btn-warn:hover { background: rgba(247,169,79,0.2); }
.btn-green { background: rgba(56,232,176,0.1); color: var(--green); border: 1px solid rgba(56,232,176,0.2); }
.btn-green:hover { background: rgba(56,232,176,0.2); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ==================== STATS ROW ==================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
  animation: fadeUp 0.4s ease both;
}
.stat-card:hover { border-color: var(--accent); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}
.stat-card.green::before { background: var(--green); }
.stat-card.blue::before { background: var(--accent); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.red::before { background: var(--red); }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; font-family: var(--mono); margin-bottom: 8px; }
.stat-value { font-family: var(--sans); font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-value.green { color: var(--green); }
.stat-value.blue { color: var(--accent); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red { color: var(--red); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  margin-top: 6px;
}
.stat-badge.up { background: rgba(56,232,176,0.12); color: var(--green); }
.stat-badge.down { background: rgba(247,95,95,0.12); color: var(--red); }

/* ==================== GRID LAYOUTS ==================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3col { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ==================== CARDS ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
}
.card-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title-badge {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  font-weight: 400;
}
.card-sub { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.card + .card { margin-top: 20px; }

/* ==================== CATEGORY BARS ==================== */
.cat-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 13px;
}
.cat-name { font-size: 12.5px; color: var(--text); width: 195px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar-wrap { flex: 1; height: 7px; background: var(--surface2); border-radius: 4px; overflow: hidden; position: relative; }
.cat-bar { height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(0.4,0,0.2,1); }
.cat-amounts { width: 110px; text-align: right; flex-shrink: 0; }
.cat-spent { font-size: 12.5px; font-family: var(--mono); color: var(--text); }
.cat-plan { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.cat-pct { font-size: 11px; width: 38px; text-align: right; flex-shrink: 0; font-family: var(--mono); }
.cat-pct-inline { display: none; font-size: 11px; font-family: var(--mono); font-weight: 600; }

/* ==================== ACCOUNTS ==================== */
.account-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.account-item:last-child { border-bottom: none; }
.account-name { font-size: 13px; color: var(--text); font-weight: 700; }
.account-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.account-val { font-family: var(--sans); font-size: 18px; font-weight: 700; color: var(--green); }
.account-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; margin-right: 12px;
}

/* ==================== INCOME ==================== */
.income-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.income-row:last-child { border-bottom: none; }
.income-src { font-size: 13px; color: var(--text); }
.income-date { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.income-right { text-align: right; }
.income-amt { font-family: var(--mono); font-size: 13px; }
.income-status {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  margin-top: 3px;
  display: inline-block;
}
.income-status.ok { background: rgba(56,232,176,0.12); color: var(--green); }
.income-status.pending { background: rgba(247,169,79,0.12); color: var(--warn); }

/* ==================== DONUT CHART ==================== */
.donut-wrap {
  display: flex; flex-direction: column; align-items: center;
  position: relative;
}
svg.donut { transform: rotate(-90deg); }
.donut-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -53%);
  text-align: center;
  pointer-events: none;
}
.donut-pct { font-family: var(--sans); font-size: 30px; font-weight: 800; color: var(--text); }
.donut-sub { font-size: 11px; color: var(--muted); }

/* ==================== TRANSACTIONS ==================== */
.tx-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.tx-desc { flex: 1; min-width: 0; }
.tx-name { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-cat { font-size: 11px; color: var(--muted); margin-top: 1px; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-amt { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.tx-date { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }

/* ==================== SPARKLINE ==================== */
.sparkline-row {
  display: flex; gap: 4px; align-items: flex-end;
  height: 40px; margin-top: 12px; padding-top: 4px;
}
.spark-bar {
  flex: 1; border-radius: 3px 3px 0 0;
  background: rgba(79,142,247,0.3);
  transition: background 0.2s;
  cursor: pointer;
  position: relative;
}
.spark-bar:hover { background: var(--accent); }
.spark-bar.current { background: var(--accent); }

/* ==================== BILANS ==================== */
.bilans-wrap {
  display: flex; flex-direction: column; gap: 10px;
}
.bilans-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border-radius: 10px;
  padding: 12px 16px;
}
.bilans-lbl { font-size: 12px; color: var(--muted); }
.bilans-val { font-family: var(--sans); font-size: 17px; font-weight: 700; }

/* ==================== IMPORT BANNER ==================== */
.import-banner {
  background: linear-gradient(135deg, rgba(79,142,247,0.08), rgba(56,232,176,0.05));
  border: 1px dashed rgba(79,142,247,0.35);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.import-banner:hover { border-color: var(--accent); }
.import-banner.dragover { border-color: var(--accent); background: rgba(79,142,247,0.12); }
.import-icon { font-size: 22px; }
.import-text { flex: 1; }
.import-text strong { font-size: 13px; color: var(--text); }
.import-text p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ==================== TABS ==================== */
.tabs {
  display: flex; gap: 4px; margin-bottom: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px;
  width: fit-content;
}
.tab {
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }

/* ==================== PANELS ==================== */
.panel { display: none; }
.panel.active { display: block; animation: fadeUp 0.2s ease; }

/* ==================== TABLES ==================== */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--mono);
  padding: 0 12px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(42,48,80,0.5);
  font-size: 13px;
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,0.02); }

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-blue { background: rgba(79,142,247,0.12); color: var(--accent); }
.badge-green { background: rgba(56,232,176,0.12); color: var(--green); }
.badge-warn { background: rgba(247,169,79,0.12); color: var(--warn); }
.badge-red { background: rgba(247,95,95,0.12); color: var(--red); }
.badge-muted { background: rgba(107,116,148,0.15); color: var(--muted); }

/* ==================== FORMS ==================== */
.form-row { display: grid; gap: 12px; margin-bottom: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 2fr 1.5fr 1fr auto; }

label {
  font-size: 11px; color: var(--muted);
  display: block; margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.8px;
  font-family: var(--mono);
}
input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 60px; }

/* ==================== TOGGLES ==================== */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-info strong { font-size: 13px; color: var(--text); display: block; margin-bottom: 3px; }
.toggle-info span { font-size: 12px; color: var(--muted); }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border); border-radius: 22px;
  transition: 0.3s;
}
.slider:before {
  position: absolute; content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
}
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(18px); }

/* ==================== IGNORED TRANSACTIONS ==================== */
.tx-ignore-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tx-ignore-row:last-child { border-bottom: none; }
.tx-ignore-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.tx-ignore-desc { flex: 1; }
.tx-ignore-name { font-size: 13px; color: var(--text); }
.tx-ignore-meta { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.tx-ignore-amt { font-family: var(--mono); font-size: 13px; width: 90px; text-align: right; flex-shrink: 0; }

/* ==================== MISC ==================== */
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 7px; flex-shrink: 0; }

.info-box {
  background: rgba(79,142,247,0.06);
  border: 1px solid rgba(79,142,247,0.18);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex; gap: 12px; align-items: flex-start;
}
.info-box svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.info-box p { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.info-box p strong { color: var(--text); }

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex; gap: 4px; align-items: center; justify-content: center;
  margin-top: 20px;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ==================== IMPORT PREVIEW ==================== */
.import-zone {
  background: linear-gradient(135deg, rgba(79,142,247,0.06), rgba(56,232,176,0.04));
  border: 2px dashed rgba(79,142,247,0.3);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.import-zone:hover, .import-zone.dragover {
  border-color: var(--accent);
  background: rgba(79,142,247,0.1);
}
.import-zone h3 { font-family: var(--sans); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.import-zone p { font-size: 13px; color: var(--muted); }

/* Drop zone (new import) */
.drop-zone {
  background: linear-gradient(135deg, rgba(79,142,247,0.06), rgba(56,232,176,0.04));
  border: 2px dashed rgba(79,142,247,0.3);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 24px;
}
.drop-zone:hover {
  border-color: var(--accent);
  background: rgba(79,142,247,0.1);
}
.drop-zone.drag-over {
  border-color: var(--green);
  background: rgba(45,212,160,0.06);
}
.drop-icon { font-size: 48px; margin-bottom: 16px; }
.drop-title { font-family: var(--sans); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.drop-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.import-preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 16px;
}
.import-stats { display: flex; gap: 20px; font-size: 13px; }
.import-stat-num { font-weight: 700; font-family: var(--mono); }

/* ==================== MODAL ==================== */
.modal-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px;
}

/* ==================== LOGIN ==================== */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  text-align: center;
}
.login-box .logo-text { font-size: 28px; margin-bottom: 8px; }
.login-box .logo-sub { margin-bottom: 32px; }
.login-box .form-group { margin-bottom: 16px; text-align: left; }
.login-box .btn { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* ==================== RENOVATION ==================== */
/* Extra variables for renovation */
.summary-bar,
.sections-wrap,
.totals-section {
  --surface3: #232840;
  --border2: #323860;
  --green-dim: rgba(45,212,160,0.08);
  --green-border: rgba(45,212,160,0.25);
}

/* Summary bar */
.summary-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.sum-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; position: relative; overflow: hidden;
  transition: border-color 0.2s;
}
.sum-card::before {
  content: ''; position: absolute; top:0; left:0; right:0; height:3px; border-radius: 12px 12px 0 0;
}
.sum-card.total::before { background: var(--accent); }
.sum-card.paid::before { background: var(--green); }
.sum-card.remaining::before { background: var(--warn); }
.sum-card.selected::before { background: #c084fc; }
.sum-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono); margin-bottom: 7px; }
.sum-val { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; font-family: var(--sans); }
.sum-val.blue { color: var(--accent); }
.sum-val.green { color: var(--green); }
.sum-val.warn { color: var(--warn); }
.sum-val.purple { color: #c084fc; }
.sum-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.progress-wrap { margin-top: 10px; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--green); transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }

/* Selection notice */
.selection-notice {
  display: none;
  background: rgba(192,132,252,0.07);
  border: 1px solid rgba(192,132,252,0.25);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #c084fc;
  align-items: center;
  gap: 10px;
}
.selection-notice.visible { display: flex; }
.selection-notice strong { color: var(--text); }

/* Sections */
.sections-wrap { display: flex; flex-direction: column; gap: 14px; }

.section-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  overflow: hidden; transition: border-color 0.2s;
  animation: fadeUp 0.3s ease both;
}
.section-card:nth-child(1) { animation-delay: 0.05s; }
.section-card:nth-child(2) { animation-delay: 0.10s; }
.section-card:nth-child(3) { animation-delay: 0.15s; }
.section-card:nth-child(4) { animation-delay: 0.20s; }
.section-card:nth-child(5) { animation-delay: 0.25s; }

.section-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.section-header:hover { background: var(--surface3); }

.section-chevron {
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--surface3); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform 0.25s;
  color: var(--muted);
}
.section-chevron svg { width: 12px; height: 12px; }
.section-card.collapsed .section-chevron { transform: rotate(-90deg); }

.section-name { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; }
.section-meta { display: flex; align-items: center; gap: 12px; }
.section-paid-badge {
  font-size: 11px; padding: 2px 9px; border-radius: 20px;
  font-weight: 600; font-family: var(--mono);
}
.section-paid-badge.all-paid { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-border); }
.section-paid-badge.partial { background: rgba(247,169,79,0.08); color: var(--warn); border: 1px solid rgba(247,169,79,0.2); }
.section-paid-badge.none { background: var(--surface3); color: var(--muted); border: 1px solid var(--border); }
.section-sum { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text); }
.section-sum.all-paid { color: var(--green); }

.section-body { overflow: hidden; }
.section-card.collapsed .section-body { display: none; }

/* Items */
.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid rgba(42,48,80,0.5);
  transition: background 0.15s;
  position: relative;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: rgba(255,255,255,0.015); }

.item-row.paid {
  background: var(--green-dim);
}
.item-row.paid .item-name { color: var(--green); }
.item-row.paid .item-formula { color: rgba(45,212,160,0.5); }
.item-row.paid::after {
  content: '';
  position: absolute; left:0; top:0; bottom:0; width:3px;
  background: var(--green); border-radius: 0 2px 2px 0;
}

.item-row.selected-item {
  background: rgba(192,132,252,0.05);
}
.item-row.selected-item::after {
  content: '';
  position: absolute; left:0; top:0; bottom:0; width:3px;
  background: #c084fc; border-radius: 0 2px 2px 0;
}
.item-row.paid.selected-item::after { background: var(--green); }

/* Checkboxes */
.cb-paid-wrap, .cb-sel-wrap { display: flex; align-items: center; flex-shrink: 0; }

.cb-paid {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s; flex-shrink: 0;
  background: transparent;
}
.cb-paid:hover { border-color: var(--green); }
.cb-paid.checked { background: var(--green); border-color: var(--green); }
.cb-paid svg { width: 11px; height: 11px; color: #0f1117; opacity: 0; transition: opacity 0.15s; }
.cb-paid.checked svg { opacity: 1; }

.cb-sel {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s; flex-shrink: 0;
  background: transparent;
}
.cb-sel:hover { border-color: #c084fc; }
.cb-sel.checked { background: #c084fc; border-color: #c084fc; }
.cb-sel svg { width: 9px; height: 9px; color: #fff; opacity: 0; transition: opacity 0.15s; }
.cb-sel.checked svg { opacity: 1; }

.item-name { flex: 1; font-size: 13px; color: #b0b8d0; font-weight: 500; transition: color 0.2s; }
.item-formula { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 1px; }

.item-amount {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--text); text-align: right; flex-shrink: 0; min-width: 90px;
  transition: color 0.2s;
}
.item-row.paid .item-amount { color: var(--green); }

/* Partial paid state */
.item-row.partial { background: rgba(255,193,7,0.04); }
.item-row.partial::after {
  content: '';
  position: absolute; left:0; top:0; bottom:0; width:3px;
  background: var(--warn); border-radius: 0 2px 2px 0;
}
.cb-paid.partial { border-color: var(--warn); background: rgba(255,193,7,0.3); }
.cb-paid.partial svg { opacity: 0.6; color: var(--warn); }

/* Item block wrapper (item + sub-items) */
.item-block { border-bottom: 1px solid rgba(42,48,80,0.5); }
.item-block:last-of-type { border-bottom: none; }
.item-block .item-row { border-bottom: none; cursor: pointer; }

/* Sub-items progress inline */
.item-sub-info {
  display: flex; align-items: center; gap: 6px; margin-top: 3px;
}
.sub-progress-bar {
  display: inline-block; width: 50px; height: 4px; background: var(--surface2);
  border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.sub-progress-fill {
  display: block; height: 100%; background: var(--green); border-radius: 2px;
  transition: width 0.3s;
}
.sub-progress-text {
  font-size: 10px; color: var(--muted); font-family: var(--mono); white-space: nowrap;
}

/* Sub-items panel */
.sub-items-panel {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  background: rgba(255,255,255,0.015);
  border-top: 1px dashed rgba(42,48,80,0.4);
}
.sub-items-panel.open { max-height: 1000px; }

.sub-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 52px;
  border-bottom: 1px solid rgba(42,48,80,0.25);
  font-size: 12px;
  position: relative;
  transition: background 0.15s;
}
.sub-item-row:hover { background: rgba(255,255,255,0.02); }
.sub-item-row.paid { background: rgba(56,232,176,0.04); }
.sub-item-row.paid .sub-item-name { color: var(--green); text-decoration: line-through; }
.sub-item-row.paid .sub-item-amount { color: var(--green); }

.sub-item-row .cb-paid.sub-cb { width: 16px; height: 16px; flex-shrink: 0; }
.sub-item-row .cb-paid.sub-cb svg { width: 9px; height: 9px; }

.sub-item-name { flex: 1; color: #8892b0; min-width: 0; }
.sub-item-amount {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--text); text-align: right; flex-shrink: 0; min-width: 70px;
}
.sub-item-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.sub-item-row:hover .sub-item-actions { opacity: 1; }

/* Sub-item add row */
.sub-add-row {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 18px 8px 52px;
  background: rgba(255,255,255,0.01);
}
.sub-add-input {
  font-size: 12px; padding: 5px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  flex: 1; min-width: 0;
}
.sub-add-input.amt { max-width: 80px; flex: 0 0 80px; text-align: right; }
.btn-xs { font-size: 11px; padding: 4px 8px; white-space: nowrap; }

/* Section footer */
.section-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border);
}
.section-footer-left { display: flex; gap: 16px; align-items: center; }
.sf-meta { font-size: 11px; color: var(--muted); }
.sf-meta strong { color: var(--green); }
.section-total { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }

/* Add item row */
.add-item-row {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 18px;
  background: rgba(255,255,255,0.01);
  border-top: 1px dashed var(--border);
}
.add-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 11px; color: var(--text); font-size: 12px;
  font-family: var(--sans); outline: none; transition: border-color 0.15s;
}
.add-input:focus { border-color: var(--accent); }
.add-input.formula { width: 120px; flex: 0 0 auto; font-family: var(--mono); font-size: 12px; }

/* Column headers */
.col-headers {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface3);
}
.col-h { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono); }

/* Totals section */
.totals-section {
  margin-top: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  overflow: hidden;
}
.totals-header {
  padding: 14px 20px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
}
.totals-grid { display: grid; grid-template-columns: 1fr 1fr; }
.totals-block { padding: 18px 22px; }
.totals-block:first-child { border-right: 1px solid var(--border); }
.totals-block-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-family: var(--mono); margin-bottom: 12px; }
.totals-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(42,48,80,0.4); }
.totals-row:last-child { border-bottom: none; }
.totals-row-name { font-size: 13px; color: #b0b8d0; }
.totals-row-val { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.totals-row-val.green { color: var(--green); }
.totals-row-val.warn { color: var(--warn); }
.totals-row-val.blue { color: var(--accent); }
.totals-row-val.muted { color: var(--muted); }
.totals-grand {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(79,142,247,0.03);
}
.totals-grand-lbl { font-size: 14px; font-weight: 700; color: var(--text); }
.totals-grand-val { font-size: 22px; font-weight: 800; font-family: var(--sans); letter-spacing: -0.5px; }
.totals-grand-val.blue { color: var(--accent); }

/* Ghost button for renovation */
.btn-ghost { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 12px; font-family: var(--sans); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* Item action buttons (edit/delete) */
.item-actions {
  display: flex; gap: 4px; align-items: center; flex-shrink: 0;
  opacity: 0; transition: opacity 0.15s;
}
.item-row:hover .item-actions { opacity: 1; }
.btn-icon {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,142,247,0.06); }
.btn-icon-danger:hover { border-color: var(--red); color: var(--red); background: rgba(247,95,95,0.06); }

/* ==================== EMOJI PICKER ==================== */
.emoji-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.emoji-opt {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--border); background: var(--surface2);
  transition: all 0.15s;
}
.emoji-opt:hover { border-color: var(--accent); background: rgba(79,142,247,0.08); }
.emoji-opt.active { border-color: var(--accent); background: rgba(79,142,247,0.15); box-shadow: 0 0 0 2px rgba(79,142,247,0.3); }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ==================== MOBILE OVERLAY ==================== */
.mobile-overlay-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 299;
}
.mobile-overlay-bg.active { display: block; }

/* ==================== MOBILE BOTTOM NAV ==================== */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 6px 0 env(safe-area-inset-bottom, 6px) 0;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: 1; padding: 6px 4px;
  color: var(--muted); text-decoration: none;
  font-size: 10px; font-weight: 500;
  transition: color 0.15s;
}
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item:hover { color: var(--accent); text-decoration: none; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  /* Sidebar as overlay */
  .sidebar {
    display: none;
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 300; width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.mobile-open {
    display: flex;
    transform: translateX(0);
  }
  .mobile-nav { display: flex; }

  /* Main layout */
  .main {
    margin-left: 0;
    padding: 16px 12px 86px 12px;
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Topbar */
  .topbar { flex-direction: column; gap: 8px; }
  .topbar-right { flex-wrap: wrap; gap: 6px !important; justify-content: center; }
  .topbar-right span[style*="min-width"] { min-width: auto !important; font-size: 12px !important; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 11px; }

  /* Stat cards: 2x2 grid, more compact */
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 14px 12px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 18px; }
  .stat-sub { font-size: 10px; }

  /* Grids → single column */
  .grid-2, .grid-3, .grid-3col { grid-template-columns: 1fr; gap: 14px; }
  .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .summary-bar { grid-template-columns: 1fr 1fr; }
  .totals-grid { grid-template-columns: 1fr; }

  /* Cards: tighter padding + contain overflow */
  .card { padding: 16px 14px; overflow: hidden; max-width: 100%; }
  .card-title { font-size: 13px; margin-bottom: 12px; }

  /* Import banner: hide on mobile */
  .import-banner { display: none; }

  /* Forecast bar: stack vertically */
  .forecast-bar .forecast-nums { flex-direction: column; gap: 10px !important; }

  /* ---- CATEGORY BARS: compact 2-line layout ---- */
  .cat-row {
    flex-wrap: wrap; gap: 4px 8px; margin-bottom: 10px;
    padding-bottom: 10px; border-bottom: 1px solid rgba(42,48,80,0.3);
  }
  .cat-row:last-child { border-bottom: none; }
  .cat-name {
    width: 100% !important; font-size: 12px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .cat-bar-wrap { flex: 1; min-width: 0; order: 2; }
  .cat-amounts { width: auto !important; order: 3; text-align: right; }
  .cat-spent { font-size: 11px; }
  .cat-plan { font-size: 10px; }
  .cat-pct { display: none !important; }
  .cat-pct-inline { display: inline; }

  /* ---- TRANSACTION ROWS: truncated, tappable ---- */
  .tx-row { gap: 8px; padding: 8px 0; }
  .tx-icon { width: 28px; height: 28px; font-size: 12px; }
  .tx-name { font-size: 12px; max-width: 140px; }
  .tx-cat { font-size: 10px; }
  .tx-amt { font-size: 12px; }
  .tx-date { font-size: 10px; }
  .tx-row.expanded .tx-name {
    white-space: normal !important; max-width: none !important;
    overflow: visible !important;
  }

  /* ---- INCOME ROWS: compact ---- */
  .income-row { padding: 8px 0; flex-wrap: wrap; gap: 4px; }
  .income-src { font-size: 12px; max-width: 150px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }
  .income-row.expanded .income-src {
    white-space: normal; max-width: none; overflow: visible;
  }
  .income-amt { font-size: 12px; }
  .income-date { font-size: 10px; }
  .income-status { font-size: 9px; padding: 1px 5px; }

  /* ---- BILANS: compact ---- */
  .bilans-item { padding: 10px 12px; }
  .bilans-lbl { font-size: 11px; }
  .bilans-val { font-size: 14px; }

  /* ---- ACCOUNTS ---- */
  .account-icon { width: 28px; height: 28px; font-size: 16px; margin-right: 8px; }
  .account-name { font-size: 12px; }
  .account-sub { font-size: 10px; }
  .account-val { font-size: 15px; }

  /* ---- TABLES: horizontal scroll ---- */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
  .tbl { font-size: 12px; min-width: 500px; }
  .tbl th, .tbl td { padding: 8px 6px; white-space: nowrap; }

  /* Donut smaller on mobile */
  .donut-pct { font-size: 24px; }

  /* Modal */
  .modal { max-width: 95vw !important; margin: 10px; max-height: 90vh; overflow-y: auto; }

  /* Tabs: scrollable */
  .tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding: 8px 14px; font-size: 12px; }

  /* Buttons */
  .btn { font-size: 12px; padding: 8px 12px; }
  .btn-sm { font-size: 11px; padding: 5px 8px; }

  /* ---- GLOBAL: prevent overflow from inline widths ---- */
  input, select, textarea { max-width: 100% !important; }

  /* ---- FILTER BARS: stack vertically ---- */
  .filter-bar { flex-direction: column !important; gap: 8px !important; }
  .filter-bar > div { width: 100%; }
  .filter-bar input, .filter-bar select { width: 100% !important; }

  /* ---- IMPORT PREVIEW: compact ---- */
  .import-preview-bar {
    flex-direction: column !important; gap: 10px !important;
    align-items: stretch !important; padding: 14px !important;
  }
  .import-stats { font-size: 12px; justify-content: center; flex-wrap: wrap; gap: 8px; }

  /* ---- REMONT: FULL MOBILE OVERHAUL ---- */

  /* Summary cards: 2x2 grid, smaller */
  .summary-bar { gap: 8px; }
  .sum-card { padding: 10px 8px; }
  .sum-lbl { font-size: 9px; letter-spacing: 0.5px; }
  .sum-val { font-size: 15px !important; }
  .sum-sub { font-size: 9px; }
  .progress-wrap { margin-top: 6px; }

  /* Selection notice */
  .selection-notice { font-size: 11px; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }

  /* Section header: compact, wrap meta */
  .section-header { padding: 10px 12px; gap: 8px; }
  .section-name { font-size: 13px; }
  .section-meta { flex-wrap: wrap; gap: 4px; }
  .section-paid-badge { font-size: 9px; padding: 1px 6px; }
  .section-sum { font-size: 11px; }

  /* Column headers: hide on mobile */
  .col-headers { display: none; }

  /* Item rows: compact, 2-line layout */
  .item-row {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }
  /* Hide the 12px spacer div between checkboxes */
  .item-row > div[style*="width:12px"] { display: none; }

  .cb-paid { width: 18px; height: 18px; }
  .cb-paid svg { width: 10px; height: 10px; }
  .cb-sel { width: 14px; height: 14px; }
  .cb-sel svg { width: 8px; height: 8px; }

  .item-name { font-size: 12px; }
  .item-formula { font-size: 10px; }

  .item-amount {
    min-width: auto !important;
    font-size: 12px;
    text-align: right;
  }

  /* Actions always visible on mobile (no hover) */
  .item-actions {
    opacity: 1 !important;
    gap: 2px;
  }
  .btn-icon { width: 24px; height: 24px; }

  /* Sub-items: mobile adjustments */
  .sub-item-row { padding: 6px 10px 6px 36px; gap: 6px; }
  .sub-item-actions { opacity: 1 !important; }
  .sub-add-row { padding: 6px 10px 6px 36px; gap: 4px; flex-wrap: wrap; }
  .sub-add-input { font-size: 11px; padding: 4px 6px; }
  .sub-add-input.amt { max-width: 60px; flex: 0 0 60px; }
  .sub-progress-text { font-size: 9px; }
  .item-sub-info { margin-top: 2px; }

  /* Section footer: stack on narrow screens */
  .section-footer {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .section-footer-left { gap: 10px; flex-wrap: wrap; }
  .sf-meta { font-size: 10px; }
  .section-total { font-size: 11px; }

  /* Add item row: compact */
  .add-item-row {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .add-input { padding: 6px 8px; font-size: 11px; }
  .add-input.formula { flex: 1 1 auto; width: auto; min-width: 80px; }

  /* Totals section: single column, compact */
  .totals-block { padding: 12px 14px; }
  .totals-block:first-child { border-right: none; border-bottom: 1px solid var(--border); }
  .totals-block-title { font-size: 10px; margin-bottom: 8px; }
  .totals-row-name { font-size: 12px; }
  .totals-row-val { font-size: 12px; }
  .totals-grand { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .totals-grand-lbl { font-size: 12px; }
  .totals-grand-val { font-size: 18px; }

  /* Remont: topbar actions wrap */
  .topbar > div[style*="display:flex"] { flex-wrap: wrap !important; justify-content: flex-start; }

  /* ---- BUDGET PAGE: smaller inputs in tables ---- */
  .plan-input, .income-plan-input, .cat-plan-input { width: 65px !important; font-size: 11px !important; }

  /* ---- SETTINGS: toggle row inputs ---- */
  .toggle-row { flex-direction: column; gap: 8px; align-items: flex-start !important; }
  .toggle-row input[type="password"], .toggle-row input[type="number"] { width: 100% !important; }

  /* ---- FORM ROWS: labels and inputs full width ---- */
  .form-row > div { min-width: 0; }

  /* ---- TABLES: ensure tbl-wrap works ---- */
  .card .tbl { min-width: 500px; }
}

/* ==================== LOADING ==================== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
