/* Estilos del sistema. Los colores de marca vienen de cada empresa (--brand, --accent). */
:root {
  --brand: #0f4c81; --accent: #f59e0b;
  --bg: #f4f6f9; --panel: #fff; --text: #1d2430; --muted: #6b7482; --line: #e3e7ee;
  --ok: #157f3b; --ok-bg: #e7f6ec; --err: #b42318; --err-bg: #fdecea; --warn-bg: #fff6e0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); }
h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: .2rem 0 .7rem; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .right { text-align: right; }
.text-danger { color: var(--err); }
.hp { position: absolute; left: -9999px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  padding: .6rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { filter: brightness(1.08); }
.btn-light { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn-accent { background: var(--accent); color: #1d2430; }
.btn-danger { background: var(--err); }
.btn-small { padding: .35rem .7rem; min-height: 32px; font-size: .88rem; }
.btn-big { padding: .85rem 1.3rem; font-size: 1.05rem; min-height: 48px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* Estructura del panel */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; background: var(--brand); color: #fff; padding: .55rem 1rem; min-height: 54px; }
.topbar a, .topbar .btn-link { color: #fff; }
.topbar .muted { color: rgba(255,255,255,.8); font-size: .9rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.topbar form { margin: 0; }
.branch-switch select { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: .25rem; }
.branch-switch option { color: #000; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; }
.brand img { height: 32px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.plain { text-decoration: none; }
.menu-btn { font-size: 1.4rem; cursor: pointer; display: none; user-select: none; }
.navtoggle { display: none; }
.sidebar { position: fixed; top: 54px; left: 0; bottom: 0; width: 230px; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: .6rem 0; z-index: 15; }
.sidebar a { display: flex; align-items: center; gap: .55rem; padding: .55rem 1.1rem; color: var(--text); text-decoration: none; }
.sidebar a:hover { background: #f1f4f8; }
.sidebar a.active { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); font-weight: 600; border-right: 3px solid var(--brand); }
.badge { background: var(--accent); color: #1d2430; border-radius: 10px; padding: 0 .45rem; font-size: .75rem; margin-left: auto; }
.content { margin-left: 230px; padding: 1.4rem 1.6rem 3rem; max-width: 1200px; }
.content.narrow, .portal .content { margin: 0 auto; max-width: 820px; padding: 1.2rem 1rem 3rem; }
.user-name { opacity: .9; font-size: .9rem; }
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .navtoggle:checked ~ .sidebar { transform: none; }
  .content { margin-left: 0; padding: 1rem .9rem 3rem; }
  .user-name, .topbar .muted { display: none; }
}

/* Avisos */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }
.alert { background: var(--warn-bg); border: 1px solid #f3d48a; padding: .7rem 1rem; border-radius: 8px; margin: .8rem 0; }

/* Tarjetas */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.cards .card { margin: 0; }
.stat { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: inherit; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat b { font-size: 1.45rem; }
.stat small { color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.2rem; }

/* Formularios */
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; font-weight: 500; margin-bottom: .75rem; }
.form label.inline, label.inline { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; }
input, select, textarea { font: inherit; padding: .55rem .65rem; border: 1px solid #cfd6e0; border-radius: 8px; background: #fff; color: var(--text); min-height: 40px; width: 100%; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; margin: 0 0 .9rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.grid2, .grid3, .grid4 { display: grid; gap: 0 .9rem; }
.grid2 { grid-template-columns: repeat(2, 1fr); } .grid3 { grid-template-columns: repeat(3, 1fr); } .grid4 { grid-template-columns: repeat(4, 1fr); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; }
@media (max-width: 700px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } .span2, .span3, .span4 { grid-column: auto; } }
details summary { cursor: pointer; font-weight: 600; margin: .3rem 0 .6rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; flex: 1 1 200px; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; }
.filters label input { flex: none; }
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.subnav { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.subnav a { padding: .4rem .75rem; border-radius: 20px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .88rem; }
.subnav a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.copy { font-family: ui-monospace, monospace; }
.logo-preview { height: 48px; vertical-align: middle; }

/* Precio en vivo, entrega, cotizador */
.price-box, .quote-box { background: color-mix(in srgb, var(--brand) 7%, #fff); border: 1px dashed color-mix(in srgb, var(--brand) 40%, #fff); border-radius: 8px; padding: .8rem 1rem; margin: .4rem 0 1rem; }
.price-box b { font-size: 1.5rem; }
.totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 1.2rem; margin-top: .8rem; }
.totals .grand b { font-size: 1.4rem; color: var(--brand); }
.pay-row, .item-row { display: grid; grid-template-columns: 160px 1fr 1fr; gap: .5rem; margin-bottom: .5rem; }
.item-row { grid-template-columns: 1fr 70px 120px; }
@media (max-width: 600px) { .pay-row { grid-template-columns: 1fr 1fr; } .pay-row input[name=reference] { grid-column: span 2; } }
.quick-pay { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.pay-status { margin: .6rem 0; font-weight: 600; }
.pay-status.ok { color: var(--ok); } .pay-status.err { color: var(--err); }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.grand td { font-weight: 700; }
.row-error td { background: #fff5f4; } .row-muted td { color: var(--muted); text-decoration: line-through; }
.pager { display: flex; gap: 1rem; justify-content: center; }
.list { list-style: none; padding: 0; } .list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.timeline { list-style: none; padding-left: 1rem; border-left: 2px solid var(--line); } .timeline li { margin-bottom: .6rem; }
.address { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; font-family: ui-monospace, monospace; white-space: pre-wrap; }

/* Etiquetas de estado */
.tag { display: inline-block; padding: .1rem .55rem; border-radius: 12px; font-size: .78rem; font-weight: 600; background: #eef1f5; color: #3b4452; white-space: nowrap; }
.tag-en_miami { background: #ede9fe; color: #5b21b6; } .tag-en_camino { background: #e0f2fe; color: #075985; }
.tag-en_bodega { background: #fef3c7; color: #92400e; } .tag-avisado { background: #ffedd5; color: #9a3412; }
.tag-listo { background: #dcfce7; color: #166534; } .tag-retirado { background: #e5e7eb; color: #374151; }
.tag-en_traslado { background: #fce7f3; color: #9d174d; } .tag-warn { background: var(--err-bg); color: var(--err); }
.tag-activa { background: var(--ok-bg); color: var(--ok); } .tag-suspendida { background: var(--err-bg); color: var(--err); } .tag-prueba { background: #e0f2fe; color: #075985; }

/* Portal */
.pkg-list { list-style: none; padding: 0; margin: 0; }
.pkg { display: flex; justify-content: space-between; gap: 1rem; background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: .8rem 1rem; margin-bottom: .6rem; }
.notice-list { list-style: none; padding: 0; } .notice-list li { display: flex; gap: .8rem; align-items: center; justify-content: space-between; background: #fff; border-radius: 8px; padding: .7rem 1rem; margin-bottom: .5rem; box-shadow: var(--shadow); }
.notice-list li > div { flex: 1; } .notice-list form { margin: 0; }
.notice-list li.sent { opacity: .45; }

/* Ingreso y registro */
body.auth { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 2rem 1rem; background: linear-gradient(160deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #000)); }
.auth-card { background: #fff; width: 100%; max-width: 440px; border-radius: 14px; padding: 1.6rem 1.5rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1rem; color: var(--brand); }
.auth-brand .brand img { height: 56px; max-width: 200px; }
.auth-card h1 { text-align: center; }
.lead { font-size: 1.05rem; }
.stack { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0; }

/* Página de ventas */
.landing-hero { background: linear-gradient(150deg, #0f2b46, #0f4c81); color: #fff; padding: 4rem 1rem 3rem; }
.landing-inner { max-width: 1050px; margin: 0 auto; padding: 0 1rem; }
.landing-hero h1 { font-size: 2.6rem; margin: .3rem 0 1rem; }
.landing-hero .lead { max-width: 640px; opacity: .92; margin-bottom: 1.5rem; }
.landing-hero .btn { margin-right: .6rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; opacity: .8; }
.grid-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: -1.5rem; }
.feature { background: #fff; border-radius: 12px; padding: 1.1rem; box-shadow: var(--shadow); }
.feature-icon { font-size: 1.6rem; } .feature p { color: var(--muted); margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.plan { background: #fff; border-radius: 12px; padding: 1.4rem; box-shadow: var(--shadow); border-top: 4px solid #0f4c81; }
.plan .price { font-size: 2rem; font-weight: 800; margin: .2rem 0; } .plan .price span { font-size: 1rem; color: var(--muted); font-weight: 400; }
.landing footer { padding: 2rem 1rem; }

/* Impresión: comprobantes, cierres, etiquetas */
body.print { background: #e9ecf1; }
.print-tools { display: flex; gap: .5rem; flex-wrap: wrap; padding: .8rem; justify-content: center; }
.paper { background: #fff; margin: 0 auto 2rem; padding: 12px; box-shadow: var(--shadow); color: #000; }
.print-80 .paper, .paper.print-80 { width: 80mm; max-width: 100%; font-size: 12px; font-family: ui-monospace, "Courier New", monospace; }
.print-sheet .paper { width: 216mm; max-width: 100%; padding: 18mm; font-size: 13px; }
.receipt .row { display: flex; justify-content: space-between; gap: 8px; }
.receipt .row.item span:first-child { flex: 1; }
.receipt .row span:last-child { white-space: nowrap; }
.receipt .grand { font-weight: 700; font-size: 1.15em; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt-logo { display: block; max-height: 60px; max-width: 70%; margin: 0 auto 6px; }
.receipt .void { text-align: center; font-weight: 700; border: 2px solid #000; margin: 6px 0; padding: 4px; }
.receipt .qr { width: 120px; height: 120px; margin: 6px auto; display: block; }
.break { word-break: break-all; }
.actions { max-width: 80mm; margin: 0 auto 2rem; display: flex; flex-direction: column; gap: .6rem; }
.print-sheet .actions { max-width: 216mm; }
.label { font-family: system-ui, sans-serif; }
.label-head { font-size: 13px; font-weight: 700; text-align: center; border-bottom: 2px solid #000; padding-bottom: 4px; }
.label-locker { font-size: 34px; font-weight: 900; text-align: center; letter-spacing: 1px; margin: 4px 0 0; }
.label-name { text-align: center; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.label .barcode { margin: 6px 0; }
.label-row { display: flex; justify-content: space-between; font-size: 12px; font-family: ui-monospace, monospace; }
@media print {
  body.print, body.print .paper { background: #fff; box-shadow: none; margin: 0; }
  .no-print, .print-tools { display: none !important; }
  .print-80 .paper { width: 72mm; padding: 0; }
  @page { margin: 4mm; }
  .portal .topbar, .portal .btn { display: none; }
}
