:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-sub: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(15,23,42,0.08);
  --font-title: "Space Grotesk", "Manrope", system-ui, -apple-system, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; height:100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); min-height:100vh; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,0.12), transparent 36%),
    radial-gradient(circle at bottom right, rgba(124,58,237,0.12), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.auth-card {
  width: min(520px, 100%);
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(203,213,225,0.9);
  border-radius: 28px;
  box-shadow: 0 32px 82px rgba(15,23,42,0.16);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.auth-brand-stack {
  display: grid;
  gap: 6px;
}

.auth-copy h1 {
  margin: 8px 0 6px;
  font-family: var(--font-title);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 22px 0 18px;
  padding: 8px;
  background: #eef3fb;
  border-radius: 20px;
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.is-active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 10px 26px rgba(15,23,42,0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.auth-form input {
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 0 14px;
  font: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: rgba(79,70,229,0.5);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.14);
}

.auth-status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(203,213,225,0.9);
  background: #f8fafc;
  color: var(--muted);
  white-space: pre-line;
}

.auth-status.success {
  background: rgba(240,253,244,0.96);
  border-color: rgba(34,197,94,0.28);
  color: #166534;
}

.auth-status.error {
  background: rgba(254,242,242,0.96);
  border-color: rgba(239,68,68,0.28);
  color: #991b1b;
}

.app-shell { display:flex; min-height:100vh; }
.sidebar-toggle {
  position: relative;
  top: auto;
  left: auto;
  z-index: 2;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  border: 2px solid #1f2937;
  background: #ffffff;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 10px 24px rgba(15,23,42,0.1);
  cursor: pointer;
}
.sidebar-toggle span {
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: #1f2937;
  display: block;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.32);
  backdrop-filter: blur(2px);
  z-index: 45;
}
.sidebar {
  width: 270px;
  background:#ffffff;
  border-right:1px solid var(--border);
  padding:24px 18px 22px;
  display:flex;
  flex-direction:column;
  gap:24px;
  position:fixed;
  top:0;
  left:0;
  height:100vh;
  z-index:50;
  box-shadow: var(--shadow);
  transition: transform .24s ease, opacity .24s ease;
}
body.sidebar-collapsed .sidebar {
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}
body.sidebar-open .sidebar {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.brand { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.brand-mark { display:block; width:168px; max-width:100%; height:auto; object-fit:contain; }
.brand-name { font-weight:700; letter-spacing:0.2px; color:#0f172a; }
.brand-tag { color: var(--muted); font-size:13px; }
.nav { display:flex; flex-direction:column; gap:8px; }
.nav-item { background: transparent; color: var(--text); border:1px solid var(--border); border-radius: var(--radius-sm); padding:12px 14px; text-align:left; font-weight:600; cursor:pointer; transition: all .16s ease; }
.nav-item:hover { background:#e2e8f0; }
.nav-item.active { background: linear-gradient(135deg,#2563eb,#7c3aed); color:#fff; border-color: transparent; box-shadow: var(--shadow); }

main { flex:1; width: 100%; padding:24px 32px 40px; }
.topbar { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; margin-bottom: 14px; }
.topbar h1 { margin:6px 0 4px; font-family: var(--font-title); font-size:28px; letter-spacing:-0.02em; }
.eyebrow { text-transform:uppercase; color: var(--muted); letter-spacing:0.15em; font-size:11px; }
.subtitle { color: var(--muted); margin:0; }
.top-actions { display:flex; gap:10px; flex-wrap:wrap; }
.top-actions .pill {
  display: inline-flex;
  align-items: center;
}
.btn-icon {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-shortcut {
  color: #2563eb;
  border-color: rgba(147, 197, 253, 0.9);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(239,246,255,0.98) 100%);
}

.settings-shortcut:hover {
  color: #1d4ed8;
  border-color: rgba(96, 165, 250, 0.92);
}

.btn { border:1px solid transparent; border-radius: var(--radius-sm); padding:11px 15px; font:inherit; font-weight:700; line-height:1.2; cursor:pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg,#2563eb,#7c3aed); color:#fff; box-shadow: var(--shadow); }
.btn.ghost { background:#fff; color: var(--text); border-color: var(--border); }
.icon-btn { background: none; border:none; color: var(--text); font-size:18px; cursor:pointer; }
.icon-btn.edit { color: #2563eb; }
.icon-btn.edit:hover { color: #1d4ed8; }
.icon-btn.danger { color: #dc2626; }
.icon-btn.danger:hover { color: #b91c1c; }

.mobile-tabs { display:none; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.tab-btn { flex:1 1 calc(50% - 8px); border:1px solid var(--border); background:#fff; padding:10px 12px; border-radius: var(--radius-sm); font-weight:600; cursor:pointer; }
.tab-btn.active { background: linear-gradient(135deg,#2563eb,#7c3aed); color:#fff; border-color: transparent; box-shadow: var(--shadow); }

.screen { display:none; }
.screen.active { display:block; }

.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:14px; margin-bottom:18px; }
.card { background: var(--panel); border:1px solid var(--border); border-radius: var(--radius); padding:16px 18px; box-shadow: var(--shadow); }
.card-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.ocr-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn.subtle {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text);
}
.btn.subtle:hover {
  background: rgba(148, 163, 184, 0.14);
}
.btn.is-success {
  animation: btn-success-pulse 900ms ease;
}

@keyframes btn-success-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(34, 197, 94, 0);
  }
  35% {
    transform: scale(1.03);
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.16);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(34, 197, 94, 0);
  }
}
.card h3 { margin:0; font-family: var(--font-title); letter-spacing:-0.01em; }
.kpi { position:relative; overflow:hidden; }
.kpi::after { content:""; position:absolute; inset:0; background: linear-gradient(135deg,rgba(37,99,235,0.08),rgba(124,58,237,0.08)); pointer-events:none; }
.kpi-label { color: var(--muted); font-size:13px; }
.kpi-value { font-size:28px; font-weight:700; margin:6px 0; }
.kpi-trend { color: var(--muted); font-size:13px; }
#kpi-expenses,
#kpi-expenses-trend {
  color: #dc2626;
}
#kpi-income,
#kpi-income-trend {
  color: #16a34a;
}
.kpi-metric-positive { color: #16a34a !important; }
.kpi-metric-negative { color: #dc2626 !important; }
.kpi-metric-neutral { color: var(--muted) !important; }

.grid-2 { display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:14px; margin-bottom:18px; }
.chart-card {
  padding: 18px;
  height: 470px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.98) 100%);
  border: 1px solid rgba(191,219,254,0.45);
  box-shadow: 0 18px 46px rgba(148,163,184,0.18);
}
.chart-card canvas {
  display: block;
  width: 100% !important;
  height: 380px !important;
  max-height: 380px;
  filter: saturate(1.05);
}
.pill { padding:6px 10px; border-radius:999px; background: var(--panel-sub); color: var(--text); font-weight:600; font-size:12px; border:1px solid var(--border); }
.pill.success { color:#0f5132; background:#d1fae5; border-color:#a7f3d0; }
.pill.neutral { color: var(--muted); }

.insights-card ul { margin:0; padding:0; list-style:none; display:grid; gap:10px; }
.insight-row { background: var(--panel-sub); border:1px solid var(--border); padding:10px 12px; border-radius: var(--radius-sm); display:flex; justify-content:space-between; align-items:center; }
.insight-row strong { color:#0f172a; }
.badge { padding:4px 8px; border-radius:999px; font-size:12px; border:1px solid var(--border); background:#fff; }
.badge.warning { border-color:#f59e0b55; color:#b45309; }
.badge.danger { border-color:#ef444455; color:#b91c1c; }
.badge.success { border-color:#22c55e55; color:#15803d; }
.badge.neutral { color: var(--muted); }

.toolbar { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; margin-bottom:12px; }
.transactions-toolbar { justify-content: space-between; align-items: center; }
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-trigger-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
}
.filter-trigger-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: #5b74f2;
}
.filter-trigger-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15,23,42,0.36);
  backdrop-filter: blur(6px);
}
.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(203,213,225,0.9);
  border-radius: 24px;
  box-shadow: 0 26px 60px rgba(15,23,42,0.24);
  padding: 20px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.transaction-modal-card {
  width: min(860px, 100%);
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
}
.transaction-modal-title-wrap h3 {
  margin: 4px 0 6px;
  font-family: var(--font-title);
  font-size: 18px;
  letter-spacing: -0.01em;
}
.transaction-modal-title-wrap p {
  margin: 0;
  color: var(--muted);
}
.modal-form {
  display: grid;
  gap: 18px;
}
.form-grid {
  display: grid;
  gap: 14px;
}
.transaction-form-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
.transaction-form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  min-width: 0;
  position: relative;
}
.transaction-form-grid label:nth-child(1),
.transaction-form-grid label:nth-child(2),
.transaction-form-grid label:nth-child(3) {
  grid-column: span 4;
}
.transaction-form-grid label:nth-child(4),
.transaction-form-grid label:nth-child(5) {
  grid-column: span 6;
}
.transaction-form-grid label:nth-child(6),
.transaction-form-grid label:nth-child(7) {
  grid-column: span 6;
}
.transaction-form-grid label:has([name="payment"]),
.transaction-form-grid label:has([name="source"]) {
  display: none;
}
.transaction-form-grid label:nth-child(8),
.transaction-form-grid label:nth-child(9) {
  grid-column: span 6;
}
.transaction-form-grid label:nth-child(10) {
  grid-column: 1 / -1;
}
.transaction-form-grid textarea {
  min-height: 104px;
  resize: vertical;
}
.transaction-date-trigger {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15,23,42,0.05);
}
.transaction-date-trigger:focus-visible,
.transaction-date-trigger.is-open {
  outline: none;
  border-color: rgba(91,116,242,0.42);
  box-shadow: 0 14px 28px rgba(91,116,242,0.14);
}
.transaction-date-trigger-icon {
  color: #475569;
  font-size: 16px;
}
.transaction-date-picker {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 15;
  width: 320px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(203,213,225,0.9);
  background: rgba(255,255,255,0.98);
  box-shadow: 0 24px 48px rgba(15,23,42,0.18);
  display: grid;
  gap: 12px;
}
.transaction-date-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.transaction-date-picker-month {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--text);
}
.transaction-date-picker-nav {
  display: inline-flex;
  gap: 8px;
}
.transaction-date-picker-nav button,
.transaction-date-picker-footer button {
  border: 1px solid rgba(203,213,225,0.9);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
  font: inherit;
}
.transaction-date-picker-weekdays,
.transaction-date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.transaction-date-picker-weekdays span {
  text-align: center;
  font-size: 12px;
  color: #64748b;
  text-transform: lowercase;
}
.transaction-date-day {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.transaction-date-day.is-muted {
  color: #94a3b8;
}
.transaction-date-day.is-today {
  border-color: rgba(91,116,242,0.28);
  color: #2563eb;
}
.transaction-date-day.is-selected {
  background: linear-gradient(135deg,#2563eb,#7c3aed);
  color: #fff;
  box-shadow: 0 12px 24px rgba(91,116,242,0.24);
}
.transaction-date-picker-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.transaction-date-picker-footer button {
  padding: 0 12px;
}
.transaction-form-grid input,
.transaction-form-grid select,
.transaction-form-grid textarea {
  width: 100%;
  min-width: 0;
}
.transaction-modal-shortcuts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.transaction-shortcut-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  box-shadow: 0 10px 22px rgba(15,23,42,0.05);
}
.filter-modal-card {
  width: min(860px, 100%);
}
.budget-modal-card {
  width: min(980px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,255,0.98) 100%);
}
.ocr-modal-card {
  width: min(1320px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
}
.import-modal-card {
  width: min(980px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,255,0.98) 100%);
}
.import-modal-grid {
  grid-template-columns: 1.3fr 1fr 0.7fr 0.7fr;
  align-items: end;
}
.import-modal-grid label {
  min-height: 108px;
  box-shadow: 0 10px 24px rgba(15,23,42,0.05);
}
.import-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.import-preview-shell {
  margin-top: 16px;
  border: 1px solid rgba(203,213,225,0.9);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}
.import-preview-shell table {
  min-width: 860px;
}
.import-modal-card .status {
  margin-top: 14px;
  margin-left: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(203,213,225,0.82);
}
.budget-modal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.budget-modal-grid label {
  min-height: 108px;
}
.budget-color-field {
  min-height: 132px;
}
.budget-icon-field {
  grid-column: span 2;
}
.budget-card-title,
.budget-detail-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.budget-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--budget-accent, #5b74f2);
  color: #fff;
  line-height: 1;
}
.budget-card-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.budget-card-icon svg circle,
.budget-card-icon svg rect {
  fill: none;
}
.budget-color-library {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}
.budget-color-option {
  width: 100%;
  min-height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(203,213,225,0.85);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.budget-color-option:hover {
  transform: translateY(-1px);
}
.budget-color-option.is-active {
  border-color: rgba(15,23,42,0.92);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.88), 0 0 0 2px rgba(15,23,42,0.12);
}
.budget-icon-library {
  position: relative;
  --budget-picker-color: var(--accent, #2563eb);
}
.budget-icon-trigger {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(203,213,225,0.9);
  background: rgba(255,255,255,0.98);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.budget-icon-trigger-preview {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--budget-picker-color);
  color: #fff;
}
.budget-icon-trigger-preview svg,
.budget-icon-option svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.budget-icon-trigger-preview svg circle,
.budget-icon-trigger-preview svg rect,
.budget-icon-option svg circle,
.budget-icon-option svg rect {
  fill: none;
}
.budget-icon-trigger-caret {
  color: var(--muted);
  font-size: 14px;
}
.budget-icon-panel {
  position: static;
  display: grid;
  grid-template-columns: repeat(8, minmax(44px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding: 0;
  border-radius: 18px;
  border: none;
  background: transparent;
  box-shadow: none;
}
.budget-icon-option {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(203,213,225,0.9);
  background: color-mix(in srgb, var(--budget-picker-color) 72%, white 28%);
  color: #fff;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.budget-icon-option:hover {
  transform: translateY(-1px);
  border-color: rgba(91,116,242,0.35);
  background: color-mix(in srgb, var(--budget-picker-color) 84%, white 16%);
}
.budget-icon-option.is-active {
  border-color: rgba(91,116,242,0.5);
  background: var(--budget-picker-color);
  box-shadow: inset 0 0 0 1px rgba(91,116,242,0.18);
}
.filter-modal-title-wrap h3 {
  margin: 6px 0 4px;
}
.filter-modal-title-wrap p {
  margin: 0;
  color: var(--muted);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.filter-grid label {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(203,213,225,0.85);
  font-weight: 600;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.transaction-search-shell { display:inline-flex; align-items:center; gap:10px; min-width: min(100%, 360px); padding:0 14px; min-height:44px; border:1px solid var(--border); border-radius:999px; background:#fff; box-shadow: 0 10px 22px rgba(15,23,42,0.05); }
.transaction-search-shell:focus-within { border-color: rgba(91,116,242,0.4); box-shadow: 0 14px 28px rgba(91,116,242,0.12); }
.transaction-search-shell input { border:none; outline:none; padding:0; width:100%; background:transparent; }
.transaction-search-icon { width:22px; height:22px; display:inline-grid; place-items:center; color:#64748b; }
.transaction-search-icon svg { width:16px; height:16px; stroke: currentColor; fill:none; stroke-width:2; stroke-linecap:round; }
.input-group { display:flex; flex-direction:column; gap:6px; }
.input-group input, .filters select, textarea, input, select {
  background:#fff; border:1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding:10px 12px; font-family: var(--font-body);
}
.filters { display:flex; gap:8px; flex-wrap:wrap; }
.table-card { overflow:hidden; }
.table-responsive { overflow:auto; margin-top:10px; }
.table-responsive table { width:100%; border-collapse:collapse; min-width:760px; }
th, td { padding:10px 8px; border-bottom:1px solid var(--border); text-align:left; }
th { color: var(--muted); font-weight:700; font-size:13px; }
td { font-size:14px; }
.table-actions { display:flex; gap:6px; }
.row-pill { padding:4px 8px; border-radius:999px; font-size:12px; font-weight:700; }
.row-pill.type-depense { background:#fee2e2; color:#b91c1c; }
.row-pill.type-revenu { background:#dcfce7; color:#15803d; }
.badge.cat { background:#e0f2fe; border-color:#bfdbfe; color:#1d4ed8; white-space:nowrap; display:inline-flex; align-items:center; }
#transactions-table th:nth-child(5),
#transactions-table td:nth-child(5) { min-width: 150px; }

.budget-list { display:grid; gap:10px; margin-top:12px; }
.budget-row { background: var(--panel-sub); border:1px solid var(--border); border-radius: var(--radius-sm); padding:12px; display:flex; justify-content:space-between; align-items:center; }
.progress { height:8px; background: #e2e8f0; border-radius:999px; overflow:hidden; margin-top:8px; }
.progress span { display:block; height:100%; background: linear-gradient(90deg,#2563eb,#7c3aed); }

.budget-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
  align-items: stretch;
}
.budget-row {
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7ff 100%);
  border: 1px solid rgba(191,219,254,0.55);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  gap: 12px;
}
.budget-manager {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}
.budget-manager-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.budget-manager-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}
.budget-tile {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-items: stretch;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, var(--budget-soft, #f8fbff) 100%);
  border: 1px solid color-mix(in srgb, var(--budget-line, #cbd5e1) 55%, white 45%);
  box-shadow: 0 18px 40px rgba(148,163,184,0.14);
}
.budget-tile.selected {
  border-color: var(--budget-line, #94a3b8);
  box-shadow: 0 22px 48px rgba(91,116,242,0.18);
}
.budget-card-main {
  width: 100%;
  min-width: 0;
  justify-self: stretch;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.budget-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding-right: 82px;
}
.budget-card-head strong {
  font-size: 17px;
  line-height: 1.08;
}
.budget-subline {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.budget-card-amount {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: #0f172a;
  white-space: nowrap;
  padding-right: 82px;
}
.budget-card-total {
  font-weight: 900;
}
.budget-card-amount.is-under,
.budget-card-meta.is-under {
  color: #166534;
}
.budget-card-amount.is-near,
.budget-card-meta.is-near {
  color: #d97706;
}
.budget-card-amount.is-hit,
.budget-card-meta.is-hit {
  color: #2563eb;
}
.budget-card-amount.is-over,
.budget-card-meta.is-over {
  color: #dc2626;
}
.budget-card-meta {
  color: var(--muted);
  font-size: 13px;
  padding-right: 82px;
}
.budget-card-viz {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  align-self: stretch;
  height: 108px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--budget-line, #cbd5e1) 30%, white 70%);
  background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.52) 100%);
}
.budget-card-viz-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.budget-card-viz-area {
  fill: color-mix(in srgb, var(--budget-accent, #5b74f2) 18%, white 82%);
}
.budget-card-viz-line {
  fill: none;
  stroke: var(--budget-line, #5b74f2);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.budget-card-viz-dot {
  fill: var(--budget-line, #5b74f2);
  stroke: #fff;
  stroke-width: 3;
}
.budget-row-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  align-self: start;
}
.budget-edit-toggle,
.budget-delete-btn {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border-color: color-mix(in srgb, var(--budget-line, #cbd5e1) 22%, white 78%);
  background: rgba(255,255,255,0.7);
  color: rgba(15,23,42,0.72);
  box-shadow: none;
  font-size: 13px;
}
.btn.budget-edit-toggle {
  color: #2563eb;
}
.btn.budget-delete-btn {
  color: #dc2626;
}
.budget-edit-toggle:hover,
.budget-delete-btn:hover {
  background: rgba(255,255,255,0.9);
}
.btn.budget-edit-toggle:hover {
  color: #1d4ed8;
}
.btn.budget-delete-btn:hover {
  color: #b91c1c;
}
.budget-editor {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(203,213,225,0.8);
}
.budget-editor label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}
.budget-editor .btn {
  align-self: end;
}
.budget-detail {
  margin-top: 18px;
}
.budget-category-page {
  display: grid;
  gap: 18px;
}
.budget-category-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
}
.budget-category-title-wrap h2 {
  margin: 4px 0 0;
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.03em;
}
.budget-back-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-grid;
  place-items: center;
}
.budget-detail-hero {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid color-mix(in srgb, var(--budget-line, #cbd5e1) 42%, white 58%);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, var(--budget-soft, #f8fbff) 100%);
  box-shadow: 0 20px 50px rgba(148,163,184,0.14);
}
.budget-detail-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}
.budget-detail-title {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
}
.budget-detail-month {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
}
.budget-detail-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(203,213,225,0.8);
  font-weight: 700;
}
.budget-detail-amount {
  font-size: clamp(30px, 4vw, 54px);
  font-weight: 800;
  letter-spacing: -0.05em;
}
.budget-detail-caption {
  color: var(--muted);
  font-size: 15px;
}
.budget-detail-progress {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: rgba(226,232,240,0.9);
  overflow: hidden;
}
.budget-detail-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--budget-line, #5b74f2), color-mix(in srgb, var(--budget-line, #5b74f2) 55%, white 45%));
}
.budget-detail-progress em {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}
.budget-detail-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.budget-stat {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(203,213,225,0.8);
}
.budget-stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.budget-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  letter-spacing: -0.03em;
}
.budget-subcat-card,
.budget-unclassified-card {
  background: #fff;
  border: 1px solid rgba(203,213,225,0.8);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 36px rgba(148,163,184,0.1);
}
.budget-subcat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}
.budget-subcat-head h4 {
  margin: 0;
  font-size: 22px;
}
.budget-subcat-head span {
  color: var(--muted);
  font-size: 13px;
}
.budget-subcat-create {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.budget-subcat-input {
  flex: 1;
}
.budget-subcat-row,
.budget-unclassified-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid rgba(226,232,240,0.8);
}
.budget-subcat-row {
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
  border-radius: 18px;
  padding-left: 12px;
  padding-right: 12px;
}
.budget-subcat-row:hover {
  background: rgba(248,250,252,0.95);
}
.budget-subcat-row.is-selected {
  background: rgba(239,246,255,0.92);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.28);
}
.budget-subcat-row:first-of-type,
.budget-unclassified-row:first-of-type {
  border-top: none;
}
.budget-subcat-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.budget-subcat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.budget-subcat-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}
.budget-subcat-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.budget-subcat-amount,
.budget-unclassified-row span {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.budget-subcat-delete {
  min-height: 38px;
  padding: 0 14px;
  color: #dc2626;
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: 999px;
  background: rgba(254,242,242,0.9);
  font-weight: 700;
}
.budget-subcat-delete:hover {
  color: #b91c1c;
  border-color: rgba(239,68,68,0.35);
  background: rgba(254,226,226,1);
}
.budget-subcat-empty {
  padding: 18px 0 4px;
  color: var(--muted);
}
.budget-unclassified-row {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ocr-layout {
  align-items: start;
  grid-template-columns: minmax(400px, 0.9fr) minmax(460px, 1.1fr);
}
.image-preview {
  margin-top: 10px;
  max-height: 860px;
  overflow: auto;
  border-radius: 18px;
}
.image-preview img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 0;
}
.ocr-table {
  overflow-x: hidden;
}
.ocr-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.ocr-table th,
.ocr-table td {
  padding: 10px 6px;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ocr-table th:nth-child(1),
.ocr-table td:nth-child(1) {
  width: 9%;
}
.ocr-table th:nth-child(2),
.ocr-table td:nth-child(2) {
  width: 10%;
}
.ocr-table th:nth-child(3),
.ocr-table td:nth-child(3) {
  width: 13%;
}
.ocr-table th:nth-child(4),
.ocr-table td:nth-child(4) {
  width: 13%;
}
.ocr-table th:nth-child(5),
.ocr-table td:nth-child(5) {
  width: 15%;
}
.ocr-table th:nth-child(6),
.ocr-table td:nth-child(6) {
  width: 22%;
}
.ocr-table th:nth-child(7),
.ocr-table td:nth-child(7) {
  width: 8%;
}
.ocr-table th:nth-child(8),
.ocr-table td:nth-child(8) {
  width: 10%;
}
.ocr-table select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
}
.ocr-cell-action input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.status { color: var(--muted); margin-left:10px; }
.dashboard-month-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.dashboard-month-card {
  margin: 0;
  padding: 6px 16px;
  width: 100%;
}
.budget-month-card {
  margin-bottom: 18px;
}
.dashboard-month-switcher {
  justify-content: space-between;
}
.dashboard-month-trigger {
  flex: 1;
  text-align: center;
}
.dashboard-month-trigger strong {
  font-size: clamp(1.4rem, 2.2vw, 2.2rem);
}
.analysis-layout {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.analysis-toolbar-card {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
}

.analysis-month-switcher {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 14px;
}

.analysis-month-nav {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 26px;
  line-height: 1;
}

.analysis-month-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: default;
}

.analysis-month-trigger strong {
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.03em;
}


.analysis-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.analysis-mode-btn {
  border: none;
  background: transparent;
  color: #64748b;
  padding: 12px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}

.analysis-mode-btn.is-active {
  background: linear-gradient(135deg,#5b74f2,#6d4df2);
  color: #fff;
  box-shadow: 0 12px 24px rgba(91,116,242,0.18);
}

.analysis-card,
.analysis-budget-card,
.analysis-categories-card {
  overflow: hidden;
}

.analysis-card-head {
  align-items: flex-start;
}

.analysis-chart-shell {
  display: grid;
  place-items: center;
  padding: 8px 0 4px;
}

.analysis-chart-wrap {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto;
}

.analysis-chart-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 8px;
  text-align: center;
  pointer-events: none;
}

.analysis-chart-center strong {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.analysis-chart-center span {
  color: var(--muted);
  font-size: 14px;
}

.analysis-budget-head,
.analysis-budget-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
}

.analysis-budget-amount {
  font-size: clamp(20px, 2.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: right;
}

.analysis-budget-progress {
  margin: 18px 0 10px;
  height: 14px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.analysis-budget-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
}

.analysis-budget-meta {
  align-items: center;
}

.analysis-budget-meta span {
  color: var(--muted);
}

.analysis-budget-meta strong {
  color: #5b5cf0;
  font-size: 28px;
}

.analysis-category-list,
.analysis-transaction-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}


.analysis-category-item,
.analysis-transaction-row {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.analysis-category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

.analysis-category-item:hover,
.analysis-category-item.is-active {
  transform: translateY(-1px);
  border-color: rgba(91,116,242,0.35);
  box-shadow: 0 18px 32px rgba(91,116,242,0.12);
  background: linear-gradient(180deg, rgba(91,116,242,0.06), rgba(255,255,255,0.98));
}

.analysis-category-main,
.analysis-transaction-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.analysis-category-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
}

.analysis-category-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.analysis-category-icon svg circle,
.analysis-category-icon svg rect {
  fill: none;
}

.settings-tools-card,
#settings-ocr-card,
.settings-panel .card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,255,0.98) 100%);
  border: 1px solid rgba(191,219,254,0.5);
  box-shadow: 0 18px 40px rgba(148,163,184,0.16);
}

.settings-tools-card {
  padding: 20px 22px;
}

.settings-tools-copy {
  margin: 10px 0 0;
  color: #51627d;
  font-size: 16px;
  max-width: 720px;
  line-height: 1.5;
}

.settings-tools-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.account-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(203,213,225,0.9);
  background: rgba(255,255,255,0.9);
}

.account-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  font-weight: 800;
}

.account-label {
  color: #64748b;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.account-scope-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.account-scope-switch .btn.is-active {
  background: linear-gradient(135deg,#2563eb,#7c3aed);
  color: #fff;
  border-color: transparent;
}

.account-scope-switch .btn.hidden {
  display: none;
}

.account-password-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.account-password-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.account-password-form .btn {
  align-self: end;
  justify-self: start;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 14px;
  width: auto;
  min-width: 168px;
}

.account-delete-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 14px;
  margin-top: 16px;
  align-items: end;
}

.account-delete-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.account-danger-card {
  border: 1px solid rgba(248,113,113,0.22);
  background: linear-gradient(180deg, rgba(255,250,250,0.98), rgba(255,244,246,0.94));
}

.account-danger-copy {
  color: #8f2f49;
}

.account-danger-btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(248,113,113,0.26);
  background: rgba(255,235,238,0.96);
  color: #b42346;
  font-weight: 800;
}

.account-danger-btn:hover {
  border-color: rgba(239,68,68,0.34);
  background: rgba(254,226,226,0.98);
}

.settings-tools-actions .btn {
  min-height: 44px;
  border-radius: 14px;
  padding: 0 16px;
}

#settings-ocr-card {
  padding: 18px;
}

#settings-ocr-card > .card-head {
  margin-bottom: 12px;
}

.app-toast {
  position: fixed;
  right: 28px;
  bottom: 108px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.96), rgba(34, 197, 94, 0.96));
  color: #fff;
  box-shadow: 0 22px 50px rgba(22, 163, 74, 0.28);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms ease;
  z-index: 1200;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast::before {
  content: "\2713";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 800;
  animation: toast-pop 420ms ease;
}

@keyframes toast-pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

#settings-ocr-card .ocr-layout > .card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(203,213,225,0.85);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 14px 32px rgba(148,163,184,0.12);
}

#settings-ocr-card textarea {
  min-height: 200px;
}

#settings-ocr-card .ocr-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

#settings-ocr-card .ocr-actions .btn {
  min-height: 46px;
  border-radius: 14px;
}

.settings-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  margin: 8px 0 2px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(241,245,249,0.98) 100%);
  border: 1px solid rgba(203,213,225,0.9);
  box-shadow: 0 12px 28px rgba(148,163,184,0.14);
}

.settings-tab {
  border: none;
  background: transparent;
  border-radius: 14px;
  min-height: 42px;
  padding: 0 16px;
}

.settings-tab.active {
  background: linear-gradient(135deg,#2563eb,#7c3aed);
  color: #fff;
  box-shadow: 0 12px 22px rgba(91,116,242,0.18);
}

.settings-panel {
  margin-top: 14px;
}

.settings-cloud-card {
  margin-top: 14px;
}

.settings-cloud-status {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15,23,42,0.04);
  border: 1px solid rgba(203,213,225,0.85);
  color: #334155;
  white-space: pre-wrap;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.admin-metric-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  border: 1px solid rgba(203,213,225,0.88);
  box-shadow: 0 14px 30px rgba(148,163,184,0.12);
  display: grid;
  gap: 6px;
}

.admin-metric-card span,
.admin-metric-card small {
  color: var(--muted);
}

.admin-metric-card strong {
  font-size: 34px;
  line-height: 1;
  color: var(--text);
}

.admin-health-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.admin-health-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.84);
  border: 1px solid rgba(203,213,225,0.82);
}

.admin-health-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.admin-health-copy span {
  color: var(--muted);
  font-size: 14px;
}

.admin-health-badge {
  flex: 0 0 auto;
  min-width: 96px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(203,213,225,0.82);
  font-weight: 700;
  background: rgba(255,255,255,0.92);
}

.admin-health-badge.success {
  color: #15803d;
  border-color: rgba(74,222,128,0.55);
  background: rgba(220,252,231,0.9);
}

.admin-health-badge.warning {
  color: #b45309;
  border-color: rgba(251,191,36,0.55);
  background: rgba(254,243,199,0.92);
}

.admin-health-badge.danger {
  color: #b91c1c;
  border-color: rgba(248,113,113,0.5);
  background: rgba(254,226,226,0.92);
}

.admin-health-badge.info {
  color: #1d4ed8;
  border-color: rgba(96,165,250,0.48);
  background: rgba(219,234,254,0.92);
}

.admin-health-debug {
  margin-top: 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(203,213,225,0.72);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.admin-table td code {
  display: inline-block;
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.admin-user-row.is-revoked {
  background: rgba(254,242,242,0.72);
}

.admin-actions {
  min-width: 120px;
}

.admin-inline-note {
  color: var(--muted);
  font-size: 13px;
}

.admin-panel-empty {
  color: var(--muted);
  text-align: center;
  padding: 18px 12px !important;
}

.balance-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1.2fr;
  gap: 14px;
  margin-top: 16px;
}

.balance-grid label {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  border: 1px solid rgba(203,213,225,0.85);
  color: var(--muted);
  font-weight: 600;
}

.balance-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.balance-actions .btn {
  min-height: 44px;
  border-radius: 14px;
  padding: 0 16px;
}

#balance-summary {
  margin-top: 16px;
  margin-left: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(203,213,225,0.82);
}

.analysis-category-text,
.analysis-transaction-text {
  min-width: 0;
}

.analysis-category-text strong,
.analysis-transaction-text strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.analysis-category-text span,
.analysis-transaction-text span,
.analysis-category-submeta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.analysis-category-side,
.analysis-transaction-side {
  text-align: right;
  flex: 0 0 auto;
}

.analysis-category-side strong,
.analysis-transaction-side strong {
  display: block;
  font-size: 18px;
}

.analysis-category-side span,
.analysis-transaction-side span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.analysis-transaction-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
}

.analysis-transaction-row:hover {
  border-color: rgba(37,99,235,0.24);
  box-shadow: 0 14px 28px rgba(15,23,42,0.08);
}

.analysis-transaction-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  flex: 0 0 auto;
}

.analysis-empty {
  margin-top: 16px;
  color: var(--muted);
  padding: 18px;
  border-radius: 16px;
  background: var(--panel-sub);
  border: 1px dashed var(--border);
}

.analysis-detail-page {
  display: grid;
  gap: 16px;
}

.analysis-detail-topbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.analysis-back-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.analysis-detail-card {
  display: grid;
  gap: 16px;
}

.analysis-detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.analysis-detail-copy strong {
  display: block;
  font-size: 32px;
  letter-spacing: -0.03em;
}

.analysis-detail-copy span {
  color: var(--muted);
}

.hidden { display:none !important; }

/* Bottom navigation preview */
.sidebar,
.sidebar-toggle,
.sidebar-backdrop {
  display: none !important;
}

.app-shell {
  display: block;
}

main {
  width: 100%;
  padding: 24px 32px 110px;
}

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  margin: 0;
  padding: 12px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(226,232,240,0.95);
  border-radius: 26px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.14);
  backdrop-filter: blur(14px);
}

