/* Cotizador · línea gráfica del 14-11-2026.
   Estructura de Joist (barra lateral oscura, encabezado blanco, botones
   redondeados), colores de la marca Skymaster. Fuente de las decisiones:
   design-system/cotizador-skymaster/MASTER.md */

:root {
  --azul: #004AAD;          /* azul Skymaster: acciones, enlaces, foco */
  --azul-osc: #00398A;
  --azul-claro: #E8F0FB;
  --rojo: #FF3131;          /* rojo Skymaster: solo acento, nunca texto chico */
  --lateral: #0B1E3F;       /* barra lateral, marino de la marca */
  --lateral-txt: #C3CCDB;

  --tinta: #0F172A;
  --suave: #5B6474;
  --linea: #E2E7EF;
  --fondo: #F3F5F9;
  --blanco: #fff;
  --ok: #0F7B3F;
  --ok-fondo: #E7F6EC;
  --error: #B42318;
  --error-fondo: #FDECEB;

  /* Compatibilidad con estilos viejos */
  --acento: var(--azul);

  --radio: 8px;
  --radio-pill: 999px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --sombra-alta: 0 10px 30px rgba(15, 23, 42, .18);
  --anillo: 0 0 0 3px rgba(0, 74, 173, .28);
  --lat-ancho: 240px;
  --cab-alto: 60px;
  --t: 160ms ease;
}

* { box-sizing: border-box; }

/* El atributo `hidden` lo aplica el navegador con una regla de baja
   prioridad, así que cualquier `display` propio la anula. Esto lo fuerza:
   sin ello el filtrado en vivo no oculta nada. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(0, 74, 173, .15);
  touch-action: manipulation;
}

a { color: var(--azul); text-underline-offset: 2px; }
a:hover { color: var(--azul-osc); }

:focus-visible { outline: none; box-shadow: var(--anillo); border-radius: 4px; }

.saltar {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--azul); color: #fff; padding: 8px 14px; border-radius: var(--radio);
  transition: top var(--t);
}
.saltar:focus { top: 8px; color: #fff; }

.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- barra lateral (como Joist) ---------- */
.lateral {
  position: fixed; inset: 0 auto 0 0; width: var(--lat-ancho); z-index: 40;
  background: var(--lateral); color: var(--lateral-txt);
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
}
.lateral-logo {
  display: flex; align-items: center; justify-content: center;
  background: #fff; height: 88px; padding: 10px 18px;
  border-bottom: 3px solid var(--rojo); text-decoration: none;
}
.lateral-logo img { max-width: 100%; max-height: 64px; width: auto; height: auto; display: block; }
.lateral-logo .marca { color: var(--tinta); font-weight: 700; font-size: 17px; }

