/* Life Changer - מערכת עיצוב. טוקנים לפי שפת המותג:
   סגול מוביל, כתום לכפתורי פעולה בלבד, Assistant, עיגול 12-20, בלי קווים מפרידים.
   נבנה לפי מותג 3.5.0 (24.9.2026): לוגו ScaleAbili, רצועת ים בראש כל מסך, גלגל שיניים
   קווי כחתימה, מרקם נקודות מודהה, כפתורים עגולים מלאים, אייקוני קו במקום אימוג'י. */

:root {
  /* צבע */
  --brand: #6B3FF0;
  --brand-hover: #5B2FE0;
  --brand-deep: #2E1180;
  --brand-100: #F0EBFF;
  --brand-200: #E2D8FE;
  --action: #F0530A;
  --action-deep: #D4340A;
  --bg: #FFFFFF;
  --bg-soft: #F0EBFF;
  --text: #0B2530;
  --text-soft: #456672;
  --text-faint: #7A93A0;
  --danger: #C00000;

  /* צורה */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;

  /* עומק */
  --shadow-sm: 0 1px 2px rgba(11, 37, 48, 0.05);
  --shadow-md: 0 6px 28px rgba(20, 19, 28, 0.07);
  --shadow-lg: 0 18px 56px rgba(46, 17, 128, 0.12);
  --glow: 0 0 18px 2px rgba(107, 63, 240, 0.35);
  --ring: 0 0 0 3px rgba(107, 63, 240, 0.25);

  /* ריווח (רשת 4px) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  --transition: 0.16s ease;

  /* גלגל שיניים קווי, החתימה הוויזואלית */
  --gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='white' stroke-width='7'%3E%3Ccircle cx='50' cy='50' r='38' stroke-dasharray='11 12.9'/%3E%3C/g%3E%3Cg fill='none' stroke='white' stroke-width='4' stroke-linecap='round'%3E%3Ccircle cx='50' cy='50' r='29'/%3E%3Ccircle cx='50' cy='50' r='12'/%3E%3Cpath d='M50 21v17M50 62v17M21 50h17M62 50h17'/%3E%3C/g%3E%3C/svg%3E");
  /* גלגל בסגול המותג לרקעים בהירים, תמונת הים, ואייקוני הניווט */
  --gear-brand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%236B3FF0' stroke-width='7'%3E%3Ccircle cx='50' cy='50' r='38' stroke-dasharray='11 12.9'/%3E%3C/g%3E%3Cg fill='none' stroke='%236B3FF0' stroke-width='4' stroke-linecap='round'%3E%3Ccircle cx='50' cy='50' r='29'/%3E%3Ccircle cx='50' cy='50' r='12'/%3E%3Cpath d='M50 21v17M50 62v17M21 50h17M62 50h17'/%3E%3C/g%3E%3C/svg%3E");
  --sea: url('/img/brand/sea.webp');
  --ico-profile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-6 8-6s8 2 8 6'/%3E%3C/svg%3E");
  --ico-tools: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='black' stroke-width='10'%3E%3Ccircle cx='50' cy='50' r='38' stroke-dasharray='11 12.9'/%3E%3C/g%3E%3Cg fill='none' stroke='black' stroke-width='8' stroke-linecap='round'%3E%3Ccircle cx='50' cy='50' r='29'/%3E%3Ccircle cx='50' cy='50' r='12'/%3E%3Cpath d='M50 21v17M50 62v17M21 50h17M62 50h17'/%3E%3C/g%3E%3C/svg%3E");
  --ico-projects: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 012-2h4l2 2h8a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2z'/%3E%3C/svg%3E");
  --ico-docs: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l5 5v13H7z'/%3E%3Cpath d='M14 3v5h5M10 13h6M10 17h6'/%3E%3C/svg%3E");
  --ico-usage: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 20V10M10 20V4M16 20v-7M22 20H2'/%3E%3C/svg%3E");
  --ico-alerts: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16V11a6 6 0 0112 0v5l2 2H4z'/%3E%3Cpath d='M10 21h4'/%3E%3C/svg%3E");
  --lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 26'%3E%3Cpath d='M5 11V8a6 6 0 0112 0v3' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'/%3E%3Crect x='2' y='11' width='18' height='14' rx='3.5' fill='black'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Assistant', 'Segoe UI', sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; font-size: 1rem; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none; box-shadow: var(--ring);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--brand-200); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- כפתורים --- */

.btn-action {
  background: linear-gradient(135deg, var(--action), var(--action-deep));
  color: #fff;
  min-height: 44px;
  padding: 10px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.02rem;
  box-shadow: 0 4px 12px rgba(240, 83, 10, 0.3);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn-action:hover { filter: brightness(1.06); box-shadow: 0 6px 18px rgba(240, 83, 10, 0.38); transform: translateY(-1px); }
.btn-action:active { transform: translateY(0) scale(0.98); }
.btn-action:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

.btn-ghost {
  background: var(--bg);
  color: var(--brand);
  border: 1.5px solid var(--brand-200);
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  transition: border-color var(--transition), background var(--transition);
}
.btn-ghost:hover { border-color: var(--brand); background: var(--brand-100); }

.card {
  background: var(--bg);
  border-radius: 22px;
  padding: var(--sp-6);
  box-shadow: var(--shadow-md);
}

/* --- התחברות --- */

.login-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; padding: 0 0 48px;
  background: var(--bg-soft);
  position: relative; isolation: isolate;
}
/* משבצות הנדסיות, מודהות לקצוות */
.login-wrap::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(107, 63, 240, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 63, 240, 0.07) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 20%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 20%, transparent 100%);
}
/* פתיח ים נמוך עם הלוגו, כמו בדפי המשפך */
.login-hero {
  width: 100%; min-height: 210px; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 28px;
  background: var(--sea) center 62% / cover no-repeat;
}
.login-hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.08) 55%, var(--bg-soft) 100%);
}
.login-hero::after {
  content: ''; position: absolute; inset-inline-end: -70px; top: -60px;
  width: 260px; height: 260px; opacity: 0.08; pointer-events: none;
  background: var(--gear-brand) center / contain no-repeat;
}
.login-logo { position: relative; z-index: 1; width: 150px; height: auto; display: block; }
.login-card {
  width: calc(100% - 32px); max-width: 400px; text-align: center; padding: var(--sp-8);
  box-shadow: var(--shadow-lg); margin-top: -36px; position: relative; z-index: 1;
}
.login-card h1 { color: var(--brand); font-size: 1.85rem; font-weight: 800; margin-bottom: var(--sp-1); }
.login-card p { color: var(--text-soft); margin-bottom: var(--sp-6); }
.login-card input {
  width: 100%; padding: 13px 15px; margin-bottom: var(--sp-3);
  border: 1.5px solid var(--brand-200); border-radius: 12px;
  font-family: inherit; font-size: 1rem;
  transition: border-color var(--transition);
}
.login-card input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.login-error { color: var(--danger); min-height: 1.4em; margin-bottom: var(--sp-2); font-weight: 600; }

