/* ============================================================
   Master Cargo CRM — components-feature.css
   מדורים 11-20: KPI · Lead card · Timeline · Tabs · Tables · Toasts · Empty · Suggestions · Sheet · Pagination
   פוצל מ-app.css (1007 שו') ב-06/09/2026 לפי docs/REFACTOR_PLAN.md §6.
   סדר הטעינה ב-base.html: tokens → layout → components-core → components-feature → pages
   (הסדר = סדר המדורים המקורי ב-app.css; אסור להחליף בין הקבצים — ה-cascade תלוי בו).
   כל הצבעים/הרדיוסים מגיעים מ-tokens.css. אין ערכים קשיחים כאן פרט לקטעים
   המסומנים "verbatim" שהועתקו מסגנון הבית של טל.
   ============================================================ */

/* ---------- 11. KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.kpi {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--sh-card);
  color: var(--text); min-height: 82px;
}
a.kpi:hover { text-decoration: none; border-color: rgba(232,135,59,.45); }
.kpi .l { font-size: var(--fs-xs); font-weight: 700; color: var(--faint); letter-spacing: .3px; }
.kpi .v { font-size: 1.7rem; font-weight: 900; line-height: 1.1; letter-spacing: -.5px; }
.kpi .s { font-size: var(--fs-xs); color: var(--muted); }
.kpi::after { content: ""; position: absolute; inset-inline-end: -18px; inset-block-start: -18px; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.04); }
.kpi-good .v { color: var(--good); } .kpi-good::after { background: rgba(var(--good-rgb), .10); }
.kpi-warn .v { color: var(--warn); } .kpi-warn::after { background: rgba(var(--warn-rgb), .10); }
.kpi-bad .v { color: var(--bad); } .kpi-bad::after { background: rgba(var(--bad-rgb), .12); }
.kpi-accent .v { color: var(--accent-2); } .kpi-accent::after { background: rgba(var(--accent-rgb), .14); }
.kpi-cyan .v { color: var(--cyan); } .kpi-cyan::after { background: rgba(var(--cyan-rgb), .12); }

/* ---------- 12. Lead card ---------- */
.lead-card { display: flex; flex-direction: column; gap: 10px; }
.lead-card .lc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.lead-card .lc-ref { font-size: var(--fs-xs); color: var(--faint); font-weight: 700; letter-spacing: .4px; }
.lead-card .lc-company { font-weight: 800; font-size: 1.05rem; line-height: 1.25; color: var(--text); }
.lead-card .lc-company a { color: inherit; }
.lead-card .lc-contact { color: var(--muted); font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lead-card .lc-contact a { color: var(--muted); }
.lead-card .lc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--faint); }
.lead-card .lc-summary { color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }
.lead-card .lc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.lead-card .lc-owner { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.lead-card .lc-next { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); padding: 6px 10px; border-radius: var(--r-sm); background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.12); }
.lead-card .lc-next .ico { color: var(--accent-2); }
.lead-card .lc-primary { margin-top: 2px; }
.lead-card.is-compact { gap: 6px; }
.lead-card.is-compact .lc-company { font-size: var(--fs-md); }
.lead-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.lead-list-tight { gap: var(--sp-2); }

/* 12b. RTL אמיתי לשמות/פרטי קשר (הכרעת טל 06/09: "בעמודה של שם הליד יש ערבוב בין RTL איפה שיש
   אנגלית"). כל תא/שדה שמכיל טקסט מעורב עברית-אנגלית מבודד bidi ⇒ סדר האלמנטים נשאר RTL גם
   כששם החברה/המייל באנגלית. חל על כרטיס הליד (מסך העבודה, תור הניתוב) ועל טבלאות. */
.lead-card .lc-company, .lead-card .lc-ref, .lead-card .lc-owner,
.lead-card .lc-contact, .lead-card .lc-contact span, .lead-card .lc-contact a {
  direction: rtl; unicode-bidi: isolate; text-align: start;
}
.lead-card .lc-company a { unicode-bidi: isolate; }
bdi { unicode-bidi: isolate; }

