/* ==========================================================================
   "הבית": components.css
   כל הקומפוננטות. דורש system.css לפניו.
   סדר: 1 שלד  2 סרגל צד  3 כותרת מסך  4 כרטיסים  5 כפתורים  6 טפסים
         7 טבלה  8 רשימת כרטיסים  9 באדג'ים  10 KPI  11 טאבים  12 מודאל
         13 טוסט  14 קנבן  15 ציר זמן  16 אווטאר  17 מצב ריק  18 טעינה
         19 עזרים
   ========================================================================== */

/* ==========================================================================
   1. שלד האפליקציה
   ========================================================================== */

.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
}

.app__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app__content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--sp-6) var(--sp-7) var(--sp-9);
}

@media (max-width: 1100px) { .app__content { padding: var(--sp-5); } }
@media (max-width: 860px) {
  .app { display: block; }
  .app__content {
    padding: var(--sp-4) var(--sp-4) calc(var(--tabbar-h) + var(--sp-8));
  }
}

/* ==========================================================================
   2. סרגל צד ניווט (RTL: יושב מימין; במובייל הופך לתפריט תחתון)
   ========================================================================== */

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  box-shadow: -1px 0 0 rgba(255, 255, 255, 0.6);
}

/* לוגו / שם המערכת - גוון כהה מעט מהאמצע, כדי שהאזור הנגלל יהיה ברור */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  background: var(--surface-2);
}

.sidebar__mark {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #FFFDFA;
  border: 1px solid var(--line-soft);
  box-shadow: 0 4px 12px rgba(69, 43, 93, 0.16);
}

.sidebar__mark-img {
  width: 76%;
  height: 76%;
  object-fit: contain;
}

.sidebar__name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: var(--fw-bold);
  color: var(--ink);
  line-height: 1.1;
}

.sidebar__tag {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.sidebar__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-3);
}

.nav-group + .nav-group { margin-top: var(--sp-5); }

.nav-group__title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--ink-3);
  letter-spacing: 0.06em;
  padding: 0 var(--sp-3) var(--sp-2);
}

.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-base);
  font-weight: var(--fw-med);
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}

.nav-item i, .nav-item .nav-item__icon {
  flex: none;
  width: 22px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-3);
  transition: color var(--t-fast) var(--ease);
}

.nav-item__label { flex: 1 1 auto; min-width: 0; }

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-item:hover i { color: var(--accent); }

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: var(--fw-semi);
}
.nav-item.is-active i { color: var(--accent); }

/* פס אינדיקציה בצד ההתחלה (ימין ב-RTL) */
.nav-item.is-active::before {
  content: "";
  position: absolute;
  inset-inline-start: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.nav-item__count {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--gold-soft-2);
  color: var(--gold-deep);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.nav-item.is-active .nav-item__count { background: var(--accent-soft-2); color: var(--accent-deep); }

/* פריט ניווט ראשי מודגש (דאשבורד) - בולד גם פעיל וגם לא */
.nav-item.nav-item--bold { font-weight: var(--fw-bold); }

/* כרטיס משתמש בתחתית הסרגל */
.sidebar__foot {
  flex: none;
  padding: var(--sp-3);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2);
  border-radius: var(--r-md);
  text-align: start;
  min-height: var(--tap);
  color: var(--ink);
  transition: background-color var(--t-fast) var(--ease);
}
.user-chip:hover { background: var(--surface-3); color: var(--ink); }
.user-chip__name { font-weight: var(--fw-semi); font-size: var(--fs-base); line-height: 1.2; }
.user-chip__role { font-size: var(--fs-xs); color: var(--ink-3); }

/* ---------- מובייל: תפריט תחתון ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    width: auto;
    height: var(--tabbar-h);
    flex-direction: row;
    border-inline-start: 0;
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -4px 20px rgba(74, 53, 34, 0.08);
    z-index: 60;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .sidebar__brand,
  .sidebar__foot,
  .nav-group__title,
  .gsearch { display: none; }

  .sidebar__scroll {
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: stretch;
    width: 100%;
  }
  .sidebar__scroll::-webkit-scrollbar { display: none; }

  .nav-group { display: contents; }
  .nav-list {
    flex-direction: row;
    gap: 0;
    padding: var(--sp-1) var(--sp-2);
  }
  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 68px;
    min-height: var(--tap);
    padding: var(--sp-2) var(--sp-2);
    border-radius: var(--r-md);
    font-size: 0.6875rem;
    font-weight: var(--fw-semi);
    white-space: nowrap;
  }
  .nav-item i, .nav-item .nav-item__icon { font-size: 1.05rem; width: auto; }
  .nav-item.is-active::before { display: none; }
  .nav-item__count {
    position: absolute;
    top: 2px;
    inset-inline-end: 10px;
    min-width: 17px;
    height: 17px;
    font-size: 0.625rem;
  }
}

/* כותרת מובייל עליונה (מוצגת רק במובייל) */
.topbar-mobile {
  display: none;
  align-items: center;
  gap: var(--sp-3);
  height: 58px;
  padding: 0 var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
@media (max-width: 860px) { .topbar-mobile { display: flex; } }

/* ==========================================================================
   3. כותרת מסך: פירורי לחם + כותרת + פעולה ראשית
   ========================================================================== */

.page-head { margin-bottom: var(--sp-6); }

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--ink-3);
  margin-bottom: var(--sp-3);
}
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--accent-ink); }
.breadcrumbs__sep { font-size: 0.65rem; color: var(--line-2); }
.breadcrumbs__current { color: var(--ink-2); font-weight: var(--fw-semi); }

