/* app.css */
:root {
  --tinta: #1c1c1f; --verde: #2f7266; --verde-osc: #25594f; --verde-claro: #3a9c6e; --menta: #bfe8d4; --menta-suave: #e3f1ea;
  --fondo: #f0f1f2; --papel: #fff; --linea: #d9dbde; --linea-suave: #eceef0; --gris: #5b6168; --gris-2: #4b5056;
  --rojo: #a3442f; --rojo-fondo: #f6e3e1; --ambar: #6b4e12; --ambar-fondo: #fbf1dc;
  --lateral: #1c1c1f; --lateral-2: #2a2a2e; --lateral-linea: #313136; --lateral-txt: #e8e8ea; --lateral-tenue: #8a939c;
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { font: 14px/1.4 'Barlow', system-ui, sans-serif; color: var(--tinta); background: var(--fondo); }
a { color: var(--verde); } a:hover { color: var(--verde-osc); }
h1, h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; }
input, select, button, textarea { font: inherit; color: inherit; }
input, select { height: 36px; border: 1px solid #c9ccd0; border-radius: 4px; padding: 0 10px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(47, 114, 102, .15); }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.tenue { color: var(--gris); } .fuerte { font-weight: 600; } .rojo { color: var(--rojo); } .verde { color: var(--verde); } .acento { color: var(--verde); font-weight: 600; }
.der { text-align: right; justify-content: flex-end; } .num { font-variant-numeric: tabular-nums; }
.romper { word-break: break-all; } .crece { flex: 1; min-width: 0; }
.sub { color: var(--gris); font-size: 13px; margin: 2px 0 0; text-wrap: pretty; }
.rotulo { font-family: 'Space Grotesk', sans-serif; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--gris); }
.cargando { display: grid; place-items: center; height: 100%; color: var(--gris); }

