/* ==========================================================================
   מוזס · פרוייקטים — עיצוב: כחול-לילה (סרגל), זהב (פעולה ראשית), נייר חם (רקע). בלי גופנים חיצוניים.
   ========================================================================== */
:root {
  --ink: #1d2733; --muted: #6b7280; --paper: #f3f1ec; --card: #fff; --line: #e3ded3; --line2: #efebe3;
  --brand: #1f3b57; --brand-2: #2c5379; --gold: #e8b04b; --gold-d: #c9912c;
  --ok: #1f7a4d; --ok-bg: #e6f4ec; --bad: #b42318; --bad-bg: #fdecea; --warn: #9a6400; --warn-bg: #fff4dd; --info-bg: #e9f0f8;
  --r: 10px; --sh: 0 1px 2px rgba(20, 30, 40, .06), 0 4px 14px rgba(20, 30, 40, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 "Segoe UI", "Rubik", Arial, sans-serif; }
body.has-modal { overflow: hidden; }
a { color: var(--brand-2); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 19px; margin: 0; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.sm, small { font-size: 13px; }
.center { text-align: center; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.pre { white-space: pre-wrap; }
.boot { padding: 80px 20px; text-align: center; color: var(--muted); font-size: 18px; }

/* ---------- כפתורים ושדות ---------- */
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 7px 14px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.btn:hover { border-color: #cfc7b8; background: #fbfaf7; }
.btn.pri { background: var(--gold); border-color: var(--gold-d); color: #1d2733; font-weight: 600; }
.btn.pri:hover { background: #f0bd5e; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 11px 18px; font-size: 16px; width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #d6cfc2; border-radius: 8px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(232, 176, 75, .55); border-color: var(--gold-d); }
input:disabled, select:disabled, textarea:disabled { background: #f7f5f0; color: #444; }
textarea { width: 100%; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: middle; }
.f { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.f > input, .f > select, .f > textarea { font-size: 15px; color: var(--ink); width: 100%; }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.w8 { width: 8em; } .w14 { width: 14em; } .grow { flex: 1 1 220px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
.grid .w2 { grid-column: span 2; } .grid .full { grid-column: 1 / -1; }
.sel { user-select: all; background: var(--info-bg); padding: 1px 6px; border-radius: 5px; }

/* ---------- מסגרת ---------- */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; cursor: pointer; white-space: nowrap; }
.brand i { color: var(--gold); font-style: normal; }
.tabs { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.tab { font: inherit; background: none; border: 0; color: #d7e1ec; padding: 7px 11px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.tab:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tab.on { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
.cnt { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: #1d2733; font-size: 12px; text-align: center; }
.who { display: flex; gap: 8px; align-items: center; }
.me { font: inherit; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); color: #fff; border-radius: 18px; padding: 5px 12px; cursor: pointer; white-space: nowrap; }
.btn.new { background: var(--gold); border-color: var(--gold-d); color: #1d2733; font-weight: 600; }
main { padding: 16px 18px 80px; max-width: 1700px; margin: 0 auto; }
.viewbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 40; background: #5a3d0c; color: #fff; padding: 10px 16px; text-align: center; display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
body.viewing header.top { background: #5a3d0c; }
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bar h1 { flex: 0 1 auto; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-inline-start: auto; }
.card .acts, p.acts { margin-inline-start: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); margin-bottom: 12px; }
.card.note { background: var(--info-bg); border-color: #cfdcec; box-shadow: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cards .card { margin: 0; }
.click { cursor: pointer; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; }
.subtabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subtabs button { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.subtabs button.on { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }
.selbar:empty { display: none; }
.selcard { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff8e8; border-color: #efd9a8; position: sticky; top: 56px; z-index: 5; }

/* ---------- טבלה ---------- */
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th { position: sticky; top: 0; background: #f8f6f1; text-align: start; font-weight: 600; font-size: 13px; color: #4b5563; padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.tbl th.sorted { color: var(--ink); }
.tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line2); vertical-align: top; white-space: nowrap; }
.tbl td.wrapc { white-space: normal; min-width: 140px; max-width: 320px; }
.tbl .num { text-align: end; }
.tbl tr.click:hover td { background: #fbf8f1; }
.tbl tr.warnrow td:first-child { box-shadow: inset -3px 0 0 var(--warn); }
.tbl tr.minusrow td:first-child { box-shadow: inset -3px 0 0 var(--bad); }
.tbl tfoot td { background: #f8f6f1; font-weight: 600; border-top: 2px solid var(--line); }
.tbl .empty { text-align: center; color: var(--muted); padding: 22px; }
.tbl .selc { width: 34px; text-align: center; }
.tbl .sm { font-size: 12px; color: var(--muted); }
.clip { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.clip3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 4px 0; }
.mn { font-variant-numeric: tabular-nums; }
.more { text-align: center; margin: 10px 0; display: flex; gap: 8px; justify-content: center; }
.pj { color: var(--brand); }
.pno { background: var(--brand); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 16px; }

/* ---------- תגיות ---------- */
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eef0f3; color: #374151; white-space: nowrap; margin-inline-start: 3px; }
.chip.st-paid, .chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.st-open, .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.st-part, .chip.soon { background: #fff1d6; color: #8a5a00; }
.chip.st-over { background: #ede7fb; color: #5b3fa8; }
.chip.acc { background: #e9eefb; color: #2f4a9a; }
.chip.biz { background: #f1ece2; color: #6b5527; }
.chip.chk, .chip.pend { background: var(--info-bg); color: var(--brand-2); }
.chip.mail { background: #e8f3ff; color: #1b5e9e; }
.chip.ps-פעיל { background: var(--ok-bg); color: var(--ok); } .chip.ps-הסתיים { background: #eef0f3; } .chip.ps-רדום { background: var(--warn-bg); color: var(--warn); } .chip.ps-בוטל { background: var(--bad-bg); color: var(--bad); }
.pct { display: inline-flex; align-items: center; gap: 6px; }
.pct i { display: inline-block; width: 70px; height: 7px; border-radius: 4px; background: #ece7dc; position: relative; overflow: hidden; }
.pct i::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--w, 0); background: var(--ok); border-radius: 4px; }
.pct.near i::after { background: var(--gold-d); } .pct.over i::after { background: var(--bad); }
.pct b { font-weight: 500; font-size: 12px; }

/* ---------- כרטיסי סיכום ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpis.sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 2px; text-align: start; font: inherit; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 21px; font-weight: 700; }
.kpi small { color: var(--muted); }
.kpi.bad { border-color: #f1c4bf; background: #fff8f7; } .kpi.bad b { color: var(--bad); }
.kpi.good b { color: var(--ok); }
.kpi.warn { border-color: #f0d9a8; background: #fffbf2; }
.kpi.click:hover { border-color: var(--gold-d); cursor: pointer; }
.alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.alert-i { font: inherit; text-align: start; background: #fff; border: 1px solid var(--line); border-inline-start: 4px solid var(--brand-2); border-radius: 8px; padding: 9px 12px; cursor: pointer; }
.alert-i.bad { border-inline-start-color: var(--bad); background: #fffafa; }
.alert-i.warn { border-inline-start-color: var(--gold-d); background: #fffcf4; }
.alert-i:hover { box-shadow: var(--sh); }
.alert { background: var(--warn-bg); border: 1px solid #f0d9a8; border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.duplist { margin: 6px 0; padding-inline-start: 18px; }
.acc .row, .paycard .row, .ibx .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; }
.acc .row.big { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.acc h3, .paycard h3 { margin: 0; }
.lnkbig { display: inline-block; padding: 4px 0; font-size: 15px; }

/* ---------- חלונות ---------- */
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 38, .45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: min(720px, 100%); padding: 16px 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.modal.wide { width: min(1100px, 100%); }
.modal.xwide { width: min(1400px, 100%); }
.mh { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mh .x { font: inherit; font-size: 20px; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 8px; }
.mf { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.stamp { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.segb { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; background: #fff; display: inline-flex; gap: 6px; align-items: center; }
.segb.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.segb input { display: none; }
.more-f summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 4px 0; }
.payrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--line2); border-radius: 8px; margin-bottom: 6px; background: #fcfbf8; }
.payrow .stamp { flex-basis: 100%; margin: 0; }
.dropz { border: 2px dashed #ddd5c6; border-radius: 10px; padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dropz.over, [data-drop].over { border-color: var(--gold-d); background: #fff8e8; }
.files { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.file { display: inline-block; background: var(--info-bg); border-radius: 6px; padding: 3px 9px; text-decoration: none; font-size: 13px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file.pend { background: var(--warn-bg); }
.ibsplit { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.ibprev iframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #f7f5f0; }
.ibform .seg { margin-bottom: 12px; }
.ibform .grid { grid-template-columns: 1fr 1fr; }
.mailtxt { white-space: pre-wrap; background: #fafafa; border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-height: 200px; font: inherit; }
.pick { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.pickrow { font: inherit; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; cursor: pointer; }
.pickrow:hover { border-color: var(--gold-d); background: #fffbf2; }
.perms td.lv { text-align: center; font-size: 13px; }
.perms .lv0 { color: #b0b4ba; } .perms .lv1 { color: var(--brand-2); } .perms .lv2 { color: var(--ok); font-weight: 600; }
.docrow { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.tasks .cur { background: #fff8e8; }
.tasks td.num { text-align: center; }
.inbox .ibx { display: flex; flex-direction: column; gap: 2px; }

/* ---------- כניסה ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--brand) 0 38%, var(--paper) 38%); }
.login-box { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 26px; text-align: center; }
.login-box img { margin: 0 auto; }
.login-box .f { text-align: start; }
.err { color: var(--bad); min-height: 1.2em; margin: 0; }

#toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%) translateY(30px); opacity: 0; transition: .2s; background: #1d2733; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 90; max-width: 90vw; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(50%) translateY(0); }
#toast.err { background: var(--bad); }

/* ---------- טלפון ---------- */
@media (max-width: 900px) {
  header.top { flex-wrap: wrap; padding: 8px 10px; }
  .tabs { order: 3; flex-basis: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ibsplit { grid-template-columns: 1fr; }
  .ibprev iframe { height: 45vh; }
}
@media (max-width: 560px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  header.top { position: static; }
  main { padding: 12px 10px 80px; }
  .grid { grid-template-columns: 1fr; }
  .grid .w2 { grid-column: auto; }
  .brand span { display: none; }
  .modal { padding: 12px; border-radius: 10px; }
  .ov { padding: 8px 6px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 17px; }
  .docrow { grid-template-columns: 1fr; }
  .w14 { width: 100%; }
}
@media print {
  header.top, .acts, .filters, .subtabs, .more, .viewbar { display: none !important; }
  body { background: #fff; }
  .tbl-wrap { box-shadow: none; border: 0; }
}
