* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Heebo', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  direction: rtl;
  min-height: 100vh;
}

/* LOGIN */
#login-screen {
  position: fixed; inset: 0;
  background: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-box h2 { font-size: 20px; margin-bottom: 6px; }
.login-box p  { color: #94a3b8; font-size: 14px; margin-bottom: 20px; }
.login-box input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-family: 'Heebo', sans-serif; font-size: 15px;
  text-align: center; letter-spacing: 4px;
  margin-bottom: 8px; direction: ltr;
}
.login-box input:focus { outline: none; border-color: #1e3a8a; }
.login-box button {
  width: 100%; padding: 11px;
  background: #1e3a8a; color: white; border: none;
  border-radius: 8px; font-family: 'Heebo', sans-serif;
  font-size: 15px; font-weight: 600; cursor: pointer;
  margin-top: 4px;
}
.login-box button:hover { background: #1e40af; }
.login-box .btn-secondary-login {
  background: white; color: #1e3a8a; border: 1.5px solid #1e3a8a;
}
.login-box .btn-secondary-login:hover { background: #f1f5f9; }
.login-divider { color: #cbd5e1; font-size: 12px; margin: 0 0 12px; }

/* NOTES */
.note-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.note-date { font-size: 11px; color: #94a3b8; }
.note-meta button {
  background: none; border: none; cursor: pointer;
  color: #cbd5e1; font-size: 12px; padding: 2px 4px;
}
.note-meta button:hover { color: #dc2626; }
.note-text { font-size: 14px; color: #1e293b; }

/* HEADER */
header {
  background: #1e3a8a;
  color: white;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 50;
}

header h1 { font-size: 20px; font-weight: 700; }

.header-controls { display: flex; gap: 12px; align-items: center; }

#search {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  width: 240px;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  direction: rtl;
}
#search::placeholder { color: rgba(255,255,255,0.6); }

.btn-header {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: white;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  white-space: nowrap;
}
.btn-header:hover { background: rgba(255,255,255,0.2); }

.header-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1e3a8a;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.menu-item {
  padding: 10px 16px;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}
.menu-item:hover { background: rgba(255,255,255,0.15); }
.menu-sep { border-top: 1px solid rgba(255,255,255,0.15); margin: 4px 0; }
#search:focus { outline: none; background: rgba(255,255,255,0.25); }

/* TOOLBAR */
.toolbar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.filter-btn {
  padding: 5px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  color: #64748b;
  transition: all 0.15s;
}
.filter-btn:hover { background: #f1f5f9; }
.filter-btn.active { background: #1e3a8a; color: white; border-color: #1e3a8a; }
.filter-btn.archive-toggle.active { background: #475569; border-color: #475569; }

.views { display: flex; gap: 6px; }
.view-btn {
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  border-radius: 8px;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  color: #64748b;
}
.view-btn.active { background: #eff6ff; border-color: #1e3a8a; color: #1e3a8a; font-weight: 600; }

/* MAIN */
main { padding: 20px 24px; }

/* SUMMARY */
.summary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.summary-card {
  background: white;
  border-radius: 10px;
  padding: 14px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  text-align: center;
  flex: 1;
  min-width: 90px;
}
.summary-card .num { font-size: 26px; font-weight: 700; }
.summary-card .lbl { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* TABLE */
.table-wrap {
  background: white;
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  -webkit-overflow-scrolling: touch;
}
table { min-width: 600px; }
table { width: 100%; border-collapse: collapse; }
thead { background: #f8fafc; }
th {
  padding: 11px 14px;
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 14px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
td.ed { cursor: pointer; }
td.ed:hover { background: #eff6ff !important; outline: 1px dashed #93c5fd; }

/* ROW URGENCY */
tr.row-upcoming td { background: #f0f9ff !important; }
tr.row-upcoming:hover td { background: #e0f2fe !important; }
tr.row-urgent td  { background: #fef2f2 !important; }
tr.row-urgent:hover td { background: #fee2e2 !important; }
tr.row-overdue td { background: #fef2f2 !important; }
tr.row-overdue:hover td { background: #fee2e2 !important; }

/* SORT HEADERS */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #e2e8f0; color: #1e3a8a; }
th.draggable-col { cursor: grab; }
th.draggable-col::before { content: '⠿ '; font-size: 10px; color: #cbd5e1; }
th.col-dragging { opacity: 0.4; }
th.col-drag-over { background: #dbeafe !important; border-right: 3px solid #1e3a8a; }

/* COLUMN DROPDOWN */
.col-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 100;
  padding: 6px 0;
}
.col-dropdown-title {
  padding: 8px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.col-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #1e293b;
  transition: background 0.1s;
}
.col-item:hover { background: #f1f5f9; }
.col-item.col-off { color: #94a3b8; text-decoration: line-through; }
.col-item.col-off::before { content: '✗ '; color: #dc2626; }
.col-item:not(.col-off)::before { content: '✓ '; color: #059669; }

/* YEAR BAR */
.year-bar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.yr-btn {
  padding: 4px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: white;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  color: #64748b;
}
.yr-btn.active { background: #475569; color: white; border-color: #475569; }

.date-filter-select {
  padding: 5px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  direction: rtl;
  background: white;
  color: #1e293b;
  cursor: pointer;
}
.date-filter-select:focus { outline: none; border-color: #1e3a8a; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.s-הקפאה      { background: #f1f5f9; color: #475569; }
.s-מסמכים     { background: #fef3c7; color: #92400e; }
.s-אושר-התיק  { background: #dbeafe; color: #1e40af; }
.s-בטחונות    { background: #cffafe; color: #0e7490; }
.s-ממתין-לאישור { background: #fce7f3; color: #db2777; }
.s-אישור-סופי { background: #ede9fe; color: #5b21b6; }
.s-ביצוע      { background: #d1fae5; color: #065f46; }
.s-הסתיים     { background: #f1f5f9; color: #94a3b8; }
.s-בוטל       { background: #fee2e2; color: #991b1b; }

/* URGENCY */
.urg-red    { color: #dc2626 !important; font-weight: 600; }
.urg-orange { color: #dc2626 !important; font-weight: 600; }

/* BALANCE */
.bal-ok   { color: #94a3b8; font-size: 13px; }
.bal-open { color: #0369a1; font-weight: 600; }

/* COPY */
.name-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.copy-btn {
  flex-shrink: 0;
  padding: 4px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  line-height: 1;
}
.name-cell:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.copy-btn:active { background: #bfdbfe; }

/* תמיד גלוי במובייל */
@media (max-width: 768px) {
  .copy-btn { opacity: 1; }
}

/* ACTIONS */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-sm {
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.btn-sm:hover { background: #f1f5f9; }

/* KANBAN */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
}
.k-col {
  min-width: 230px;
  max-width: 260px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.k-head {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 3px solid;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.k-head .count {
  background: rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 12px;
}
.k-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.k-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.k-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.1); transform: translateY(-1px); }
.k-card .k-name { font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.k-card .k-meta { font-size: 12px; color: #64748b; margin-top: 3px; }
.k-card .k-warn { font-size: 12px; color: #ea580c; margin-top: 4px; }

/* EMPTY */
.empty { text-align: center; padding: 60px 20px; color: #94a3b8; font-size: 15px; }

/* MODAL */
.hidden { display: none !important; }

#archive-overlay,
#overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
#overlay.hidden { display: none; }

.modal {
  background: white;
  border-radius: 16px;
  width: 580px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin: 16px 24px 0;
  gap: 4px;
}
.tab-btn {
  padding: 8px 20px;
  border: none;
  background: none;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
}
.tab-btn:hover { background: #f8fafc; color: #1e293b; }
.tab-btn.active { color: #1e3a8a; border-bottom-color: #1e3a8a; font-weight: 600; }

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; }
.close-btn:hover { color: #475569; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px 24px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: #64748b; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  direction: rtl;
  background: #f8fafc;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1e3a8a;
  background: white;
}

.modal-footer {
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #f1f5f9;
}
.btn-cancel {
  background: #f1f5f9;
  border: none;
  padding: 9px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
}
.btn-primary {
  background: #1e3a8a;
  color: white;
  border: none;
  padding: 9px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
}
.btn-primary:hover { background: #1e40af; }

/* STATS */
.stats-wrap { display: flex; flex-direction: column; gap: 20px; }
.stats-section {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.stats-section h3 { font-size: 15px; font-weight: 700; color: #1e293b; margin-bottom: 16px; border-bottom: 2px solid #f1f5f9; padding-bottom: 8px; }
.stats-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-card { background: #f8fafc; border-radius: 10px; padding: 16px 20px; min-width: 120px; flex: 1; }
.stat-num  { font-size: 30px; font-weight: 800; }
.stat-lbl  { font-size: 11px; color: #94a3b8; margin-top: 3px; }
.stats-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th { text-align: right; padding: 8px 10px; background: #f8fafc; font-size: 12px; color: #64748b; border-bottom: 2px solid #e2e8f0; }
.stats-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.stats-table tr:last-child td { border-bottom: none; }

.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding: 0 4px 0;
  border-bottom: 2px solid #e2e8f0;
  overflow-x: auto;
}
.month-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 44px;
  height: 100%;
  gap: 4px;
}
.month-bar-fill {
  width: 32px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s;
}
.month-bar-num { font-size: 12px; font-weight: 700; color: #1e40af; }
.month-bar-lbl { font-size: 10px; color: #94a3b8; white-space: nowrap; }

.gviya-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e3a8a;
  color: white;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  font-family: Heebo, sans-serif;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}
.gviya-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── FINANCES MODULE ─────────────────────────────────── */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap #search { padding-left: 28px; }
.search-clear {
  position: absolute;
  left: 6px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.search-clear:hover { color: white; }

.btn-archive-header {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: white; border-radius: 8px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  font-family: Heebo, sans-serif; cursor: pointer; transition: background 0.15s;
}
.btn-archive-header:hover { background: rgba(255,255,255,0.22); }
.btn-archive-header.active { background: #059669; border-color: #059669; }

.btn-finances {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: Heebo, sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-finances:hover { background: rgba(255,255,255,0.22); }
.btn-finances.active { background: #f59e0b; border-color: #f59e0b; color: #1e3a8a; }

.fin-container { max-width: 900px; margin: 0 auto; }

.fin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.fin-title { font-size: 20px; font-weight: 700; color: #1e3a8a; }
.fin-month-select { display: flex; gap: 8px; align-items: center; }
.fin-month-select select {
  padding: 7px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: Heebo, sans-serif;
  font-size: 14px;
  direction: rtl;
  cursor: pointer;
}
.fin-save-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.2s;
}
.fin-save-status.saving { color: #d97706; background: #fef3c7; }
.fin-save-status.saved  { color: #059669; background: #d1fae5; }

.fin-closed { border-right: 4px solid #1e3a8a; }

/* Bell button */
.btn-bell {
  background: #7c3aed; color: white; border: none;
  border-radius: 8px; padding: 6px 12px;
  font-size: 13px; font-weight: 700;
  font-family: Heebo, sans-serif; cursor: pointer;
  animation: bell-pulse 2s infinite;
}
@keyframes bell-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(124,58,237,0); }
}

/* Reminders */
.reminder-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.rem-card { border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; border: 1.5px solid #e2e8f0; }
.rem-overdue { border-color: #fca5a5; background: #fff5f5; }
.rem-soon    { border-color: #fde68a; background: #fffbeb; }
.rem-ok      { background: #f8fafc; }
.rem-top     { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rem-days    { font-size: 12px; font-weight: 700; color: #64748b; }
.rem-overdue .rem-days { color: #dc2626; }
.rem-soon    .rem-days { color: #d97706; }
.rem-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rem-btn { padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; font-family: Heebo, sans-serif; cursor: pointer; border: none; text-decoration: none; display: inline-block; }
.rem-wa      { background: #25d366; color: white; }
.rem-gcal    { background: #4285f4; color: white; }
.rem-postpone{ background: #f1f5f9; color: #475569; }
.rem-done    { background: #d1fae5; color: #059669; }
#reminders-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:1000;display:flex;align-items:center;justify-content:center; }
#reminders-overlay.hidden { display:none!important; }

/* Thursday view */
.thu-header {
  font-size: 16px; font-weight: 700; color: #1e3a8a;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
}
.thu-section { margin-bottom: 20px; }
.thu-title {
  font-size: 14px; font-weight: 700; color: #1e3a8a;
  margin-bottom: 10px; padding-right: 10px;
  border-right: 4px solid #1e3a8a;
}

/* MoM badges */
.mom-badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; margin-right: 4px; }
.mom-up    { background: #d1fae5; color: #059669; }
.mom-down  { background: #fef2f2; color: #dc2626; }

/* Analytics */
.btn-analytics {
  background: #ede9fe;
  border: 1.5px solid #c4b5fd;
  color: #5b21b6; border-radius: 8px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  font-family: Heebo, sans-serif; cursor: pointer; transition: background 0.15s;
}
.btn-analytics:hover  { background: #ddd6fe; }
.btn-analytics.active { background: #7c3aed; border-color: #7c3aed; color: white; }

.forecast-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.forecast-card {
  background: #f8fafc; border: 1.5px solid #e2e8f0;
  border-radius: 10px; padding: 14px;
}
.forecast-current { border-color: #1e3a8a; background: #eff6ff; }
.forecast-month { font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 4px; }
.forecast-total { font-size: 20px; font-weight: 800; color: #1e3a8a; margin-bottom: 8px; }
.forecast-item  { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 0; color: #475569; }

.year-summary-box { background: linear-gradient(135deg, #eff6ff, #f5f3ff); border: 2px solid #1e3a8a; }
.deal-in-progress {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

/* DASHBOARD KPI */
.fin-dashboard { margin-bottom: 16px; }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
.dash-card {
  background: white;
  border-radius: 12px;
  padding: 16px 14px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-icon { font-size: 18px; }
.dash-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.dash-big {
  font-size: 28px;
  font-weight: 800;
  color: #1e3a8a;
  line-height: 1;
}
.dash-target-row {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.dash-target-inp {
  width: 90px;
  padding: 2px 6px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-family: Heebo,sans-serif;
  text-align: center;
  direction: ltr;
  background: #f8fafc;
}
.dash-target-inp:focus {
  outline: none;
  border-color: #1e3a8a;
  background: white;
}
.dash-bar-bg {
  height: 22px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.dash-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.dash-pct {
  font-size: 13px;
  font-weight: 700;
}
.dash-remain {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}
.dash-card-stat .dash-big { color: #0f172a; }
.dash-sub-val {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.fin-section {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  margin-bottom: 16px;
}
.fin-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}
.fin-empty { color: #94a3b8; font-size: 14px; text-align: center; padding: 20px; }

.fin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fin-table th {
  background: #f1f5f9;
  padding: 8px 10px;
  text-align: right;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}
.fin-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.fin-table tfoot td { font-weight: 700; border-top: 2px solid #e2e8f0; background: #f8fafc; }
.fin-table .fin-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-src-cell { cursor: pointer; }
.fin-src-cell:hover .src-badge { background: #ddd6fe; }
.fin-edit-client { opacity: 0; transition: opacity 0.15s; }
tr:hover .fin-edit-client { opacity: 1; }
.fin-table .fin-date { text-align: center; color: #94a3b8; font-size: 12px; white-space: nowrap; }
.fin-total-row td { padding: 10px; }

.commission-row { background: #fef9f0; }
.commission-row td { color: #92400e; font-size: 12px; }

.exp-inp {
  padding: 5px 8px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-family: Heebo, sans-serif;
  font-size: 13px;
  direction: rtl;
  width: 100%;
  box-sizing: border-box;
}
.exp-inp:focus { outline: none; border-color: #1e3a8a; }
.exp-name { min-width: 130px; }

.vat-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.vat-toggle input { cursor: pointer; }
.vat-amt { font-size: 12px; color: #64748b; }

.btn-add-exp {
  margin-top: 10px;
  background: #f1f5f9;
  border: 1.5px dashed #94a3b8;
  border-radius: 8px;
  padding: 8px 20px;
  font-family: Heebo, sans-serif;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  width: 100%;
}
.btn-add-exp:hover { background: #e2e8f0; }

.fin-balance { border: 2px solid #e2e8f0; }
.fin-balance-red { border-color: #fca5a5; background: #fff5f5; }
.balance-grid { display: flex; flex-direction: column; gap: 10px; }
.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: #475569;
}
.balance-main {
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
}
.balance-ok { background: #f0fdf4; color: #059669; }
.balance-danger { background: #fef2f2; color: #dc2626; }
.balance-divider { height: 1px; background: #e2e8f0; margin: 4px 0; }
.balance-vat { font-weight: 600; color: #1e3a8a; }
.bal-val { font-weight: 700; font-size: 15px; }
.bal-val.green { color: #059669; }
.bal-val.red { color: #dc2626; }
.red-line-msg, .green-line-msg {
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
}
.red-line-msg   { background: #dc2626; color: white; }
.green-line-msg { background: #059669; color: white; }

.vat-toggle-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.src-badge {
  background: #ede9fe;
  color: #5b21b6;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ── PAYMENTS TAB ────────────────────────────────────── */
.pay-summary-bar {
  display: flex;
  gap: 16px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pay-stat { text-align: center; }
.pay-val { font-size: 18px; font-weight: 700; }
.pay-lbl { font-size: 11px; color: #94a3b8; font-weight: 600; margin-top: 2px; }

.pay-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  background: white;
  gap: 8px;
}
.pay-item.pay-done { background: #f0fdf4; border-color: #bbf7d0; }
.pay-item-main { display: flex; flex-direction: column; gap: 2px; }
.pay-status-label { font-size: 12px; color: #64748b; }
.pay-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-pay-received {
  background: #059669;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: Heebo, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-add-payment {
  width: 100%;
  padding: 10px;
  background: #f1f5f9;
  border: 1.5px dashed #94a3b8;
  border-radius: 8px;
  font-family: Heebo, sans-serif;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  margin-top: 8px;
}
.btn-add-payment:hover { background: #e2e8f0; }

.btn-feedback {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-feedback:hover { background: rgba(255,255,255,0.22); }

#feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#feedback-overlay.hidden { display: none !important; }

.feedback-modal {
  background: white;
  border-radius: 14px;
  width: 380px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}
.feedback-header {
  background: #1e3a8a;
  color: white;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 15px;
}
.feedback-header button {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
}
.feedback-header button:hover { opacity: 1; }
.feedback-body { padding: 16px; }
.feedback-types {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
}
.feedback-types label { cursor: pointer; display: flex; align-items: center; gap: 5px; }
#fb-text {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  font-family: Heebo, sans-serif;
  font-size: 14px;
  direction: rtl;
  resize: vertical;
  box-sizing: border-box;
}
#fb-text:focus { outline: none; border-color: #1e3a8a; }

.quick-payment-box {
  margin: 0 24px 16px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 10px;
  padding: 14px 16px;
}
.quick-payment-title {
  font-size: 13px;
  font-weight: 700;
  color: #059669;
  margin-bottom: 10px;
}
.qp-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  display: block;
  margin-bottom: 4px;
}
.quick-payment-box input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #d1fae5;
  border-radius: 7px;
  font-family: Heebo, sans-serif;
  font-size: 13px;
  direction: rtl;
  box-sizing: border-box;
  background: white;
}
.quick-payment-box input:focus { outline: none; border-color: #059669; }

.archive-divider {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  margin: 4px 0 12px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}
.btn-msg-template {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: Heebo, sans-serif;
  cursor: pointer;
  color: #1e3a8a;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-msg-template:hover { background: #e2e8f0; }
.archive-input {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: Heebo, sans-serif;
  font-size: 14px;
  direction: rtl;
  box-sizing: border-box;
}
.archive-input:focus { outline: none; border-color: #1e3a8a; }

/* USERS MANAGEMENT */
#users-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:1000;display:flex;align-items:center;justify-content:center; }
#users-overlay.hidden { display:none!important; }
.users-client-list {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.user-card-header strong { font-size: 14px; }
.user-card-header span { font-size: 12px; color: #94a3b8; }
.user-card-actions { display: flex; gap: 6px; }

.gs-header {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 8px;
}
.gs-archive-tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
  vertical-align: middle;
}

.archive-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #92400e;
  font-weight: 600;
}

/* MOBILE */
@media (max-width: 640px) {
  main { padding: 12px; }
  header { flex-direction: column; gap: 10px; }
  .header-controls { width: 100%; justify-content: space-between; }
  #search { width: 160px; }
  .form-grid { grid-template-columns: 1fr; }
  .summary-card .num { font-size: 20px; }
}

/* ── תג תיק תקוע ────────────────────────────────────── */
.stuck-badge {
  display: inline-block;
  background: #f3e8ff;
  color: #7c3aed;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 4px;
  white-space: nowrap;
}

/* ── צ'קליסט חוסרים ─────────────────────────────────── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px 12px;
  margin: 6px 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}
.doc-chk {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}
.doc-chk input { accent-color: #1e3a8a; }

/* ── פח נמחקים ──────────────────────────────────────── */
#trash-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:1000;display:flex;align-items:center;justify-content:center; }
#trash-overlay.hidden { display:none!important; }
.doc-chk-all { font-weight: 700; color: #1e3a8a; grid-column: 1 / -1; border-bottom: 1px solid #e2e8f0; padding-bottom: 5px; }

/* ── כותרות טבלה דביקות (דסקטופ) ────────────────────── */
@media (min-width: 769px) {
  .table-wrap { overflow-x: visible; }
  thead th {
    position: sticky;
    top: 56px; /* גובה ה-header הדביק של העמוד */
    background: #f8fafc;
    z-index: 5;
  }
}

/* ── כרטיסי לקוח למובייל ────────────────────────────── */
.m-cards { display: none; }
@media (max-width: 768px) {
  .table-wrap.has-m-cards { display: none; }
  .m-cards { display: flex; flex-direction: column; gap: 8px; }
  .m-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    position: relative;
  }
  .m-card.row-upcoming { background: #f0f9ff; border-color: #bae6fd; }
  .m-card.row-urgent,
  .m-card.row-overdue  { background: #fef2f2; border-color: #fecaca; }
  .m-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
  .m-card-line { font-size: 13px; color: #334155; margin-top: 6px; }
  .m-card-line.urg-red { color: #dc2626; font-weight: 600; }
  .m-card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #64748b; margin-top: 6px; align-items: center; }
  .m-card-actions { position: absolute; bottom: 10px; left: 12px; display: flex; gap: 6px; }
}

/* ── תיקים נוספים של אותו לקוח ─────────────────────── */
#related-cases {
  padding: 8px 24px;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.rel-chip {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 12px;
  font-family: Heebo, sans-serif;
  cursor: pointer;
  margin: 0 2px;
}
.rel-chip:hover { background: #dbeafe; }

/* כפתור שקט — נוכח אבל לא צועק */
.btn-quiet { color: #94a3b8; border-color: transparent; background: transparent; font-size: 13px; }
.btn-quiet:hover { color: #1e3a8a; }
.btn-quiet.active { color: #1e3a8a; background: #eff6ff; border-color: #bfdbfe; }

/* ── סרגל עליון במובייל ─────────────────────────────── */
.more-wrap { display: none; }
@media (max-width: 768px) {
  header { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  header h1 { font-size: 16px; white-space: nowrap; }
  .header-controls { flex-wrap: wrap; gap: 8px; row-gap: 8px; }
  /* חיפוש יורד לשורה מלאה משלו */
  .search-wrap { order: 10; flex-basis: 100%; }
  #search { width: 100%; box-sizing: border-box; }
  /* כפתורי ניהול נדירים מתקפלים לתפריט ⋯ */
  .header-controls > div[data-requires="export"],
  .header-controls > div[data-requires="import"],
  #btn-users, #btn-add-passkey, .btn-feedback { display: none !important; }
  .more-wrap { display: block; }
  #more-menu { left: 0; right: auto; }
  /* פעולות יומיומיות - אייקון בלבד */
  .btn-label { display: none; }
  .btn-archive-header, .btn-finances, .btn-primary { padding: 8px 12px; }
}

/* ── מובייל: סרגל עליון בערימה + מסך מדדים בטור ─────── */
@media (max-width: 768px) {
  header { flex-direction: column; align-items: stretch; }
  header h1 { text-align: center; font-size: 17px; }
  .header-controls { justify-content: center; }

  .year-bar { padding: 8px 10px; }
  .yr-btn { padding: 5px 10px; font-size: 12px; }

  .stats-row { flex-direction: column; }
  .stats-section { padding: 14px; }
  .stat-card { min-width: 90px; padding: 12px 14px; }
  .stat-num { font-size: 22px; }
  .month-chart { overflow-x: auto; padding-bottom: 6px; }
}

/* ── מובייל: מניעת גלישה רוחבית שמכווצת את כל העמוד ── */
@media (max-width: 768px) {
  html, body { max-width: 100vw; overflow-x: hidden; }
  /* טבלאות סטטיסטיקה ירשו בטעות min-width של טבלת הלקוחות (600px) ומתחו את העמוד */
  .stats-table { min-width: 0; width: 100%; }
  .stats-table th, .stats-table td { padding: 6px; font-size: 12px; }
  .summary { flex-wrap: wrap; }
  .summary-card { min-width: 72px; flex: 1; }
}

/* ── מובייל: כרטיס לקוח נוח לעריכה ──────────────────── */
@media (max-width: 768px) {
  /* iOS עושה זום אוטומטי לשדות מתחת ל-16px - זה מקור ה"נפתח גדול מדי" */
  .form-group input, .form-group select, .form-group textarea,
  #new-note-input, td.ed input, td.ed select {
    font-size: 16px !important;
  }
  /* המודל הופך לגיליון מסך-מלא במקום חלון צף */
  #overlay .modal {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .form-grid { padding: 12px 14px; gap: 10px; }
  .modal-tabs { margin: 10px 14px 0; overflow-x: auto; }
  .docs-grid { grid-template-columns: 1fr 1fr; }
}

/* ── תפריט טלפון קופץ (חיוג / וואטסאפ / הודעה) ──────── */
#phone-menu {
  position: fixed;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  min-width: 170px;
  z-index: 10000;
  overflow: hidden;
}
#phone-menu a {
  padding: 11px 16px;
  font-size: 14px;
  color: #1e293b;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
}
#phone-menu a:last-child { border-bottom: none; }
#phone-menu a:hover { background: #f8fafc; }

/* ── מסך השלמת נתונים ───────────────────────────────── */
#complete-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:1000;display:flex;align-items:center;justify-content:center; }
#complete-overlay.hidden { display:none!important; }
.cmp-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.cmp-fields { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-fields input, .cmp-fields select {
  padding: 7px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-family: Heebo, sans-serif;
  font-size: 13px;
  max-width: 150px;
}
@media (max-width: 768px) {
  .cmp-fields input, .cmp-fields select { font-size: 16px; max-width: 46%; }
}
.m-lbl { color: #94a3b8; font-weight: 600; font-size: 11px; }
