/* brand.css – מיתוג RabieMan Labs לאתר עץ משפחת מנסור (קבצים מקומיים בלבד, תואם CSP) */

/* Heebo (SIL Open Font License 1.1 – ראו fonts/OFL-Heebo.txt) */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/heebo-hebrew-wght-normal.woff2) format('woff2-variations'), url(fonts/heebo-hebrew-wght-normal.woff2) format('woff2');
  unicode-range: U+0307-0308,U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/heebo-latin-wght-normal.woff2) format('woff2-variations'), url(fonts/heebo-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --rm-orange: #ff8a1f;
  --rm-orange-dark: #c2410c;
  --rm-cyan: #22d3ee;
  --rm-line: linear-gradient(90deg, #22d3ee 0%, #38bdf8 35%, #ff8a1f 70%, #ff6a00 100%);
}

/* גופן אחיד (ערבית נופלת לגופן המערכת, כי ל-Heebo אין אותיות ערביות) */
*, input, select, textarea, button {
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* הקו הכתום-תכלת מהלוגו בתחתית הכותרת */
header { position: relative; }
header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--rm-line); box-shadow: 0 0 10px rgba(255, 138, 31, .45);
  pointer-events: none;
}

/* אותו קו בראש חלון הכניסה ובראש כרטיס הכניסה */
#sub-login-modal .modal-card { border-top: 0; position: relative; }
#sub-login-modal .modal-header { position: relative; }
#sub-login-modal .modal-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--rm-line);
}
.login-card { position: relative; overflow: hidden; }
.login-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--rm-line);
}

/* כותרת משנה בצבע המותג */
.brand-text .creator-credit { color: #fdba74; }
.login-card .subtitle, #sub-login-modal .modal-header span { color: #fdba74 !important; }

/* ===== מסך פתיחה ממותג (index.html) ===== */
#rm-splash {
  position: fixed; inset: 0; z-index: 20000; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 38%, #16284a 0%, #0b1220 62%); color: #fff; text-align: center;
  transition: opacity .5s ease; animation: rmSplashFailsafe .5s ease 9s forwards; cursor: pointer;
}
#rm-splash.out { opacity: 0; pointer-events: none; }
#rm-splash .sp-icon { width: 104px; height: 104px; border-radius: 26px; animation: rmPop .6s cubic-bezier(.2,1.4,.4,1) both; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
#rm-splash .sp-name { margin-top: 18px; font-size: 1.7rem; font-weight: 800; letter-spacing: -.3px; animation: rmUp .6s .15s both; }
#rm-splash .sp-name b { color: var(--rm-orange); }
#rm-splash .sp-tag { margin-top: 6px; font-size: .98rem; color: #94a3b8; animation: rmUp .6s .25s both; }
#rm-splash .sp-bar { width: 190px; height: 4px; margin-top: 26px; border-radius: 99px; background: rgba(148,163,184,.2); overflow: hidden; }
#rm-splash .sp-bar i { display: block; height: 100%; width: 100%; background: var(--rm-line); transform-origin: right; animation: rmFill 1.6s ease-out both; }
#rm-splash .sp-labs { position: absolute; bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 800; color: #cbd5e1; letter-spacing: .4px; }
#rm-splash .sp-labs img { width: 26px; height: 26px; border-radius: 50%; }
@keyframes rmPop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rmUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rmFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rmSplashFailsafe { to { opacity: 0; visibility: hidden; } }

