/* 6NEMASTER PRO — Budget module (pro-budget.js, deck "PRO Budget MMB Excel", 23 Oct 2026).
   Same light workspace as pro-studio.css: dark green table heads, white cards,
   green on actions and selections. */
.bgHead { margin-bottom: 18px; }
.bgEyebrow { font-size: .74rem; color: var(--st-dim); margin: 0 0 22px; }
.bgHead .acts { align-self: flex-end; }
.bgSave { font-size: .76rem; color: var(--st-dim); min-width: 90px; text-align: end; }
.bgSave.err { color: var(--st-red); font-weight: 700; }
.bgSubLink { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.bgSubLink:hover { color: var(--st-green-d); text-decoration: underline; }
.bgTabsRow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.bgTabsRow .stTabs button { min-width: 74px; }
.bgTools { background: #fff; border: 1px solid var(--st-line); border-radius: 8px; padding: 9px 18px; font-size: .84rem; font-weight: 700; color: var(--st-text); cursor: pointer; }
.bgTools.on { border-color: var(--st-green-d); color: var(--st-green-d); }
.bgTools:hover { border-color: var(--st-green-d); }

/* ---------- 1 choice of format ---------- */
.bgChoice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bgOpt { display: flex; flex-direction: column; padding: 24px 22px 22px; }
.bgOpt > h2 { font-size: 1.15rem !important; margin-bottom: 14px; }
.bgOpt p { margin: 0 0 14px; font-size: .88rem; }
.bgOpt .bgOptSub { color: var(--st-dim); font-size: .92rem; margin-bottom: 26px; }
.bgOpt .bgWide { margin-top: auto; }
.bgWide { width: 100%; margin-top: 18px; }
.bgFootNote { color: var(--st-dim); font-size: .76rem; margin: 22px 0 0; }
.bgFootNote + .bgFootNote { margin-top: 4px; }
.bgList td { vertical-align: middle; }
.bgRowAct { white-space: nowrap; text-align: end; }
.bgRowAct .stLink + .stLink { margin-inline-start: 12px; }
.bgTpl { display: grid; gap: 10px; }

/* ---------- grids (topsheet, accounts, detail, globals, compare) ---------- */
.bgTableWrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.bgGrid { width: 100%; border-collapse: collapse; font-size: .84rem; background: #fff; border: 1px solid var(--st-line); }
.bgGrid th { background: #16261F; color: #fff; text-align: start; font-weight: 700; font-size: .78rem; padding: 9px 8px; border-inline-end: 1px solid #2C4038; white-space: nowrap; }
.bgGrid th:last-child { border-inline-end: 0; }
.bgGrid td { border: 1px solid var(--st-line); padding: 0 8px; height: 36px; vertical-align: middle; }
.bgGrid tbody tr:nth-child(even) td { background: #F4F7F5; }
.bgGrid .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bgGrid th.num { text-align: end; }
.bgGrid .code { width: 90px; }
.bgGrid .act { width: 1%; white-space: nowrap; text-align: end; }
.bgGrid tr.on td { background: var(--st-green-bg) !important; }
.bgGrid tr.sec td { background: #E9EFEC !important; font-weight: 700; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--st-dim); height: 28px; }
.bgGrid tr.secTot td { font-weight: 700; background: #F4F7F5 !important; }
.bgGrid tr.tot td { font-weight: 700; background: #fff !important; border-top: 2px solid #16261F; }
.bgGrid tr.sub td { font-style: italic; background: #FAFBFA !important; }
.bgGrid tr.excl td { color: #9AA8A2; text-decoration: line-through; text-decoration-color: #C9D3CF; }
.bgGrid tr.excl td input { text-decoration: line-through; color: #9AA8A2; }
.bgGrid tr.gone td { color: var(--st-dim); font-style: italic; }
.bgGrid tr.cur td { box-shadow: inset 3px 0 0 var(--st-green); }
.bgGrid tr.err td { background: #FDF3F2 !important; }
.bgGrid tr.zero td:not(:first-child) { color: #8B9993; }
.bgGrid td.r { text-align: end; color: var(--st-dim); }
.bgIn { width: 100%; box-sizing: border-box; border: 1px solid transparent; background: transparent; padding: 6px 4px; font-size: .84rem; color: var(--st-text); border-radius: 4px; min-width: 0; }
.bgIn:hover:not([readonly]) { border-color: var(--st-line); background: #fff; }
.bgIn:focus { outline: 2px solid #9CCDB5; border-color: var(--st-green-d); background: #fff; }
.bgIn.num { text-align: end; }
.bgIn.chg { background: #FFF6DF; border-color: var(--st-warn-line); font-weight: 700; }
.bgIn[readonly] { cursor: default; }
.bgNameCell { display: flex; align-items: center; gap: 4px; }
.bgNameCell .bgIn { flex: 1; }
.bgChev { background: none; border: 0; color: var(--st-green-d); font-size: 1.15rem; line-height: 1; font-weight: 700; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.bgChev:hover { background: var(--st-green-bg); }
.bgNoteDot { color: var(--st-green-d); font-size: .78rem; cursor: help; padding: 0 2px; }
.bgMenuW { position: relative; display: inline-block; }
.bgDots { background: none; border: 0; cursor: pointer; font-size: 1.05rem; padding: 2px 8px; border-radius: 4px; color: var(--st-dim); line-height: 1; }
.bgDots:hover { background: #E6ECE9; color: var(--st-text); }
.bgMenu { position: absolute; z-index: 60; background: #fff; border: 1px solid var(--st-line); border-radius: 8px; box-shadow: 0 10px 26px rgba(20, 40, 32, .16); padding: 6px; min-width: 190px; }
.bgMenu button { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 8px 10px; font-size: .84rem; border-radius: 6px; cursor: pointer; color: var(--st-text); }
.bgMenu button:hover:not(:disabled) { background: var(--st-green-bg); color: var(--st-green-d); }
.bgMenu button:disabled { opacity: .45; cursor: default; }
.bgMenu hr { border: 0; border-top: 1px solid #E6ECE9; margin: 4px 0; }
.bgEmptyRow { color: var(--st-dim); text-align: center; padding: 18px 8px !important; height: auto !important; }
.bgErr { color: var(--st-red); font-weight: 700; }
.bgWarn { color: var(--st-warn); cursor: help; }
.bgCur { display: inline-block; font-size: .64rem; font-weight: 700; background: var(--st-blue-bg); color: #2B4777; border-radius: 4px; padding: 1px 5px; margin-inline-start: 2px; }
.bgTags { display: inline-block; font-size: .64rem; color: var(--st-green-d); margin-inline-start: 4px; white-space: nowrap; }

.bgBar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.bgBar .l, .bgBar .r { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bgPickRow { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.bgPickRow .stF { margin: 0; min-width: 240px; }
.bgSelCard { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.bgSelCard h3 { margin: 0 0 4px; font-size: 1rem; }

/* work area with the tools panel */
.bgWork { display: block; }
.bgWork.withTools { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bgMain { min-width: 0; }

/* ---------- 4 detail ---------- */
.bgDet td { padding: 0 2px; }
.bgDet th.pk, .bgDet td.pk { width: 26px; text-align: center; padding: 0; }
.bgDet .c-desc { min-width: 200px; }
.bgDet .c-qty, .bgDet .c-amt, .bgDet .c-x { width: 64px; }
.bgDet .c-unit { width: 84px; }
.bgDet .c-rate { width: 110px; }
.bgDet .c-base { width: 110px; padding-inline-end: 8px; }
.bgDet.compact .c-desc { min-width: 150px; }
.bgDet.compact .c-qty, .bgDet.compact .c-amt, .bgDet.compact .c-x { width: 52px; }
.bgC { width: 100%; box-sizing: border-box; border: 1px solid transparent; background: transparent; padding: 7px 6px; font-size: .84rem; color: var(--st-text); border-radius: 3px; min-width: 0; }
td.num .bgC, .bgC.num { text-align: end; }
.bgC:focus { outline: 2px solid var(--st-green); outline-offset: -2px; background: #fff; }
.bgC.fx { color: var(--st-green-d); }
.bgC.bad { color: var(--st-red); background: #FDF3F2; }
.bgDet td.selc { background: #DDF2E8 !important; }
.bgDet td.selc .bgC { background: transparent; }
.bgDet tr.cur td.pk { box-shadow: inset 3px 0 0 var(--st-green); }
.bgCards { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.bgCalc h3, .bgLineTot h3, .bgFCalc h3 { font-size: 1rem; margin: 0 0 16px; }
.bgFormula { font-size: 1.05rem; margin: 0 0 14px; line-height: 1.5; word-break: break-word; }
.bgFormula.bad { color: var(--st-red); font-size: .9rem; }
.bgFormula code, .bgCalc code { background: #F4F7F5; border: 1px solid var(--st-line); border-radius: 4px; padding: 1px 6px; font-size: .82rem; }
.bgRef { color: var(--st-green-d); font-size: .8rem; margin: 0 0 6px; }
.bgRef.warn { color: var(--st-warn); }
.bgLineTot p { margin: 0 0 8px; font-size: .88rem; }
.bgLineTot .big { font-size: 1.5rem; font-weight: 700; color: var(--st-green-d); margin-top: 18px; }
.bgLineBar { display: flex; gap: 4px 16px; flex-wrap: wrap; margin-top: 14px; }
.bgLineBar button { background: none; border: 0; padding: 4px 0; font-size: .78rem; color: var(--st-dim); cursor: pointer; }
.bgLineBar button:hover:not(:disabled) { color: var(--st-green-d); text-decoration: underline; }
.bgLineBar button:disabled { opacity: .4; cursor: default; }

/* ---------- 5 tools panel ---------- */
.bgToolsPanel { background: #fff; border: 1px solid var(--st-line); border-radius: 10px; padding: 16px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; box-sizing: border-box; }
.bgToolsH { font-size: .82rem !important; font-weight: 700 !important; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 10px; }
.bgToolSearch { margin-bottom: 12px; padding: 8px 10px !important; font-size: .82rem !important; }
.bgToolLinks { display: flex; gap: 4px 14px; flex-wrap: wrap; margin: 0 0 12px; }
.bgToolLinks button { background: none; border: 0; padding: 2px 0; font-size: .82rem; font-weight: 700; color: var(--st-green-d); cursor: pointer; border-bottom: 2px solid transparent; }
.bgToolLinks.dim button { color: var(--st-dim); font-weight: 400; }
.bgToolLinks button.on { color: var(--st-text); border-bottom-color: var(--st-green); }
.bgToolLinks button:hover { text-decoration: underline; }
.bgMini { width: 100%; border-collapse: collapse; font-size: .8rem; margin: 0 0 10px; }
.bgMini th { background: #16261F; color: #fff; text-align: start; padding: 6px; font-size: .72rem; }
.bgMini td { border: 1px solid var(--st-line); padding: 5px 6px; vertical-align: middle; }
.bgMini tr.on td { background: var(--st-green-bg); }
.bgMini kbd { font-family: inherit; font-size: .72rem; background: #F4F7F5; border: 1px solid var(--st-line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.bgUse { background: #F4F7F5; border: 1px solid var(--st-line); border-radius: 5px; font-size: .74rem; font-weight: 700; padding: 3px 6px; min-width: 42px; cursor: pointer; color: var(--st-text); }
.bgUse:hover:not(:disabled) { border-color: var(--st-green-d); color: var(--st-green-d); }
.bgUse:disabled { opacity: .55; cursor: default; }
.bgUse.pend { background: #FFF6DF; border-color: var(--st-warn-line); }
.bgDef { background: none; border: 0; padding: 0; text-align: start; font-size: inherit; color: var(--st-text); cursor: pointer; }
.bgDef:hover { color: var(--st-green-d); text-decoration: underline; }
.bgChips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.bgChip { display: inline-flex; align-items: center; gap: 4px; background: #F4F7F5; border: 1px solid var(--st-line); border-radius: 14px; padding: 3px 10px; font-size: .78rem; }
.bgChip button { background: none; border: 0; padding: 0 0 0 2px; cursor: pointer; color: var(--st-dim); font-size: .8rem; }
.bgChip button:hover { color: var(--st-red); }
.bgInline { display: flex; gap: 6px; margin: 6px 0 10px; }
.bgInline .stIn { padding: 7px 9px; font-size: .82rem; }
.bgToolLine { font-size: .82rem; margin: 0 0 8px; }
.bgToolsPanel .stNote { font-size: .74rem; margin: 4px 0 10px; }
.bgToolsPanel .stBtn.bgWide { margin-top: 10px; }
.bgKV { display: grid; grid-template-columns: max-content max-content; gap: 6px 26px; margin: 0; font-size: .95rem; }
.bgKV dt { margin: 0; }
.bgKV dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.bgKV dd.big { font-weight: 700; color: var(--st-green-d); }
.bgFCalc { margin-top: 16px; }

/* ---------- 6 globals ---------- */
.bgGlob td .stNote { display: block; font-size: .72rem; margin: 0 0 4px 4px; }
.bgGlob td { height: auto; padding-top: 4px; padding-bottom: 4px; }
.bgImpact td { height: 34px; }
.bgImpact .up { color: var(--st-warn); font-weight: 700; }
.bgImpact .down { color: var(--st-green-d); font-weight: 700; }

/* ---------- 9 versions and forecast ---------- */
.bgCmp .up { color: var(--st-warn); font-weight: 700; }
.bgCmp .down { color: var(--st-green-d); font-weight: 700; }
.bgNE { color: #9AA8A2; cursor: help; }
.bgEst { background: none; border: 1px dashed transparent; border-radius: 4px; padding: 3px 6px; font-size: inherit; color: var(--st-text); cursor: pointer; font-variant-numeric: tabular-nums; }
.bgEst:hover { border-color: var(--st-green-d); color: var(--st-green-d); }
.bgCmpFoot { margin-top: 14px; }
.bgVar { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
.bgVar.up { color: var(--st-warn); }
.bgVar.down { color: var(--st-green-d); }
.bgZero { color: #8B9993; }

/* ---------- 7 Excel import ---------- */
.bgImport { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.bgImpCard { display: flex; flex-direction: column; }
.bgImpCard > h2 { font-size: 1.15rem !important; display: flex; gap: 10px; align-items: baseline; }
.bgImpCard > h2 .n { font-weight: 700; }
.bgImpCard h3 { font-size: .9rem; margin: 18px 0 8px; }
.bgDrop { border: 2px dashed var(--st-line); border-radius: 10px; padding: 26px 16px; text-align: center; background: #F8FAF9; color: var(--st-dim); font-size: .86rem; cursor: pointer; }
.bgDrop.over, .bgDrop:hover { border-color: var(--st-green-d); background: var(--st-green-bg); color: var(--st-green-d); }
.bgDrop b { display: block; color: var(--st-text); font-size: .95rem; margin-bottom: 6px; }
.bgFileName { font-size: 1rem; margin: 0 0 10px; word-break: break-all; }
.bgPickFile { margin: 0 0 4px; }
.bgSheets { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.bgSheets li { padding: 3px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bgWarns { background: var(--st-warn-bg); border: 1px solid var(--st-warn-line); border-radius: 8px; padding: 10px 12px; margin: 14px 0 0; color: var(--st-warn); font-size: .8rem; }
.bgWarns p { margin: 0 0 4px; }
.bgWarns p:last-child { margin: 0; }
.bgMapGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.bgMapGrid .stF { margin-bottom: 10px; }
.stF > span.cap, .bgMapGrid .stF > span { font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--st-dim); }
.bgMore { margin: 4px 0 10px; font-size: .84rem; }
.bgMore summary { cursor: pointer; color: var(--st-green-d); font-weight: 700; font-size: .8rem; margin-bottom: 8px; }
.bgCheck { font-weight: 700; font-size: .92rem; margin: 10px 0 8px; }
.bgCheck.ok { color: var(--st-green-d); }
.bgCheck.ko { color: var(--st-red); }
.bgExplain { margin: 0 0 12px; padding-inline-start: 18px; font-size: .8rem; color: var(--st-dim); }
.bgExplain li { margin-bottom: 4px; }
.bgExplain li.warn { color: var(--st-warn); }
.bgExplain.big { font-size: .88rem; color: var(--st-text); }
.bgImpCard .bgWide { margin-top: auto; }
.bgImpCard .bgWide + .bgWide, .bgImpCard .stBtn2.bgWide { margin-top: 10px; }

/* ---------- 8 Excel workspace ---------- */
.bgFxRow { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.bgNameBox { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--st-dim); }
.bgNameBox input { width: 84px; border: 1px solid var(--st-line); border-radius: 6px; padding: 8px; font-size: .84rem; background: #fff; font-family: inherit; }
.bgFxBar { flex: 1; min-width: 240px; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--st-line); border-radius: 8px; padding: 0 12px; }
.bgFxBar .fx { color: var(--st-green-d); font-style: italic; font-weight: 700; font-size: .84rem; }
.bgFxBar input { flex: 1; border: 0; background: transparent; padding: 10px 0; font-size: .9rem; color: var(--st-green-d); min-width: 0; font-family: Consolas, Menlo, monospace !important; }
.bgFxBar input:focus { outline: none; }
.bgFxBar:focus-within { border-color: var(--st-green-d); box-shadow: 0 0 0 2px #CFEADC; }
.bgFmt { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--st-dim); }
.bgFmt select { border: 1px solid var(--st-line); border-radius: 6px; padding: 8px; font-size: .82rem; background: #fff; }
.bgBookWrap { max-height: 62vh; overflow: auto; border: 1px solid var(--st-line); background: #fff; }
.bgBook { border-collapse: separate; border-spacing: 0; font-size: .82rem; user-select: none; }
.bgBook th { position: sticky; top: 0; z-index: 2; background: #16261F; color: #fff; font-weight: 700; font-size: .76rem; padding: 7px 8px; text-align: start; border-inline-end: 1px solid #2C4038; white-space: nowrap; min-width: 70px; }
.bgBook th.mapped { background: #0B5A41; }
.bgBook th.rn, .bgBook td.rn { position: sticky; inset-inline-start: 0; z-index: 1; min-width: 38px; width: 38px; text-align: center; color: var(--st-dim); background: #EEF2F0; font-size: .72rem; }
.bgBook th.rn { z-index: 3; background: #16261F; }
.bgBook td { border-inline-end: 1px solid #E1E8E4; border-bottom: 1px solid #E1E8E4; padding: 0 8px; height: 30px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: cell; }
.bgBook tbody tr:nth-child(even) td:not(.rn) { background: #F7FAF8; }
.bgBook td.n { text-align: end; font-variant-numeric: tabular-nums; }
.bgBook td.f { color: var(--st-green-d); }
.bgBook td.b { font-weight: 700; }
.bgBook td.err { color: var(--st-red); font-weight: 700; background: #FDF3F2 !important; }
.bgBook td.cached { font-style: italic; }
.bgBook td.in { background: #E6F5EE !important; }
.bgBook td.sel { outline: 2px solid var(--st-green); outline-offset: -2px; background: #fff !important; }
.bgBook tr.hid td { color: #A3B0AA; background: repeating-linear-gradient(135deg, #fff, #fff 6px, #F3F5F4 6px, #F3F5F4 12px) !important; height: 18px; font-size: .7rem; }
.bgCellEdit { position: absolute; z-index: 5; box-sizing: border-box; border: 2px solid var(--st-green); padding: 0 6px; font-size: .82rem; background: #fff; outline: none; font-family: inherit; }
.bgSheetBar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.bgSheetBar .stTabs { margin: 0; }
.bgDiag { list-style: none; margin: 0; padding: 0; font-size: .8rem; max-height: 260px; overflow-y: auto; }
.bgDiag li { padding: 5px 0; border-bottom: 1px solid #E6ECE9; }
.bgDiag li .stLink { margin-inline-end: 8px; font-size: .78rem; }

/* ---------- 10 reports ---------- */
.bgReports { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.bgRepSide .stF { margin-bottom: 14px; }
.bgTwo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bgTwo select { width: 100%; box-sizing: border-box; background: #F4F7F5; border: 1px solid var(--st-line); border-radius: 8px; padding: 10px 8px; font-size: .86rem; }
.bgRepSide .stCheck { display: flex; gap: 8px; align-items: center; font-size: .82rem; margin: 0 0 6px; }
.bgRepBtns { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.bgRepBtns .stLink { text-align: start; }
.bgRepBtns .stBtn, .bgRepBtns .stBtn2 { width: 100%; }
.bgRepPrev { padding: 16px; }
.bgPrevWrap { background: #E9EEEC; border-radius: 8px; padding: 14px; max-height: 76vh; overflow: auto; }
.bgPrevWrap iframe { display: block; width: 100%; border: 0; background: transparent; height: 560px; }
.bgPrevWrap { padding: 0; overflow: hidden; }
.bgMiniSum { font-size: .8rem; color: var(--st-dim); margin: 10px 0 0; }

/* buttons */
.stDangerBtn { background: #fff; color: var(--st-red); border: 1px solid #E6B4AF; border-radius: 8px; font-weight: 700; font-size: .86rem; padding: 10px 20px; cursor: pointer; }
.stDangerBtn:hover { background: #FCEDEB; }

/* ---------- phones and narrow windows ---------- */
@media (max-width: 1100px) {
  .bgWork.withTools { grid-template-columns: minmax(0, 1fr) 260px; }
  .bgReports { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .bgChoice, .bgImport, .bgCards, .bgReports, .bgMapGrid { grid-template-columns: minmax(0, 1fr); }
  .bgWork.withTools { grid-template-columns: minmax(0, 1fr); }
  .bgToolsPanel { position: static; max-height: none; }
  .bgTabsRow { flex-direction: column; align-items: stretch; }
  .bgTabsRow .bgTools { align-self: flex-start; }
  .bgPickRow .stF { min-width: 0; flex: 1 1 100%; }
  .bgHead .acts { align-self: flex-start; }
  .bgBar .r { width: 100%; }
  .bgBar .r .stBtn, .bgBar .r .stBtn2 { flex: 1; }
  .bgFxRow { gap: 8px; }
  .bgFxBar { min-width: 0; flex: 1 1 100%; order: 3; }
  .bgDet .c-desc { min-width: 150px; }
}
html[dir="rtl"] .bgGrid tr.cur td, html[dir="rtl"] .bgDet tr.cur td.pk { box-shadow: inset -3px 0 0 var(--st-green); }
html[dir="rtl"] .bgChev { transform: scaleX(-1); }

/* Corrections 24 Oct: PDF import card, AI reading of an imported budget */
.bgChoice.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bgAiBox { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--st-line); }
.bgAiWait { margin: 12px 0; }
.bgAiWait .stProgress { height: 6px; border-radius: 4px; background: var(--st-line); overflow: hidden; }
.bgAiWait .stProgress i { display: block; height: 100%; background: var(--st-green-d); transition: width .6s; }
.bgAiRes { margin-top: 10px; }
.bgAiTable { max-height: 420px; overflow: auto; border: 1px solid var(--st-line); border-radius: 8px; margin: 8px 0; }
.bgAiTable table { font-size: .8rem; }
.bgAiTable thead th { position: sticky; top: 0; background: var(--st-card, #fff); z-index: 1; }
.bgAiCat td { background: #F1F5F3; font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 1000px) { .bgChoice.three { grid-template-columns: minmax(0, 1fr); } }
/* Cost report tab */
.crKpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.crKpi { padding: 14px 16px !important; }
.crKpi span { display: block; font-size: .74rem; color: var(--st-dim); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.crKpi b { font-size: 1.25rem; }
.crKpi b small { font-size: .72rem; font-weight: 600; color: var(--st-dim); }
.crKpi.over b, .crOver { color: #B42318 !important; }
.crBar { height: 6px; border-radius: 4px; background: var(--st-line); overflow: hidden; margin-top: 6px; min-width: 60px; }
.crBar i { display: block; height: 100%; background: var(--st-green-d); }
.crBar i.over { background: #B42318; }
.crPct { min-width: 110px; }
.crPct .crBar { display: inline-block; width: 64px; vertical-align: middle; margin: 0 6px 0 0; }
.crPct span { font-size: .78rem; }
.crCat td { background: #F1F5F3; font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.crFilter { display: flex; gap: 6px; flex-wrap: wrap; }
.crChip { border: 1px solid var(--st-line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: .8rem; cursor: pointer; color: var(--st-text); }
.crChip.on { background: var(--st-green-bg); border-color: var(--st-green-d); color: var(--st-green-d); font-weight: 700; }
.crType { font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #EEF2F0; }
.crType.invoice { background: #E5F3EC; color: #087D5C; }
.crType.order { background: #FFF4E5; color: #9A5B00; }
.crType.payment { background: #E8EEFC; color: #2945A8; }