.page-head__bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.page-head__title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.page-head__sub {
  margin-top: var(--sp-2);
  color: var(--ink-3);
  font-size: var(--fs-base);
  max-width: 62ch;
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* קו זהב עדין מתחת לכותרת המסך */
.page-head__rule {
  margin-top: var(--sp-5);
  height: 2px;
  border-radius: var(--r-pill);
  background: linear-gradient(to left, var(--gold-line), var(--line-soft) 34%, transparent 70%);
}

@media (max-width: 640px) {
  .page-head__bar { align-items: stretch; flex-direction: column; }
  .page-head__actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ==========================================================================
   4. כרטיסים
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.card--flat { box-shadow: none; }
.card--raised { box-shadow: var(--sh-md); }
.card--soft { background: var(--surface-2); border-color: var(--line-soft); box-shadow: none; }
.card--accent { border-color: var(--accent-line); background: var(--accent-soft); }
.card--pad { padding: var(--sp-5); }

/* כרטיס עם כותרת עליונה בגוון זהב */
.card--crown { position: relative; }
.card--crown::before {
  content: "";
  position: absolute;
  top: 0; inset-inline: 0;
  height: 3px;
  background: linear-gradient(to left, var(--gold), var(--accent) 70%);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, var(--surface), var(--surface-2));
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semi);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.card__title i { color: var(--accent); font-size: 0.9em; }

.card__sub { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 2px; }

.card__body { padding: var(--sp-5); }
.card__body--tight { padding: var(--sp-4); }
.card__body--flush { padding: 0; }

.card__foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* כרטיס לחיץ */
.card--link {
  display: block;
  color: inherit;
  transition: transform var(--t-base) var(--ease),
              box-shadow var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease);
}
.card--link:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-lg);
  border-color: var(--accent-line);
  text-decoration: none;
}

/* לוח מידע: זוגות תווית/ערך */
.deflist { display: grid; gap: var(--sp-3); }
.deflist__row {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: var(--sp-3);
  align-items: baseline;
  font-size: var(--fs-base);
}
.deflist__key { color: var(--ink-3); font-size: var(--fs-sm); font-weight: var(--fw-med); }
.deflist__val { color: var(--ink); font-weight: var(--fw-med); }
@media (max-width: 480px) {
  .deflist__row { grid-template-columns: 1fr; gap: 2px; }
}

/* ==========================================================================
   5. כפתורים
   ========================================================================== */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn i { font-size: 0.9em; }

.btn[disabled], .btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ראשי */
.btn--primary {
  --btn-bd: transparent;
  background: linear-gradient(165deg, var(--accent-hover), var(--accent-deep));
  color: #fff;
  box-shadow: 0 2px 6px rgba(100, 35, 91, 0.24), var(--sh-inset);
}
.btn--primary:hover {
  background: linear-gradient(165deg, #8B3D82, var(--accent));
  box-shadow: 0 4px 14px rgba(100, 35, 91, 0.32), var(--sh-inset);
}

/* משני */
.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-2);
  box-shadow: var(--sh-xs);
}
.btn--secondary:hover { background: var(--surface-2); border-color: var(--accent-line); color: var(--accent-deep); }

/* רך */
.btn--soft {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: transparent;
}
.btn--soft:hover { background: var(--accent-soft-2); }

/* זהב */
.btn--gold {
  background: var(--gold-soft);
  color: var(--gold-deep);
  border-color: var(--gold-line);
}
.btn--gold:hover { background: var(--gold-soft-2); }

/* שקוף */
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

/* מסוכן */
.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(168, 68, 63, 0.24), var(--sh-inset);
}
.btn--danger:hover { background: var(--danger-deep); }