.tab-btn {
  min-width: 0;
  padding: 12px 8px;
  border-radius: 18px;
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
}

.tab-btn.active {
  background: linear-gradient(135deg,#4f46e5,#7c3aed);
}

.dashboard-month-row {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-month-row .sidebar-toggle {
  display: none !important;
}

.mobile-companion {
  display: none;
  min-height: 100vh;
  padding: 12px 10px 28px;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.98), rgba(244,246,252,0.98) 52%, rgba(237,241,248,1) 100%);
}

.mobile-companion-shell {
  width: 100%;
  max-width: 393px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding-bottom: 110px;
}

.mobile-companion-topbar,
.mobile-card-head,
.mobile-sheet-head,
.mobile-search-row,
.mobile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-companion-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.mobile-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  justify-self: end;
}

.mobile-circle-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(203,213,225,0.95);
  background: rgba(255,255,255,0.95);
  color: #0f172a;
  font-size: 20px;
  box-shadow: 0 10px 26px rgba(15,23,42,0.08);
  flex: 0 0 auto;
}

.mobile-circle-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-circle-btn.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border-color: transparent;
}

.mobile-circle-btn-settings {
  color: #2563eb;
  border-color: rgba(147,197,253,0.34);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(239,246,255,0.98) 100%);
}

