:root {
  --card: #ffffff;
  --ink: #1a1212;
  --muted: #6b6b6b;
  --line: #e7e2e2;
  --brand: #c41019;        /* אדום TSM */
  --brand-dark: #7a0a0e;   /* בורדו כהה */
  --brand-light: #fdecec;
  --good: #16a34a;
  --warn: #d97706;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Heebo", Arial, sans-serif;
  background: #f6f3f3;
  color: var(--ink);
}

header {
  background: #ffffff;
  color: var(--ink);
  padding: 16px 28px 0;
  border-top: 4px solid var(--brand);
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
/* לוגו משמאל, כותרת מימין */
.brand { display: flex; align-items: center; gap: 16px; direction: ltr; }
.logo { height: 58px; width: auto; display: block; }
.brand-text { direction: rtl; text-align: right; margin-left: auto; }
header h1 { margin: 0; font-size: 21px; color: var(--brand-dark); }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 4px; margin-top: 14px; }
.tab {
  background: transparent; border: none; color: var(--muted);
  padding: 12px 20px; font-size: 15px; cursor: pointer;
  border-bottom: 3px solid transparent; font-family: inherit;
}
.tab:hover { color: var(--brand-dark); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 700; }

main { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--card); border-radius: 14px; padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 6px; }
input, select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; font-family: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
select { cursor: pointer; }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
button.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border: none; padding: 11px 28px;
  border-radius: 9px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  box-shadow: 0 2px 8px rgba(196,16,25,.3);
}
button.primary:hover { filter: brightness(1.08); }
.wm-badge { color: var(--muted); font-size: 14px; }
.wm-badge b { color: var(--ink); }

