/* מחוברות · משימות — מיתוג מחוברות: שחור/צהוב/לבן, Assistant */
:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --ink: #2c2a29;
  --muted: #6f6d6a;
  --line: #e9e7e2;
  --brand: #ffdc27;            /* הצהוב של מחוברות */
  --brand-hover: #ffe45a;
  --brand-soft: #fff8d6;
  --dark: #2c2a29;             /* השחור של מחוברות */
  --good: #2e7d5b;
  --good-soft: #e3f2ea;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --bad: #c23a3a;
  --bad-soft: #fbe9e9;
  --shadow: 0 1px 2px rgba(44,42,41,.05), 0 8px 24px rgba(44,42,41,.08);
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Assistant', system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh; line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: #fff; min-width: 0;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--dark); }
label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
button { cursor: pointer; border: none; background: none; }
h2 { font-size: 1.15rem; font-weight: 700; }

/* ---------- אייקונים ואנימציות בסיס ---------- */
.ic { width: 1.05em; height: 1.05em; vertical-align: -0.18em; flex: none; }
.bn-svg { width: 20px; height: 20px; }
#apiBar {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 300;
  background: linear-gradient(90deg, var(--brand), #f0c400, var(--brand));
  background-size: 200% 100%; transform-origin: right; display: none;
}
#apiBar.on { display: block; animation: barMove 1s linear infinite; }
@keyframes barMove { from { background-position: 0 0; } to { background-position: 200% 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes fadeIn { from { opacity: 0; } }
.main > * { animation: fadeUp .4s cubic-bezier(.22,1,.36,1) backwards; }
.task-row, .client-card, .stat, .sugg-row, .wa-sugg-item, .wa-chat-row {
  animation: fadeUp .38s cubic-bezier(.22,1,.36,1) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.vanish { transform: scale(.95) translateX(12px); opacity: 0; transition: all .3s cubic-bezier(.4,0,1,1); }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; padding: 9px 18px; font-weight: 700; font-size: .95rem;
  transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .15s, background .15s;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--brand); color: var(--dark); box-shadow: 0 4px 14px rgba(255,220,39,.45); position: relative; overflow: hidden; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.6), transparent);
  inset-inline-start: -60%; transition: none;
}
.btn-primary:hover::after { inset-inline-start: 130%; transition: inset-inline-start .6s ease; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-ghost { background: var(--brand-soft); color: var(--dark); }
.btn-plain { background: #efedea; color: var(--ink); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- כניסה ---------- */
.login-body { display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #fff8d6, var(--bg) 55%); }
.login-card {
  width: min(400px, 100%); background: var(--card); border-radius: 22px;
  box-shadow: var(--shadow); padding: 36px 30px 22px;
  border-top: 6px solid var(--brand);
}
.brand { text-align: center; margin-bottom: 26px; }
.brand h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.5px; }
.brand p { color: var(--muted); font-size: .9rem; }
.brand-mark {
  width: 60px; height: 60px; margin: 0 auto 10px; border-radius: 16px;
  background: var(--brand);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(255,220,39,.5);
}
.brand-mark img { width: 60%; height: auto; display: block; }
.brand-mark.sm { width: 36px; height: 36px; border-radius: 10px; margin: 0; box-shadow: none; }
.login-err { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 9px 12px; font-size: .88rem; margin-bottom: 12px; }
.login-foot { text-align: center; color: var(--muted); font-size: .72rem; margin-top: 20px; }

/* ---------- מסגרת ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 18px;
}
.brand-row { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.brand-sub { color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button {
  padding: 7px 14px; border-radius: 999px; font-weight: 600; color: var(--muted);
  transition: background .15s, color .15s; position: relative;
}
.tabs button:hover { background: #f2f0ec; }
.tabs button.active { background: var(--dark); color: #fff; }
.user-chip {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--dark); border-radius: 999px;
  padding: 6px 13px; font-weight: 700; font-size: .88rem; color: var(--dark);
}
.main { max-width: 1080px; margin: 0 auto; padding: 22px 18px 110px; }

/* ---------- ניווט תחתון (נייד) ---------- */
.bottomnav { display: none; }
@media (max-width: 760px) {
  .tabs { display: none; }
  .topbar-inner { justify-content: space-between; }
  .bottomnav {
    position: fixed; bottom: 0; inset-inline: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: center;
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav button {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: .7rem; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 12px;
  }
  .bottomnav button.active { color: var(--dark); font-weight: 800; }
  .bn-ico { font-size: 1.15rem; font-style: normal; }
  .bn-fab {
    width: 52px; height: 52px; border-radius: 50%; margin-top: -26px;
    background: var(--brand); color: var(--dark) !important;
    font-size: 1.5rem; box-shadow: 0 8px 20px rgba(255,220,39,.55);
    justify-content: center;
  }
}

/* ---------- כרטיסים ורשימות ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.section { margin-bottom: 20px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-head .count { background: var(--dark); color: var(--brand); border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 13px 16px; border-bottom: 3px solid var(--brand); }
.stat b { font-size: 1.5rem; display: block; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat.bad { border-bottom-color: var(--bad); }
.stat.bad b { color: var(--bad); }
.stat.warn { border-bottom-color: var(--warn); }
.stat.warn b { color: var(--warn); }
.stat.good { border-bottom-color: var(--good); }
.stat.good b { color: var(--good); }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 14px; cursor: pointer; transition: transform .12s;
}
.task-row:hover { transform: translateY(-1px); }
.task-row.done { opacity: .55; }
.task-row.done .task-title { text-decoration: line-through; }
.task-check {
  flex: none; width: 24px; height: 24px; border-radius: 8px; margin-top: 2px;
  border: 2px solid #d5d3ce; background: #fff; display: grid; place-items: center;
  color: transparent; font-weight: 800; transition: all .15s;
}
.task-check:hover { border-color: var(--good); }
.task-check.on { background: var(--good); border-color: var(--good); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 1px 9px;
  background: #f0eeea; color: var(--muted); white-space: nowrap;
}
.chip.client { background: var(--brand-soft); color: var(--dark); border: 1px solid #f4e28f; }
.chip.late { background: var(--bad-soft); color: var(--bad); }
.chip.today { background: var(--warn-soft); color: var(--warn); }
.chip.prio { background: var(--bad); color: #fff; }
.chip.ai { background: var(--dark); color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: .95rem; }

/* ---------- לקוחות ---------- */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.client-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; cursor: pointer; transition: transform .12s; border-right: 4px solid var(--brand); }
.client-card:hover { transform: translateY(-2px); }
.client-card h3 { font-size: 1rem; margin-bottom: 4px; overflow-wrap: anywhere; }
.client-card .cmeta { color: var(--muted); font-size: .8rem; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- סרגל כלים ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.toolbar input[type=text], .toolbar input[type=search] { flex: 2; min-width: 150px; }
.toolbar select { flex: 1; min-width: 110px; width: auto; }

/* ---------- קליטה חכמה ---------- */
.intake-box textarea { min-height: 150px; resize: vertical; }
.intake-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.audio-label { font-size: .85rem; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sugg-row { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.sugg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.sugg-grid .full { grid-column: 1 / -1; }
.sugg-head { display: flex; gap: 10px; align-items: center; }
.sugg-head input[type=text] { font-weight: 600; }
.transcript { background: #f5f3ef; border-radius: 12px; padding: 12px 14px; font-size: .88rem; white-space: pre-wrap; margin: 12px 0; max-height: 200px; overflow: auto; }

/* ---------- פאנל הצעות (וואטסאפ) ---------- */
.wa-sugg-panel {
  background: linear-gradient(135deg, #fffbe8, #fff);
  border: 1.5px solid var(--brand); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 20px;
}
.wa-sugg-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f2e9c8; }
.wa-sugg-item:last-child { border-bottom: none; }
.wa-sugg-body { flex: 1; min-width: 0; cursor: pointer; }
.wa-sugg-actions { display: flex; gap: 6px; flex: none; }
.mini-btn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; transition: transform .12s;
}
.mini-btn:active { transform: scale(.9); }
.mini-btn.yes { background: var(--good-soft); color: var(--good); }
.mini-btn.no { background: var(--bad-soft); color: var(--bad); }

/* ---------- וואטסאפ (צוות) ---------- */
.wa-card { margin-bottom: 20px; }
.wa-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wa-dot { width: 10px; height: 10px; border-radius: 50%; background: #c9c6c0; }
.wa-dot.on { background: var(--good); animation: waPulse 2.2s infinite; }
.wa-dot.qr { background: var(--warn); animation: waPulse 1.2s infinite; }
@keyframes waPulse {
  0% { box-shadow: 0 0 0 0 rgba(46,125,91,.45); }
  70% { box-shadow: 0 0 0 9px rgba(46,125,91,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,125,91,0); }
}
.wa-qr { text-align: center; padding: 14px; }
.wa-qr img { width: 240px; max-width: 100%; border: 8px solid #fff; border-radius: 12px; box-shadow: var(--shadow); }
.wa-chat-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.wa-chat-row:last-child { border-bottom: none; }
.wa-chat-row .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.wa-chat-row select { width: 160px; flex: none; font-size: .85rem; padding: 5px 8px; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0; border-radius: 999px; background: #d5d3ce; cursor: pointer; transition: .2s;
}
.switch .sl::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; top: 3px; inset-inline-start: 3px; transition: .2s;
}
.switch input:checked + .sl { background: var(--dark); }
.switch input:checked + .sl::before { transform: translateX(-18px); background: var(--brand); }

/* ---------- פרופיל לקוח ---------- */
.profile-card {
  background: linear-gradient(135deg, #fffbe8, #fff);
  border: 1.5px solid var(--brand); border-radius: 14px;
  padding: 14px 16px; margin: 0 0 14px;
}
.profile-summary { font-weight: 600; margin-bottom: 10px; }
.profile-row { display: flex; gap: 10px; padding: 6px 0; font-size: .9rem; align-items: flex-start; }
.profile-row b { font-size: .78rem; color: var(--muted); display: block; }
.p-ico { flex: none; width: 22px; text-align: center; }
.profile-list { margin: 2px 18px 0 0; padding: 0; }
.profile-list li { margin-bottom: 2px; }

/* ---------- מודאל ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(44,42,41,.45);
  display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px);
  animation: fadeIn .15s;
}
.modal {
  width: min(560px, 100%); max-height: 88dvh; overflow: auto;
  background: var(--card); border-radius: 20px; box-shadow: 0 20px 60px rgba(44,42,41,.3);
  padding: 22px; animation: pop .2s cubic-bezier(.34,1.56,.64,1);
  border-top: 5px solid var(--brand);
}
.modal h2 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- טוסט ---------- */
#toastRoot { position: fixed; bottom: 84px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  background: var(--dark); color: var(--brand); border-radius: 12px; padding: 10px 18px;
  font-size: .9rem; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: pop .25s cubic-bezier(.34,1.56,.64,1);
}
.toast.err { background: var(--bad); color: #fff; }

/* ---------- תדריך ---------- */
.brief-card { background: linear-gradient(135deg, #fffbe8, #fff); border: 1.5px solid var(--brand); }
.brief-text { white-space: pre-wrap; font-size: .95rem; margin-top: 10px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; display: inline-block;
  border: 3px solid var(--brand-soft); border-top-color: var(--dark);
  animation: spin .7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- טבלת צוות ---------- */
.table-wrap { overflow-x: auto; }
table.team { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.team th, table.team td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.team th { background: var(--dark); color: #fff; font-size: .82rem; }
table.team tr:last-child td { border-bottom: none; }

.note-row { border-bottom: 1px solid var(--line); padding: 9px 0; font-size: .9rem; }
.note-row:last-child { border-bottom: none; }
.note-meta { color: var(--muted); font-size: .75rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
