/* ============================================================
   כספית — שפת עיצוב "פינטק פרימיום נייר ודיו"
   מצב יום: שנהב חם + ירוק־יער + זהב־חרדל
   ============================================================ */

:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-2: #F1EEE7;
  --ink: #1A2E26;
  --ink-soft: #5C6B63;
  --ink-faint: #93A099;
  --brand: #0E5C43;
  --brand-soft: #E3EFE9;
  --gold: #C9962E;
  --gold-soft: #F6EDD9;
  --red: #B54334;
  --red-soft: #F5E4E1;
  --green: #1E7A55;
  --border: #E4DFD4;
  --shadow: 0 6px 24px rgba(26, 46, 38, 0.10);
  --radius: 10px;
  --font: 'Heebo', system-ui, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #101B16;
  --surface: #18251F;
  --surface-2: #1F2E27;
  --ink: #E8E4DA;
  --ink-soft: #A3AFA7;
  --ink-faint: #6D7A72;
  --brand: #4FA97F;
  --brand-soft: #1C332A;
  --gold: #D9A93F;
  --gold-soft: #33301E;
  --red: #D06A5B;
  --red-soft: #362320;
  --green: #4FA97F;
  --border: #2A3A32;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ---------- מסך התחברות ---------- */
.login-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: grid; place-items: center;
  padding: 20px;
}
.login-box {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  animation: modalIn .25s cubic-bezier(.2,.8,.2,1);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-logo strong { display: block; font-size: 20px; font-weight: 800; }
.login-logo span { font-size: 12.5px; color: var(--ink-soft); }
.login-box h2 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.login-box .field { margin-bottom: 14px; }
.login-box .input { padding: 11px 13px; font-size: 15px; }

/* ---------- תג משתמש בסרגל ---------- */
.user-badge { display: flex; align-items: center; gap: 8px; margin-inline-start: 4px; }
.ub-info { display: flex; flex-direction: column; line-height: 1.25; text-align: start; }
.ub-name { font-size: 13.5px; font-weight: 700; }
.ub-role { font-size: 11px; color: var(--gold); font-weight: 600; }

/* ---------- ניהול משתמשים ---------- */
.roles-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 16px; }
.role-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); font-size: 13px; }
.role-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.role-card .rc-perms { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.role-chip { font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.role-chip.DEVELOPER { background: var(--brand); color: #F7F5F0; }
.role-chip.ADMIN { background: var(--gold-soft); color: var(--gold); }
.role-chip.MANAGER { background: var(--brand-soft); color: var(--brand); }
.role-chip.EMPLOYEE { background: var(--surface-2); color: var(--ink-soft); }
.role-perms { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; line-height: 1.6; }
.u-inactive td { opacity: .5; }

/* באנר "חבר מכשיר" — התראה גלובלית כשאמון-המכשיר של הבנק פג */
.reauth-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  background: var(--gold-soft);
  border-bottom: 1px solid var(--gold);
  color: var(--ink);
  font-size: 14px;
  animation: rbIn .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes rbIn { from { opacity: 0; transform: translateY(-8px); } }
.reauth-banner .rb-icon { font-size: 18px; }
.reauth-banner .rb-text { flex: 1; line-height: 1.4; }
.reauth-banner .rb-text b { color: var(--gold); }
.reauth-banner .rb-btn { background: var(--gold); color: #fff; white-space: nowrap; }
.reauth-banner .rb-btn:hover { filter: brightness(1.08); }
.reauth-banner .rb-btn:disabled { opacity: .6; cursor: default; }
.reauth-banner .rb-dismiss {
  border: none; background: transparent; color: var(--ink-soft);
  font-size: 15px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.reauth-banner .rb-dismiss:hover { color: var(--ink); }

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

/* מעבר ערכה — circular reveal דרך View Transitions */
::view-transition-old(root), ::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
html.theme-fade body { transition: background .35s ease; }
html.theme-fade .card, html.theme-fade .sidebar, html.theme-fade .topbar {
  transition: background .35s ease, border-color .35s ease, color .35s ease;
}

/* ---------- פריסה ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-inline-start: none;
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.logo-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--brand);
  color: #F7F5F0;
  font-size: 24px; font-weight: 800;
  display: grid; place-items: center;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.logo-text span { font-size: 12px; color: var(--ink-soft); }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border: none; border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer;
  text-align: start;
  transition: background .15s, color .15s, transform .1s;
}
.nav-item svg { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:active { transform: scale(0.97); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }

.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--border); }
.kbd-hint {
  width: 100%;
  background: transparent; border: none;
  color: var(--ink-faint); font-family: inherit; font-size: 12.5px;
  cursor: pointer; padding: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.kbd-hint:hover { color: var(--ink-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- סרגל עליון ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.greeting { font-size: 15px; color: var(--ink-soft); }
.greeting strong { color: var(--ink); font-weight: 700; }

.month-picker {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px;
}
.month-picker button {
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--ink-soft);
  font-size: 20px; cursor: pointer; line-height: 1;
  transition: background .15s;
}
.month-picker button:hover { background: var(--surface); color: var(--brand); }
#monthLabel { min-width: 110px; text-align: center; font-weight: 700; font-size: 14.5px; }

/* מתג דמו / אמיתי */
.mode-switch {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.mode-switch button {
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mode-switch button.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.mode-switch button[data-mode="real"].active { color: var(--gold); }

/* באנר מצב אמיתי ריק */
.empty-banner {
  display: flex; align-items: center; gap: 16px;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  animation: cardIn .4s ease both;
}
.empty-banner .eb-icon { font-size: 28px; }
.empty-banner .eb-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.empty-banner .eb-text strong { font-size: 15px; }
.empty-banner .eb-text span { font-size: 13px; color: var(--ink-soft); }

/* חיבורי בנק בהגדרות */
.bank-list { display: flex; flex-direction: column; gap: 8px; }
.bank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
}
.bank-row .br-name { font-weight: 700; }
.bank-row .br-type {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.bank-row .br-type.credit { background: var(--gold-soft); color: var(--gold); }
.bank-row .br-preview { color: var(--ink-faint); font-variant-numeric: tabular-nums; margin-inline-start: auto; }
.bank-row .br-guard {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold); font-weight: 600;
  white-space: nowrap;
}
.bank-row .br-guard.bad { background: var(--red-soft); color: var(--red); }
.bank-row .br-trust { white-space: nowrap; font-size: 12px; padding: 5px 10px; }
.bank-row { flex-wrap: wrap; }
.bank-row .row-del { opacity: 1; }
.bank-empty { color: var(--ink-faint); font-size: 13px; padding: 6px 2px; }
.sync-row { display: flex; gap: 8px; }
.sync-row .input { flex: 1; }
.scraper-warn {
  background: var(--red-soft); color: var(--red);
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; line-height: 1.5;
}
.btn.syncing { opacity: .7; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin-icon { display: inline-block; animation: spin 1s linear infinite; }

.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .15s, color .15s, transform .1s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
.icon-sun { display: none; }
.icon-moon { display: block; }

/* ---------- מסכים ---------- */
.screens { padding: 26px 28px 90px; flex: 1; }
.screen { display: none; }
.screen.active { display: block; animation: screenIn .18s ease both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.screen-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.screen-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }

/* ---------- כרטיסים ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow); }

.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 16px 18px 4px;
}
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.card-hint { font-size: 12px; color: var(--ink-faint); }

/* ---------- כרטיסי סטטיסטיקה ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  padding: 16px 18px 12px;
  opacity: 0;
  animation: cardIn .4s ease forwards;
}
.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 60ms; }
.stat-card:nth-child(3) { animation-delay: 120ms; }
.stat-card:nth-child(4) { animation-delay: 180ms; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.stat-title { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.stat-delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.stat-delta.up { color: var(--green); background: var(--brand-soft); }
.stat-delta.down { color: var(--red); background: var(--red-soft); }
.stat-value {
  font-size: 27px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.stat-value.income, .stat-value.positive { color: var(--brand); }
.stat-value.negative { color: var(--red); }
.stat-sub { font-size: 12px; color: var(--ink-faint); }
.sparkline { width: 100%; height: 34px; display: block; }

/* ---------- תובנות ---------- */
.insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.insight {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  line-height: 1.45;
  animation: cardIn .4s ease both;
}
.insight .ins-icon { font-size: 18px; line-height: 1.2; }
.insight.good { border-inline-start: 3px solid var(--green); }
.insight.warn { border-inline-start: 3px solid var(--gold); }
.insight.bad { border-inline-start: 3px solid var(--red); }
.insight.info { border-inline-start: 3px solid var(--ink-faint); }

/* ---------- רשת דשבורד ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.chart-card { padding-bottom: 14px; }
.chart-wrap { padding: 10px 14px 4px; height: 260px; position: relative; }
.chart-wrap.tall { height: 300px; }
.chart-wrap canvas { max-width: 100%; }

/* מד בריאות */
.gauge-wrap { position: relative; display: grid; place-items: center; padding-top: 12px; }
.gauge-label {
  position: absolute; bottom: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
}
.gauge-parts { padding: 4px 18px 12px; font-size: 12.5px; color: var(--ink-soft); }
.gauge-parts .gp-row {
  display: flex; justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px dashed var(--border);
}
.gauge-parts .gp-row:last-child { border: none; }
.gauge-parts .gp-val { font-variant-numeric: tabular-nums; font-weight: 700; }

/* קבועות מול משתנות */
.fixed-var { padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.fv-row .fv-head {
  display: flex; justify-content: space-between;
  font-size: 13.5px; margin-bottom: 7px;
}
.fv-row .fv-amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.fv-bar {
  height: 10px; border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.fv-fill {
  height: 100%; border-radius: 999px;
  width: 0;
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.fv-fill.fixed { background: var(--gold); }
.fv-fill.variable { background: var(--brand); }

/* מפת חום */
.heatmap { padding: 12px 18px 16px; overflow-x: auto; }
.hm-grid { display: grid; grid-auto-flow: column; gap: 4px; direction: rtl; }
.hm-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.hm-cell {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--surface-2);
  position: relative;
  cursor: default;
}
.hm-cell.empty { background: transparent; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; margin-inline-end: 6px; }
.hm-days span { font-size: 10.5px; color: var(--ink-faint); height: 22px; line-height: 22px; }
.hm-cell:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 50%; transform: translateX(50%);
  background: var(--ink); color: var(--bg);
  padding: 4px 9px; border-radius: 6px;
  font-size: 11.5px; white-space: nowrap;
  z-index: 30;
}

/* ---------- כפתורים ושדות ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s, background .15s, border-color .15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--brand); color: #F7F5F0; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.file-btn { position: relative; overflow: hidden; }

.input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit; font-size: 14px;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--brand); }
.color-input { padding: 3px; height: 40px; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field > span { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.checkbox-field { flex-direction: row; align-items: center; gap: 10px; padding-top: 20px; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-row { display: flex; gap: 12px; margin-top: 12px; }
.field-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; margin: 14px 0 6px; }

.section-label {
  font-size: 13px; font-weight: 700; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .5px;
  margin: 22px 0 10px;
}

/* ---------- טבלת תנועות ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .input { min-width: 0; }
#txSearch { width: 200px; }

.bulk-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-size: 13.5px; font-weight: 600;
}

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tx-table th {
  text-align: start;
  padding: 12px 14px;
  font-size: 12.5px; font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.tx-table th.sortable { cursor: pointer; user-select: none; }
.tx-table th.sortable:hover { color: var(--brand); }
.tx-table th.num, .tx-table td.num { text-align: end; font-variant-numeric: tabular-nums; }
.tx-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tx-table tbody tr { cursor: pointer; transition: background .12s; }
.tx-table tbody tr:hover { background: var(--surface-2); }
.tx-table tbody tr.flash { animation: rowFlash 1.6s ease; }
@keyframes rowFlash {
  0% { background: var(--brand-soft); }
  100% { background: transparent; }
}
.col-check { width: 36px; }
.col-actions { width: 42px; }
.tx-cat { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tx-cat .dot { width: 9px; height: 9px; border-radius: 50%; }
.tx-amount.income { color: var(--brand); font-weight: 700; }
.tx-amount { font-weight: 600; white-space: nowrap; }
.tx-balance { color: var(--ink-soft); white-space: nowrap; font-size: 13px; }
.tx-balance.neg { color: var(--red); }
.tag-chip {
  display: inline-block;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-inline-end: 4px;
}
.type-chip {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 600;
}
.type-chip.fixed { background: var(--gold-soft); color: var(--gold); }
.type-chip.variable { background: var(--brand-soft); color: var(--brand); }
.row-del {
  border: none; background: transparent;
  color: var(--ink-faint); cursor: pointer;
  font-size: 15px; padding: 4px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .12s, color .12s;
}
tr:hover .row-del { opacity: 1; }
.row-del:hover { color: var(--red); }

.table-foot {
  position: sticky; bottom: 0;
  padding: 12px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600;
  display: flex; gap: 20px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- קטגוריות ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.cat-card { padding: 16px; cursor: pointer; }
.cat-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.cat-emoji {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 21px;
  border-radius: 10px;
  background: var(--surface-2);
}
.cat-name { font-weight: 700; font-size: 15px; }
.cat-total { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.budget-bar {
  height: 8px; border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 4px;
}
.budget-fill {
  height: 100%; border-radius: 999px;
  width: 0;
  background: var(--brand);
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.budget-fill.warn { background: var(--gold); }
.budget-fill.over { background: var(--red); }
.budget-caption {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-faint);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.budget-caption .over-txt { color: var(--red); font-weight: 700; }
.import-status { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.import-status .is-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
}
.import-status .is-icon { font-size: 17px; }
.import-status .is-body { flex: 1; line-height: 1.5; }
.import-status .is-title { font-weight: 700; }
.import-status .is-detail { color: var(--ink-soft); font-size: 12.5px; }
.import-status .is-detail b { color: var(--ink); font-variant-numeric: tabular-nums; }
.import-status .is-none { color: var(--ink-faint); }

.cat-excluded { opacity: .7; }
.excl-badge {
  font-size: 10.5px; font-weight: 700;
  background: var(--surface-2); color: var(--ink-soft);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px; margin-inline-start: 4px;
  vertical-align: middle;
}

/* ---------- קבועות ומנויים ---------- */
.subs-summary {
  padding: 18px 20px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.subs-summary .ss-item { display: flex; flex-direction: column; gap: 2px; }
.subs-summary .ss-label { font-size: 12.5px; color: var(--ink-soft); }
.subs-summary .ss-value { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.subs-summary .ss-value.gold { color: var(--gold); }
.rec-inactive { opacity: .45; }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}
.switch .sl::before {
  content: "";
  position: absolute; top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: transform .2s, background .2s;
}
.switch input:checked + .sl { background: var(--brand-soft); border-color: var(--brand); }
.switch input:checked + .sl::before { transform: translateX(-16px); background: var(--brand); }

/* ---------- יעדים ---------- */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.goal-card { padding: 20px; position: relative; overflow: hidden; }
.goal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.goal-icon { font-size: 28px; }
.goal-name { font-weight: 800; font-size: 17px; }
.goal-badge {
  position: absolute; top: 14px; inset-inline-end: 14px;
  background: var(--gold-soft); color: var(--gold);
  font-size: 12px; font-weight: 800;
  padding: 4px 12px; border-radius: 999px;
}
.goal-body { display: flex; gap: 18px; align-items: center; }
.goal-ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring .ring-bg { stroke: var(--surface-2); }
.goal-ring .ring-fg {
  stroke: var(--brand);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1);
}
.goal-ring.done .ring-fg { stroke: var(--gold); }
.ring-pct {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.goal-nums { flex: 1; font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.goal-nums .gn-big { font-size: 16px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.goal-eta {
  margin-top: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13.5px; font-weight: 600;
}
.goal-eta.never { background: var(--red-soft); color: var(--red); }

.whatif { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.whatif-label {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-soft); font-weight: 600;
  margin-bottom: 6px;
}
.whatif-label .wl-val { color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 800; }
.whatif input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: grab;
}
.whatif input[type="range"]:active { cursor: grabbing; }
.lever-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lever-chip {
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.lever-chip:hover { border-color: var(--gold); color: var(--gold); }
.goal-actions { position: absolute; bottom: 14px; inset-inline-end: 14px; display: flex; gap: 6px; }
.goal-actions .icon-btn { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }

/* ---------- דוחות ---------- */
.cmp-trend { font-size: 12px; margin-inline-start: 4px; }
.cmp-trend.up { color: var(--red); }
.cmp-trend.down { color: var(--green); }
.forecast-list { padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 9px; }
.fc-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.fc-row .fc-flow { font-weight: 800; }
.fc-row .fc-flow.pos { color: var(--brand); }
.fc-row .fc-flow.neg { color: var(--red); }

/* ---------- הגדרות ---------- */
.accounts-card { margin-bottom: 14px; padding-bottom: 16px; }
.accounts-list { padding: 6px 18px 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.acct {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  background: var(--surface);
}
.acct.over { border-color: var(--red); background: var(--red-soft); }
.acct.near { border-color: var(--gold); }
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.acct-name { font-weight: 700; font-size: 14.5px; }
.acct-type { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.acct-balance { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 8px; }
.acct-balance.neg { color: var(--red); }
.acct-balance.pos { color: var(--brand); }
.acct-sub { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; }
.acct-util-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0; }
.acct-util-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.acct-util-fill.near { background: var(--gold); }
.acct-util-fill.over { background: var(--red); }
.acct-limit-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.acct-limit-row label { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.acct-limit-row input { flex: 1; padding: 6px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--ink); font-family: inherit; }
.acct-warn { font-size: 12.5px; font-weight: 700; margin-top: 6px; }
.acct-warn.over { color: var(--red); }
.acct-warn.near { color: var(--gold); }
.acct-warn.ok { color: var(--green); }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}
.settings-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.settings-card h3 { font-size: 16px; font-weight: 800; }
.settings-actions { display: flex; flex-direction: column; gap: 9px; }
.muted { color: var(--ink-soft); font-size: 13.5px; line-height: 1.5; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  bottom: 26px; inset-inline-end: 26px;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #F7F5F0;
  font-size: 30px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(14, 92, 67, 0.4);
  transition: transform .15s;
  z-index: 60;
}
.fab:hover { transform: scale(1.08) rotate(90deg); }
.fab:active { transform: scale(0.95); }

/* ---------- מודאלים ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16, 27, 22, 0.55);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 100;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  animation: modalIn .2s cubic-bezier(.2,.8,.2,1);
}
.modal.small { width: min(400px, calc(100vw - 32px)); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.modal-head h3 { font-size: 18px; font-weight: 800; }
.icon-btn.close { border: none; width: 32px; height: 32px; font-size: 15px; }
.modal-actions { margin-top: 18px; }
.form-errors { color: var(--red); font-size: 13px; margin-top: 10px; line-height: 1.5; }

/* שדה סכום גדול */
.amount-field { position: relative; margin-bottom: 12px; }
.amount-input {
  width: 100%;
  font-family: inherit;
  font-size: 38px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 12px 46px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
}
.amount-input:focus { outline: none; border-color: var(--brand); }
.amount-input::-webkit-outer-spin-button, .amount-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.currency {
  position: absolute; top: 50%; inset-inline-end: 18px;
  transform: translateY(-50%);
  font-size: 22px; font-weight: 700; color: var(--ink-faint);
}

/* טוגל מקטעים */
.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
  margin-top: 10px;
}
.seg-btn {
  flex: 1;
  padding: 8px;
  border: none; border-radius: 7px;
  background: transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
#txKindSeg .seg-btn[data-value="expense"].active { color: var(--red); }

/* בוחר קטגוריות */
.cat-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 7px;
  max-height: 170px;
  overflow-y: auto;
}
.cat-pick {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, background .12s, transform .1s;
}
.cat-pick:active { transform: scale(0.95); }
.cat-pick .cp-icon { font-size: 20px; }
.cat-pick .cp-name { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
.cat-pick.active { border-color: var(--brand); background: var(--brand-soft); }
.cat-pick.active .cp-name { color: var(--brand); font-weight: 700; }

/* ---------- לוח פקודות ---------- */
.palette-backdrop { align-items: start; padding-top: 12vh; display: flex; justify-content: center; }
.palette {
  width: min(560px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn .18s cubic-bezier(.2,.8,.2,1);
}
#paletteInput {
  width: 100%;
  padding: 17px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  font-family: inherit; font-size: 16.5px;
}
#paletteInput:focus { outline: none; }
.palette-results { max-height: 330px; overflow-y: auto; padding: 7px; }
.pal-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.pal-item .pal-icon { font-size: 17px; width: 24px; text-align: center; }
.pal-item .pal-sub { margin-inline-start: auto; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.pal-item:hover, .pal-item.selected { background: var(--brand-soft); }
.pal-empty { padding: 22px; text-align: center; color: var(--ink-faint); font-size: 13.5px; }

/* ---------- עזרה ---------- */
.help-list { display: flex; flex-direction: column; gap: 9px; }
.help-list > div { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.help-list span { color: var(--ink-soft); margin-inline-start: 8px; }
kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 12px; font-weight: 700;
}

/* ---------- טוסטים ---------- */
.toasts {
  position: fixed;
  bottom: 24px; inset-inline-end: 24px;
  display: flex; flex-direction: column; gap: 9px;
  z-index: 200;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  padding: 12px 17px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .25s cubic-bezier(.2,.8,.2,1);
  max-width: 360px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
}
.toast.leaving { opacity: 0; transform: translateY(8px); transition: all .25s; }
.toast.error { background: var(--red); color: #fff; }
.toast .toast-undo {
  border: none;
  background: rgba(255,255,255,.15);
  color: inherit;
  font-family: inherit; font-size: 13px; font-weight: 700;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
}
.toast .toast-undo:hover { background: rgba(255,255,255,.28); }

/* ---------- שלדים (skeleton) ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
  color: transparent !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- ניווט תחתון (מובייל) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  justify-content: space-around;
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: none; background: transparent;
  font-family: inherit; font-size: 10.5px; font-weight: 600;
  color: var(--ink-faint);
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: color .15s, transform .1s;
}
.bnav-item svg { width: 22px; height: 22px; fill: currentColor; }
.bnav-item:active { transform: scale(0.92); }
.bnav-item.active { color: var(--brand); }

.phone-access {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 14px;
}
.phone-access code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  direction: ltr; display: inline-block;
}

/* ---------- רספונסיביות ---------- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .span2, .span3 { grid-column: span 2; }
}
@media (max-width: 860px) {
  .sidebar { width: 66px; padding: 18px 8px; }
  .logo-text, .nav-item span, .sidebar-footer { display: none; }
  .logo { justify-content: center; padding-bottom: 18px; }
  .nav-item { justify-content: center; padding: 12px; }
  .dash-grid { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: span 1; }
  .greeting { display: none; }
  .screens { padding: 18px 14px 90px; }
  .form-row { flex-direction: column; }
}

/* טלפון — ניווט תחתון במקום סרגל צד, מראה אפליקציה */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .topbar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }
  #monthLabel { min-width: 88px; font-size: 13.5px; }
  .mode-switch button { padding: 5px 10px; font-size: 12px; }
  .screens { padding: 14px 12px calc(120px + env(safe-area-inset-bottom, 0px)); }
  .screen-head h2 { font-size: 20px; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 22px; }
  .chart-wrap { height: 220px; padding: 8px 10px 4px; }
  .chart-wrap.tall { height: 240px; }
  .fab {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    width: 52px; height: 52px; font-size: 27px;
  }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 12px; }
  .goal-body { flex-direction: column; align-items: flex-start; }
  .filters { width: 100%; }
  #txSearch { width: 100%; flex-basis: 100%; }
  .modal { padding: 16px; max-height: calc(100vh - 24px); }
  .amount-input { font-size: 30px; }
  .subs-summary { gap: 14px; }
}
