:root {
  /* Paleta de marca Barco de Papel (tokens) */
  --c-rojo: #DD2728; --c-verde: #42B65E; --c-naranja: #E98824; --c-amarillo: #F7D511;
  --c-crema: #F2E7BC; --c-rosa: #DF3476; --c-violeta: #643381; --c-celeste: #16A9E1; --c-negro: #000000;
  /* Mapeo funcional (v1): base neutra; primario/acciones = celeste; marca = rojo */
  --bg: #f7f5ef;
  --surface: #ffffff;
  --ink: #1d2126;
  --muted: #6b7280;
  --line: #e7e3d8;
  --primary: var(--c-celeste);
  --primary-ink: #ffffff;
  --brand: var(--c-rojo);
  --accent: var(--c-naranja);
  --sidebar-bg: #16181d;
  --ok-bg: #e7f6ec; --ok-ink: #2f8c4d;
  --low-bg: #fdf1e2; --low-ink: #b56b15;
  --out-bg: #fdeceb; --out-ink: #c12a26;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; font-weight: 700; }
h2 { font-size: 1.25rem; margin: 1.4rem 0 .6rem; font-weight: 600; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; font-weight: 600; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

/* Topbar */
.topbar {
  background: var(--primary); color: var(--primary-ink);
  position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { font-weight: 700; color: #fff; font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; opacity: .92; }
.brand small { display: block; font-weight: 400; font-size: .7rem; opacity: .8; }
.nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { color: #eaf1f8; padding: .4rem .65rem; border-radius: 8px; font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.18); color: #fff; }
.nav-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.nav-user { color: #dbe7f1; font-size: .82rem; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: 9px; border: 1px solid transparent;
  font-size: .92rem; font-weight: 600; cursor: pointer; background: #eef1ee; color: var(--ink);
  line-height: 1; transition: filter .12s ease;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--out-bg); color: var(--out-ink); border-color: #f3c8c4; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-sm { padding: .32rem .55rem; font-size: .82rem; border-radius: 7px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Cards / surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1rem; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: .85rem; }

/* Product card */
.product-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.product-cover { aspect-ratio: 4/3; background: #eef0ee; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.product-cover .ph { color: #b6bcb5; font-size: .8rem; }
.product-body { padding: .8rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-body .name { font-weight: 600; line-height: 1.25; }
.product-body .sku { color: var(--muted); font-size: .78rem; }
.price { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.price small { font-weight: 500; color: var(--muted); font-size: .72rem; }
.product-foot { margin-top: auto; padding-top: .5rem; }

/* Badges */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-low { background: var(--low-bg); color: var(--low-ink); }
.badge-out { background: var(--out-bg); color: var(--out-ink); }
.badge-state { background: #eef1f6; color: var(--primary); }

/* Forms */
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=file], input[type=search], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: .95rem; background: #fff; color: var(--ink); font-family: inherit;
}
input[type=search] { -webkit-appearance: none; appearance: none; }
/* Cantidades: ocultar las flechitas nativas (spinner) y centrar el número;
   el control de +/- lo dan los botones .btn-stepper. */
input[type=number] { -moz-appearance: textfield; appearance: textfield; text-align: center; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
button { font-family: inherit; }
input::placeholder, textarea::placeholder { font-family: inherit; color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3ea; border-color: var(--primary); }
.help { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.errorlist { color: var(--out-ink); list-style: none; padding: 0; margin: .3rem 0; font-size: .85rem; }
.qty-row { display: flex; gap: .5rem; align-items: flex-end; }
.qty-row .field { margin: 0; flex: 1; }
.inline-form { display: inline; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: #f3f5f2; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Layout helpers */
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.detail-2col { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .detail-2col { grid-template-columns: 320px 1fr; } }
.def-list { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; font-size: .92rem; }
.def-list dt { color: var(--muted); }
.def-list dd { margin: 0; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.alert { padding: .65rem .9rem; border-radius: 9px; font-size: .92rem; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); color: var(--ok-ink); border-color: #bfe6cd; }
.alert.error { background: var(--out-bg); color: var(--out-ink); border-color: #f3c8c4; }
.alert.info, .alert.warning, .alert.debug { background: #eef4fb; color: var(--primary); border-color: #cfe0f1; }

/* Auth */
.auth-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 380px; }

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1.4rem; align-items: center; }
footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 0 0; }

/* Toggle grilla/lista */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-toggle a { padding: .35rem .7rem; font-size: .85rem; color: var(--muted); background: #fff; }
.view-toggle a.active { background: var(--primary); color: #fff; }
.view-toggle a:hover { text-decoration: none; }

/* Lista (una fila por producto) */
.list-row { display: flex; gap: .8rem; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row:last-child { border-bottom: none; }
.list-row .thumb { width: 52px; height: 52px; border-radius: 8px; background: #eef0ee; object-fit: cover; flex: none; }
.list-row .main { flex: 2; min-width: 180px; }
.list-row .main .name { font-weight: 600; }
.list-row .price-col { text-align: right; min-width: 120px; }

/* Widget "Agregar" desplegable (sin popup) */
details.add-disc > summary { list-style: none; display: inline-flex; }
details.add-disc > summary::-webkit-details-marker { display: none; }
details.add-disc > summary::marker { content: ''; }
.add-panel { margin-top: .5rem; padding: .6rem; border: 1px dashed var(--line); border-radius: 9px; background: #fafbfa; }
.add-panel .qty-row { align-items: flex-end; }
.units-out { display: inline-block; font-size: .82rem; color: var(--muted); font-weight: 500; margin-top: .2rem; }

/* Selector de pedido destino */
.dest-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.dest-row select { width: auto; min-width: 160px; }

/* Permisos (form de rol) */
.perm-group { margin-bottom: 1rem; }
.perm-group h4 { margin: .2rem 0 .4rem; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.perm-grid { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.perm-item { display: flex; gap: .5rem; align-items: center; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.perm-item input { width: auto; }
.perm-item label { margin: 0; font-weight: 500; }

/* Nota de ajuste de depósito */
.adj { color: var(--low-ink); background: var(--low-bg); border-radius: 6px; padding: .05rem .4rem; font-size: .78rem; font-weight: 600; }

.sticky-summary { position: sticky; top: 56px; z-index: 5; }

/* Catálogo con facetas */
.catalog-topbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.catalog-layout { display: flex; gap: 1.2rem; align-items: flex-start; }
.catalog-results { flex: 1; min-width: 0; }
.facets {
  width: 250px; flex: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem; box-shadow: var(--shadow);
  position: sticky; top: 68px; max-height: calc(100vh - 84px); overflow: auto;
}
.facets-head { display: none; }
.facet-search { margin-bottom: .6rem; }
.facet-group { margin-bottom: .9rem; }
.facet-group h4 { margin: 0 0 .3rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.facet-opt { display: flex; align-items: center; gap: .45rem; padding: .18rem 0; font-size: .88rem; cursor: pointer; }
.facet-opt input { width: auto; flex: none; }
.facet-lbl { flex: 1; }
.facet-count { color: var(--muted); font-size: .74rem; background: #eef1ee; padding: 0 .45rem; border-radius: 999px; }
.facets-foot { margin-top: .4rem; display: flex; flex-direction: column; gap: .4rem; }
.facets-foot button[type=submit] { display: none; }     /* desktop: auto-submit */
.filters-toggle { display: none; }
.filters-backdrop { display: none; }

/* Buscador arriba del listado + grilla 3 columnas (ronda 3) */
.catalog-searchbar { display: flex; gap: .5rem; margin-bottom: .8rem; }
.catalog-searchbar input { flex: 1; }
.catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1150px) { .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.thumb-link { flex: none; }
.thumb-ph { display: flex; align-items: center; justify-content: center; font-size: .58rem; color: #b6bcb5; }
.price-bulk { font-size: 1.25rem; }

/* Widget de agregar inline (cantidad visible + 1 botón) — ronda 4 */
.add-inline { display: flex; flex-direction: column; gap: .35rem; }
.add-inline .add-dest { width: 100%; font-size: .82rem; padding: .35rem .45rem; }
/* flex-wrap: en cards angostas (catálogo) los botones bajan de línea y no se
   recortan contra el overflow:hidden de la card. */
.qty-inline { display: flex; gap: .35rem; align-items: flex-end; flex-wrap: wrap; }
.add-inline .qty-inline .btn-primary { flex: 1 1 100%; }   /* "Agregar" a lo ancho de la card */
.qty-lbl { display: flex; flex-direction: column; font-size: .68rem; color: var(--muted); gap: .1rem; }
.qty-lbl input { width: 52px; padding: .35rem; text-align: center; }
.qty-stepper { display: flex; align-items: center; gap: 0; }
.qty-stepper input { border-radius: 0; flex: 1; width: 44px; min-width: 0; }
.btn-stepper { padding: .3rem .5rem; border: 1px solid var(--line); background: #f3f1ec; color: var(--ink); font-size: .95rem; font-weight: 700; cursor: pointer; line-height: 1; font-family: inherit; }
.btn-stepper:first-child { border-radius: 7px 0 0 7px; border-right: none; }
.btn-stepper:last-child { border-radius: 0 7px 7px 0; border-left: none; }
.btn-stepper:hover { background: #e7e4dd; }
.qty-inline .btn { white-space: nowrap; }
.row-action { min-width: 150px; }

/* Vista lista: alinear bien y no encimar en mobile */
@media (max-width: 620px) {
  .list-row { align-items: flex-start; }
  .list-row .main { flex: 1 1 100%; }
  .list-row .price-col, .list-row .row-action { flex: 1 1 auto; }
}

/* Autocompletado de carga rápida (dropdown) */
.ac-wrap { position: relative; }
.quick-add-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 9px 9px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.ac-item { padding: .5rem .7rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-active { background: #eef4fb; }
.ac-out { color: var(--muted); }

/* Armado de pedido: catálogo + panel "Tu pedido" sticky al costado */
.order-build { display: flex; gap: 1.2rem; align-items: flex-start; }
.order-build__catalog { flex: 1; min-width: 0; }
.order-build__cart { width: 320px; flex-shrink: 0; }
.cart-sticky {
  position: sticky; top: 70px; max-height: calc(100vh - 88px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem;
}
.cart-quickadd { padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.cart-items { overflow: auto; margin: .6rem 0; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.cart-item { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.cart-item:last-child { border-bottom: none; padding-bottom: 0; }
.cart-item__name { font-size: .9rem; font-weight: 600; line-height: 1.2; }
.cart-remove { color: var(--out-ink); padding: .2rem .45rem; line-height: 1; }
.cart-remove:hover { background: var(--out-bg); }
.cart-foot { border-top: 1px solid var(--line); padding-top: .7rem; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin: .3rem 0 .6rem; font-size: .9rem; }
.cart-total strong { font-size: 1.2rem; color: var(--primary); }
@media (max-width: 980px) {
  .order-build { flex-direction: column; }
  .order-build__cart { width: 100%; order: -1; }   /* en mobile, el pedido arriba */
  .cart-sticky { position: static; max-height: none; }
  .cart-items { max-height: 40vh; }
}

/* ── Armador (pantalla única, htmx) ─────────────────────────────────────── */
.build-head { margin-bottom: .6rem; }
.build-summary {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .6rem 1rem; margin-bottom: 1rem;
}
.build-summary__stats { display: flex; gap: 1.2rem; align-items: baseline; font-size: .95rem; }
.build-summary__total { font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.build-summary__actions { display: flex; gap: .5rem; }

.build-layout { display: flex; gap: 1.2rem; align-items: flex-start; }
.build-main { flex: 1; min-width: 0; }
.build-filters { margin-bottom: 1rem; }
.build-search { width: 100%; }
.build-facets { margin-top: .5rem; }
.build-facets summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.build-facet-group { margin: .5rem 0; }
.build-facet-title { display: block; font-size: .78rem; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; margin-bottom: .2rem; }
.build-facet-opt { display: inline-flex; gap: .25rem; align-items: center; margin: 0 .8rem .25rem 0; font-size: .9rem; }
.build-facet-opt input { width: auto; }

.build-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.build-prod {
  display: flex; gap: .6rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .7rem; box-shadow: var(--shadow);
}
.build-prod.in-order { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.build-prod__media { flex: 0 0 64px; height: 64px; border-radius: 8px; overflow: hidden; background: #eef0ee; display: flex; align-items: center; justify-content: center; }
.build-prod__media img { width: 100%; height: 100%; object-fit: cover; }
.build-prod__media .thumb-ph { font-size: .6rem; color: var(--muted); text-align: center; }
.build-prod__main { flex: 1; min-width: 0; }
.build-prod__name { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.build-price { margin-top: .3rem; font-size: .85rem; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.build-price__bulk strong { color: var(--primary); }
.build-prod__qty { flex: 0 0 auto; display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; justify-content: center; }
.build-prod__line { text-align: right; line-height: 1.3; }

.build-pager { grid-column: 1 / -1; display: flex; gap: .8rem; align-items: center; justify-content: center; margin-top: .6rem; }

.build-cart {
  width: 300px; flex-shrink: 0; position: sticky; top: 70px; max-height: calc(100vh - 90px);
  display: flex; flex-direction: column; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
}
.build-cart__items { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .6rem; }
.build-cart__item { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.build-cart__item:last-child { border-bottom: none; padding-bottom: 0; }
.build-cart__name { font-size: .9rem; font-weight: 600; line-height: 1.2; }
.build-cart__rm { color: var(--out-ink); padding: .15rem .4rem; line-height: 1; }
.build-cart__total { border-top: 1px solid var(--line); padding-top: .6rem; display: flex; justify-content: space-between; align-items: baseline; }
.build-cart__total strong { font-size: 1.15rem; color: var(--primary); }
@media (max-width: 980px) {
  .build-layout { flex-direction: column; }
  .build-cart { width: 100%; order: -1; position: static; max-height: none; }
}

/* Pedido: total destacado + barra de acciones (ronda 3) */
.total-panel { display: flex; flex-direction: column; gap: .1rem; }
.total-amount { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.actions-bar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* Home del cliente con aire (ronda 3) */
.btn-lg { padding: .7rem 1.3rem; font-size: 1rem; }
.home-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.3rem 0; }
.home-grid { display: grid; gap: 1.3rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 2fr 1fr; align-items: start; } }
.home-main > .panel, .home-side > .panel { margin-bottom: 1.3rem; }
.home-order-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.home-order-row:last-child { border-bottom: none; }

@media (max-width: 760px) {
  .catalog-layout { display: block; }
  .filters-toggle { display: inline-flex; }
  .facets {
    position: fixed; top: 0; left: 0; bottom: 0; width: 86%; max-width: 340px;
    z-index: 50; transform: translateX(-105%); transition: transform .2s ease;
    border-radius: 0; max-height: 100vh;
  }
  body.filters-open .facets { transform: translateX(0); }
  body.filters-open .filters-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .facets-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
  .facets-foot button[type=submit] { display: block; }
}

/* --- Barra lateral (navegación) --- */
.app { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 232px; flex: none; background: var(--sidebar-bg); color: #fff;
  display: flex; flex-direction: column; padding: 1rem .8rem;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.sidebar .brand { color: #fff; margin-bottom: .3rem; display: block; }
.brand-logo { height: 64px; width: auto; display: block; }
.brand-logo-sm { height: 36px; width: auto; display: block; }
.side-nav { display: flex; flex-direction: column; gap: .12rem; margin-top: .5rem; }
.side-nav a { color: #eaf1f8; padding: .5rem .7rem; border-radius: 8px; font-size: .95rem; }
.side-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.side-nav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.2); padding-top: .7rem; }
.side-foot .nav-user { color: #dbe7f1; font-size: .76rem; margin-bottom: .5rem; word-break: break-all; line-height: 1.5; }
.side-foot .badge-state { background: rgba(255,255,255,.15); color: #eaf1f8; }
.side-foot .btn-outline { color: #eaf1f8; border-color: rgba(255,255,255,.3); }
.side-foot .btn-outline:hover { background: rgba(255,255,255,.1); }
.main-area { flex: 1; min-width: 0; }
.mobile-bar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 860px) {
  .app { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; height: 100vh;
    width: 250px; transform: translateX(-105%); transition: transform .2s ease;
  }
  #nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  #nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .mobile-bar { display: flex; align-items: center; gap: .8rem; background: var(--sidebar-bg); color: #fff; padding: .5rem 1rem; position: sticky; top: 0; z-index: 30; }
  .mobile-bar .hamburger { font-size: 1.4rem; cursor: pointer; color: #fff; line-height: 1; }
  .mobile-bar .brand-sm { color: #fff; font-weight: 700; }
}

.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-ph { background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; }

@media (max-width: 620px) {
  .nav { width: 100%; order: 3; }
  .nav-right { order: 2; }
  .brand { order: 1; }
}
