/* עיצוב לפי docs/design/legislator-mockup.html + docs/design/README.md
   ("מה לוקחים ממנו"): פלטה, טיפוגרפיה, מבנה תפריט צד/כרטיסים, גיליון
   הוורד, תפריט ההוספה. מנגנוני האינטראקציה (app.js) לא נגעו - זה עיצוב
   בלבד על אותם אלמנטים/מזהים. ראו docs/design/ui-overhaul-plan.md. */

:root {
  --navy: #0B2A5B;
  --flag: #0038B8;
  --flag-deep: #012E9C;
  --tint: #EAF0FC;
  --tint-2: #F6F9FE;
  --ink: #14171C;
  --soft: #5A6472;
  --faint: #8C95A3;
  --rule: #D9E1EF;
  --shell: #EEF2F8;
  --page: #FFFFFF;
  --del: #A3242B;
  --del-bg: #FBEDEE;
  --ins: #0E6B45;
  --ins-bg: #E9F5EF;
  --warn: #8A5A00;
  --warn-bg: #FBF1DE;
  --skip-bg: #EDEAE4;
  --touched-bg: #FFF9E6;
  --touched-accent: #EFC15E;
  --r: 10px;
  /* דף הבית (26.9.2026) - מנטה המותג מהמוקאפ של ברק. נייבי - רק --navy (הכרעה ו):
     גוון אחד בכל המערכת, גם בפס ההרשמה (tests/unit/test_single_navy.py) */
  --mint: #5EE0A8;
  --mint-deep: #3FCB8F;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  padding: 0;
  background: var(--shell);
  color: var(--ink);
  font-family: "Assistant", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  direction: rtl;
  display: flex;
}
button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--rule); background: var(--page); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font-size: 14px;
}
button:hover { border-color: #B6C4DC; }
button.primary { background: var(--flag); border-color: var(--flag); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--flag-deep); border-color: var(--flag-deep); }
button.subtle { border-color: transparent; background: transparent; color: var(--soft); }
button.subtle:hover { border-color: var(--rule); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ═══ תפריט צד ═══ */
.rail {
  width: 236px; flex: 0 0 236px; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
}
/* הלוגו (26.9) - כולל את השם ואת "ארגז הכלים הפרלמנטרי". הרקע שלו #0E2B5A,
   כמעט זהה ל---navy, ולכן אין מסגרת נראית סביבו. */
.brand { padding: 10px 8px 8px; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand img { display: block; width: 100%; height: auto; }
.nav { padding: 12px 10px; flex: 1; overflow: auto; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; margin-bottom: 1px; border: 0; border-radius: 7px;
  background: none; color: #C6D4EC; font-size: 14.5px; text-align: start;
}
.nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav button.on { background: #fff; color: var(--navy); font-weight: 600; }
.nav .ico { width: 18px; flex: 0 0 18px; text-align: center; opacity: .9; font-size: 13px; }

/* ═══ מסגרת ═══ */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-width: 0; }
.topbar {
  background: var(--page); border-bottom: 1px solid var(--rule);
  padding: 11px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 700; }
.grow { flex: 1; }
select, .inp {
  font: inherit; border: 1px solid var(--rule); background: var(--page);
  border-radius: 8px; padding: 7px 11px; color: var(--ink);
}
select { font-weight: 600; max-width: 420px; }
.inp:focus, select:focus { outline: 2px solid var(--tint); border-color: var(--flag); }
.asof {
  font-size: 12.5px; color: var(--soft); background: var(--tint-2);
  border: 1px solid var(--rule); border-inline-start: 3px solid var(--flag);
  border-radius: 6px; padding: 5px 10px;
}

/* ═══ חיפוש חוק (autocomplete, החליף <select> על 1,093 חוקים -
   ברק, 2026-09-16: "תפריט נגלל לא עובד") ═══ */
.law-picker { position: relative; width: 100%; max-width: 420px; }
#law-search-input { width: 100%; font-weight: 600; }
.law-search-results {
  position: absolute; z-index: 30; top: calc(100% + 4px); inset-inline: 0;
  max-height: 340px; overflow-y: auto;
  background: var(--page); border: 1px solid var(--flag); border-radius: 9px;
  box-shadow: 0 10px 28px rgba(11,42,91,.18); padding: 4px;
}
.law-result-item {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
.law-result-item:hover, .law-result-item.highlighted { background: var(--tint); }
.law-result-item .law-result-note { font-size: 12px; color: var(--soft); }
.law-result-item.unsupported {
  cursor: not-allowed; color: var(--faint); font-style: italic;
}
.law-result-item.unsupported:hover { background: none; }
.law-result-empty { padding: 10px; font-size: 13px; color: var(--soft); }

.law-loading {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft);
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--rule); border-top-color: var(--flag);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stage { flex: 1; min-height: 0; padding: 16px; overflow: hidden; }
.tab { display: none; height: 100%; }
.tab.on { display: flex; flex-direction: column; min-height: 0; }
/* #law-panels הוא הילד היחיד של .tab.on - חייב להשתתף בשרשרת ה-flex
   (flex:1 + min-height:0 + display:flex) בעצמו, אחרת .cols/.card
   שבתוכו לא מוגבלים לגובה הזמין וגולשים החוצה בלי אפשרות גלילה -
   .stage שמעליו עם overflow:hidden פשוט קוטע אותם (נתפס בבדיקה של
   המשתמש: "אין לי אפשרות לגלילה... תוקע אותי"). */
/* **חלונית נוסח החוק אינה מתכווצת** (ברק, 22.9): כשחלון ההצעות
   הדומות נפתח הוא לקח גובה מ-.cols, והחלון העיקרי התכווץ. עכשיו
   ל-.cols יש גובה מינימלי, והעודף גולל ב-#law-panels עצמו במקום
   להידחס. `min-height:0` נשאר - בלעדיו שרשרת ה-flex נשברת וחוזרת
   התקלה המתועדת למעלה ("אין לי אפשרות לגלילה"). */
#law-panels {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto;
}
/* **גובה קבוע, נגזר-מסך.** שתי גרסאות קודמות נכשלו בבדיקה בדפדפן:
   `min-height` לבדו רק הגביל את ההתכווצות ולא מנע אותה
   (780px -> 523px), ו-`flex: 1 0 auto` גרם לחלונית לגדול לגובה
   **כל** עץ החוק (40,398px) במקום לגלול בתוכה. `flex: none` עם
   גובה מפורש שומר על הגלילה הפנימית של הכרטיסים, ומה שנוסף מעל
   דוחף את הדף לגלילה במקום לדחוס את החלון העיקרי. */
#law-panels > .cols { flex: none; height: calc(100vh - 210px); height: calc(100dvh - 210px); min-height: 420px; }

/* ═══ חלוניות ═══ */
.cols { flex: 1; display: grid; gap: 16px; min-height: 0; grid-template-columns: 1fr 1fr; }
.card {
  background: var(--page); border: 1px solid var(--rule); border-radius: var(--r);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
}
.card > header {
  background: var(--tint); border-bottom: 1px solid var(--rule);
  padding: 9px 16px; display: flex; align-items: baseline; gap: 10px; flex: 0 0 auto;
}
.card > header h2 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.card > header span { font-size: 12.5px; color: var(--soft); }
.card .body { flex: 1; overflow: auto; padding: 20px 24px 48px; }

@media (max-width: 1150px) { .cols { grid-template-columns: 1fr !important; } }

/* טופס פרטי ההצעה */
.meta {
  display: grid; gap: 13px; flex: 0 0 auto; margin-bottom: 16px;
  grid-template-columns: minmax(0,2.4fr) minmax(0,1.4fr);
}
.fld label { display: block; font-size: 12.5px; color: var(--soft); margin-bottom: 4px; }
.fld.required label::after, .insert-margin-title-field label::after { content: " *"; color: var(--del); }
.fld .inp, .fld textarea { width: 100%; font-size: 14.5px; font-family: inherit; }
.fld textarea { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--rule); }
.hint { font-size: 12px; margin-top: 4px; color: var(--soft); }
.as-of-note, .source-ref-note {
  font-size: 12.5px; color: var(--soft); background: var(--tint-2);
  border: 1px solid var(--rule); border-inline-start: 3px solid var(--flag);
  border-radius: 6px; padding: 6px 10px; margin-bottom: 10px;
}