/* --- מבנה --- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 276px; flex-shrink: 0; background: var(--bg);
  padding: var(--sp-5) var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2);
  box-shadow: var(--shadow-md);
  position: sticky; top: 0; height: 100vh;
}

.logo {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%;
  background: none; border: none; cursor: pointer; padding: var(--sp-1) 0 var(--sp-2);
  font-family: inherit; font-size: 1rem; font-weight: 700; color: var(--brand-deep);
  transition: opacity var(--transition);
}
.logo-img { width: 132px; height: auto; display: block; }
.logo-name { letter-spacing: 0.02em; }
.logo:hover { opacity: 0.85; }

.sidebar .who { color: var(--text-soft); font-size: 0.9rem; margin-bottom: var(--sp-3); }

.search-box {
  width: 100%; min-height: 42px; padding: 9px 14px; margin-bottom: var(--sp-3);
  border: 1.5px solid var(--brand-200); border-radius: 12px;
  font-family: inherit; font-size: 0.95rem; background: var(--bg-soft);
  transition: border-color var(--transition), background var(--transition);
}
.search-box:focus { outline: none; border-color: var(--brand); background: var(--bg); box-shadow: var(--ring); }

.tool-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 10px 14px; border-radius: 12px; background: transparent;
  color: var(--text); text-align: right; font-size: 1rem; font-weight: 600;
  transition: background var(--transition), color var(--transition);
}
.tool-item:hover { background: var(--brand-100); }
.tool-item.active { background: var(--brand); color: #fff; box-shadow: var(--glow); }
.tool-item .lock { margin-inline-start: auto; font-size: 0.85rem; }
/* אייקוני קו בצבע המותג במקום אימוג'י; במצב פעיל הם לבנים */
.nav-ico {
  flex: none; width: 22px; height: 22px; background: currentColor; color: var(--brand);
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.nav-ico--profile { --ico: var(--ico-profile); }
.nav-ico--tools { --ico: var(--ico-tools); }
.nav-ico--projects { --ico: var(--ico-projects); }
.nav-ico--docs { --ico: var(--ico-docs); }
.nav-ico--usage { --ico: var(--ico-usage); }
.nav-ico--alerts { --ico: var(--ico-alerts); }
.tool-item.active .nav-ico { color: #fff; }

.section-title {
  color: var(--text-faint); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; margin-top: var(--sp-4); padding: 0 6px;
}

.recent-list { overflow-y: auto; flex: 1; min-height: 60px; }
.recent-item {
  display: block; width: 100%; text-align: right; padding: 8px 10px;
  border-radius: var(--radius-sm); background: transparent; font-size: 0.88rem; color: var(--text);
  transition: background var(--transition);
}
.recent-item:hover { background: var(--brand-100); }
.recent-item .meta { color: var(--text-faint); font-size: 0.78rem; display: block; }

.logout { margin-top: auto; color: var(--text-soft); background: none; text-align: right; padding: var(--sp-2) 6px; min-height: 40px; }
.logout:hover { color: var(--danger); }

.main {
  flex: 1; display: flex; flex-direction: column; max-height: 100vh;
  background: var(--bg-soft);
  position: relative; isolation: isolate;
}
/* מרקם נקודות, מודהה לקצוות */
.main::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(107, 63, 240, 0.13) 1.4px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 100%, #000 10%, transparent 100%);
  mask-image: radial-gradient(ellipse 75% 60% at 50% 100%, #000 10%, transparent 100%);
}

/* רצועת ים נמוכה בראש כל מסך: החופש מוביל, הגלגל הוא החתימה */
.main-header {
  position: relative; overflow: hidden; min-height: 168px;
  padding: 40px var(--sp-8) 18px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  background: var(--sea) center 62% / cover no-repeat;
}
.main-header::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.48) 55%, var(--bg-soft) 100%);
}
.main-header::after {
  content: ''; position: absolute; inset-inline-end: -70px; top: -60px;
  width: 260px; height: 260px; opacity: 0.08; pointer-events: none;
  background: var(--gear-brand) center / contain no-repeat;
}
.main-header > * { position: relative; z-index: 1; }
.main-header h2 { color: var(--brand-deep); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.main-header .hint { color: var(--text); font-size: 1rem; margin-top: 2px; }

.chat-area {
  flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-8) var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
}

