/* Catálogo Distribuciones CYJ — cambia los colores de marca aquí */
:root {
  --brand: #161616;        /* negro principal */
  --brand-2: #3a3a3a;
  --accent: #d71f26;       /* rojo de acción */
  --accent-2: #b0161c;
  --ok: #138a4a;
  --warn: #b7791f;
  --danger: #c0392b;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --line: #dfe3ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, 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-2); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Barras */
.topbar { background: var(--brand); color: #fff; border-bottom: 3px solid var(--accent); }
.topbar .in { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; color: #fff; text-decoration: none; }
.logo .mark { width: 38px; height: 38px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 15px; font-weight: 900; }
.logo small { display: block; font-weight: 500; font-size: 11px; opacity: .8; letter-spacing: 1.5px; text-transform: uppercase; }
.topbar nav { display: flex; gap: 6px; margin-left: 12px; flex-wrap: wrap; }
.topbar nav button { background: transparent; color: #dce6f5; border: 0; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.topbar nav button.on, .topbar nav button:hover { background: rgba(255,255,255,.14); color: #fff; }
.spacer { flex: 1; }
.client-chip { text-align: right; font-size: 13px; line-height: 1.25; }
.client-chip b { display: block; font-size: 14px; }

/* Botones */
.btn { border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; background: var(--brand); color: #fff; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); } .btn.accent:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.ghost:hover { background: #eef2f8; }
.btn.light { background: rgba(255,255,255,.15); color: #fff; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: #3d4757; }
.field input, .field select, .field textarea, .input {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; width: 100%; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(215,31,38,.15); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(150deg, #1d1d1d 0%, #000 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: 44px; line-height: 1.05; margin: 0 0 16px; font-weight: 900; letter-spacing: -.5px; }
.auth-hero p { font-size: 17px; opacity: .85; max-width: 460px; }
.auth-hero ul { padding: 0; list-style: none; display: grid; gap: 10px; margin: 28px 0 0; }
.auth-hero li { display: flex; gap: 10px; align-items: center; opacity: .92; }
.auth-hero li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.auth-panel { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { margin: 0 0 4px; font-size: 26px; }
.tabs { display: flex; background: #e6eaf0; border-radius: 9px; padding: 4px; margin: 20px 0; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.btn.google { width: 100%; background: #fff; color: #1f1f1f; border: 1px solid #c8ccd2; padding: 11px 16px; }
.btn.google:hover { background: #f5f6f8; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.msg.err { background: #fdecea; color: #8a2318; }
.msg.ok { background: #e7f6ee; color: #0f5e33; }
.msg.info { background: #eaf1fb; color: #1b3e70; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { padding: 32px 20px; } .auth-hero h1 { font-size: 32px; } .auth-hero ul { display: none; } }

/* Catálogo */
.layout { max-width: 1280px; margin: 0 auto; padding: 20px 16px 80px; display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.side { display: flex; flex-direction: column; gap: 16px; align-self: start; position: sticky; top: 12px; }
@media (max-width: 960px) { .side { position: static; } }
.side h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.benefit { background: linear-gradient(135deg, #fff1f1, #fff); border: 1px solid #f3c9cb; }
.benefit .pct { font-size: 28px; font-weight: 900; color: var(--accent); line-height: 1; }
.benefit .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tier-badge { display: inline-block; background: #efefef; color: var(--brand); font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 99px; }
.seller a { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; font-size: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 260px; position: relative; }
.toolbar .search input { padding-left: 38px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: #3d4757; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.count-line { color: var(--muted); font-size: 14px; margin: 0 0 10px; }

.product { display: grid; grid-template-columns: 180px 1fr; gap: 20px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
@media (max-width: 640px) { .product { grid-template-columns: 1fr; } }
.product .img { background: #f6f7f9; border-radius: 8px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.product .img img { width: 100%; height: 100%; object-fit: contain; }
.product .img .ph { color: #a5afbd; font-size: 12px; text-align: center; padding: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.tag { border: 1.5px solid #3d4757; border-radius: 5px; padding: 1px 8px; font-size: 12px; color: #3d4757; font-weight: 700; text-transform: uppercase; }
.tag.origin-fabricado { border-color: var(--ok); color: var(--ok); }
.tag.origin-importado { border-color: #1d4f91; color: #1d4f91; }
.product h4 { margin: 6px 0 10px; font-size: 17px; text-transform: uppercase; }
.prices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; }
@media (max-width: 760px) { .prices { grid-template-columns: 1fr 1fr; } }
.prices .lbl { font-size: 13px; color: var(--muted); }
.prices .val { font-size: 18px; font-weight: 700; }
.prices .old { text-decoration: line-through; color: var(--muted); font-size: 13px; font-weight: 500; }
.disc-pill { background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.qty { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 36px; border: 0; background: #eef1f5; font-size: 18px; font-weight: 700; color: var(--brand); }
.qty input { width: 56px; text-align: center; border: 0; padding: 8px 4px; outline: none; }
.product .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; flex-wrap: wrap; }
.stock-ok { color: var(--ok); font-weight: 700; font-size: 14px; }
.stock-low { color: var(--warn); font-weight: 700; font-size: 14px; }
details.desc summary { cursor: pointer; color: var(--brand-2); font-weight: 600; font-size: 14px; }
details.desc p { margin: 8px 0 0; color: #3d4757; font-size: 14px; white-space: pre-line; }

/* Carrito */
.cart-fab { position: fixed; right: 18px; bottom: 18px; background: var(--accent); color: #fff; border: 0; border-radius: 99px; padding: 14px 20px; font-weight: 800; box-shadow: 0 8px 24px rgba(215,31,38,.35); display: flex; gap: 10px; align-items: center; z-index: 30; }
.cart-fab .n { background: #fff; color: var(--accent); border-radius: 99px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; padding: 0 6px; }
.drawer-bg { position: fixed; inset: 0; background: rgba(10,20,35,.45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: #fff; z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.15); }
.drawer header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer header h3 { margin: 0; }
.drawer .body { flex: 1; overflow: auto; padding: 12px 20px; }
.drawer footer { border-top: 1px solid var(--line); padding: 16px 20px; background: #fafbfc; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line .nm { font-weight: 600; font-size: 14px; }
.line .sub { font-size: 12px; color: var(--muted); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; margin-bottom: 12px; }
.totals .big { font-size: 20px; font-weight: 800; }
.x { background: none; border: 0; font-size: 22px; color: var(--muted); line-height: 1; }
.link-btn { background: none; border: 0; color: var(--danger); font-size: 12px; padding: 0; }

/* Tablas (admin y pedidos) */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: #fafbfd; }
.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #eef1f5; color: #3d4757; white-space: nowrap; }
.status.activo, .status.en_alegra, .status.despachado { background: #e7f6ee; color: #0f5e33; }
.status.pendiente, .status.nuevo { background: #fff4e0; color: #8a5a00; }
.status.inactivo, .status.cancelado, .status.error { background: #fdecea; color: #8a2318; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,35,.5); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { margin: 0; }
.modal .body { padding: 18px 20px; overflow: auto; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 18px 0 10px; font-weight: 700; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c2430; color: #fff; padding: 12px 18px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.demo-banner { background: #fff4e0; color: #8a5a00; text-align: center; font-size: 13px; padding: 6px; }

@media print {
  .topbar, .side, .toolbar, .cart-fab, .no-print { display: none !important; }
  body { background: #fff; }
}

/* Móvil */
@media (max-width: 640px) {
  .topbar .in { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .topbar nav { order: 3; width: 100%; margin: 0; overflow-x: auto; flex-wrap: nowrap; }
  .topbar nav button { white-space: nowrap; }
  .client-chip, #adminEmail { display: none; }
  .logo { font-size: 14px; }
  .layout { padding: 12px 12px 90px; gap: 12px; }
  .side .panel:not(.benefit) { padding: 12px; }
  .product { padding: 14px; gap: 12px; }
  .product .img { aspect-ratio: 16/10; }
  .prices .val { font-size: 16px; }
  .modal .body { padding: 14px; }
}