.mobile-circle-btn-settings:hover {
  color: #1d4ed8;
  border-color: rgba(96,165,250,0.38);
}

.mobile-circle-btn-danger {
  color: #dc2626;
  border-color: rgba(248,113,113,0.3);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(254,242,242,0.98) 100%);
  box-shadow: 0 10px 24px rgba(220,38,38,0.12);
}

.mobile-circle-btn-danger:hover {
  color: #b91c1c;
  border-color: rgba(239,68,68,0.35);
  background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(254,226,226,1) 100%);
}

.mobile-companion-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(226,232,240,0.95);
  box-shadow: 0 10px 24px rgba(15,23,42,0.06);
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-companion-profile strong {
  font-size: 14px;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-companion-profile-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #fb7185);
}

.mobile-range-switch,
.mobile-type-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(226,232,240,0.75);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.mobile-range-btn,
.mobile-type-btn {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  font-size: 14px;
}

.mobile-range-btn.is-active,
.mobile-type-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
}

.mobile-hero-card,
.mobile-insight-card,
.mobile-transactions-panel,
.mobile-sheet-card {
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(226,232,240,0.95);
  border-radius: 28px;
  box-shadow: 0 22px 42px rgba(148,163,184,0.16);
}

.mobile-hero-card {
  padding: 4px 2px 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mobile-hero-copy {
  display: grid;
  gap: 4px;
}

.mobile-section-label {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  text-transform: lowercase;
}

.mobile-hero-copy strong {
  font-size: clamp(42px, 10vw, 56px);
  line-height: 1;
  letter-spacing: -0.05em;
  font-family: var(--font-title);
}

.mobile-summary-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mobile-summary-card {
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(226,232,240,0.95);
  background: rgba(255,255,255,0.92);
  display: grid;
  gap: 8px;
}

.mobile-summary-card span {
  font-size: 14px;
  font-weight: 700;
}

.mobile-summary-card strong {
  font-size: 18px;
}

.mobile-summary-card.expense span,
.mobile-summary-card.expense strong {
  color: #57b894;
}

.mobile-summary-card.income span,
.mobile-summary-card.income strong {
  color: #8b909a;
}

.mobile-insight-card {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.mobile-insight-kicker {
  font-size: 14px;
  font-weight: 800;
}

.mobile-insight-kicker.success {
  color: #57b894;
}

.mobile-insight-kicker.trend {
  color: #4fbf8b;
}

.mobile-chevron-btn,
.mobile-link-btn {
  border: 0;
  background: transparent;
  color: #57b894;
  font-weight: 800;
}

.mobile-insight-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-family: var(--font-title);
}

.mobile-budget-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mobile-budget-stats strong {
  font-size: 24px;
}

.mobile-budget-stats span {
  color: #94a3b8;
  font-weight: 700;
}

.mobile-progress {
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(226,232,240,0.85);
}

.mobile-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, #57b894, #7c3aed);
  transition: width .2s ease;
}

