/* Change CRM — עיצוב פינטק מודרני. Heebo מקומי (CSP), RTL, סרגל צד כהה. */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/static/fonts/heebo-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/static/fonts/heebo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF;
}

* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #16233a;
  --muted: #64748f;
  --line: #e5eaf2;
  --line-soft: #eef2f8;
  --accent: #2e6be6;
  --accent-ink: #ffffff;
  --accent-soft: #eaf1fd;
  --navy: #0f1b2d;
  --navy-2: #16273f;
  --ok: #0e9f6e;   --ok-bg: #e7f7f0;
  --warn: #9a6700; --warn-bg: #fdf4dc;
  --err: #d92d20;  --err-bg: #fdecea;
  --shadow: 0 1px 2px rgba(15,27,45,.05), 0 4px 16px rgba(15,27,45,.06);
  --radius: 14px;
}
html { direction: rtl; }
body {
  font-family: 'Heebo', 'Segoe UI', Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- שלד: סרגל צד + תוכן ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 224px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, #0c1626 100%);
  color: #c6d3e6;
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding: 2px 8px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #2e6be6, #17b8a6);
  color: #fff; font-weight: 800; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(46,107,230,.35);
}
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: .01em; }
.side-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 10px; padding: 9px 12px; margin: 0 4px 14px;
  font-weight: 600; font-size: 14px;
  transition: filter .15s;
}
.side-cta:hover { filter: brightness(1.12); }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-cap {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; color: #5f7291;
  padding: 14px 10px 4px;
}
.side nav a {
  display: flex; align-items: center; gap: 10px;
  color: #b4c3d9; text-decoration: none;
  padding: 8px 10px; border-radius: 9px; font-size: 14px; font-weight: 500;
  transition: background .12s, color .12s;
}
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.active { background: rgba(46,107,230,.22); color: #fff; font-weight: 600; }
.side svg, .side-cta svg, .logout svg {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.side-user {
  display: flex; align-items: center; gap: 6px;
  border-top: 1px solid rgba(255,255,255,.09);
  margin-top: 12px; padding-top: 12px;
}
.user-chip { display: flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; flex: 1; min-width: 0; padding: 4px 6px; border-radius: 9px; }
.user-chip:hover { background: rgba(255,255,255,.06); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #31548f, #1f3a63); color: #dbe7f8;
  font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta b { color: #eef3fa; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: #7e91ac; font-size: 11.5px; }
.logout { background: none; border: 0; color: #7e91ac; cursor: pointer; padding: 8px; border-radius: 8px; }
.logout:hover { color: #ff9a8f; background: rgba(255,255,255,.06); }

.main { flex: 1; min-width: 0; }
.page { max-width: 1160px; margin: 0 auto; padding: 28px 28px 48px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 18px; text-wrap: balance; }
h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 12px; }

/* ---------- מסכי הזדהות ---------- */
.auth-bg {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(46,107,230,.16), transparent 60%),
    radial-gradient(700px 420px at 10% 110%, rgba(23,184,166,.12), transparent 60%),
    var(--bg);
}
.auth-page { max-width: 460px; margin: 0 auto; padding: 48px 20px; }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 19px; font-weight: 700; margin-bottom: 22px; }
.card.auth { max-width: 460px; margin: 0; padding: 28px; }
.card.auth h1 { font-size: 21px; }
.card.auth .btn { width: 100%; margin-top: 4px; }

/* ---------- כרטיסים ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 18px; overflow-x: auto;
  box-shadow: var(--shadow);
}
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }

/* ---------- אריחי סטטיסטיקה ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  border-inline-start: 3px solid var(--accent);
}
.tile .k { color: var(--muted); font-size: 12.5px; font-weight: 500; letter-spacing: .02em; }
.tile .v { font-size: 24px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- טבלאות ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
td { font-variant-numeric: tabular-nums; }
tbody tr:hover td, table tr:hover td { background: #f8fafd; }
tr.canceled td { opacity: .42; text-decoration: line-through; }
table.kv th { width: 130px; text-transform: none; letter-spacing: 0; font-size: 13px; }
.neg { color: var(--err); font-weight: 700; }
.pos { color: var(--ok); font-weight: 600; }
.buy { color: var(--ok); font-weight: 600; }
.sell { color: #b45309; font-weight: 600; }

/* ---------- טפסים ---------- */
form label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 9px 12px; margin-top: 5px;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,107,230,.15);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 .full { grid-column: 1 / -1; }
label.chk { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 400; font-size: 14px; }
label.chk input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
input.mini { width: 74px; padding: 6px 8px; }
input.mini-w { width: 140px; display: inline-block; padding: 6px 9px; margin: 0 4px; }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 10px 18px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 2px rgba(15,27,45,.12);
  transition: filter .13s, transform .08s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 6px 13px; font-size: 13px; border-radius: 9px; }
.btn.big { font-size: 16px; padding: 12px 26px; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); background: var(--accent-soft); filter: none; }
.btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 500; padding: 0 4px; }
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--err); }
a { color: var(--accent); }

