/* Portal de Clientes B2B — Grupo MIM
   Paleta corporativa de los minisitios (sites/redesign/docs/research/
   02-corp-image-spec.md §1): acero + tinta + papel + naranja industrial.
   Regla de marca "Sin redondeces": esquinas rectas en todo. */

:root {
  --steel-950: #081320;
  --steel-900: #0d2036;
  --steel-800: #14314f;
  --steel-700: #1d4569;
  --steel-600: #2c5b87;
  --tinta: #10161d;
  --papel: #F5F7F9;
  --linea: #DBE2EA;
  --suave: #5B6B7C;
  --naranja: #F26A21;
  --naranja-hot: #FF7E38;
  --error: #c0392b;
  --exito: #1a7f5a;
  --sombra: 0 14px 40px -16px rgba(8, 19, 32, .25);
  --sombra-suave: 0 2px 10px rgba(8, 19, 32, .10);

  /* Aliases históricos del portal → nueva paleta */
  --azul: var(--steel-700);
  --azul-oscuro: var(--steel-900);
  --acento: var(--exito);
  --fondo: var(--papel);
  --texto: var(--tinta);
  --texto-suave: var(--suave);
  --borde: var(--linea);
  --radio: 0;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--papel);
  color: var(--tinta);
}

h1, h2, h3, .tab, .btn-primary, .btn-cta {
  font-family: "Archivo", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ═══ Login ═══ */

.login-body { min-height: 100vh; }

.login-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}

.login-hero {
  background:
    linear-gradient(150deg, rgba(8,19,32,.92), rgba(13,32,54,.82) 60%, rgba(29,69,105,.75)),
    var(--hero-img, none) center/cover no-repeat,
    linear-gradient(150deg, var(--steel-950), var(--steel-900) 60%, var(--steel-600));
  color: #fff;
  display: flex;
  align-items: center;
  padding: 3rem 4rem;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .8rem;
  opacity: .75;
  margin: 0 0 1rem;
}

.login-logo {
  height: 52px;
  width: auto;
  background: #fff;
  padding: .3rem .8rem;
  margin-bottom: 1.4rem;
}

.login-hero h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.2;
  margin: 0 0 1.6rem;
  font-weight: 700;
}

.hero-list { list-style: none; padding: 0; margin: 0; }
.hero-list li {
  padding: .55rem 0 .55rem 1.9rem;
  position: relative;
  opacity: .92;
  font-size: 1.02rem;
}
.hero-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: .55rem;
  color: var(--naranja-hot);
  font-weight: 700;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: #fff;
  border-radius: 0;
  box-shadow: var(--sombra);
  padding: 2.4rem 2.2rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border-top: 3px solid var(--naranja);
}

.login-card h2 { margin: 0 0 .2rem; font-size: 1.5rem; }
.login-sub { color: var(--suave); font-size: .92rem; margin: 0 0 1.2rem; }

.login-card label { font-size: .85rem; font-weight: 600; margin-top: .7rem; }

.login-card input {
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .7rem .9rem;
  font-size: 1rem;
  width: 100%;
}
.login-card input:focus {
  outline: 2px solid var(--steel-700);
  outline-offset: 1px;
  border-color: var(--steel-700);
}

.form-error {
  background: #fdecea;
  color: var(--error);
  border: 1px solid #f5c6c0;
  border-radius: 0;
  padding: .6rem .8rem;
  font-size: .88rem;
  margin-top: .8rem;
}

.login-help { color: var(--suave); font-size: .82rem; text-align: center; margin: 1rem 0 0; }

/* ═══ Botones ═══ */