.btn--danger-soft {
  background: var(--danger-soft);
  color: var(--danger-deep);
  border-color: var(--danger-line);
}
.btn--danger-soft:hover { background: #F6DDD9; }

/* גדלים */
.btn--sm { min-height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.btn--lg { min-height: 52px; padding: 0 var(--sp-7); font-size: var(--fs-md); }
.btn--block { display: flex; width: 100%; }

/* כפתור אייקון */
.btn-icon {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn-icon:hover { background: var(--surface-3); color: var(--accent-deep); }
.btn-icon:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-icon--bordered { border-color: var(--line-2); background: var(--surface); }
.btn-icon--danger:hover { background: var(--danger-soft); color: var(--danger-deep); }

/* קבוצת כפתורים / מתג תצוגה */
.btn-group {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.btn-group__item {
  min-height: 38px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn-group__item:hover { color: var(--ink); }
.btn-group__item.is-active {
  background: var(--surface);
  color: var(--accent-deep);
  box-shadow: var(--sh-xs);
}

/* ==========================================================================
   6. טפסים
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4) var(--sp-5);
}

.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field--full { grid-column: 1 / -1; }

.label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.label__req { color: var(--danger); font-size: 0.9em; }
.label__hint { color: var(--ink-3); font-weight: var(--fw-reg); font-size: var(--fs-xs); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: var(--fs-base);
  box-shadow: var(--sh-xs);
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease);
}

.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 1; }

.input:hover, .select:hover, .textarea:hover { border-color: var(--accent-line); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
  background: var(--surface);
}

.textarea { min-height: 108px; padding-top: var(--sp-3); resize: vertical; line-height: var(--lh-base); }

.input[disabled], .select[disabled], .textarea[disabled] {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
  box-shadow: none;
}

.input.is-invalid, .select.is-invalid, .textarea.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.input.is-invalid:focus { box-shadow: var(--ring-danger); }

.field__error {
  font-size: var(--fs-xs);
  color: var(--danger-deep);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.field__help { font-size: var(--fs-xs); color: var(--ink-3); }

/* select מותאם: בלי חץ נייטיב אפור */
.select {
  appearance: none;
  -webkit-appearance: none;
  /* החץ מצויר תמיד בצד הפיזי "left" - שריון הריפוד חייב להיות באותו צד (inline-end ב-RTL),
     אחרת בסלקטים צרים (width:auto) הטקסט נדרס ע"י החץ */
  padding-inline-end: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%237A6C60' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left var(--sp-4) center;
  background-size: 12px 8px;
  cursor: pointer;
}

/* שדה עם אייקון */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .input { padding-inline-start: 2.7rem; }
.input-wrap__icon {
  position: absolute;
  inset-inline-start: var(--sp-4);
  color: var(--ink-3);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-wrap:focus-within .input-wrap__icon { color: var(--accent); }
.input-wrap__end {
  position: absolute;
  inset-inline-end: var(--sp-2);
}
.input-wrap--end > .input { padding-inline-end: 2.9rem; }

/* חיפוש */
.search { max-width: 420px; width: 100%; }
.search .input { border-radius: var(--r-pill); }

/* תאריך: אייקון מותאם, בלי הפקד האפור */
.input[type="date"], .input[type="time"], .input[type="datetime-local"] {
  padding-inline-start: 2.7rem;
  font-variant-numeric: tabular-nums;
}
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset-inline-start: 0;
  width: 2.6rem;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.field--date { position: relative; }
.field--date .input-wrap__icon { color: var(--accent); }

/* צ'קבוקס מותאם */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-height: var(--tap);
  padding: var(--sp-2) 0;
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-base);
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--line-2);
  border-radius: 7px;
  background: var(--surface);
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 0.7rem;
  box-shadow: var(--sh-xs);
  transition: background-color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.check:hover .check__box { border-color: var(--accent); }
.check input:checked + .check__box {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.check input:focus-visible + .check__box { box-shadow: var(--ring); }
.check__text { line-height: 1.4; padding-top: 2px; }
.check--radio .check__box { border-radius: 50%; }
.check--radio input:checked + .check__box { background: var(--surface); border-color: var(--accent); border-width: 6px; }

/* מתג (toggle) */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--tap);
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  flex: none;
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: background-color var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.toggle__thumb {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(74, 53, 34, 0.28);
  transition: transform var(--t-base) var(--ease);
}
.toggle input:checked + .toggle__track {
  background: var(--accent);
  border-color: var(--accent);
}
/* RTL: התזוזה שמאלה */
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(-20px); }
.toggle input:focus-visible + .toggle__track { box-shadow: var(--ring); }
.toggle__label { font-size: var(--fs-base); font-weight: var(--fw-med); }

/* קבוצת פילטרים */
.filters {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-deep);
}
.chip__x { font-size: 0.7rem; opacity: 0.6; }
.chip__x:hover { opacity: 1; }

/* ==========================================================================
   7. טבלת נתונים
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-lg);
}

.table {
  width: 100%;
  min-width: 720px;
  font-size: var(--fs-base);
  text-align: start;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  padding: var(--sp-3) var(--sp-5);
  text-align: start;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--ink-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.table thead th.is-sortable { cursor: pointer; user-select: none; }
.table thead th.is-sortable:hover { color: var(--accent-deep); }
.table thead th i { margin-inline-start: var(--sp-1); font-size: 0.7em; opacity: 0.7; }

.table tbody td {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-2);
}

.table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-selected { background: var(--accent-soft); }

.table .cell-strong { color: var(--ink); font-weight: var(--fw-semi); }
.table .cell-num { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.table .cell-actions { width: 1%; white-space: nowrap; text-align: end; }

/* תא זהות: אווטאר + שם + תת-שורה */
.cell-id { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.cell-id__text { min-width: 0; }
.cell-id__name {
  font-weight: var(--fw-semi);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-id__meta { font-size: var(--fs-xs); color: var(--ink-3); }

/* פעולות שורה: מופיעות רק ב-hover בדסקטופ */
.row-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.table tbody tr:hover .row-actions,
.table tbody tr:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

/* סרגל תחתון לטבלה */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  color: var(--ink-3);
  flex-wrap: wrap;
}
.pager { display: inline-flex; align-items: center; gap: var(--sp-1); }
.pager__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  display: inline-grid;
  place-items: center;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pager__btn:hover { background: var(--surface-3); color: var(--ink); }
.pager__btn.is-active { background: var(--accent); color: #fff; }

/* ---------- מובייל: הטבלה הופכת לכרטיסים ---------- */
@media (max-width: 780px) {
  .table-wrap { overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { min-width: 0; }
  .table thead { display: none; }

  .table tbody tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-xs);
    padding: var(--sp-2) var(--sp-4) var(--sp-3);
    margin-bottom: var(--sp-3);
  }
  .table tbody tr:hover { background: var(--surface); }

  .table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-2) 0;
    border-bottom: 1px dashed var(--line-soft);
    text-align: start;
  }
  .table tbody td:last-child { border-bottom: 0; }

  .table tbody td::before {
    content: attr(data-label);
    flex: none;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--ink-3);
    letter-spacing: 0.03em;
  }
  /* התא הראשי: שורת כותרת לכרטיס, בלי תווית */
  .table tbody td.td-head {
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-1);
  }
  .table tbody td.td-head::before { display: none; }
  .table .cell-actions { width: auto; text-align: start; }
  .table .cell-actions::before { display: none; }
  .table .cell-actions .row-actions { opacity: 1; width: 100%; justify-content: flex-end; }
}

