:root { --sidebar-w: 250px; --fs-app: .875rem; --fs-aux: .8125rem; }
body { background: #f4f6f9; }

/* ===== Tipografía uniforme =====
   Un solo tamaño para todo dato: celdas de tablas, encabezados de columna, etiquetas, campos,
   listas desplegables, botones y datos de detalle. Solo los títulos de página son más grandes
   y los textos de ayuda/auditoría/paginación un poco más chicos. */
body, .app-content, .table, .form-control, .form-control-sm, .form-select, .form-select-sm,
.form-label, .form-check-label, .input-group-text, .btn, .btn-sm, .dropdown-menu, .list-group-item,
.offcanvas-body, .modal-body, .alert, .card-header, .card-body, .card-footer { font-size: var(--fs-app); }
.form-control-sm, .form-select-sm { min-height: calc(1.5em + .5rem + 2px); }
.table > :not(caption) > * > * { font-size: var(--fs-app); }
.table .small, .table small, td .small { font-size: inherit; }
.small, small, .form-text, .invalid-feedback { font-size: var(--fs-aux); }
.badge { font-size: .75rem; font-weight: 600; }
.badge.fs-6 { font-size: var(--fs-app) !important; }
.app-nav-pendiente { opacity: .45; cursor: default; }
.app-nav-pendiente:hover { background: none; color: #cbd5e1; }
.app-nav-link > span:not(.app-nav-badge) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-nav-badge { color: #94a3b8; }
.app { display: flex; min-height: 100vh; }
.app-sidebar { width: var(--sidebar-w); background: #1f2937; color: #cbd5e1; flex-shrink: 0; overflow-y: auto; position: sticky; top: 0; height: 100vh; }
.app-brand { font-weight: 700; font-size: 1.15rem; color: #fff; padding: 1rem 1.25rem; border-bottom: 1px solid #374151; }
.app-nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; padding: 1rem 1.25rem .35rem; }
.app-nav-link { display: flex; gap: .6rem; align-items: center; padding: .45rem 1.25rem; color: #cbd5e1; text-decoration: none; font-size: var(--fs-app); }
.app-nav-link:hover { background: #374151; color: #fff; }
.app-nav-link.active { background: #2563eb; color: #fff; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: #fff; border-bottom: 1px solid #e5e7eb; }
.app-content { padding: 1.5rem; }
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { width: 100%; max-width: 400px; margin: 1rem; }
.table th { color: #4b5563; font-weight: 600; white-space: nowrap; }
/* Columna de descripción larga (nombre de insumo, concepto): ancho mínimo para que no se vuelva una tira */
.col-texto { min-width: 18rem; }
.col-clasif { min-width: 13rem; }
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; left: calc(-1 * var(--sidebar-w)); z-index: 1040; transition: left .2s; }
  .app-sidebar.abierto { left: 0; }
  .app-content { padding: 1rem; }
}
.form-angosto { max-width: 720px; }
.form-ancho { max-width: 1100px; }
.bitacora-json { max-width: 520px; max-height: 300px; overflow: auto; white-space: pre-wrap; }
.traza { max-height: 420px; overflow: auto; white-space: pre-wrap; font-size: var(--fs-aux); }
.permisos-tabla td, .permisos-tabla th { text-align: center; }
.permisos-tabla td:first-child, .permisos-tabla th:first-child { text-align: left; }
.tabla-partidas td { white-space: nowrap; }
.tabla-partidas td:nth-child(2) { white-space: normal; min-width: 260px; }
.tabla-partidas tbody#partidas tr { cursor: pointer; }
.offcanvas-partida { --bs-offcanvas-width: 560px; }
.offcanvas-partida .sugerencias { position: absolute; z-index: 1060; left: 0; right: 0; max-height: 280px; overflow: auto; box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); }
.totales th { font-weight: 500; padding-right: 1.5rem; }
.totales td { min-width: 150px; }
.th-boton .btn, th .btn[data-alta] { padding: 0 .35rem; line-height: 1.2; }
.oc-dato { font-size: var(--fs-app); color: #6b7280; }
.dA-caja { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .375rem; padding: .35rem .6rem; height: 100%; }
.dA-destacado { background: #fff3cd; border-color: #ffe69c; }

/* Subcontratos */
.ancho-totales { max-width: 420px; }
.th-ancho { min-width: 16rem; }
.th-importe { width: 12rem; }

/* Reportes agrupados (encabezado de grupo con su suma, como el "Group aggregate" de AppSheet) */
.tabla-reporte .rep-g td { font-weight: 600; }
.tabla-reporte .rep-g0 td { background: var(--bs-secondary-bg); }
.tabla-reporte .rep-g1 td:first-child { padding-left: 1.25rem; }
.tabla-reporte .rep-g2 td:first-child { padding-left: 2.5rem; }
.tabla-reporte .rep-det { padding-left: 3.75rem !important; }
.tabla-reporte .rep-n { font-weight: 400; color: var(--bs-secondary-color); }

/* ---- Barras de avance y estados (presupuesto / dashboard) ---- */
:root {
  --st-ok: #0ca30c; --st-warn: #fab219; --st-serious: #ec835a; --st-crit: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
.barra { display: block; width: 100%; height: 10px; }
.barra-lg { height: 14px; }
.barra-fondo { fill: #ebeae6; }
.barra-valor.barra-ok { fill: var(--s1); }
.barra-valor.barra-warn { fill: var(--st-warn); }
.barra-valor.barra-crit { fill: var(--st-crit); }
.barra-marca { fill: #0b0b0b; }
.estado { font-weight: 600; white-space: nowrap; }
.estado-ok { color: #0a7d0a; } .estado-warn { color: #9a6500; } .estado-crit { color: var(--st-crit); } .estado-neutro { color: var(--bs-secondary-color); }
.pres-input { text-align: right; }
.pres-grupo td { background: var(--bs-secondary-bg); font-weight: 600; }

/* ---- Dashboard ---- */
.kpi { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .75rem; padding: 1rem 1.1rem; height: 100%; }
.kpi-destacado { border-color: #b7d3f6; box-shadow: inset 0 3px 0 var(--s1); }
.kpi-t { color: var(--bs-secondary-color); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; font-size: .75rem; }
.kpi-t .bi { margin-right: .25rem; }
.kpi-v { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.kpi-chico .kpi-v { font-size: 1.25rem; }
.kpi-s { color: var(--bs-secondary-color); margin-top: .15rem; }
.kpi-s b { color: var(--bs-body-color); }
.grafica { position: relative; height: 260px; }
.grafica-alta { height: 320px; }
.obra-avance + .obra-avance, .etapa-fila + .etapa-fila { margin-top: .9rem; }
.obra-avance .barra, .etapa-fila .barra { margin: .3rem 0 .15rem; }
.leyenda-marca { width: 4px; height: 12px; vertical-align: -1px; }
.leyenda-marca rect { fill: #0b0b0b; }
.col-barra { min-width: 180px; }
.dash-filtros .form-select { min-width: 200px; }
.dash-seccion { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: .75rem; color: var(--bs-secondary-color); margin: 0 0 .4rem; }
.dash-seccion span { font-weight: 400; text-transform: none; letter-spacing: 0; }
.dash-periodo { background: #eef4fc; border: 1px solid #cde2fb; border-radius: .5rem; padding: .55rem .9rem; }
.dash-periodo .bi { color: var(--s1); }
.dash-filtros input[type=date] { min-width: 150px; }
.tabla-reporte .rep-g3 td:first-child { padding-left: 3.75rem; font-weight: 600; }
.tabla-reporte .rep-g4 td:first-child { padding-left: 5rem; font-weight: 600; }
.tabla-reporte .rep-g3 td, .tabla-reporte .rep-g4 td { font-weight: 500; }
.tabla-reporte.prof-5 .rep-det, .tabla-reporte.prof-4 .rep-det { padding-left: 6.25rem !important; }
.config-corto { max-width: 140px; }
.config-logo { border: 1px dashed var(--bs-border-color); border-radius: .5rem; padding: .75rem; background: #fff; display: inline-block; }
.config-logo img { max-width: 220px; max-height: 110px; display: block; }

/* Comentario opcional de una partida de OC (debajo del insumo; mismo tamaño de letra que los datos) */
.comentario-partida { font-style: italic; color: var(--bs-secondary-color); white-space: normal; }
.aviso-padre { font-size: var(--fs-aux); margin-top: .25rem; }
