/* זנזיבראינפו · מערכת הניהול · גרסה 0.4.1 · שלב 1 (0.4.1: מונה אישורים בניווט, טבלת עריכת השאלון)
   עיצוב פרימיום ברוח האתר: אוקיינוס, חול ושקיעה, מוטיבים אפריקאיים עדינים, הנפשות רכות. */

:root {
  --ink: #1b2a2f;
  --ink-2: #4a5a60;
  --muted: #7d8a8f;
  --line: #e3dccf;
  --sand: #f7f1e6;
  --sand-2: #efe4d0;
  --paper: #fffdf9;
  --ocean: #0f6b4f;
  --ocean-deep: #0a4a37;
  --ocean-soft: #dcefe6;
  --sunset: #1fa6e0;
  --sunset-soft: #d9eefa;
  --gold: #c9a24a;
  --leaf: #3d7a4a;
  --leaf-soft: #dff0e2;
  --danger: #b8392f;
  --danger-soft: #f8dcd9;
  --warn: #c98a1b;
  --warn-soft: #fbeccb;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(27, 42, 47, 0.08);
  --shadow-sm: 0 2px 10px rgba(27, 42, 47, 0.06);
  --font: 'Heebo', 'Segoe UI', Arial, sans-serif;
  --font-display: 'Frank Ruhl Libre', 'Heebo', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--sand);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--ocean); }
h1, h2, h3 { margin: 0 0 0.4em; font-weight: 600; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; line-height: 1.6; }
code { font-family: Consolas, monospace; font-size: 0.9em; background: var(--sand-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- מוטיב אפריקאי עדין: פס קנטה בראש ---------- */
.kente {
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--ocean) 0 28px, var(--gold) 28px 40px, var(--sunset) 40px 60px, var(--sand-2) 60px 72px);
  opacity: 0.85;
}

/* ---------- כניסה ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--ocean-soft), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, var(--sunset-soft), transparent 60%),
    var(--sand);
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.5s ease-out both;
}
.brand h1 { font-family: var(--font-display); font-size: 2rem; color: var(--ocean-deep); margin-top: 10px; }
.brand-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 22px; }
.brand-logo { width: min(240px, 70%); height: auto; display: block; margin: 0 auto 6px; }
.topbar-mark { height: 40px; width: auto; display: block; }
.login-message { color: var(--ink-2); min-height: 1.6em; }
.login-foot { color: var(--muted); font-size: 0.82rem; margin-top: 18px; margin-bottom: 0; }
.g-icon {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; color: #4285f4; font-weight: 700; margin-left: 8px; font-size: 0.9rem;
}

/* ---------- כפתורים ---------- */
.btn {
  font-family: inherit; font-size: 0.95rem; font-weight: 500;
  border: 1px solid transparent; border-radius: 999px; padding: 10px 20px;
  cursor: pointer; transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-flex; align-items: center; gap: 8px; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--ocean); color: #fff; box-shadow: 0 6px 16px rgba(11, 110, 114, 0.25); }
