/* src/app/dan/branches.css — ענפים: העיצוב של דן, מועתק.
 * מקור: legacy/community/branches.html (ה-<style> שלו, כלל אחר כלל)
 * מסכים: src/app/screens/branches.js — עוטף את עצמו ב-`<div class="dan dan-branches">`.
 * הנוהל: docs/runbooks/dan-design-port.md · הפלטה (`--d-*`): src/app/dan/dan.css.
 *
 * ⚠️ מה שונה מהמקור, ולמה — חמישה דברים בלבד:
 *  ① **אין `:root`, אין `body`, אין `main`/`aside`.** הפלטה ב-dan.css, הרקע והמעטפת — של המעטפת.
 *     `@media(max-width:900px){ main{…} aside{display:none} }` של דן הוא מעטפת, לא תוכן המסך.
 *  ② **`@container` ולא `@media`.** רוחב התוכן תלוי במעטפת (סרגל פתוח/סגור), לא ברוחב החלון.
 *     הסף נשאר של דן (820) — "מתחת לו טבלה עם חמש עמודות אינה נקראית" — אבל נמדד על המכל.
 *  ③ **שתי מחלקות התנגשו ב-packages/ui:** `.pill` ⟶ `.bpill` · `.bar` ⟶ `.ubar` · `.topbar` ⟶ `.btop`
 *     (`.topbar` של המעטפת הוא פס לבן sticky). `.tools` · `.num` · `.note` · `.none` … אינן במעטפת.
 *  ④ **ניגודיות AA:** `--dim` של דן (#A3ACA5, 2.4:1) אינו טקסט — "טרם מונה" · "—" · אפס · "טרם נבדק"
 *     עברו ל-`--d-faint` (5.37 על לבן). `opacity` על טקסט מוריד אותו מתחת ל-4.5 בלי שאיש ראה:
 *     `.fchip[data-empty]` (0.42) ו-`.fchip .c` (0.75) הוחלפו — "צ׳יפ ריק" נקרא עכשיו ברקע קרם
 *     ומסגרת מקווקוות, והטקסט נשאר ב-5.07+. ו-`a:hover` כתום (#E07A3F, 3.0) ⟶ `--d-orange-ink`.
 *  ⑤ **`line-height: normal` מוצהר.** ל-`body` של דן אין line-height (ברירת המחדל, `normal`); ל-`body` של המעטפת יש 1.6
 *     (`--lh-body`), וכל אלמנט בלי line-height משלו (`.bname` · `.mgr` · `td` · `.meta` · `.fchip` · `input` · `.bpill`) ירש אותו;
 *     ל-`h1` יש `--lh-tight` ב-base.css על הרכיב עצמו. נמדד באותו רוחב תוכן (968px): שדה חיפוש 43.2 מול 37, צ׳יפ 37.6 מול 32,
 *     שורת meta 24.8 מול 19, טבלה 397 מול 344 (+15%). ✅ 01.10 — המכל: `.dan { line-height: normal }` ב-dan.css (הפתרון
 *     הכללי, לכל המסכים); הכותרת (`h1`, שנושאת `--lh-tight` משלה) — כאן.
 */

.dan-branches {
  container: dbr / inline-size;
  display: flex; flex-direction: column; gap: 22px;
}
.dan-branches a { color: var(--d-green); text-decoration: none; }
.dan-branches a:hover { color: var(--d-orange-ink); }

