/* ═══════════════════════════════════════════════════════════════
   Área de clientes Arvex
   Reutiliza los tokens de ../styles.css (:root) y añade lo suyo.
   ═══════════════════════════════════════════════════════════════ */

body.area {
  background: var(--bg-alt);
  color: var(--ink-body);
  font-family: var(--sans);
  min-height: 100vh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.banda-config {
  background: #7A2E00; color: #fff;
  padding: .6rem 1rem; text-align: center;
  font-size: .85rem; position: relative; z-index: 200;
}
.banda-config code { background: rgba(255,255,255,.15); padding: .1rem .35rem; border-radius: 4px; }

/* ─────────────────── Cabecera de la app ─────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy-dark);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-header-inner {
  max-width: 1440px; margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
  height: 62px; display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem);
}
.app-logo img { height: 26px; width: auto; }
.app-nav { display: flex; gap: .35rem; flex: 1; }
.app-nav-link {
  padding: .45rem .85rem; border-radius: var(--r-sm);
  font-size: .88rem; font-weight: 500;
  color: rgba(238,242,255,.6); text-decoration: none;
  transition: background .15s, color .15s;
}
.app-nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.app-nav-link.is-activa { color: #fff; background: rgba(255,255,255,.12); }
.app-user { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.app-empresa {
  font-size: .85rem; font-weight: 600; color: #fff;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-salir {
  background: none; border: 1px solid rgba(255,255,255,.2);
  color: rgba(238,242,255,.75); border-radius: var(--r-sm);
  padding: .35rem .75rem; font-size: .8rem; font-family: var(--sans);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.app-salir:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ─────────────────── Contenedor ─────────────────── */
.area-wrap {
  max-width: 1440px; margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 4rem;
}

.area-titulo {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: var(--ink); letter-spacing: -.02em; line-height: 1.15;
}
.area-sub { font-size: .92rem; color: var(--ink-mute); margin-top: .3rem; }

/* ─────────────────── Rejilla principal ─────────────────── */
.pedido-grid {
  display: grid; gap: clamp(1rem, 2.5vw, 1.75rem);
  grid-template-columns: minmax(0, 1fr) 372px;
  align-items: start; margin-top: 1.5rem;
}
@media (max-width: 1040px) { .pedido-grid { grid-template-columns: 1fr; } }

/* ─────────────────── Tarjetas ─────────────────── */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: clamp(1.1rem, 2.5vw, 1.5rem);
  margin-bottom: clamp(1rem, 2vw, 1.25rem);
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.card-titulo {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 700;
  color: var(--ink); letter-spacing: -.01em;
}
.card-nota { font-size: .82rem; color: var(--ink-mute); }

/* ─────────────────── Trabajadores ─────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .42rem .5rem .42rem .8rem;
  border: 1.5px solid var(--line); border-radius: 100px;
  background: #fff; font-size: .87rem; color: var(--ink);
  cursor: pointer; transition: all .16s var(--ease-soft);
}
.chip:hover { border-color: var(--navy); }
.chip.is-activo {
  background: var(--navy); border-color: var(--navy); color: #fff;
}
.chip.is-activo .chip-talla { color: rgba(255,255,255,.7); }
.chip-nombre { font-weight: 500; }
.chip-talla { color: var(--ink-mute); font-size: .8rem; }
.chip-acciones { display: flex; gap: .15rem; }
.chip-btn {
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(13,24,57,.07); color: var(--ink-mute);
  font-size: .72rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.chip.is-activo .chip-btn { background: rgba(255,255,255,.18); color: #fff; }
.chip-btn:hover { background: var(--orange); color: #fff; }

.chip--add {
  border-style: dashed; color: var(--orange); border-color: var(--orange);
  font-weight: 600; padding: .42rem .9rem;
}
.chip--add:hover { background: var(--orange-soft); }

.chip--todos { padding: .42rem .9rem; }

.aviso-destino {
  margin-top: .85rem; padding: .6rem .85rem;
  background: var(--orange-soft); border-radius: var(--r-sm);
  font-size: .84rem; color: #8a3908;
}

/* Formulario de alta de trabajador */
.form-trabajador {
  display: none; gap: .6rem; margin-top: 1rem;
  padding: 1rem; background: var(--bg-alt); border-radius: var(--r-sm);
  flex-wrap: wrap; align-items: flex-end;
}
.form-trabajador.is-abierto { display: flex; }
.campo { display: flex; flex-direction: column; gap: .3rem; }
.campo--crece { flex: 1; min-width: 160px; }
.campo label { font-size: .78rem; font-weight: 600; color: var(--ink-mute); }
.campo input, .campo select, .campo textarea {
  padding: .55rem .7rem; border: 1.5px solid var(--line);
  border-radius: var(--r-sm); font-family: var(--sans); font-size: .9rem;
  color: var(--ink); background: #fff; outline: none;
  transition: border-color .15s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--navy); }
.campo textarea { resize: vertical; min-height: 76px; }