.lateral-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.lateral-nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 18px 0 17px;
  color: var(--lateral-txt); text-decoration: none; font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background-color var(--t), color var(--t);
}
.lateral-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.lateral-nav a.act {
  background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600;
  border-left-color: var(--rojo);
}
.lateral-nav a.act .ico { color: var(--rojo); }
.lateral-nav a:focus-visible { box-shadow: inset 0 0 0 2px #7FA6E0; border-radius: 0; }
.lateral-pie {
  padding: 12px 18px; font-size: 12px; color: #8592A8;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* ---------- encabezado blanco ---------- */
.principal { margin-left: var(--lat-ancho); min-height: 100vh; }
.cabecera {
  position: sticky; top: 0; z-index: 30;
  height: var(--cab-alto); background: #fff; border-bottom: 1px solid var(--linea);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.cabecera-tit { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.sp { flex: 1; }
.usuario { color: var(--suave); font-size: 13.5px; }
.menu-btn { display: none; }

.selector select {
  width: auto; min-width: 180px; padding: 7px 34px 7px 12px;
  border-radius: var(--radio-pill); font-weight: 600; font-size: 13.5px;
}

/* ---------- contenido ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 24px 64px; }
.wrap:focus { outline: none; }

h1 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-size: 15.5px; margin: 26px 0 10px; letter-spacing: -.005em; }
h3 { font-size: 14.5px; }
.sub { color: var(--suave); font-size: 13.5px; margin: 0 0 18px; text-wrap: pretty; }

.barra { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.barra .sp { flex: 1; }

.card {
  background: #fff; border: 1px solid var(--linea);
  border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra);
}

/* ---------- tablas ---------- */
table { width: 100%; border-collapse: collapse; background: #fff; }
.tabla-wrap {
  border: 1px solid var(--linea); border-radius: var(--radio);
  overflow-x: auto; background: #fff; box-shadow: var(--sombra);
}
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--linea); vertical-align: top; }
th {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--suave); background: #F8FAFC;
}
tbody tr { transition: background-color var(--t); }
.tabla-wrap tbody tr:hover { background: #F8FAFD; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nw { white-space: nowrap !important; }
.desc { color: var(--suave); font-size: 13px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---------- formularios ---------- */
label.campo { display: block; margin-bottom: 14px; }
label.campo > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--suave); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; font: inherit; color: var(--tinta);
  border: 1px solid #CFD6E1; border-radius: var(--radio); background: #fff;
  transition: border-color var(--t), box-shadow var(--t);
}
input:hover, select:hover, textarea:hover { border-color: #AEB8C7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: var(--anillo); }
input[readonly] { background: #F6F8FB; color: var(--suave); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6474' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
}
textarea { min-height: 120px; resize: vertical; font-family: inherit; }
::placeholder { color: #98A2B3; }
.fila { display: flex; gap: 14px; flex-wrap: wrap; }
.fila > * { flex: 1; min-width: 180px; }

.check { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--azul); margin: 0; }

/* ---------- vista a dos paneles (catálogo) ---------- */
.split { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }

.split-lista {
  background: #fff; border: 1px solid var(--linea);
  border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra);
  position: sticky; top: calc(var(--cab-alto) + 14px);
}
.split-buscar { padding: 10px; border-bottom: 1px solid var(--linea); background: #F8FAFC; }
.split-buscar input { width: 100%; }
.split-conteo { font-size: 12px; color: var(--suave); margin-top: 6px; }

/* Alto fijo con scroll propio: la lista no empuja el detalle hacia abajo. */
.split-scroll { max-height: calc(100vh - 250px); overflow-y: auto; overscroll-behavior: contain; }

.split-letra {
  position: sticky; top: 0;
  padding: 5px 14px; background: #EEF2F7; color: var(--suave);
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
}
.split-item {
  display: block; padding: 10px 14px; text-decoration: none; color: var(--tinta);
  border-bottom: 1px solid #EEF1F5; border-left: 3px solid transparent;
  transition: background-color var(--t);
}
.split-item:hover { background: #F6F8FC; color: var(--tinta); }
.split-item.act { background: var(--azul-claro); border-left-color: var(--rojo); }
.split-nom { display: block; font-size: 13.5px; line-height: 1.35; font-weight: 500; }
.split-precio { font-size: 12px; color: var(--suave); font-variant-numeric: tabular-nums; }
.split-imp {
  font-size: 11px; color: var(--azul); background: var(--azul-claro);
  padding: 1px 7px; border-radius: var(--radio-pill); margin-left: 6px; font-weight: 600;
}
.split-detalle { min-width: 0; }

/* ---------- editor de cotización ---------- */
.sub-caja {
  background: #F8FAFC; border: 1px solid var(--linea);
  border-radius: var(--radio); padding: 16px; margin-bottom: 14px;
}
.l-cab { display: flex; gap: 6px; align-items: center; }
.l-cab .l-nombre { flex: 1; min-width: 0; }

tr.grupo td { background: var(--azul-claro); }
tr.grupo .g-titulo {
  font-weight: 700; text-transform: uppercase; font-size: 13px;
  letter-spacing: .04em; background: #fff;
}

.ntec-bloque { border-left: 3px solid var(--azul); }

/* ---------- modal buscador de partidas ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(11, 30, 63, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px; z-index: 50; overscroll-behavior: contain;
}
.modal-caja {
  background: #fff; border-radius: 12px; width: 100%; max-width: 640px;
  padding: 18px; box-shadow: var(--sombra-alta);
  display: flex; flex-direction: column; max-height: 76vh;
}
.modal-cab { display: flex; align-items: center; margin-bottom: 10px; }
.modal-cab strong { flex: 1; }
.modal-conteo { font-size: 12px; color: var(--suave); margin: 8px 0 4px; }
.modal-lista { overflow-y: auto; border-top: 1px solid var(--linea); overscroll-behavior: contain; }

.pick-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: 0; border-bottom: 1px solid #EEF1F5; background: none;
  cursor: pointer; border-radius: 0; min-height: 0; font-weight: 400;
}
.pick-item:hover { background: var(--azul-claro); }
.pick-nom { display: block; font-weight: 600; font-size: 14px; }
.pick-precio { font-size: 12px; color: var(--azul); font-variant-numeric: tabular-nums; }
.pick-desc { display: block; font-size: 12px; color: var(--suave); margin-top: 2px; }

/* ---------- editor con formato ---------- */
.rich { border: 1px solid #CFD6E1; border-radius: var(--radio); background: #fff; transition: border-color var(--t), box-shadow var(--t); }
.rich:focus-within { border-color: var(--azul); box-shadow: var(--anillo); }
.rich-barra {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 5px;
  border-bottom: 1px solid var(--linea); background: #F8FAFC;
  border-radius: var(--radio) var(--radio) 0 0;
}
.rich-btn {
  min-height: 30px; padding: 3px 10px; font-size: 13px; line-height: 1.4; font-weight: 500;
  border: 1px solid transparent; border-radius: 6px;
  background: none; cursor: pointer; color: var(--tinta);
}
.rich-btn:hover { background: #EAEFF6; border-color: var(--linea); }
.rich-area {
  padding: 10px 12px; min-height: 110px; outline: none;
  font-size: 14px; line-height: 1.6; overflow-wrap: break-word;
}
.rich-area:focus { box-shadow: none; }
.rich-area:empty:before { content: attr(data-ph); color: #98A2B3; }
.rich-area ul, .rich-area ol { margin: 6px 0; padding-left: 22px; }
.rich-area p { margin: 0 0 8px; }
.rich-area h4, .rich-area h3 { font-size: 15px; font-weight: 700; margin: 10px 0 4px; color: var(--azul); }
.rich-area b, .rich-area strong { font-weight: 700; color: var(--tinta); }

/* ---------- botones (redondeados, como Joist) ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 18px; font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid #CFD6E1; border-radius: var(--radio-pill);
  background: #fff; cursor: pointer; text-decoration: none; color: var(--tinta);
  transition: background-color var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
}
button:hover, .btn:hover { background: #F1F4F9; border-color: #AEB8C7; color: var(--tinta); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-pri, button.pri {
  background: var(--azul); border-color: var(--azul); color: #fff;
}
.btn-pri:hover, button.pri:hover { background: var(--azul-osc); border-color: var(--azul-osc); color: #fff; }
.btn-sec { background: #EEF1F6; border-color: #EEF1F6; }
.btn-sec:hover { background: #E2E7EF; border-color: #E2E7EF; }
button.link {
  border: 0; background: none; color: var(--azul); min-height: 0;
  padding: 0; font-weight: 500; font-size: inherit; text-decoration: underline;
}
button.link:hover { background: none; color: var(--azul-osc); }
.inline { display: inline; }
.chico { min-height: 32px; font-size: 13px; padding: 0 12px; }

/* ---------- avisos ---------- */
.flash {
  padding: 11px 14px 11px 16px; border-radius: var(--radio); margin-bottom: 16px; font-size: 14px;
  border-left: 4px solid currentColor;
}
.flash.ok { background: var(--ok-fondo); color: var(--ok); }
.flash.error { background: var(--error-fondo); color: var(--error); }
.aviso { color: var(--error); font-size: 13.5px; margin-bottom: 12px; font-weight: 500; }
.vacio { padding: 40px; text-align: center; color: var(--suave); }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: var(--radio-pill);
  background: var(--azul-claro); color: var(--azul); font-size: 12px; font-weight: 600;
  white-space: nowrap;
}

/* ---------- panel ---------- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tarjeta {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--linea); box-shadow: var(--sombra);
  border-radius: var(--radio); padding: 18px 18px 16px; text-decoration: none; color: inherit;
  transition: border-color var(--t), box-shadow var(--t);
}
.tarjeta::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--azul);
}
.tarjeta:hover { border-color: #C5D3EA; box-shadow: 0 4px 14px rgba(0, 74, 173, .12); color: inherit; }
.tarjeta .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tarjeta .t { color: var(--suave); font-size: 13.5px; }

/* ---------- login ---------- */
body:not(.app):not(.pub) { min-height: 100vh; }
.login {
  max-width: 360px; margin: 12vh auto; background: #fff;
  border: 1px solid var(--linea); border-radius: 12px; padding: 30px 28px;
  box-shadow: var(--sombra-alta); border-top: 4px solid var(--rojo);
}
.login h1 { text-align: center; margin-bottom: 20px; }
.login button { width: 100%; }

/* ---------- celular y tableta ---------- */
@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
  .split-lista { position: static; }
  .split-scroll { max-height: 320px; }
}

@media (max-width: 900px) {
  .lateral { transform: translateX(-100%); transition: transform 200ms ease; box-shadow: var(--sombra-alta); }
  body.menu-abierto .lateral { transform: none; }
  .velo { position: fixed; inset: 0; background: rgba(11, 30, 63, .45); z-index: 35; }
  .principal { margin-left: 0; }
  .menu-btn {
    display: inline-flex; min-height: 40px; width: 40px; padding: 0;
    border-color: transparent; background: none;
  }
  .cabecera { padding: 0 12px; gap: 8px; }
  .cabecera-tit { font-size: 17px; }
  .usuario { display: none; }
  .selector select { min-width: 0; max-width: 150px; }
  .wrap { padding: 18px 14px 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* ---------- fotos y adjuntos (panel) ---------- */
.arch-subir { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 6px; }
.arch-form { background: #F8FAFC; border: 1px dashed #C5CEDB; border-radius: var(--radio); padding: 14px; }
.arch-form input[type=file] { font: inherit; font-size: 13px; width: 100%; }
.arch-aviso { display: block; margin: 6px 0 0; }
.arch-lista { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--linea); }
.arch-lista li {
  display: flex; align-items: center; gap: 14px; padding: 10px 0;
  border-bottom: 1px solid var(--linea);
}
.arch-prev {
  flex: none; width: 96px; height: 72px; border-radius: 8px; overflow: hidden;
  background: #EEF2F7; display: flex; align-items: center; justify-content: center;
}
.arch-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arch-info { flex: 1; min-width: 0; }
.arch-nom { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; margin-bottom: 6px; }
.arch-tit { display: flex; gap: 8px; }
.arch-tit input { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.arch-tit { flex-wrap: wrap; }
.arch-tit input { flex: 2 1 220px; }
.arch-tit select { flex: 1 1 200px; width: auto; min-height: 34px; padding: 5px 30px 5px 10px; font-size: 13px; }
@media (max-width: 700px) {
  .arch-subir { grid-template-columns: 1fr; }
  .arch-lista li { flex-wrap: wrap; }
}
