/* הקלויז הגדול — עיצוב: כחול-לילה של בית מדרש, נחושת/זהב, ונייר חם */
:root {
  color-scheme: light;
  --bg: #f3efe6; --surface: #fffdf9; --surface-2: #f8f4ec; --line: #e7dfcf; --line-2: #d8ccb4;
  --grid: #ece6d9; --axis: #cfc6b3; --track: #f0ebe0;
  --ink: #16233a; --ink-2: #4b5568; --muted: #737b8a; --muted-2: #959caa;
  --navy: #13233f; --navy-2: #1f3763; --gold: #b8892b; --gold-2: #d9b25a; --gold-soft: #f4ead0;
  --inc: #2a78d6; --inc-ink: #1c5cab; --inc-soft: #e4eefb;
  --exp: #eb6834; --exp-ink: #b0441a; --exp-soft: #fde9df;
  --bank: #6250d6; --bank-ink: #4a3aa7; --bank-soft: #ecE9fb;
  --cash: #179e6f; --cash-ink: #0f6e4d; --cash-soft: #e0f4ec;
  --pos: #0f7a3d; --neg: #b9322a;
  --m-cash: #179e6f; --m-transfer: #6250d6; --m-cheque: #eda100; --m-credit: #e87ba4; --m-standing: #2a78d6;
  --r: 16px;
  --shadow: 0 1px 2px rgba(22, 35, 58, .05), 0 6px 22px rgba(22, 35, 58, .05);
  --font: "Heebo", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  --serif: "Frank Ruhl Libre", "David", "Times New Roman", serif;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; }
.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.c-inc { color: var(--inc-ink); } .c-exp { color: var(--exp-ink); }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.hint.pad { padding: 10px 16px 14px; margin: 0; }