.btn-primary {
  background: var(--steel-800);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: .75rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-primary:hover { background: var(--steel-700); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-block { width: 100%; margin-top: 1.2rem; }

/* CTA principal (checkout, enviar chat): naranja industrial */
.btn-cta {
  background: var(--naranja);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: .75rem 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-cta:hover { background: var(--naranja-hot); }
.btn-cta:disabled { opacity: .6; cursor: wait; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .45rem .9rem;
  font-size: .88rem;
  color: var(--suave);
  cursor: pointer;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--steel-700); color: var(--steel-700); }
.btn-ghost:disabled { opacity: .45; cursor: default; }
.btn-ghost-inverso { border-color: rgba(255,255,255,.45); color: #fff; }
.btn-ghost-inverso:hover:not(:disabled) { border-color: #fff; color: #fff; }

/* ═══ App: header con logo de la sucursal ═══ */

.topbar {
  background: var(--steel-900);
  color: #fff;
  border-bottom: 3px solid var(--naranja);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 1.6rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-brand { display: flex; align-items: center; gap: .9rem; }
.brand-logo {
  height: 40px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  background: #fff;
  padding: .25rem .6rem;
}
.topbar-brand small { display: block; color: rgba(255,255,255,.72); }
.topbar-brand strong { font-size: 1.02rem; }

.btn-hamburguesa {
  background: transparent;
  border: 1px solid rgba(255,255,255,.45);
  color: #fff;
  font-size: 1.15rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-hamburguesa:hover { border-color: var(--naranja); color: var(--naranja-hot); }

.topbar-user { display: flex; align-items: center; gap: .8rem; font-size: .92rem; }
.badge-rol {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 0;
  padding: .2rem .7rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge-carrito { background: var(--naranja); }

/* ═══ Menú lateral (hamburguesa) ═══ */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 19, 32, .5);
  z-index: 50;
}
.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--steel-950);
  color: #fff;
  z-index: 51;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  box-shadow: var(--sombra);
}
.menu-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .4rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.14);
  margin-bottom: .6rem;
  font-weight: 600;
  font-size: .9rem;
}
.menu-head img { height: 34px; background: #fff; padding: .15rem .45rem; }
.menu-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,.85);
  padding: .8rem 1.2rem;
  font-size: .95rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.menu-item:hover:not(:disabled) { background: rgba(255,255,255,.07); }
.menu-item.activo { border-left-color: var(--naranja); background: rgba(242,106,33,.12); color: #fff; }
.menu-item:disabled { opacity: .4; cursor: default; }
.menu-ico { width: 1.3rem; text-align: center; }
.menu-seccion {
  padding: 1rem 1.2rem .3rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.45);
}

.app-main { max-width: 1100px; margin: 1.6rem auto; padding: 0 1.2rem; }

.alerta {
  background: #fff8e1;
  border: 1px solid #f0e0a8;
  border-left: 3px solid var(--naranja);
  border-radius: 0;
  padding: .7rem 1rem;
  margin-bottom: 1rem;
  font-size: .92rem;
}
.alerta.error { background: #fdecea; border-color: #f5c6c0; border-left-color: var(--error); color: var(--error); }

/* ═══ Hero de tienda (foto de la empresa del grupo) ═══ */

.hero-tienda {
  position: relative;
  min-height: 150px;
  margin-bottom: 1.4rem;
  background:
    linear-gradient(100deg, rgba(8,19,32,.88) 25%, rgba(13,32,54,.55) 65%, rgba(13,32,54,.15)),
    var(--hero-img, none) center/cover no-repeat,
    linear-gradient(100deg, var(--steel-950), var(--steel-800));
  color: #fff;
  display: flex;
  align-items: center;
  padding: 1.6rem 2rem;
}
.hero-texto h1 { margin: 0; font-size: 1.6rem; }
.hero-texto p { margin: .35rem 0 0; opacity: .85; font-size: .95rem; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}

.card {
  background: #fff;
  border-radius: 0;
  box-shadow: var(--sombra-suave);
  border: 1px solid var(--linea);
  padding: 1.4rem 1.5rem;
}
.card h3 { margin: 0 0 .8rem; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }
.card-sub { color: var(--suave); font-size: .88rem; margin: -.4rem 0 .9rem; }

.cifra { font-variant-numeric: tabular-nums; }
.cifra-grande { font-size: 2.1rem; font-weight: 700; margin: .2rem 0 1rem; color: var(--exito); }

.credito-detalle { display: flex; gap: 1.6rem; font-size: .85rem; color: var(--suave); }
.credito-detalle span { display: block; }
.credito-detalle strong { color: var(--tinta); font-size: .95rem; }

.credito-barra {
  margin-top: 1rem;
  height: 8px;
  border-radius: 0;
  background: #edf1f6;
  overflow: hidden;
}
.credito-barra-fill {
  height: 100%;
  background: var(--exito);
  width: 0;
  transition: width .5s ease;
}

.precio-form { display: flex; gap: .5rem; }
.precio-form input {
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .6rem .8rem;
  font-size: .95rem;
}
.precio-form input[type="number"] { width: 5rem; }
.precio-form input:focus {
  outline: 2px solid var(--steel-700);
  outline-offset: 1px;
  border-color: var(--steel-700);
}

/* ═══ Typeahead (búsqueda dinámica mientras escribes) ═══ */

.typeahead { position: relative; flex: 1; }
.typeahead input { width: 100%; }

.typeahead-lista {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  margin: 0; padding: .3rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 0;
  box-shadow: var(--sombra);
  max-height: 320px;
  overflow-y: auto;
  z-index: 30;
}

.typeahead-lista li {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  padding: .55rem .7rem;
  cursor: pointer;
}
.typeahead-lista li.activo { background: #eef4fa; }
.typeahead-lista li.typeahead-info {
  color: var(--suave);
  font-size: .86rem;
  cursor: default;
}

.typeahead-principal { font-weight: 700; font-size: .92rem; }
.typeahead-sub {
  color: var(--suave);
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.precio-resultado {
  margin-top: 1rem;
  border-top: 1px dashed var(--linea);
  padding-top: .9rem;
}
.precio-cifra { font-size: 1.7rem; font-weight: 700; margin: 0; }
.precio-desc { margin: .2rem 0; color: var(--tinta); }
.precio-explica { margin: 0; color: var(--suave); font-size: .82rem; }

/* ═══ Tienda: catálogo + carrito ═══ */

.tienda-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.2rem;
  align-items: start;
  margin-bottom: 1.4rem;
}
.card-buscador { margin-bottom: 1rem; }

.catalogo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .9rem;
}
.producto-card {
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 0;
  box-shadow: var(--sombra-suave);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.producto-card:hover { border-color: var(--steel-600); }
.producto-codigo { font-weight: 700; font-size: .9rem; color: var(--steel-700); }
.producto-codcli {
  font-size: .75rem;
  color: var(--steel-700);
  background: #eef4fa;
  padding: .1rem .45rem;
  align-self: flex-start;
}
.producto-desc {
  font-size: .88rem;
  margin: 0;
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.producto-precio { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.producto-precio small { font-size: .72rem; color: var(--suave); font-weight: 600; }
.producto-exist { font-size: .8rem; color: var(--suave); }
.producto-exist.sin-existencia { color: var(--error); }
.producto-agregar { display: flex; gap: .4rem; margin-top: .3rem; }
.producto-agregar input {
  width: 4.2rem;
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .4rem .5rem;
  font-size: .9rem;
}
.producto-agregar .btn-mini { flex: 1; padding: .45rem .5rem; font-size: .82rem; }

.paginacion-catalogo {
  border-top: none;
  padding: .9rem 0 0;
}

/* ═══ Carrito ═══ */

.tienda-carrito {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.carrito-head { display: flex; justify-content: space-between; align-items: center; }
.carrito-head h3 { margin: 0 0 .8rem; }
.carrito-vacio { color: var(--suave); font-size: .9rem; text-align: center; padding: 1.2rem 0; }

.carrito-item {
  border-top: 1px solid var(--linea);
  padding: .7rem 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .15rem .6rem;
  font-size: .86rem;
}
.carrito-item-codigo { font-weight: 700; color: var(--steel-700); font-size: .8rem; }
.carrito-item-desc {
  color: var(--tinta);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.carrito-item-quitar {
  grid-row: span 2;
  align-self: center;
  background: none;
  border: none;
  color: var(--suave);
  font-size: 1.05rem;
  cursor: pointer;
  padding: .3rem;
}
.carrito-item-quitar:hover { color: var(--error); background: #fdecea; }
.carrito-item-editor { display: flex; align-items: center; gap: .5rem; }
.carrito-item-editor input {
  width: 4.4rem;
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .3rem .45rem;
  font-size: .86rem;
}
.carrito-item-subtotal { font-weight: 700; font-variant-numeric: tabular-nums; }

.carrito-totales {
  border-top: 2px solid var(--linea);
  margin-top: .6rem;
  padding-top: .7rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.carrito-total-linea {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.02rem;
}
.carrito-total-linea small { color: var(--suave); font-weight: 600; }
.carrito-nota-iva { font-size: .76rem; color: var(--suave); }

/* ═══ Checkout ═══ */

.checkout-form {
  margin-top: .9rem;
  border-top: 1px dashed var(--linea);
  padding-top: .9rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.checkout-form label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--suave);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.checkout-form input, .checkout-form select, .checkout-form textarea {
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .5rem .6rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--tinta);
  background: #fff;
}
.checkout-form input:focus, .checkout-form select:focus, .checkout-form textarea:focus {
  outline: 2px solid var(--steel-700);
  outline-offset: 1px;
  border-color: var(--steel-700);
}

/* ═══ Estado de cuenta ═══ */

.card-estado { padding: 1.4rem 0 0; overflow: hidden; margin-bottom: 1.4rem; }

.edo-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  padding: .2rem 1.5rem 1rem;
}
.edo-kpis span { display: block; color: var(--suave); font-size: .8rem; }
.edo-kpis strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

.edo-buckets { padding: 0 1.5rem 1rem; }
.edo-barra {
  display: flex;
  height: 10px;
  overflow: hidden;
  background: #edf1f6;
}
.edo-seg { display: block; height: 100%; }
.edo-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.2rem;
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--suave);
}
.edo-leyenda i {
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: .3rem;
}
.edo-leyenda strong { color: var(--tinta); font-variant-numeric: tabular-nums; }

/* ═══ Preferencias de facturación ═══ */

.card-prefs { margin-bottom: 1.4rem; }
.prefs-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .4rem; }
.prefs-meta { color: var(--suave); font-size: .8rem; }

.prefs-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .9rem 1.2rem;
  margin-top: .6rem;
}
.prefs-form label { font-size: .82rem; font-weight: 600; color: var(--suave); display: flex; flex-direction: column; gap: .3rem; }
.prefs-form select, .prefs-form input[type="text"], .prefs-form textarea {
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .55rem .7rem;
  font-size: .92rem;
  font-family: inherit;
  color: var(--tinta);
  background: #fff;
}
.prefs-form select:focus, .prefs-form input:focus, .prefs-form textarea:focus {
  outline: 2px solid var(--steel-700);
  outline-offset: 1px;
  border-color: var(--steel-700);
}
.prefs-wide { grid-column: 1 / -1; }

.prefs-decimales {
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .5rem .8rem .7rem;
  display: flex;
  gap: 1.1rem;
  align-items: center;
}
.prefs-decimales legend { font-size: .82rem; font-weight: 600; color: var(--suave); padding: 0 .3rem; }
.prefs-decimales label { display: flex; flex-direction: row !important; align-items: center; gap: .3rem; font-size: .92rem !important; color: var(--tinta) !important; }

.prefs-acciones { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }
.prefs-msg { font-size: .88rem; }
.prefs-msg.ok { color: var(--exito); font-weight: 600; }
.prefs-msg.error { color: var(--error); }

/* ═══ Facturas ═══ */

.card-facturas { padding: 1.4rem 0 0; overflow: hidden; }
.facturas-head { display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; flex-wrap: wrap; gap: .5rem; }
.facturas-acciones { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.facturas-total { color: var(--suave); font-size: .85rem; }

.zip-grupo { display: flex; align-items: center; gap: .35rem; }
.zip-grupo input[type="date"] {
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .35rem .5rem;
  font-size: .82rem;
  color: var(--tinta);
}

.btn-mini {
  background: #eef4fa;
  color: var(--steel-700);
  border: 1px solid transparent;
  border-radius: 0;
  padding: .2rem .55rem;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-mini:hover:not(:disabled) { border-color: var(--steel-700); }
.btn-mini:disabled { opacity: .5; cursor: wait; }
.btn-peligro { background: #fdecea; color: #b3261e; }
.btn-peligro:hover:not(:disabled) { border-color: #b3261e; }
.aprobacion-acciones { white-space: nowrap; }
.aprobacion-acciones .btn-mini + .btn-mini { margin-left: .3rem; }
.descargas { white-space: nowrap; }
.descargas .btn-mini + .btn-mini { margin-left: .3rem; }

/* ═══ Detalle expandible (facturas / pedidos) ═══ */

.link-folio {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--steel-700);
  cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.link-folio:hover { border-bottom-color: var(--steel-700); }
.link-folio.abierto { border-bottom-color: var(--steel-700); }

.fila-detalle td { background: #f8fafc; padding: .8rem 1.5rem !important; }
.detalle-cargando { color: var(--suave); text-align: center; }

.tabla-mini { margin-top: 0; background: #fff; border: 1px solid var(--linea); }
.tabla-mini th, .tabla-mini td { padding: .45rem .8rem; font-size: .85rem; }
.tabla-mini th { border-top: none; border-bottom: 1px solid var(--linea); }

.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; margin-top: .6rem; }
.tabla th, .tabla td {
  text-align: left;
  padding: .7rem 1.5rem;
  border-top: 1px solid var(--linea);
  font-size: .92rem;
  white-space: nowrap;
}
.tabla th {
  border-top: none;
  color: var(--suave);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-vacia { text-align: center; color: var(--suave); padding: 2rem !important; }

.badge-estatus { padding: .15rem .6rem; font-size: .75rem; font-weight: 600; }
.badge-activa { background: #e6f6ee; color: var(--exito); }
.badge-cancelada { background: #fdecea; color: var(--error); }
.badge-cfdi { background: #eef4fa; color: var(--steel-700); padding: .15rem .5rem; font-size: .75rem; }

.paginacion {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: .9rem 1.5rem;
  border-top: 1px solid var(--linea);
  font-size: .88rem;
  color: var(--suave);
}

/* ═══ Pedidos ═══ */

.card-pedidos { padding: 1.4rem 0 0; overflow: hidden; margin-bottom: 1.4rem; }
.badge-pendiente { background: #fff8e1; color: #8a6d1a; }
.badge-autorizacion { background: #eef4fa; color: var(--steel-700); }
.badge-autorizado { background: #e6f6ee; color: var(--exito); }

/* ═══ Manual de usuario ═══ */

.manual { max-width: 780px; margin: 0 auto 1.4rem; }
.manual-seccion {
  border-top: 1px solid var(--linea);
  padding: .6rem 0 1rem;
}
.manual-seccion summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  padding: .5rem 0;
  color: var(--steel-800);
}
.manual-seccion summary:hover { color: var(--naranja); }
.manual-seccion p, .manual-seccion li { font-size: .92rem; line-height: 1.55; color: var(--tinta); }
.manual-seccion img {
  width: 100%;
  border: 1px solid var(--linea);
  margin-top: .6rem;
  box-shadow: var(--sombra-suave);
}
.manual-nota {
  border-top: 1px dashed var(--linea);
  padding-top: 1rem;
  color: var(--suave);
  font-size: .88rem;
}

/* ═══ Copiloto (chat Fase 3) ═══ */

.chat-fab {
  position: fixed;
  right: 1.6rem;
  bottom: 1.6rem;
  width: 56px;
  height: 56px;
  border-radius: 0;
  border: none;
  background: var(--naranja);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--sombra);
  z-index: 60;
  transition: background .15s ease, transform .15s ease;
}
.chat-fab:hover { transform: scale(1.05); background: var(--naranja-hot); }

.chat-panel {
  position: fixed;
  right: 1.6rem;
  bottom: 5.6rem;
  width: min(400px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 8rem));
  background: #fff;
  border-radius: 0;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
}
.chat-panel.expandida {
  width: min(720px, calc(100vw - 2rem));
  height: calc(100vh - 6rem);
  bottom: 1.6rem;
}

.chat-head {
  background: var(--steel-900);
  color: #fff;
  padding: .9rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .6rem;
}
.chat-head small { display: block; opacity: .8; font-size: .74rem; margin-top: .15rem; }
.chat-head-botones { display: flex; gap: .35rem; }
.chat-head .btn-ghost { padding: .15rem .55rem; }

.chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  background: var(--papel);
}
.chat-msg {
  max-width: 85%;
  padding: .55rem .8rem;
  font-size: .9rem;
  line-height: 1.35;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--steel-800);
  color: #fff;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--linea);
}
.chat-msg.pensando { color: var(--suave); font-style: italic; }

.chat-acciones {
  padding: .4rem 1rem;
  background: #eef4fa;
  border-top: 1px solid var(--linea);
  font-size: .76rem;
  color: var(--steel-700);
}
.chat-acciones span { display: block; padding: .1rem 0; }
.chat-acciones span::before { content: "⚙ "; }

.chat-form {
  display: flex;
  gap: .5rem;
  padding: .7rem;
  border-top: 1px solid var(--linea);
}
.chat-form input {
  flex: 1;
  border: 1px solid var(--linea);
  border-radius: 0;
  padding: .55rem .95rem;
  font-size: .9rem;
}
.chat-form input:focus { outline: 2px solid var(--steel-700); border-color: var(--steel-700); }
.chat-form .btn-cta { padding: .55rem 1rem; }

/* ═══ Responsive ═══ */

@media (max-width: 960px) {
  .tienda-grid { grid-template-columns: 1fr; }
  .tienda-carrito { position: static; max-height: none; }
}

@media (max-width: 860px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-hero { padding: 2.2rem; }
  .topbar { padding: .6rem .9rem; }
  .topbar-user #user-name { display: none; }

  /* El chat ocupa toda la pantalla en móviles */
  .chat-panel, .chat-panel.expandida {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    right: 0;
    bottom: 0;
  }
  .chat-fab { right: 1rem; bottom: 1rem; }
}

/* ═══ Seguimiento de pedido: timeline + mapa del camión ═══ */
.seg-contenedor { margin-top: 1rem; border-top: 1px solid var(--linea); padding-top: .9rem; }
.seg-contenedor h4 {
  margin: 0 0 .7rem; font-size: .8rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--steel-700, #3a4a5a);
}
.seg-timeline {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0;
}
.seg-paso {
  flex: 1 1 0; min-width: 110px; position: relative;
  padding: 1.35rem .4rem .2rem; text-align: center;
}
.seg-paso::before {
  content: ""; position: absolute; top: .55rem; left: -50%; right: 50%;
  height: 2px; background: var(--linea);
}
.seg-paso:first-child::before { display: none; }
.seg-paso.hecho::before { background: var(--steel-600, #2c5b87); }
.seg-punto {
  position: absolute; top: .25rem; left: 50%; transform: translateX(-50%);
  width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--linea); border: 2px solid var(--papel);
}
.seg-paso.hecho .seg-punto { background: var(--steel-600, #2c5b87); }
.seg-paso.actual .seg-punto {
  background: var(--naranja); box-shadow: 0 0 0 4px rgba(242, 106, 33, .25);
}
.seg-titulo { display: block; font-size: .78rem; font-weight: 600; color: var(--tinta); }
.seg-paso:not(.hecho):not(.actual) .seg-titulo { color: #8a97a5; font-weight: 400; }
.seg-fecha { display: block; font-size: .7rem; color: #8a97a5; margin-top: .15rem; }
.seg-eta, .seg-ruta { margin: .55rem 0 0; font-size: .85rem; color: var(--tinta); }
.seg-ruta { color: var(--steel-700, #3a4a5a); }
.seg-mapa {
  height: 260px; margin-top: .8rem; border: 1px solid var(--linea);
  border-radius: 0; z-index: 0;
}
.seg-pos-nota { margin: .45rem 0 0; font-size: .78rem; color: #8a97a5; }
.seg-truck { font-size: 1.4rem; text-align: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
@media (max-width: 720px) {
  .seg-timeline { flex-direction: column; }
  .seg-paso { min-width: 0; text-align: left; padding: .2rem .4rem .2rem 1.6rem; }
  .seg-paso::before { top: .9rem; bottom: -.9rem; left: .55rem; right: auto; width: 2px; height: auto; }
  .seg-paso:last-child::before { display: none; }
  .seg-punto { top: .5rem; left: .55rem; }
}