/* ---------- 13. Timeline ---------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 0 0 0 0; }
.timeline::before { content: ""; position: absolute; inset-block: 6px 6px; inset-inline-start: 11px; width: 2px; background: linear-gradient(180deg, rgba(232,135,59,.5), rgba(34,211,238,.35)); border-radius: 2px; }
.tl-item { position: relative; padding-inline-start: 36px; padding-block: 6px 12px; }
.tl-dot {
  position: absolute; inset-inline-start: 4px; inset-block-start: 9px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 9px;
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-EMAIL_SENT .tl-dot, .tl-EMAIL .tl-dot { border-color: var(--cyan); background: rgba(34,211,238,.18); }
.tl-EMAIL_RECEIVED .tl-dot { border-color: var(--good-2); background: rgba(74,222,128,.18); }
.tl-CALL_CONNECTED .tl-dot, .tl-CALL .tl-dot { border-color: var(--good); background: rgba(134,239,172,.18); }
.tl-CALL_ATTEMPTED .tl-dot, .tl-CONTACT_ATTEMPTED .tl-dot { border-color: var(--warn); background: rgba(253,230,138,.18); }
.tl-WHATSAPP_SENT .tl-dot { border-color: #4ADE80; background: rgba(74,222,128,.18); }
.tl-NOTE .tl-dot { border-color: var(--accent-2); background: rgba(245,178,107,.18); }
.tl-MILESTONE .tl-dot, .tl-STATUS .tl-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px var(--bg), var(--glow-accent); }
.tl-SYSTEM .tl-dot, .tl-AUDIT .tl-dot { border-color: var(--faint); background: rgba(255,255,255,.06); }
.tl-QUOTE_SENT .tl-dot, .tl-DOCUMENTS_RECEIVED .tl-dot { border-color: #60A5FA; background: rgba(96,165,250,.2); }
.tl-FOLLOWUP_SET .tl-dot { border-color: var(--violet); background: rgba(196,181,253,.2); }
.tl-LEAD_RECEIVED .tl-dot { border-color: var(--cyan); background: var(--cyan); }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.tl-title { font-weight: 700; font-size: var(--fs-sm); display: inline-flex; gap: 6px; align-items: center; }
.tl-time { font-size: var(--fs-xs); color: var(--faint); }
.tl-body { color: var(--muted); font-size: var(--fs-sm); margin-top: 3px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.tl-actor { font-size: var(--fs-xs); color: var(--faint); margin-top: 3px; }
.tl-item.is-milestone .tl-title { color: var(--accent-2); }

/* ---------- 14. Tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: var(--sp-3); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; min-height: var(--touch); padding: 8px 14px;
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted);
  font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--accent-2); border-bottom-color: var(--accent); }
.tab .cnt { display: inline-block; margin-inline-start: 6px; min-width: 20px; padding: 0 6px; border-radius: var(--r-pill); background: rgba(255,255,255,.08); font-size: var(--fs-xs); color: var(--faint); font-weight: 700; line-height: 20px; text-align: center; }
.tab.is-active .cnt { background: rgba(var(--accent-rgb), .18); color: var(--accent-2); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade-in var(--t-med) var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 15. Tables (stack to cards on mobile) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: var(--fs-xs); font-weight: 700; color: var(--faint); letter-spacing: .3px; background: rgba(255,255,255,.03); white-space: nowrap; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.table tr[data-href] { cursor: pointer; }
.table-stack tr[data-href]:hover { border-color: rgba(232,135,59,.4); }
.table .num { white-space: nowrap; }
.table .cell-actions { white-space: nowrap; }
.table-stack { display: block; }
.table-stack thead { display: none; }
.table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
.table-stack tr { padding: 10px 12px; margin-bottom: 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--sh-card); }
.table-stack td { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 6px 0; border: 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.table-stack td:last-child { border-bottom: 0; }
.table-stack td::before { content: attr(data-label); font-size: var(--fs-xs); font-weight: 700; color: var(--faint); flex: 0 0 auto; }
.table-stack td.cell-actions { justify-content: flex-end; }
.table-stack td.cell-actions::before { display: none; }
.table-stack td.cell-title { display: block; font-weight: 800; font-size: var(--fs-md); padding-bottom: 8px; }
.table-stack td.cell-title::before { display: none; }
.table-stack td.num { flex-direction: row-reverse; } /* keep the label on the inline-start side even when the value is LTR */
.table-stack td.num::before { direction: rtl; }

/* 15b. טבלה RTL מלאה (הכרעת טל 06/09): כל תא מבודד bidi ומיושר לימין, גם כשהתוכן אנגלית/מספרים.
   .cell-title מכיל שם + מזהה (<bdi> כל אחד) — הבידוד שומר את הסדר: שם מימין, מזהה אחריו. */
.table-rtl { direction: rtl; }
.table-rtl th, .table-rtl td { direction: rtl; unicode-bidi: isolate; text-align: right; }
.table-rtl td.cell-title { text-align: right; }
.table-rtl td .num { unicode-bidi: isolate; }
.table-rtl .lc-owner { direction: rtl; unicode-bidi: isolate; }
.table tr.ts-none td { text-align: center; color: var(--faint); padding: var(--sp-4) var(--sp-3); }
.table-stack tr.ts-none { display: block; }
.table-stack tr.ts-none td::before { display: none; }