.mobile-trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 10px;
  border-top: 1px dashed rgba(203,213,225,0.95);
}

.mobile-trend-grid span {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 700;
}

.mobile-trend-grid strong {
  font-size: 18px;
}

.mobile-transactions-panel {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(calc(100% - 20px), 393px);
  height: 86px;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  border-radius: 28px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(226,232,240,0.95);
  box-shadow: 0 24px 52px rgba(15,23,42,0.16);
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: height .28s ease, bottom .28s ease, border-radius .28s ease, box-shadow .28s ease, width .28s ease;
  z-index: 90;
}

.mobile-transactions-panel.is-open {
  bottom: 0;
  width: min(calc(100% - 4px), 393px);
  height: calc(100vh - 8px);
  border-radius: 34px 34px 0 0;
  box-shadow: 0 34px 78px rgba(15,23,42,0.24);
}

@media (max-width: 420px) {
  .mobile-companion {
    padding: 10px 8px 24px;
  }

  .mobile-companion-shell {
    max-width: 100%;
    gap: 12px;
    padding-bottom: 104px;
  }

  .mobile-companion-topbar {
    gap: 4px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .mobile-circle-btn {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  .mobile-circle-btn svg {
    width: 16px;
    height: 16px;
  }

  .mobile-companion-profile {
    padding: 0 10px;
    min-height: 38px;
    gap: 6px;
  }

  .mobile-companion-profile strong {
    font-size: 12px;
  }

  .mobile-companion-profile-dot {
    width: 8px;
    height: 8px;
  }

  .mobile-topbar-actions {
    gap: 4px;
  }

  .mobile-range-switch,
  .mobile-type-switch {
    gap: 4px;
    padding: 4px;
  }

  .mobile-range-btn,
  .mobile-type-btn {
    min-height: 36px;
    font-size: 13px;
  }

  .mobile-summary-cards,
  .mobile-trend-grid {
    gap: 10px;
  }

  .mobile-summary-card,
  .mobile-insight-card {
    padding: 16px;
  }

  .mobile-insight-title {
    font-size: 22px;
  }

  .mobile-transactions-panel {
    width: calc(100% - 16px);
    bottom: 10px;
    padding: 10px;
  }

  .mobile-transactions-panel.is-open {
    width: calc(100% - 2px);
    height: calc(100vh - 2px);
    border-radius: 26px 26px 0 0;
  }

  .mobile-search-shell {
    min-height: 50px;
    padding: 0 14px;
    font-size: 15px;
  }

  .mobile-add-btn {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }
}

@media (max-width: 390px) {
  .mobile-companion {
    padding: 8px 6px 22px;
  }

  .mobile-companion-topbar {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .mobile-circle-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .mobile-companion-profile {
    padding: 0 9px;
    min-height: 36px;
  }

  .mobile-companion-profile strong {
    font-size: 11px;
  }

  .mobile-range-btn,
  .mobile-type-btn {
    font-size: 12px;
  }

  .mobile-insight-title {
    font-size: 20px;
  }

  .mobile-hero-copy strong {
    font-size: clamp(38px, 11vw, 48px);
  }

  .mobile-summary-card strong,
  .mobile-trend-grid strong {
    font-size: 16px;
  }

  .mobile-transactions-panel {
    width: calc(100% - 12px);
    padding: 8px;
  }
}

.mobile-search-shell {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(241,245,249,0.95);
  border: 1px solid rgba(226,232,240,0.95);
  color: #64748b;
  font-size: 16px;
  font-weight: 700;
}

.mobile-transactions-panel.is-open .mobile-search-shell {
  min-height: 58px;
  border-radius: 20px;
}

.mobile-search-icon {
  font-size: 16px;
  color: #94a3b8;
}

.mobile-launcher-arrow {
  margin-left: auto;
  color: #94a3b8;
  transition: transform .18s ease;
}

.mobile-transactions-panel.is-open .mobile-launcher-arrow {
  transform: rotate(180deg);
}

.mobile-add-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #57b894, #6ad5a5);
  color: #fff;
  font-size: 30px;
  box-shadow: 0 16px 26px rgba(87,184,148,0.3);
}

.mobile-transaction-list {
  display: grid;
  gap: 12px;
  align-content: start;
  max-height: 100%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.mobile-transactions-panel.is-open .mobile-transaction-list {
  opacity: 1;
  overflow: auto;
  pointer-events: auto;
  padding: 4px 2px 12px;
}

.mobile-transaction-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  border-radius: 22px;
  background: rgba(248,250,252,0.92);
  border: 1px solid rgba(226,232,240,0.95);
}

.mobile-transaction-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-transaction-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.mobile-transaction-icon .budget-card-icon {
  width: 22px;
  height: 22px;
}

.mobile-transaction-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.mobile-transaction-text strong,
.mobile-category-name {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-transaction-text span,
.mobile-transaction-side span {
  color: #94a3b8;
  font-size: 13px;
}

.mobile-transaction-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.mobile-transaction-side strong.expense {
  color: #ef4444;
}

.mobile-transaction-side strong.income {
  color: #16a34a;
}

.mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  align-items: end;
}

.mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.32);
  backdrop-filter: blur(10px);
}

