/* ===== בניית תקציב 2027 — עמינדב מחלקות ===== */
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Rubik', sans-serif; background: #f1f5f9; color: #1e293b; }

/* header */
.header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px;
    background: linear-gradient(135deg, #9B6DB5, #7BC5D6); color: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.12); }
.header-logo img { height: 46px; width: auto; display: block; }
.header-center { text-align: center; }
.header-center h1 { margin: 0; font-size: 21px; font-weight: 700; }
.header-center p { margin: 2px 0 0; font-size: 13px; opacity: .9; }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-user-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.header-user-info { display: flex; flex-direction: column; text-align: right; }
.header-user-name { font-weight: 600; font-size: 14px; }
.header-user-email { font-size: 12px; opacity: .85; }

.b27-backbar { max-width: 1500px; margin: 18px auto 0; padding: 0 20px; }
.b27-back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: #64748b; font-weight: 600; font-size: 14px;
    background: #fff; padding: 8px 16px; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.b27-back:hover { color: #6d28d9; }

#bb27Root { max-width: 1500px; margin: 18px auto 60px; padding: 0 20px; }
.b27-loading, .b27-empty { text-align: center; color: #94a3b8; padding: 60px 0; font-size: 15px; }

/* toolbar */
.b27-toolbar { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 18px; }
.b27-title { font-size: 20px; font-weight: 700; color: #1e293b; }
.b27-sub { font-size: 13px; color: #94a3b8; margin-top: 2px; max-width: 760px; line-height: 1.6; }
.b27-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.b27-filter { display: flex; align-items: center; gap: 6px; }
.b27-fl { font-size: 12px; font-weight: 700; color: #94a3b8; }
.b27-filter select { padding: 8px 12px; font-family: 'Rubik', sans-serif; font-size: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: #334155; }
.b27-status { font-size: 13px; color: #94a3b8; min-width: 120px; text-align: left; }
.b27-status.ok { color: #10b981; } .b27-status.dirty { color: #f59e0b; } .b27-status.err { color: #ef4444; }
.b27-btn { padding: 10px 22px; font-size: 14px; font-weight: 600; font-family: 'Rubik', sans-serif; border: none; border-radius: 10px; cursor: pointer; transition: all .2s ease; }
.b27-btn.save { color: #fff; background: linear-gradient(135deg, #9B6DB5, #7BC5D6); box-shadow: 0 2px 10px rgba(155,109,181,.3); }
.b27-btn.save:hover { filter: brightness(1.05); transform: translateY(-1px); }
.b27-btn.save:disabled { opacity: .5; cursor: default; transform: none; }
.b27-btn.ghost { color: #64748b; background: #eef2f7; }
.b27-btn.ghost:hover { background: #e2e8f0; }
.b27-btn.sm { padding: 7px 16px; font-size: 13px; margin-top: 10px; }

/* card + main table */
.b27-card { background: #fff; border-radius: 16px; box-shadow: 0 2px 16px rgba(0,0,0,.07); padding: 18px; margin-bottom: 20px; }
.b27-cathead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.b27-catname { font-size: 17px; font-weight: 700; color: #334155; }
.b27-catbadge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.b27-catbadge.inc { color: #047857; background: #ecfdf5; }
.b27-catbadge.exp { color: #6d28d9; background: #f5f3ff; }
.b27-scroll { overflow-x: auto; }
table.b27-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.b27-table th, .b27-table td { padding: 9px 12px; text-align: center; border-bottom: 1px solid #eef2f7; }
.b27-table thead th { background: #f8fafc; color: #64748b; font-weight: 700; font-size: 12px; }
.b27-table th.b27-name, .b27-table td.b27-name { text-align: right; font-weight: 600; color: #334155; min-width: 220px; }
.b27-2027col { background: #faf7fd; } .b27-table th.b27-2027col { background: #f3ecfa; }
.b27-actcol { min-width: 150px; }
.b27-line:hover td { background: #fcfdff; }
.b27-line:hover td.b27-2027col { background: #f6f0fc; }
.b27-line.b27-open td { background: #f7f9ff; }
.b27-actual { color: #64748b; white-space: nowrap; }

/* clickable drill cells */
.b27-clickable { cursor: pointer; }
.b27-clickable:hover { text-decoration: underline; }
td.b27-clickable { color: #0e7490; font-weight: 600; }
.b27-drill { color: #6d28d9; margin-left: 5px; font-size: 12px; }
.b27-actual.b27-clickable { color: #0e7490; font-weight: 600; }
.b27-ledico { margin-right: 5px; vertical-align: -1px; opacity: .7; }

/* 2027 input / from-breakdown */
.b27-amount { width: 120px; padding: 7px 10px; font-size: 14px; font-weight: 600; text-align: center; font-family: 'Rubik', sans-serif;
    border: 1.5px solid #d8c7ea; border-radius: 8px; background: #fff; color: #1e293b; }
.b27-amount:focus { outline: none; border-color: #9B6DB5; box-shadow: 0 0 0 3px rgba(155,109,181,.15); }
.b27-frombd { font-size: 14px; font-weight: 700; color: #6d28d9; }
.b27-tag { font-size: 10px; font-weight: 700; color: #7c3aed; background: #ede9fe; padding: 2px 7px; border-radius: 12px; vertical-align: middle; }

/* mini buttons */
.b27-mini { padding: 5px 12px; font-size: 12px; font-weight: 600; font-family: 'Rubik', sans-serif; border: 1px solid #e2e8f0;
    background: #f8fafc; color: #64748b; border-radius: 8px; cursor: pointer; margin: 2px; }
.b27-mini:hover { background: #eef2f7; }
.b27-mini.on { color: #6d28d9; border-color: #d8c7ea; background: #f5f3ff; }
.b27-mini.expand { color: #0e7490; }
.b27-mini.copy { color: #0f766e; border-color: #99f6e4; background: #f0fdfa; }

/* delta */
.b27-delta { font-size: 12px; font-weight: 700; white-space: nowrap; color: #94a3b8; }
.b27-delta small { font-weight: 500; opacity: .8; }
.b27-delta.up { color: #dc2626; } .b27-delta.down { color: #059669; } .b27-delta.zero { color: #94a3b8; }

/* subtotal / grand */
.b27-subtot td { font-weight: 700; color: #334155; background: #f8fafc !important; border-top: 2px solid #e2e8f0; }
.b27-grand { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; margin: 4px 2px 40px; }
.b27-gcell { background: #fff; border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.06); padding: 14px 22px; min-width: 180px; text-align: center; }
.b27-gcell.teal { background: linear-gradient(135deg, #9B6DB5, #7BC5D6); }
.b27-glabel { font-size: 12px; font-weight: 600; color: #94a3b8; }
.b27-gcell.teal .b27-glabel { color: rgba(255,255,255,.85); }
.b27-gval { font-size: 22px; font-weight: 800; color: #1e293b; margin-top: 4px; }
.b27-gcell.teal .b27-gval { color: #fff; }

/* ===== 2027 breakdown editor (my own) ===== */
.b27-exprow > td { background: #f9fafc; padding: 0; border-bottom: 1px solid #eef2f7; }
.b27-bd { padding: 12px 16px 16px; border-right: 3px solid #c4b5e0; margin: 4px 0; }
.b27-bd-title { font-size: 13px; font-weight: 700; color: #6d28d9; margin-bottom: 8px; }
table.b27-bdtable { border-collapse: separate; border-spacing: 0; width: 100%; max-width: 760px; font-size: 13px; }
.b27-bdtable th { text-align: right; font-size: 11px; color: #94a3b8; font-weight: 700; padding: 4px 8px; }
.b27-bdtable td { padding: 4px 8px; }
.b27-bdtable th.b27-bdamt { width: 130px; } .b27-bdtable th.b27-bdname { width: 240px; }
.b27-bdin { width: 100%; padding: 6px 9px; font-size: 13px; font-family: 'Rubik', sans-serif; border: 1px solid #e2e8f0; border-radius: 7px; background: #fff; color: #1e293b; }
.b27-bdin:focus { outline: none; border-color: #9B6DB5; box-shadow: 0 0 0 2px rgba(155,109,181,.12); }
.b27-bdnum { text-align: center; font-weight: 600; }
.b27-bdsum td { font-weight: 700; color: #6d28d9; border-top: 1.5px solid #e2e8f0; text-align: right; padding-top: 8px; }
.b27-bdsum td.b27-bdnum { text-align: center; }
.b27-delrow { width: 26px; height: 26px; border: none; border-radius: 6px; background: #fef2f2; color: #ef4444; font-size: 16px; cursor: pointer; line-height: 1; }
.b27-delrow:hover { background: #fee2e2; }

/* ===== כרטסת — עותק מדויק מהדשבורד הראשי (details-row / details-table) ===== */
.details-row { display: none; }
.details-row.active { display: table-row; }
.details-row > td { padding: 0 !important; border: none !important; }
.item-details { background: #fafbfc; padding: 16px 24px; border-top: 1px dashed #e2e8f0; }
.details-wrapper { max-width: 750px; margin: 0 auto; background: white; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); overflow: hidden; }
.details-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.filter-input { flex: 1; max-width: 280px; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; font-family: 'Rubik', sans-serif; transition: border-color 0.2s; }
.filter-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.filter-input::placeholder { color: #94a3b8; }
.details-count { font-size: 12px; color: #64748b; background: #e2e8f0; padding: 6px 12px; border-radius: 12px; font-weight: 500; }
.details-table-container { max-height: 400px; overflow-y: auto; }
.details-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.details-table th { background: #f1f5f9; padding: 12px 14px; text-align: center; font-weight: 600; color: #475569; position: sticky; top: 0; }
.details-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.details-table tbody tr:hover { background: #f8fafc; }
.details-table .detail-date { text-align: center; color: #64748b; font-size: 12px; width: 85px; }
.details-table .detail-description { text-align: right; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-table .detail-amount { text-align: right; direction: ltr; font-variant-numeric: tabular-nums; font-family: 'Rubik', monospace; width: 100px; padding-left: 15px; }

/* ===== פירוט תקציב 2026 — מודל עותק מדויק מהדשבורד הראשי (bb-*) ===== */
#bb-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(15,23,42,.45); align-items: center; justify-content: center; }
#bb-overlay.show { display: flex; }
.bb-modal { background: #fff; border-radius: 12px; width: min(440px, 92vw); max-height: 82vh; overflow-y: auto; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.22); direction: rtl; }
.bb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bb-title { font-size: 15px; font-weight: 600; color: #0f172a; }
.bb-close { background: none; border: none; font-size: 16px; color: #94a3b8; cursor: pointer; padding: 2px 6px; }
.bb-close:hover { color: #0f172a; }
.bb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bb-table td { padding: 8px 0; border-bottom: 1px solid #e2e8f0; }
.bb-name { color: #0f172a; }
.bb-note { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.bb-amt { text-align: left; white-space: nowrap; color: #0f172a; }
.bb-total td { font-weight: 600; border-bottom: none; padding-top: 10px; }
.bb-check { margin-top: 12px; padding: 8px 10px; border-radius: 8px; font-size: 12px; }
.bb-ok { background: #ecfdf5; color: #047857; }
.bb-warn { background: #fef3c7; color: #92400e; }

@media (max-width: 640px) {
  .header { flex-direction: column; gap: 8px; padding: 12px; }
  .b27-toolbar { flex-direction: column; }
}

/* ===== יישור אחיד (עמודות זהות בין כל הטבלאות + סכומים לפי מפריד אלפים) ===== */
table.b27-table { table-layout: fixed; }
.b27-c-name { width: 22%; }
.b27-c-num  { width: 14.5%; }
.b27-c-act  { width: 20%; }
.b27-table td.b27-name { white-space: normal; }
/* מספרים: יישור לימין + tabular כדי שמפרידי האלפים יעמדו אחד מעל השני */
.b27-table th.b27-num { text-align: right; padding-right: 16px; }
.b27-table td.b27-num { text-align: right; direction: ltr; font-variant-numeric: tabular-nums; padding-right: 16px; }
.b27-amount { text-align: right; direction: ltr; width: 110px; }
.b27-frombd { direction: ltr; }
.b27-delta { font-variant-numeric: tabular-nums; }
/* ביצוע 2026 — נקי כמו בתקציב: בלי קו תחתון ובלי סמל */
.b27-ledico { display: none; }
.b27-actual, .b27-actual.b27-clickable, td.b27-clickable { color: #334155; font-weight: 600; }
.b27-clickable { cursor: pointer; }
.b27-clickable:hover { text-decoration: none; background: #eef6f9; }
.b27-drill { color: #a78bda; font-size: 11px; margin: 0; margin-inline-end: 5px; }

/* ===== אישור תקציב 2027 ===== */
.b27-approvebar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: #fff; border: 1px solid #ede9fe; border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.05); padding: 14px 18px; margin: 30px 0 4px; }
.b27-apinfo { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.b27-aptitle { font-size: 15px; font-weight: 700; color: #4338ca; }
.b27-apok { font-size: 13px; font-weight: 600; color: #047857; background: #ecfdf5; padding: 5px 12px; border-radius: 20px; }
.b27-apno { font-size: 13px; font-weight: 600; color: #b45309; background: #fffbeb; padding: 5px 12px; border-radius: 20px; }

/* ===== פופאפ (מחליף alert/confirm) ===== */
.b27-pop-overlay { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center;
    background: rgba(30, 27, 55, .45); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; }
.b27-pop-overlay.show { opacity: 1; visibility: visible; }
.b27-pop { width: min(420px, 92vw); background: #fff; border-radius: 20px; padding: 28px 26px 22px; text-align: center;
    box-shadow: 0 20px 60px rgba(76, 29, 149, .28); transform: translateY(12px) scale(.97); transition: transform .22s cubic-bezier(.2,.8,.25,1); }
.b27-pop-overlay.show .b27-pop { transform: translateY(0) scale(1); }
.b27-pop-ic { width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 700; color: #fff; }
.b27-pop-ok  .b27-pop-ic { background: linear-gradient(135deg, #10b981, #059669); }
.b27-pop-warn .b27-pop-ic { background: linear-gradient(135deg, #9B6DB5, #6d28d9); }
.b27-pop-err .b27-pop-ic { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.b27-pop-title { font-size: 19px; font-weight: 700; color: #1e293b; line-height: 1.4; }
.b27-pop-body { font-size: 14px; color: #475569; margin-top: 10px; line-height: 1.6; }
.b27-pop-line { margin-top: 8px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.b27-pop-line.ok { background: #ecfdf5; color: #047857; }
.b27-pop-line.warn { background: #fffbeb; color: #b45309; }
.b27-pop-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.b27-pop-btn { border: none; cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 600; padding: 11px 26px; border-radius: 12px;
    background: #f1f5f9; color: #475569; transition: filter .15s ease, background .15s ease; }
.b27-pop-btn:hover { background: #e2e8f0; }
.b27-pop-btn.primary { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; box-shadow: 0 6px 16px rgba(109, 40, 217, .35); }
.b27-pop-btn.primary:hover { filter: brightness(1.07); }