.dan-branches .btop { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
/* base.css קובע line-height על רכיב ה-h1 עצמו (`--lh-tight`), ולכן הירושה מהמכל אינה מגיעה אליו — `normal` כאן במפורש (ראו ⑤). */
.dan-branches h1 { font-size: 27px; font-weight: 600; color: var(--d-ink); letter-spacing: -.02em; margin: 0 0 5px; line-height: normal; }
.dan-branches .btop .meta { font-size: 15.5px; color: var(--d-muted); }

/* ⚠️ שלד: `.tablewrap` · ההודעה · `.legend` יושבים יחד בתוך `div` אחד בלי מחלקה — `#body` של דן (בלוק רגיל). בלי העטיפה הם
   היו ילדים ישירים של ה-flex, ו-`gap: 22px` של המכל פותח ~34px בין הטבלה למקרא במקום ~10 (נמדד). */
/* הרשימה. אותה מוסכמת טבלה שבמסכי הענף (branch-budget/branch-documents): מעטפת לבנה
   מעוגלת, כותרת בגוון הקרם, שורות מופרדות בקו רך. */
.dan-branches .tablewrap { background: #fff; border: 1px solid var(--d-line); border-radius: 18px; overflow-x: auto; box-shadow: var(--d-shadow); }
.dan-branches table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.dan-branches thead th { background: var(--d-cream2); color: var(--d-muted); font-weight: 600; font-size: 12.5px; text-align: right;
  padding: 12px 16px; border-bottom: 1px solid var(--d-line); white-space: nowrap; }
.dan-branches thead th.n { text-align: center; }
.dan-branches tbody td { padding: 14px 16px; border-bottom: 1px solid var(--d-line-soft); vertical-align: middle; }
.dan-branches tbody tr:last-child td { border-bottom: none; }
.dan-branches tbody tr:hover { background: #FCFAF3; }

.dan-branches .bname { font-size: 16px; font-weight: 600; color: var(--d-ink); display: inline-block; }
.dan-branches a.bname:hover { color: var(--d-orange-ink); }
.dan-branches .bpill { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; margin-inline-start: 8px;
  vertical-align: middle; white-space: nowrap; }
.dan-branches .bpill.mine { color: var(--d-green-dark); background: var(--d-mint); }

.dan-branches .who { color: var(--d-text); }
.dan-branches .none { color: var(--d-faint); }
/* מנהל + היקף. ⚠️ שתי שורות ולא אחת: "ניסן פתחה 65%" באותה שורה קורא כמו ציון. */
.dan-branches .mgr { display: flex; flex-direction: column; gap: 1px; }
.dan-branches .mgr + .mgr { margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--d-line-soft); }
.dan-branches .mgr .n { color: var(--d-text); }
.dan-branches .mgr .f { font-size: 12.5px; color: var(--d-muted); font-variant-numeric: tabular-nums; }
.dan-branches .mgr .f.nomeasure { color: var(--d-faint); }

/* סרגל הסינון */
.dan-branches .tools { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.dan-branches .search-field, .dan-branches .letter-field { display: grid; gap: 6px; font-size: var(--fs-th); font-weight: 600; color: var(--d-muted); }
.dan-branches .search-field { flex: 1 1 260px; max-width: 440px; }
.dan-branches .letter-field { flex: 0 0 132px; }
.dan-branches .tools input { flex: 1; min-width: 190px; max-width: 320px; font-family: inherit; font-size: 14.5px; color: var(--d-text);
  background: #fff; border: 1px solid var(--d-line); border-radius: 12px; padding: 9px 13px; }
.dan-branches .search-field input { width: 100%; max-width: none; min-height: 44px; }
.dan-branches .letter-field select { width: 100%; min-height: 44px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--d-line); border-radius: 12px; }
.dan-branches .results-count { margin: -8px 0 -10px; font-size: var(--fs-th); color: var(--d-muted); }
.dan-branches .fchip { font-family: inherit; font-size: 13.5px; color: var(--d-muted); background: #fff; border: 1px solid var(--d-line);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.dan-branches .fchip:hover { border-color: var(--d-green); }
/* ⚠️ צ׳יפ בלי אף התאמה נשאר גלוי ומוחלש, ולא נעלם: "0 ענפים בלי מנהל" הוא תשובה,
   וצ׳יפ שנעלם נראה כמו פיצ׳ר שבור. (בדן: opacity .42 — כאן ללא opacity, ראו ④ למעלה.) */
.dan-branches .fchip[data-empty=true] { background: var(--d-cream2); border-style: dashed; border-color: var(--d-sage); }
.dan-branches .fchip[data-empty=true]:hover { border-color: var(--d-green); }
.dan-branches .fchip[aria-pressed=true] { background: var(--d-green); border-color: var(--d-green); border-style: solid; color: #fff; }
.dan-branches .fchip .c { font-size: 12px; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }

/* המספרים הם קישורים: "3 פניות" מוביל לתיבת הפניות של הענף, "2 אירועים" ליומן שלו.
   מספר שאי אפשר ללחוץ עליו הוא דיווח; מספר שאפשר הוא נקודת כניסה. */
.dan-branches td.n { text-align: center; white-space: nowrap; width: 112px; }
/* עמודת המשימות רחבה מאחיותיה: היא נושאת פירוט מילולי ולא רק ספרה. */
.dan-branches td.n.work { width: 186px; white-space: normal; }
.dan-branches .num.work { align-items: center; gap: 3px; }
.dan-branches .wsub { font-size: 11.5px; color: var(--d-muted); line-height: 1.35; text-align: center; }
.dan-branches .wsub.dim { color: var(--d-faint); }
.dan-branches .num { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 12px;
  padding: 5px 12px; min-width: 56px; line-height: 1.25; }
.dan-branches a.num:hover { background: var(--d-mint); }
.dan-branches .num b { font-size: 19px; font-weight: 600; color: var(--d-ink); font-variant-numeric: tabular-nums; }
.dan-branches .num.warn b { color: var(--d-orange-ink); }
.dan-branches .num .sub { font-size: 11.5px; color: var(--d-faint); white-space: nowrap; }
.dan-branches .num.zero b { color: var(--d-faint); font-weight: 400; }

.dan-branches .bud { font-size: 14px; background: var(--d-cream2); border: 1px solid var(--d-line-soft); border-radius: 999px;
  padding: 7px 14px; display: inline-block; line-height: 1; white-space: nowrap; }
.dan-branches a.bud:hover { background: var(--d-mint); border-color: #CFE3D6; color: var(--d-green-dark); }
.dan-branches .bud .y { color: var(--d-faint); font-size: 12.5px; margin-inline-start: 5px; }

/* ניצול התקציב. הפס הוא מה שהופך אחוז למשהו שנקרא בסריקה אחת של העין; חריגה נמשכת
   מעבר לרוחב המלא ואי אפשר להראות אותה, ולכן היא נצבעת ולא נמתחת. */
/* האחוז והסכומים זה מתחת לזה ולא זה לצד זה: בשורה אחת רוחב התא הוא סכום שניהם, וזה
   דחק את עמודת המנהל/ת עד ששמות התחילו להישבר לשתי שורות. */
.dan-branches td.use { width: 150px; }
.dan-branches .use-w { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.dan-branches .use-pct { font-size: 17px; font-weight: 600; color: var(--d-ink); font-variant-numeric: tabular-nums; line-height: 1.15; }
.dan-branches .use-of { font-size: 11.5px; color: var(--d-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dan-branches .ubar { height: 6px; border-radius: 999px; background: var(--d-line-soft); overflow: hidden; display: block; }
.dan-branches .ubar i { display: block; height: 100%; background: var(--d-green-mid); border-radius: 999px; }
.dan-branches .over .use-pct { color: var(--d-orange-ink); }
.dan-branches .over .ubar i { background: var(--d-orange); }

.dan-branches .legend { font-size: 13px; color: var(--d-faint); line-height: 1.6; }
.dan-branches .note { background: #fff; border-radius: 20px; padding: 26px 24px; box-shadow: var(--d-shadow);
  font-size: 15.5px; color: var(--d-muted); line-height: 1.6; }

/* כשאין מדדים להשוואה, כל ענף הוא יעד ברור ברשימה נוחה לסריקה. */
.dan-branches--directory .branch-directory ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.dan-branches--directory .branch-directory li { min-width: 0; background: var(--surface); border: 1px solid var(--d-line); border-radius: 14px; box-shadow: var(--d-shadow); }
.dan-branches--directory .branch-directory li:hover { border-color: var(--d-green); background: var(--d-cream2); }
.dan-branches--directory .branch-directory a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 14px 18px; font-size: var(--fs-body); font-weight: 600; color: var(--d-ink); }
.dan-branches--directory .branch-directory__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dan-branches--directory .branch-directory__arrow { color: var(--d-green); font-size: var(--fs-h2); font-weight: 400; }
.dan-branches--directory .branch-directory .bpill { margin-inline-start: 0; }
@container dbr (max-width: 650px) {
  .dan-branches--directory .branch-directory ul { grid-template-columns: 1fr; }
  .dan-branches .search-field { flex-basis: 100%; max-width: none; }
}

/* מתחת ל-820px טבלה עם חמש עמודות אינה נקראית. אותן שורות בדיוק הופכות לכרטיסים,
   וכל תא נושא את שם העמודה שלו כתווית — בלי מסך שני ובלי סדר תצוגה שני. */
@container dbr (max-width: 820px) {
  .dan-branches thead { display: none; }
  .dan-branches .tablewrap { border-radius: 16px; }
  .dan-branches tbody tr { display: block; border-bottom: 1px solid var(--d-line); padding: 6px 0; }
  .dan-branches tbody tr:last-child { border-bottom: none; }
  .dan-branches tbody td { display: flex; align-items: center; justify-content: space-between; gap: 14px;
    border: none; padding: 7px 16px; width: auto; }
  .dan-branches tbody td.n, .dan-branches tbody td.n.work, .dan-branches tbody td.use { width: auto; }
  .dan-branches .num.work { align-items: flex-start; }
  .dan-branches .wsub { text-align: start; }
  .dan-branches tbody td[data-label]::before { content: attr(data-label); color: var(--d-faint); font-size: 12.5px; flex: none; }
  .dan-branches tbody td.name::before { content: none; }
  .dan-branches .num { align-items: flex-start; padding: 0; min-width: 0; }
  /* הפס צריך רוחב כדי להיות פס. בתוך שורת "תווית מימין, ערך משמאל" הוא היה נמעך. */
  .dan-branches .use-w { min-width: 150px; flex: none; }
}

/* 05.10 · שורת "מזכירות" — תוספת של עגור, אין לה מקבילה ב-legacy/community/branches.html (המזכירות שם group, לא ענף).
   הגלולה ניטרלית (לא ירוקה כמו "הענף שלי": זה לא "שלי") והתא הממוזג נקרא כהערה, לא כנתון. */
.dan-branches .bpill.office { color: var(--d-text); background: var(--d-cream2); }
.dan-branches .office-note { color: var(--d-faint); font-size: var(--fs-th); }
.dan-branches .office-note a { color: var(--d-green-dark); font-weight: 600; }

/* 05.10 · "ממתין למזכירות" — שלוש שורות-קישור בתא הממוזג (טבלה) או מתחת לכותרת (מדריך). אפס חיוור ואינו קישור; לא-אפס כתום כמו `.num.warn`.
   🔴 בלי גדלי פיקסלים — `ui-tokens-only` מתקרה של 20 ערכי font-size מחוץ לטוקן, והקובץ כבר עומד עליה. */
.dan-branches .office-waiting { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: var(--fs-th); }
.dan-branches .office-lead { color: var(--d-faint); }
.dan-branches .wait { font-weight: 600; color: var(--d-green-dark); }
.dan-branches a.wait.warn { color: var(--d-orange-ink); }
.dan-branches a.wait:hover { text-decoration: underline; }
.dan-branches .wait.zero { color: var(--d-faint); font-weight: 400; }
.dan-branches--directory .branch-directory li.office-item > a { min-height: 0; padding-bottom: 8px; }
.dan-branches--directory .branch-directory li.office-item .office-waiting { padding: 0 18px 14px; }
.dan-branches--directory .branch-directory li.office-item .office-waiting a { display: inline; min-height: 0; padding: 0; font-size: inherit; }
