/* R16 project accounting & cost control – cost-control.css. Owner: CC – budgets, revisions, commitments, subcontracts & certificates, forecasts, earned value, dashboard. Every class in this file starts with "kc-". */

/* ---------- shared bits */
.kc-pad { padding-inline: 16px; padding-top: 12px; }
.kc-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; text-align: center; color: var(--muted); }
.kc-empty h2 { margin: 0; font-size: 17px; color: var(--text); }
.kc-empty p { margin: 0; max-width: 600px; }
.kc-empty .icon { color: var(--primary); }
.kc-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kc-name .muted { font-size: 12px; overflow-wrap: anywhere; }
.kc-strong { font-weight: 600; }
.kc-amber { color: var(--amber-fg); }
.kc-note { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.kc-hint { font-size: 11px; color: var(--amber-fg); }
.kc-section-title { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kc-tag { display: inline-block; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-fg); font-size: 11px;
    font-family: inherit; vertical-align: 1px; }
.kc-chips-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.kc-link { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; cursor: pointer; text-align: start; }
.kc-link:hover, .kc-link:focus-visible { text-decoration: underline; outline: none; }
.kc-list { list-style: none; margin: 0 0 10px; padding: 0; }
.kc-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--row-line); }
.kc-list li:last-child { border-bottom: 0; }
.kc-list .grow { flex: 1 1 140px; min-width: 0; }
.kc-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }
.kc-done td { color: var(--muted); }

/* filter chips (view / kind toggles) */
.kc-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.filters .kc-chips { margin-bottom: 0; align-self: flex-end; }
.kc-chips button { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
    cursor: pointer; }
.kc-chips button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.kc-chips button:disabled { opacity: .5; cursor: not-allowed; }

/* KPI tiles that act as links / filters */
a.kc-kpi-link { color: inherit; text-decoration: none; transition: border-color .15s; }
a.kc-kpi-link:hover, a.kc-kpi-link:focus-visible { border-color: var(--primary); outline: none; }
.kc-kpi-btn { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.kc-kpi-btn:hover .kpi-label, .kc-kpi-btn:focus-visible .kpi-label { color: var(--primary); }
.kc-kpi-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: var(--radius-sm); }
.kc-inline-edit { display: flex; align-items: center; gap: 8px; }
.kc-inline-edit input { width: 100%; max-width: 200px; font-family: var(--mono); font-size: 18px; }

/* banners */
.kc-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--blue-bg); color: var(--blue-fg); margin-bottom: 16px; }
.kc-banner.warn { background: var(--amber-bg); color: var(--amber-fg); }
.kc-banner.bad { background: var(--red-bg); color: var(--red-fg); }
.kc-banner.good { background: var(--green-bg); color: var(--green-fg); }
.kc-banner > .grow { flex: 1 1 260px; }

/* attention list (dashboard) */
.kc-attention ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.kc-attention a { display: flex; align-items: center; gap: 10px; padding: 8px 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--row-line); }
.kc-attention a span:nth-child(2) { flex: 1; }
.kc-attention a:hover, .kc-attention a:focus-visible { color: var(--primary); outline: none; }

/* label / amount pairs */
.kc-money-rows { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; font-size: 14px; margin-bottom: 8px; }
.kc-money-rows .num { font-family: var(--mono); }

/* used-of-budget meter */
.kc-meter { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; }
.kc-meter-track { position: relative; flex: 1; min-width: 60px; height: 8px; border-radius: 4px; background: var(--gray-bg); overflow: hidden; }
.kc-meter-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 4px; background: var(--green-fg); }
.kc-meter.warn .kc-meter-fill { background: var(--amber-fg); }
.kc-meter.bad .kc-meter-fill { background: var(--red-fg); }
.kc-meter.none .kc-meter-fill { background: transparent; }
.kc-meter-num { font-family: var(--mono); font-size: 12px; min-width: 44px; text-align: end; }
.kc-meter.bad .kc-meter-num { color: var(--red-fg); font-weight: 600; }
.kc-meter.none .kc-meter-num { color: var(--muted); font-family: inherit; }

