/* ===========================================================
   budget.css — Project Budget module (.bg-* namespace)
   Mirrors the platform's card/RAG visual language.
   =========================================================== */
.bg { display: flex; flex-direction: column; gap: 14px; }

/* header */
.bg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.bg-title { display: flex; align-items: center; gap: 10px; }
.bg-title h3 { margin: 0; font-size: 18px; }
.bg-badge { background: linear-gradient(135deg, #e0701b, #b8530f); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 4px 9px; border-radius: 6px; }
.bg-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* tabs */
.bg-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line, #e6ddd2); padding-bottom: 2px; }
.bg-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted, #8a7d6c); cursor: pointer; border-radius: 6px 6px 0 0; }
.bg-tab:hover { background: var(--hover, #f6f1ea); color: var(--text, #2a2018); }
.bg-tab.on { color: #b8530f; border-bottom-color: #b8530f; background: #fbf3ec; }

/* KPI grid */
.bg-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.bg-kpi { background: var(--card, #fff); border: 1px solid var(--line, #e6ddd2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bg-kpi.accent { border-color: #e0a06a; background: linear-gradient(180deg, #fff8f1, #fff); }
.bg-kpi-v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text, #2a2018); overflow-wrap: anywhere; }
.bg-kpi-l { font-size: 11px; color: var(--muted, #8a7d6c); font-weight: 600; }
.bg-kpi-s { font-size: 10.5px; color: var(--muted, #a89b88); }
.bg-kpi.bg-k-green { border-left: 4px solid #2f7d32; } .bg-kpi.bg-k-amber { border-left: 4px solid #e0921f; } .bg-kpi.bg-k-red { border-left: 4px solid #cf3c2e; } .bg-kpi.bg-k-grey { border-left: 4px solid #b3a48d; }

/* RAG banner */
.bg-rag { border-radius: 10px; padding: 11px 14px; font-size: 13px; border: 1px solid; }
.bg-rag b { margin-right: 4px; }
.bg-rag-green { background: #eef7ee; border-color: #bfe0c0; color: #245c27; }
.bg-rag-amber { background: #fdf5e6; border-color: #f0d9a8; color: #8a5d12; }
.bg-rag-red { background: #fdecea; border-color: #f3c2bd; color: #8f2a22; }
.bg-rag-grey { background: #f4f1ec; border-color: #ddd3c5; color: #6a5f50; }

/* dashboard grid */
.bg-dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bg-card { padding: 12px 14px; }
.bg-card-h { font-size: 13px; font-weight: 700; color: var(--text, #2a2018); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* charts */
.bg-chart { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bg-ring { display: block; }
.bg-ring-v { font-size: 20px; font-weight: 700; fill: var(--text, #2a2018); }
.bg-ring-s { font-size: 10px; fill: var(--muted, #8a7d6c); }
.bg-donut { display: block; }
.bg-donut-v { font-size: 15px; font-weight: 700; fill: var(--text, #2a2018); }
.bg-donut-s { font-size: 10px; fill: var(--muted, #8a7d6c); }
.bg-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; }
.bg-leg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted, #6a5f50); }
.bg-leg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.bg-leg i.bg-leg-dash { height: 3px; border-radius: 2px; }
.bg-linechart { width: 100%; height: auto; }
.bg-axt { font-size: 9px; fill: var(--muted, #a89b88); }

/* horizontal bars */
.bg-bars { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.bg-bar-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 8px; }
.bg-bar-lbl { font-size: 11.5px; color: var(--text, #4a4036); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-bar-track { background: var(--hover, #f1ebe2); border-radius: 5px; height: 14px; overflow: hidden; }
.bg-bar-fill { display: block; height: 100%; background: #b8530f; border-radius: 5px; min-width: 2px; }
.bg-bar-v { font-size: 11px; color: var(--muted, #6a5f50); font-variant-numeric: tabular-nums; }

.bg-empty { padding: 20px; text-align: center; color: var(--muted, #8a7d6c); font-size: 13px; }

/* filters & actions */
.bg-filter, .bg-act-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bg-filter .fld, .bg-act-row .fld { max-width: 170px; }

/* tables */
.bg-table { width: 100%; font-size: 12.5px; }
.bg-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted, #8a7d6c); }
.bg-table td { vertical-align: top; }
.bg-link { color: #b8530f; cursor: pointer; font-weight: 600; }
.bg-link:hover { text-decoration: underline; }
.bg-row:hover { background: var(--hover, #faf6f0); }
.bg-neg { color: #cf3c2e; font-weight: 600; }
.bg-pos { color: #2f7d32; }
.bg-foot td { font-weight: 700; border-top: 2px solid var(--line, #e6ddd2); background: #fbf7f1; }
.bg-rate { max-width: 96px; padding: 3px 6px; }

/* chips */
.bg-cat { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 10px; background: #f0e7da; color: #6a5535; border: 1px solid #e3d6c2; }
.bg-gate { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #efe9fb; color: #5b3aa6; border: 1px solid #d8caf2; }
.bg-status, .bg-appr { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.bg-status { background: #eef1f4; color: #4a5560; border-color: #dde3ea; }
.bg-st-active, .bg-ap-approved, .bg-st-approved, .bg-st-reviewed { background: #e8f4e8; color: #2f6f23; border-color: #c4e3c0; }
.bg-st-on-hold, .bg-ap-under-review, .bg-ap-submitted, .bg-ap-on-hold, .bg-st-uploaded { background: #fdf3e3; color: #8a5d12; border-color: #f0dcae; }
.bg-st-cancelled, .bg-ap-rejected, .bg-st-closed { background: #f1edf0; color: #6a5560; border-color: #ddd0d8; }
.bg-ap-rejected { background: #fdecea; color: #a4332a; border-color: #f1c4be; }
.bg-appr { background: #eef1f4; color: #4a5560; border-color: #dde3ea; }
.bg-ragpill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }
.bg-green { background: #e6f4e6; color: #245c27; } .bg-amber { background: #fbeecd; color: #8a5d12; } .bg-red { background: #fbdcd7; color: #8f2a22; } .bg-grey { background: #ece7df; color: #6a5f50; }

/* editor */
.bg-editor { display: flex; flex-direction: column; gap: 12px; min-width: min(760px, 92vw); }
.bg-ed-head { display: flex; align-items: center; gap: 10px; }
.bg-ed-id { font-size: 12px; color: #fff; background: #b8530f; padding: 3px 8px; border-radius: 6px; }
.bg-ed-title { flex: 1; font-size: 16px; font-weight: 700; border: 1px solid var(--line, #e6ddd2); border-radius: 8px; padding: 7px 10px; }
.bg-ed-tabs { display: flex; gap: 3px; flex-wrap: wrap; border-bottom: 1px solid var(--line, #e6ddd2); }
.bg-ed-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: var(--muted, #8a7d6c); cursor: pointer; }
.bg-ed-tab.on { color: #b8530f; border-bottom-color: #b8530f; }
.bg-ed-body { min-height: 120px; }
.bg-ed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.bg-ed-grid.bg-money { grid-template-columns: repeat(4, 1fr); }
.bg-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bg-f-full { grid-column: 1 / -1; }
.bg-f-l { font-size: 11px; font-weight: 600; color: var(--muted, #8a7d6c); }
.bg-sec-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #b8530f; margin: 12px 0 6px; }
.bg-derived { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; background: #fbf7f1; border: 1px solid var(--line, #eadfce); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }

/* phasing */
.bg-phase-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

/* evidence */
.bg-evidence { display: flex; flex-direction: column; gap: 7px; }
.bg-ev-row { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line, #eadfce); border-radius: 8px; padding: 7px 10px; }
.bg-ev-ico { font-size: 16px; }
.bg-ev-meta { flex: 1; min-width: 0; }
.bg-ev-st { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: #eef1f4; }
.bg-ev-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.bg-ev-add .fld[type="text"] { flex: 1; min-width: 180px; }

/* audit */
.bg-audit { display: flex; flex-direction: column; gap: 5px; max-height: 320px; overflow: auto; }
.bg-audit-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; border-bottom: 1px dashed var(--line, #eadfce); padding-bottom: 4px; }
.bg-audit-f { color: var(--text, #4a4036); }

/* workflow / approvals */
.bg-wf { display: flex; gap: 8px; flex-wrap: wrap; }

/* forecast explanation */
.bg-explain { }
.bg-defs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; }
.bg-def { font-size: 12px; }
.bg-def b { color: #b8530f; margin-right: 4px; }

/* reports */
.bg-report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bg-danger { color: #cf3c2e; }
.bg-import-errs { background: #fdecea; border: 1px solid #f1c4be; border-radius: 8px; padding: 8px 10px; margin: 8px 0; display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow: auto; }

/* responsive */
@media (max-width: 1100px) {
  .bg-kpis { grid-template-columns: repeat(3, 1fr); }
  .bg-dash-grid { grid-template-columns: repeat(2, 1fr); }
  .bg-ed-grid, .bg-ed-grid.bg-money { grid-template-columns: repeat(2, 1fr); }
  .bg-defs { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .bg-kpis { grid-template-columns: repeat(2, 1fr); }
  .bg-dash-grid { grid-template-columns: 1fr; }
  .bg-ed-grid, .bg-ed-grid.bg-money { grid-template-columns: 1fr; }
  .bg-editor { min-width: 0; }
  .bg-bar-row { grid-template-columns: 90px 1fr auto; }
}

/* print */
@media print {
  .bg-tabs, .bg-head-actions, .bg-filter, .bg-act-row, .bg-report-actions { display: none !important; }
}