/* ==========================================================================
   8. רשימת כרטיסים
   ========================================================================== */

.list { display: flex; flex-direction: column; }

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
  min-height: 64px;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); text-decoration: none; }

.list-item__body { flex: 1 1 auto; min-width: 0; }
.list-item__title { font-weight: var(--fw-semi); color: var(--ink); }
.list-item__meta {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: 2px;
}
.list-item__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }
.list-item__end { flex: none; display: flex; align-items: center; gap: var(--sp-3); }

.list-item__icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
}
.list-item__icon--gold { background: var(--gold-soft); color: var(--gold-deep); }
.list-item__icon--ok { background: var(--ok-soft); color: var(--ok); }
.list-item__icon--rose { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 560px) {
  .list-item { padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
}

/* ==========================================================================
   9. באדג'ים ותגיות סטטוס
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px var(--sp-3);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.7;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--ink-2);
}
.badge i { font-size: 0.8em; }

.badge--purple { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent-line); }
.badge--gold   { background: var(--gold-soft);   color: var(--gold-deep);   border-color: var(--gold-line); }
.badge--ok     { background: var(--ok-soft);     color: var(--ok);          border-color: var(--ok-line); }
.badge--warn   { background: var(--warn-soft);   color: var(--warn);        border-color: var(--warn-line); }
.badge--danger { background: var(--danger-soft); color: var(--danger-deep); border-color: var(--danger-line); }
.badge--info   { background: var(--info-soft);   color: var(--info);        border-color: var(--info-line); }
.badge--neutral{ background: var(--surface-2);   color: var(--ink-2);       border-color: var(--line); }
.badge--slate  { background: var(--slate-soft);  color: var(--slate);       border-color: var(--slate-line); }
.badge--solid  { background: var(--accent);      color: #fff;               border-color: transparent; }

.badge--lg { font-size: var(--fs-sm); padding: 5px var(--sp-4); }

/* נקודת סטטוס */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--ink-2);
}
.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(122, 108, 96, 0.14);
}
.status--ok .status__dot     { background: var(--ok);     box-shadow: 0 0 0 3px rgba(55, 107, 75, 0.18); }
.status--warn .status__dot   { background: var(--warn);   box-shadow: 0 0 0 3px rgba(140, 92, 22, 0.18); }
.status--danger .status__dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(168, 68, 63, 0.16); }
.status--purple .status__dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(100, 35, 91, 0.16); }