/* --- צ'אט --- */

.bubble {
  max-width: 720px; padding: 13px 18px; border-radius: var(--radius);
  white-space: pre-wrap; line-height: 1.6; font-size: 1.02rem;
  box-shadow: var(--shadow-sm);
  animation: bubble-in 0.18s ease;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bubble.user {
  background: linear-gradient(135deg, var(--brand), var(--brand-hover));
  color: #fff; align-self: flex-start; border-bottom-right-radius: 6px;
}
.bubble.assistant {
  background: var(--bg); align-self: flex-end; border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-md);
}
.bubble.notice { background: transparent; color: var(--text-soft); align-self: center; font-size: 0.9rem; box-shadow: none; }

.bubble.typing::after {
  content: '● ● ●';
  color: var(--brand-200);
  font-size: 0.7rem;
  letter-spacing: 3px;
  animation: typing-pulse 1.1s infinite;
}
@keyframes typing-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.composer { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-8) var(--sp-6); }
.composer textarea {
  flex: 1; resize: none; min-height: 54px; max-height: 160px;
  padding: 14px 16px; border: 1.5px solid var(--brand-200); border-radius: 14px;
  font-family: inherit; font-size: 1rem; background: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}
.composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* --- כלים --- */

/* כותרת קטגוריה: פותחת וסוגרת את כל הכלים שתחתיה */
.cat-sec { margin-bottom: var(--sp-6); }
.cat-head {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  background: none; padding: var(--sp-5) 0 var(--sp-3); min-height: 44px;
  text-align: right; color: var(--brand-deep);
}
.cat-head:hover { color: var(--brand); }
.cat-chev { width: 20px; height: 20px; flex: none; transition: transform var(--transition); }
.cat-sec.collapsed .cat-chev { transform: rotate(90deg); }
.cat-title { color: inherit; font-size: 1.2rem; font-weight: 800; margin: 0; }
.cat-count {
  flex: none;
  font-size: 0.8rem; font-weight: 700; color: var(--brand-deep);
  background: var(--brand-100); padding: 5px 13px; border-radius: 999px;
}
.cat-sec.collapsed .tool-grid { display: none; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); align-items: stretch; }
.tool-card {
  position: relative; height: 100%;
  background: var(--bg); border-radius: 20px; padding: 0; overflow: visible;
  text-align: right; cursor: pointer;
  border: 1px solid var(--brand-200);
  box-shadow: var(--shadow-sm);
  font-family: inherit; font-size: 1rem;
  display: flex; flex-direction: column; align-items: stretch;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.tool-card:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.tool-card.locked:hover { transform: none; border-color: var(--brand-200); box-shadow: var(--shadow-sm); }

/* עטיפה בסגנון סקול: כיתוב על משטח סגול, ותמונה שנחתכת ישר עד קצה המסגרת */
.cover {
  position: relative; overflow: hidden;
  display: flex; align-items: stretch; gap: 0; padding: 0;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #5B2FE0, #2E1180);
}
/* גלגל שיניים: החתימה הוויזואלית, במקום פס האלכסונים של סקול */
.cover::after {
  content: ''; position: absolute; z-index: 0; pointer-events: none;
  inset-inline-start: -24px; inset-inline-end: auto; top: -24px;
  width: 96px; height: 96px; opacity: 0.12;
  background: var(--gear) center / contain no-repeat;
}
/* רק הגלגל של השלב שהלקוח נמצא בו מסתובב (הכרעת לירון, 24.9.2026): הכלי שפתוח לעבודה */
.cover.current::after, .tool-card.current .cover::after { animation: gear-spin 32s linear infinite; }
.cover .cover-title {
  flex: 1 1 auto; min-width: 0; position: relative; z-index: 1;
  display: flex; align-items: center;
  padding: var(--sp-4) var(--sp-5);
  font-weight: 800; font-size: 1.28rem; line-height: 1.28;
  color: #fff; text-align: right;
}
.cover img {
  flex: 0 0 52%; width: 52%; height: 100%; object-fit: cover; display: block;
  border-radius: 0; box-shadow: none;
  transition: transform 0.3s ease;
}
.tool-card .cover { border-radius: 19px 19px 0 0; }
.tool-card:hover .cover img { transform: scale(1.04); }
.tool-card.locked .cover img { filter: grayscale(0.4) brightness(1.03); opacity: 0.9; }

.cover-lg {
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  margin-bottom: var(--sp-5); padding: 0;
}
.cover-lg .cover-title { font-size: 1.9rem; padding: var(--sp-5) var(--sp-6); }
/* בהירו התמונה מקבלת יותר רוחב, כדי שהחיתוך יישאר קרוב לריבוע */
.cover-lg img { flex-basis: 60%; width: 60%; }
.cover-lg::after { width: 138px; height: 138px; inset-inline-start: -32px; top: -32px; }

.tool-card .card-body {
  flex: 1; padding: var(--sp-4) var(--sp-5) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: stretch;
}
.step-row { display: flex; align-items: center; gap: var(--sp-2); }
.step-num {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand); color: #fff;
  font-size: 0.85rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.tool-card.locked .step-num { background: var(--brand-200); color: var(--brand-deep); }
.tool-card h4 { color: var(--text); font-size: 1.05rem; line-height: 1.3; }
.tool-card p { color: var(--text-soft); font-size: 0.9rem; line-height: 1.45; }
.status-strip {
  margin-top: auto; padding: 8px 14px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700; line-height: 1.35;
  background: rgba(69, 102, 114, 0.09); color: var(--text-soft);
}
.status-strip.open { background: var(--brand); color: #fff; }
.status-strip.done { background: var(--brand-100); color: var(--brand-deep); }

/* סיכום השלב: הכרטיס יושב בתוך מסגרת סגולה, ולא רק מקבל מתאר */
.tool-card.summary {
  padding: 30px 7px 7px; border-radius: 26px; border-color: var(--brand);
  background: linear-gradient(145deg, #8B6BFF, #5B2FE0);
  box-shadow: var(--glow), var(--shadow-md);
}
.tool-card.summary:hover { box-shadow: var(--glow), var(--shadow-lg); }
.tool-card.summary .cover { border-radius: 15px 15px 0 0; }
.tool-card.summary .card-body { background: var(--bg); border-radius: 0 0 15px 15px; }
.summary-tag {
  position: absolute; top: 8px; inset-inline-start: 0; inset-inline-end: 0;
  text-align: center; color: #fff; font-size: 0.78rem; font-weight: 800;
  letter-spacing: 0.02em;
}
.status-strip .lock-ico { display: inline-block; width: 11px; height: 13px; vertical-align: -2px;
  margin-inline-end: 6px; background: currentColor;
  -webkit-mask: var(--lock) center / contain no-repeat; mask: var(--lock) center / contain no-repeat; }

.tool-page { max-width: 660px; margin: var(--sp-6) auto; padding: 0 var(--sp-5); width: 100%; }
.tool-page img.hero {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); margin-bottom: var(--sp-5);
}
.tool-page h2 { color: var(--brand-deep); margin-bottom: var(--sp-3); font-size: 1.6rem; }
.tool-page .block { margin: var(--sp-4) 0; background: var(--bg); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-sm); }
.tool-page .block h5 { color: var(--brand); font-size: 0.92rem; margin-bottom: var(--sp-1); }
.tool-page .block p { color: var(--text); line-height: 1.6; }
.back-btn { background: none; color: var(--brand); font-weight: 700; padding: var(--sp-2) 0; margin-bottom: var(--sp-2); min-height: 40px; }
.back-btn:hover { color: var(--brand-deep); }

/* רשימת הפרופילים, והכוכב שקובע ברירת מחדל */
.profile-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); max-width: 580px; }
.profile-row {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--bg); border-radius: 14px; padding: 10px var(--sp-4);
  cursor: pointer; box-shadow: var(--shadow-sm);
  border: 1.5px solid transparent; transition: border-color var(--transition);
}
.profile-row:hover { border-color: var(--brand-200); }
.profile-row.editing { border-color: var(--brand); }
.profile-name { font-weight: 700; color: var(--text); }
.star {
  background: none; padding: 0; line-height: 1; flex: none;
  font-size: 1.3rem; color: var(--brand-200); min-width: 28px;
  transition: color var(--transition), transform var(--transition);
}
.star:hover { color: var(--brand); transform: scale(1.12); }
.star.on { color: var(--brand); }
.star:disabled { opacity: 0.5; }
.btn-ghost {
  align-self: stretch; text-align: right;
  background: none; color: var(--brand);
  font-weight: 700; font-size: 0.9rem; padding: 8px 4px; min-height: 40px;
}
.btn-ghost:hover { color: var(--brand-deep); }