/* ---------- כפתורים ושדות ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn.gold { background: linear-gradient(180deg, #c99a3b, #b0822a); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 2px 8px rgba(176, 130, 42, .3); }
.btn.gold:hover { background: linear-gradient(180deg, #d2a446, #b8892b); }
.btn.ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost-l { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); color: #e8ecf4; }
.btn.ghost-l:hover { background: rgba(255, 255, 255, .12); }
.btn.danger { background: #fff; border-color: #e8b8b3; color: var(--neg); }
.btn.link { background: none; border: 0; color: var(--inc-ink); padding: 4px 6px; min-height: 0; font-weight: 500; }
.btn.link.danger-t { color: var(--neg); }
.btn.big { min-height: 50px; font-size: 16px; border-radius: 13px; }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(127, 127, 127, .12); }
select, input[type="date"], input[type="search"], input:not([type]), input[type="text"], textarea {
  border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 8px 11px; min-height: 40px; font-size: 14px; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 137, 43, .18); }
select { padding-left: 28px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ================= מסך כניסה ================= */
.login { position: fixed; inset: 0; z-index: 50; background: #0b1528; color: #fff; overflow: auto; }
.lg-bg { position: fixed; inset: 0; overflow: hidden; }
.lg-fallback { position: absolute; inset: 0; transition: opacity 1s;
  background:
    radial-gradient(1100px 680px at 78% 18%, rgba(217, 178, 90, .2), transparent 62%),
    radial-gradient(900px 600px at 8% 92%, rgba(98, 80, 214, .2), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='112' viewBox='0 0 84 112'%3E%3Cpath d='M12 112V50a30 30 0 0 1 60 0v62' fill='none' stroke='%23d9b25a' stroke-opacity='.14' stroke-width='1.5'/%3E%3Cpath d='M23 112V53a19 19 0 0 1 38 0v59' fill='none' stroke='%23d9b25a' stroke-opacity='.07'/%3E%3C/svg%3E"),
    linear-gradient(160deg, #182c50, #0b1528 70%); }
.lg-bg.has-img .lg-fallback { opacity: 0; }
.lg-slide { position: absolute; inset: 0; background-size: cover; background-position: center 28%; opacity: 0; transition: opacity 1.8s ease; transform: scale(1.03); }
.lg-slide.on { opacity: 1; animation: kb 16s ease-out forwards; }
@keyframes kb { from { transform: scale(1.03); } to { transform: scale(1.12); } }
.lg-shade { position: fixed; inset: 0; background: linear-gradient(to left, rgba(9, 17, 34, .08) 22%, rgba(9, 17, 34, .72) 62%, rgba(9, 17, 34, .9)), linear-gradient(to top, rgba(9, 17, 34, .7), transparent 42%); }
.lg-wrap { position: relative; min-height: 100%; display: flex; align-items: center; justify-content: flex-end; padding: 40px 6vw; }
.lg-card { width: min(430px, 100%); background: rgba(12, 22, 44, .7); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); border: 1px solid rgba(217, 178, 90, .34); border-radius: 24px; padding: 28px 26px 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.lg-brand { display: flex; gap: 14px; align-items: center; }
.lg-brand .emblem { width: 60px; height: 60px; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.lg-brand h1 { font-family: var(--serif); font-weight: 900; font-size: 36px; line-height: 1.05; color: #f6ecd2; letter-spacing: .3px; }
.lg-sub { color: #d9c9a0; font-size: 14px; margin-top: 4px; }
.lg-date { margin: 16px 0 16px; color: #b9c3d6; font-size: 13px; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 12px; }
.lg-q { font-weight: 600; margin-bottom: 8px; font-size: 14px; color: #e8ecf4; }
.lg-users { display: grid; gap: 8px; }
.lg-user { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .04); cursor: pointer; min-height: 56px; transition: border-color .15s, background .15s; }
.lg-user:hover { background: rgba(255, 255, 255, .08); }
.lg-user input { position: absolute; opacity: 0; pointer-events: none; }
.lg-user:has(input:checked) { border-color: var(--gold-2); background: rgba(217, 178, 90, .15); }
.lg-user:has(input:focus-visible) { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.av { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(160deg, #e2c27a, #b8892b); color: #13233f; font-weight: 800; font-size: 15px; flex: none; }
.who { min-width: 0; } .who b { display: block; font-size: 15px; font-weight: 600; } .who small { color: #b9c3d6; font-size: 12.5px; }
.code-hint { margin-inline-start: auto; font-size: 12px; color: #e9d8ad; background: rgba(217, 178, 90, .14); padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.lg-code { display: block; margin-top: 14px; }
.lg-code span { font-size: 13px; color: #b9c3d6; }
.lg-code input { width: 100%; margin-top: 6px; font-size: 24px; letter-spacing: 8px; text-align: center; padding: 10px; border-radius: 13px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #fff; min-height: 54px; }
.lg-code input::placeholder { color: rgba(255, 255, 255, .35); }
.lg-err { min-height: 22px; color: #ffb9ad; font-size: 13px; margin: 6px 0 4px; }
.lg-card .btn.big { width: 100%; }
.lg-demo { text-align: center; margin-top: 12px; font-size: 12px; color: #9fb0c9; }
.lg-dots { position: fixed; bottom: 20px; right: 26px; display: flex; gap: 6px; z-index: 2; }
.lg-dots i { width: 8px; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .38); transition: width .4s, background .4s; }
.lg-dots i.on { width: 24px; background: var(--gold-2); }
.lg-bgbtn { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(9, 17, 34, .45); color: #e8ecf4; font-size: 13px; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.lg-bgbtn:hover { background: rgba(9, 17, 34, .65); }

/* ================= מעטפת ================= */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #15284a, #0f1d36); color: #e8ecf4; display: flex; flex-direction: column; padding: 18px 14px 14px; gap: 16px; overflow: auto; grid-row: 1 / span 2; }
.sd-brand { display: flex; gap: 11px; align-items: center; padding: 2px 4px 14px; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.sd-brand .emblem { width: 46px; height: 46px; flex: none; }
.sd-brand b { display: block; font-family: var(--serif); font-weight: 900; font-size: 22px; color: #f6ecd2; line-height: 1.1; }
.sd-brand small { color: #c9b78a; font-size: 12.5px; }
.sd-nav { display: grid; gap: 3px; }
.sd-nav a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 11px; color: #c4cde0; text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.sd-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sd-nav a.on { background: rgba(217, 178, 90, .15); color: #f6ecd2; box-shadow: inset -3px 0 0 var(--gold-2); }
.sd-nav a.on .ic { color: var(--gold-2); }
.sd-add { display: grid; gap: 7px; padding-top: 4px; }
.sd-add .btn { justify-content: flex-start; }
.sd-user { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 13px; background: rgba(255, 255, 255, .05); }
.sd-user > div { min-width: 0; flex: 1; }
.sd-user b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-user small { color: #9fb0c9; font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-demo { font-size: 11px; color: #7e8ea9; text-align: center; }
.topbar, .tabbar { display: none; }
main { padding: 22px 28px 70px; min-width: 0; }
.fab { display: none; }

/* ---------- כותרת עמוד ושורת סינון ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ph h1 { font-family: var(--serif); font-weight: 900; font-size: 30px; line-height: 1.1; color: var(--navy); }
.ph-sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.ph-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13.5px; margin-bottom: 6px; }
.back:hover { color: var(--ink); }
.fbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.fb-f { display: grid; gap: 3px; }
.fb-f label { font-size: 12px; color: var(--muted); font-weight: 500; }
.fb-f select { min-width: 190px; }
.fb-info { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; flex-wrap: wrap; }
.fb-info small { color: var(--muted); }
.fb-info .ic { color: var(--gold); display: none; }

/* ---------- באנר לוח בקרה ---------- */
.banner { position: relative; border-radius: 22px; overflow: hidden; color: #fff; padding: 22px 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 18px 30px; flex-wrap: wrap; margin-bottom: 14px; min-height: 168px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='112' viewBox='0 0 84 112'%3E%3Cpath d='M12 112V50a30 30 0 0 1 60 0v62' fill='none' stroke='%23d9b25a' stroke-opacity='.13' stroke-width='1.5'/%3E%3C/svg%3E"), linear-gradient(135deg, #13233f, #22406f); }
.banner.img::before { content: ''; position: absolute; inset: 0; background: var(--ban) center 28% / cover no-repeat; }
.banner.img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to left, rgba(12, 22, 44, .45), rgba(12, 22, 44, .9) 75%), linear-gradient(to top, rgba(12, 22, 44, .55), transparent 60%); }
.banner > div { position: relative; z-index: 1; }
.bn-date { font-size: 13px; color: #d9c9a0; }
.banner h1 { font-family: var(--serif); font-weight: 900; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.12; margin-top: 4px; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.bn-sub { color: #cfd8e8; font-size: 14px; margin-top: 4px; }
.bn-hero { text-align: left; }
.bn-hero small { display: block; color: #d9c9a0; font-size: 13px; }
.bn-hero b { display: block; font-size: clamp(36px, 5vw, 52px); font-weight: 800; line-height: 1.05; letter-spacing: -.5px; }
.bn-split { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; font-size: 13.5px; color: #e8ecf4; }
.bn-split span { display: inline-flex; align-items: center; gap: 5px; }
.bn-split .ic { width: 16px; height: 16px; color: var(--gold-2); }

/* ---------- כרטיסים ומדדים ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi b { display: block; font-size: 26px; font-weight: 800; line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi em { display: block; font-style: normal; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.delta { display: inline-block; font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.delta small { font-weight: 400; color: var(--muted); }
.delta.good { color: var(--pos); } .delta.bad { color: var(--neg); }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid > .card { margin-bottom: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h3 { font-size: 16px; font-weight: 700; }
.lnk { color: var(--inc-ink); font-size: 13.5px; text-decoration: none; font-weight: 500; }
.lnk:hover { text-decoration: underline; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
.lg-i { display: inline-flex; align-items: center; gap: 6px; }
.lg-i i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-i i.ln { width: 14px; height: 3px; border-radius: 2px; }

/* ---------- גרפים ---------- */
.chart { width: 100%; }
.ch { display: block; direction: rtl; font-family: var(--font); overflow: visible; }
.ch .grid { stroke: var(--grid); stroke-width: 1; }
.ch .grid.base { stroke: var(--axis); }
.ch .tick { stroke: var(--axis); }
.ch .ax { fill: var(--muted); font-size: 11.5px; }
.ch .ax.sub { fill: var(--muted-2); font-size: 10.5px; }
.ch .hit { fill: transparent; cursor: pointer; }
.ch .hit:hover { fill: rgba(19, 35, 63, .055); }
.ch .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch .ln-end, .ch .ln-dot { stroke: var(--surface); stroke-width: 2; }
.ch .xh { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; }
.ch .ln-ov { fill: transparent; cursor: crosshair; }
.sankey .sk-link { transition: filter .15s; }
.sankey .sk-link:hover { filter: brightness(.82) saturate(1.4); }
.sk-l { font-size: 12.5px; fill: var(--ink); font-weight: 600; }
.sk-l.mid { font-weight: 700; }
.sk-v { font-size: 11.5px; fill: var(--muted); }
.sk-col { font-size: 12px; fill: var(--muted); font-weight: 700; }
.donut .dn-seg { stroke: var(--surface); stroke-width: 2; cursor: default; }
.donut .dn-seg:hover { filter: brightness(.92); }
.dn-t { font-size: 21px; font-weight: 800; fill: var(--ink); }
.dn-b { font-size: 12px; fill: var(--muted); }
.donut-box { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.dl { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; min-width: 150px; flex: 1; }
.dl li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; font-size: 13.5px; }
.dl li i { width: 12px; height: 12px; border-radius: 3px; }
.dl li em { grid-column: 2 / 4; font-style: normal; color: var(--muted); font-size: 12px; margin-top: -6px; }
.spark { display: block; }

/* פסים אופקיים */
.hb { display: grid; gap: 4px; }
.hb-row { display: grid; grid-template-columns: minmax(96px, 32%) minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 32px; padding: 2px 6px; border-radius: 8px; }
.hb-row.clk { cursor: pointer; }
.hb-row:hover { background: var(--surface-2); }
.hb-l { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-l small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.hb-t { display: block; height: 12px; background: var(--track); border-radius: 6px; overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 4px 0 0 4px; }
.hb-t.two { height: auto; background: none; display: grid; gap: 2px; border-radius: 0; }
.hb-t.two i { height: 8px; }
.hb-v { font-size: 13.5px; font-weight: 600; text-align: left; min-width: 96px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb-v small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.hb-v em { font-style: normal; }
.solo { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.solo small { display: block; color: var(--muted); font-size: 13px; }
.solo b { font-size: 24px; }
.stk { display: grid; gap: 6px; margin-bottom: 14px; }
.stk-r { display: grid; grid-template-columns: minmax(96px, 22%) minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 30px; }
.hstack { display: flex; height: 14px; gap: 2px; border-radius: 4px; overflow: hidden; }
.hstack i { display: block; height: 100%; min-width: 2px; }

/* קופות */
.klist { display: grid; gap: 2px; margin-bottom: 10px; }
.krow { display: grid; grid-template-columns: 30px minmax(0, 1fr) 72px auto; align-items: center; gap: 9px; padding: 7px 6px; border-radius: 9px; text-decoration: none; }
.krow:hover { background: var(--surface-2); }
.krow .kn { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.krow b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kbar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.kbar i { display: block; height: 100%; border-radius: 4px 0 0 4px; }
.kbar i.bank { background: var(--bank); } .kbar i.cash { background: var(--cash); }
.kic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; }
.kic .ic { width: 17px; height: 17px; }
.kic.bank { background: var(--bank-soft); color: var(--bank-ink); }
.kic.cash { background: var(--cash-soft); color: var(--cash-ink); }
.khero { display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: center; background: linear-gradient(135deg, #13233f, #22406f); color: #fff; border-radius: 20px; padding: 18px 22px; margin-bottom: 14px; }
.kh-tot small { display: block; color: #d9c9a0; font-size: 13px; }
.kh-tot b { font-size: clamp(34px, 4.6vw, 50px); font-weight: 800; line-height: 1.05; }
.kh-split { flex: 1; min-width: 240px; }
.kh-bar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: rgba(255, 255, 255, .1); }
.kh-bar i { display: block; height: 100%; }
.kh-bar i.bank { background: #8c7ff0; } .kh-bar i.cash { background: #3cc795; }
.kh-l { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 8px; font-size: 13.5px; }
.kh-l span { display: inline-flex; align-items: center; gap: 6px; }
.kh-l small { opacity: .75; }
.kh-l .ic { width: 16px; height: 16px; }
.kh-l.tot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-2); }
.kcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; border-top: 3px solid var(--cash); }
.kcard.bank { border-top-color: var(--bank); }
.kcard:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(22, 35, 58, .1); }
.kc-h { display: flex; gap: 10px; align-items: center; }
.kc-h b { display: block; font-size: 14.5px; font-weight: 600; }
.kc-h small { display: block; color: var(--muted); font-size: 12px; }
.kc-b { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 10px; }
.kc-b > b { font-size: 24px; font-weight: 800; white-space: nowrap; }
.kc-f { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }

/* ---------- תנועות ---------- */
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.tag.inc { background: var(--inc-soft); color: var(--inc-ink); }
.tag.exp { background: var(--exp-soft); color: var(--exp-ink); }
.tag.trf { background: #eceaf2; color: #4f4a68; }
.kchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid; }
.kchip .ic { width: 13px; height: 13px; }
.kchip.bank { background: var(--bank-soft); color: var(--bank-ink); border-color: #d9d3f6; }
.kchip.cash { background: var(--cash-soft); color: var(--cash-ink); border-color: #c4e8da; }
.arrow { color: var(--muted); margin: 0 3px; font-size: 12px; }
.amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.inc { color: var(--inc-ink); } .amt.exp { color: var(--exp-ink); } .amt.trf { color: #4f4a68; }
.recent { display: grid; }
.rc { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 6px; border-bottom: 1px solid var(--grid); }
.rc:last-child { border-bottom: 0; }
.rc.clk { cursor: pointer; } .rc:hover { background: var(--surface-2); }
.rc-d b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; } .rc-d small { color: var(--muted); font-size: 11.5px; }
.rc-t { min-width: 0; } .rc-t b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .rc-t small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txf { display: grid; gap: 10px; margin-bottom: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 13.5px; font-weight: 500; min-height: 36px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.txf-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.srch { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; min-height: 40px; flex: 1 1 240px; }
.srch:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 137, 43, .18); }
.srch .ic { color: var(--muted); width: 18px; height: 18px; }
.srch input { border: 0; box-shadow: none !important; padding: 6px 0; min-height: 38px; flex: 1; min-width: 0; background: transparent; }
.srch.sm { flex: 0 1 220px; }
.sumline { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); margin: 0 4px 10px; }
table { border-collapse: collapse; width: 100%; }
.tx th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tx td { padding: 9px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; font-size: 13.5px; }
.tx tr.clk { cursor: pointer; }
.tx tbody tr:hover { background: #faf6ee; }
.tx td small { display: block; color: var(--muted); font-size: 11.5px; }
.tx td.d b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tx td.ct b { font-weight: 600; }
.tx td.ct, .tx td.pt { max-width: 260px; }
.tx td.ct b, .tx td.pt { overflow-wrap: anywhere; }
.tx .num { text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx tr.openrow td { background: var(--surface-2); color: var(--ink-2); }
.more { padding: 14px; text-align: center; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid-t th, .grid-t td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--grid); font-size: 13.5px; white-space: nowrap; }
.grid-t thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.grid-t tbody th { font-weight: 600; }
.grid-t td { font-variant-numeric: tabular-nums; }
.grid-t td small, .grid-t th small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.grid-t tfoot th, .grid-t tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-2); }
.grid-t tr.clk { cursor: pointer; } .grid-t tbody tr:hover { background: #faf6ee; }
.grid-t td.wrap { white-space: normal; min-width: 200px; font-size: 12.5px; }
.cat-t .sub-r th { font-weight: 400; padding-right: 30px; color: var(--ink-2); }
.cat-t .sub-r td { color: var(--ink-2); font-size: 12.5px; }
.cat-t .cat-r th, .cat-t .cat-r td { border-top: 1px solid var(--line); background: #fdfaf3; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 7px; vertical-align: middle; }
.heat { font-size: 12.5px; }
.heat th, .heat td { padding: 7px 9px; border: 2px solid var(--surface); text-align: center; white-space: nowrap; }
.heat thead th, .heat tr:first-child th { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: normal; min-width: 66px; vertical-align: bottom; }
.heat th.sticky { position: sticky; right: 0; background: var(--surface); text-align: right; font-weight: 600; color: var(--ink); z-index: 1; min-width: 92px; }
.heat td { font-variant-numeric: tabular-nums; color: var(--ink); border-radius: 6px; }
.heat td.dk { color: #fff; font-weight: 600; }
.heat td.tot { background: var(--surface-2); font-weight: 700; }

/* ---------- דוחות ---------- */
.repgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.repcard { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 170px; }
.repcard:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(22, 35, 58, .1); border-color: var(--gold-2); }
.rc-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--gold-soft); color: #8a6516; margin-bottom: 4px; }
.repcard b { font-size: 16.5px; font-weight: 700; }
.repcard small { color: var(--muted); font-size: 13px; }
.rc-go { margin-top: auto; color: var(--inc-ink); font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink-2); min-height: 32px; }
.seg button.on { background: var(--navy); color: #fff; }
.seg.sm button { padding: 4px 10px; font-size: 13px; }
.print-head { display: none; }

/* ---------- הגדרות ---------- */
.edit-t th { text-align: right; font-size: 12px; color: var(--muted); padding: 6px 6px; font-weight: 600; white-space: nowrap; }
.edit-t td { padding: 4px 4px; }
.edit-t input, .edit-t select { width: 100%; min-width: 110px; }
.catcol h4 { font-size: 14px; margin-bottom: 8px; color: var(--ink-2); }
.catrow { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.catrow input { font-weight: 600; }
.catrow textarea { font-size: 13px; resize: vertical; }

/* ---------- חלונות ---------- */
.mback { position: fixed; inset: 0; z-index: 60; background: rgba(10, 18, 36, .5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 20px; width: min(580px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(760px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal header h2 { font-size: 19px; font-weight: 700; }
.txform .seg { margin: 4px 18px 6px; display: flex; }
.txform .seg button { flex: 1; min-height: 40px; font-weight: 600; }
.txform .seg button.inc.on { background: var(--inc-ink); }
.txform .seg button.exp.on { background: var(--exp-ink); }
.txform .seg button.trf.on { background: #4f4a68; }
.txform .seg button:disabled { cursor: default; }
.fbody { display: grid; gap: 12px; padding: 10px 18px 4px; }
.fbody label { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.fbody input, .fbody select { width: 100%; min-height: 46px; font-size: 16px; }
.fbody label small { color: var(--gold); font-size: 12.5px; font-weight: 600; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ferr { color: var(--neg); font-size: 13.5px; min-height: 18px; padding: 4px 18px 0; }
.modal footer { display: flex; gap: 8px; padding: 12px 18px 18px; position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--grid); }
.modal footer .btn.big { flex: 1; }
.bgm { padding-bottom: 18px; }
.bgm > p, .bgm > .btn, .bgm > .hint { margin-left: 18px; margin-right: 18px; }
.bgm > .btn { display: flex; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 8px 18px 14px; }
.bg-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.bg-grid figure > div { aspect-ratio: 16 / 10; background-size: cover; background-position: center; }
.bg-grid figcaption { font-size: 12px; padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; gap: 4px; color: var(--ink-2); overflow-wrap: anywhere; }
.menu { padding-bottom: 16px; }
.menu > .muted { padding: 0 18px 8px; }
.menu nav { display: grid; padding: 0 10px; }
.menu nav a, .menu nav button { display: flex; align-items: center; gap: 12px; padding: 13px 10px; border-radius: 11px; text-decoration: none; border: 0; background: none; font-size: 15px; text-align: right; cursor: pointer; color: var(--ink); }
.menu nav a:hover, .menu nav button:hover { background: var(--surface-2); }
.menu nav .ic { color: var(--gold); }

/* בועת מידע והודעות */
.tip { position: fixed; top: 0; left: 0; z-index: 80; display: none; pointer-events: none; background: #13233f; color: #fff; border-radius: 11px; padding: 8px 11px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 300px; }
.tt-h { font-weight: 700; margin-bottom: 4px; color: #f6ecd2; }
.tt-r { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 7px; line-height: 1.6; }
.tt-r i { width: 12px; height: 3px; border-radius: 2px; display: block; }
.tt-r i.none { background: transparent; }
.tt-r b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tt-r span { color: #b9c3d6; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: #13233f; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.warn { background: #8a3a12; }

/* ================= מסכים בינוניים ================= */
@media (max-width: 1180px) {
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================= טלפון ================= */
@media (max-width: 900px) {
  body { font-size: 14.5px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; background: #13233f; color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 8px; align-items: center; justify-content: space-between; }
  .tb-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .tb-brand .emblem { width: 36px; height: 36px; flex: none; }
  .tb-brand b { display: block; font-family: var(--serif); font-weight: 900; font-size: 18px; color: #f6ecd2; line-height: 1.1; }
  .tb-brand small { display: block; font-size: 11.5px; color: #c9b78a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: rgba(255, 253, 249, .97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11.5px; color: var(--muted); text-decoration: none; font-weight: 500; min-height: 56px; }
  .tabbar a.on { color: var(--navy); font-weight: 700; }
  .tabbar a.on .ic { color: var(--gold); }
  .tabbar .ic { width: 23px; height: 23px; }
  main { padding: 12px 12px calc(92px + env(safe-area-inset-bottom)); }
  .fab { display: grid; place-items: center; position: fixed; left: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; z-index: 21; background: linear-gradient(180deg, #c99a3b, #b0822a); color: #fff; box-shadow: 0 8px 22px rgba(176, 130, 42, .45); cursor: pointer; }
  .fab .ic { width: 26px; height: 26px; stroke-width: 2.2; }
  .ph h1 { font-size: 25px; }
  .ph-act .btn.gold { display: none; }
  .fbar { padding: 10px; gap: 8px; }
  .fb-f { flex: 1 1 140px; }
  .fb-f select, .fb-f input { min-width: 0; width: 100%; font-size: 16px; }
  .fb-info { margin: 0; font-size: 12px; width: 100%; }
  .banner { padding: 18px; min-height: 0; border-radius: 18px; }
  .bn-hero { text-align: right; width: 100%; }
  .bn-split { justify-content: flex-start; }
  .kpis, .kpis.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi b { font-size: 21px; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px; border-radius: 14px; }
  .hb-row { grid-template-columns: minmax(80px, 34%) minmax(0, 1fr) auto; gap: 8px; padding: 2px; }
  .hb-v { min-width: 82px; font-size: 13px; }
  .rc { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px; }
  .rc-k { display: none; }
  .srch { flex-basis: 100%; }
  .srch input { font-size: 16px; }
  .txf-row select { flex: 1 1 140px; min-width: 0; font-size: 16px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .chip { flex: none; }
  /* טבלת תנועות → כרטיסים */
  table.tx:not(.ledger) thead { display: none; }
  table.tx:not(.ledger) tr { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; grid-template-areas: "d ct num" "d pt pt" "ty kp kp"; gap: 3px 10px; padding: 10px 12px; border-bottom: 1px solid var(--grid); }
  table.tx:not(.ledger) td { padding: 0; border: 0; max-width: none; }
  table.tx:not(.ledger) td.d { grid-area: d; } table.tx:not(.ledger) td.ct { grid-area: ct; } table.tx:not(.ledger) td.num { grid-area: num; }
  table.tx:not(.ledger) td.pt { grid-area: pt; color: var(--ink-2); font-size: 12.5px; } table.tx:not(.ledger) td.ty { grid-area: ty; } table.tx:not(.ledger) td.kp { grid-area: kp; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
  table.tx:not(.ledger) td.sh, table.tx:not(.ledger) td.me { display: none; }
  table.tx:not(.ledger) td.pt small { display: inline; margin-right: 6px; }
  .ledger .ty, .ledger .pt { display: none; }
  .ledger th, .ledger td { padding: 8px 6px; font-size: 12.5px; }
  .kcards { grid-template-columns: minmax(0, 1fr); }
  .khero { padding: 16px; border-radius: 16px; }
  .repgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .repcard { min-height: 0; padding: 14px; border-radius: 15px; }
  .repcard small { display: none; }
  .rc-ic { width: 38px; height: 38px; }
  .repcard b { font-size: 14.5px; }
  .stk-r { grid-template-columns: 76px minmax(0, 1fr) auto; }
  /* חלונות כ"גיליון" מלמטה */
  .mback { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: 20px 20px 0 0; max-height: 94vh; padding-bottom: env(safe-area-inset-bottom); animation: sheet .24s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: .6; } }
  .modal header::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line-2); }
  .tip { max-width: 240px; }
  /* כניסה בטלפון: התמונה למעלה, הכרטיס למטה */
  .lg-wrap { align-items: flex-end; justify-content: center; padding: 34vh 12px calc(16px + env(safe-area-inset-bottom)); }
  .lg-shade { background: linear-gradient(to top, rgba(9, 17, 34, .96) 38%, rgba(9, 17, 34, .35) 70%, rgba(9, 17, 34, .15)); }
  .lg-card { padding: 20px 16px 16px; border-radius: 22px; }
  .lg-brand h1 { font-size: 30px; }
  .lg-brand .emblem { width: 50px; height: 50px; }
  .lg-dots { top: calc(20px + env(safe-area-inset-top)); bottom: auto; right: auto; left: 16px; }
  .lg-slide { background-position: center 22%; }
}
@media (max-width: 420px) {
  .kpi b { font-size: 19px; }
  .lg-bgbtn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lg-slide.on { animation: none; }
  .lg-card, .modal, .mback { animation: none; }
  * { transition: none !important; }
}

/* ================= הדפסה ================= */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11.5px; }
  .side, .topbar, .tabbar, .fab, .ph-act, .fbar, .back, .hint, .seg, .srch, #toast, .tip, .more { display: none !important; }
  .app { display: block; }
  main { padding: 0; }
  .print-head { display: block; border-bottom: 2px solid #13233f; padding-bottom: 6px; margin-bottom: 10px; font-size: 13px; }
  .print-head b { font-family: var(--serif); font-size: 18px; }
  .print-head span { display: block; color: #555; font-size: 11.5px; }
  .ph h1 { font-size: 22px; }
  .card, .kpi, .kcard { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .banner, .khero { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .tbl-wrap { overflow: visible; }
  .heat td, .hb-t i, .hstack i, .kbar i, .tag, .kchip, .dot, .lg-i i { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .grid-t th, .grid-t td { padding: 4px 6px; font-size: 11px; }
  .g-2, .g-2-1 { grid-template-columns: 1fr 1fr; }
}
