:root {
  --navy: #14213d;
  --navy-2: #1f3260;
  --red: #c1121f;
  --gold: #fca311;
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #1b1f29;
  --muted: #667085;
  --line: #e3e6ee;
  --ok: #157347;
  --ok-bg: #e7f5ee;
  --warn: #b54708;
  --warn-bg: #fef3e2;
  --danger-bg: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", Arial, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--navy-2); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- כותרת: טאבים של עסקים + ניווט ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 10px 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .nav::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  background: transparent; color: #c9d1e6;
  border: 0; border-radius: 10px 10px 0 0;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--bg); color: var(--navy); }
.tab.add { color: var(--gold); font-size: 20px; padding: 6px 14px; }
.nav {
  display: flex; gap: 4px; overflow-x: auto; background: var(--bg);
  padding: 8px 8px; border-bottom: 1px solid var(--line);
}
.nav a {
  flex: 0 0 auto; text-decoration: none; color: var(--navy);
  padding: 7px 12px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
}
.nav a.active { background: var(--navy); color: #fff; }

main { max-width: 1100px; margin: 0 auto; padding: 14px 12px 90px; }

/* ---------- כרטיסים ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.badge {
  display: inline-block; background: var(--navy); color: #fff; border-radius: 999px;
  font-size: 12.5px; padding: 1px 9px; font-weight: 600; vertical-align: middle;
}
.badge.red { background: var(--red); }
.badge.gray { background: #98a2b3; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: #eef1f7; color: var(--navy-2); }
.tag.sim { background: var(--warn-bg); color: var(--warn); }
.banner { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14.5px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: #eaf1ff; color: var(--navy-2); }

/* ---------- טבלאות עם גלילה ---------- */
.scroll-box { max-height: 470px; overflow-y: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8f9fc; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafbfe; }
td.num { white-space: nowrap; }
.empty { padding: 22px; text-align: center; color: var(--muted); }
.docs-list { margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.docs-list li { white-space: nowrap; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; min-width: 200px; }
.btn-with-hint { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.btn-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* בטלפון: כל שורה הופכת לכרטיס */
@media (max-width: 760px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
  table.responsive td { border: 0; padding: 4px 8px; display: flex; gap: 10px; }
  table.responsive td::before {
    content: attr(data-label); flex: 0 0 105px; color: var(--muted); font-size: 13px; font-weight: 600;
  }
  table.responsive td.actions-cell { display: flex; }
  table.responsive td.actions-cell::before { display: none; }
  .scroll-box { max-height: 560px; }
}

/* ---------- טפסים ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13.5px; font-weight: 600; color: #344054; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text);
  border: 1px solid #cfd4dc; border-radius: 9px; padding: 9px 11px; background: #fff; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db4ea; border-color: #6c8bd8; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14.5px; font-weight: 600; border-radius: 9px; border: 1px solid transparent;
  padding: 9px 14px; cursor: pointer; text-decoration: none; background: var(--navy); color: #fff;
  min-height: 40px; white-space: nowrap;
}
.btn:hover { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--navy); border-color: #cfd4dc; }
.btn.secondary:hover { background: #f4f6fb; }
.btn.red { background: var(--red); }
.btn.green { background: var(--ok); }
.btn.wa { background: #1f9d55; }
.btn.small { font-size: 13px; padding: 6px 10px; min-height: 34px; }
.btn.block { width: 100%; }
.btn:disabled { background: #e4e7ec; color: #98a2b3; border-color: #e4e7ec; cursor: not-allowed; }
.btn.done:disabled { background: var(--ok-bg); color: var(--ok); border-color: #b7e2cb; }
.link-btn { background: none; border: 0; color: var(--navy-2); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* ---------- כניסה ---------- */
.auth { max-width: 380px; margin: 9vh auto; padding: 0 14px; }
.auth .card { padding: 22px; }
.auth h1 { text-align: center; }
.auth .logo { width: 64px; height: 64px; display: block; margin: 0 auto 12px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 44px; }
.pw-eye {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; font-size: 18px; line-height: 1; padding: 6px; cursor: pointer; border-radius: 6px;
}
.pw-eye:hover { background: #f0f2f7; }
.divider { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0; }

/* ---------- הצעת מחיר ---------- */
.price-line { display: grid; grid-template-columns: 1fr 120px 1fr auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.price-line .total-pick { font-size: 12.5px; display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.price-line .total-pick input { width: auto; }
@media (max-width: 760px) {
  .price-line { grid-template-columns: 1fr 100px; }
  .price-line .note-input { grid-column: 1 / -1; }
}
.preview-wrap { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.preview-frame { width: 794px; height: 1123px; border: 0; background: #fff; transform-origin: top right; display: block; }
a[href^="tel:"] { white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.logo-preview { max-width: 100%; max-height: 120px; border-radius: 8px; display: block; margin-top: 6px; }
.customer-hit { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 8px 10px; font-size: 14px; }

/* ---------- חלון קופץ + הודעות ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto;
}
@media (min-width: 761px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 16px; }
}
.modal .row.end { margin-top: 14px; }
#toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60;
  font-size: 15px; max-width: 92vw; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); display: none;
  pointer-events: none; /* ההודעה לא חוסמת לחיצה על כפתורים שמתחתיה */
}
#toast.show { display: block; }
#toast.error { background: var(--red); }
.files-list { list-style: none; padding: 0; margin: 0; }
.files-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.expiring { color: var(--red); font-weight: 600; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