/* בוררי השיוך בראש הצ'אט */
.assign-bar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.assign {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-100); border-radius: 999px; padding: 3px 12px 3px 6px;
  min-height: 36px;
}
.assign-label { font-size: 0.78rem; font-weight: 700; color: var(--brand-deep); }
.assign-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--brand-200);
}
.assign select {
  border: none; background: none; font-family: inherit; font-size: 0.85rem;
  font-weight: 700; color: var(--text); cursor: pointer; max-width: 170px;
  padding: 4px 2px;
}
.assign select:disabled { opacity: 0.5; }
.assign select:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

.select-row { display: flex; gap: var(--sp-3); align-items: center; margin: var(--sp-4) 0; flex-wrap: wrap; }
.select-row select {
  min-height: 44px; padding: 10px 14px; border: 1.5px solid var(--brand-200); border-radius: 12px;
  font-family: inherit; font-size: 0.98rem; background: var(--bg);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: 999px; background: var(--bg); color: var(--text-soft);
  font-size: 0.82rem; font-weight: 600; box-shadow: var(--shadow-sm);
  margin-inline-end: 6px; margin-top: 6px;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* --- פרויקטים --- */

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); }
.proj-card {
  border-radius: var(--radius); padding: var(--sp-5); background: var(--bg); cursor: pointer;
  border-right: 6px solid var(--brand); box-shadow: var(--shadow-sm);
  text-align: right; font-family: inherit; font-size: 1rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.proj-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.proj-card h4 { color: var(--text); font-size: 1.05rem; }
.proj-card .meta { color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: var(--text); transform: scale(1.12); box-shadow: var(--shadow-sm); }

/* --- טפסים ומסמכים --- */

.form-card { max-width: 580px; }
.form-card label { display: block; color: var(--text-soft); font-size: 0.9rem; font-weight: 600; margin: var(--sp-4) 0 var(--sp-1); }
.form-card input[type="text"], .form-card textarea, .form-card select {
  width: 100%; padding: 12px 15px; border: 1.5px solid var(--brand-200); border-radius: 12px;
  font-family: inherit; font-size: 0.98rem; background: var(--bg);
  transition: border-color var(--transition);
}
.form-card textarea { min-height: 90px; resize: vertical; }
.form-card input:focus, .form-card textarea:focus, .form-card select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

.doc-card { margin: var(--sp-2) 0; }
.doc-card h4 { color: var(--brand); margin-bottom: var(--sp-2); font-size: 1.05rem; }
.doc-card pre { white-space: pre-wrap; font-family: inherit; line-height: 1.6; }
.doc-meta { color: var(--text-faint); font-size: 0.85rem; margin-bottom: var(--sp-2); }

.start-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.start-card { text-align: center; max-width: 440px; }
.start-card h3 { color: var(--brand-deep); margin-bottom: var(--sp-2); }
.start-card p { color: var(--text-soft); margin-bottom: var(--sp-5); }

/* --- מובייל --- */

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 22px var(--sp-3) var(--sp-2); gap: var(--sp-1);
  }
  .sidebar .who, .section-title, .recent-list { display: none; }
  .search-box { order: 9; margin: var(--sp-1) 0 0; }
  .logo { flex-basis: 100%; margin: 0 0 var(--sp-1); padding: 0; font-size: 0.95rem; }
  .logo-img { width: 103px; }
  .tool-item { width: auto; min-height: 40px; padding: 8px 12px; font-size: 0.9rem; }
  .logout { margin: 0 auto 0 0; }
  .main { max-height: none; }
  .main-header { min-height: 128px; padding: 22px var(--sp-4) 14px; }
  /* בטלפון כל הדף נגלל, ולכן אזור הגלילה לא יכול להיות מיכל גלילה: אחרת השורה לא נצמדת למסך */
  .chat-area { overflow-y: visible; }
  .main-header h2 { font-size: 1.5rem; }
  .login-hero { min-height: 160px; padding-top: 22px; }
  .login-logo { width: 120px; }
  .chat-area { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
  .composer { padding: var(--sp-2) var(--sp-3) var(--sp-4); }
  .bubble { max-width: 100%; }
  .tool-grid, .proj-grid { grid-template-columns: 1fr; }
}