/* תגית מידע קטנה */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--sp-2);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-med);
}

/* ==========================================================================
   10. KPI stat tiles
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: var(--sp-4);
}

.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
a.stat:hover, .stat--link:hover { box-shadow: var(--sh-md); border-color: var(--accent-line); }

.stat__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.stat__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--ink-3);
  line-height: 1.3;
}

.stat__icon {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
}
.stat--gold .stat__icon { background: var(--gold-soft); color: var(--gold-deep); }
.stat--ok .stat__icon   { background: var(--ok-soft);   color: var(--ok); }
.stat--rose .stat__icon { background: var(--danger-soft); color: var(--danger); }
.stat--info .stat__icon { background: var(--info-soft); color: var(--info); }

.stat__value {
  font-family: var(--font);
  font-size: 2rem;
  font-weight: var(--fw-bold);
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.015em;
}
.stat__value small { font-size: 0.5em; font-weight: var(--fw-semi); color: var(--ink-3); margin-inline-start: 3px; }

.stat__foot {
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-3);
  flex-wrap: wrap;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.delta--up   { background: var(--ok-soft);     color: var(--ok); }
.delta--down { background: var(--danger-soft); color: var(--danger-deep); }
.delta--flat { background: var(--surface-2);   color: var(--ink-3); }

/* פס התקדמות בתוך אריח מדד */
.stat__meter { width: 100%; margin-top: var(--sp-4); }
.stat__meter + .stat__foot { margin-top: var(--sp-2); }

/* פס התקדמות רך */
.meter {
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(to left, var(--accent), var(--accent-hover));
}
.meter--gold .meter__fill { background: linear-gradient(to left, var(--gold-deep), var(--gold)); }
.meter--ok .meter__fill   { background: var(--ok); }

/* ==========================================================================
   11. טאבים
   ========================================================================== */

.tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  color: var(--ink-3);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}
.tab::after {
  content: "";
  position: absolute;
  bottom: -1px;
  inset-inline: var(--sp-3);
  height: 3px;
  border-radius: var(--r-pill) var(--r-pill) 0 0;
  background: transparent;
  transition: background-color var(--t-base) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent-deep); }
