/* Colores y tipografía tomados de winkeventos.com: salmón #d98675, gris #666665, Manrope */
:root {
  --fondo: #f7f5f3; --tarjeta: #fff; --texto: #262423; --suave: #666665; --linea: #ebe7e3;
  --marca: #d98675; --marca-oscura: #b4574a; --marca-clara: #fbeeeb; --tinta: #2b2928;
  --alerta: #a35a08; --alerta-fondo: #fff6e5; --peligro: #b42318; --peligro-fondo: #fdecea;
  --ok: #1a7f4b; --ok-fondo: #e7f6ee; --info-fondo: #f1f0ee;
  --radio: 14px; --radio-campo: 10px;
  --sombra: 0 1px 2px rgba(38,36,35,.05), 0 6px 20px rgba(38,36,35,.06);
  --sombra-alta: 0 2px 4px rgba(38,36,35,.06), 0 14px 34px rgba(38,36,35,.12);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fondo); color: var(--texto); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--marca-oscura); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 .25rem; }
h2 { font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; margin: 1.6rem 0 .7rem; }
p { margin: .4rem 0; }
.suave { color: var(--suave); }
.pequeno { font-size: .85rem; }

/* barra superior */
header.barra { background: var(--tinta); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 14px rgba(0,0,0,.18); }
.barra-in { max-width: 1240px; margin: 0 auto; padding: .55rem 20px; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; }
.barra .marca { display: flex; align-items: center; gap: .7rem; color: #fff; font-weight: 600; margin-right: .4rem; }
.barra .marca:hover { text-decoration: none; }
.barra .marca img { height: 26px; width: auto; display: block; }
.barra .marca span { border-left: 1px solid rgba(255,255,255,.3); padding-left: .7rem; font-size: .92rem; letter-spacing: .02em; opacity: .9; }
.barra nav { display: flex; flex-wrap: wrap; gap: .1rem; flex: 1; }
.barra nav a { color: #fff; font-size: .93rem; white-space: nowrap; padding: .4rem .7rem; border-radius: 999px; opacity: .78; font-weight: 500; transition: background .15s, opacity .15s; }
.barra nav a:hover { background: rgba(255,255,255,.1); opacity: 1; text-decoration: none; }
.barra nav a.activo { background: var(--marca); opacity: 1; font-weight: 600; }
.barra .cuenta { font-size: .84rem; display: flex; align-items: center; gap: .8rem; opacity: .95; }
.barra .cuenta .quien { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.barra .cuenta .quien b { font-weight: 600; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra .cuenta .quien small { opacity: .7; font-size: .76rem; }
.barra .cuenta button { font: inherit; background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px; padding: .28rem .8rem; cursor: pointer; transition: background .15s; }
.barra .cuenta button:hover { background: rgba(255,255,255,.12); }
.globo { background: #fff; color: var(--tinta); border-radius: 999px; padding: .05rem .45rem; font-size: .72rem; font-weight: 700; margin-left: .35rem; }

main { max-width: 1240px; margin: 0 auto; padding: 26px 20px 70px; }
.cabecera { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .8rem; margin-bottom: 1.1rem; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); padding: 20px; margin-bottom: 18px; box-shadow: var(--sombra); }
.tarjeta.tabla-caja { overflow: hidden; }

.mensajes { list-style: none; padding: 0; margin: 0 0 1rem; }
.mensajes li { padding: .7rem 1rem; border-radius: var(--radio-campo); background: var(--ok-fondo); color: var(--ok); margin-bottom: .4rem; font-weight: 500; box-shadow: var(--sombra); }
.mensajes li.error { background: var(--peligro-fondo); color: var(--peligro); }
.aviso { padding: .8rem 1rem; border-radius: var(--radio-campo); background: var(--alerta-fondo); color: #6f3d04; border: 1px solid #f1dcae; margin-bottom: 1rem; }
.aviso.peligro { background: var(--peligro-fondo); color: var(--peligro); border-color: #f5c2bd; }
.aviso.info { background: var(--info-fondo); color: #44403c; border-color: var(--linea); }
.aviso ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* campos */
.filtros { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin-bottom: 1.1rem; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=password], input[type=email], input[type=file], select, textarea {
  font: inherit; padding: .58rem .8rem; border: 1px solid #ddd8d3; border-radius: var(--radio-campo); background: #fff; color: inherit; max-width: 100%;
  box-shadow: inset 0 1px 2px rgba(38,36,35,.04), 0 1px 2px rgba(38,36,35,.04); transition: border-color .15s, box-shadow .15s; }
input[type=file] { padding: .42rem .6rem; }
textarea { width: 100%; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #c9c2bb; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--marca); box-shadow: 0 0 0 4px rgba(217,134,117,.22); }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--marca-oscura); vertical-align: -2px; }

.boton, button.boton { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 600; padding: .58rem 1.15rem; border-radius: 999px; border: 1px solid var(--tinta); background: var(--tinta); color: #fff; cursor: pointer; box-shadow: 0 1px 2px rgba(38,36,35,.12), 0 4px 12px rgba(38,36,35,.12); transition: transform .12s, box-shadow .15s, background .15s; }
.boton:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(38,36,35,.14), 0 8px 20px rgba(38,36,35,.16); }
.boton:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid rgba(217,134,117,.55); outline-offset: 2px; }
.boton.claro { background: #fff; color: var(--tinta); border-color: #ddd8d3; box-shadow: 0 1px 2px rgba(38,36,35,.06); }
.boton.claro:hover { border-color: var(--marca); color: var(--marca-oscura); }
.boton.peligro { background: #fff; color: var(--peligro); border-color: #efb7b1; box-shadow: none; }
.boton.peligro:hover { background: var(--peligro-fondo); }

.pestanas { display: flex; gap: .35rem; flex-wrap: wrap; }
.pestanas a { padding: .4rem .95rem; border-radius: 999px; border: 1px solid var(--linea); background: #fff; color: var(--texto); font-weight: 500; box-shadow: 0 1px 2px rgba(38,36,35,.04); }
.pestanas a:hover { text-decoration: none; border-color: var(--marca); }
.pestanas a.activo { background: var(--tinta); border-color: var(--tinta); color: #fff; }

.etiqueta { display: inline-block; font-size: .72rem; font-weight: 700; padding: .14rem .6rem; border-radius: 999px; background: var(--info-fondo); color: #57534e; white-space: nowrap; }
.etiqueta.ok { background: var(--ok-fondo); color: var(--ok); }
.etiqueta.alerta { background: var(--alerta-fondo); color: var(--alerta); }
.etiqueta.peligro { background: var(--peligro-fondo); color: var(--peligro); }

/* galería */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.ficha-mini { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; color: inherit; display: flex; flex-direction: column; box-shadow: var(--sombra); transition: transform .15s, box-shadow .2s; }
.ficha-mini:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--sombra-alta); }
.ficha-mini .foto { aspect-ratio: 4/3; background: linear-gradient(135deg, #fbeeeb, #f3d9d2); display: flex; align-items: center; justify-content: center; color: var(--marca-oscura); font-size: 2.2rem; font-weight: 800; }
.ficha-mini .foto img { width: 100%; height: 100%; object-fit: cover; }
.ficha-mini .cuerpo { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: .4rem; }
.ficha-mini .nombre { font-weight: 700; line-height: 1.25; }
.ficha-mini .marcas { display: flex; flex-wrap: wrap; gap: .3rem; }

/* tablas */
.tabla-caja { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); font-weight: 700; white-space: nowrap; background: #faf8f6; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #fcfaf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.con-alerta td, tbody tr.con-alerta:hover td { background: var(--alerta-fondo); }

/* cifras */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.cifra { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); }
.cifra b { display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.cifra span { color: var(--suave); font-size: .85rem; }
.cifra.alerta b { color: var(--alerta); } .cifra.ok b { color: var(--ok); }
.barra-avance { height: 12px; background: var(--linea); border-radius: 999px; overflow: hidden; }
.barra-avance i { display: block; height: 100%; background: linear-gradient(90deg, var(--marca), var(--marca-oscura)); border-radius: 999px; }

/* ficha */
.dos-col { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 22px; align-items: start; }
.foto-grande { width: 100%; aspect-ratio: 4/3; border-radius: var(--radio); background: linear-gradient(135deg, #fbeeeb, #f3d9d2); display: flex; align-items: center; justify-content: center; color: var(--marca-oscura); font-size: 3.2rem; font-weight: 800; overflow: hidden; box-shadow: var(--sombra); }
.foto-grande img { width: 100%; height: 100%; object-fit: cover; }
dl.datos { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: .3rem 0; }
dl.datos dt { color: var(--suave); } dl.datos dd { margin: 0; font-weight: 600; }

/* formularios: la etiqueta puede ocupar una o dos líneas; el campo siempre queda abajo, alineado con sus vecinos */
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: stretch; }
.campos label, label.bloque { display: flex; flex-direction: column; justify-content: flex-end; gap: .35rem; font-size: .84rem; font-weight: 600; color: var(--suave); }
.campos label > input, .campos label > select, .campos label > textarea, label.bloque > * { width: 100%; color: var(--texto); font-size: 15px; font-weight: 400; }
.acciones { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.1rem; align-items: center; }
.paginas { display: flex; gap: .9rem; align-items: center; margin-top: 1.2rem; }

/* editor de líneas */
.linea-ing { position: relative; }
.linea-ing input.buscador { width: 100%; min-width: 220px; }
.sugerencias { position: absolute; z-index: 5; left: .8rem; right: .8rem; top: calc(100% - .5rem); background: #fff; border: 1px solid var(--linea); border-radius: var(--radio-campo); box-shadow: var(--sombra-alta); max-height: 270px; overflow-y: auto; padding: .25rem; }
.sugerencias button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: .5rem .65rem; cursor: pointer; border-radius: 7px; }
.sugerencias button:hover, .sugerencias button:focus { background: var(--marca-clara); outline: none; }
.sugerencias small { color: var(--suave); }
.original { font-size: .8rem; color: var(--suave); margin-top: .25rem; }
.nota-alerta { font-size: .82rem; color: var(--alerta); margin-top: .2rem; font-weight: 500; }
td .corta { width: 110px; }
#lineas td { vertical-align: top; }

/* entrada */
.entrada { max-width: 400px; margin: 9vh auto; padding: 0; overflow: hidden; box-shadow: var(--sombra-alta); }
.entrada .franja { background: var(--tinta); padding: 22px 28px; }
.entrada .franja img { height: 30px; display: block; }
.entrada .dentro { padding: 24px 28px 28px; }
.entrada label { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; font-size: .84rem; font-weight: 600; color: var(--suave); }
.entrada input { width: 100%; font-size: 15px; font-weight: 400; color: var(--texto); }
.entrada .boton { width: 100%; justify-content: center; margin-top: .3rem; }

@media (max-width: 760px) {
  .dos-col { grid-template-columns: 1fr; }
  body { font-size: 16px; }
  main { padding: 18px 14px 60px; }
  .barra-in { padding: .55rem 14px; }
  .barra nav a { padding: .42rem .7rem; }
  th, td { padding: .55rem .5rem; }
  .tarjeta { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* listas desplegables propias (desplegable.js); en táctil se usa la nativa */
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23666665' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; }
.desp { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.desp.ancho, .campos label > .desp { display: block; width: 100%; }
.desp-nativo { position: absolute !important; inset: 0; width: 100% !important; height: 100%; opacity: 0; pointer-events: none; }
.desp-boton { font: inherit; font-size: 15px; font-weight: 400; color: var(--texto); width: 100%; min-width: 9rem; text-align: left; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .58rem .8rem; background: #fff;
  border: 1px solid #ddd8d3; border-radius: var(--radio-campo); box-shadow: inset 0 1px 2px rgba(38,36,35,.04), 0 1px 2px rgba(38,36,35,.04);
  transition: border-color .15s, box-shadow .15s; }
.desp-boton span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desp-boton span.vacio { color: var(--suave); }
.desp-boton::after { content: ""; flex: none; width: 12px; height: 8px; transition: transform .18s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23666665' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center; }
.desp-boton:hover { border-color: #c9c2bb; }
.desp-boton:focus-visible, .desp-boton.abierto { outline: none; border-color: var(--marca); box-shadow: 0 0 0 4px rgba(217,134,117,.22); }
.desp-boton.abierto::after { transform: rotate(180deg); }
.desp-boton:disabled { background: #f6f4f2; color: var(--suave); cursor: default; }
td .desp-boton { min-width: 5.5rem; }
.desp-panel { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--linea); border-radius: 12px; box-shadow: var(--sombra-alta);
  padding: 6px; max-width: min(420px, calc(100vw - 16px)); animation: desp-entra .12s ease-out; }
.desp-lista { max-height: 300px; overflow-y: auto; }
.desp-buscar { width: 100%; margin-bottom: 6px; font-size: 14px !important; padding: .45rem .65rem !important; }
.desp-opcion { padding: .5rem .7rem; border-radius: 8px; cursor: pointer; line-height: 1.3; color: var(--texto); }
.desp-opcion.activo { background: var(--marca-clara); }
.desp-opcion.elegido { font-weight: 700; color: var(--marca-oscura); }
.desp-opcion.elegido::after { content: "✓"; float: right; margin-left: .8rem; }
.desp-nada { padding: .6rem .7rem; color: var(--suave); font-size: .9rem; }
@keyframes desp-entra { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .desp-panel { animation: none; } }

/* celular: logo y cuenta arriba; el menú en una fila que se desliza de lado */
@media (max-width: 760px) {
  .barra-in { gap: .45rem .8rem; justify-content: space-between; }
  .barra .marca { margin-right: 0; }
  .barra nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px .1rem; }
  .barra nav::-webkit-scrollbar { display: none; }
  .barra .cuenta .quien b { max-width: 9rem; }
  .filtros > input[type=search], .filtros > select, .filtros > .desp { flex: 1 1 100%; width: 100%; }
  .filtros > .boton { flex: 1 1 100%; justify-content: center; }
  .cabecera .boton { width: 100%; justify-content: center; }
  .dos-col[style] { grid-template-columns: 1fr !important; }
}