/* ===== הודעות קופצות במקום alert() ===== */
#rm-toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 15000; display: flex; flex-direction: column; gap: 8px; width: min(460px, calc(100vw - 24px)); pointer-events: none; }
.rm-toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; direction: rtl; text-align: right;
  background: #0f172a; color: #f1f5f9; border: 1px solid rgba(148,163,184,.25); border-right: 4px solid var(--rm-cyan);
  border-radius: 12px; padding: 11px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.35); font-size: .88rem; line-height: 1.55;
  white-space: pre-line; animation: rmToastIn .25s ease both; cursor: pointer;
}
.rm-toast.ok { border-right-color: #22c55e; }
.rm-toast.err { border-right-color: #ef4444; }
.rm-toast.warn { border-right-color: var(--rm-orange); }
.rm-toast .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rm-toast .x { flex: none; background: none; border: none; color: #94a3b8; font-size: .95rem; cursor: pointer; padding: 0 2px; }
.rm-toast.bye { opacity: 0; transform: translateY(-6px); transition: all .25s ease; }
@keyframes rmToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ===== כותרת מכווצת בנייד: שורה אחת + 🔍 + ☰ ===== */
.m-toggles { display: none; }
@media (max-width: 768px) {
  .m-toggles { display: flex; gap: 6px; margin-inline-start: auto; flex: none; }
  .m-toggles button {
    width: 38px; height: 34px; border-radius: 9px; border: 1px solid rgba(148,163,184,.35);
    background: rgba(255,255,255,.08); color: #fff; font-size: 1.05rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  }
  .m-toggles button.on { background: var(--rm-orange); border-color: var(--rm-orange); color: #1a0d00; }
  .m-toggles .dot { position: relative; }
  .m-toggles .dot[data-n]:not([data-n="0"])::after {
    content: attr(data-n); position: absolute; top: -6px; left: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--rm-orange); color: #1a0d00; font-size: .65rem; font-weight: 800; line-height: 17px;
  }
  header { padding: 7px 10px !important; }
  body:not(.help-inline) header { padding-left: 72px !important; }
  .m-toggles #help-open-btn { position: static; box-shadow: none; width: auto; height: 34px; padding: 0 10px; font-size: .8rem; border-radius: 9px; border: 1px solid var(--rm-orange); }
  .brand { flex-wrap: nowrap !important; gap: 8px !important; }
  .brand .brand-icon { width: 34px; height: 34px; font-size: 1.1rem; flex: none; }
  .brand-text { flex: 1 1 auto !important; min-width: 0; }
  .brand-text h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem !important; }
  /* סגור: רק שורת הכותרת */
  header:not(.m-menu) .brand .stat-pill,
  header:not(.m-menu) .brand .role-pill,
  header:not(.m-menu) [data-rm-chip],
  header:not(.m-menu) .header-actions { display: none !important; }
  header:not(.m-search) .search-wrapper { display: none !important; }
  /* תפריט פתוח */
  header.m-menu .brand { flex-wrap: wrap !important; }
  header.m-menu .brand-text { flex: 1 1 0 !important; }
  header.m-menu .brand .stat-pill { order: 9; }
  header.m-menu .brand .role-pill { order: 10; }
  header.m-menu .header-actions { display: flex !important; }
  header.m-search .search-wrapper { display: block !important; }
}

/* ===== v7.4.0: כרטיס האדם – ייחוס לחיץ ופעולות ===== */
.lineage-card .lin-title { font-weight: 700; margin-bottom: 5px; }
.lin-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.lin-chip { padding: 2px 9px; border-radius: 999px; background: #fff; border: 1px solid #bae6fd; color: #0c4a6e; font-weight: 700; cursor: pointer; font-size: .78rem; }
.lin-chip:hover { border-color: var(--rm-orange); color: var(--rm-orange-dark); }
.lin-chip.me { background: var(--rm-orange); border-color: var(--rm-orange); color: #1a0d00; cursor: default; }
.lin-sep { color: #64748b; font-size: .72rem; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.da-btn { flex: 1 1 auto; padding: 7px 10px; border-radius: 8px; border: 1px solid #cbd5e1; background: #f8fafc; color: #0f172a; font-weight: 700; font-size: .8rem; cursor: pointer; }
.da-btn:hover { border-color: var(--rm-orange); }
.da-btn.wa { background: #dcfce7; border-color: #86efac; color: #166534; }
.da-btn.rel { background: var(--rm-orange); border-color: var(--rm-orange); color: #1a0d00; }
.exp-hero-card .da-btn { flex: none; background: rgba(255,255,255,.09); color: #e2e8f0; border: 1px solid rgba(255,255,255,.18); }

/* ===== "מה הקשר?" ===== */
.rel-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 14000; width: min(520px, calc(100vw - 20px)); display: flex; gap: 10px; align-items: center; justify-content: space-between; background: #0f172a; color: #f1f5f9; border: 1px solid var(--rm-orange); border-radius: 12px; padding: 10px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.35); font-size: .86rem; line-height: 1.45; }
.rel-banner small { color: #94a3b8; }
.rel-banner button { flex: none; background: #1f2937; color: #fff; border: 1px solid #475569; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 700; }
.rel-panel { position: fixed; z-index: 13000; left: 50%; transform: translateX(-50%); bottom: 16px; width: min(560px, calc(100vw - 20px)); max-height: 46vh; overflow-y: auto; background: #fff; color: #0f172a; border-radius: 16px; box-shadow: 0 18px 50px rgba(2,6,23,.35); padding: 14px 16px; border-top: 4px solid transparent; border-image: var(--rm-line) 1; direction: rtl; }
.rel-head { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
.rel-x { background: #f1f5f9; border: none; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
.rel-term { font-size: 1.35rem; font-weight: 800; color: var(--rm-orange-dark); margin: 4px 0 2px; }
.rel-sent { font-size: .9rem; }
.rel-lca { font-size: .8rem; color: #475569; margin-top: 4px; }
.rel-path-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0; }
.rel-chip { padding: 3px 10px; border-radius: 999px; background: #f1f5f9; border: 1px solid #cbd5e1; font-weight: 700; font-size: .8rem; cursor: pointer; }
.rel-chip.end { background: var(--rm-orange); border-color: var(--rm-orange); color: #1a0d00; }
.rel-chip.lca { background: #0f172a; border-color: #0f172a; color: #fff; }
.rel-arr { color: #94a3b8; font-size: .8rem; }
.rel-actions { display: flex; gap: 8px; justify-content: flex-start; }
.link.rel-path { stroke: var(--rm-orange) !important; stroke-width: 4.5px !important; }
.node-group.rel-path .node-card { stroke: var(--rm-orange) !important; stroke-width: 3.5px !important; }
.node-group.rel-end .node-card { fill: #fff7ed !important; stroke-width: 4.5px !important; }

/* ===== "מצא את עצמך" ===== */
.fm-input { width: 100%; margin-top: 10px; padding: 11px 12px; border-radius: 10px; border: 2px solid #cbd5e1; font-size: 1rem; }
.fm-input:focus { outline: none; border-color: var(--rm-orange); }
.fm-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 42vh; overflow-y: auto; }
.fm-item { text-align: right; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 9px 12px; cursor: pointer; font-size: .92rem; }
.fm-item:hover { border-color: var(--rm-orange); background: #fff7ed; }
.fm-item span { color: #64748b; }
.fm-item small { display: block; color: #64748b; margin-top: 2px; }
.fm-empty { color: #64748b; font-size: .85rem; }

/* ===== סיור ===== */
.tour-ov { position: fixed; inset: 0; z-index: 16000; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(2,6,23,.62); border: 2px solid var(--rm-orange); transition: all .3s ease; pointer-events: none; }
.tour-tip { position: fixed; background: #fff; color: #0f172a; border-radius: 14px; padding: 14px 16px; box-shadow: 0 18px 40px rgba(0,0,0,.35); direction: rtl; text-align: right; }
.tour-tip p { font-size: .88rem; color: #334155; margin: 4px 0 10px; line-height: 1.5; }
.tour-tip .tt-step { font-size: .72rem; color: #94a3b8; font-weight: 700; }
.tour-tip .tt-btns { display: flex; gap: 8px; justify-content: space-between; }

/* ===== נייד: שורת בקרה אחת + חלון "⚙️ תצוגה" ===== */
.vs-gear { display: none; }
.vs-backdrop { position: fixed; inset: 0; z-index: 12000; background: rgba(2,6,23,.5); display: none; align-items: flex-end; }
.vs-backdrop.open { display: flex; }
.vs-panel { width: 100%; background: #fff; border-radius: 18px 18px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; direction: rtl; animation: vsUp .22s ease both; }
@keyframes vsUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.vs-handle { width: 42px; height: 5px; border-radius: 99px; background: #cbd5e1; margin: 0 auto; }
.vs-title { font-weight: 800; font-size: 1rem; }
.vs-rows { display: flex; flex-direction: column; gap: 10px; }
.vs-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #f1f5f9; padding-bottom: 9px; }
.vs-label { font-size: .85rem; font-weight: 700; color: #475569; }
.vs-slot { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.vs-slot select { padding: 7px 9px; border-radius: 8px; border: 1px solid #cbd5e1; font-weight: 600; background: #fff; }
.vs-slot .btn { padding: 7px 11px !important; }
.theme-btn { background: #e2e8f0; color: #1e293b; padding: 4px 8px; }
@media (max-width: 768px) {
  body.vs-mobile .subbar { flex-wrap: nowrap !important; }
  body.vs-mobile .branch-tabs { flex: 1 1 auto; width: auto !important; min-width: 0; }
  body.vs-mobile .view-controls { width: auto !important; flex: none; flex-wrap: nowrap; }
  body.vs-mobile .vs-gear { display: inline-flex; background: #0f172a; color: #fff; padding: 5px 9px; white-space: nowrap; }
  body.vs-mobile #my-node-btn { white-space: nowrap; padding: 5px 8px !important; }
}

/* ===== מצב כהה ===== */
body.theme-dark { --bg-main: #0b1220; }
body.theme-dark .subbar { background: #0f172a; border-bottom-color: #1f2937; }
body.theme-dark .branch-tab { background: #111827; color: #cbd5e1; border-color: #334155; }
body.theme-dark .branch-tab.active { background: var(--rm-orange); color: #1a0d00; border-color: var(--rm-orange); }
body.theme-dark .view-controls { color: #cbd5e1; }
body.theme-dark .view-controls select, body.theme-dark .vs-slot select { background: #111827; color: #e2e8f0; border-color: #334155; }
body.theme-dark .view-mode-switch { background: #111827; border-color: #334155; }
body.theme-dark .view-mode-btn { color: #94a3b8; }
body.theme-dark .view-mode-btn.active { background: var(--rm-orange); color: #1a0d00; }
body.theme-dark .view-controls .btn:not(#my-node-btn):not(.vs-gear), body.theme-dark .vs-slot .btn, body.theme-dark .theme-btn { background: #1f2937 !important; color: #e2e8f0 !important; }
body.theme-dark #tree-view { background-color: #0b1220; background-image: radial-gradient(#1e293b 1px, transparent 1px); }
body.theme-dark .node-card { fill: #111827; filter: none; }
body.theme-dark .node-name-he { fill: #f1f5f9; }
body.theme-dark .node-name-ar { fill: #94a3b8; }
body.theme-dark .node-meta { fill: #64748b; }
body.theme-dark .link { stroke: #334155; }
body.theme-dark .collapse-badge { fill: #1f2937; stroke: #475569; }
body.theme-dark .collapse-text { fill: #e2e8f0; }
body.theme-dark .node-group.highlight .node-card { fill: #3b0d1a !important; }
body.theme-dark .node-group.rel-end .node-card { fill: #3a1d05 !important; }
body.theme-dark .floating-controls { background: rgba(15,23,42,.95); border-color: #1f2937; }
body.theme-dark .icon-btn { background: #111827; border-color: #334155; color: #e2e8f0; }
body.theme-dark #explorer-pane { background: #0b1220; }
body.theme-dark .exp-breadcrumbs, body.theme-dark .exp-person-card { background: #111827; border-color: #1f2937; color: #e2e8f0; }
body.theme-dark .exp-crumb, body.theme-dark .exp-person-card .ep-badge { background: #1f2937; color: #e2e8f0; }
body.theme-dark .exp-person-card .ep-name { color: #f1f5f9; }
body.theme-dark .exp-person-card .ep-ar, body.theme-dark .exp-section-title { color: #94a3b8; }
body.theme-dark .exp-person-card:hover { background: #1e293b; }
body.theme-dark .child-chip, body.theme-dark .rel-chip { background: #1f2937; border-color: #334155; color: #e2e8f0; }
body.theme-dark #editor-drawer { background: #0f172a; color: #e2e8f0; border-color: #1f2937; }
body.theme-dark #drawer-name-title { color: #f8fafc !important; }
body.theme-dark .drawer-header { border-bottom-color: #1f2937; }
body.theme-dark #editor-drawer label { color: #94a3b8 !important; }
body.theme-dark .lineage-card { background: #0c1a2e; border-color: #1e3a5f; color: #bae6fd; }
body.theme-dark .lin-chip { background: #111827; border-color: #1e3a5f; color: #bae6fd; }
body.theme-dark .lin-chip.me { background: var(--rm-orange); color: #1a0d00; }
body.theme-dark .da-btn:not(.wa):not(.rel) { background: #111827; border-color: #334155; color: #e2e8f0; }
body.theme-dark .request-box { background: #052e22; border-color: #065f46; }
body.theme-dark .request-box h4, body.theme-dark .request-box p { color: #a7f3d0 !important; }
body.theme-dark #editor-drawer input, body.theme-dark #editor-drawer select, body.theme-dark #editor-drawer textarea { background: #111827; color: #e2e8f0; border-color: #334155; }
body.theme-dark .rel-panel, body.theme-dark .vs-panel { background: #0f172a; color: #e2e8f0; }
body.theme-dark .rel-lca, body.theme-dark .vs-label { color: #94a3b8; }
body.theme-dark .vs-row { border-bottom-color: #1f2937; }
body.theme-dark .rel-x { background: #1f2937; color: #e2e8f0; }

/* תוצאות החיפוש מעל שורת הכפתורים של הכותרת */
.autocomplete-list { z-index: 500 !important; }

/* בורר דורות (− עד דור N +) */
.gen-stepper{display:inline-flex;align-items:center;background:#e2e8f0;color:#1e293b;border-radius:8px;overflow:hidden;font-size:.82rem;font-weight:700;white-space:nowrap}
.gen-stepper .gs-btn{border:none;background:transparent;color:#1e293b;font-size:1.05rem;font-weight:800;line-height:1;padding:4px 10px;cursor:pointer;font-family:inherit}
.gen-stepper .gs-btn:hover{background:#cbd5e1}
.gen-stepper .gs-label{padding:0 4px;min-width:62px;text-align:center}
.gen-stepper .gs-label b{color:#c2410c}
body.theme-dark .gen-stepper{background:#1e293b;color:#e2e8f0}
body.theme-dark .gen-stepper .gs-btn{color:#e2e8f0}
body.theme-dark .gen-stepper .gs-btn:hover{background:#334155}
body.theme-dark .gen-stepper .gs-label b{color:#ffb35c}

#gate-reg-lineage ~ .lineage-hint{font-size:.78rem;color:#64748b;margin-top:5px;line-height:1.5}#gate-reg-lineage ~ .lineage-hint b{color:#334155;font-weight:700}
body.theme-dark #gate-reg-lineage ~ .lineage-hint{color:#94a3b8}body.theme-dark #gate-reg-lineage ~ .lineage-hint b{color:#cbd5e1}