/* budget-check warnings */
.kc-warnings { margin-bottom: 16px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--amber-bg); color: var(--amber-fg); }
.kc-warnings.bad { background: var(--red-bg); color: var(--red-fg); }
.kc-warnings-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; }
.kc-warnings-head .muted { color: inherit; opacity: .8; }
.kc-warnings ul { list-style: none; margin: 0; padding: 0; }
.kc-warnings li { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.kc-warn-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; color: var(--text); }
.kc-warn-figs { overflow-wrap: anywhere; }

/* timeline */
.kc-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.kc-timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 14px; }
.kc-timeline li::before { content: ""; position: absolute; inset-inline-start: 5px; inset-block: 14px 0; width: 2px; background: var(--row-line); }
.kc-timeline li:last-child::before { display: none; }
.kc-tl-dot { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--gray-fg); box-shadow: 0 0 0 3px var(--surface); position: relative; z-index: 1; }
.kc-tl-good .kc-tl-dot { background: var(--green-fg); }
.kc-tl-bad .kc-tl-dot { background: var(--red-fg); }
.kc-tl-info .kc-tl-dot { background: var(--blue-fg); }
.kc-tl-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.kc-tl-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }

/* editable grids (budget lines, revision lines, subcontract lines, certificates, forecasts) */
.kc-cell { width: 110px; min-width: 80px; padding: 4px 6px; text-align: end; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.kc-cell.kc-pct { width: 80px; }
.kc-unit { width: 70px; }
.kc-budget-grid th.kc-month { white-space: nowrap; }
.kc-budget-grid td, .kc-budget-grid th { vertical-align: middle; }
.kc-budget-grid tfoot th, .kc-lines tfoot th { font-family: var(--mono); }
.kc-wbs { display: inline-block; padding-inline-start: calc(var(--lvl, 0) * 14px); white-space: nowrap; }
.kc-row-tools { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.kc-lines select { max-width: 220px; }
.kc-lines input:not(.kc-cell):not(.kc-unit) { min-width: 180px; }
.kc-add-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 12px 16px; border-top: 1px solid var(--row-line); }
.kc-add-row .field { min-width: 200px; flex: 0 1 280px; }
.kc-grid-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 12px; }
.kc-grid-tools .field.compact input { width: 150px; }

/* earned value */
.kc-evm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.kc-curve { margin: 0; }
.kc-curve svg { width: 100%; height: auto; max-height: 300px; display: block; }
.kc-curve-grid { stroke: var(--row-line); stroke-width: 1; }
.kc-curve-axis { fill: var(--muted); font-size: 11px; }
.kc-curve-bac { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 4; }
.kc-curve polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.kc-curve-pv { stroke: var(--series-1); stroke-dasharray: 2 4; }
.kc-curve-ev { stroke: var(--series-1); }
.kc-curve-ac { stroke: var(--series-2); }
.kc-curve-dot { stroke: var(--surface); stroke-width: 1.5; }
.kc-curve-dot.ev { fill: var(--series-1); }
.kc-curve-dot.ac { fill: var(--series-2); }
.kc-curve figcaption { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.kc-sw { display: inline-block; width: 18px; height: 0; margin-inline-end: 6px; vertical-align: middle; border-top: 3px solid var(--series-1); }
.kc-sw.pv { border-top-style: dotted; }
.kc-sw.ac { border-top-color: var(--series-2); }
.kc-sw.bac { border-top: 2px dashed var(--muted); }

/* phone width */
@media (max-width: 640px) {
    .kc-cell { width: 90px; }
    .kc-add-row .field { flex: 1 1 100%; }
    .kc-meter { min-width: 90px; }
    .kc-attention ul { grid-template-columns: 1fr; }
}

@media print {
    .kc-no-print { display: none !important; }
    .kc-cell { border: 0; background: none; width: auto; }
}