.mobile-sheet-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  max-height: min(92vh, 920px);
  margin: 0 auto;
  overflow: auto;
  padding: 14px 16px 22px;
  background: linear-gradient(180deg, rgba(248,250,252,0.98) 0%, rgba(240,244,249,0.98) 100%);
  border-radius: 34px 34px 0 0;
  box-shadow: 0 -18px 44px rgba(15,23,42,0.22);
  align-self: end;
}

.mobile-sheet-dialog.entry {
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 14px 34px;
  background: linear-gradient(180deg, rgba(244,247,252,0.99) 0%, rgba(239,243,248,0.99) 100%);
  border-radius: 36px 36px 0 0;
}

.mobile-sheet-entry-top {
  width: 100%;
  height: 10px;
  margin: -4px 0 12px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 8px 4px, rgba(203,213,225,0.92) 3px, transparent 3.5px) repeat-x;
  background-size: 18px 10px;
}

.mobile-sheet-dialog.categories {
  padding-bottom: 26px;
}

.mobile-sheet-dialog.budget {
  width: min(100%, 430px);
  min-height: auto;
  max-height: min(92vh, 860px);
  padding: 14px 16px 26px;
  background: linear-gradient(180deg, rgba(248,250,252,0.98) 0%, rgba(240,244,249,0.98) 100%);
  border-radius: 34px 34px 0 0;
  box-shadow: 0 -18px 44px rgba(15,23,42,0.22);
}