.btn { height: 36px; padding: 0 14px; border: 1px solid #c9ccd0; background: #fff; border-radius: 4px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--verde); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #fff; } .btn.primario:hover { background: var(--verde-osc); }
.btn.enlace { border: none; background: none; color: var(--verde); padding: 0; }
.btn.chico { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.peligro { color: var(--rojo); border-color: #e3b9b0; }
.btn.oscuro { background: transparent; border-color: #38383d; color: var(--lateral-txt); height: 30px; } .btn.oscuro:hover { background: var(--lateral-2); }

.insignia { display: inline-flex; height: 22px; align-items: center; padding: 0 8px; border-radius: 3px; font-size: 12px; font-weight: 600; background: #eef0f2; color: var(--gris-2); }
.est-activa, .pres-adjudicado { background: var(--menta-suave); color: var(--verde-osc); }
.est-prueba, .pres-en_revision { background: var(--ambar-fondo); color: var(--ambar); }
.est-suspendida { background: var(--rojo-fondo); color: #8a2a1f; }
.pres-oferta { background: #e3f1ea; color: var(--verde); }
.pres-cerrado { background: #efe9e1; color: #7a5b2e; }

.aviso-error, .aviso-ok, .aviso-alerta { padding: 10px 12px; border-radius: 4px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.aviso-error { background: var(--rojo-fondo); color: #8a2a1f; } .aviso-ok { background: var(--menta-suave); color: var(--verde-osc); } .aviso-alerta { background: var(--ambar-fondo); color: var(--ambar); }

.marca { display: flex; align-items: center; gap: 10px; }
.marca-txt { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--lateral-txt); }
.marca-txt span { color: var(--verde-claro); }

/* Acceso */
.acceso { min-height: 100%; display: flex; flex-wrap: wrap; }
.acceso-lado { flex: 1 1 360px; min-height: 240px; background: var(--lateral); color: var(--lateral-txt); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.acceso-titulo { display: flex; flex-direction: column; gap: 14px; }
.acceso-titulo h1 { font-size: 34px; color: #fff; line-height: 1; }
.acceso-titulo p { color: #b4b4ba; max-width: 420px; margin: 0; font-size: 15px; text-wrap: pretty; }
.acceso-lado small { color: var(--lateral-tenue); }
.acceso-form { flex: 1 1 460px; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.acceso-col { width: 460px; max-width: 100%; }
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--gris); font-weight: 600; }
.campo input, .campo select { font-size: 14px; font-weight: 400; color: var(--tinta); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; } .span2 { grid-column: 1 / -1; }
.opciones { display: flex; flex-direction: column; gap: 6px; }
.opcion { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--linea); background: #fff; border-radius: 4px; text-align: left; cursor: pointer; }
.opcion small { color: var(--gris); } .opcion.on { border-color: var(--verde); background: var(--menta-suave); }
.acciones { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; } .acciones.entre, .entre { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fila-empresa { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--linea); background: #fff; border-radius: 4px; text-align: left; cursor: pointer; }
.fila-empresa:hover { border-color: var(--verde); background: #f5f9f7; }
.fila-empresa > span:first-child { display: flex; flex-direction: column; } .fila-empresa small { color: var(--gris); }

/* Estructura */
.shell { height: 100%; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.lateral { background: var(--lateral); color: var(--lateral-txt); display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; overflow: auto; }
.lateral-marca { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.lateral-marca .marca-txt { display: none; }
.lateral-marca > div { display: flex; flex-direction: column; min-width: 0; }
.lateral-marca b { font-family: 'Space Grotesk', sans-serif; color: #fff; font-size: 17px; }
.lateral-marca small { color: var(--lateral-tenue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: none; border-radius: 4px; background: transparent; color: #c8c8cc; font-weight: 600; cursor: pointer; text-align: left; }
.lateral nav button:hover { background: var(--lateral-2); } .lateral nav button.on { background: #38383d; color: #fff; box-shadow: inset 3px 0 0 var(--verde-claro); }
.lateral nav small { font-size: 11px; color: var(--lateral-tenue); font-weight: 400; }
.lateral-bloque { padding: 14px 10px; border-top: 1px solid var(--lateral-linea); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.lateral-bloque:first-of-type { margin-top: auto; }
.lateral-bloque .rotulo { color: var(--lateral-tenue); }
.lateral-bloque select { height: 30px; background: var(--lateral-2); color: #fff; border-color: #38383d; }
.lateral-bloque .usuario { color: #fff; font-size: 13px; margin-top: 4px; } .lateral-bloque small { color: var(--lateral-tenue); } .lateral-bloque .tenue { font-size: 11px; }
.ind { display: flex; justify-content: space-between; } .ind b { color: #fff; font-variant-numeric: tabular-nums; }
.principal { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.barra { padding: 12px 20px; border-bottom: 1px solid var(--linea); background: #fbfbfb; }
.rotulo.acento { color: var(--verde); }
.principal > .aviso-alerta { border-radius: 0; }
.contenido { flex: 1; min-height: 0; overflow: auto; }
.pagina { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.pagina-cab { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }
.editor { height: 100%; display: flex; flex-direction: column; } .editor .volver { align-self: flex-start; margin: 10px 16px 0; } .editor .tg { flex: 1; min-height: 0; }
.segmentado { display: flex; border: 1px solid #c9ccd0; border-radius: 4px; overflow: hidden; }
.segmentado button { height: 32px; padding: 0 14px; border: none; border-right: 1px solid #e1e3e6; background: #fff; font-weight: 600; cursor: pointer; }
.segmentado button:last-child { border-right: none; } .segmentado button.on { background: var(--tinta); color: #fff; }

/* Tablas y listas */
.tabla { background: #fff; border: 1px solid var(--linea); border-radius: 4px; overflow-x: auto; }
.tabla-cab, .tabla-fila { display: grid; align-items: center; }
.tabla-cab { height: 34px; background: #e9e9ea; border-bottom: 1px solid #c9ccd0; font-family: 'Space Grotesk', sans-serif; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--gris-2); font-weight: 600; }
.tabla-cab > span, .tabla-fila > span { padding: 4px 12px; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tabla-fila { min-height: 42px; border-top: 1px solid var(--linea-suave); cursor: pointer; } .tabla-fila:hover { background: #f5f9f7; } .tabla-fila.sin-click { cursor: default; } .tabla-fila.sin-click:hover { background: none; }
.tabla-fila select { height: 28px; width: 100%; }
.col-pres { grid-template-columns: 120px minmax(200px, 1.4fr) minmax(160px, 1fr) 120px 100px 150px 100px; min-width: 950px; }
.col-usr { grid-template-columns: minmax(180px, 1fr) minmax(200px, 1fr) 190px 150px 90px; min-width: 820px; }
.col-plat { grid-template-columns: minmax(220px, 1fr) 120px 130px 140px 80px 80px 140px; min-width: 920px; }
.vacio { padding: 20px; color: var(--gris); }
.columnas { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.columnas > .tarjeta { flex: 1 1 340px; } .columnas > .tarjeta.ancha { flex: 1.5 1 460px; }
.item-lista { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--linea-suave); flex-wrap: wrap; }
.item-lista > span:first-child { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.item-lista small { font-size: 12px; } .item-lista input.corto { width: 140px; height: 30px; }
.fila-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .fila-form input:not([type=file]) { flex: 1 1 220px; }
.grande { font-family: 'Space Grotesk', sans-serif; font-size: 20px; }
.uso > div:first-child { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.uso-barra { height: 6px; background: var(--linea-suave); border-radius: 3px; overflow: hidden; } .uso-barra > div { height: 100%; }
.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--linea); border: 1px solid var(--linea); border-radius: 4px; overflow: hidden; }
.metricas > div { background: #fff; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; } .metricas b { font-size: 20px; font-variant-numeric: tabular-nums; }
.modal-fondo { position: fixed; inset: 0; background: rgba(28, 28, 31, .45); display: grid; place-items: center; padding: 20px; z-index: 40; }
.modal { width: 560px; max-width: 100%; background: #fff; border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }

/* Editor */
.editor { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.editor-cab { padding: 12px 20px 0; background: #f2f2f3; border-bottom: 1px solid var(--linea); display: flex; flex-direction: column; gap: 10px; }
.editor-cab .btn.chico { align-self: flex-start; }
.editor-cab h2 { font-size: 22px; }
.editor-cuerpo { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.editor-cuerpo > .tg { flex: 1; min-height: 480px; }
.pestanas { display: flex; gap: 4px; flex-wrap: wrap; }
.pestanas button { height: 36px; padding: 0 14px; border: none; border-bottom: 2px solid transparent; background: none; font-weight: 600; color: var(--gris-2); cursor: pointer; }
.pestanas button.on { border-bottom-color: var(--verde); color: var(--tinta); }
.col-venta { grid-template-columns: 90px minmax(220px, 1fr) 50px 100px 120px 140px 140px 130px; min-width: 990px; }
.col-edp { grid-template-columns: 80px minmax(200px, 1fr) 44px 90px 110px 90px 150px 80px 120px; min-width: 1000px; }
.col-ctl { grid-template-columns: 90px minmax(200px, 1fr) 80px 140px 140px 140px 140px; min-width: 940px; }
.col-hh { grid-template-columns: minmax(160px, 1fr) 120px 120px 120px 120px 110px; min-width: 760px; }
.col-mat { grid-template-columns: 130px minmax(200px, 1fr) 120px 150px 110px 110px 130px; min-width: 960px; }
.cap-fila { background: #e8f2ed; }
.num-input { width: 100%; height: 28px; text-align: right; font-variant-numeric: tabular-nums; padding: 0 6px; border-color: transparent; border-bottom: 1px dashed #8fbfaa; background: transparent; border-radius: 3px; }
.num-input:hover { border-color: #c9ccd0; background: #fff; } .num-input:focus { background: #fff; }
.num-input.manual { font-weight: 700; color: var(--verde-osc); }
.fila-form.apretada { flex-wrap: nowrap; gap: 4px; width: 100%; } .fila-form.apretada input { flex: 1; }
.contrato { margin-left: auto; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--gris); }
.contrato label { display: flex; align-items: center; gap: 4px; } .contrato input { width: 56px; height: 28px; text-align: right; }
.tarjeta.sin-pad { padding: 0; gap: 0; overflow: hidden; } .pad { padding: 12px 16px; }
.tabla.sin-borde { border: none; border-radius: 0; border-top: 1px solid var(--linea); }
.resumen { position: sticky; top: 0; flex: 0 1 320px !important; gap: 0; }
.resumen > b { margin-bottom: 8px; }
.linea { padding: 7px 0; border-top: 1px solid var(--linea-suave); font-size: 13px; }
.total-oscuro { margin-top: 10px; background: var(--tinta); color: #fff; border-radius: 4px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.total-oscuro .rotulo { color: var(--menta); } .total-oscuro b { font-size: 20px; font-variant-numeric: tabular-nums; } .total-oscuro small { color: #b4b4ba; }
.metricas small { font-size: 12px; }

@media (max-width: 760px) { .shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .lateral { max-height: 40vh; } .acceso-lado { padding: 28px; } }

/* presupuesto.css */
.tg { display: flex; flex-direction: column; height: 100%; font: 13px/1.3 "IBM Plex Sans", system-ui, sans-serif; color: #1c2430; background: #fbfbfa; }
.tg-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #e3e5e8; }
.tg-top h1 { font-size: 16px; margin: 0; }
.tg-top small { color: #5d6672; }
.tg-top button { height: 32px; padding: 0 14px; border: 1px solid #1c2430; background: #1c2430; color: #fff; border-radius: 4px; cursor: pointer; }
.tg-head { background: #eef0f2; border-bottom: 1px solid #d6d9dd; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #4a5260; }
.tg-head > span, .fila > span { padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tg-head > span { height: 30px; }
.tg-body { flex: 1; min-height: 0; }
.num { justify-content: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.fila { border-bottom: 1px solid #eceef0; }
.fila.cap { font-weight: 600; cursor: pointer; background: #f3f5f7; }
.fila.cap.nivel-0 { background: #e4e9ef; }
.fila.par:hover, .fila.par.activa { background: #fff8e8; }
.item { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: #5d6672; }
.chev { display: inline-block; width: 14px; transition: transform .15s; color: #8a929c; }
.chev.open { transform: rotate(90deg); }
.celda-edit { border: 1px solid transparent; background: transparent; text-align: right; font: inherit; padding: 2px 4px; border-radius: 3px; }
.celda-edit:hover { border-color: #d6d9dd; background: #fff; }
.celda-edit:focus { outline: none; border-color: #2f6fd6; background: #fff; }
.panel-apu { background: #fbfaf6; border-bottom: 1px solid #e6dcc2; padding-top: 10px; padding-bottom: 10px; padding-right: 16px; box-sizing: border-box; overflow: hidden; box-shadow: inset 3px 0 0 #e6dcc2; }
.apu-head, .apu-linea, .skel-row, .apu-grupo-tit { display: grid; align-items: center; column-gap: 12px; padding-left: 10px; }
.apu-head { height: 30px; font-size: 11px; letter-spacing: .04em; color: #7a6a44; text-transform: uppercase; font-weight: 600; }
.apu-head .num, .apu-linea .num, .apu-grupo-tit .num { text-align: right; }
.apu-linea { height: 34px; border-bottom: 1px solid #f1ecdf; }
.apu-linea:hover { background: #fff; }
.apu-linea > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apu-linea .desc { color: var(--tinta); }
.apu-linea .ud { color: var(--gris); }
.apu-grupo-tit { height: 30px; margin-top: 6px; font-size: 12px; font-weight: 600; color: #4b4030; background: #f3eddd; border-radius: 3px; }
.apu-grupo-tit .tit { grid-column: 1 / 7; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.apu-grupo-tit .tit small { font-weight: 600; color: #8a7a55; background: #fff; border-radius: 9px; padding: 0 7px; line-height: 18px; letter-spacing: 0; }
.apu-grupo-tit .tot { grid-column: 7; font-size: 13px; }
.t-MAT .apu-grupo-tit { box-shadow: inset 3px 0 #b58a2e; } .t-MO .apu-grupo-tit { box-shadow: inset 3px 0 #2f7266; }
.t-EQ .apu-grupo-tit { box-shadow: inset 3px 0 #4f6fa8; } .t-SC .apu-grupo-tit { box-shadow: inset 3px 0 #8a5a9c; }
.apu-tipo-c { display: flex; }
.apu-tipo { width: 100%; height: 26px; font-size: 12px; padding: 0 6px; border-color: transparent; background-color: transparent; color: var(--gris-2); cursor: pointer; }
.apu-linea:hover .apu-tipo, .apu-tipo:focus { border-color: #d6d9dd; background-color: #fff; }
.apu-tipo.reclas { border-color: #b9d9cb; background-color: var(--menta-suave); color: var(--verde-osc); font-weight: 600; }
.skel-row { height: 34px; }
.skel { height: 10px; border-radius: 3px; background: linear-gradient(90deg, #efe7d4 25%, #f8f3e6 50%, #efe7d4 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.apu-error { padding: 8px 10px; color: var(--rojo); font-size: 13px; }

.tg-totales { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: #d6d9dd; border-top: 1px solid #d6d9dd; }
.tg-totales > div { background: #fff; padding: 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.tg-totales .total { background: #1c2430; color: #fff; }
.tg-error { background: #fde8e8; color: #8a1c1c; padding: 6px 16px; }

/* Agregar insumos al APU */
.apu-agregar { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; height: 56px; margin-top: 8px; padding: 0 0 0 10px; border-top: 1px dashed #d9cfb4; }
.apu-agregar input, .apu-agregar select { height: 32px; font-size: 13px; }
.apu-buscar { width: 240px; flex: none; }
.apu-sel { flex: 1 1 0; min-width: 120px; }
.apu-rend-l { font-size: 12px; color: var(--gris); flex: none; }
.apu-rend { width: 64px; flex: none; text-align: right; }
.apu-agregar .btn { flex: none; height: 32px; }
.apu-err { color: #a3442f; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.apu-quitar { border: none; background: none; color: #a3442f; cursor: pointer; font-size: 12px; opacity: .35; padding: 0; }
.apu-linea:hover .apu-quitar { opacity: .7; } .apu-quitar:hover { opacity: 1; }

/* Maestros */
.col-art { grid-template-columns: 120px minmax(220px, 1fr) 56px 160px 120px 110px 56px 200px; min-width: 1060px; }
.col-pm { grid-template-columns: 100px minmax(200px, 1fr) 56px 150px 56px; min-width: 600px; }
.col-pml { grid-template-columns: 100px minmax(160px, 1fr) 50px 100px 100px 100px 28px; min-width: 660px; }
.tabla-fila.sel { background: #e8f2ed; }
.segmentado { display: inline-flex; border: 1px solid var(--linea); border-radius: 4px; overflow: hidden; }
.segmentado button { height: 30px; padding: 0 12px; border: none; border-right: 1px solid var(--linea); background: #fff; font-weight: 600; cursor: pointer; }
.segmentado button:last-child { border-right: none; }
.segmentado button.on { background: var(--tinta); color: #fff; }

/* Asistente IA */
.asis-btn { border-color: var(--verde); color: var(--verde); font-weight: 600; }
.asis-btn.on { background: var(--verde); color: #fff; }
.modal.asis { width: 980px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.asis-inst { width: 100%; border: 1px solid var(--linea); border-radius: 4px; padding: 8px 10px; font: inherit; resize: vertical; }
.asis-cargando { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.asis-cargando .skel { height: 14px; width: 100%; }
.asis-res { display: flex; flex-direction: column; gap: 12px; }
.asis-resumen { margin: 0; padding: 10px 12px; background: var(--menta-suave); border-radius: 4px; }
.col-asis { grid-template-columns: 28px 74px minmax(220px, 1fr) 50px 140px 100px 110px; min-width: 760px; }
.asis-linea { border-top: 1px solid var(--linea-suave); }
.asis-linea .tabla-fila { border-top: none; }
.asis-linea.off { opacity: .55; }
.asis-just { padding: 0 12px 8px 114px; font-size: 12px; color: var(--gris); text-wrap: pretty; }
.asis-nueva { background: var(--menta-suave); color: var(--verde-osc); }
.asis-cambia { background: var(--ambar-fondo); color: var(--ambar); }
.asis-igual { background: var(--linea-suave); color: var(--gris); }
.asis-bloque { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--linea); border-radius: 4px; }
.asis-bloque ul { margin: 0; padding-left: 18px; }
.asis-check { display: flex; gap: 8px; align-items: center; }
.asis-check > span { flex: 1; }
.asis-pie { position: sticky; bottom: -1px; background: #fff; padding: 10px 0 2px; border-top: 1px solid var(--linea); }
.asis-chat { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: #fff; border-left: 1px solid var(--linea); box-shadow: -12px 0 32px rgba(0,0,0,.12); display: flex; flex-direction: column; z-index: 40; }
.asis-chat-cab { padding: 12px 14px; border-bottom: 1px solid var(--linea); }
.asis-chat-msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.asis-chat-vacio { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.asis-msg { max-width: 92%; padding: 8px 12px; border-radius: 8px; white-space: pre-wrap; line-height: 1.45; font-size: 14px; }
.asis-msg.usuario { align-self: flex-end; background: var(--tinta); color: #fff; }
.asis-msg.asistente { align-self: flex-start; background: var(--fondo); }
.asis-chat-in { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--linea); }
.asis-chat-in textarea { flex: 1; border: 1px solid var(--linea); border-radius: 4px; padding: 8px; font: inherit; resize: none; }
.campo.chk > span:last-child { display: flex; align-items: center; gap: 8px; height: 36px; font-weight: 400; }

/* Moneda UF y eliminar */
.aviso-uf { margin: 6px 0; padding: 8px 12px; background: var(--menta-suave); color: var(--verde-osc); border-radius: 4px; font-size: 13px; }
.aviso-uf a { color: inherit; font-weight: 600; }
.btn.peligro { border-color: #e3b9b0; color: #a3442f; }
.btn.peligro:hover { background: #f6e3e1; }

.asis-falt { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 6px 0; border-top: 1px solid rgba(0,0,0,.06); }
.asis-falt-desc { flex: 1 1 220px; min-width: 0; height: 30px; border: 1px solid var(--linea); border-radius: 4px; padding: 0 8px; font: inherit; background: #fff; }
.asis-falt-mot { flex-basis: 100%; padding-left: 24px; }

.asis-chat { width: 460px; }
.asis-msg-g { display: flex; flex-direction: column; gap: 8px; }
.asis-msg-g.usuario { align-items: flex-end; }
.asis-card { border: 1px solid var(--linea); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: #fff; font-size: 13px; }
.asis-card-l { display: grid; grid-template-columns: 18px minmax(0, 1fr) 64px 34px; gap: 6px; align-items: center; }
.asis-card-l.nuevo { grid-template-columns: 18px minmax(0, 1fr) 56px 34px 80px; }
.asis-card-l > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asis-card-l .num-input { width: 100%; }
.asis-card-desc { min-width: 0; height: 28px; border: 1px solid var(--linea); border-radius: 4px; padding: 0 6px; font: inherit; }
.asis-card .asis-check .num-input { width: 70px; margin-left: auto; }

/* Asistente Gemini */
.gem-btn { border-color: #3d6fd1; color: #2f5bb5; font-weight: 600; }
.gem-btn.on { background: #2f5bb5; border-color: #2f5bb5; color: #fff; }
.asis-chat.gem { border-left: 3px solid #3d6fd1; }
.gem-tit { display: flex; align-items: center; gap: 8px; }
.gem-logo { color: #3d6fd1; font-size: 18px; line-height: 1; }
.gem-key { padding: 12px 14px; border-bottom: 1px solid var(--linea); display: flex; flex-direction: column; gap: 8px; background: #f4f7fd; }
.gem-key-ok { padding: 6px 14px; border-bottom: 1px solid var(--linea); display: flex; justify-content: space-between; align-items: center; background: #f4f7fd; }
.gem-env { background: #2f5bb5; border-color: #2f5bb5; }
.gem-busq { display: flex; flex-wrap: wrap; gap: 4px; }
.gem-busq .insignia { background: #e7eefb; color: #2f5bb5; }
.gem-md { white-space: normal; }
.gem-md p { margin: 0 0 6px; }
.gem-md ul { margin: 0 0 6px; padding-left: 18px; }
.gem-md code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.gem-h { display: block; margin: 6px 0 4px; }
.gem-tabla { overflow-x: auto; margin: 4px 0 8px; }
.gem-tabla table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.gem-tabla th, .gem-tabla td { border: 1px solid var(--linea); padding: 4px 6px; text-align: left; vertical-align: top; }
.gem-tabla th { background: #e7eefb; }

.gem-guia { border: 1px solid #c9d8f5; border-radius: 4px; background: #fff; padding: 8px 10px; font-size: 13px; }
.gem-guia summary { cursor: pointer; font-weight: 600; color: #2f5bb5; }
.gem-guia ol { margin: 8px 0 6px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.gem-guia a { color: #2f5bb5; font-weight: 600; }
.gem-guia code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; background: #f2f4f6; padding: 0 3px; border-radius: 2px; }

.gem-config { border-top: 3px solid #3d6fd1; display: flex; flex-direction: column; gap: 10px; }

/* 1.4.6 importación de artículos */
.chip-sin { display: inline-block; padding: 1px 6px; border-radius: 3px; background: #fdf1dc; color: #7a4f00; font-size: 11px; font-weight: 600; white-space: nowrap; }
.imp-tabla { width: 100%; border-collapse: collapse; font-size: 12px; }
.imp-tabla th, .imp-tabla td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--linea); vertical-align: top; }
.imp-tabla th { font-weight: 600; color: #555; }
.imp-uds { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12px; }
.imp-uds span { border: 1px solid var(--linea); border-radius: 3px; padding: 1px 6px; }

/* 1.4.6 cambios de artículos desde el asistente */
.asis-card-l.cambio { grid-template-columns: 18px minmax(0, 1fr) 90px 14px 96px 44px; }
.asis-card-l.cambio .act { text-align: right; color: #777; font-variant-numeric: tabular-nums; }

/* 1.5.1 Asistente de APU con más aire */
.modal.asis { width: 1120px; padding: 24px 28px 0; gap: 16px; }
.modal.asis .segmentado { align-self: flex-start; }
.asis-inst { padding: 10px 12px; line-height: 1.45; }
.asis-res { gap: 18px; }
.asis-resumen { padding: 12px 16px; line-height: 1.55; text-wrap: pretty; }
.col-asis { grid-template-columns: 28px 84px minmax(260px, 1fr) 56px 150px 110px 120px; column-gap: 12px; min-width: 860px; }
.asis-linea .tabla-fila { min-height: 50px; padding-top: 8px; padding-bottom: 6px; align-items: center; }
.asis-linea:nth-child(even) { background: #fafbfb; }
.asis-ins { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.asis-ins-d { font-weight: 500; line-height: 1.35; text-wrap: pretty; }
.asis-just { padding: 0 16px 12px 136px; line-height: 1.5; max-width: 100ch; }
.asis-bloque { padding: 14px 16px; gap: 8px; }
.asis-falt { padding: 10px 0; gap: 8px 10px; }
.asis-pie { padding: 14px 0 18px; flex-wrap: wrap; gap: 12px; z-index: 1; }
.asis-chat { width: 500px; }
.asis-chat-cab { padding: 14px 18px; }
.asis-chat-msgs { padding: 18px; gap: 14px; }
.asis-msg { padding: 10px 14px; line-height: 1.5; }
.asis-card { padding: 12px 14px; gap: 8px; }
.asis-card-l { gap: 8px; min-height: 32px; }
.asis-chat-in { padding: 12px 18px; }

/* 1.5.2 Cabecera del editor compacta */
.editor-cab { padding: 10px 20px 0; gap: 6px; }
.editor-fila { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.editor-fila .btn.chico { align-self: center; }
.editor-volver { width: 32px; height: 32px !important; padding: 0 !important; font-size: 16px !important; flex: none; }
.editor-tit { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.editor-tit-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.editor-tit-l h2 { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.editor-tit small { font-size: 12.5px; }
.editor-fila .acciones { align-items: center; }
.tg-top { padding: 8px 16px; gap: 12px; background: #fff; }
.tg-top .btn { height: 30px; background: #fff; color: var(--tinta); border: 1px solid #c9ccd0; font-size: 12.5px; font-weight: 600; }
.tg-top .btn:hover { border-color: var(--verde); }
.tg-estado { color: var(--verde-osc); font-size: 12.5px; }
.tg-estado.guardando { color: var(--ambar); }
.fila.par .desc.link { cursor: pointer; }
.abrir-apu { margin-left: auto; padding-left: 12px; font-size: 11px; font-weight: 600; color: var(--verde); opacity: 0; }
.fila.par:hover .abrir-apu { opacity: 1; }

/* 1.5.2 Pantalla de APU dividida */
.esp-apu { position: fixed; inset: 0; z-index: 45; background: var(--fondo); display: flex; flex-direction: column; }
.esp-apu .modal-fondo { z-index: 60; }
.esp-cab { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--linea); }
.esp-tit { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.esp-tit h2 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esp-kpis { display: flex; gap: 24px; flex-wrap: wrap; }
.esp-kpi { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.esp-kpi span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); font-weight: 600; }
.esp-kpi b { font-size: 16px; font-variant-numeric: tabular-nums; min-height: 24px; display: flex; align-items: center; }
.esp-kpi.fuerte b { color: var(--verde-osc); }
.esp-kpi .celda-edit { width: 90px; text-align: right; }
.esp-nav { display: flex; align-items: center; gap: 8px; }
.esp-cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.esp-apu.con-ia .esp-cuerpo { grid-template-columns: minmax(0, 1fr) minmax(420px, 40%); }
.esp-col-apu { overflow: auto; padding: 20px; min-width: 0; }
.esp-col-ia { min-height: 0; min-width: 0; border-left: 1px solid var(--linea); background: #fff; display: flex; flex-direction: column; }
.panel-apu.pantalla { background: #fff; border: 1px solid var(--linea); border-radius: 6px; padding: 12px 14px; box-shadow: none; overflow: visible; min-width: 760px; }
.pantalla .apu-linea { height: 38px; }
.pantalla .apu-grupo-tit { height: 32px; margin-top: 12px; }
.pantalla .apu-agregar { flex-wrap: wrap; height: auto; gap: 8px; margin-top: 14px; padding: 14px 0 2px; border-top: 1px solid var(--linea); }
.pantalla .apu-buscar { flex: 1 1 220px; width: auto; }
.pantalla .apu-sel { flex: 2 1 320px; }
@media (max-width: 1100px) {
  .esp-apu.con-ia .esp-cuerpo { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .esp-col-ia { border-left: none; border-top: 1px solid var(--linea); }
}

/* Asistente incrustado (mitad derecha) */
.asis-panel { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 0; }
.asis-panel h2 { font-size: 18px; }
.asis-panel .segmentado { align-self: flex-start; }
.asis-panel .tabla { overflow: visible; }
.asis-panel .tabla-cab.col-asis { display: none; }
.asis-panel .col-asis { grid-template-columns: 22px 68px minmax(0, 1fr) 118px 100px; column-gap: 10px; row-gap: 4px; min-width: 0; }
.asis-panel .col-asis > :nth-child(3) { grid-column: 3 / -1; }
.asis-panel .col-asis > :nth-child(4) { grid-column: 2; grid-row: 2; }
.asis-panel .col-asis > :nth-child(6) { grid-column: 3; grid-row: 2; justify-content: flex-start; text-align: left; }
.asis-panel .col-asis > :nth-child(5) { grid-column: 4; grid-row: 2; }
.asis-panel .col-asis > :nth-child(7) { grid-column: 5; grid-row: 2; font-weight: 600; }
.asis-panel .col-asis > :nth-child(6)::after { content: ' c/u'; color: var(--gris); font-size: 11px; }
.asis-panel .asis-linea .tabla-fila { height: auto; min-height: 0; padding: 10px 4px 6px; }
.asis-panel .asis-just { padding: 0 8px 12px 100px; }
.asis-panel .asis-falt-mot { padding-left: 24px; }
.asis-panel .asis-pie { margin-top: auto; }

/* 1.6.0 Cotizaciones y respaldo de precios */
.cot-panel { margin-top: 16px; background: #fff; border: 1px solid var(--linea); border-radius: 6px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 760px; }
.cot-modal .cot-panel { min-width: 0; border: none; padding: 0; margin: 0; }
.cot-panel.drag { border: 2px dashed var(--verde); background: var(--menta-suave); }
.cot-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.cot-tit { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 280px; }
.cot-pegar { display: flex; flex-direction: column; gap: 8px; }
.cot-pegar textarea { width: 100%; border: 1px solid var(--linea); border-radius: 4px; padding: 10px 12px; font: inherit; resize: vertical; }
.cot-busy { display: flex; flex-direction: column; gap: 6px; }
.cot-busy .skel { height: 8px; width: 100%; }
.cot-vacio { padding: 16px; text-align: center; color: var(--gris); border: 1px dashed var(--linea); border-radius: 4px; }
.cot-lista { display: flex; flex-direction: column; }
.cot-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--linea-suave); }
.cot-fila:first-child { border-top: none; }
.cot-doc { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cot-doc a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cot-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cot-vigente { background: var(--menta-suave); color: var(--verde-osc); }
.cot-vencida { background: var(--rojo-fondo); color: #8a2a1f; }
.cot-fondo { z-index: 70; }
.modal.cot-modal { width: 860px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal.cot-modal.ancho { width: 1180px; padding-bottom: 0; }
.cot-prov { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(130px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr); gap: 12px; }
.cot-vig { display: flex; align-items: center; gap: 6px; }
.cot-iva { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #f7f8f9; border: 1px solid var(--linea); border-radius: 4px; cursor: pointer; }
.cot-iva input { height: auto; }
.cot-tabla { display: flex; flex-direction: column; border: 1px solid var(--linea); border-radius: 6px; overflow: hidden; }
.cot-tr { display: grid; grid-template-columns: 28px minmax(220px, 1.1fr) minmax(220px, 1.2fr) 120px 130px 72px; gap: 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--linea-suave); }
.cot-tr:nth-child(even) { background: #fafbfb; }
.cot-th { border-top: none; background: #eef0f2 !important; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: #4a5260; padding-top: 8px; padding-bottom: 8px; }
.cot-tr.off { opacity: .5; }
.cot-tr.conf-baja { box-shadow: inset 3px 0 #c08a2a; }
.cot-tr input[type=checkbox] { height: auto; }
.cot-tr .num-input { width: 100%; text-align: right; height: 32px; }
.cot-it { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.35; }
.cot-nota { color: var(--gris-2); font-style: italic; }
.cot-baja { color: var(--ambar); font-weight: 600; }
.cot-sin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--linea-suave); }
.cot-sin select { width: 100%; }
.cot-hist { display: flex; flex-direction: column; }
.cot-hist-f { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; border-top: 1px solid var(--linea-suave); align-items: baseline; }
.apu-precio { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.apu-cot { flex: none; border: 1px solid #b9d9cb; background: var(--menta-suave); color: var(--verde-osc); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; border-radius: 3px; padding: 1px 4px; cursor: pointer; line-height: 14px; }
.apu-cot:hover { background: var(--verde); color: #fff; }
@media (max-width: 900px) { .cot-prov { grid-template-columns: 1fr 1fr; } .cot-tr { grid-template-columns: 28px 1fr 1fr; } .cot-tr > :nth-child(n+4) { grid-column: auto; } }