/* --- שורה דביקה עם "חזרה" בראש אזור הגלילה --- */

.topbar {
  /* top שלילי בגובה הריפוד של אזור הגלילה, כדי שהשורה תיצמד לקצה ולא ישאר רווח מעליה */
  position: sticky; top: calc(-1 * var(--sp-2)); z-index: 5;
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-8)) 0;
  padding: 10px var(--sp-8);
  background: rgba(240, 235, 255, 0.86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(20, 19, 28, 0.05);
}
.topbar .back-btn {
  margin: 0; min-height: 36px; padding: 6px 16px; border-radius: 999px;
  background: var(--bg); color: var(--brand); box-shadow: var(--shadow-sm); font-size: 0.95rem;
}
.topbar .back-btn:hover { color: var(--brand-deep); box-shadow: var(--shadow-md); }
.topbar-title { font-weight: 800; color: var(--brand-deep); font-size: 1.05rem; }

/* "אתם כאן": מדבקה על שפת הכרטיס של הכלי הפתוח לעבודה. זזה עם השלב, כמו הגלגל */
.here-tag {
  position: absolute; top: -14px; inset-inline-end: 18px; z-index: 2;
  background: var(--bg); color: var(--brand-deep); font-size: 0.78rem; font-weight: 800;
  line-height: 1.3; padding: 4px 12px; border-radius: 999px;
  box-shadow: 0 8px 22px rgba(20, 19, 28, 0.14);
}
/* בטלפון הכלל חייב לבוא אחרי הכלל הבסיסי של השורה, אחרת הוא נדרס */
@media (max-width: 760px) {
  .topbar { top: 0; margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-3)) 0; padding: 8px var(--sp-3); }
}
.here-tag::after {
  content: ''; position: absolute; inset-inline-start: 14px; bottom: -6px;
  border: 6px solid transparent; border-top-color: var(--bg); border-bottom: 0;
}