.mobile-sheet-dialog.settings {
  width: min(100%, 430px);
  min-height: auto;
  max-height: min(92vh, 860px);
  padding: 14px 16px 26px;
  background: linear-gradient(180deg, rgba(248,250,252,0.98) 0%, rgba(240,244,249,0.98) 100%);
  border-radius: 34px 34px 0 0;
  box-shadow: 0 -18px 44px rgba(15,23,42,0.22);
}

.mobile-settings-head-spacer {
  width: 48px;
  height: 48px;
}

.mobile-settings-account-card {
  margin-bottom: 12px;
}

.mobile-settings-scope-label {
  display: block;
  margin-bottom: 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.mobile-account-scope-switch {
  margin-top: 0;
}

.mobile-account-password-form {
  display: grid;
  gap: 12px;
}

.mobile-account-password-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.mobile-account-password-form .btn {
  width: auto;
  min-width: 160px;
  justify-self: start;
}

.mobile-account-delete-form {
  display: grid;
  gap: 12px;
}

.mobile-account-delete-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.mobile-budget-copy {
  margin: -2px 2px 14px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
}

.mobile-budget-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.mobile-section-head.compact {
  margin-bottom: 10px;
}

.mobile-budget-color-library {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.mobile-budget-icon-library .budget-icon-panel {
  grid-template-columns: repeat(5, minmax(44px, 1fr));
}

.mobile-sheet-dialog.detail {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 40px;
  background: linear-gradient(180deg, rgba(243,246,252,0.98) 0%, rgba(237,242,248,0.98) 100%);
  border-radius: 0;
  box-shadow: none;
  border: 0;
  padding-bottom: 32px;
  align-self: start;
  margin-top: 0;
}

.mobile-sheet-dialog.detail .mobile-sheet-handle {
  display: none;
}

.mobile-sheet-handle {
  width: 72px;
  height: 6px;
  border-radius: 999px;
  margin: 2px auto 12px;
  background: rgba(203,213,225,0.95);
}

.mobile-sheet-head {
  margin-bottom: 14px;
}

.mobile-entry-head {
  margin-bottom: 18px;
}

.mobile-sheet-head strong {
  font-family: var(--font-title);
  font-size: 22px;
  letter-spacing: -0.03em;
}

.mobile-sheet-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-detail-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 6px;
}

.mobile-detail-head > strong {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-title);
  font-size: 24px;
  letter-spacing: -0.05em;
  text-align: left;
}

