:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #dfded9;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7b7a75;
  --ejec: #2a78d6;
  --prog: #9ec5f4;
  --prog-mark: #0b0b0b;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --accent: #184f95;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #262624;
    --border: #383835;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --ejec: #3987e5;
    --prog: #184f95;
    --prog-mark: #ffffff;
    --accent: #86b6ef;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #262624;
  --border: #383835;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --text-3: #8f8e86;
  --ejec: #3987e5;
  --prog: #184f95;
  --prog-mark: #ffffff;
  --accent: #86b6ef;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 14px; margin: 0; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--text-2); font-size: 12px; }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.corte { text-align: right; display: flex; flex-direction: column; }
.corte strong { font-size: 16px; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
main { overflow: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }

main > * { flex: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.kpi .lbl { color: var(--text-2); font-size: 12px; }
.kpi .val { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { color: var(--text-3); font-size: 12px; }
.nota-kpi { margin-top: -8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.legend { display: flex; gap: 14px; color: var(--text-2); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.sw-ejec { background: var(--ejec); }
.sw-prog { width: 2px; height: 12px; border-radius: 0; background: var(--prog-mark); }

/* Avance por frente: barra de ejecutado + marca de programado */
.frentes { display: grid; grid-template-columns: minmax(140px, 240px) 1fr 150px; gap: 8px 12px; align-items: center; }
.frentes .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frentes .num { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-2); font-size: 12px; }
.pista { position: relative; height: 12px; background: var(--surface-2); border-radius: 4px; }
.pista .ej { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ejec); border-radius: 4px; }
.pista .pr { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--prog-mark); box-shadow: 0 0 0 1px var(--surface); }
.pista.mini { height: 8px; min-width: 70px; }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tabs { display: flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 6px; padding: 2px; margin-right: auto; }
.tab { border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 5px; cursor: pointer; font: inherit; }
.tab.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px;
}
input[type=search] { width: 210px; }
.btn { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }

.vista { overflow: auto; max-height: 62vh; border: 1px solid var(--border); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12px; z-index: 2; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.resumen td { font-weight: 600; }
tr.n3 td { background: var(--surface-2); }
tr:hover td { background: var(--surface-2); }
td.act { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.tog { display: inline-block; width: 16px; cursor: pointer; color: var(--text-2); user-select: none; }
.edt { color: var(--text-3); font-size: 12px; }

.estado { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.estado i { width: 14px; height: 14px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-style: normal; font-size: 9px; font-weight: 700; }
.estado.good i { background: var(--good); }
.estado.warning i { background: var(--warning); color: #0b0b0b; }
.estado.critical i { background: var(--critical); }
.pie { margin-top: 8px; }

/* Cronograma */
.gantt { display: grid; grid-template-columns: 300px max-content; font-size: 13px; width: max-content; }
.g-nom, .g-head-nom { position: sticky; left: 0; background: var(--surface); z-index: 3; border-right: 1px solid var(--border); padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-head-nom, .g-head { position: sticky; top: 0; background: var(--surface-2); z-index: 4; height: 40px; border-bottom: 1px solid var(--border); }
.g-head-nom { z-index: 5; background: var(--surface-2); line-height: 40px; color: var(--text-2); font-weight: 600; font-size: 12px; }
.g-head { display: flex; }
.g-mes { flex: none; border-left: 1px solid var(--border); color: var(--text-2); font-size: 11px; text-align: center; padding-top: 4px; line-height: 1.3; }
.g-mes b { display: block; color: var(--text); font-weight: 600; }
.g-nom, .g-fila { height: 26px; line-height: 26px; border-bottom: 1px solid var(--border); }
.g-nom.resumen { font-weight: 600; }
.g-fila { position: relative; background-image: linear-gradient(to right, var(--border) 1px, transparent 1px); }
.g-barra { position: absolute; top: 8px; height: 10px; background: var(--prog); border-radius: 4px; min-width: 3px; overflow: hidden; }
.g-barra .ej { height: 100%; background: var(--ejec); }
.g-barra.resumen { top: 10px; height: 6px; }
.g-hito { position: absolute; top: 8px; width: 10px; height: 10px; background: var(--text); transform: translateX(-5px) rotate(45deg); }
.g-corte { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--critical); z-index: 1; }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.mensajes { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 8px 10px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.usuario { align-self: flex-end; background: var(--accent); color: var(--surface); }
.msg.asistente { align-self: flex-start; background: var(--surface-2); }
.msg.error { align-self: stretch; max-width: 100%; border: 1px solid var(--critical); background: transparent; font-size: 13px; }
.sugerencias { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.sugerencias button { font: inherit; font-size: 12px; text-align: left; color: var(--text-2); background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; cursor: pointer; }
.sugerencias button:hover { background: var(--surface-2); }
.chat-form { display: flex; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; }

.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 8px; border-radius: 6px; font-size: 12px; white-space: pre; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

@media (max-width: 1000px) {
  body { height: auto; }
  .layout { grid-template-columns: 1fr; }
  .chat { border-left: 0; border-top: 1px solid var(--border); height: 70vh; }
  .frentes { grid-template-columns: 120px 1fr 110px; }
}

/* Edicion del % ejecutado */
input.ejec { width: 62px; text-align: right; font: inherit; font-variant-numeric: tabular-nums; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; }
input.ejec:focus { outline: 2px solid var(--ejec); outline-offset: 0; }
.aviso { position: fixed; left: 20px; bottom: 20px; z-index: 30; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.aviso.error { background: var(--critical); color: #fff; }

/* Historial y curva S */
.controles { display: contents; }
.controles[hidden] { display: none; }
.hist { padding: 12px; display: flex; flex-direction: column; gap: 16px; }
.hist h3 { font-size: 13px; margin: 0 0 6px; }
.hist table { width: auto; min-width: 50%; }
.curva { width: 100%; height: auto; display: block; }
.curva text { font: 11px "Segoe UI", system-ui, sans-serif; fill: var(--text-2); }
.curva .eje { stroke: var(--border); stroke-width: 1; }
.curva .prog { fill: none; stroke: var(--text-3); stroke-width: 2; }
.curva .ejec { fill: none; stroke: var(--ejec); stroke-width: 2; }
.curva .p-ejec { fill: var(--ejec); stroke: var(--surface); stroke-width: 2; }
.curva .p-prog { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.curva .corte { stroke: var(--critical); stroke-width: 1.5; stroke-dasharray: 4 3; }
.curva .rot { fill: var(--text); font-weight: 600; }
.curva .zona { fill: transparent; }
.sw-linea { width: 16px; height: 2px; border-radius: 0; background: var(--text-3); }
.sw-punto { width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text); }
.pos { color: var(--text); }

/* Alertas y proximas semanas */
.panel { padding: 12px; display: flex; flex-direction: column; gap: 18px; }
.panel h3 { font-size: 13px; margin: 0; }
.panel .expl { color: var(--text-2); font-size: 12px; margin: 2px 0 6px; }
.panel table { width: 100%; }
.panel td.act { max-width: 300px; }
.resumen-alertas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.resumen-alertas .kpi { background: var(--surface-2); border: 0; padding: 10px 12px; }
.resumen-alertas .kpi .val { font-size: 20px; }
tr.grupo td { background: var(--surface-2); font-weight: 600; }
.vacio { color: var(--text-2); font-size: 13px; padding: 6px 0; }

/* Chat: titulo, copiar */
.chat-titulo { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.btn.mini { font-size: 12px; padding: 3px 8px; }
.msg.asistente { position: relative; }
.msg .copiar { display: block; margin-top: 6px; font: inherit; font-size: 11px; color: var(--text-2); background: transparent; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

.aviso button { margin-left: 12px; font: inherit; font-weight: 600; color: inherit; background: transparent; border: 0; text-decoration: underline; cursor: pointer; padding: 0; }

/* Filtro por frente, orden de columnas y totales */
.frentes .nom button { font: inherit; color: inherit; background: transparent; border: 0; padding: 2px 4px; margin-left: -4px; border-radius: 4px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.frentes .nom button:hover { background: var(--surface-2); }
.frentes .nom button.on { background: var(--accent); color: var(--surface); font-weight: 600; }
.chip { font: inherit; font-size: 12px; color: var(--surface); background: var(--accent); border: 0; border-radius: 12px; padding: 4px 10px; cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th[data-col] { cursor: pointer; user-select: none; }
th[data-col]:hover { color: var(--text); }
tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }

/* Encabezado: botones */
.top-der { display: flex; align-items: center; gap: 10px; }

/* Observaciones */
.obs { font: inherit; font-size: 13px; line-height: 1; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 2px 5px; cursor: pointer; color: var(--text-3); }
.obs:hover { border-color: var(--border); color: var(--text); }
.obs.con { color: var(--accent); font-weight: 700; }
.dlg { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); padding: 16px; width: min(520px, 92vw); }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg h3 { margin: 0 0 10px; font-size: 14px; }
.dlg textarea { width: 100%; resize: vertical; }
.dlg-botones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* Cronograma: leyenda */
.g-leyenda { width: max-content; display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 10px; color: var(--text-2); font-size: 12px; border-bottom: 1px solid var(--border); position: sticky; left: 0; }
.g-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.sw-lb { background: var(--prog); }
.sw-hito { width: 8px; height: 8px; border-radius: 0; background: var(--text); transform: rotate(45deg); }
.sw-corte { width: 2px; height: 12px; border-radius: 0; background: var(--critical); }

/* Impresion: solo el contenido, sin chat ni controles */
@media print {
  :root:root:root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f0efec; --border: #cfcdc6; --text: #000; --text-2: #333; --text-3: #555; --ejec: #2a78d6; --prog: #9ec5f4; --prog-mark: #000; --accent: #184f95; }
  html, body { height: auto; }
  body { display: block; font-size: 11px; }
  .chat, .filtros .controles, .top-der .btn, .pie, .aviso, .tip { display: none !important; }
  .layout { display: block; }
  main { overflow: visible; padding: 0 8px; }
  .vista { max-height: none; overflow: visible; border: 0; }
  .card { border: 0; padding: 8px 0; break-inside: auto; }
  .tabs .tab:not(.on) { display: none; }
  th { position: static; }
  tfoot td { position: static; }
  tr { break-inside: avoid; }
  input.ejec { border: 0; width: 44px; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Actividades editadas en el tablero */
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); cursor: pointer; }
input.ejec.editada { border-color: var(--ejec); box-shadow: inset 3px 0 0 var(--ejec); }

/* Pantallas estrechas (celular) */
@media (max-width: 700px) {
  .top { flex-wrap: wrap; padding: 10px 12px; }
  .top h1 { font-size: 15px; }
  .top-der { width: 100%; justify-content: space-between; }
  main { padding: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px; }
  .kpi .val { font-size: 18px; }
  .frentes { grid-template-columns: 96px 1fr 92px; gap: 6px 8px; }
  .card-head { flex-wrap: wrap; gap: 6px; }
  .tabs { margin-right: 0; width: 100%; }
  input[type=search] { width: 100%; }
  .gantt { grid-template-columns: 150px max-content; }
  .vista { max-height: 70vh; }
  td.act, .panel td.act { max-width: 190px; }
  th, td { padding: 5px 6px; }
}

/* Resumen de alertas, resaltado de busqueda, comparacion de cortes */
.resumen-texto { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.resumen-texto ul { margin: 6px 0 8px; padding-left: 18px; }
.resumen-texto li { margin: 2px 0; }
mark { background: var(--warning); color: #0b0b0b; border-radius: 2px; padding: 0 1px; }
.comparar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }

/* Pantalla de entrada */
.login { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.login[hidden] { display: none; }
.login-caja { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.login-caja h2 { font-size: 18px; }
.login-caja label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.login-caja input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.login-error { color: var(--critical); font-size: 13px; }
@media print { .login { display: none !important; } }

/* Cuenta, roles y administracion */
.chip-alerta { font-size: 12px; font-weight: 600; color: #0b0b0b; background: var(--warning); border-radius: 12px; padding: 3px 10px; cursor: pointer; }
.chip-alerta[hidden] { display: none; }
.grupo-campos { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.grupo-campos legend { font-size: 12px; color: var(--text-2); padding: 0 4px; }
.grupo-campos label, .form-usuario label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.grupo-campos input, .form-usuario input, .form-usuario select, .admin select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.form-usuario { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; background: var(--surface-2); border-radius: 8px; padding: 12px; }
.clave-generada { display: flex; gap: 6px; }
.clave-generada input { flex: 1; min-width: 0; font-family: Consolas, monospace; }
.rol { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 2px 8px; background: var(--surface-2); color: var(--text-2); }
.rol.admin { background: var(--accent); color: var(--surface); }
.rol.editor { background: var(--ejec); color: #fff; }
.inactivo td { color: var(--text-3); }
.solo-lectura { display: inline-block; font-size: 12px; color: var(--text-2); border: 1px dashed var(--border); border-radius: 12px; padding: 2px 10px; }
.estado-copia { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.estado-copia b.ok { color: var(--good); }
.estado-copia b.mal { color: var(--critical); }
@media print { #cuenta, #alertaCopia { display: none !important; } }

/* Visor 3D */
.vista.modo-visor { max-height: none; height: 78vh; overflow: hidden; }
.vz { display: flex; flex-direction: column; height: 100%; }
.vz-barra { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.vz-barra button, .vz-barra select { font: inherit; font-size: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.vz-barra button:hover { border-color: var(--ejec); }
.vz-barra button.on { background: var(--ejec); border-color: var(--ejec); color: #fff; }
.vz-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.vz-buscar { flex: 1; min-width: 160px; font: inherit; font-size: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; }
.vz-cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px 1fr 290px; }
.vz-izq, .vz-der { overflow: auto; padding: 8px 10px; font-size: 12px; background: var(--surface); }
.vz-izq { border-right: 1px solid var(--border); }
.vz-der { border-left: 1px solid var(--border); }
.vz-izq h4, .vz-der h4 { font-size: 12px; margin: 8px 0 6px; color: var(--text); }
.vz-izq label { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; color: var(--text); }
.vz-izq label span { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; }
.vz-lienzo { position: relative; min-width: 0; min-height: 0; background: linear-gradient(#e9eef4, #f7f8fa); }
:root[data-theme="dark"] .vz-lienzo { background: linear-gradient(#1d232b, #121417); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vz-lienzo { background: linear-gradient(#1d232b, #121417); } }
.vz-lienzo.vz-cruz canvas { cursor: crosshair; }
.vz-ayuda { position: absolute; left: 8px; bottom: 6px; z-index: 2; font-size: 11px; color: var(--text-2); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 2px 6px; border-radius: 4px; pointer-events: none; }
.vz-cargando, .vz-vacio, .vz-nota { color: var(--text-2); font-size: 12px; }
.vz-fila { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.vz-fila span { color: var(--text-2); }
.vz-fila b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.vz-der details { margin: 6px 0; }
.vz-der summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.vz-error { padding: 16px; color: var(--critical); }
@media (max-width: 900px) {
  .vz-cuerpo { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .vz-izq { display: none; }
  .vz-der { max-height: 32vh; border-left: 0; border-top: 1px solid var(--border); }
}

/* Contratos, otrosi y actas */
.vista.modo-contratos { max-height: 78vh; }
.cont .c-barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.cont .c-barra input[type=search] { flex: 1; min-width: 220px; }
.cont .c-cabeza { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cont .c-cabeza h3 { font-size: 15px; margin: 0; }
.c-tabla { width: 100%; }
.c-tabla td { vertical-align: middle; }
.c-fila { cursor: pointer; }
.c-fila:hover td { background: var(--surface-2); }
.c-in { font: inherit; font-size: 12px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 3px 5px; width: 100%; }
.c-in:not(:disabled):hover { border-color: var(--border); }
.c-in:focus { border-color: var(--ejec); background: var(--surface); outline: none; }
.c-in.corto { width: 60px; } .c-in.mini { width: 54px; } .c-in.num { width: 110px; text-align: right; } .c-in.largo { min-width: 170px; }
.c-alerta { color: var(--critical); font-weight: 600; }
.c-seccion { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.c-seccion > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.c-seccion[open] > summary { margin-bottom: 8px; }
.form-usuario .c-ancho { grid-column: 1 / -1; }
.form-usuario textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.c-checks { display: flex; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.c-checks label { flex-direction: row !important; align-items: center; gap: 4px !important; color: var(--text) !important; }
.c-estado { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 2px 8px; background: var(--surface-2); color: var(--text-2); text-transform: capitalize; }
.c-estado.c-vigente, .c-estado.c-aprobada { background: var(--ejec); color: #fff; }
.c-estado.c-pagada, .c-estado.c-terminado { background: var(--good); color: #fff; }
.c-estado.c-suspendido { background: var(--warning); color: #0b0b0b; }
.c-estado.c-liquidado { background: var(--text-3); color: #fff; }
.c-liquidacion { max-width: 520px; margin-left: auto; font-size: 13px; }
.c-liquidacion .c-total { font-size: 15px; border-top: 2px solid var(--text); border-bottom: 2px solid var(--text); padding: 6px 0; }
.c-firmas { display: none; }
@media print {
  .vista.modo-contratos { max-height: none; overflow: visible; }
  .cont .c-barra, .cont .c-cabeza button, .resumen-alertas { display: none !important; }
  .c-in { border: 0 !important; padding: 0; }
  .c-firmas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 60px; }
  .c-firmas div { border-top: 1px solid #000; padding-top: 4px; text-align: center; font-size: 11px; }
  .c-seccion { border: 0; padding: 0; }
}

.c-secciones { margin-bottom: 4px; align-self: flex-start; }
.c-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warning); color: #0b0b0b; font-size: 11px; font-weight: 700; text-align: center; }
@media print { .c-secciones { display: none !important; } }

/* Control de obra, polizas, flujo de caja */
.c-sindatos td { color: var(--text-3); }
.c-estado.c-pol-vigente { background: var(--good); color: #fff; }
.c-estado.c-pol-por-vencer { background: var(--warning); color: #0b0b0b; }
.c-estado.c-pol-vencida { background: var(--critical); color: #fff; }
.c-estado.c-solicitado, .c-estado.c-radicada { background: var(--warning); color: #0b0b0b; }
.c-estado.c-aprobado { background: var(--ejec); color: #fff; }
.c-estado.c-atendido { background: var(--good); color: #fff; }
.c-estado.c-rechazado, .c-estado.c-anulada { background: var(--critical); color: #fff; }
.c-check-l span { display: inline-flex; align-items: center; gap: 6px; padding-top: 18px; color: var(--text); }
.fc .fc-ing { fill: #2a78d6; } .fc .fc-egr { fill: #eb6834; } .fc .fc-proy { opacity: .4; }
.fc-sw-ing { background: #2a78d6; } .fc-sw-egr { background: #eb6834; } .fc-sw-proy { background: var(--text-3); opacity: .4; }
.curva.fc { max-height: 260px; }
.curva.fc text { font-size: 9px; }

.msg.propuesta { align-self: stretch; max-width: 100%; border: 1px dashed var(--ejec); background: transparent; font-size: 13px; line-height: 1.5; }