/* ---------- התראות, תגיות ---------- */
.alert { border-radius: 11px; padding: 11px 15px; margin-bottom: 12px; font-size: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: #0b6b4c; border-color: #c4ebda; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f3e3b3; }
.alert.err { background: var(--err-bg); color: var(--err); border-color: #f7cdc7; }
.alert a { color: inherit; font-weight: 700; }
.badge { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.badge.err { background: var(--err-bg); color: var(--err); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.center { text-align: center; }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
form.inline { display: inline-flex; gap: 8px; align-items: center; }
.quote { background: var(--accent-soft); border: 1px solid #d5e3fa; border-radius: 11px; padding: 14px; margin: 10px 0; font-size: 15px; min-height: 20px; font-variant-numeric: tabular-nums; }
.quote .big { font-size: 18px; font-weight: 700; }
.handle { margin-top: 8px; }
code { background: var(--line-soft); padding: 2px 7px; border-radius: 6px; direction: ltr; display: inline-block; font-size: 12.5px; }

/* ---------- שערים חיים: גלגל ספירה לאחור + הבהוב שינוי ---------- */
.live-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex-shrink: 0; }
.live-ring-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.live-ring-wrap .ring-bg { fill: none; stroke: #c4ebda; stroke-width: 2.5; }
.live-ring-wrap .ring-progress { fill: none; stroke: var(--ok); stroke-width: 2.5; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.live-ring-wrap b { font-size: 9.5px; font-variant-numeric: tabular-nums; color: var(--ok); }
@keyframes tickUp { 0% { background: #c9f3de; } 100% { background: transparent; } }
@keyframes tickDown { 0% { background: #fbd9d3; } 100% { background: transparent; } }
td.tick-up { animation: tickUp 1.6s ease-out; color: var(--ok); font-weight: 700; }
td.tick-down { animation: tickDown 1.6s ease-out; color: var(--err); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { td.tick-up, td.tick-down { animation: none; } }

/* ---------- קבלות ומסמכים להדפסה ---------- */
.receipt { max-width: 720px; }
.receipt-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; flex-wrap: wrap; }
@media print {
  .side, .no-print, .tabbar, .more-overlay { display: none !important; }
  body { background: #fff; font-size: 13px; }
  .shell { display: block; }
  .page { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- תפריט "עוד" וסרגל טאבים — מוסתרים בדסקטופ ---------- */
.tabbar { display: none; }
.more-overlay { display: none; }

/* ---------- מובייל: חוויית אפליקציה — פס עליון מינימלי + טאבים תחתונים ---------- */
@media (max-width: 820px) {
  body { font-size: 14.5px; }
  .shell { flex-direction: column; }

  /* פס עליון: רק לוגו ושם העסק */
  .side {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 40;
    flex-direction: row; align-items: center; justify-content: center;
    padding: 10px 14px; overflow: visible;
  }
  .brand { padding: 0; }
  .side-cta, .side nav, .side-user { display: none; }

  /* תוכן: מקום לסרגל התחתון */
  .page { padding: 16px 12px calc(86px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; margin-bottom: 14px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 13px 14px; }
  .tile .v { font-size: 19px; }
  .cols { gap: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: 12px; }
  th, td { padding: 9px 8px; font-size: 13px; }
  input, select, textarea { padding: 11px 12px; font-size: 16px; } /* 16px מונע זום אוטומטי ב-iOS */
  .btn { padding: 12px 18px; }
  .btn.sm { padding: 8px 13px; }
  form .btn:not(.sm):not(.ghost) { width: 100%; }
  .row-actions { gap: 8px; }
  .auth-page { padding: 26px 14px; }

  /* סרגל טאבים תחתון */
  .tabbar {
    display: flex; position: fixed; bottom: 0; right: 0; left: 0; z-index: 50;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; align-items: flex-end;
    box-shadow: 0 -4px 16px rgba(15,27,45,.07);
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: 0; font: inherit; cursor: pointer;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
    padding: 4px 2px; min-width: 0;
  }
  .tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .active { color: var(--accent); }
  .tabbar .tab-cta { flex: 0 0 66px; }
  .tab-cta-btn {
    width: 52px; height: 52px; border-radius: 50%; margin-top: -22px;
    background: linear-gradient(135deg, #2e6be6, #17b8a6); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(46,107,230,.4); border: 3px solid var(--card);
  }
  .tab-cta-btn svg { width: 26px; height: 26px; stroke-width: 2.2; }

  /* תפריט "עוד" — יריעת מסך מלא */
  .more-overlay {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: var(--bg); overflow-y: auto;
    transform: translateY(100%); transition: transform .22s ease-out;
    padding: 16px 16px calc(30px + env(safe-area-inset-bottom));
  }
  .more-overlay.open { transform: translateY(0); }
  @media (prefers-reduced-motion: reduce) { .more-overlay { transition: none; } }
  .more-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
  .more-head b { font-size: 19px; }
  .more-close { background: var(--card); border: 1px solid var(--line); border-radius: 50%;
    width: 38px; height: 38px; font-size: 16px; cursor: pointer; color: var(--muted); }
  .more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .more-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 18px 8px 14px; text-decoration: none; color: var(--ink);
    font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
  }
  .more-grid a span { font-size: 26px; }
  .more-logout { margin-top: 18px; text-align: center; }
  .more-logout .btn { width: 100%; }
}

/* סימון שדה חובה, וטבלה רחבה שגוללת בתוך עצמה במקום לדחוף את העמוד */
.req { color: var(--err); font-weight: 700; }
.scroll-x { overflow-x: auto; }