/* סרגל מיון תוצאות */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 4px 2px 14px; flex-wrap: wrap;
}
.toolbar .count { color: var(--muted); font-size: 14px; font-weight: 600; }
.sort-label { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.sort-label select { padding: 8px 12px; }

/* תוצאות הצעת מחיר */
.result {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 12px; display: grid;
  grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.result:hover { border-color: var(--brand); }
.result.best { border: 2px solid var(--good); }
.result.selected { border: 2px solid var(--brand); box-shadow: 0 4px 16px rgba(196,16,25,.18); }
.pick-hint { font-size: 11px; color: var(--brand); margin-top: 6px; font-weight: 600; }

/* תפריט נפתח: פרטים + תנאי מכר */
.expander { margin: -6px 2px 14px; }
.exp-inner {
  background: #fff; border: 1px solid var(--brand); border-top: none;
  border-radius: 0 0 12px 12px; padding: 18px; box-shadow: var(--shadow);
}
.exp-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 10px; margin-bottom: 16px; }
.exp-details > div { background: #f8f6f6; border-radius: 8px; padding: 8px 12px; }
.exp-details span { display: block; font-size: 11px; color: var(--muted); }
.exp-details b { font-size: 14px; }

.term-pick { display: flex; align-items: center; gap: 10px; padding-top: 4px; border-top: 1px dashed var(--line); }
.term-q { font-weight: 700; font-size: 14px; }
.term-btn {
  padding: 9px 24px; border: 2px solid var(--line); background: #fff; border-radius: 9px;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--muted);
}
.term-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.term-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.term-out { margin-top: 14px; }
.term-result { background: var(--brand-light); border-radius: 9px; padding: 14px 16px; }
.tr-line { font-size: 14px; margin-bottom: 8px; }
.grand { font-size: 18px; }
.grand b, .exw-table .sum td { color: var(--brand-dark); font-weight: 800; }
.exw-table { width: auto; min-width: 280px; border-collapse: collapse; }
.exw-table td { padding: 7px 14px; border-bottom: 1px solid #f0dada; font-size: 15px; }
.exw-table td:last-child { text-align: left; font-weight: 600; }
.exw-table .sum td { font-size: 18px; border-bottom: none; border-top: 2px solid var(--brand); }
.exw-table .ph { color: var(--warn); font-size: 11px; }
.ph-note { margin-top: 10px; font-size: 12px; color: var(--warn); background: #fff7ed; padding: 8px 12px; border-radius: 8px; }
.rank { font-size: 20px; font-weight: 700; color: var(--muted); text-align: center; }
.result.best .rank { color: var(--good); }
.r-main .agent { font-size: 17px; font-weight: 700; }
.r-main .route { color: var(--muted); font-size: 13px; margin-top: 3px; }
.r-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.r-meta span { background: #f1f5f9; padding: 3px 9px; border-radius: 20px; }
.r-price { text-align: left; }
.r-price .total { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.r-price .break { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.best-tag { display: inline-block; background: var(--good); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 6px; margin-inline-start: 8px; }

/* טבלאות */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #f8fafc; }

.search { width: 100%; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13px; }

.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
}
.list-row .li-title { font-weight: 700; }
.list-row .li-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.li-actions { display: flex; gap: 8px; }
.btn-sm { background: #f1f5f9; border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-sm:hover { background: #e2e8f0; }
.btn-sm.danger { color: #dc2626; }

.agent-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.agent-card .name { font-weight: 700; font-size: 15px; }
.agent-card .loc { color: var(--brand-dark); font-size: 13px; }
.agent-card .det { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.6; white-space: pre-line; }
.agent-card a { color: var(--brand); }

.dropzone {
  border: 2px dashed var(--brand); border-radius: 12px; padding: 40px;
  text-align: center; color: var(--muted); cursor: pointer; background: #f8fbfe;
}
.dropzone.drag { background: #e0f2fe; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.toast { padding: 12px 16px; border-radius: 9px; margin-top: 14px; font-size: 14px; }
.toast.ok { background: #dcfce7; color: #166534; }
.toast.err { background: #fee2e2; color: #991b1b; }
.spinner { color: var(--muted); padding: 14px; }

/* ====== חלון בניית הצעת מחיר (מודאל) ====== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,10,10,.55); display: none;
  align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto;
}
.modal-box {
  background: #f8f6f6; border-radius: 16px; width: 100%; max-width: 920px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); padding: 0 0 22px; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; padding: 16px 22px;
}
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-close {
  background: rgba(255,255,255,.18); border: none; color: #fff; width: 34px; height: 34px;
  border-radius: 8px; font-size: 17px; cursor: pointer;
}
.modal-close:hover { background: rgba(255,255,255,.32); }

/* פרטי הובלה ימית */
.b-ocean { background: #fff; margin: 18px; border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.bo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.bo-tag { background: var(--brand-light); color: var(--brand-dark); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.bo-agent { font-size: 18px; font-weight: 800; }
.bo-price { margin-inline-start: auto; font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.bo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
.bo-grid > div { background: #f8f6f6; border-radius: 8px; padding: 8px 12px; }
.bo-grid span { display: block; font-size: 11px; color: var(--muted); }
.bo-grid b { font-size: 14px; }

/* שני הצדדים */
.b-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 18px; }
.b-col { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.b-col h3 { margin: 0 0 14px; font-size: 16px; color: var(--brand-dark); }
.il-port-line { font-size: 14px; margin-bottom: 10px; }
.il-city-lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.seg-out { margin-top: 14px; }
.seg-note { background: var(--brand-light); border-radius: 8px; padding: 12px 14px; font-size: 14px; }

.il-table, .final-table { width: 100%; border-collapse: collapse; }
.il-table td { padding: 7px 10px; border-bottom: 1px solid #f0dada; font-size: 14px; }
.il-table td:last-child { text-align: left; font-weight: 600; }
.il-table .sum td { font-weight: 800; color: var(--brand-dark); border-bottom: none; border-top: 2px solid var(--brand); font-size: 16px; }

/* מחיר סופי */
.b-final { background: #fff; margin: 16px 18px 0; border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); border: 2px solid var(--brand); }
.b-final h3 { margin: 0 0 12px; font-size: 17px; }
.final-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.final-table td:last-child { text-align: left; font-weight: 600; }
.final-table .grand td { font-size: 21px; font-weight: 800; color: var(--brand-dark); border-bottom: none; border-top: 2px solid var(--brand); }
.cur-note { margin-top: 10px; font-size: 12px; color: var(--muted); }

@media (max-width: 680px) { .b-cols { grid-template-columns: 1fr; } }

/* ====== בונה הצעת מחיר ====== */
.b-footer { margin: 18px 18px 0; text-align: center; }
.primary.big { font-size: 16px; padding: 13px 36px; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.ghost-btn {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4); color: #fff;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.ghost-btn:hover { background: rgba(255,255,255,.32); }
.modal-box.wide { max-width: 1120px; }

.prop-layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; padding: 18px; }
.prop-panel { background: #fff; border-radius: 12px; padding: 16px; box-shadow: var(--shadow); align-self: start; }
.prop-panel h3 { margin: 16px 0 8px; font-size: 14px; color: var(--brand-dark); border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.prop-panel h3:first-child { margin-top: 0; }
.prop-panel label { margin-bottom: 10px; }
.prop-panel textarea { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-family: inherit; font-size: 14px; resize: vertical; }

.prop-preview { background: #e9e5e5; border-radius: 12px; padding: 20px; overflow: auto; }

/* מסמך ההצעה */
.doc {
  background: #fff; max-width: 760px; margin: 0 auto; padding: 40px 46px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12); font-size: 13.5px; line-height: 1.7; color: #1a1212;
}
.doc p { margin: 7px 0; }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; direction: ltr; margin-bottom: 18px; }
.doc-logo { height: 56px; width: auto; }
.doc-date { direction: rtl; color: #444; font-size: 13px; }
.doc-to { margin-bottom: 12px; }
.doc-strong { font-weight: 800; font-size: 15px; }
.doc-subject { font-weight: 800; font-size: 15px; margin: 14px 0; text-decoration: underline; }
.doc-section-title { font-weight: 800; margin: 16px 0 6px; color: var(--brand-dark); }
.doc-table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.doc-table td { padding: 6px 10px; border-bottom: 1px solid #eee; }
.doc-table td:last-child { text-align: left; font-weight: 700; white-space: nowrap; }
.doc-summary { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc-summary th { background: var(--brand); color: #fff; padding: 9px; font-size: 13px; border: 1px solid var(--brand-dark); }
.doc-summary td { padding: 10px; text-align: center; border: 1px solid var(--line); font-weight: 700; }
.doc-small { font-size: 11.5px; color: #666; }
.doc-terms { font-size: 11px; color: #444; padding-inline-start: 20px; margin: 6px 0; }
.doc-terms li { margin: 3px 0; }
.doc-sign { margin-top: 20px; }

/* הדפסה / שמירת PDF: רק מסמך ההצעה, על עמוד אחד נקי */
@media print {
  /* מסתירים את כל האפליקציה ומציגים רק את מודאל ההצעה (ילד ישיר של body) */
  body > * { display: none !important; }
  #proposal {
    display: block !important; position: static !important; inset: auto !important;
    background: none !important; backdrop-filter: none !important; padding: 0 !important;
  }
  #proposal .modal-box {
    display: block !important; position: static !important; width: auto !important;
    max-width: none !important; margin: 0 !important; box-shadow: none !important;
    border-radius: 0 !important; animation: none !important;
  }
  /* לא מדפיסים את הכותרת האדומה (כפתורים) ואת פאנל העריכה */
  #proposal .modal-head, #proposal .prop-panel { display: none !important; }
  #proposal .prop-layout { display: block !important; grid-template-columns: none !important; }
  /* ניקוי רקעים/מסגרות כדי שההדפסה תהיה לבנה ונקייה (full-bleed) */
  #proposal .modal-box, #proposal .prop-layout, #proposal .prop-preview {
    background: #fff !important; border: 0 !important; border-radius: 0 !important;
    padding: 0 !important; overflow: visible !important;
  }
  #proposal-doc {
    display: block !important; box-shadow: none !important; max-width: none !important;
    margin: 0 !important; padding: 0 !important;
  }

  /* דחיסה כדי שהכול ייכנס לעמוד A4 אחד */
  #proposal-doc { font-size: 12px; line-height: 1.45; color: #000; }
  #proposal-doc .doc-logo { height: 44px; }
  #proposal-doc .doc-head { margin-bottom: 10px; }
  #proposal-doc .doc-subject { margin: 9px 0; }
  #proposal-doc .doc-section-title { margin: 8px 0 4px; }
  #proposal-doc p, #proposal-doc .doc-to { margin: 4px 0; }
  #proposal-doc .doc-table, #proposal-doc .doc-summary { margin: 7px 0; }
  #proposal-doc .doc-table td { padding: 4px 10px; }
  #proposal-doc .doc-summary th, #proposal-doc .doc-summary td { padding: 6px; }
  #proposal-doc .doc-terms { font-size: 9.5px; margin: 4px 0; }
  #proposal-doc .doc-terms li { margin: 1px 0; }
  #proposal-doc .doc-small { font-size: 10px; }
  #proposal-doc .doc-sign { margin-top: 12px; }
  #proposal-doc table, #proposal-doc ol { page-break-inside: avoid; }
  @page { size: A4; margin: 10mm 12mm; }
}

/* מצב צפייה בהצעה שמורה: הסתרת פאנל העריכה */
.modal.view-mode .prop-panel { display: none; }
.modal.view-mode .prop-layout { grid-template-columns: 1fr; }
.doc-headinfo { direction: rtl; text-align: left; }
.doc-track { font-weight: 800; color: var(--brand-dark); font-size: 15px; margin-top: 4px; }

/* דרופדאון סטטוס מעקב */
.status-sel { padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; border: 1px solid var(--line); cursor: pointer; }
.status-sel.st-sent { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.status-sel.st-ok   { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-sel.st-no   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ====== דף כניסה ====== */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #1a1212 0%, var(--brand-dark) 100%); margin: 0;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 38px 40px; width: 360px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); text-align: center;
}
.login-logo { height: 60px; width: auto; margin-bottom: 14px; }
.login-card h1 { font-size: 18px; margin: 0 0 4px; color: var(--brand-dark); }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: right; }
.login-card label { font-size: 13px; color: var(--muted); gap: 6px; }
.login-card .primary { width: 100%; margin-top: 6px; }
.login-error { color: #dc2626; font-size: 13px; min-height: 18px; text-align: center; }

/* כפתור התנתקות בכותרת */
.user-box { display: flex; align-items: center; gap: 10px; direction: rtl; }
.user-name { font-size: 13px; color: var(--muted); }
.logout-btn {
  background: var(--brand-light); border: 1px solid #f0caca; color: var(--brand-dark);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.logout-btn:hover { background: #fbd5d5; }
.header-top { display: flex; align-items: flex-start; justify-content: space-between; }

/* ניהול משתמשים */
.chk-label { justify-content: flex-end; }
.chk-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); padding: 9px 0; }
.chk-row input { width: auto; }
.badge-admin { background: var(--brand); color: #fff; font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 700; }
.me-tag { background: #e0f2fe; color: #1d4ed8; font-size: 10px; padding: 1px 7px; border-radius: 12px; }

/* ====== מסך טעינה ממותג ====== */
.sail-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(120% 90% at 50% 35%, #ffffff 0%, #faf5f5 55%, #f3e9e9 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
}
.sail-overlay.go { opacity: 1; pointer-events: all; animation: loadShow 2.1s ease forwards; }
/* נשאר אטום עד הסוף — המעבר החלק נעשה ע"י #enter-cover בעמוד המערכת */
@keyframes loadShow { 0%{opacity:0} 9%{opacity:1} 100%{opacity:1} }

.load-logo {
  width: min(260px, 70vw); height: auto;
  filter: drop-shadow(0 8px 22px rgba(196,16,25,.18));
}
.sail-overlay.go .load-logo { animation: logoPulse 1.5s ease-in-out infinite; }
@keyframes logoPulse {
  0%,100% { transform: scale(1);    opacity: .9; }
  50%     { transform: scale(1.055); opacity: 1; }
}

.load-text {
  margin-top: 26px; color: var(--brand-dark); font-size: 16px; font-weight: 700; letter-spacing: 1px;
  opacity: 0;
}
.sail-overlay.go .load-text { animation: fadeUp .6s ease .3s forwards; }
@keyframes fadeUp { from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:translateY(0)} }

.load-bar {
  margin-top: 18px; width: 240px; max-width: 70vw; height: 4px;
  background: #efe2e2; border-radius: 4px; overflow: hidden; position: relative; opacity: 0;
}
.sail-overlay.go .load-bar { animation: fadeUp .6s ease .4s forwards; }
.load-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
}
.sail-overlay.go .load-bar::after { animation: barSlide 1.1s cubic-bezier(.4,0,.2,1) infinite; }
@keyframes barSlide { 0%{left:-42%} 100%{left:102%} }

/* כיסוי מעבר חלק בכניסה למערכת (fade-in של האתר) */
#enter-cover {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 35%, #ffffff 0%, #faf5f5 55%, #f3e9e9 100%);
  animation: coverOut .7s ease .1s forwards;
}
@keyframes coverOut { to { opacity: 0; visibility: hidden; } }

/* רעידת כרטיס בכניסה שגויה */
.login-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }

/* ====== חיות במערכת (רמה בינונית) ====== */
/* כניסת כרטיסי תוצאות בהדרגה */
@keyframes fadeInUp { from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:translateY(0)} }
.result { animation: fadeInUp .42s ease both; }

/* מעבר תוכן בין טאבים */
@keyframes panelFade { from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:translateY(0)} }
.panel.active { animation: panelFade .3s ease; }

/* פתיחת מודאלים */
@keyframes popIn { from{opacity:0; transform:scale(.96) translateY(10px)} to{opacity:1; transform:scale(1) translateY(0)} }
.modal-box { animation: popIn .28s cubic-bezier(.2,.8,.3,1); }

/* גל עדין בתחתית הכותרת (מוטיב ימי) */
header { position: relative; }
.header-wave {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 6px;
  background: repeating-linear-gradient(90deg, var(--brand) 0 14px, transparent 14px 28px);
  -webkit-mask: linear-gradient(90deg,#000,#000); opacity: .25;
  background-size: 56px 100%; animation: waveSlide 6s linear infinite;
}
@keyframes waveSlide { from{background-position:0 0} to{background-position:56px 0} }

/* כיבוד העדפת "פחות תנועה" */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   ====== שדרוג עיצוב: SaaS מודרני ואוורירי ======
   ============================================================ */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #1b2430;
  --muted: #707b8c;
  --line: #e9edf3;
  --brand-light: #fdeef0;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 4px 18px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.14);
  --ring: 0 0 0 4px rgba(196,16,25,.12);
}

body {
  font-family: "Assistant", "Heebo", system-ui, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
}

/* כותרת אווררית */
header { padding: 18px 32px 0; border-top: none; box-shadow: var(--shadow-sm); }
header h1 { font-weight: 800; letter-spacing: -.3px; }
.tabs { gap: 2px; margin-top: 16px; }
.tab { font-size: 15px; padding: 12px 18px; border-radius: 10px 10px 0 0; transition: all .15s; }
.tab:hover { background: #faf1f2; }
.tab.active { font-weight: 800; }
.header-wave { opacity: .14; }

main { max-width: 1140px; padding: 0 24px; }

/* כרטיסים */
.card {
  border-radius: var(--radius); padding: 26px; border: 1px solid var(--line);
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.card h2 { font-weight: 800; font-size: 19px; letter-spacing: -.2px; }

/* שדות קלט */
.grid { gap: 16px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); gap: 7px; }
input, select, textarea {
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* כפתורים */
button.primary {
  background: var(--brand); border-radius: var(--radius-sm); padding: 12px 30px;
  box-shadow: 0 6px 16px rgba(196,16,25,.22); transition: transform .12s, box-shadow .15s, filter .15s;
}
button.primary:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(196,16,25,.30); transform: translateY(-1px); }
button.primary:active { transform: translateY(0); }

/* תוצאות */
.result {
  border-radius: var(--radius); padding: 18px 20px; border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.result:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.result.best { border-color: var(--good); background: linear-gradient(0deg,#fbfffe,#fff); }
.r-price .total { font-size: 24px; letter-spacing: -.5px; }
.r-meta span { background: #f1f4f8; color: #5a6677; border-radius: 8px; padding: 4px 10px; }

/* טבלאות מודרניות */
table { font-size: 14px; }
th { font-size: 11px; letter-spacing: .4px; color: var(--muted); padding: 11px 14px; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f8fafc; }

/* מודאלים */
.modal { background: rgba(20,28,40,.55); backdrop-filter: blur(3px); }
.modal-box { border-radius: 20px; box-shadow: var(--shadow-lg); }

/* badges / pills עקביים */
.best-tag, .badge-admin { border-radius: 20px; font-weight: 700; }
.btn-sm { border-radius: 9px; border: 1.5px solid var(--line); transition: all .12s; }
.btn-sm:hover { border-color: var(--brand); color: var(--brand-dark); background: #fff; }

/* כניסה */
.login-card { border-radius: 20px; box-shadow: var(--shadow-lg); padding: 42px 44px; }
.login-card h1 { font-weight: 800; }

/* ====== לוגו ממורכז בכותרת ====== */
.header-top { position: relative; min-height: 72px; }
.header-top .logo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  height: 60px; width: auto;
}
.brand-text { margin-left: 0; }   /* ביטול הדחיפה הישנה */
@media (max-width: 720px) {
  .header-top .logo { height: 42px; }
  .brand-text h1 { font-size: 16px; }
}

/* ====== כותרת: לוגו במרכז · פרופיל ימין · כותרת אנגלית שמאל ====== */
header { box-shadow: 0 6px 20px rgba(16,24,40,.12); position: relative; z-index: 5; }
.header-top { display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.header-top .logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); height: 60px; width: auto; }

.brand-en {
  font-family: "Montserrat", sans-serif; direction: ltr;
  color: var(--brand); font-weight: 800; font-size: 23px; letter-spacing: .5px; line-height: 1;
}

/* טאבים ממורכזים מתחת ללוגו */
.tabs { justify-content: center; }

/* פס הפרדה סטטי ועדין (במקום הרץ) */
.header-wave {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: linear-gradient(90deg, transparent, rgba(196,16,25,.55) 25%, var(--brand) 50%, rgba(196,16,25,.55) 75%, transparent);
  opacity: 1; animation: none; -webkit-mask: none;
}

@media (max-width: 720px) {
  .header-top .logo { height: 42px; }
  .brand-en { font-size: 17px; }
}

/* ====== כפתור + פאנל פרטי סוכן ====== */
.agent-btn {
  background: #fff; border: 1.5px solid var(--line); color: var(--brand-dark);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: all .12s;
}
.agent-btn:hover { border-color: var(--brand); background: var(--brand-light); }
.agent-panel {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: 340px; max-width: 86vw;
  background: #fff; z-index: 10000; box-shadow: var(--shadow-lg);
  transform: translateX(-105%); transition: transform .28s cubic-bezier(.2,.8,.3,1);
  display: flex; flex-direction: column;
}
[dir="rtl"] .agent-panel { transform: translateX(105%); }
.agent-panel.open { transform: translateX(0); }
.ap-head {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; padding: 16px 18px; font-weight: 800;
}
.ap-body { padding: 16px 18px; overflow-y: auto; }
.ap-agent { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.ap-name { font-weight: 800; font-size: 16px; color: var(--brand-dark); margin-bottom: 10px; }
.ap-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: 13.5px; padding: 5px 0; border-top: 1px solid #f3f3f3; }
.ap-row span { color: var(--muted); }
.ap-row a { color: var(--brand); }

/* ====== רווח בתיק (פנימי) ====== */
.profit-box {
  margin-top: 6px; background: #ecfdf3; border: 1px solid #bbf7d0; color: #166534;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 600;
}
.profit-box b { font-size: 16px; font-weight: 800; }
.profit-cell { font-weight: 700; color: #166534; }

/* ====== סינוני מאגר הצעות ====== */
.prop-filters {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px;
}
.pf-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.pf-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 5px; flex-direction: row;
  background: #fff; border: 1.5px solid var(--line); border-radius: 20px; padding: 5px 12px;
  font-size: 13px; cursor: pointer; color: var(--ink);
}
.pf-chip:has(input:checked) { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.pf-chip input { width: auto; }
.pf-group input[type="date"] { padding: 8px 10px; }
.pf-summary { font-size: 14px; color: var(--muted); margin: 4px 2px 12px; }
.pf-summary b { color: var(--ink); }

/* ============================================================
   ====== שדרוג מסך כניסה + טעינה: מראה ימי ממותג ======
   ============================================================ */
.login-body {
  position: relative; overflow: hidden;
  background: radial-gradient(140% 120% at 50% -10%, #3a0f13 0%, #240a0d 45%, #160608 100%);
}

/* רקע מונפש: כתמי אור עדינים + גלי ים בתחתית */
.login-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.login-bg .orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5;
}
.orb-1 {
  width: 480px; height: 480px; top: -160px; inset-inline-end: -120px;
  background: radial-gradient(circle, rgba(196,16,25,.55), transparent 70%);
  animation: orbFloat 14s ease-in-out infinite;
}
.orb-2 {
  width: 420px; height: 420px; bottom: -140px; inset-inline-start: -100px;
  background: radial-gradient(circle, rgba(122,10,14,.6), transparent 70%);
  animation: orbFloat 18s ease-in-out infinite reverse;
}
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(24px,-26px) scale(1.08); }
}

/* שלוש שכבות גלים שקופות (קצף ים) בתחתית */
.login-waves { position: absolute; left: 0; right: 0; bottom: 0; height: 220px; }
.login-waves .wave {
  position: absolute; bottom: 0; left: 0; width: 200%; height: 100%;
  background-repeat: repeat-x; background-position: 0 bottom; background-size: 50% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,50 C150,100 350,10 600,45 C850,80 1050,15 1200,55 L1200,120 L0,120 Z' fill='%23ffffff'/%3E%3C/svg%3E");
}
.wave-1 { opacity: .07; animation: waveX 18s linear infinite; }
.wave-2 { opacity: .05; height: 80%; animation: waveX 26s linear infinite reverse; }
.wave-3 { opacity: .04; height: 60%; animation: waveX 34s linear infinite; }
@keyframes waveX { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* כרטיס זכוכיתי */
.login-card {
  position: relative; z-index: 1; overflow: hidden;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 2px 0 rgba(255,255,255,.4) inset;
  animation: cardRise .6s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes cardRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.login-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand), var(--brand-dark));
}
.login-logo { margin-top: 6px; filter: drop-shadow(0 6px 14px rgba(196,16,25,.12)); }
.login-card h1 { letter-spacing: -.3px; }

/* שדות עם אייקון */
.login-card .field {
  position: relative; display: flex; align-items: center;
}
.field-ic {
  position: absolute; inset-inline-start: 13px; width: 18px; height: 18px;
  color: var(--muted); pointer-events: none; transition: color .15s;
}
.login-card .field input {
  width: 100%; padding-inline-start: 42px;
}
.login-card .field:focus-within .field-ic { color: var(--brand); }
.login-foot {
  margin: 18px 0 0; font-size: 11.5px; color: var(--muted); opacity: .8;
}

/* גלי ים בתחתית מסך הטעינה (גוון מותג) */
.load-waves { position: absolute; left: 0; right: 0; bottom: 0; height: 160px; overflow: hidden; }
.load-waves .lwave {
  position: absolute; bottom: 0; left: 0; width: 200%; height: 100%;
  background-repeat: repeat-x; background-position: 0 bottom; background-size: 50% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,50 C150,100 350,10 600,45 C850,80 1050,15 1200,55 L1200,120 L0,120 Z' fill='%23c41019'/%3E%3C/svg%3E");
}
.lwave-1 { opacity: .10; animation: waveX 16s linear infinite; }
.lwave-2 { opacity: .06; height: 78%; animation: waveX 24s linear infinite reverse; }

/* ============================================================
   ====== שדרוג עמודים: כותרות, רשימות, טבלאות, העלאה ======
   ============================================================ */

/* כותרת כרטיס עם הדגשת מותג + כותרת משנה */
.card > h2 { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.card > h2::before {
  content: ""; flex: none; width: 4px; height: 21px; border-radius: 4px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
}
.card-sub { margin: 0 0 20px 15px; color: var(--muted); font-size: 13.5px; }
/* כשאין כותרת-משנה, נשמר ריווח תחתון לכותרת */
.card > h2:last-of-type:not(:has(+ .card-sub)) { margin-bottom: 16px; }

/* כותרת עליונה: שם משתמש + אווטאר */
.user-box { gap: 12px; }
.user-name { font-weight: 600; color: var(--ink); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 4px 10px rgba(196,16,25,.28);
}

/* ====== מחירונים: שורות עשירות ====== */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.list-row:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.li-icon {
  width: 46px; height: 46px; flex: none; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--brand-light); color: var(--brand-dark);
}
.list-row > .li-main { flex: 1; }
.li-title { font-weight: 800; font-size: 16px; }
.li-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 7px; }
.li-meta .li-pill {
  background: #f1f4f8; color: #5a6677; border-radius: 8px; padding: 3px 10px; font-size: 12.5px; font-weight: 600;
}

/* ====== סוכנים: כרטיסים בגריד עם אווטאר ====== */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* קבוצות אזורים */
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.region-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 22px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: #fff;
  cursor: pointer; font-family: inherit; transition: all .14s; }
.region-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.region-emoji { font-size: 34px; line-height: 1; }
.region-name { font-weight: 800; font-size: 15.5px; color: var(--ink); }
.region-count { font-size: 12.5px; color: var(--muted); background: #f1f5f9; border-radius: 999px; padding: 2px 12px; }
.region-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.region-title { margin: 0; font-size: 18px; }
.region-title span { color: var(--muted); font-weight: 600; font-size: 14px; }
.region-back { white-space: nowrap; }

.agent-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .12s;
  animation: fadeInUp .35s ease both;
}
.agent-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.ac-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ac-avatar {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  font-weight: 800; font-size: 16px; box-shadow: 0 4px 12px rgba(196,16,25,.25);
}
.ac-id { min-width: 0; }
.agent-card .name { font-weight: 800; font-size: 16px; line-height: 1.2; }
.agent-card .loc { color: var(--brand-dark); font-size: 12.5px; margin-top: 2px; }
.ac-rows { display: flex; flex-direction: column; gap: 8px; }
.ac-row {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink);
  padding-top: 8px; border-top: 1px solid var(--line);
}
.ac-row:first-child { border-top: none; padding-top: 0; }
.ac-row .ac-ic { flex: none; width: 16px; height: 16px; color: var(--muted); }
.ac-row a { color: var(--brand); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-row a:hover { text-decoration: underline; }
.ac-empty { color: var(--muted); font-size: 13px; }

/* ====== הצעות שהונפקו: טבלה מלוטשת ====== */
#proposals-body table { border-collapse: separate; border-spacing: 0; }
#proposals-body thead th {
  position: sticky; top: 0; background: #f8fafc; border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
#proposals-body tbody tr { transition: background .12s; }
#proposals-body tbody tr:nth-child(even) td { background: #fcfdfe; }
#proposals-body tbody tr:hover td { background: var(--brand-light); }
.track-pill {
  display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--brand-light); color: var(--brand-dark); font-weight: 800;
  border-radius: 7px; padding: 3px 9px; font-size: 13px;
}

/* ====== העלאת מחירון: אזור גרירה משודרג ====== */
.dropzone {
  border: 2px dashed #f0caca; border-radius: var(--radius); padding: 46px 30px;
  background: linear-gradient(180deg, #fffafa, #fff5f5);
  transition: border-color .15s, background .15s, transform .12s;
}
.dropzone:hover { border-color: var(--brand); background: #fff0f1; transform: translateY(-1px); }
.dropzone.drag { border-color: var(--brand); background: #ffe7e9; }
.dz-icon {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-light); color: var(--brand);
}
.dz-icon svg { width: 30px; height: 30px; }
.dz-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.dz-hint { font-size: 13px; color: var(--muted); margin: 0; }

/* ====== ניהול משתמשים: אווטאר בטבלה ====== */
.u-cell { display: flex; align-items: center; gap: 10px; }
.u-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef1f6; color: #5a6677; font-weight: 800; font-size: 13px;
}
.u-avatar.is-admin { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; }

/* תמונת אווטאר ממלאת את העיגול */
.user-avatar.av-has-img, .u-avatar.av-has-img, .prof-av-preview.av-has-img,
.av-chip.av-has-img { padding: 0; overflow: hidden; }
.av-has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* אווטאר בכותרת לחיץ */
button.user-avatar {
  border: none; cursor: pointer; padding: 0; font-family: inherit;
  transition: transform .12s, box-shadow .15s;
}
button.user-avatar:hover { transform: scale(1.06); box-shadow: 0 6px 16px rgba(196,16,25,.4); }

/* ============================================================
   ====== מודאל "הפרופיל שלי" ======
   ============================================================ */
.modal-box.prof-box { max-width: 560px; }
.prof-body { padding: 20px 22px 22px; }
.prof-sec { margin-bottom: 22px; }
.prof-sec:last-of-type { margin-bottom: 12px; }
.prof-sec h3 {
  display: flex; align-items: center; gap: 9px; margin: 0 0 12px;
  font-size: 15px; font-weight: 800; color: var(--brand-dark);
}
.prof-sec h3::before {
  content: ""; flex: none; width: 4px; height: 17px; border-radius: 4px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
}
.prof-sec label { margin-bottom: 13px; }
.prof-sec textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; margin-top: 5px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 14px; color: var(--ink); resize: vertical;
}
.prof-sec textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* אווטאר ראשי בראש המודאל */
.prof-avatar-top { display: flex; align-items: center; gap: 18px; margin-bottom: 6px; }
.prof-av-preview {
  width: 88px; height: 88px; flex: none; border-radius: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 34px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 10px 26px rgba(196,16,25,.3);
}
.prof-av-side { flex: 1; min-width: 0; }
.prof-av-name { font-weight: 800; font-size: 17px; }
.prof-av-hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* גלריית אווטארים */
.avatar-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.av-chip {
  width: 44px; height: 44px; border-radius: 13px; cursor: pointer; border: 2px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px; position: relative;
  transition: transform .12s, box-shadow .12s;
}
.av-chip:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow); }
.av-chip.sel { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(27,36,48,.12); }
.av-chip.av-initials { background: #eef1f6; color: #5a6677; }
.av-chip.av-upload { background: var(--brand-light); color: var(--brand); border: 2px dashed #f0caca; }
.av-chip.av-upload svg { width: 20px; height: 20px; }

/* מתג הפעלה */
.prof-toggle {
  flex-direction: row; align-items: center; gap: 11px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 13px;
}
.prof-toggle input { appearance: none; -webkit-appearance: none; width: 44px; height: 25px; flex: none;
  background: #d7dce4; border-radius: 20px; position: relative; cursor: pointer; transition: background .18s; }
.prof-toggle input::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 19px; height: 19px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.prof-toggle input:checked { background: var(--brand); }
.prof-toggle input:checked::after { transform: translateX(-19px); }
[dir="rtl"] .prof-toggle input:checked::after { transform: translateX(-19px); }

.days-row { flex-direction: row; align-items: center; gap: 9px; }
.days-row input { width: 88px; }
.prof-footer { display: flex; align-items: center; gap: 14px; padding-top: 6px; border-top: 1px solid var(--line); }
.prof-footer .primary { min-width: 130px; }

/* תגית "באיחור" בהצעות שלא אושרו */
.overdue-badge {
  display: inline-block; margin-inline-start: 7px; background: #fff7ed; color: #b45309;
  border: 1px solid #fed7aa; border-radius: 7px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
#proposals-body tbody tr.overdue td { background: #fffbf4; }
#proposals-body tbody tr.overdue:hover td { background: #fff7ed; }

/* ============================================================
   ====== דף הרשמה (signup) ======
   ============================================================ */
.signup-card { width: 400px; }
.signup-card h1 { font-size: 19px; margin: 4px 0; color: var(--brand-dark); font-weight: 800; }
.signup-step { animation: panelFade .3s ease; }
.login-link { color: var(--brand); font-weight: 700; text-decoration: none; }
.login-link:hover { text-decoration: underline; }
.link-btn {
  background: none; border: none; color: var(--muted); font-family: inherit; font-size: 13px;
  cursor: pointer; margin-top: 4px;
}
.link-btn:hover { color: var(--brand-dark); }

/* שורת טלפון עם קידומת מדינה */
.phone-row { display: flex; gap: 8px; align-items: stretch; }
.phone-cc {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #f4f6f9;
  font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; direction: ltr;
}
.phone-row input { flex: 1; min-width: 0; direction: ltr; text-align: right; }

/* קלט קוד 6 ספרות */
.code-input {
  width: 100%; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: 12px;
  padding: 14px 10px; direction: ltr; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* מסך הצלחה */
.done-check {
  width: 64px; height: 64px; margin: 6px auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 32px; color: #fff;
  background: linear-gradient(135deg, var(--good), #0f7a37); box-shadow: 0 8px 22px rgba(22,163,74,.35);
}
.done-btn { display: block; text-align: center; text-decoration: none; margin-top: 8px; }

/* ============================================================
   ====== שער "ממתין לאישור" ======
   ============================================================ */
.pending-gate {
  position: fixed; inset: 0; z-index: 9000; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 90% at 50% 30%, #fff 0%, #faf5f5 60%, #f3e9e9 100%);
}
.pending-gate.show { display: flex; }
.pending-box {
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); max-width: 440px; width: 100%;
  padding: 40px 36px; text-align: center; border-top: 5px solid var(--warn);
}
.pending-box .pg-ic { font-size: 46px; }
.pending-box h2 { margin: 10px 0 8px; color: var(--brand-dark); }
.pending-box p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.pending-box .pg-company { font-weight: 800; color: var(--ink); }

/* ============================================================
   ====== כרטיס קוד מתחלף + תיבת אישורים (מנהל) ======
   ============================================================ */
.code-card { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.code-ring {
  --pct: 100;
  width: 132px; height: 132px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; position: relative;
  background: conic-gradient(var(--brand) calc(var(--pct) * 1%), #eef1f6 0);
  transition: background .9s linear;
}
.code-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.code-ring .cr-inner { position: relative; text-align: center; }
.code-ring .cr-secs { font-size: 26px; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.code-ring .cr-lbl { font-size: 10px; color: var(--muted); margin-top: 3px; }
.code-main { flex: 1; min-width: 220px; }
.code-digits {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 42px; font-weight: 800;
  letter-spacing: 10px; color: var(--brand-dark); direction: ltr;
}
.code-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.code-copy {
  background: var(--brand-light); border: 1.5px solid #f0caca; color: var(--brand-dark);
  border-radius: 9px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.code-copy:hover { background: #fbd5d5; }
.code-hint { color: var(--muted); font-size: 13px; margin-top: 12px; }

/* תיבת אישורים */
.approval-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 10px;
}
.approval-row .ar-id { flex: 1; min-width: 0; }
.approval-row .ar-email { font-weight: 800; font-size: 15px; }
.approval-row .ar-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.ar-actions { display: flex; gap: 8px; }
.btn-approve { background: var(--good); color: #fff; border: none; border-radius: 9px; padding: 9px 18px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-approve:hover { filter: brightness(1.07); }
.btn-reject { background: #fff; color: #dc2626; border: 1.5px solid #fecaca; border-radius: 9px; padding: 9px 16px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-reject:hover { background: #fee2e2; }
.approve-badge {
  background: var(--warn); color: #fff; border-radius: 20px; font-size: 12px; font-weight: 800;
  padding: 2px 9px; margin-inline-start: 8px;
}

/* כרטיסי חברות (בעל מערכת) */
.company-row {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 10px;
}
.company-row .co-ic {
  width: 46px; height: 46px; flex: none; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--brand-light); color: var(--brand-dark);
}
.company-row .co-main { flex: 1; }
.company-row .co-name { font-weight: 800; font-size: 16px; }
.company-row .co-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ============================================================
   ====== מסך אישור ייבוא מחירון + הגדרת מפתח AI ======
   ============================================================ */
.review-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.engine-badge { font-size: 12px; font-weight: 700; border-radius: 20px; padding: 4px 12px; }
.engine-badge.ai { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #5b21b6; }
.engine-badge.rules { background: #f1f4f8; color: #5a6677; }
.review-warn {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 12px;
  padding: 12px 16px; margin: 0 0 16px; font-size: 13.5px;
}
.review-warn ul { margin: 6px 0 0; padding-inline-start: 20px; }
.review-warn li { margin: 2px 0; }
.imp-meta { margin-bottom: 18px; }

.imp-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 920px; }
.imp-table th {
  background: #f8fafc; text-align: right; padding: 9px 8px; font-size: 11px; color: var(--muted);
  position: sticky; top: 0; white-space: nowrap; border-bottom: 2px solid var(--line);
}
.imp-table td { padding: 4px 5px; border-bottom: 1px solid var(--line); }
.imp-table input, .imp-table select {
  width: 100%; min-width: 70px; padding: 7px 8px; font-size: 13px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff;
}
.imp-table input.num, .imp-table input.cur { min-width: 52px; width: 60px; }
.imp-table input[type="number"] { min-width: 70px; }
.imp-table td:last-child { text-align: center; }
.imp-table td:last-child button { padding: 5px 9px; }

.review-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.review-actions .count { color: var(--muted); font-size: 13px; font-weight: 600; }

/* הגדרת מפתח AI */
.ai-status { font-size: 14px; margin-bottom: 14px; }
.ai-status code { background: #f1f4f8; padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.ai-on { color: var(--good); font-weight: 800; }
.ai-off { color: var(--warn); font-weight: 800; }

/* ============================================================
   ====== ספריית סוכנים: כותרת + כפתור, סינון, סוג שירות ======
   ============================================================ */
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.card-head-row > h2 {
  display: flex; align-items: center; gap: 11px; margin: 0; font-weight: 800; font-size: 19px; letter-spacing: -.2px;
}
.card-head-row > h2::before {
  content: ""; flex: none; width: 4px; height: 21px; border-radius: 4px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
}
.add-btn {
  flex: none; background: var(--brand); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 12px rgba(196,16,25,.22); transition: transform .12s, box-shadow .15s, filter .15s;
}
.add-btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(196,16,25,.3); }

/* צ'יפים לסינון ימי/אווירי */
.agent-filter { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.af-chip {
  background: #fff; border: 1.5px solid var(--line); border-radius: 20px; padding: 7px 16px;
  font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; font-family: inherit; transition: all .12s;
}
.af-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.af-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* תגית סוג שירות בכרטיס הסוכן */
.tr-badge {
  display: inline-block; font-size: 11px; font-weight: 800; border-radius: 20px;
  padding: 2px 9px; margin-inline-start: 6px; vertical-align: middle; white-space: nowrap;
}
.tr-badge.tr-sea, .tr-badge.tr-sea_lcl { background: #e0f2fe; color: #075985; }
.tr-badge.tr-air { background: #ede9fe; color: #5b21b6; }

.ac-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ac-actions .btn-sm { flex: 1; }
.ac-src { margin-top: 10px; font-size: 11px; color: var(--muted); text-align: center; }
.ac-row.ac-notes { color: var(--muted); font-size: 13px; font-style: italic; }
.ac-row a { color: var(--brand); text-decoration: none; }
.ac-row a:hover { text-decoration: underline; }

/* בורר סוג שירות במודאל יצירת סוכן */
.transport-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-opt {
  flex: 1; min-width: 90px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 10px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; font-family: inherit; transition: all .12s;
}
.tr-opt:hover { border-color: var(--brand); }
.tr-opt.on { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); box-shadow: var(--ring); }

/* קישור "הוספת מייל נוסף" */
.link-add {
  background: none; border: none; color: var(--brand); font-weight: 700; font-size: 13px;
  cursor: pointer; font-family: inherit; padding: 0; margin: -6px 0 13px;
}
.link-add:hover { text-decoration: underline; }

/* כפתור "שלח לי תקציר עכשיו" בפרופיל */
.digest-now { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

/* ============================================================
   ====== התאמה מלאה למובייל ======
   ============================================================ */
/* מניעת גלילה אופקית (מגירת פאנל הסוכן מוסתרת מחוץ למסך ע"י transform) */
html, body { overflow-x: hidden; }

@media (max-width: 600px) {
  /* ---------- כותרת ---------- */
  header { padding: 10px 14px 0; box-shadow: 0 4px 14px rgba(16,24,40,.12); }
  .header-top { min-height: 0; gap: 10px; align-items: center; }
  /* הלוגו הופך לאלמנט רגיל (לא ממורכז אבסולוטית) — כדי לא לחפוף את פרטי המשתמש */
  .header-top .logo { position: static; transform: none; height: 32px; margin-inline-start: auto; }
  .user-box { gap: 8px; }
  .user-name { display: none; }              /* חוסך מקום — האווטאר מספיק */
  .user-avatar { width: 30px; height: 30px; font-size: 12px; }
  .logout-btn { padding: 5px 10px; font-size: 12px; }
  .brand-en { font-size: 15px; }

  /* טאבים — גלילה אופקית חלקה במקום חיתוך */
  .tabs {
    justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto;
    margin-top: 12px; padding-bottom: 2px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; padding: 10px 13px; font-size: 14px; }

  /* ---------- מבנה כללי ---------- */
  main { padding: 0 12px; margin: 16px auto; }
  .card { padding: 16px 14px; border-radius: 13px; margin-bottom: 16px; }
  .card > h2 { font-size: 17px; }
  .card-sub { margin: 0 0 14px 8px; font-size: 12.5px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .actions { flex-wrap: wrap; gap: 10px; }
  .actions .primary, .actions .primary.big { width: 100%; }
  .sort-label { width: 100%; flex-direction: row; }

  /* ---------- טבלאות: גלילה אופקית במקום חיתוך ---------- */
  #proposals-body, #users-body, #rates-detail, #lists-body, #import-review,
  #requests-body, #orders-body, #quotes-body {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  #proposals-body table, #users-body table, #rates-detail table, #import-review table,
  #orders-body table { min-width: 620px; }
  #requests-body table, #quotes-body table { min-width: 560px; }
  th, td { padding: 9px 10px; }

  /* ---------- תוצאות הצעת מחיר ---------- */
  .result { grid-template-columns: 30px 1fr; gap: 10px; padding: 14px; }
  .r-price { grid-column: 1 / -1; text-align: right; margin-top: 6px; }
  .r-price .total { font-size: 21px; }
  .r-meta { gap: 6px; }

  /* ---------- מודאלים ---------- */
  .modal { padding: 10px 8px; align-items: flex-start; }
  .modal-box, .modal-box.wide, .modal-box.prof-box { max-width: 100%; border-radius: 14px; }
  .modal-head { padding: 13px 16px; }
  .modal-head h2 { font-size: 16px; }

  /* בניית הצעת מחיר */
  .b-ocean, .b-final { margin: 12px; padding: 14px; }
  .b-cols { grid-template-columns: 1fr; gap: 12px; margin: 0 12px; }
  .bo-head { flex-wrap: wrap; }
  .bo-price { margin-inline-start: 0; }
  .b-footer { margin: 14px 12px 0; }

  /* בונה הצעת מחיר ללקוח — פאנל העריכה מעל המסמך */
  .prop-layout { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .prop-preview { padding: 10px; }
  .doc { padding: 22px 18px; font-size: 12.5px; }
  .head-actions { gap: 6px; }
  .ghost-btn { padding: 7px 11px; font-size: 12px; }

  /* פרופיל */
  .prof-body { padding: 16px 14px; }
  .prof-avatar-top { gap: 12px; }
  .prof-av-preview { width: 72px; height: 72px; font-size: 28px; border-radius: 18px; }
  .prof-footer { flex-wrap: wrap; }
  .prof-footer .primary { width: 100%; }

  /* קוד שיוך מתחלף */
  .code-card { justify-content: center; gap: 18px; }
  .code-main { min-width: 0; }
  .code-digits { font-size: 32px; letter-spacing: 6px; }

  /* שורות: אישורים / חברות / מחירונים */
  .approval-row, .company-row, .list-row { flex-wrap: wrap; }
  .ar-actions { width: 100%; }
  .ar-actions .btn-approve, .ar-actions .btn-reject { flex: 1; }
  .li-actions { width: 100%; }
  .li-actions .btn-sm { flex: 1; }

  /* סקירת ייבוא */
  .review-actions { flex-wrap: wrap; }
  .review-actions .primary { width: 100%; }

  /* אזור גרירה */
  .dropzone { padding: 30px 16px; }

  /* סינוני מאגר הצעות */
  .prop-filters { gap: 12px; padding: 12px; }
}

/* ====== חלון שליחת הצעה ללקוח ====== */
.send-body { padding: 20px 22px; display: grid; gap: 15px; }
.send-body label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); }
.send-body input[type="text"],
.send-body textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; font-family: inherit; font-size: 14px; box-sizing: border-box;
  background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
.send-body input[type="text"]:focus,
.send-body textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.send-body textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.send-hint { font-weight: 400; color: #9aa3b2; font-size: 12px; }
.send-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.send-check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.send-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

/* ====== מערכת אוויר (עמוד נפרד) ====== */
.air-title { position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  font-family: "Montserrat", sans-serif; font-weight: 800; font-size: 18px; color: var(--brand); }
.tab-link { text-decoration: none; }
.air-entry { color: var(--brand-dark); font-weight: 800; }
.air-filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.air-modal-body { padding: 20px 22px; }
.air-modal-body h3 { margin: 4px 0 10px; font-size: 15px; color: var(--brand-dark); }
.air-modal-body h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--ink); }
.air-modal-body label.full { display: block; margin-top: 12px; font-size: 13px; font-weight: 700; }
.air-modal-body label.full input { width: 100%; margin-top: 6px; }
.air-modal-body label.full textarea { width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; font-family: inherit; font-size: 14px;
  box-sizing: border-box; resize: vertical; }
.inco-btn { padding: 8px 18px; font-size: 13px; }
.air-modal-body label.full select { width: 100%; margin-top: 6px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-family: inherit; font-size: 14px; background: #fff; }
#airreq-link { margin-bottom: 6px; }
.chg-row { display: flex; gap: 6px; align-items: center; }
.chg-row input { flex: 1; }
.quote-add { margin-top: 18px; padding: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.air-profit { margin-top: 14px; font-size: 15px; color: #166534; }

/* טוגל יבוא/יצוא */
.dir-toggle { display: inline-flex; background: #eef2f7; border-radius: 12px; padding: 4px; margin-bottom: 16px; gap: 4px; }
.dir-btn { border: 0; background: transparent; padding: 8px 26px; border-radius: 9px; font-family: inherit;
  font-weight: 700; font-size: 14px; color: #64748b; cursor: pointer; transition: all .12s; }
.dir-btn.on { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }

/* שורות מידות */
.dim-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.dim-row input { width: 84px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; font-family: inherit; font-size: 14px; }
.dim-row span { color: #94a3b8; font-weight: 700; }

/* סיכום משקל */
.weight-summary { display: flex; gap: 14px; margin: 14px 0 4px; flex-wrap: wrap; }
.ws-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; font-size: 13px; color: #64748b; }
.ws-item span { display: block; font-size: 22px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.ws-chg { background: var(--brand-light); border-color: #f3c2c5; }
.ws-chg span { color: var(--brand-dark); }

/* בחירת סוכנים לשליחה */
.agent-select { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 8px 0; }
.agent-chk { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.agent-chk:hover { border-color: var(--brand); background: var(--brand-light); }
.agent-chk input { width: 17px; height: 17px; accent-color: var(--brand); flex-shrink: 0; }
.agent-chk .ag-name { font-weight: 700; font-size: 13.5px; }
.agent-chk .ag-mail { color: #94a3b8; font-size: 11.5px; direction: ltr; margin-inline-start: auto; }
.agent-chk .ag-country { font-weight: 600; font-size: 11px; color: #64748b; background: #eef2f7; border-radius: 6px; padding: 1px 7px; }
.agent-chk .ag-emailcount { color: var(--brand-dark); font-weight: 700; }

/* מסמכים מצורפים לבקשה */
.files-empty { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 6px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.file-row a { color: var(--brand-dark); text-decoration: none; font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; word-break: break-all; }
.file-row .file-size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.intro-ta { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; margin-bottom: 4px; }
.cheap-tag { display: inline-block; background: #dcfce7; color: #166534; font-size: 10px; font-weight: 800;
  padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
tr.q-chosen td { background: #f0fdf4; }

/* פיל סטטוס צבעוני (בקשות + הזמנות) */
.air-status { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #eef2f7; color: #475569; white-space: nowrap; }
.air-status.st-פתוחה   { background: #e0edff; color: #1d4ed8; }
.air-status.st-הוצעה   { background: #fef3c7; color: #b45309; }
.air-status.st-הוזמן   { background: #ede9fe; color: #6d28d9; }
.air-status.st-בדרך    { background: #fef3c7; color: #b45309; }
.air-status.st-נחת     { background: #ccfbf1; color: #0f766e; }
.air-status.st-נסגר    { background: #dcfce7; color: #166534; }
.air-status.st-נסגרה   { background: #dcfce7; color: #166534; }

@media (max-width: 640px) {
  .air-title { display: none; }
  .air-filters { gap: 10px; }
}

/* ===== מערכת אוויר: סטטוס הצעות, התראות וניתוח ===== */

/* נקודת סטטוס ליד מספר הבקשה */
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 7px; vertical-align: middle; }
.dot-red   { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.16); }
.dot-green { background: var(--good, #16a34a); box-shadow: 0 0 0 3px rgba(22,163,74,.16); }
.btn-sm.analyze { border-color: var(--brand); color: var(--brand-dark); font-weight: 700; }

/* תיבת התראות צפה — פינה ימנית תחתונה */
.notif-box {
  position: fixed; bottom: 22px; right: 22px; width: 320px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg, 0 16px 40px rgba(16,24,40,.18));
  border: 1px solid var(--line); z-index: 900; overflow: hidden; animation: fadeInUp .3s ease;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; padding: 11px 14px;
}
.notif-title { font-weight: 800; font-size: 14px; }
.notif-badge {
  display: inline-block; min-width: 20px; text-align: center; background: #fff; color: var(--brand-dark);
  border-radius: 20px; font-size: 12px; font-weight: 800; padding: 1px 7px; margin-right: 4px;
}
.notif-head-actions { display: flex; gap: 6px; }
.notif-mini { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 7px; padding: 3px 9px; cursor: pointer; font-family: inherit; font-size: 12px; }
.notif-mini:hover { background: rgba(255,255,255,.32); }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--brand-light); }
.notif-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.notif-agent { font-weight: 700; color: var(--ink); }
.notif-price { font-weight: 800; color: var(--brand-dark); white-space: nowrap; }
.notif-item-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* פעמון צף כשהתיבה ממוזערת */
.notif-bell {
  position: fixed; bottom: 22px; right: 22px; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; border: 0;
  font-size: 24px; cursor: pointer; z-index: 900; box-shadow: var(--shadow-lg, 0 12px 30px rgba(16,24,40,.22));
  display: flex; align-items: center; justify-content: center; animation: fadeInUp .3s ease;
}
.notif-bell .notif-badge { position: absolute; top: -4px; right: -4px; background: #fff; color: var(--brand-dark); }

.notif-empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.head-btns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* טופס איסוף EXW בחו"ל (מחיר לפי מיקוד+עיר) */
.exw-form { margin: 10px 0; display: flex; flex-direction: column; gap: 9px; }
.exw-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 9px; }
.exw-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted, #6b6b6b); font-weight: 600; }
.exw-lbl input, .exw-lbl select, .exw-lbl textarea {
  padding: 8px 11px; border: 1.5px solid var(--line, #e7e2e2); border-radius: 9px; font-family: inherit; font-size: 14px; color: var(--ink, #1a1212);
}
.exw-bd { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.exw-bd td { padding: 6px 8px; border-bottom: 1px solid var(--line, #e7e2e2); }
.exw-bd td:last-child { text-align: left; direction: ltr; white-space: nowrap; font-weight: 600; }
.exw-bd tr.sum td { border-top: 2px solid var(--ink, #1a1212); border-bottom: 0; font-size: 14.5px; font-weight: 800; color: var(--brand-dark, #7a0a0e); padding-top: 8px; }
@media (max-width: 640px) { .exw-grid { grid-template-columns: 1fr; } }
.src-auto { font-size: 11.5px; color: #2563eb; background: #eff6ff; border-radius: 20px; padding: 2px 8px; font-weight: 700; white-space: nowrap; }

/* טוסטים — קופצים רגעית (פינה ימנית עליונה, כדי לא להסתיר את תיבת ההתראות הקבועה למטה) */
.toast-wrap { position: fixed; top: 92px; right: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast-pop {
  display: flex; align-items: center; gap: 11px; background: #fff; border-radius: 13px; padding: 12px 15px;
  box-shadow: var(--shadow-lg, 0 12px 30px rgba(16,24,40,.2)); border-right: 4px solid var(--good, #16a34a);
  min-width: 270px; max-width: 330px; cursor: pointer; pointer-events: auto;
  opacity: 0; transform: translateY(16px); transition: opacity .3s, transform .3s;
}
.toast-pop.show { opacity: 1; transform: translateY(0); }
.toast-pop-icon { font-size: 22px; }
.toast-pop-body { display: flex; flex-direction: column; line-height: 1.4; }
.toast-pop-body b { font-size: 14px; color: var(--ink); }
.toast-pop-body span { font-size: 12.5px; color: var(--muted); }

/* מודאל ניתוח הצעה */
.analysis-body { padding-top: 4px; }
.an-summary { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 14px 16px; background: var(--brand-light); border-radius: 12px; margin-bottom: 14px; }
.an-summary > div { display: flex; flex-direction: column; }
.an-k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.an-summary b { font-size: 15px; color: var(--ink); }
.an-warn { background: #fef3c7; color: #92400e; padding: 9px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.an-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.an-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; }
.an-card.an-cheap { border-color: var(--good, #16a34a); box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.an-card.an-hi { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(196,16,25,.12); }
.an-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.an-agent { font-weight: 800; font-size: 15px; color: var(--ink); }
.chosen-tag { background: #dcfce7; color: #166534; border-radius: 20px; font-size: 11px; font-weight: 700; padding: 2px 9px; }
.an-table { width: 100%; border-collapse: collapse; }
.an-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.an-table td:last-child { text-align: left; direction: ltr; white-space: nowrap; }
.an-table tr.an-total td { border-top: 2px solid var(--ink); border-bottom: 0; font-size: 14.5px; padding-top: 9px; }
.an-flag { background: var(--warn, #d97706); color: #fff; border-radius: 6px; font-size: 10.5px; padding: 1px 6px; margin-right: 4px; }
.an-card .btn-sm { margin-top: 11px; width: 100%; }

/* פירוט עלויות בטופס הוספת הצעה */
.charges-h { margin-top: 16px; }
.charge-row { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.charge-row .ch-label { flex: 1; }
.charge-row .ch-amount { width: 120px; direction: ltr; text-align: left; }
.charge-row input { padding: 8px 11px; border: 1.5px solid var(--line); border-radius: 9px; font-family: inherit; font-size: 14px; }
.charge-add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.charge-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.charge-quick .btn-sm { background: var(--brand-light); border-color: transparent; color: var(--brand-dark); font-size: 12px; padding: 5px 10px; }
.qa-total-disp { margin: 12px 0 6px; font-size: 15px; color: var(--ink); }
.qa-total-disp b { color: var(--brand-dark); }
.qa-total-sub { font-size: 12px; color: var(--muted); font-weight: 400; }

/* תצוגת השוואה — טבלה */
.an-table-wrap { overflow-x: auto; }
.an-compare { width: 100%; border-collapse: collapse; min-width: 380px; }
.an-compare th, .an-compare td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: center; font-size: 13.5px; white-space: nowrap; }
.an-compare thead th { background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 700; }
.an-compare td:first-child, .an-compare th:first-child { text-align: right; font-weight: 600; color: var(--ink); position: sticky; right: 0; background: #fff; }
.an-compare thead th:first-child { background: #f8fafc; }
.an-compare tr.an-total td { border-top: 2px solid var(--ink); font-size: 15px; }
.an-compare .an-col-cheap { background: rgba(22,163,74,.08); }

@media (max-width: 640px) {
  .notif-box { right: 12px; bottom: 12px; left: 12px; width: auto; }
  .an-cards { grid-template-columns: 1fr; }
  .toast-wrap { left: 12px; right: 12px; }
}