/* ─────────────────── Catálogo ─────────────────── */
.buscador { position: relative; margin-bottom: 1rem; }
.buscador input {
  width: 100%; padding: .7rem .9rem .7rem 2.4rem;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--sans); font-size: .92rem; background: #fff;
  color: var(--ink); outline: none; transition: border-color .15s;
}
.buscador input:focus { border-color: var(--navy); }
.buscador-icono {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-mute); pointer-events: none; font-size: .95rem;
}

.productos {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.prod {
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  padding: .85rem; display: flex; flex-direction: column; gap: .5rem;
  transition: border-color .16s, box-shadow .16s;
}
.prod:hover { border-color: #C0CCE5; box-shadow: var(--shadow-sm); }
.prod.is-en-pedido { border-color: var(--orange); background: rgba(229,86,11,.03); }
.prod-ref { font-size: .7rem; color: var(--ink-mute); letter-spacing: .04em; }
.prod-nombre { font-size: .92rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.prod-desc { font-size: .78rem; color: var(--ink-mute); line-height: 1.45; flex: 1; }
.prod-pie { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .15rem; }
.prod-precio { font-size: 1rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }

.cant { display: inline-flex; align-items: center; gap: .3rem; }
.cant-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font-size: 1rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.cant-btn:hover:not(:disabled) { background: var(--navy); color: #fff; border-color: var(--navy); }
.cant-btn:disabled { opacity: .35; cursor: not-allowed; }
.cant-num {
  min-width: 26px; text-align: center; font-size: .92rem;
  font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}

.vacio { padding: 1.5rem; text-align: center; color: var(--ink-mute); font-size: .88rem; }

/* ─────────────────── Panel del pedido ─────────────────── */
.panel {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  position: sticky; top: 78px;
}
@media (max-width: 1040px) { .panel { position: static; } }

.panel-head {
  padding: 1.1rem 1.25rem; background: var(--navy-dark); color: #fff;
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
}
.panel-titulo { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; }
.panel-count { font-size: .8rem; color: rgba(238,242,255,.6); }

.panel-lineas { max-height: 46vh; overflow-y: auto; }
@media (max-width: 1040px) { .panel-lineas { max-height: none; } }

.grupo-trab {
  padding: .55rem 1.25rem; background: var(--bg-alt);
  font-size: .76rem; font-weight: 700; color: var(--ink-mute);
  letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.linea {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .7rem 1.25rem; border-bottom: 1px solid var(--line-light);
}
.linea-cuerpo { flex: 1; min-width: 0; }
.linea-nombre { font-size: .86rem; font-weight: 500; color: var(--ink); line-height: 1.35; }
.linea-detalle { font-size: .76rem; color: var(--ink-mute); margin-top: .1rem; }
.linea-precio { font-size: .86rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.linea-quitar {
  border: none; background: none; color: var(--ink-mute);
  cursor: pointer; font-size: .95rem; line-height: 1; padding: .1rem .2rem;
  transition: color .15s;
}
.linea-quitar:hover { color: #c0392b; }

.panel-vacio { padding: 2.25rem 1.25rem; text-align: center; color: var(--ink-mute); font-size: .88rem; line-height: 1.6; }

.panel-total {
  padding: 1rem 1.25rem; border-top: 2px solid var(--line);
  display: flex; align-items: baseline; justify-content: space-between;
}
.panel-total-label { font-size: .88rem; font-weight: 600; color: var(--ink-mute); }
.panel-total-num {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 700;
  color: var(--ink); letter-spacing: -.02em;
}
.panel-iva { padding: 0 1.25rem .5rem; font-size: .74rem; color: var(--ink-mute); text-align: right; }
.panel-pie { padding: 0 1.25rem 1.25rem; }

.btn-confirmar {
  width: 100%; padding: .85rem 1rem; border: none;
  border-radius: var(--r-sm); background: var(--orange); color: #fff;
  font-family: var(--sans); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .16s;
}
.btn-confirmar:hover:not(:disabled) { background: var(--orange-h); }
.btn-confirmar:disabled { opacity: .45; cursor: not-allowed; }
.btn-confirmar.is-cargando { position: relative; color: transparent; }
.btn-confirmar.is-cargando::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: giro .7s linear infinite;
}
@keyframes giro { to { transform: rotate(360deg); } }

/* ── Barra inferior de móvil ──
   En pantalla estrecha el panel cae debajo de todo el catálogo, así que
   el total dejaría de verse justo cuando más falta hace. */
.barra-movil {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: none; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem clamp(.9rem, 4vw, 1.25rem);
  background: var(--navy-dark); color: #fff;
  box-shadow: 0 -4px 20px rgba(13,24,57,.22);
  transform: translateY(110%); transition: transform .25s var(--ease-out);
}
.barra-movil.is-visible { transform: none; }
.barra-movil-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.barra-movil-count { font-size: .72rem; color: rgba(238,242,255,.6); }
.barra-movil-total { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.barra-movil-btn {
  flex-shrink: 0; border: none; border-radius: var(--r-sm);
  background: var(--orange); color: #fff;
  padding: .6rem 1.1rem; font-family: var(--sans);
  font-size: .88rem; font-weight: 600; cursor: pointer;
}
.barra-movil-btn:hover { background: var(--orange-h); }

@media (max-width: 1040px) {
  .barra-movil { display: flex; }
  /* Que la barra no tape el final del contenido */
  .area-wrap { padding-bottom: 6rem; }
}

/* ─────────────────── Histórico ─────────────────── */
.tabla-pedidos { width: 100%; border-collapse: collapse; }
.tabla-pedidos th {
  text-align: left; font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute);
  padding: .6rem .75rem; border-bottom: 1.5px solid var(--line);
}
.tabla-pedidos td { padding: .8rem .75rem; border-bottom: 1px solid var(--line-light); font-size: .9rem; }
.tabla-pedidos tbody tr { cursor: pointer; transition: background .14s; }
.tabla-pedidos tbody tr:hover { background: var(--bg-alt); }
.td-num { font-weight: 700; color: var(--ink); }
.td-total { font-weight: 700; text-align: right; white-space: nowrap; }
.td-arts { text-align: center; color: var(--ink-mute); }

.estado {
  display: inline-block; padding: .18rem .6rem; border-radius: 100px;
  font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.estado--recibido       { background: #E8EEFB; color: #1A2C5E; }
.estado--en_preparacion { background: #FFF0E3; color: #8a3908; }
.estado--enviado        { background: #E3F1FF; color: #0B4F82; }
.estado--entregado      { background: #E4F6EA; color: #1B6E38; }
.estado--anulado        { background: #F3F4F6; color: #6B7280; }

/* Detalle de pedido (desplegable) */
.detalle-fila > td { background: var(--bg-alt); padding: 0; }
.detalle-caja { padding: 1rem 1.25rem; }
.detalle-lineas { width: 100%; border-collapse: collapse; }
.detalle-lineas td { padding: .4rem .5rem; font-size: .85rem; border-bottom: 1px solid var(--line-light); }
.detalle-lineas tr:last-child td { border-bottom: none; }
.detalle-vacio { font-size: .85rem; color: var(--ink-mute); }

/* ─────────────────── Login ─────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.25rem; background: var(--navy-dark); position: relative; overflow: hidden;
}
.login-wrap::after {
  content: ""; position: absolute; top: -200px; right: -160px;
  width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(229,86,11,.16) 0%, transparent 65%);
  pointer-events: none;
}
.login-card {
  position: relative; width: 100%; max-width: 400px;
  background: #fff; border-radius: var(--r-lg);
  padding: clamp(1.75rem, 5vw, 2.5rem); box-shadow: var(--shadow-lg);
}
.login-logo { height: 30px; width: auto; margin-bottom: 1.5rem; }
.login-titulo {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  color: var(--ink); letter-spacing: -.02em; margin-bottom: .4rem;
}
.login-sub { font-size: .88rem; color: var(--ink-mute); margin-bottom: 1.5rem; line-height: 1.55; }
.login-form { display: flex; flex-direction: column; gap: .9rem; }
.login-form .campo input { padding: .65rem .8rem; }
.login-acciones { display: flex; flex-direction: column; gap: .75rem; margin-top: .35rem; }
.btn-full { width: 100%; }
.login-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--sans); font-size: .84rem; color: var(--navy);
  text-decoration: underline; text-underline-offset: 2px; align-self: center;
}
.login-link:hover { color: var(--orange); }
.login-pie { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-mute); text-align: center; line-height: 1.6; }
.login-pie a { color: var(--navy); }

.mensaje { padding: .7rem .85rem; border-radius: var(--r-sm); font-size: .85rem; line-height: 1.5; }
.mensaje--error { background: #FDECEA; color: #8a1c12; }
.mensaje--ok    { background: #E4F6EA; color: #1B6E38; }

.pantalla-error {
  max-width: 460px; margin: 18vh auto; padding: 2rem; text-align: center;
  font-family: var(--sans);
}
.pantalla-error h1 { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); margin-bottom: .75rem; }
.pantalla-error p { color: var(--ink-mute); font-size: .92rem; line-height: 1.65; margin-bottom: 1.5rem; }

/* ─────────────────── Avisos flotantes ─────────────────── */
#avisos {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: .5rem;
  align-items: center; pointer-events: none; width: min(92vw, 460px);
}
.aviso {
  padding: .7rem 1.1rem; border-radius: var(--r-sm);
  font-size: .88rem; font-weight: 500; color: #fff;
  box-shadow: var(--shadow-md); animation: avisoEntra .25s var(--ease-out);
  transition: opacity .3s, transform .3s;
}
.aviso--ok    { background: var(--navy-dark); }
.aviso--error { background: #8a1c12; }
.aviso.is-saliendo { opacity: 0; transform: translateY(8px); }
@keyframes avisoEntra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ─────────────────── Carga ─────────────────── */
.cargando { padding: 3rem 1rem; text-align: center; color: var(--ink-mute); font-size: .9rem; }
.cargando::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto .85rem;
  border: 3px solid var(--line); border-top-color: var(--orange);
  border-radius: 50%; animation: giro .8s linear infinite;
}