.btn-primary:hover { background: var(--ocean-deep); }
.btn-accent { background: var(--sunset); color: #fff; }
.btn-ghost { background: transparent; color: var(--ocean-deep); border-color: var(--line); }
.btn-ghost:hover { background: var(--sand-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-wide { width: 100%; justify-content: center; padding: 13px 20px; font-size: 1.02rem; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper);
  color: var(--ocean-deep); font-weight: 700; cursor: pointer;
}
.icon-btn:hover { background: var(--sand-2); }

/* ---------- מעטפת ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 22px; background: rgba(255, 253, 249, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: repeating-linear-gradient(90deg, var(--ocean) 0 28px, var(--gold) 28px 40px, var(--sunset) 40px 60px, var(--sand-2) 60px 72px);
  opacity: 0.8;
}
.topbar-right, .topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-family: var(--font-display); font-weight: 700; color: var(--ocean-deep); font-size: 1.1rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink-2); padding: 8px 14px; border-radius: 999px; font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav a:hover { background: var(--sand-2); }
.nav a.active { background: var(--ocean); color: #fff; }
.nav-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--sunset); color: #fff; font-size: 0.72rem; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
.nav a.active .nav-count { background: #fff; color: var(--ocean-deep); }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: var(--ocean-soft); color: var(--ocean-deep);
}
.badge-muted { background: var(--sand-2); color: var(--ink-2); }
.pill {
  display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}
.pill-ok { background: var(--leaf-soft); color: var(--leaf); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-down { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--sand-2); color: var(--muted); }

.main {
  flex: 1; width: min(1180px, 100%); margin: 0 auto; padding: 26px 22px 40px;
  animation: fade 0.35s ease both;
}
.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 12px 22px; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--line);
}
.footer b { color: var(--ink-2); font-weight: 600; }

/* ---------- כרטיסים וגריד ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-family: var(--font-display); font-size: 1.6rem; color: var(--ocean-deep); }
.page-head p { color: var(--ink-2); margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  animation: rise 0.4s ease both;
}
.card h3 { display: flex; align-items: center; gap: 8px; }
.stat { font-size: 2rem; font-weight: 700; color: var(--ocean-deep); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.card.accent { border-color: transparent; background: linear-gradient(135deg, var(--ocean) 0%, var(--ocean-deep) 100%); color: #fff; }
.card.accent .stat, .card.accent h3 { color: #fff; }
.card.accent .stat-label { color: rgba(255, 255, 255, 0.8); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- טבלאות ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: right; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.table tr:hover td { background: rgba(239, 228, 208, 0.35); }
.table .num { font-variant-numeric: tabular-nums; }

/* ---------- טפסים ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="number"], input[type="url"], select, textarea {
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ocean-soft); border-color: var(--ocean); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.switch:last-child { border-bottom: 0; }
.switch .label { display: flex; flex-direction: column; }
.switch .label small { color: var(--muted); }
.toggle { position: relative; width: 46px; height: 26px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span {
  position: absolute; inset: 0; background: #cfd6d8; border-radius: 999px; cursor: pointer; transition: background 0.2s ease;
}
.toggle span::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform 0.2s ease; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.toggle input:checked + span { background: var(--leaf); }
.toggle input:checked + span::after { transform: translateX(-20px); }
.toggle.master input:checked + span { background: var(--ocean); }
.toggle input:disabled + span { opacity: 0.5; cursor: not-allowed; }

/* ---------- התראות ---------- */
.notice { padding: 12px 16px; border-radius: 12px; font-size: 0.92rem; margin-bottom: 14px; }
.notice-warn { background: var(--warn-soft); color: #7a5100; }
.notice-danger { background: var(--danger-soft); color: var(--danger); }
.notice-ok { background: var(--leaf-soft); color: var(--leaf); }
.notice-info { background: var(--ocean-soft); color: var(--ocean-deep); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.toasts { position: fixed; bottom: 18px; left: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 0.9rem;
  box-shadow: var(--shadow); animation: rise 0.25s ease both; max-width: 360px;
}
.toast.ok { background: var(--leaf); }
.toast.err { background: var(--danger); }

/* ---------- טוטוריאל זרקור ---------- */
.tutorial { position: fixed; inset: 0; z-index: 50; }
.tutorial-hole {
  position: absolute; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(7, 72, 76, 0.62);
  transition: all 0.3s ease; outline: 2px solid var(--gold);
}
.tutorial-card {
  position: absolute; width: min(340px, calc(100vw - 32px)); background: var(--paper); border-radius: 16px;
  padding: 18px 20px 14px; box-shadow: var(--shadow); animation: rise 0.3s ease both;
}
.tutorial-card h3 { color: var(--ocean-deep); padding-left: 24px; }
.tutorial-close { position: absolute; top: 10px; left: 12px; border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.tutorial-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.tutorial-step { margin-left: auto; color: var(--muted); font-size: 0.8rem; }

/* ---------- הנפשות ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- לידים (0.2.0) ---------- */
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { box-shadow: var(--shadow); }
.leads-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; padding: 12px 16px; }
.leads-toolbar input[type="search"] { flex: 1 1 220px; min-width: 160px; font-family: inherit; font-size: 0.95rem; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; }
.leads-toolbar select { max-width: 180px; }
.chip-count { background: var(--sand-2); border-radius: 999px; padding: 4px 11px; font-size: 0.8rem; color: var(--ink-2); margin-right: auto; }
.leads-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.leads-layout.has-drawer { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
.leads-list { padding: 4px 6px; overflow: auto; }
.leads-list .table td { padding: 9px 10px; }
.leads-list tr[data-id] { cursor: pointer; }
.leads-list tr.selected td { background: var(--ocean-soft); }
.lead-name { font-weight: 600; }
.lead-sub { color: var(--muted); font-size: 0.8rem; display: block; direction: ltr; text-align: right; }
.lead-preview { color: var(--ink-2); font-size: 0.82rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.stage { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.stage-new { background: var(--sunset-soft); color: #0b5f85; }
.stage-progress { background: var(--ocean-soft); color: var(--ocean-deep); }
.stage-warm { background: var(--leaf-soft); color: var(--leaf); }
.stage-converted { background: var(--ocean); color: #fff; }
.stage-closed { background: var(--sand-2); color: var(--muted); }
.lead-drawer { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.drawer-head h3 { font-family: var(--font-display); font-size: 1.25rem; color: var(--ocean-deep); margin: 0; }
.drawer-section { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.drawer-section h4 { margin: 0 0 8px; font-size: 0.9rem; color: var(--ink-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.thread { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; padding: 8px; background: var(--sand); border-radius: 12px; }
.bubble { max-width: 86%; padding: 8px 12px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bubble.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-top-right-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--leaf-soft); border-top-left-radius: 4px; }
.bubble time { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(7, 72, 76, 0.5); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(640px, 100%); background: var(--paper); border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; animation: rise 0.25s ease both; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.demo-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.demo-col { background: var(--sand); border-radius: 12px; padding: 8px; }
.demo-head { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink-2); }
@media (max-width: 1000px) {
  .leads-layout.has-drawer { grid-template-columns: 1fr; }
  .lead-drawer { position: static; max-height: none; }
  .demo-compare { grid-template-columns: 1fr; }
}

/* ---------- מובייל ---------- */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; justify-content: center; }
  .topbar-left { margin-right: auto; }
  .main { padding: 18px 14px 30px; }
}