.tab.is-active::after { background: var(--accent); }
.tab__count {
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
.tab.is-active .tab__count { background: var(--accent-soft-2); color: var(--accent-deep); }

.tabs--pills { border-bottom: 0; gap: var(--sp-2); }
.tabs--pills .tab {
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.tabs--pills .tab::after { display: none; }
.tabs--pills .tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.tab-panel { padding-top: var(--sp-5); }

/* ==========================================================================
   12. מודאל
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  animation: fade-in var(--t-base) var(--ease) both;
}

.modal {
  width: min(560px, 100%);
  max-height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  overflow: hidden;
  animation: modal-in var(--t-slow) var(--ease) both;
}
.modal--wide { width: min(880px, 100%); }
.modal--narrow { width: min(420px, 100%); }

.modal__head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, var(--surface), var(--surface-2));
}
.modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  line-height: 1.25;
}
.modal__sub { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 3px; }
.modal__close { flex: none; margin-inline-start: auto; }

.modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-6);
}

.modal__foot {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.modal__foot--spread { justify-content: space-between; }

/* אייקון אזהרה במודאל מחיקה */
.modal__glyph {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 1.1rem;
}
.modal__glyph--accent { background: var(--accent-soft); color: var(--accent); }
.modal__glyph--gold { background: var(--gold-soft); color: var(--gold-deep); }
.modal__glyph--danger { background: var(--danger-soft); color: var(--danger); }
.modal__glyph--warn { background: var(--warn-soft); color: var(--warn); }
.modal__glyph--info { background: var(--info-soft); color: var(--info); }
.modal__glyph--ok { background: var(--ok-soft); color: var(--ok); }

@media (max-width: 560px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-bottom: 0;
    animation: sheet-in var(--t-slow) var(--ease) both;
  }
  .modal__head, .modal__body, .modal__foot { padding-inline: var(--sp-5); }
  .modal__foot .btn { flex: 1 1 auto; justify-content: center; }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ==========================================================================
   12b. בורר קטן (אחראית / שיוכים / תגית) - מודל משותף במקום prompt()
   ========================================================================== */
.picker__list {
  max-height: 320px;
  overflow-y: auto;
  margin: 0 calc(var(--sp-6) * -1);
}
.picker__list .list-item {
  width: 100%;
  text-align: start;
  font: inherit;
  color: inherit;
  padding-inline: var(--sp-6);
}
.picker__list .list-item.is-active { background: var(--accent-soft); }
.picker__empty { padding: var(--sp-6); text-align: center; color: var(--ink-3); font-size: var(--fs-sm); }
.picker__dot { width: 13px; height: 13px; border-radius: 50%; flex: none; }

.picker__new-toggle { width: 100%; justify-content: center; margin-top: var(--sp-5); }
.picker__new-form {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.picker__new-form .field { margin-bottom: 0; }
.picker__swatches { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.picker__swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0.55;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.picker__swatch:hover { transform: scale(1.08); opacity: 0.85; }
.picker__swatch.is-selected { opacity: 1; border-color: var(--ink); }
.picker__swatch i { font-size: 0.7rem; opacity: 0; }
.picker__swatch.is-selected i { opacity: 1; }
.picker__new-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); }

@media (max-width: 560px) {
  .picker__list { margin-inline: calc(var(--sp-5) * -1); }
  .picker__list .list-item { padding-inline: var(--sp-5); }
}

/* ==========================================================================
   13. Toast
   ========================================================================== */

/* ממוקם בתחתית אזור התוכן, צמוד לסרגל הצד.
   כך הוא לעולם לא מכסה פאנל נשלף (שנפתח בצד הנגדי). */
.toasts {
  position: fixed;
  bottom: var(--sp-6);
  inset-inline-start: calc(var(--sidebar-w) + var(--sp-6));
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: min(380px, calc(100vw - var(--sidebar-w) - var(--sp-8)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  animation: toast-in var(--t-slow) var(--ease) both;
}

.toast__icon {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
}
.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__title { font-weight: var(--fw-semi); font-size: var(--fs-base); line-height: 1.3; }
.toast__text { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 2px; }
.toast__close { flex: none; width: 32px; height: 32px; border-radius: var(--r-sm); }

.toast--ok     { border-inline-start: 3px solid var(--ok); }
.toast--ok .toast__icon { background: var(--ok-soft); color: var(--ok); }
.toast--danger { border-inline-start: 3px solid var(--danger); }
.toast--danger .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--warn   { border-inline-start: 3px solid var(--warn); }
.toast--warn .toast__icon { background: var(--warn-soft); color: var(--warn); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* במובייל אין סרגל צד, והגיליון התחתון תופס את התחתית: הטוסט עולה למעלה */
@media (max-width: 860px) {
  .toasts {
    inset-inline: var(--sp-4);
    top: var(--sp-3);
    bottom: auto;
    width: auto;
  }
  .toast { animation-name: toast-in-top; }
}
@keyframes toast-in-top {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   14. קנבן
   ========================================================================== */

.kanban {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-3);
}

.kcol {
  flex: 0 0 300px;
  width: 300px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  max-height: 72vh;
}

.kcol__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--line-soft);
}
.kcol__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.kcol--gold .kcol__dot { background: var(--gold); }
.kcol--ok .kcol__dot   { background: var(--ok); }
.kcol--rose .kcol__dot { background: var(--danger); }
.kcol--info .kcol__dot { background: var(--info); }

.kcol__title { font-weight: var(--fw-bold); font-size: var(--fs-base); flex: 1 1 auto; }
.kcol__count {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 1px 8px;
}

.kcol__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-height: 90px;
}

.kcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--sh-xs);
  cursor: grab;
  transition: box-shadow var(--t-base) var(--ease),
              transform var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease);
}
.kcard:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
  border-color: var(--accent-line);
}
.kcard:active { cursor: grabbing; }
.kcard.is-dragging {
  transform: rotate(-1.4deg);
  box-shadow: var(--sh-lg);
  border-color: var(--accent);
}

.kcard__title { font-weight: var(--fw-semi); color: var(--ink); line-height: 1.35; }
.kcard__meta {
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.kcard__tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-2); }

/* אזור שחרור */
.kdrop {
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
}

@media (max-width: 560px) {
  .kcol { flex-basis: 84vw; width: 84vw; }
}

/* גרסת "מתאים למסך": כל העמודות נכנסות ברוחב הזמין בלי גלילה אופקית כלל
   (לוחות במספר עמודות קבוע - צינור הגיוס, בקשות תשלום). במובייל חוזר להתנהגות הרגילה (גלילה/כרטיסים). */