/* --- המסר המזוקק: עריכה, העתקה והורדה --- */

.msg-panel {
  /* flex: none, אחרת אזור השיחה מכווץ את התיבה ואת תיבת הטקסט שבתוכה */
  flex: none; align-self: stretch; max-width: 720px; width: 100%;
  background: var(--bg); border-radius: 22px; box-shadow: var(--shadow-md);
  padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3);
  position: relative; overflow: hidden;
}
.msg-panel::after {
  content: ''; position: absolute; inset-inline-start: -40px; bottom: -40px;
  width: 150px; height: 150px; opacity: 0.07; pointer-events: none;
  background: var(--gear-brand) center / contain no-repeat;
}
.msg-panel-title { color: var(--brand-deep); font-size: 1.25rem; font-weight: 800; }
.msg-panel-hint, .msg-panel-note { color: var(--text-soft); font-size: 0.92rem; }
.msg-panel-text {
  width: 100%; min-height: 150px; resize: vertical; padding: 14px 16px;
  border: 1.5px solid var(--brand-200); border-radius: 14px; background: var(--brand-100);
  font-family: inherit; font-size: 1.08rem; line-height: 1.65; color: var(--text);
}
.msg-panel-text:focus { outline: none; border-color: var(--brand); background: var(--bg); box-shadow: var(--ring); }
.msg-panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); position: relative; z-index: 1; }
.msg-panel-status { color: var(--brand-deep); font-weight: 700; font-size: 0.92rem; }

/* --- תנועה --- */

@keyframes gear-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