.mobile-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.mobile-detail-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(226,232,240,0.95);
  border-radius: 26px;
  padding: 10px 16px;
  box-shadow: 0 16px 34px rgba(148,163,184,0.12);
}

.mobile-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.mobile-detail-row + .mobile-detail-row {
  border-top: 1px dashed rgba(203,213,225,0.95);
}

.mobile-detail-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.mobile-detail-icon .budget-card-icon {
  width: 20px;
  height: 20px;
}

.mobile-detail-inline-icon {
  width: 22px;
  text-align: center;
  color: #0f172a;
  font-size: 18px;
  flex: 0 0 auto;
}

.mobile-detail-section-title {
  margin: 24px 4px 10px;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.mobile-sheet-card {
  padding: 16px 18px;
  border-radius: 30px;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 14px 30px rgba(148,163,184,0.14);
}

.mobile-sheet-field {
  display: grid;
  gap: 10px;
}

.mobile-sheet-field > span,
.mobile-section-head strong {
  font-size: 16px;
  font-weight: 800;
}

.mobile-amount-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px;
  border-radius: 22px;
  border: 1px dashed rgba(203,213,225,0.95);
  background: rgba(255,255,255,0.88);
}

.mobile-amount-input input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  outline: none;
}

.mobile-amount-input strong {
  font-size: 24px;
  color: #94a3b8;
}

.mobile-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 2px;
  border-top: 1px dashed rgba(203,213,225,0.95);
}

.mobile-inline-row:first-child {
  border-top: 0;
}

.mobile-row-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: #0f172a;
}

.mobile-row-icon {
  width: 22px;
  text-align: center;
  color: #111827;
  font-size: 18px;
  flex: 0 0 auto;
}

.mobile-inline-row span {
  color: #0f172a;
  font-weight: 700;
}

.mobile-inline-row select,
.mobile-inline-row input[type="text"] {
  width: 100%;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 16px;
  outline: none;
}

.mobile-row-side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.mobile-date-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
}

.mobile-date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.mobile-date-icon {
  color: #0f172a;
  font-size: 18px;
}

.mobile-date-picker {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 16;
  width: min(320px, calc(100vw - 52px));
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(203,213,225,0.94);
  background: rgba(255,255,255,0.98);
  box-shadow: 0 24px 48px rgba(15,23,42,0.18);
  display: grid;
  gap: 12px;
}

.mobile-date-picker .transaction-date-picker-head,
.mobile-date-picker .transaction-date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-date-picker .transaction-date-picker-month {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--text);
}

.mobile-date-picker .transaction-date-picker-nav {
  display: inline-flex;
  gap: 8px;
}

.mobile-date-picker .transaction-date-picker-nav button,
.mobile-date-picker .transaction-date-picker-footer button {
  border: 1px solid rgba(203,213,225,0.9);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
  font: inherit;
}

.mobile-date-picker .transaction-date-picker-weekdays,
.mobile-date-picker .transaction-date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.mobile-date-picker .transaction-date-picker-weekdays span {
  text-align: center;
  font-size: 12px;
  color: #64748b;
  text-transform: lowercase;
}