@media (min-width: 861px) {
  .kanban--fit { overflow-x: visible; }
  .kanban--fit .kcol { flex: 1 1 0; width: auto; min-width: 0; }
  .kanban--fit .kcol__head { padding: var(--sp-3) var(--sp-3) var(--sp-2); gap: var(--sp-1); }
  .kanban--fit .kcol__title {
    font-size: var(--fs-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .kanban--fit .kcol__count { font-size: 0.6875rem; padding: 1px 6px; }
  .kanban--fit .kcol__body { padding: var(--sp-2); gap: var(--sp-2); }
  .kanban--fit .kcard { padding: var(--sp-3); }
  .kanban--fit .kcard__title {
    font-size: var(--fs-sm);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .kanban--fit .kcard__tags .tag {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
  }
}

/* ==========================================================================
   15. ציר זמן
   ========================================================================== */

.timeline {
  position: relative;
  padding-inline-start: var(--sp-6);
  margin-inline-start: var(--sp-2);
}
/* הקו הראשי (RTL: מימין) */
.timeline::before {
  content: "";
  position: absolute;
  inset-inline-start: 7px;
  top: 6px;
  bottom: 10px;
  width: 2px;
  border-radius: var(--r-pill);
  background: linear-gradient(to bottom, var(--accent-line), var(--line));
}

.tl-item { position: relative; padding-bottom: var(--sp-6); }
.tl-item:last-child { padding-bottom: 0; }

.tl-item__dot {
  position: absolute;
  inset-inline-start: calc(-1 * var(--sp-6) + 1px);
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-item--gold .tl-item__dot { border-color: var(--gold); }
.tl-item--ok .tl-item__dot   { border-color: var(--ok); }
.tl-item--rose .tl-item__dot { border-color: var(--danger); }
.tl-item--muted .tl-item__dot { border-color: var(--line-2); }

.tl-item__time {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.tl-item__title {
  font-weight: var(--fw-semi);
  color: var(--ink);
  margin-top: 3px;
  line-height: 1.35;
}
.tl-item__text {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  margin-top: var(--sp-2);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  line-height: var(--lh-base);
}
.tl-item__who {
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

/* ==========================================================================
   16. אווטאר
   ========================================================================== */

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.01em;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid rgba(74, 53, 34, 0.06);
  user-select: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar--xs { width: 26px; height: 26px; font-size: 0.625rem; border-radius: 8px; }
.avatar--sm { width: 32px; height: 32px; font-size: 0.6875rem; border-radius: 9px; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.05rem; border-radius: var(--r-lg); }
.avatar--xl { width: 76px; height: 76px; font-size: 1.4rem; border-radius: var(--r-xl); }
.avatar--round { border-radius: 50%; }

/* גוונים חמים לאווטארים */
.avatar--c1 { background: #EFE6F7; color: #4A3063; }
.avatar--c2 { background: #FBEFD7; color: #7E5A1C; }
.avatar--c3 { background: #E6F0E9; color: #2F6244; }
.avatar--c4 { background: #FAE5E2; color: #8B3530; }
.avatar--c5 { background: #E4EDF4; color: #2F5271; }
.avatar--c6 { background: #F2E9DF; color: #6B5340; }

/* ישויות שאינן אנשים (קרנות, ספקים, תוכניות, מחזורים, קבוצות) - בלי ראשי-תיבות צבעוניים, אייקון עדין בלבד */
.avatar--entity { background: var(--surface-2); color: var(--ink-3); border-color: var(--line-soft); }
.avatar--entity i { font-size: 0.85em; }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid var(--surface); }
.avatar-stack .avatar + .avatar { margin-inline-start: -10px; }
.avatar-stack__more {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 2px solid var(--surface);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  margin-inline-start: -10px;
}

/* ==========================================================================
   17. מצב ריק (empty state) עם איור CSS של בית
   ========================================================================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-9) var(--sp-5);
  max-width: 460px;
  margin-inline: auto;
}

.empty__art {
  position: relative;
  width: 130px;
  height: 118px;
  margin-bottom: var(--sp-5);
}
/* הילה רכה, סטטית */
.empty__art::before {
  content: "";
  position: absolute;
  inset: 6px 0 14px;
  border-radius: var(--r-2xl);
  background: radial-gradient(circle at 50% 55%, var(--accent-soft), transparent 68%);
}
/* גג */
.empty__roof {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 46px solid transparent;
  border-right: 46px solid transparent;
  border-bottom: 36px solid var(--accent);
  filter: drop-shadow(0 3px 5px rgba(100, 35, 91, 0.22));
}
/* גוף הבית */
.empty__wall {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 54px;
  border-radius: 6px 6px 12px 12px;
  background: var(--surface);
  border: 2px solid var(--accent-line);
  border-top: 0;
}
/* דלת */
.empty__door {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 32px;
  border-radius: 12px 12px 3px 3px;
  background: var(--gold-soft-2);
  border: 2px solid var(--gold-line);
  border-bottom: 0;
}
/* ארובה */
.empty__chimney {
  position: absolute;
  top: 8px;
  inset-inline-start: 26px;
  width: 12px;
  height: 32px;
  border-radius: 3px 3px 0 0;
  background: var(--gold);
}
/* קרקע */
.empty__ground {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 106px;
  height: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(to left, transparent, var(--line-2) 22%, var(--line-2) 78%, transparent);
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  color: var(--ink);
}
.empty__text {
  color: var(--ink-3);
  font-size: var(--fs-base);
  margin-top: var(--sp-2);
  line-height: var(--lh-loose);
}
.empty__actions { margin-top: var(--sp-5); display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: center; }

/* ==========================================================================
   18. טעינה
   ========================================================================== */

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--accent-soft-2);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}
.spinner--sm { width: 15px; height: 15px; border-width: 2px; }
.spinner--lg { width: 34px; height: 34px; border-width: 3px; }
.spinner--light { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8);
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

/* שלד טעינה: סטטי, בלי הבהוב */
.skel {
  background: var(--surface-3);
  border-radius: var(--r-sm);
  height: 12px;
}
.skel--line { width: 100%; }
.skel--title { height: 18px; width: 42%; border-radius: var(--r-xs); }
.skel--pill { height: 22px; width: 84px; border-radius: var(--r-pill); }
.skel--avatar { width: 40px; height: 40px; border-radius: var(--r-md); }
.skel-rows { display: flex; flex-direction: column; gap: var(--sp-3); }

/* פס טעינה עליון */
.topline {
  position: fixed;
  top: 0; inset-inline: 0;
  height: 3px;
  background: var(--accent-soft-2);
  z-index: 200;
  overflow: hidden;
}
.topline__bar {
  height: 100%;
  width: 38%;
  background: var(--accent);
  border-radius: var(--r-pill);
  animation: topline 1.1s var(--ease) infinite;
}
@keyframes topline {
  0%   { transform: translateX(120%); }
  100% { transform: translateX(-260%); }
}

/* ==========================================================================
   19. עזרים נוספים
   ========================================================================== */

/* סרגל כלים מעל טבלה */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
@media (max-width: 640px) {
  .toolbar { padding: var(--sp-3) var(--sp-4); }
  .toolbar .search { max-width: none; }
}

/* פאנל צד נשלף (כרטיס הבית) */
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: min(560px, 100%);
  z-index: 90;
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  box-shadow: var(--sh-xl);
  display: flex;
  flex-direction: column;
  animation: drawer-in var(--t-slow) var(--ease) both;
}
@keyframes drawer-in {
  from { transform: translateX(-24px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.drawer__head {
  flex: none;
  padding: var(--sp-5) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, var(--accent-soft), var(--surface));
}
.drawer__body { flex: 1 1 auto; overflow-y: auto; padding: var(--sp-6); }
.drawer__foot {
  flex: none;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .drawer { inset: auto 0 0 0; width: auto; height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .drawer__head, .drawer__body, .drawer__foot { padding-inline: var(--sp-5); }
  /* הפעולה הראשית תופסת שורה מלאה, השאר מסתדר מתחתיה */
  .drawer__foot .btn.grow { flex-basis: 100%; }
  .drawer__foot .btn--ghost { flex: none; width: var(--tap); padding: 0; }
}

/* בלוק "בני הזוג": שני צדדים זה לצד זה */
.couple {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: var(--sp-3);
}
.couple__side {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  min-width: 0;
  text-align: center;
}
.couple__link {
  display: grid;
  place-items: center;
  width: 34px;
  color: var(--gold-deep);
  font-size: 0.85rem;
  align-self: center;
}
.couple__name {
  font-family: var(--font-display);
  font-weight: var(--fw-semi);
  font-size: var(--fs-lg);
  margin-top: var(--sp-2);
  line-height: 1.2;
}
.couple__meta { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 3px; }
.couple__facts {
  margin-top: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  text-align: start;
}
.couple__facts span { display: flex; align-items: center; gap: var(--sp-2); }
.couple__facts i { color: var(--ink-3); width: 14px; text-align: center; font-size: 0.75rem; }
.couple__side .avatar { margin-inline: auto; }

@media (max-width: 520px) {
  .couple { grid-template-columns: 1fr; }
  .couple__link { width: auto; height: 26px; transform: rotate(90deg); }
}

/* שורת מטא עם מפרידים */
.metaline {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--ink-3);
}
.metaline > span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.metaline i { font-size: 0.8rem; opacity: 0.8; }

/* קופסת הערה רכה */
.note {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}
.note i { color: var(--gold-deep); margin-top: 3px; }
.note--accent { background: var(--accent-soft); border-color: var(--accent-line); }
.note--accent i { color: var(--accent); }
.note--ok { background: var(--ok-soft); border-color: var(--ok-line); }
.note--ok i { color: var(--ok); }
.note--danger { background: var(--danger-soft); border-color: var(--danger-line); }
.note--danger i { color: var(--danger); }

/* מפריד עם כותרת */
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-4);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

/* תפריט נפתח */
.menu {
  min-width: 190px;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 40px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-base);
  text-align: start;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.menu__item i { width: 18px; text-align: center; color: var(--ink-3); font-size: 0.85rem; }
.menu__item:hover { background: var(--surface-2); color: var(--ink); }
.menu__item--danger { color: var(--danger-deep); }
.menu__item--danger i { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); }
.menu__sep { height: 1px; background: var(--line-soft); margin: var(--sp-2) 0; }