/* ═══ נוסח החוק ═══ */
.law-heading {
  font-family: "Frank Ruhl Libre", serif; font-size: 17px; font-weight: 700;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
#law-tree { font-family: "Frank Ruhl Libre", serif; font-size: 16.5px; line-height: 1.85; max-width: 64ch; }

.node { margin-inline-start: 14px; margin-bottom: 20px; }
.node-header {
  font-family: "Assistant", sans-serif; font-size: 13.5px; font-weight: 700;
  color: var(--navy); display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.node.status-repealed > .node-header,
.node.status-merged > .node-header { color: var(--faint); font-style: italic; }
.node-number { color: var(--faint); font-weight: 400; font-size: 12.5px; }
/* ח14 (26.9.2026): מספר הסעיף - בגוון, בגודל ובגופן של כותרת השוליים שלידו
   (יורש מ-.node-header). התוויות "(א)", "(1)" בשורת הטקסט נשארות כמו שהן. */
.node-header > .node-number { color: inherit; font-weight: inherit; font-size: inherit; font-family: inherit; }

.node-body-row { display: flex; align-items: flex-end; gap: 6px; }
.node-body-row > .node-text,
.node-body-row > .node-text-empty { flex: 1; min-width: 0; }

.node-text {
  white-space: pre-wrap; line-height: 1.85; cursor: text; user-select: text;
  padding: 2px 0; outline: none; border-radius: 4px;
}
.node-text:focus { background: var(--tint); box-shadow: 0 0 0 2px var(--flag); }
.node-text del, .node-margin-title del { color: var(--del); background: var(--del-bg); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.node-text ins, .node-margin-title ins { color: var(--ins); background: var(--ins-bg); text-decoration: underline; text-decoration-thickness: 1.5px; }
.node-text.edit-unsupported, .node-margin-title.edit-unsupported {
  background: var(--del-bg); outline: 1px dashed var(--del);
}

.node-margin-title { outline: none; border-radius: 3px; padding: 0 2px; }
.node-margin-title[contenteditable="true"]:focus { background: var(--tint); box-shadow: 0 0 0 2px var(--flag); }
.node-margin-title.readonly { color: var(--faint); font-weight: 400; font-style: italic; }

/* תוכן שהוכנס - נראה כמו כל צומת אחר, פרט לרקע הצהוב (בדיוק כמו
   ".fresh" בטבלת ההצעה - אותו רעיון, שני מקומות) - עדיין ניתן לעריכה
   חופשית, לא נעול (ראו משוב המשתמש, TASKS.md 10ב). */
.node.inserted > .node-header,
.node.inserted > .node-body-row > .node-text {
  background: var(--touched-bg); border-radius: 4px; padding-inline: 4px;
  box-shadow: -3px 0 0 var(--touched-accent) inset;
}

/* כפתור "+": נשאר בסוף שורת התוכן של הצומת (לא ליד הכותרת, כמו
   שהמוקאפ ממקם אותו) - החלטת פונקציונליות גוברת, ראו
   docs/design/ui-overhaul-plan.md. רק העיצוב (עיגול, --flag) מהמוקאפ. */
/* ח4 (25.9.2026): הפלוס והפח **גלויים תמיד** - עד כאן opacity: 0 עד
   ריחוף, ו"קשה לראות אותם". גדולים יותר, מסגרת בצבע הממשק. */
button.node-add-btn, button.node-del-btn, .remove-insertion-btn {
  flex-shrink: 0; opacity: .8; transition: .12s;
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--flag);
  background: var(--tint); color: var(--flag); font-size: 18px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.node-body-row:hover .node-add-btn, .node-body-row:hover .node-del-btn { opacity: 1; }
/* button.X - גובר על button.subtle (שקוף, בלי מסגרת), שמחק עד כאן את
   העיגול של הפלוס בשקט. */
button.node-add-btn:hover { background: var(--flag); color: #fff; }
button.node-del-btn { color: var(--del); border-color: var(--del); background: #fff; margin-inline-start: 4px; }
button.node-del-btn:hover { background: var(--del); color: #fff; }
.node-del-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.remove-insertion-btn {
  opacity: 1; width: auto; height: auto; border-radius: 20px; font-size: 11px;
  padding: 1px 9px; margin-inline-start: auto; color: var(--del); border-color: var(--del-bg);
}

/* ═══ תפריט הוספה (".pop" במוקאפ) ═══ */
.insert-host { position: relative; }
.insert-menu {
  position: relative; z-index: 20; margin: 6px 0; width: 246px;
  background: var(--page); border: 1px solid var(--flag); border-radius: 9px;
  box-shadow: 0 10px 28px rgba(11,42,91,.18); padding: 6px; font-family: "Assistant", sans-serif;
}
.insert-menu-levels { display: flex; flex-direction: column; gap: 2px; }
.insert-level-btn {
  display: flex; width: 100%; gap: 7px; align-items: baseline; text-align: start;
  background: none; border: 0; border-radius: 6px; padding: 7px 9px; font-size: 14px;
}
.insert-level-btn:hover:not(:disabled) { background: var(--tint); }
.insert-menu-form { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; }
.insert-menu-form button { margin-inline-end: 6px; }

.insertion-error-card {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 4px 0; padding: 5px 8px; background: var(--del-bg); color: var(--del);
  border-radius: 5px; font-size: 12.5px;
}

/* ═══ גיליון הוורד (".sheet"/".tbl" במוקאפ) ═══ */
#docx-approx {
  background: var(--shell); flex: 1; overflow: auto; padding: 22px; margin: 0;
  border: 0; border-radius: 0; min-height: 0;
}
/* .sheet עוטף את שלושת הילדים (כותרת/יוזם/טבלה) בכרטיס "דף" אחד -
   נוסף ב-index.html מסביב לשלושת ה-id-ים הקיימים, לא משנה אותם. */
.sheet {
  background: var(--page); max-width: 620px; margin: 0 auto;
  border: 1px solid var(--rule); box-shadow: 0 2px 14px rgba(11,42,91,.08);
  padding: 40px 44px 44px; font-family: "Frank Ruhl Libre", serif;
}
.docx-title {
  text-align: center; font-size: 17px; font-weight: 700; line-height: 1.6; margin-bottom: 4px;
}
.docx-initiator { font-size: 14px; color: var(--soft); text-align: center; margin-bottom: 20px; }
#docx-lines { font-size: 14.5px; line-height: 1.75; }
#docx-lines .hint { font-family: "Assistant", sans-serif; padding: 10px 0; }

.docx-extra {
  max-width: 620px; margin: 14px auto 0; font-family: "Assistant", sans-serif;
}

.line-row { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.line-side-heading {
  font-family: "Assistant", sans-serif; font-size: 12.5px; font-weight: 700; color: var(--navy);
}
.line-quoted { background: var(--tint-2); padding: 4px 6px; border-radius: 4px; margin-top: 3px; }

/* ולידציה: אינה מוצגת למשתמש (docs/design/README.md #4) - 15 הבדיקות
   ממשיכות לרוץ בשרת כרגיל, פנימית בלבד. חיווי על שדה חסר מוצג בטופס
   עצמו (source-ref-note למעלה), לא כפאנל נפרד. */

/* ═══ מעטפת צ'אט (משימה ח, 2026-09-16) - שאילתות + הצעות לסדר.
   ערכי הצבע/מידה מועתקים במדויק מ-docs/design/legislator-mockup.html
   (חלק "צ'אט") - README.md §"מה לוקחים ממנו": עיצוב, לא HTML. ═══ */
.nav-sep { height: 1px; background: rgba(255,255,255,.12); margin: 11px; }

.chat-form {
  display: flex; gap: 14px; padding: 14px 24px 0; flex-wrap: wrap;
}
.chat-form .fld { flex: 1 1 160px; min-width: 140px; }

.chat { flex: 1; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; padding: 11px 15px; border-radius: 12px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; }
.msg.u { align-self: flex-start; background: var(--flag); color: #fff; border-end-start-radius: 3px; }
.msg.a { align-self: flex-end; background: var(--tint-2); border: 1px solid var(--rule); border-end-end-radius: 3px; }
.msg.err { align-self: flex-end; background: var(--del-bg); border: 1px solid var(--del); color: var(--del); }
.composer {
  border-top: 1px solid var(--rule); padding: 12px 16px; display: flex; gap: 10px;
  background: var(--tint-2); flex: 0 0 auto;
}
.composer .inp { flex: 1; font-size: 14.5px; }
.draft {
  font-family: "Frank Ruhl Libre", serif; font-size: 15px; line-height: 1.85;
  background: var(--page); border: 1px solid var(--rule); border-radius: 8px;
  padding: 16px 18px; margin-top: 10px;
}
.draft .to { font-weight: 700; margin-bottom: 8px; }
.draft .word-count { font-family: "Assistant", sans-serif; font-size: 12px; color: var(--soft); margin-top: 10px; }
.draft .word-count.over { color: var(--del); font-weight: 600; }

.coming-soon { display: flex; align-items: center; justify-content: center; color: var(--soft); font-size: 14.5px; height: 100%; }

/* --- מחקר / חיפוש סמנטי (ברק, 2026-09-17) --- */
.coverage-badge {
  font-size: 12.5px; color: var(--soft); border: 1px solid var(--rule);
  border-radius: 999px; padding: 4px 12px; white-space: nowrap; background: var(--tint-2);
}
.notice {
  border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px;
  font-size: 14px; line-height: 1.7; color: var(--ink); background: var(--tint-2);
}
.notice-coverage {
  border-right: 3px solid var(--touched-accent); background: var(--warn-bg);
}
.notice-coverage b { color: var(--warn); }
.notice ul { margin: 8px 0; padding-inline-start: 20px; }
.result { border-bottom: 1px solid var(--rule); padding: 14px 2px; }
.result:last-child { border-bottom: 0; }
.result-head { font-weight: 600; margin-bottom: 4px; color: var(--navy); }
.result-body { font-size: 14px; line-height: 1.75; color: var(--ink); }

/* --- OData של הכנסת (1.4) --- */
.citation-row { padding: 8px 2px; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.citation-row:last-child { border-bottom: 0; }
.citation-ref { color: var(--navy); font-weight: 600; margin-inline-start: 6px; }
.citation-date { color: var(--soft); font-size: 12.5px; margin-inline-start: 6px; }
.citation-title { color: var(--ink); margin-top: 2px; }
#citations-box { margin-top: 12px; font-size: 13.5px; }
#citations-box summary { cursor: pointer; color: var(--navy); font-weight: 600; }
#similar-bills-notice:not(:empty) { margin-bottom: 14px; }

/* --- שאילתות קודמות: תצוגה הדרגתית --- */
.pq-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--soft); padding: 8px 2px;
}
.pq-rank {
  display: inline-block; min-width: 17px; padding: 0 4px; margin-inline-start: 6px;
  border-radius: 9px; background: var(--tint); color: var(--flag-deep);
  font-size: 11px; font-weight: 700; text-align: center; vertical-align: 1px;
}
.pq-asked { color: var(--soft); }
.pq-done {
  margin-top: 10px; padding: 8px 10px; border-radius: 6px;
  background: var(--tint-2); border: 1px solid var(--rule);
  font-size: 12.5px; color: var(--soft); line-height: 1.7;
}
.pq-done b { color: var(--navy); }
/* ש2: מקור שלא נטען - שורה שקטה, לא קופסה צהובה */
.pq-partial { color: var(--soft); }

/* --- טבלת תוצאות מחקר (1.4) --- */
.research-title { font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.research-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
.research-table th { text-align: right; padding: 7px 8px; border-bottom: 2px solid var(--rule); color: var(--soft); font-weight: 600; }
.research-table td { padding: 7px 8px; border-bottom: 1px solid var(--rule); }
.research-table tbody tr:hover { background: var(--tint-2); }

/* --- תקציר הצעת חוק (2.1) --- */
.summary-body { margin-top: 14px; line-height: 1.85; font-size: 14.5px; color: var(--ink); }
.summary-body strong, .summary-body b { color: var(--navy); }

/* ביקורת ניסוח (משימה 2.2) - ממצא הוא כרטיס נפרד ובולט, לא שורה
   בתוך פסקה. הממצא הדטרמיניסטי (critique-raw) תמיד גלוי מתחת
   להסבר, כדי שאפשר יהיה להצליב מול הבדיקה עצמה. */
.critique-item { margin-top: 12px; padding: 12px 14px; border-radius: 8px;
  border-inline-start: 4px solid var(--navy); background: #fbfbfd; }
.critique-fail { border-inline-start-color: #b3261e; }
.critique-warn { border-inline-start-color: #b58900; }
.critique-head { display: flex; align-items: baseline; gap: 8px; line-height: 1.6; }
.critique-badge { flex: none; font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  background: #b3261e; color: #fff; }
.critique-warn .critique-badge { background: #b58900; }
.critique-why { margin-top: 6px; line-height: 1.75; color: var(--ink); }
.critique-fix { margin-top: 6px; line-height: 1.75; }
.critique-raw { margin-top: 8px; font-size: 12.5px; color: #5c6370; line-height: 1.6; }
.critique-skipped { margin-top: 14px; }
.critique-skipped summary { cursor: pointer; font-size: 13px; color: #5c6370; }

/* הסתייגויות: שני המספרים יחד, בגודל אחד. הצגת המספר הגדול לבדו
   הייתה מטעה - ראו app.js. */
.res-headline { margin-top: 12px; font-size: 17px; line-height: 1.7; color: var(--navy); }
.res-table { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 13.5px; }
.res-table th, .res-table td { padding: 6px 10px; border-bottom: 1px solid var(--rule); text-align: start; }
.res-table th { color: var(--soft); font-weight: 700; }

/* סעיף שאי אפשר לערוך. **לא מוסתר ולא מושתק** - הנוסח נשאר קריא,
   אבל ברור מיד שהמערכת לא תוכל לנסח עליו הוראת תיקון. הכישלון
   הקודם היה שהוא נראה תקין ולא הגיב ללחיצה. */
.node.not-editable { background: var(--skip-bg); border-inline-start: 3px solid var(--faint); }
.node.not-editable .node-text { color: var(--soft); }
.not-editable-badge {
  flex: none; margin-inline-start: 8px; font-size: 11.5px; padding: 1px 7px;
  border-radius: 999px; background: var(--faint); color: #fff; cursor: help;
}

/* חיווי שהנוסח הטעון אינו העדכני שבוויקיטקסט. נכתב מהריצה היומית
   (tools/check_for_update.py); ראו plan.md §1.2 - ידיעה, לא רענון. */
.law-result-stale {
  font-size: 11px;
  color: var(--warn);
  margin-inline-start: 8px;
  white-space: nowrap;
}

/* הערת "צריך להיות" בגוף החוק - ראו scrivenerNotes ב-app.js.
   כתום ולא אדום: זו הערה של מנסחי הנוסח, לא שגיאה של המערכת. */
.scrivener-note-badge {
  flex: none; margin-inline-start: 8px; font-size: 11.5px; padding: 1px 7px;
  border-radius: 999px; background: var(--warn); color: #fff; cursor: help;
  white-space: nowrap;
}

/* חיווי "מעדכן" בצד הצעת החוק - ראו setPreviewPending ב-app.js.
   יש כשתי שניות בין הקלדה לתשובה (השהיה + בקשת render), וזו
   התחושה שדווחה כ"תקוע". ח5 (25.9.2026): 12px באפור בהיר לא נראה -
   עכשיו פס מודגש עם ספינר, דביק לראש החלונית (נשאר גלוי גם כשגוללים
   בהצעה), והתוכן עצמו מעומעם - כדי שיהיה ברור שהוא עוד לא מעודכן. */
.preview-pending {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  font-family: "Assistant", sans-serif; font-size: 14px; font-weight: 700;
  color: var(--flag); background: var(--tint);
  border: 1px solid var(--flag); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 10px;
}
.preview-pending[hidden] { display: none; }
#docx-approx.is-pending #docx-lines { opacity: .45; transition: opacity .15s; }
}

/* לשונית "הצעות חוק" מוצגת במלואה עוד לפני בחירת חוק (ברק,
   2026-09-21) - רק תיבת נוסח החוק ריקה, עם ההסבר הזה בתוכה. */
.tree-empty {
  color: var(--faint);
  font-size: 14px;
  padding: 28px 8px;
  text-align: center;
}
/* שדה "שם ההצעה" ברוחב שדה רגיל, לא על כל רוחב הדף. */
.fld-title { max-width: 520px; }

/* תווית סעיף קטן/פסקה - "(א)", "(1)" - בשורת הטקסט עצמה ולא
   בשורה נפרדת מעליה (ברק, 2026-09-21). ראו inlineLabel ב-app.js. */
.node-number-inline {
  align-self: flex-start;
  flex: none;
  line-height: 1.85;
  padding: 2px 0;
}

/* בועת "חושב" בכלי הצ'אט - סימן § פועם ושלוש שורות נוסח
   שמתמלאות. ראו appendThinking ב-app.js. */
.msg.thinking {
  display: flex; align-items: center; gap: 10px;
  color: var(--faint); font-size: 13.5px;
}
.thinking-mark {
  font-size: 19px; font-weight: 700; color: var(--flag);
  animation: think-pulse 1.4s ease-in-out infinite;
}
@keyframes think-pulse {
  0%, 100% { opacity: .35; transform: scale(.92); }
  50%      { opacity: 1;   transform: scale(1.06); }
}
.thinking-lines { display: inline-flex; flex-direction: column; gap: 3px; }
.thinking-lines i {
  display: block; height: 3px; border-radius: 2px;
  background: var(--flag); opacity: .3;
  animation: think-fill 1.8s ease-in-out infinite;
}
.thinking-lines i:nth-child(1) { width: 34px; animation-delay: 0s; }
.thinking-lines i:nth-child(2) { width: 52px; animation-delay: .22s; }
.thinking-lines i:nth-child(3) { width: 22px; animation-delay: .44s; }
@keyframes think-fill {
  0%, 100% { opacity: .22; transform: scaleX(.45); transform-origin: right; }
  45%      { opacity: .85; transform: scaleX(1);   transform-origin: right; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-mark, .thinking-lines i { animation: none; opacity: .6; }
}

/* היסטוריית הצעות - ראו הבלוק בראש הקטע ב-app.js. */
.drafts-panel {
  background: #fff; border: 1px solid var(--rule); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px;
}
.drafts-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.draft-row { display: flex; align-items: stretch; gap: 6px; border-top: 1px solid var(--rule); }
.draft-row:first-child { border-top: 0; }
.draft-row.current { background: var(--tint); }
.draft-open {
  flex: 1; text-align: start; background: none; border: 0; cursor: pointer;
  padding: 9px 4px; display: flex; flex-direction: column; gap: 2px; font: inherit;
}
.draft-open:hover { background: var(--tint-2); border-radius: 6px; }
.draft-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.draft-meta { font-size: 12px; color: var(--faint); }
.draft-delete { align-self: center; }
.draft-notice {
  border-radius: 8px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13.5px; line-height: 1.6;
}
.draft-notice.warn { background: var(--del-bg); border: 1px solid var(--warn); }

/* ── נוסח משולב ───────────────────────────────────────────────── */
.merge-tree { margin-top: 16px; line-height: 1.75; }
.merge-children { margin-inline-start: 22px; }
.merge-line { padding: 3px 6px; border-radius: 4px; }
.merge-label { color: #6b7280; font-weight: 600; margin-inline-end: 4px; }
/* ירוק לתוספת, אדום לנמחק - כמו "עקוב אחר שינויים" בכלי ההצעות.
   מחיקה עדיין אינה דפוס נתמך במיזוג, ולכן .merge-removed מוגדר
   אך אינו מיוצר; כשהדפוס ייתמך, התצוגה כבר תדע להציג אותו. */
.merge-added { background: #e8f7ec; border-inline-start: 3px solid #16a34a; cursor: pointer; }
.merge-added:hover { background: #d7f0de; }
.merge-removed { background: #fdecec; border-inline-start: 3px solid #dc2626;
                 text-decoration: line-through; color: #7f1d1d; }
.merge-line.is-open { box-shadow: 0 0 0 2px rgba(22,163,74,.35); }
.merge-source { margin-top: 6px; padding: 8px 10px; background: #fff; border: 1px solid #d1d5db;
                border-radius: 6px; font-size: 13px; color: #374151; cursor: default; }
.merge-legend { margin-top: 14px; font-size: 13px; color: #4b5563; }
/* מקרא. **לא משתמש בקלאס .merge-added** אף שהצבע זהה: שיתוף הקלאס
   נתן לריבוע המקרא גם cursor:pointer וגם :hover, כאילו אפשר ללחוץ
   עליו - ובבדיקה בדפדפן הוא אף נתפס כ"השינוי הראשון". */
.merge-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px;
                vertical-align: -2px; background: #e8f7ec; border-inline-start: 3px solid #16a34a; }
.merge-changes { margin: 12px 0 0; padding-inline-start: 20px; }
.merge-changes li { margin-bottom: 8px; cursor: pointer; }
.merge-changes li:hover .merge-instruction { color: #111827; }
.merge-instruction { font-size: 13px; color: #6b7280; margin-top: 2px; }
.merge-detail { margin-top: 12px; font-size: 14px; }
.merge-detail ul { margin: 6px 0 0; padding-inline-start: 20px; }

/* ── הצעות דומות ──────────────────────────────────────────────── */
.similar-notice .similar-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: start;
}
.similar-caret { color: #6b7280; font-size: 12px; }
.similar-notice.is-collapsed .similar-body { display: none; }
.similar-body { margin-top: 8px; }
.similar-body ul { margin: 8px 0 6px; padding-inline-start: 20px; }
.similar-body a { color: #1d4ed8; }

/* חיווי שמירה אוטומטית - קטן, לא צועק, אבל נוכח. */
.draft-save-status { font-size: 12.5px; color: #6b7280; margin-inline-start: 10px; }
.draft-save-status.is-saved { color: #15803d; }
.draft-save-status.is-saving { color: #92400e; }
.draft-save-status.is-failed { color: #b91c1c; font-weight: 600; }
.similar-unknown { color: #92400e; }


/* --- אזור גרירת קובץ (א8) --- */
.dropzone {
  border: 1.5px dashed var(--rule); border-radius: 10px;
  padding: 22px 16px; text-align: center; background: var(--tint-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--flag); background: var(--tint); }
.dropzone.has-file { border-style: solid; border-color: var(--ins); background: var(--ins-bg); }
.dropzone.has-error { border-color: var(--del); background: var(--del-bg); }
.dz-ico {
  width: 26px; height: 26px; fill: none; stroke: var(--flag);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  display: block; margin: 0 auto 8px;
}
.dz-main { font-size: 14px; color: var(--ink); }
.dz-sub { font-size: 12px; color: var(--soft); margin-top: 4px; }
.dz-link {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--flag); text-decoration: underline; cursor: pointer;
}


/* --- אייקונים על הודעת צ'אט ---
   צ2: העתקה בפינה הימנית העליונה, ש3: וורד בפינה השמאלית העליונה.
   **sticky ולא absolute:** בהודעה ארוכה שגוללים בה, האייקון נשאר
   בראש החלון ולא צריך לגלול לסוף כדי להגיע אליו. float כדי שהטקסט
   יזרום סביבו ולא מתחתיו. */
.msg-copy, .msg-action {
  position: sticky; top: 6px; z-index: 1;
  width: 26px; height: 26px; padding: 4px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--page);
  cursor: pointer; display: grid; place-items: center;
  margin-bottom: 4px;
}
.msg-copy { float: right; margin-left: 10px; }
.msg-action { float: left; margin-right: 10px; }
.msg-copy:hover, .msg-action:hover { border-color: var(--flag); background: var(--tint); }
.msg-action:disabled { opacity: .5; cursor: default; }
.msg-copy svg, .msg-action svg {
  width: 16px; height: 16px; fill: none; stroke: var(--flag);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* צ3: שדה ההקלדה הוא textarea - Shift+Enter יורד שורה */
textarea.composer-input {
  resize: none; overflow-y: auto; min-height: 38px; max-height: 160px;
  line-height: 24px; font-family: inherit;
}


/* --- בורר הכנסות (ב5) --- */
.pq-knesset {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  padding: 6px 2px 0; font-size: 12px;
}
.pq-knesset-note { color: var(--soft); margin-inline-end: 4px; }
.pq-chip {
  border: 1px solid var(--rule); background: var(--page); color: var(--soft);
  border-radius: 11px; padding: 1px 9px; font-size: 12px; cursor: pointer;
}
.pq-chip:hover { border-color: var(--flag); }
.pq-chip.on { background: var(--flag); border-color: var(--flag); color: #fff; }


/* --- שיחות שאילתא קודמות (ב4) - כפתור "היסטוריה" ורשימה צפה (ש5) --- */
.card > header.qconv-head { align-items: center; }
.qconv-current {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qconv-current:not(:empty)::before { content: "· "; }
.qconv-actions {
  position: relative; display: flex; align-items: center; gap: 8px;
  margin-inline-start: auto; flex: 0 0 auto;
}
.qconv-new { font-size: 12.5px; padding: 5px 11px; }
button.qconv-history-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px;
  border: 1px solid var(--flag); color: var(--flag); background: var(--page);
}
button.qconv-history-btn:hover, button.qconv-history-btn[aria-expanded="true"] { background: var(--tint-2); }
button.qconv-history-btn.warn { border-color: #B45309; color: #B45309; }
.qconv-clock {
  width: 11px; height: 11px; border: 1.6px solid currentColor; border-radius: 50%;
  position: relative; box-sizing: border-box;
}
.qconv-clock::after {
  content: ""; position: absolute; inset-inline-start: 3.4px; top: 1.2px;
  width: 3px; height: 3.4px; border-inline-start: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
}
.card > header .qconv-count {
  font-size: 11px; font-weight: 600; color: var(--soft); background: var(--tint);
  border-radius: 9px; padding: 0 6px; min-width: 18px; text-align: center;
}
.qconv-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
  width: 340px; max-width: calc(100vw - 32px); max-height: min(460px, 70vh); max-height: min(460px, 70dvh);
  display: flex; flex-direction: column;
  background: var(--page); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(11, 42, 91, .16);
}
.qconv-menu[hidden] { display: none; }
.qconv-menu > .inp { margin: 12px 12px 6px; width: auto; font-size: 13px; }
.qconv-list { overflow: auto; flex: 1 1 auto; padding-bottom: 4px; }
.qconv-list .notice { margin: 6px 12px; }
.qconv-group { font-size: 11.5px; font-weight: 700; color: var(--soft); padding: 8px 16px 4px; }
.qconv-empty { padding: 10px 16px 14px; }
.qconv-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  width: 100%; text-align: start; background: none; cursor: pointer;
  border: 0; border-radius: 0; padding: 9px 16px; font: inherit;
}
.qconv-item:hover { background: var(--tint-2); }
.qconv-item.on { background: var(--tint); }
.qconv-item.on .qconv-title { font-weight: 700; }
.qconv-title { color: var(--ink); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qconv-date { color: var(--soft); font-size: 12px; white-space: nowrap; }
button.qconv-all {
  border: 0; border-top: 1px solid var(--rule); border-radius: 0 0 10px 10px;
  background: none; color: var(--flag); font-weight: 600; font-size: 13px;
  padding: 10px 16px; text-align: start;
}
button.qconv-all:hover { background: var(--tint-2); }
button.qconv-all[hidden] { display: none; }

/* ח10: כשל בקליטת עריכה/הוספה - שורה לכל כשל, בולטת */
#download-hint .failure-line { color: var(--del); font-weight: 600; margin-top: 4px; }

/* ח7: ביטול / חזרה בכותרת נוסח החוק */
.undo-bar { margin-inline-start: auto; display: flex; gap: 6px; align-self: center; }
button.undo-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; padding: 4px 10px;
  border: 1px solid var(--rule); background: var(--page); color: var(--flag);
}
button.undo-btn:hover:not(:disabled) { border-color: var(--flag); background: var(--tint-2); }
button.undo-btn svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ת3: מומחה התקנון - צ'אט מימין, המקורות משמאל */
.rules-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.rules-doc-tabs { display: flex; gap: 6px; margin-inline-start: auto; flex-wrap: wrap; }
.rules-doc-tabs .pq-chip { font-size: 12px; }
.rules-cited {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  padding: 8px 16px; border-bottom: 1px solid var(--rule); font-size: 12px; flex: 0 0 auto;
  max-height: 84px; overflow: auto;
}
.rules-cited[hidden] { display: none; }
#rules-cited-chips { display: contents; }
.rules-doc { line-height: 1.75; font-size: 14px; padding: 16px 22px 48px; }
.rules-doc h3 { font-size: 13.5px; color: var(--navy); margin: 22px 0 8px; }
.rules-doc h3:first-child { margin-top: 0; }
.rules-sec { padding: 6px 8px; margin: 0 -8px 4px; border-radius: 6px; scroll-margin-top: 12px;
  transition: background-color .4s; }
.rules-sec-head { font-weight: 700; color: var(--ink); }
.rules-sec-head .num { color: var(--flag); margin-inline-end: 6px; }
.rules-unit { margin: 2px 0; }
.rules-unit .lbl { color: var(--soft); margin-inline-end: 4px; }
.rules-sec.rules-hit { background: #FFF4CC; box-shadow: inset -3px 0 0 #E0A800; }
/* ת8 (26.9.2026): בלי קו מקווקו - הכחול מספיק. */
a.rules-cite { color: var(--flag); text-decoration: none; cursor: pointer; }
a.rules-cite:hover, a.rules-cite:focus { text-decoration: underline; text-underline-offset: 3px; }

/* ש13: "?" משמאל לכנסת הוותיקה ביותר - למה אין כנסות קודמות */
.pq-knesset-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; margin-inline-start: 4px;
  border: 1px solid var(--rule); color: var(--soft); font-size: 12px; font-weight: 700;
  cursor: help; vertical-align: middle;
}
.pq-knesset-help:hover, .pq-knesset-help:focus { color: var(--ink, #222); border-color: var(--soft); }

/* ת6: פרשנות שלפיה נוהגים בכנסת, מתחת לסעיף */
.rules-interp { margin-top: 6px; padding: 6px 10px; border-inline-start: 3px solid var(--flag);
  background: var(--page); font-size: 0.95em; }
.rules-interp .lbl { display: block; font-size: 12px; font-weight: 700; color: var(--flag); margin-bottom: 2px; }


/* ═══ דף הבית (26.9.2026) ═══════════════════════════════════════════
   שלושה מצבים של אותו דף - body[data-view]: guest / new / returning.
   בשפת העיצוב הקיימת: כרטיסים לבנים על --shell, Assistant לממשק,
   --flag כאקסנט בלבד. המנטה (--mint) - רק לכפתורי ההרשמה. */
.rail-guest { padding: 16px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.btn-mint {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--mint); color: var(--navy); font-weight: 700; font-size: 15px;
  border-radius: 8px; padding: 10px 16px; text-decoration: none; border: 1px solid var(--mint);
}
.btn-mint:hover { background: var(--mint-deep); border-color: var(--mint-deep); }
.btn-wide { width: 100%; }
.rail-login { font-size: 13.5px; color: #C6D4EC; text-align: center; }
.rail-login a, .home-signup .home-login a { color: #fff; font-weight: 700; }
body[data-view="guest"] .rail-guest { flex: 1; }
.rail-foot { padding: 10px 12px 14px; border-top: 1px solid rgba(255,255,255,.13); }
.contact-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: transparent; color: #DCE6F7; border: 1px solid rgba(255,255,255,.35);
  font-size: 14px; padding: 8px 12px;
}
.contact-btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.6); color: #fff; }
.contact-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }

#home.tab.on { overflow-y: auto; }
.home { max-width: 1120px; width: 100%; margin: 0 auto; padding: 12px 8px 40px; }
.home-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.home-head h1 { margin: 0; font-size: 26px; font-weight: 700; color: var(--navy); }
.home-h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--navy); }
.home-recent, .home-tools { margin-bottom: 26px; }

.home-signup {
  background: var(--navy); color: #fff; border-radius: 14px;
  padding: 30px 32px; margin-bottom: 28px;
}
.home-signup h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.home-signup p { margin: 0 0 20px; color: #C6D4EC; font-size: 15px; }
.btn-google {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--navy); font-weight: 700; font-size: 16px;
  border-radius: 10px; padding: 13px 28px; text-decoration: none;
}
.btn-google:hover { background: var(--tint); }
.home-login { margin-top: 12px; font-size: 13.5px; }
.home-signup .home-login { color: #C6D4EC; }
.modal .home-login { text-align: center; color: var(--soft); }
.modal .home-login a { color: var(--flag); font-weight: 700; }

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start;
  background: var(--page); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 16px 16px 18px; line-height: 1.55;
}
.tool-card:hover { border-color: var(--flag); box-shadow: 0 6px 18px rgba(11,42,91,.08); }
.tool-card b { font-size: 15.5px; color: var(--navy); }
.tool-card span:not(.tool-ico) { font-size: 13.5px; color: var(--soft); }
.tool-ico {
  width: 34px; height: 34px; border-radius: 9px; background: var(--tint); color: var(--flag);
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
}

.recent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.recent-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: start;
  background: var(--page); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 16px;
  min-width: 0;
}
.recent-item:hover { border-color: var(--flag); }
.recent-tag {
  font-size: 12px; font-weight: 600; color: var(--flag); background: var(--tint);
  border-radius: 999px; padding: 2px 10px;
}
.recent-title {
  font-size: 14.5px; font-weight: 700; color: var(--ink); width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-meta { font-size: 12.5px; color: var(--soft); }
.recent-empty {
  background: var(--page); border: 1px dashed var(--rule); border-radius: var(--r);
  padding: 20px 22px; color: var(--soft); font-size: 14px; line-height: 1.7;
}
@media (max-width: 1150px) {
  .tool-grid, .recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .tool-grid, .recent-grid { grid-template-columns: 1fr; }
  .home-signup { padding: 22px 18px; }
}

/* ═══ חלון קופץ (הרשמה, יצירת קשר) ═══ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(11,42,91,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  position: relative; background: var(--page); border-radius: 14px; width: 100%; max-width: 520px;
  padding: 26px 26px 22px; box-shadow: 0 24px 60px rgba(11,42,91,.3); max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.modal-sm { max-width: 420px; }
.modal h2 { margin: 0 0 14px; font-size: 19px; font-weight: 700; color: var(--navy); padding-inline-end: 28px; }
.modal-sub { margin: -6px 0 18px; color: var(--soft); font-size: 14px; }
.modal-x {
  position: absolute; top: 12px; inset-inline-end: 12px; width: 32px; height: 32px; padding: 0;
  border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--soft);
}
.modal-x:hover { background: var(--tint); color: var(--navy); }
.modal .fld { margin-bottom: 12px; }
.modal textarea { resize: vertical; min-height: 110px; }
.fld-err { font-size: 12.5px; color: var(--del); margin-top: 4px; }
.fld.has-err .inp, .fld.has-err textarea { border-color: var(--del); }
.contact-as {
  font-size: 13.5px; color: var(--soft); background: var(--tint-2); border: 1px solid var(--rule);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}
.contact-error { max-width: none; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 6px; }
.contact-done { text-align: center; padding: 26px 0 14px; font-size: 17px; font-weight: 700; color: var(--ins); }
.contact-done-mark {
  display: flex; align-items: center; justify-content: center; margin: 0 auto 10px;
  width: 44px; height: 44px; border-radius: 50%; background: var(--ins-bg); font-size: 22px;
}
/* השדה הנסתר: מחוץ למסך ולא display:none - בוטים מדלגים על שדות מוסתרים מפורשות */
.hp-field { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* מקום שמור להרשמה ולכניסה (/auth/*) */
body.auth-pending { align-items: center; justify-content: center; background: var(--navy); }
.auth-card {
  background: var(--page); border-radius: 14px; padding: 28px 30px; max-width: 440px; margin: 16px;
  text-align: center;
}
.auth-card img { width: 220px; height: auto; background: var(--navy); border-radius: 10px; margin-bottom: 14px; }
.auth-card h1 { margin: 0 0 8px; font-size: 20px; color: var(--navy); }
.auth-card p { color: var(--soft); margin: 0 0 18px; }

/* ═══ הסתייגויות (בנייה מחדש, 26.9) ═══ */
.res-levels { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.res-levels button { border: 0; border-radius: 0; padding: 7px 18px; background: #fff; }
.res-levels button + button { border-inline-start: 1px solid var(--rule); }
.res-levels button.on { background: var(--flag); color: #fff; font-weight: 600; }
.res-families { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.res-fam { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.res-fam-note { color: var(--soft); font-size: 12.5px; }
.res-max { margin-top: 6px; font-size: 14px; }
.res-max-item { display: inline-block; margin-inline-start: 12px; color: var(--soft); }
.res-max-item.on { color: var(--ink); }
.res-quote { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; background: var(--tint-2); }
.res-quote-row + .res-quote-row { margin-top: 6px; }
.res-demo { font-size: 12.5px; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--touched-accent); border-radius: 999px; padding: 3px 10px; }
a.btn { display: inline-block; padding: 7px 14px; border-radius: 7px; text-decoration: none; border: 1px solid var(--rule); }
a.btn.primary { background: var(--flag); border-color: var(--flag); color: #fff; font-weight: 600; }
.res-preview { margin-top: 14px; font-family: "David", "Frank Ruhl Libre", serif; font-size: 15.5px; line-height: 1.7; text-align: justify; }
.res-heading { margin: 14px 0 4px; font-weight: 700; text-decoration: underline; }
.res-item { margin: 2px 0; }
.res-num { font-weight: 700; }
.res-quoted { padding-inline-start: 26px; }
.res-budget { font-family: Assistant, sans-serif; font-size: 11.5px; color: var(--warn); background: var(--warn-bg); border-radius: 4px; padding: 1px 6px; }

/* ═══ מובייל (docs/mobile-plan.md, ברק 26.9.2026) ═══
   **המחשב לא זז בפיקסל:** מחוץ ל-@media יש כאן רק display:none לפס העליון ולרקע.
   מתחת ל-900px: פס עליון (56px) + ☰, והתפריט הוא מגירה מימין (5ב); שדות 16px (נגד הזום
   של ספארי); יעדי לחיצה 44px. נאכף ב-tests/browser/test_mobile.py. */
.mbar, .rail-backdrop, .mpanes, .rules-src-close { display: none; }
@media (max-width: 899px) {
  body { flex-direction: column; height: 100vh; height: 100dvh; }
  .mbar {
    display: flex; align-items: center; gap: 10px; flex: 0 0 56px; height: 56px;
    padding: 0 6px 0 14px; background: var(--navy); color: #fff;
  }
  .mbar-menu {
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 8px; background: transparent; color: #fff;
  }
  .mbar-menu:hover { background: rgba(255,255,255,.08); }
  .mbar-menu svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .mbar-logo { height: 34px; width: auto; }
  .mbar-title {
    flex: 1; min-width: 0; font-size: 16px; font-weight: 600; text-align: end;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .main { flex: 1; height: auto; min-height: 0; }

  /* המגירה - אותו תפריט, מעל התוכן, מימין */
  .rail {
    position: fixed; top: 0; right: 0; z-index: 90; width: min(300px, 86vw); flex: none;
    transform: translateX(100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: -12px 0 32px rgba(11,42,91,.28);
  }
  body.rail-open .rail { transform: none; visibility: visible; transition: transform .22s ease; }
  body.rail-open .rail-backdrop { display: block; position: fixed; inset: 0; z-index: 89; background: rgba(11,42,91,.45); }
  .nav button { min-height: 44px; font-size: 16px; }
  .brand { padding: 12px 10px 10px; }

  /* 16px בכל שדה - אחרת ספארי מגדיל את הדף בכל נגיעה */
  input, select, textarea, .inp { font-size: 16px !important; }
  /* 44px ליעדי לחיצה */
  button, select, .inp, a.btn, a.btn-mint, [role=button] { min-height: 44px; }
  button, [role=button] { min-width: 44px; }
  .topbar { padding: 8px 12px; }
  .stage { padding: 12px; }

  /* ── שלב 2: הכלים הקלים ── */
  /* פס כותרת שיש בו רק שם הכלי ותיאור - השם כבר בפס העליון */
  .topbar[data-bar=merge], .topbar[data-bar=reservations], .topbar[data-bar=query],
  .topbar[data-bar=agenda], .topbar[data-bar=rules], .topbar[data-bar=proto] { display: none; }
  .card > header.qconv-head { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .card > header.qconv-head h2 { white-space: nowrap; }
  .qconv-actions { margin-inline-start: auto; }

  /* הצ'אטים: טופס בעמודה אחת, הודעות ברוחב, שורת ההקלדה בתחתית הכרטיס */
  .chat-form { flex-direction: column; gap: 8px; padding: 10px 12px 0; }
  .chat-form .fld { flex: none; min-width: 0; }
  .chat { padding: 12px; gap: 10px; }
  .msg { max-width: 92%; font-size: 15.5px; }
  .msg.u { max-width: 85%; }
  .composer { padding: 8px 10px; gap: 8px; }
  .composer-input { min-height: 44px !important; }

  /* שאילתות: הניסוח והשאילתות הקודמות - שתי לשוניות בתוך הכלי */
  .mpanes { display: flex; gap: 6px; margin-bottom: 10px; flex: none; }
  .mpanes button { flex: 1; border-radius: 999px; font-weight: 600; color: var(--soft); background: var(--page); }
  .mpanes button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
  #query .cols { grid-template-rows: minmax(0, 1fr); }
  #query:not(.pane-past) .cols > section:nth-child(2),
  #query.pane-past .cols > section:nth-child(1) { display: none; }

  /* מומחה התקנון: הצ'אט במסך מלא; סעיף שאוזכר נפתח מעליו */
  .rules-cols { grid-template-rows: minmax(0, 1fr); }
  #rules:not(.src-open) .rules-source-card { display: none; }
  #rules.src-open .rules-source-card {
    position: fixed; inset: 56px 0 0 0; z-index: 80; border-radius: 0; border: 0;
  }
  #rules.src-open .rules-source-card > header { flex-wrap: wrap; align-items: center; }
  .rules-src-close { display: inline-flex; align-items: center; margin-inline-start: auto; }
  a.rules-cite { padding: 14px 2px; margin: 0 -2px; }

  /* חלונות קופצים - גיליון תחתון ברוחב המסך */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal-sm {
    max-width: none; border-radius: 16px 16px 0 0; padding: 22px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 92vh; max-height: 92dvh;
  }
  .modal-x { top: 8px; }

  /* ── שלב 3: הכלים עם קובץ ── */
  /* אין גרירה בטלפון: "בחרו קובץ" הוא הכפתור הראשי (מהקבצים / מהדרייב) */
  .card .body { padding: 14px 14px 32px; }
  .card > header { flex-wrap: wrap; row-gap: 2px; padding: 9px 14px; }
  .card > header h2 { white-space: nowrap; }
  .dropzone { padding: 16px 12px; }
  .dz-drag { display: none; }
  .dz-link {
    display: inline-flex; align-items: center; justify-content: center; width: 80%; min-height: 48px;
    background: var(--flag); color: #fff; text-decoration: none; font-weight: 600; border-radius: 8px;
  }
  .dropzone.has-file .dz-link { background: var(--page); color: var(--flag); border: 1px solid var(--flag); }
  /* הסתייגויות: הבחירות אחת מתחת לשנייה */
  .res-levels { display: flex; width: 100%; }
  .res-levels button { flex: 1; }
  .res-families { flex-direction: column; gap: 0; }
  .res-fam { display: flex; min-height: 44px; width: 100%; font-size: 15px; }
  .res-fam input { width: 20px; height: 20px; flex: none; }
  #res-count { width: 100% !important; }
  .res-max-item { display: block; margin-inline-start: 0; }
  #res-pay-btn, #res-download { width: 100%; justify-content: center; display: flex; align-items: center; }
  #res-download { min-height: 48px; }
  .res-preview { text-align: start; font-size: 15px; }
  .res-quoted { padding-inline-start: 14px; }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  .rail, body.rail-open .rail { transition: none; }
}