.mobile-date-picker .transaction-date-day {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.mobile-date-picker .transaction-date-day.is-muted {
  color: #94a3b8;
}

.mobile-date-picker .transaction-date-day.is-today {
  border-color: rgba(91,116,242,0.28);
  color: #2563eb;
}

.mobile-date-picker .transaction-date-day.is-selected {
  background: linear-gradient(135deg,#2563eb,#7c3aed);
  color: #fff;
  box-shadow: 0 12px 24px rgba(91,116,242,0.24);
}

.mobile-date-picker .transaction-date-picker-footer button {
  padding: 0 12px;
}

.mobile-mini-pill {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(241,245,249,0.95);
  color: #475569;
  font-weight: 700;
  font-size: 14px;
}

.mobile-inline-value {
  color: #64748b;
  font-weight: 700;
}

.mobile-inline-row input,
.mobile-inline-row textarea {
  width: 58%;
  border: 0;
  background: transparent;
  font-size: 16px;
  text-align: right;
  outline: none;
  color: #475569;
}

.mobile-inline-row.stacked {
  display: grid;
  align-items: start;
  min-height: 0;
  gap: 10px;
  padding: 14px 2px 0;
}

.mobile-inline-row.stacked input,
.mobile-inline-row.stacked textarea {
  width: 100%;
  text-align: left;
  min-height: 24px;
}

.mobile-section-head {
  margin-top: 4px;
  margin-bottom: 4px;
  align-items: baseline;
}

.mobile-category-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mobile-category-chips::-webkit-scrollbar {
  display: none;
}

.mobile-category-chip {
  flex: 0 0 auto;
  min-width: 132px;
  max-width: 170px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 20px;
  border: 2px solid rgba(191,219,254,0.34);
  background: rgba(255,255,255,0.98);
  color: #475569;
  scroll-snap-align: start;
}

.mobile-category-chip.is-active {
  border-color: currentColor;
  box-shadow: 0 10px 22px rgba(15,23,42,0.08);
  background: rgba(255,255,255,1);
}

.mobile-category-chip .mobile-chip-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.mobile-category-chip .budget-card-icon,
.mobile-category-item .budget-card-icon {
  width: 20px;
  height: 20px;
}

.mobile-category-chip span:last-child {
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.mobile-action-row {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-top: 1px dashed rgba(203,213,225,0.95);
  background: transparent;
  color: #0f172a;
  font-weight: 700;
}

.mobile-action-row:first-child {
  border-top: 0;
}

.mobile-action-hint {
  margin-top: 10px;
  color: #57b894;
  font-size: 13px;
  font-weight: 700;
}

.mobile-sheet-footnote {
  margin: 10px 4px 0;
  color: #94a3b8;
  font-size: 13px;
}

.mobile-category-list {
  display: grid;
  gap: 10px;
}

.mobile-category-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(226,232,240,0.95);
  background: rgba(255,255,255,0.96);
  text-align: left;
}

.mobile-category-item-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}

.mobile-category-item-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mobile-category-item-meta span {
  color: #94a3b8;
  font-size: 13px;
}

body.mobile-companion-mode {
  background: #edf2f8;
}

body.mobile-companion-mode .app-shell {
  display: none;
}

body.mobile-companion-mode .mobile-companion {
  display: block;
}

@media (max-width: 980px) {
  .settings-switch {
    display: grid;
    width: 100%;
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .balance-grid {
    grid-template-columns: 1fr;
  }

  .ocr-layout {
    grid-template-columns: 1fr;
  }

  .image-preview {
    max-height: 520px;
  }

  .import-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transaction-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transaction-form-grid label:nth-child(1),
  .transaction-form-grid label:nth-child(2),
  .transaction-form-grid label:nth-child(3),
  .transaction-form-grid label:nth-child(4),
  .transaction-form-grid label:nth-child(5),
  .transaction-form-grid label:nth-child(6),
  .transaction-form-grid label:nth-child(7),
  .transaction-form-grid label:nth-child(8),
  .transaction-form-grid label:nth-child(9),
  .transaction-form-grid label:nth-child(10) {
    grid-column: span 2;
  }

  main {
    padding: 18px 18px 104px;
  }

  .mobile-tabs {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 8px;
    padding: 10px;
  }

  .tab-btn {
    padding: 10px 4px;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-card {
    padding: 20px;
    border-radius: 22px;
  }

  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .mobile-companion {
    padding: 14px 12px 28px;
  }

  .mobile-companion-shell,
  .mobile-sheet-dialog {
    width: 100%;
  }

  .mobile-hero-copy strong {
    font-size: 44px;
  }

  .mobile-transactions-panel {
    width: calc(100% - 24px);
    bottom: 12px;
  }

  .mobile-transactions-panel.is-open {
    width: calc(100% - 4px);
    height: calc(100vh - 4px);
    border-radius: 28px 28px 0 0;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-health-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-health-badge {
    min-width: 0;
  }

  .admin-table td code {
    max-width: 220px;
  }

  .ocr-modal-card {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    padding: 14px;
    border-radius: 22px;
  }

  .ocr-layout > .card,
  #settings-ocr-card .ocr-layout > .card {
    padding: 14px;
    border-radius: 18px;
  }

  .ocr-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }

  .ocr-head-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .image-preview {
    max-height: 340px;
    border-radius: 16px;
  }

  .ocr-table {
    overflow: visible;
  }

  .ocr-table table,
  .ocr-table thead,
  .ocr-table tbody,
  .ocr-table tr,
  .ocr-table th,
  .ocr-table td {
    display: block;
    width: 100%;
  }

  .ocr-table thead {
    display: none;
  }

  .ocr-table th:nth-child(1),
  .ocr-table td:nth-child(1),
  .ocr-table th:nth-child(2),
  .ocr-table td:nth-child(2),
  .ocr-table th:nth-child(3),
  .ocr-table td:nth-child(3),
  .ocr-table th:nth-child(4),
  .ocr-table td:nth-child(4),
  .ocr-table th:nth-child(5),
  .ocr-table td:nth-child(5),
  .ocr-table th:nth-child(6),
  .ocr-table td:nth-child(6),
  .ocr-table th:nth-child(7),
  .ocr-table td:nth-child(7),
  .ocr-table th:nth-child(8),
  .ocr-table td:nth-child(8) {
    width: auto !important;
  }

  .ocr-table tbody {
    display: grid;
    gap: 12px;
  }

  .ocr-table tr {
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  }

  .ocr-table td {
    padding: 0;
    border: 0;
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    word-break: normal;
    overflow-wrap: normal;
  }

  .ocr-table td + td {
    margin-top: 10px;
  }

  .ocr-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .ocr-table td[data-label="Montant"] {
    font-weight: 800;
    color: #0f172a;
  }

  .ocr-table td[contenteditable] {
    min-width: 0;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .ocr-cell-amount,
  .ocr-cell-date,
  .ocr-cell-confidence {
    font-variant-numeric: tabular-nums;
  }

  .ocr-cell-amount {
    font-size: 16px;
  }

  .ocr-cell-raw,
  .ocr-cell-merchant {
    line-height: 1.45;
  }

  .ocr-table td[data-label="Confiance"],
  .ocr-table td[data-label="Action"] {
    align-items: center;
  }

  .ocr-table td[data-label="Action"] input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  .ocr-table select {
    min-height: 42px;
    border-radius: 12px;
    font-size: 14px;
  }

  .ocr-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ocr-actions .btn {
    width: 100%;
  }

  .ocr-actions .status {
    margin-left: 0;
  }
}
