/* משימון — גיליון עיצוב ראשי. RTL, עברית. */

:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-light: #ccfbf1;
  --accent: #c2410c;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --info: #2563eb;
  --info-bg: #eff6ff;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, .18);

  --header-h: 60px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Segoe UI", "Assistant", "Rubik", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- כפתורים */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-mute); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(15, 23, 42, .06); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------- שדות */

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: 12.5px; color: var(--text-soft); }
.field .hint { font-size: 11.5px; color: var(--text-mute); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=number], select, textarea {
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
textarea { resize: vertical; min-height: 76px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* ---------------------------------------------------------------- לוגו */

.logo-mark { display: inline-flex; flex: none; line-height: 0; }
.logo-mark svg { display: block; }

.app-logo { display: flex; align-items: center; gap: 11px; }
.app-logo-text { display: inline-block; }
.app-logo-name {
  font-weight: 800; font-size: 19px; letter-spacing: .13em;
  margin-inline-end: -.13em;         /* קיזוז הרווח שנוסף אחרי האות האחרונה */
  line-height: 1.12; text-transform: uppercase; white-space: nowrap;
}
/* הרוחב מחושב ב-JS כך שיהיה זהה לרוחב MESIMON שמעליו */
.app-logo-tagline {
  font-size: 11px; opacity: .82; line-height: 1.3;
  white-space: nowrap; margin-top: 1px;
}

/* גרסה גדולה — מסך הפתיחה */
.app-logo-lg { flex-direction: column; gap: 22px; }
.app-logo-lg .app-logo-name { font-size: 46px; letter-spacing: .19em; margin-inline-end: -.19em; }
.app-logo-lg .app-logo-tagline { font-size: 18px; margin-top: 10px; opacity: .92; }

/* לוגו החברה — מהקובץ אם קיים, אחרת שם החברה כטקסט */
/* align-items חובה: בברירת המחדל פריט גמיש נמתח לרוחב המכל, ותמונה מרובעת
   הייתה נמתחת לרוחב ונחתכת בגובה — כלומר לוגו מעוות */
.company-logo { display: flex; flex-direction: column; align-items: flex-start; }
.company-img { max-width: 100%; height: auto; display: block; object-fit: contain; }
.company-fallback { line-height: 1.3; }
.company-name { font-size: 21px; font-weight: 800; color: #2f6cb5; letter-spacing: -.01em; }
.company-tag { font-size: 11.5px; color: var(--text-mute); letter-spacing: .02em; }

.company-logo.on-panel { margin-bottom: 30px; }
.company-logo.on-panel .company-img { max-height: 112px; width: auto; }

.company-logo.in-sidebar {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--border); align-items: center;
}
.company-logo.in-sidebar .company-img { max-height: 82px; width: auto; opacity: .92; }
.company-logo.in-sidebar .company-fallback { text-align: center; }
.company-logo.in-sidebar .company-name { font-size: 15px; }
.company-logo.in-sidebar .company-tag { font-size: 10px; }

/* ---------------------------------------------------------------- התחברות */

/* טור הטופס ברוחב קבוע מימין, ואזור המיתוג ממלא את השאר */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 460px 1fr;
  background: var(--surface);
}
.login-hero {
  background: linear-gradient(150deg, var(--brand-dark) 0%, var(--brand) 55%, #0d9488 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: '';
  position: absolute;
  inset: auto -80px -140px auto;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.hero-center { position: relative; z-index: 1; }

.login-panel { padding: 52px 46px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { font-size: 24px; margin-bottom: 4px; }
.login-panel .muted { color: var(--text-soft); margin-bottom: 26px; }

/* כניסה עם Google */
.or-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 16px; color: var(--text-mute); font-size: 12.5px;
}
.or-divider::before, .or-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.google-btn {
  gap: 10px; font-weight: 600; color: var(--text);
  border-color: var(--border-strong); background: var(--surface);
}
.google-btn:hover { background: var(--surface-2); border-color: var(--text-mute); }
.google-mark { display: inline-flex; line-height: 0; flex: none; }

.demo-users { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 18px; }
.demo-users h4 { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.demo-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; margin-bottom: 6px; text-align: right;
  transition: border-color .15s, background .15s;
}
.demo-user:hover { border-color: var(--brand); background: var(--brand-light); }
.demo-user .who { flex: 1; min-width: 0; }
.demo-user .who b { display: block; font-size: 13px; }
.demo-user .who small { color: var(--text-mute); font-size: 11.5px; }

/* ---------------------------------------------------------------- מבנה */

.shell { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  height: var(--header-h);
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  z-index: 30;
}
.brand { display: flex; align-items: center; color: var(--brand-dark); }
.brand .app-logo-tagline { color: var(--text-mute); opacity: 1; font-weight: 500; }

.global-search { flex: 1; max-width: 420px; position: relative; }
.global-search input { padding-right: 34px; background: var(--surface-2); }
.global-search .icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; z-index: 60;
}
.search-results .sr-group { padding: 7px 12px 4px; font-size: 11px; color: var(--text-mute); font-weight: 700; }
.search-results button {
  display: block; width: 100%; text-align: right; padding: 8px 12px;
  border: 0; background: none; cursor: pointer; border-top: 1px solid var(--border);
}
.search-results button:hover { background: var(--surface-2); }
.search-results .sr-title { font-weight: 600; }
.search-results .sr-meta { font-size: 11.5px; color: var(--text-mute); }

.topbar-spacer { flex: 1; }

.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: 18px;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.badge-dot {
  position: absolute; top: 4px; left: 4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
}

.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.user-chip:hover { border-color: var(--border-strong); }
.user-chip .name { font-weight: 600; font-size: 13px; line-height: 1.15; }
.user-chip .role { font-size: 11px; color: var(--text-mute); line-height: 1.15; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff;
  background: var(--brand);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.vendor { background: var(--accent); }

.body { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-left: 1px solid var(--border); padding: 14px 10px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 3px;
}
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: 10.5px; font-weight: 700; color: var(--text-mute); letter-spacing: .07em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  border-radius: var(--radius); cursor: pointer; border: 0; background: none;
  width: 100%; text-align: right; font-weight: 600; color: var(--text-soft);
  transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-light); color: var(--brand-dark); }
.nav-item .ico { font-size: 15px; width: 20px; text-align: center; flex: none; }
.nav-item .count { margin-inline-start: auto; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-weight: 700; color: var(--text-soft); }
.nav-item.active .count { background: #fff; border-color: transparent; }

.main { flex: 1; min-width: 0; overflow: auto; padding: 20px 22px 40px; }

.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head .sub { color: var(--text-soft); font-size: 13px; margin-top: 2px; }
.page-head .spacer { flex: 1; }

/* ---------------------------------------------------------------- קלפים כלליים */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 15px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.widget {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 15px 17px; cursor: pointer; text-align: right; box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s, border-color .12s;
  display: flex; align-items: center; gap: 14px;
}
.widget:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.widget .w-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.widget .w-num { font-size: 27px; font-weight: 800; line-height: 1.05; }
.widget .w-label { color: var(--text-soft); font-size: 12.5px; font-weight: 600; }
.w-mine .w-icon { background: var(--info-bg); color: var(--info); }
.w-over .w-icon { background: var(--danger-bg); color: var(--danger); }
.w-urgent .w-icon { background: var(--warn-bg); color: var(--warn); }
.w-approve .w-icon { background: #f5f3ff; color: #7c3aed; }

/* ---------------------------------------------------------------- תגיות */

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.tag-low { background: #f1f5f9; color: #64748b; }
.tag-normal { background: var(--info-bg); color: var(--info); }
.tag-high { background: var(--warn-bg); color: var(--warn); }
.tag-urgent { background: #fee2e2; color: var(--danger); }
.tag-overdue { background: var(--danger); color: #fff; }
.tag-scheduled { background: #f5f3ff; color: #7c3aed; }
.tag-recurring { background: #ecfeff; color: #0e7490; }
.tag-escalated { background: #7c2d12; color: #fff; }
.tag-vendor { background: #fff7ed; color: var(--accent); border-color: #fed7aa; }
.tag-internal { background: var(--brand-light); color: var(--brand-dark); }
.tag-status { color: #fff; }

/* ---------------------------------------------------------------- לוח קנבן */

.toolbar {
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 10px 12px; margin-bottom: 15px;
}
.toolbar select, .toolbar input { width: auto; min-width: 130px; padding: 6px 10px; font-size: 13px; }
.toolbar .sep { width: 1px; height: 24px; background: var(--border); }
.toolbar .spacer { flex: 1; }

.view-switch { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.view-switch button { border: 0; background: var(--surface); padding: 6px 13px; cursor: pointer; font-weight: 600; font-size: 13px; border-inline-start: 1px solid var(--border); }
.view-switch button:first-child { border-inline-start: 0; }
.view-switch button.active { background: var(--brand); color: #fff; }

.kanban { display: flex; gap: 13px; align-items: flex-start; overflow-x: auto; padding-bottom: 14px; }
.kanban-col {
  flex: 1 0 265px; max-width: 340px; background: #eef2f6;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  display: flex; flex-direction: column; max-height: calc(100vh - 250px);
}
.kanban-col.drop-target { background: var(--brand-light); border-color: var(--brand); }
.kanban-col-head { padding: 11px 13px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.kanban-col-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban-col-head h4 { font-size: 13.5px; flex: 1; }
.kanban-col-head .num { font-size: 11.5px; font-weight: 700; color: var(--text-soft); background: var(--surface); border-radius: 999px; padding: 1px 8px; border: 1px solid var(--border); }
.kanban-col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; min-height: 90px; }

.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 12px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: box-shadow .13s, border-color .13s, transform .08s;
  position: relative;
}
.task-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.task-card.dragging { opacity: .45; transform: rotate(1.2deg); }
.task-card.is-overdue { border-inline-start: 3px solid var(--danger); }
.task-card.is-urgent { border-inline-start: 3px solid var(--warn); }
.task-card.is-escalated { box-shadow: 0 0 0 2px #fca5a5; }
.task-card .tc-title { font-weight: 600; margin-bottom: 7px; line-height: 1.4; }
.task-card .tc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.task-card .tc-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-mute); }
.task-card .tc-foot .spacer { flex: 1; }
.task-card .tc-project { font-size: 11.5px; color: var(--text-mute); margin-bottom: 5px; }
.task-card .tc-check { display: flex; align-items: center; gap: 5px; }
.progress-mini { width: 44px; height: 4px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress-mini > div { height: 100%; background: var(--ok); }
.task-card .select-box { position: absolute; top: 9px; left: 9px; }

/* ---------------------------------------------------------------- טבלה */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; white-space: nowrap; }
table.data th, table.data td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); }
table.data th { background: var(--surface-2); font-size: 12px; color: var(--text-soft); font-weight: 700; position: sticky; top: 0; z-index: 2; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.wrap { white-space: normal; min-width: 240px; }

/* ---------------------------------------------------------------- נעיצת פרויקטים */

.nav-item { position: relative; }
.nav-pin {
  border: 0; background: none; cursor: pointer; flex: none;
  font-size: 12px; line-height: 1; padding: 3px 4px; border-radius: 5px;
  /* visibility ולא רק opacity: אלמנט שקוף עדיין מקבל לחיצות, ובמסך מגע
     שאין בו ריחוף הקשה בקצה השורה הייתה נועצת פרויקט במקום לפתוח אותו */
  opacity: 0; visibility: hidden;
  /* הסמל הוא אמוג'י, ואמוג'י מתעלם מ-color — ההבחנה נעשית בהרוויה */
  filter: grayscale(1);
  transition: opacity .12s, filter .12s;
}
.nav-item:hover .nav-pin,
.nav-pin:focus-visible { opacity: .75; visibility: visible; }
.nav-pin:hover { opacity: 1; background: rgba(15, 23, 42, .08); }
/* פרויקט נעוץ — הסימון גלוי תמיד ובצבעו המלא */
.nav-pin.is-pinned { opacity: 1; visibility: visible; filter: none; }
/* במסך מגע אין ריחוף, ולכן הסימון גלוי תמיד — אחרת אין דרך לנעוץ */
@media (hover: none) {
  .nav-pin { opacity: .75; visibility: visible; }
}
.nav-pinned-sep {
  height: 1px; background: var(--border); margin: 6px 10px 7px;
}

/* ---------------------------------------------------------------- פיד עדכונים בגובה קבוע */

/* בלי הגבלת גובה כל עדכון הוסיף שורה והעמוד התארך בלי סוף */
.feed-scroll {
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline-end: 4px;
}
.feed-scroll::-webkit-scrollbar { width: 8px; }
.feed-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--surface); }

/* ---------------------------------------------------------------- קבצים בתוך שורת המשימה */

.file-chips { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; min-width: 0; }
.file-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 190px;
  padding: 2px 8px 2px 6px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2);
  font-size: 11.5px; color: var(--text-soft); text-decoration: none;
  white-space: nowrap; overflow: hidden;
}
.file-chip:hover { border-color: var(--brand); background: var(--brand-light); color: var(--text); }
.file-chip .fc-name { overflow: hidden; text-overflow: ellipsis; }
.file-chip .fc-ver {
  flex: none; font-size: 10px; font-weight: 700; color: var(--text-mute);
  background: var(--surface); border-radius: 4px; padding: 0 4px;
}
.file-chip-more { font-size: 11.5px; color: var(--text-mute); flex: none; }

/* ---------------------------------------------------------------- טבלה מקובצת (תצוגה ראשית) */

.grid-view { display: flex; flex-direction: column; gap: 20px; }

.group-control {
  display: flex; align-items: center; gap: 9px;
  padding: 0 2px 2px; margin-top: -6px;
}
.group-control select { width: auto; padding: 5px 9px; font-size: 13px; }

.grid-group { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } }

.group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px 8px;
}
.group-toggle {
  border: 0; background: none; cursor: pointer; font-size: 15px;
  width: 22px; height: 22px; border-radius: 5px; line-height: 1;
}
.group-toggle:hover { background: rgba(15, 23, 42, .07); }
.group-title { font-size: 15px; font-weight: 800; }
.group-count {
  font-size: 11.5px; font-weight: 700; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px;
}
.group-collapsed-note {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px 16px;
}

.grid-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow-sm);
}
/* פריסה קבועה — בלעדיה כל קבוצה מקבלת רוחבי עמודות משלה והלוח נראה
   כמה טבלאות לא מיושרות; היא גם מפעילה את חיתוך הטקסט הארוך */
table.grid-table { width: 100%; min-width: 920px; border-collapse: collapse; table-layout: fixed; }
table.grid-table th {
  background: var(--surface-2); font-size: 11.5px; color: var(--text-soft);
  font-weight: 700; text-align: right; padding: 7px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.grid-table td {
  padding: 5px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle; font-size: 13px;
}
table.grid-table tbody tr:last-child td { border-bottom: 0; }

/* פס הצבע של הקבוצה — בקצה ההתחלתי (ימין ב-RTL) */
.cell-bar { padding: 0 !important; }
th.cell-bar { background: var(--border) !important; }
.cell-check { text-align: center; }
.cell-check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.grid-row { transition: background .1s; }
.grid-row:hover { background: var(--surface-2); }
.grid-row.selected { background: var(--brand-light); }
.grid-row.is-overdue .due-box { font-weight: 700; }
.grid-row.is-escalated { box-shadow: inset 3px 0 0 #b91c1c; }

/* --- תא הכותרת --- */

.cell-title { overflow: hidden; }
.title-box { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-text {
  font-weight: 600; border-radius: 5px; padding: 2px 5px; margin: -2px -5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1 1 auto; min-width: 0;
}
.title-text.editable { cursor: text; }
.title-text.editable:hover { background: #eef2f6; box-shadow: inset 0 0 0 1px var(--border-strong); }
.inline-title-input {
  font-weight: 600; padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--brand); max-width: 340px;
}
.title-tags { display: flex; gap: 4px; flex: none; }
.open-card {
  border: 0; background: none; color: var(--brand); cursor: pointer;
  font-size: 11.5px; font-weight: 700; opacity: 0; flex: none;
  padding: 2px 6px; border-radius: 5px; white-space: nowrap;
}
.grid-row:hover .open-card { opacity: 1; }
.open-card:hover { background: var(--brand-light); }

/* --- תאי סטטוס ועדיפות: התא עצמו הוא הפקד --- */

.cell-status { padding: 3px 4px !important; }
.status-chip {
  border-radius: 6px; color: #fff; font-weight: 700; font-size: 12px;
  text-align: center; padding: 6px 8px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: filter .12s, transform .06s;
}
.status-chip.editable { cursor: pointer; }
.status-chip.editable:hover { filter: brightness(1.09); }
.status-chip.editable:active { transform: scale(.98); }

/* --- אחראי ותאריך --- */

.cell-assignee { overflow: hidden; }
.assignee-box {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 6px; margin: -3px -6px; border-radius: 6px;
  overflow: hidden; white-space: nowrap;
}
.assignee-box span { overflow: hidden; text-overflow: ellipsis; }
.assignee-box.editable { cursor: pointer; }
.assignee-box.editable:hover { background: #eef2f6; }

.cell-due { overflow: hidden; }
.due-box {
  display: flex; flex-direction: column; line-height: 1.25;
  padding: 3px 6px; margin: -3px -6px; border-radius: 6px;
}
.due-box small { font-size: 10.5px; color: var(--text-mute); }
.due-box.is-danger { color: var(--danger); }
.due-box.is-danger small { color: var(--danger); }
.due-box.is-warn { color: var(--warn); }
.due-box.is-warn small { color: var(--warn); }
.due-box.editable { cursor: pointer; }
.due-box.editable:hover { background: #eef2f6; }

.cell-progress { overflow: hidden; }
.cell-project, .cell-board { color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- שורת סיכום ושורת הוספה --- */

.grid-summary td { background: var(--surface-2); padding: 7px 10px !important; }
.summary-inner { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.summary-count { font-weight: 700; font-size: 12.5px; }
.summary-bar {
  display: flex; height: 9px; width: 190px; border-radius: 5px;
  overflow: hidden; background: var(--border);
}

.grid-quickadd td { padding: 0 !important; background: var(--surface); }
.quick-add-input {
  border: 0 !important; border-radius: 0 !important; background: transparent;
  padding: 8px 11px !important; font-size: 13px; color: var(--text-soft);
}
.quick-add-input:focus { box-shadow: none !important; background: var(--surface-2); color: var(--text); }
.quick-add-input::placeholder { color: var(--text-mute); }

/* --- פופאובר בחירה --- */

/* ללא אנימציית כניסה: היא מוסיפה transform שמזייף את מדידת המיקום */
.cell-popover {
  position: fixed; z-index: 150; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto;
}
.popover-list { padding: 4px; }
.popover-option {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; background: none; cursor: pointer;
  text-align: right; border-radius: 6px; font-size: 13px; white-space: nowrap;
}
.popover-option:hover { background: var(--surface-2); }
.popover-option .swatch { width: 13px; height: 13px; border-radius: 4px; flex: none; }
.popover-option .check { margin-inline-start: auto; color: var(--brand); font-weight: 800; }

/* ---------------------------------------------------------------- ציר זמן */

.timeline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; overflow-x: auto; }
.tl-grid { position: relative; min-width: 760px; }
.tl-head { display: flex; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 10px; }
.tl-head .tl-label { width: 230px; flex: none; font-size: 12px; font-weight: 700; color: var(--text-soft); }
.tl-head .tl-days { flex: 1; display: flex; }
.tl-head .tl-day { flex: 1; text-align: center; font-size: 10.5px; color: var(--text-mute); border-inline-start: 1px solid var(--border); }
.tl-head .tl-day.today { color: var(--danger); font-weight: 800; }
.tl-row { display: flex; align-items: center; margin-bottom: 7px; }
.tl-row .tl-label { width: 230px; flex: none; font-size: 12.5px; padding-inline-end: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tl-row .tl-label:hover { color: var(--brand); }
.tl-track { flex: 1; position: relative; height: 24px; background: var(--surface-2); border-radius: 6px; }
.tl-bar { position: absolute; top: 4px; height: 16px; border-radius: 5px; cursor: pointer; display: flex; align-items: center; padding: 0 6px; font-size: 10.5px; color: #fff; font-weight: 700; overflow: hidden; }
.tl-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .5; }

/* ---------------------------------------------------------------- מודל */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: grid; place-items: center; z-index: 100; padding: 22px;
  animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px; max-height: 92vh; display: flex; flex-direction: column;
  animation: pop .16s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes pop { from { transform: translateY(14px) scale(.985); opacity: 0; } }
.modal.wide { max-width: 940px; }
.modal.xwide { max-width: 1120px; }
.modal-head { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-start; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .spacer { flex: 1; }

/* ---------------------------------------------------------------- כרטיס משימה */

.task-detail { display: grid; grid-template-columns: 1fr 290px; gap: 0; }
@media (max-width: 900px) { .task-detail { grid-template-columns: 1fr; } }
.td-main { padding: 20px; overflow-y: auto; }
.td-side { padding: 20px; background: var(--surface-2); border-inline-start: 1px solid var(--border); overflow-y: auto; }
.td-side .sec { margin-bottom: 16px; }
.td-side .sec > label { display: block; font-size: 11px; font-weight: 700; color: var(--text-mute); letter-spacing: .05em; margin-bottom: 5px; }

.alert { padding: 10px 13px; border-radius: var(--radius); margin-bottom: 14px; display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }
.alert-danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warn { background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-bg); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-ok { background: var(--ok-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert a { font-weight: 700; text-decoration: underline; cursor: pointer; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 15px; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.checklist-item { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; }
.checklist-item:hover { background: var(--surface-2); }
.checklist-item input { width: 16px; height: 16px; accent-color: var(--ok); cursor: pointer; flex: none; }
.checklist-item .txt { flex: 1; }
.checklist-item.done .txt { text-decoration: line-through; color: var(--text-mute); }
.checklist-item .del { opacity: 0; }
.checklist-item:hover .del { opacity: 1; }

.progress-bar { height: 7px; border-radius: 5px; background: var(--border); overflow: hidden; margin: 8px 0 12px; }
.progress-bar > div { height: 100%; background: var(--ok); transition: width .25s; }

.comment { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment.internal { background: var(--warn-bg); margin: 0 -10px; padding: 11px 10px; border-radius: 8px; border-bottom: 0; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment .c-head b { font-size: 13px; }
.comment .c-head time { font-size: 11px; color: var(--text-mute); }
.comment .c-text { white-space: pre-wrap; word-break: break-word; }
.comment .mention { background: var(--brand-light); color: var(--brand-dark); border-radius: 4px; padding: 0 3px; font-weight: 600; }

.file-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 7px; background: var(--surface); }
.file-row .f-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.file-row .f-name { flex: 1; min-width: 0; }
.file-row .f-name b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .f-name small { color: var(--text-mute); font-size: 11px; }
.file-row.old-version { opacity: .68; background: var(--surface-2); }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 18px;
  text-align: center; color: var(--text-mute); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }

.history-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.history-item:last-child { border-bottom: 0; }
.history-item .h-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); margin-top: 7px; flex: none; }
.history-item .h-body { flex: 1; }
.history-item .h-meta { color: var(--text-mute); font-size: 11px; }
.history-item.system .h-dot { background: var(--info); }

/* ---------------------------------------------------------------- התראות */

.notif-panel {
  position: absolute; top: calc(var(--header-h) - 6px); left: 14px; width: 380px; max-height: 520px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 80; display: flex; flex-direction: column; overflow: hidden;
}
.notif-panel .np-head { padding: 12px 15px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.notif-panel .np-list { overflow-y: auto; }
.notif {
  display: flex; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #f0fdfa; }
.notif .n-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 14px; }
.notif b { display: block; font-size: 13px; }
.notif small { color: var(--text-mute); font-size: 11.5px; }
.notif .n-body { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- טוסט */

.toast-root { position: fixed; bottom: 18px; left: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: #0f172a; color: #fff; padding: 11px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-weight: 600; max-width: 420px;
  animation: slideup .2s ease;
}
@keyframes slideup { from { transform: translateY(12px); opacity: 0; } }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------------------------------------------------------------- שונות */

.empty { text-align: center; padding: 44px 20px; color: var(--text-mute); }
.empty .e-icon { font-size: 40px; opacity: .5; margin-bottom: 10px; }
.muted { color: var(--text-soft); }
.mute-sm { color: var(--text-mute); font-size: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }

.bar-track { height: 8px; background: var(--border); border-radius: 5px; overflow: hidden; min-width: 90px; }
.bar-track > div { height: 100%; }

.matrix-table td.v-yes { color: var(--ok); font-weight: 800; text-align: center; }
.matrix-table td.v-no { color: var(--danger); font-weight: 800; text-align: center; }
.matrix-table td.v-partial { color: var(--warn); font-size: 12px; text-align: center; white-space: normal; }

.vendor-banner {
  background: linear-gradient(105deg, #7c2d12, var(--accent));
  color: #fff; padding: 15px 19px; border-radius: var(--radius-lg); margin-bottom: 17px;
  display: flex; align-items: center; gap: 14px;
}
.vendor-banner h2 { font-size: 19px; }
.vendor-banner p { margin: 2px 0 0; opacity: .92; font-size: 13px; }

.spinner {
  width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .sidebar { position: fixed; inset: var(--header-h) 0 0 auto; z-index: 50; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 14px; }
}
