/* theme_sync.css — איחוד מלא של ערכת-העיצוב עם שאר המערכת (CRM).
   נטען אחרון. מגדיר את פלטת ה-CRM לכל שמות-המשתנים (משתי המוסכמות: styles.css
   ו-madlan_theme.css), במצב בהיר ובמצב כהה, עם כל טריגרי-ה-dark:
   :root[data-theme="dark"], body.dark-mode, ו-@media(prefers-color-scheme:dark).
   פלטה כהה = GitHub-dark (#0d1117) זהה ל-crm.html. */

/* ---------- מצב בהיר (ברירת מחדל) — פלטת CRM ---------- */
:root {
  /* מוסכמת CRM/madlan */
  --bg: #faf8f4; --surface: #fff; --surface2: #f3efe8; --surface-2: #f3efe8;
  --border: #e5e0d8; --border-strong: #d8d2c8;
  --text: #1a1a1a; --text-2: #4b5563; --text-medium: #4b5563; --text-soft: #7a7268; --text-muted: #7a7268; --muted: #7a7268;
  --accent: #e8603f; --accent-2: #f78166; --accent-soft: #fbeee9;
  --primary: #e8603f; --primary-hover: #d1493f; --primary-soft: #fbeee9;
  --green: #3a9d5d; --success: #3a9d5d; --red: #d1493f; --danger: #d1493f;
  --gold: #c98a1a; --warning: #c98a1a; --blue: #2f6fd1; --info: #2f6fd1; --purple: #7c5cc4;
  /* מוסכמת styles.css (bg-*) */
  --bg-page: #faf8f4; --bg-card: #fff; --bg-subtle: #f3efe8;
}

/* ---------- מצב כהה — פלטת GitHub-dark זהה ל-CRM ---------- */
:root[data-theme="dark"],
body.dark-mode {
  --bg: #0d1117; --surface: #161b22; --surface2: #1c2128; --surface-2: #1c2128;
  --border: #30363d; --border-strong: #444c56;
  --text: #e6edf3; --text-2: #adbac7; --text-medium: #adbac7; --text-soft: #8b949e; --text-muted: #8b949e; --muted: #8b949e;
  --accent: #f78166; --accent-2: #ff9b7a; --accent-soft: #21262d;
  --primary: #f78166; --primary-hover: #ff9b7a; --primary-soft: #21262d;
  --green: #3fb950; --success: #3fb950; --red: #ff7b72; --danger: #ff7b72;
  --gold: #ffd700; --warning: #ffd700; --blue: #58a6ff; --info: #58a6ff; --purple: #bc8cff;
  --bg-page: #0d1117; --bg-card: #161b22; --bg-subtle: #1c2128;
}

/* מצב כהה אוטומטי לפי מערכת-ההפעלה — כשאין בחירה מפורשת (data-theme=light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #161b22; --surface2: #1c2128; --surface-2: #1c2128;
    --border: #30363d; --border-strong: #444c56;
    --text: #e6edf3; --text-2: #adbac7; --text-medium: #adbac7; --text-soft: #8b949e; --text-muted: #8b949e; --muted: #8b949e;
    --accent: #f78166; --accent-2: #ff9b7a; --accent-soft: #21262d;
    --primary: #f78166; --primary-hover: #ff9b7a; --primary-soft: #21262d;
    --green: #3fb950; --success: #3fb950; --red: #ff7b72; --danger: #ff7b72;
    --gold: #ffd700; --warning: #ffd700; --blue: #58a6ff; --info: #58a6ff; --purple: #bc8cff;
    --bg-page: #0d1117; --bg-card: #161b22; --bg-subtle: #1c2128;
  }
}

/* כיבוי אנימציית-הרקע והבלובים (עקביות עם ה-CRM השטוח) */
body { animation: none !important; background: var(--bg) !important; color: var(--text); }
.bg-blob, .bg-shape, .bg-animation { display: none !important; }

/* פונט אחיד */
html, body { font-family: 'Heebo', Arial, sans-serif; }

/* ---------- אכיפת פלטת GitHub-dark על הכללים המוטבעים ב-styles.css ----------
   הסלקטורים משקפים בדיוק את styles.css (אותה ספֵּציפיוּת) ו-theme_sync נטען
   אחרון — לכן גובר. מחליף את ה-slate (#0f172a/#1e293b) בפלטת ה-CRM. */
body.dark-mode { background: var(--bg) !important; color: var(--text) !important; }
body.dark-mode .topbar { background: var(--surface) !important; border-color: var(--border) !important; }
body.dark-mode .panel, body.dark-mode .form-section, body.dark-mode .settings-section,
body.dark-mode .card, body.dark-mode .info-box, body.dark-mode .gov-card,
body.dark-mode .archive-card, body.dark-mode .method-card, body.dark-mode .area-info-display,
body.dark-mode .results, body.dark-mode .breakdown, body.dark-mode .pro-comparison,
body.dark-mode .pro-impact-box, body.dark-mode .pro-list-col, body.dark-mode .deep-neighborhood,
body.dark-mode .tabs {
  background: var(--surface) !important; border-color: var(--border) !important; color: var(--text) !important;
}
body.dark-mode input, body.dark-mode select, body.dark-mode textarea,
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea,
body.dark-mode .field input, body.dark-mode .field select, body.dark-mode .field textarea {
  background: var(--surface2) !important; color: var(--text) !important; border: 1px solid var(--border) !important;
}
body.dark-mode input:focus, body.dark-mode select:focus, body.dark-mode textarea:focus {
  background: var(--surface) !important; border-color: var(--accent) !important;
}
body.dark-mode option, body.dark-mode datalist {
  background: var(--surface) !important; color: var(--text) !important;
}