/* ---------- 16. Toasts ---------- */
.toast-root {
  position: fixed; inset-inline: 0; inset-block-end: calc(var(--sp-4) + var(--sa-b)); z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 var(--sp-3);
  pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 480px; width: 100%;
  padding: 12px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,30,58,.98), rgba(14,20,40,.98));
  border: 1px solid rgba(34,211,238,.35); color: var(--text);
  box-shadow: var(--sh-pop); font-weight: 600; font-size: var(--fs-sm);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in var(--t-med) var(--ease);
}
.toast.is-error { border-color: rgba(252,165,165,.55); }
.toast.is-error .t-ico { color: var(--bad); }
.toast.is-ok .t-ico { color: var(--good); }
.toast .t-ico { font-size: 1.1rem; }
.toast .t-close { margin-inline-start: auto; background: none; border: 0; color: var(--faint); font-size: 1.1rem; width: 32px; height: 32px; border-radius: 8px; }
.toast .t-close:hover { background: rgba(255,255,255,.08); color: var(--text); }
.toast.is-leaving { animation: toast-out var(--t-med) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- 17. Empty state / skeleton ---------- */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--muted); border: 1px dashed rgba(255,255,255,.14); border-radius: var(--r-lg); background: rgba(255,255,255,.02); }
.empty .ico { font-size: 2.2rem; line-height: 1; margin-bottom: var(--sp-2); filter: drop-shadow(0 0 12px rgba(34,211,238,.35)); }
.empty .t { font-weight: 800; font-size: var(--fs-lg); color: var(--text); margin-bottom: 4px; }
.empty .d { font-size: var(--fs-sm); }
.empty .btn { margin-top: var(--sp-3); }
.skeleton { position: relative; overflow: hidden; border-radius: var(--r-sm); background: rgba(255,255,255,.06); color: transparent !important; min-height: 1em; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); animation: shimmer 1.4s infinite; }
.skeleton-line { height: 14px; margin: 6px 0; } .skeleton-line.w60 { width: 60%; } .skeleton-line.w40 { width: 40%; }
.skeleton-card { height: 120px; border-radius: var(--r-lg); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- 18. Suggestions ---------- */
.suggestion { border-color: rgba(34,211,238,.28); }
.suggestion::before { background: linear-gradient(90deg, var(--cyan), var(--accent)); }
.suggestion .sg-head { display: flex; align-items: flex-start; gap: var(--sp-2); }
.suggestion .sg-ico { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(34,211,238,.12); border: 1px solid rgba(34,211,238,.35); font-size: 1.1rem; }
.suggestion .sg-title { font-weight: 800; }
.suggestion .sg-reason { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.suggestion .sg-preview { margin-top: var(--sp-2); padding: 10px 12px; border-radius: var(--r-sm); background: rgba(8,13,28,.6); border: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }
.suggestion .sg-actions { display: flex; gap: 8px; margin-top: var(--sp-3); }
.suggestion .sg-actions .btn { flex: 1 1 auto; }
.confidence { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--faint); font-weight: 700; }
.confidence .bar { width: 54px; height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.confidence .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 4px; }

/* ---------- 19. Sheet / dialog (action fields, confirm) ---------- */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 88dvh; overflow: auto;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + var(--sa-b));
  border: 1px solid rgba(255,255,255,.12); border-bottom: 0; border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #131D3A, #0E1428); color: var(--text);
  box-shadow: var(--sh-pop);
  animation: sheet-up var(--t-med) var(--ease);
}
dialog.sheet::backdrop { background: rgba(3,6,14,.65); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog.sheet .grabber { width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); margin: -4px auto var(--sp-3); }
dialog.sheet h3 { margin-bottom: var(--sp-3); }
dialog.sheet .form-actions .btn { flex: 1 1 auto; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
/* human confirmation before any e-mail to a customer (MC.confirmEmail / email_prompt) */
dialog.sheet .email-confirm { margin-bottom: var(--sp-3); padding: 10px 12px; border-radius: var(--r-sm); background: rgba(8,13,28,.45); border: 1px solid var(--line); }
dialog.sheet .email-confirm .mv-head { padding-bottom: 0; border-bottom: 0; margin-bottom: 0; }
dialog.sheet .email-confirm .mv-body { max-height: 32vh; font-size: var(--fs-xs); margin-top: 8px; }
dialog.sheet .email-confirm details > summary { cursor: pointer; font-size: var(--fs-xs); color: var(--muted); margin-top: 8px; }

/* ---------- 20. Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-4); }
.pagination .info { font-size: var(--fs-xs); color: var(--faint); }
.pagination .btn { min-width: 110px; }
