:root {
  --navy: #0B2545;
  --navy-deep: #071A33;
  --navy-soft: #EAF0FB;
  --red: #C81E2C;
  --red-deep: #94141F;
  --red-soft: #FDEAEC;
  --ink: #0A1628;
  --muted: #5B6B82;
  --line: #E2E6EC;
  --surface: #F4F6F9;
  --surface-2: #E9EDF3;
  --success: #1E8E5A;
  --success-soft: #E6F5EE;
  --warning: #C77700;
  --warning-soft: #FDF1E0;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; padding-bottom: 84px; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy); color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
}
.app-header-top { display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.logo span { color: #ff9095; }
.searchbar {
  margin-top: 12px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); border-radius: 12px; padding: 10px 12px;
  color: rgba(255,255,255,.85); font-size: 14px;
}
.brand-tabs {
  position: sticky; top: 84px; z-index: 20;
  display: flex; gap: 8px; overflow-x: auto;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.btab {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; background: var(--surface); color: var(--muted);
  white-space: nowrap;
}
.btab.active { background: var(--navy); color: #fff; }
.app-main { min-height: 40vh; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(6px);
}
.tabitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0; font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabitem.active { color: var(--navy); }
.nav-icon-wrap { position: relative; }
.nav-badge {
  position: absolute; top: -6px; right: -10px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; padding: 32px 24px; text-align: center;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}
.login-logo { font-size: 30px; font-weight: 700; color: #fff; }
.login-logo span { color: #ff9095; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.login-form input[type=text], .login-form input[type=email], .login-form input[type=password] {
  width: 100%; background: rgba(255,255,255,.12); border: none; border-radius: 12px;
  padding: 14px 16px; font-size: 15px; color: #fff;
}
.login-form input::placeholder { color: rgba(255,255,255,.55); }
.login-check { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.8); font-size: 13.5px; }
.btn-primary {
  width: 100%; background: var(--red); color: #fff; border: none; border-radius: 12px;
  padding: 14px; font-size: 15px; font-weight: 700;
}
.btn-primary:active { background: var(--red-deep); }
.btn-ghost {
  width: 100%; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 700;
}
.login-error { color: #ffb4b8; font-size: 13px; }
.login-note { max-width: 360px; font-size: 12px; color: rgba(255,255,255,.45); line-height: 1.5; }
.wholesale-register-link { display: flex; width: 100%; max-width: 360px; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,.07); color: rgba(255,255,255,.76); font-size: 12px; }
.wholesale-register-link b { color: #fff; }

/* ---------- Home ---------- */
.page-pad { padding: 20px 16px; }
.hello { font-size: 21px; font-weight: 700; margin: 0; }
.subtle { color: var(--muted); font-size: 14px; margin-top: 4px; }
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.brand-card {
  border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 16px;
  box-shadow: 0 12px 30px -18px rgba(10,20,40,.3);
  display: flex; flex-direction: column; justify-content: space-between; min-height: 84px;
}
.brand-card b { font-size: 15px; color: var(--navy); }
.brand-card span { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- Sub tabs (categoría) ---------- */
.sub-tabs { display: flex; gap: 6px; overflow-x: auto; background: var(--surface); padding: 8px 12px; }
.stab {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
}
.stab.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- Product grid/card ---------- */
.grid-toolbar { padding: 12px 16px 0; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px; }
.product-card {
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 12px 30px -18px rgba(10,20,40,.3); display: flex; flex-direction: column;
}
.product-thumb { position: relative; aspect-ratio: 1; background: var(--surface); }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.fav-btn {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 999px;
  background: rgba(255,255,255,.9); border: none; display: flex; align-items: center; justify-content: center;
}
.fav-btn svg { stroke: var(--muted); fill: none; }
.fav-btn.active svg { stroke: var(--red); fill: var(--red); }
.sale-badge {
  position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
}
.product-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.product-brand { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--red); letter-spacing: .03em; }
.product-name { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-sku { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.product-footer { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; padding-top: 6px; }
.product-price { font-size: 14px; font-weight: 800; color: var(--navy); }
.stock-line { font-size: 9.5px; font-weight: 700; }
.stock-line.ok { color: var(--success); }
.stock-line.out { color: var(--red); }
.add-btn {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; border: none;
  background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center;
}
.add-btn:disabled { background: var(--line); color: var(--muted); }
.empty-note { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
#grid-sentinel { height: 30px; }

/* ---------- Detalle de producto ---------- */
.detail-hero { position: relative; width: 100%; aspect-ratio: 1; background: var(--surface); }
.detail-hero img { width: 100%; height: 100%; object-fit: contain; padding: 28px; }
.thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; }
.thumb-strip button { width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 2px; }
.thumb-strip button.active { border-color: var(--red); }
.thumb-strip img { width: 100%; height: 100%; object-fit: contain; }
.detail-body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.detail-name { font-size: 19px; font-weight: 700; line-height: 1.3; }
.detail-meta { font-size: 12px; color: var(--muted); }
.detail-price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.detail-price { font-size: 26px; font-weight: 800; color: var(--navy); }
.detail-stock { font-size: 12.5px; font-weight: 700; }
.whatsapp-link {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 13px; font-size: 12.5px; font-weight: 600; color: var(--navy);
}
.detail-desc { font-size: 14px; line-height: 1.6; color: rgba(10,22,40,.8); margin-top: 8px; }
.detail-actions {
  position: sticky; bottom: 84px; margin-top: 16px; display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.97); padding: 12px 16px;
}
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; }
.icon-btn svg { stroke: var(--muted); fill: none; }
.icon-btn.active svg { stroke: var(--red); fill: var(--red); }
.qty-box { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.qty-box button { border: none; background: none; font-size: 16px; color: var(--navy); font-weight: 700; }
.related-section { padding: 16px; }
.related-section h2 { font-size: 15px; margin: 0 0 12px; }

/* ---------- Pedido / carrito ---------- */
.order-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.order-header h1 { font-size: 15px; margin: 0; }
.link-danger { color: var(--red); font-size: 12.5px; font-weight: 700; background: none; border: none; }
.order-list { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.order-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.order-item:last-child { border-bottom: none; }
.order-thumb { width: 48px; height: 48px; border-radius: 10px; background: var(--surface); flex-shrink: 0; object-fit: contain; padding: 4px; }
.order-item-body { flex: 1; min-width: 0; }
.order-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-item-sku { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.qty-stepper { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; }
.qty-stepper button { border: none; background: none; font-weight: 700; color: var(--navy); }
.remove-item { border: none; background: none; color: var(--muted); padding: 4px; }
.order-total-row { margin: 16px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.order-total-row b { font-size: 18px; color: var(--navy); }
.export-grid { margin: 0 16px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-btn { border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--navy); background: #fff; }
.export-btn.whatsapp { background: var(--success); color: #fff; border: none; }

/* ---------- Favoritos ---------- */
.remove-fav-btn { width: 100%; border: none; border-top: 1px solid var(--line); background: none; padding: 8px 0; font-size: 11px; font-weight: 700; color: var(--red); }

/* ---------- Perfil ---------- */
.profile-head { background: var(--navy); color: #fff; padding: 22px 18px; display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 999px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.profile-rows { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.profile-row { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-weight: 600; background: #fff; }
.profile-row .val { color: var(--muted); font-weight: 500; }
.logout-btn { margin-top: 8px; border: none; background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 13px; font-weight: 700; font-size: 14px; }

/* ---------- Escáner ---------- */
.scan-screen { min-height: calc(100vh - 84px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; background: var(--navy-deep); color: #fff; }
.scan-video { width: 100%; max-width: 320px; border-radius: 16px; border: 2px solid rgba(255,255,255,.4); }
.scan-input { width: 100%; max-width: 320px; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 14px; }
.scan-input input { flex: 1; background: none; border: none; color: #fff; font-size: 14px; }
.scan-input input::placeholder { color: rgba(255,255,255,.5); }

/* ---------- Admin ---------- */
.admin-topbar { background: var(--navy); color: #fff; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
.admin-topbar b { font-size: 14px; }
.admin-topbar a { font-size: 12px; color: rgba(255,255,255,.75); }
.admin-body { padding: 16px; background: var(--surface); min-height: calc(100vh - 52px); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat-card .label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
.stat-card .value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat-card.success .value { color: var(--success); }
.stat-card.danger .value { color: var(--red); }
.stat-card.warning .value { color: var(--warning); }
.notice-box { margin-top: 14px; background: var(--warning-soft); color: var(--warning); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; font-weight: 500; }
.admin-panels { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.panel h2 { font-size: 13px; margin: 0 0 10px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 9px; }
.bar-row .bname { width: 100px; flex-shrink: 0; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); }
.bar-row .bcount { width: 30px; text-align: right; font-weight: 700; }
.alert-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.alert-row:last-child { border-bottom: none; }
.tag { flex-shrink: 0; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.tag.warn { background: var(--warning-soft); color: var(--warning); }
.tag.out { background: var(--red-soft); color: var(--red); }

/* ---------- Buscar ---------- */
.search-top { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); padding: 12px; display: flex; align-items: center; gap: 8px; }
.search-top a { flex-shrink: 0; color: var(--navy); display: flex; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.search-box input { flex: 1; border: none; background: none; font-size: 14px; }
.search-result-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.search-thumb { width: 46px; height: 46px; border-radius: 10px; background-size: cover; background-position: center; background-color: var(--surface); flex-shrink: 0; }

/* ---------- Install banner ---------- */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 40;
  background: var(--navy); color: #fff; border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 12px 30px -14px rgba(10,20,40,.4);
}
.install-close { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 999px; background: rgba(255,255,255,.12); border: none; color: #fff; }
.install-row { display: flex; align-items: center; gap: 12px; padding-right: 20px; }
.install-icon { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.install-text b { font-size: 13px; display: block; }
.install-text span { font-size: 12px; color: rgba(255,255,255,.75); }
.install-cta { flex-shrink: 0; background: var(--red); color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-size: 12px; font-weight: 700; }

/* ---------- Responsive: admin en tablet/desktop ---------- */
@media (min-width: 860px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .admin-panels { flex-direction: row; }
  .admin-panels .panel:first-child { flex: 1.3; }
  .admin-panels .panel:last-child { flex: 1; }
}

/* ---------- Product polish & responsive workspace ---------- */
:root {
  --shadow-sm: 0 8px 24px rgba(7, 26, 51, .08);
  --shadow-md: 0 18px 50px rgba(7, 26, 51, .14);
  --radius-lg: 20px;
}

:focus-visible { outline: 3px solid rgba(200, 30, 44, .35); outline-offset: 3px; }
button, a { touch-action: manipulation; }
.logo { display: inline-flex; align-items: center; gap: 9px; }
.brand-logo { width: clamp(156px, 20vw, 210px); height: auto; padding: 6px 10px; border-radius: 11px; background: #fff; }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: -.04em; }
.logo-word { color: #fff; font-size: 16px; font-weight: 500; letter-spacing: .02em; }
.logo-word strong, .login-logo strong, .desktop-nav-brand strong { color: #ff9ca2; font-weight: 900; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-user { display: none; font-size: 13px; color: rgba(255,255,255,.72); }
.header-order { padding: 8px 12px; border: 1px solid rgba(255,255,255,.24); border-radius: 10px; color: #fff; font-size: 12px; font-weight: 700; }
.desktop-nav-brand { display: none; }

.home-hero { position: relative; min-height: 250px; overflow: hidden; display: flex; align-items: center; border-radius: 24px; padding: 28px 24px; color: #fff; background: linear-gradient(135deg, #071a33 0%, #0b3159 56%, #124b72 100%); box-shadow: var(--shadow-md); }
.home-hero-copy { position: relative; z-index: 2; max-width: 590px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--red); font-size: 10px; line-height: 1; font-weight: 900; letter-spacing: .14em; }
.home-hero .eyebrow { color: #ff9ca2; }
.home-hero h1 { margin: 0; max-width: 520px; font-size: clamp(27px, 5vw, 44px); line-height: 1.05; letter-spacing: -.035em; }
.home-hero p { max-width: 520px; margin: 14px 0 0; color: rgba(255,255,255,.74); font-size: 14px; line-height: 1.6; }
.home-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.hero-primary, .hero-secondary { padding: 11px 15px; border-radius: 11px; font-size: 12.5px; font-weight: 800; }
.hero-primary { background: var(--red); color: #fff; }
.hero-secondary { border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: #fff; }
.home-hero-art { position: absolute; inset: 0 0 0 auto; width: 42%; opacity: .9; }
.hero-rf { position: absolute; right: 8%; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.055); font-size: 150px; font-weight: 950; letter-spacing: -.1em; }
.hero-brandmark { position: absolute; right: 7%; top: 50%; width: min(86%, 480px); transform: translateY(-50%) rotate(-4deg); opacity: .13; filter: saturate(.7) brightness(1.5); }
.water-line { position: absolute; right: -15%; width: 110%; height: 80px; border: 2px solid rgba(255,255,255,.09); border-radius: 50%; transform: rotate(-14deg); }
.water-line.one { top: 22%; }.water-line.two { top: 44%; right: -25%; }.water-line.three { top: 66%; right: -5%; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 30px 0 14px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-heading > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.brand-grid { margin-top: 0; }
.brand-card { position: relative; min-height: 112px; justify-content: flex-start; gap: 12px; padding: 15px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.brand-card > div:nth-child(2) { min-width: 0; }
.brand-card span { display: block; margin-top: 4px; }
.brand-monogram { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; background: var(--navy-soft); color: var(--navy); font-size: 16px; font-weight: 900; }
.brand-arrow { position: absolute; right: 14px; bottom: 13px; color: var(--red) !important; font-size: 17px !important; }
.brand-card:hover { transform: translateY(-2px); border-color: #c9d4e4; box-shadow: var(--shadow-sm); }

.product-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.product-card:hover { transform: translateY(-2px); border-color: #c9d4e4; box-shadow: var(--shadow-sm); }
.add-btn { transition: transform .15s ease, background .15s ease; }
.add-btn.added { background: var(--success); transform: scale(1.08); }
.app-toast { position: fixed; left: 50%; bottom: 92px; z-index: 100; max-width: min(90vw, 420px); transform: translateX(-50%); padding: 11px 15px; border-radius: 12px; background: var(--success); color: #fff; box-shadow: var(--shadow-md); font-size: 13px; font-weight: 700; text-align: center; }
.app-toast.error { background: var(--red-deep); }
.app-toast[hidden] { display: none; }

.login-screen { position: relative; overflow: hidden; }
.login-screen::before { content: ""; position: absolute; width: 520px; height: 520px; right: -220px; top: -200px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018); }
.login-brand, .login-form, .login-note { position: relative; z-index: 1; }
.login-brand p { margin: 10px 0 0; color: rgba(255,255,255,.66); font-size: 14px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; }
.login-logo img { width: min(78vw, 310px); height: auto; padding: 11px 15px; border-radius: 17px; background: #fff; box-shadow: var(--shadow-sm); }
.login-logo-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--red); color: #fff !important; font-size: 13px; font-weight: 900; }
.login-form { padding: 22px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: rgba(255,255,255,.07); box-shadow: var(--shadow-md); backdrop-filter: blur(10px); text-align: left; }
.field-label { margin: 2px 2px -6px; color: rgba(255,255,255,.72); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.login-form input[type=email], .login-form input[type=password] { border: 1px solid rgba(255,255,255,.12); }
.login-form input:focus { outline: none; border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.16); }

.security-notice { display: flex; flex-direction: column; gap: 4px; border: 1px solid #efcf9e; border-radius: 14px; padding: 13px 14px; background: var(--warning-soft); color: #8a5200; font-size: 12.5px; }
.password-panel { margin-top: 6px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.password-panel summary { padding: 13px 14px; cursor: pointer; color: var(--navy); font-size: 13.5px; font-weight: 700; }
.password-form { display: grid; gap: 11px; padding: 4px 14px 15px; }
.password-form label { display: grid; gap: 5px; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.password-form input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; }
.form-error, .form-success { margin: 0; font-size: 12px; font-weight: 700; }.form-error { color: var(--red); }.form-success { color: var(--success); }
.profile-rows form .logout-btn { width: 100%; }

.search-result-body { flex: 1; min-width: 0; }.search-result-name { overflow: hidden; font-size: 13.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }.search-result-meta { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }.search-result-price { color: var(--navy); font-size: 14px; font-weight: 800; }.search-message { padding: 28px; color: var(--muted); font-size: 14px; text-align: center; }.search-message.error { color: var(--red); }
.detail-layout { max-width: 1180px; margin: 0 auto; }.detail-info { min-width: 0; }
.catalog-alert { margin: 14px 16px 0; border: 1px solid #efcf9e; border-radius: 12px; padding: 11px 14px; background: var(--warning-soft); color: #855000; font-size: 12.5px; font-weight: 650; }.catalog-empty { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 16px; background: #fff; }.brand-card { flex-direction: row; align-items: center; }

/* ---------- Identidad y gestión de usuarios ---------- */
.desktop-nav-brand { min-height: 50px; padding: 8px; border-radius: 13px; background: #fff; }
.desktop-nav-brand img { width: 100%; height: auto; }
.admin-page { min-height: 100vh; background: var(--surface); }
.admin-topbar { min-height: 66px; gap: 18px; padding: 10px 18px; }
.admin-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.admin-brand img { width: 150px; height: auto; padding: 6px 9px; border-radius: 10px; background: #fff; }
.admin-brand span { color: rgba(255,255,255,.72); font-size: 12px; font-weight: 700; }
.admin-nav { display: flex; align-items: center; gap: 5px; }
.admin-nav a { padding: 8px 10px; border-radius: 9px; color: rgba(255,255,255,.72); font-size: 12px; font-weight: 700; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.admin-users-body { max-width: 1320px; margin: 0 auto; padding: 24px 16px 50px; }
.admin-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.admin-page-heading h1 { margin: 3px 0 5px; color: var(--navy); font-size: clamp(25px, 4vw, 36px); letter-spacing: -.035em; }
.admin-page-heading p { margin: 0; color: var(--muted); font-size: 13.5px; }
.user-total { flex: 0 0 auto; padding: 7px 11px; border: 1px solid #cfe1f4; border-radius: 999px; background: #fff; color: var(--navy); font-size: 12px; font-weight: 800; }
.admin-message { margin-bottom: 14px; border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 700; }
.admin-message.error { border: 1px solid #f1b9c0; background: #fff0f2; color: #9b1c2b; }
.admin-message.success { border: 1px solid #a9dfc8; background: var(--success-soft); color: #176c47; }
.admin-users-layout { display: grid; gap: 16px; }
.admin-users-layout .panel { padding: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-heading h2 { margin: 3px 0 0; color: var(--navy); font-size: 18px; }
.admin-user-form { display: grid; gap: 12px; }
.admin-user-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11.5px; font-weight: 800; }
.admin-user-form input, .admin-user-form select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #fff; color: var(--ink); font: inherit; }
.admin-user-form input:focus, .admin-user-form select:focus { outline: none; border-color: #74a9df; box-shadow: 0 0 0 3px rgba(4,120,201,.12); }
.admin-user-form small { margin-top: -5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.user-card-list { display: grid; gap: 10px; }
.user-card { display: grid; gap: 11px; border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: #fff; }
.user-card.is-current { border-color: #a9cbe9; background: #f9fcff; }
.user-card-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.user-avatar { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; background: linear-gradient(135deg, #0878cf, #13c4db); color: #fff; font-size: 13px; font-weight: 900; }
.user-identity { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.user-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.user-name-line strong { font-size: 13.5px; }
.user-identity > a { overflow: hidden; color: #075fa4; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-identity > span { color: var(--muted); font-size: 11px; }
.role-pill, .current-pill, .pending-password { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 3px 7px; font-size: 9.5px; font-weight: 800; }
.role-pill.admin { background: var(--navy-soft); color: var(--navy); }
.role-pill.operador { background: var(--success-soft); color: var(--success); }
.role-pill.cliente { background: #e2f6fb; color: #08748b; }
.current-pill { background: #e2f6fb; color: #06728d; }
.pending-password { background: var(--warning-soft); color: var(--warning); }
.status-pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 3px 7px; font-size: 9.5px; font-weight: 800; }
.status-pill.active { background: var(--success-soft); color: var(--success); }
.status-pill.pending { background: var(--warning-soft); color: var(--warning); }
.status-pill.rejected { background: #fff0f2; color: #a92131; }
.user-card-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 10.5px; }
.user-card-actions { display: flex; align-items: center; gap: 7px; }
.user-card-actions form { margin: 0; }
.btn-small { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; border: 1px solid #cbd8e7; border-radius: 9px; padding: 7px 11px; background: #fff; color: var(--navy); font-size: 11px; font-weight: 800; }
.btn-small.ghost { color: var(--muted); }
.btn-small.danger { border-color: #f1c4c9; background: #fff4f5; color: #a92131; }
.form-grid { display: grid; gap: 12px; }
.admin-nav-badge { display: inline-grid; min-width: 18px; height: 18px; place-items: center; border-radius: 999px; padding: 0 5px; background: #fff; color: var(--navy); font-size: 9px; }

/* ---------- Registro mayorista público ---------- */
.registration-page { min-height: 100vh; background: linear-gradient(135deg, #061d38 0%, #073e70 52%, #079bc7 100%); }
.registration-shell { display: grid; min-height: 100vh; align-items: center; gap: 28px; max-width: 1180px; margin: 0 auto; padding: 32px 18px; }
.registration-intro { color: #fff; }
.registration-brand { display: inline-flex; margin-bottom: 34px; border-radius: 16px; padding: 10px 14px; background: #fff; box-shadow: var(--shadow-md); }
.registration-brand img { width: min(64vw, 280px); height: auto; }
.registration-kicker { color: #68dced; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.registration-intro h1 { max-width: 620px; margin: 10px 0 14px; font-size: clamp(32px, 7vw, 58px); line-height: 1.02; letter-spacing: -.045em; }
.registration-intro > p { max-width: 590px; margin: 0; color: rgba(255,255,255,.72); font-size: 14px; line-height: 1.65; }
.registration-steps { display: grid; gap: 10px; margin: 28px 0 0; padding: 0; list-style: none; }
.registration-steps li { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.82); font-size: 12.5px; font-weight: 700; }
.registration-steps b { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(255,255,255,.09); color: #fff; font-size: 10px; }
.registration-card { border: 1px solid rgba(255,255,255,.3); border-radius: 24px; padding: 22px; background: rgba(255,255,255,.97); box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.registration-card-head h2, .registration-success h2 { margin: 5px 0 4px; color: var(--navy); font-size: 21px; letter-spacing: -.025em; }
.registration-card-head p, .registration-success p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.registration-form { display: grid; gap: 12px; margin-top: 18px; }
.registration-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11.5px; font-weight: 800; }
.registration-form input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: #fff; color: var(--ink); font: inherit; }
.registration-form input:focus { outline: none; border-color: #61a9df; box-shadow: 0 0 0 3px rgba(4,120,201,.12); }
.registration-privacy { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.registration-login-link { margin: 15px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.registration-login-link a { color: #0666aa; font-weight: 800; }
.hp-field { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.registration-success { display: grid; min-height: 390px; place-items: center; align-content: center; gap: 10px; text-align: center; }
.registration-success .btn-primary { max-width: 290px; margin-top: 10px; }
.success-check { display: grid; width: 64px; height: 64px; place-items: center; margin-bottom: 8px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 28px; font-weight: 900; }

/* ---------- Aprobaciones ---------- */
.approvals-body { max-width: 1320px; margin: 0 auto; padding: 24px 16px 50px; }
.approval-success { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.approval-success a { flex: 0 0 auto; border-radius: 9px; padding: 7px 10px; background: var(--success); color: #fff; font-size: 11px; }
.share-registration { display: grid; gap: 20px; padding: 20px; }
.share-registration-copy h2 { margin: 4px 0 7px; color: var(--navy); font-size: 21px; }
.share-registration-copy > p { max-width: 650px; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.share-link-box { display: flex; gap: 7px; margin-top: 15px; }
.share-link-box input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--muted); font: 12px var(--mono); }
.qr-card { display: flex; align-items: center; flex-direction: column; gap: 8px; }
#registration-qr { width: 180px; height: 180px; padding: 7px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
#registration-qr svg { display: block; width: 100%; height: 100%; }
.approval-tabs { display: flex; gap: 7px; margin: 18px 0 10px; }
.approval-tabs a { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; color: var(--muted); font-size: 11.5px; font-weight: 800; }
.approval-tabs a.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.approval-tabs span { display: inline-grid; min-width: 18px; height: 18px; place-items: center; margin-left: 3px; border-radius: 999px; background: rgba(255,255,255,.18); font-size: 9px; }
.approval-list { display: grid; gap: 10px; }
.approval-row { display: grid; gap: 13px; padding: 14px; }
.approval-company, .approval-contact { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.approval-company { align-items: center; flex-direction: row; gap: 11px; }
.approval-company h2 { margin: 0; color: var(--navy); font-size: 14px; }
.approval-company span, .approval-contact a, .approval-date span { color: var(--muted); font-size: 11px; }
.approval-contact strong { font-size: 12.5px; }
.approval-contact a { overflow: hidden; color: #075fa4; text-overflow: ellipsis; white-space: nowrap; }
.approval-date { display: flex; flex-direction: column; gap: 3px; }
.approval-date b { font-size: 11.5px; }
.approval-actions { display: flex; align-items: center; gap: 7px; }
.approval-actions form { flex: 1; margin: 0; }
.approve-btn, .reject-btn { width: 100%; min-height: 39px; border: 0; border-radius: 10px; padding: 9px 12px; font-size: 11.5px; font-weight: 800; }
.approve-btn { background: var(--success); color: #fff; }
.reject-btn { background: #fff0f2; color: #a92131; }
.approval-empty { display: grid; min-height: 240px; place-items: center; align-content: center; gap: 6px; text-align: center; }
.approval-empty > span { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 22px; font-weight: 900; }
.approval-empty h2 { margin: 4px 0 0; color: var(--navy); font-size: 17px; }
.approval-empty p { margin: 0; color: var(--muted); font-size: 12px; }

@media (min-width: 620px) {
  .brand-grid { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-pad { padding: 26px 24px; }
  .header-user { display: inline; }
  .order-item { padding: 13px 20px; }
  .order-thumb { width: 62px; height: 62px; }
  .user-card { grid-template-columns: minmax(250px, 1fr) auto auto; align-items: center; }
  .user-card-meta { justify-content: flex-end; }
  .registration-card { padding: 28px; }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .share-registration { grid-template-columns: minmax(0, 1fr) 210px; align-items: center; }
  .approval-row { grid-template-columns: minmax(220px, 1.2fr) minmax(210px, 1fr) auto; align-items: center; }
  .approval-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .approval-actions form { flex: 0 0 120px; }
}

@media (min-width: 860px) {
  .registration-shell { grid-template-columns: minmax(0, 1fr) minmax(440px, 520px); padding: 44px 30px; }
  .approval-row { grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) auto 190px; }
  .approval-actions { grid-column: auto; }
  .approval-actions form { flex: 1; }
}

@media (min-width: 1024px) {
  body.app-shell { padding-left: 224px; padding-bottom: 0; background: var(--surface); }
  .bottom-nav { inset: 0 auto 0 0; width: 224px; flex-direction: column; align-items: stretch; gap: 5px; padding: 22px 16px; border: 0; background: var(--navy-deep); backdrop-filter: none; }
  .desktop-nav-brand { display: flex; align-items: center; gap: 10px; margin: 0 5px 24px; color: #fff; }
  .desktop-nav-brand > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--red); font-size: 12px; font-weight: 900; }.desktop-nav-brand b { font-size: 14px; font-weight: 500; }
  .tabitem { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 13px; border-radius: 11px; color: rgba(255,255,255,.62); font-size: 13px; }
  .tabitem:hover, .tabitem.active { background: rgba(255,255,255,.09); color: #fff; }
  .app-header { padding: 18px 28px 16px; box-shadow: 0 5px 20px rgba(7,26,51,.12); }
  .app-header-top, .app-header .searchbar { max-width: 1320px; margin-left: auto; margin-right: auto; }
  .app-header .searchbar { max-width: min(1320px, calc(100% - 0px)); }
  .brand-tabs { top: 121px; padding: 12px max(28px, calc((100% - 1320px) / 2)); box-shadow: 0 5px 18px rgba(7,26,51,.05); }
  .app-main { width: 100%; max-width: 1376px; margin: 0 auto; }
  .page-pad { padding: 34px 28px 48px; }
  .home-hero { min-height: 300px; padding: 42px; }
  .brand-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 18px 28px 40px; }
  .grid-toolbar { padding: 20px 28px 0; }
  .product-body { padding: 13px 14px 15px; }.product-name { font-size: 14px; }.product-price { font-size: 16px; }
  .detail-layout { display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(380px, .95fr); gap: 46px; padding: 40px 28px 30px; }
  .detail-media { position: sticky; top: 190px; align-self: start; }.detail-hero { border: 1px solid var(--line); border-radius: 22px; background: #fff; overflow: hidden; }.detail-body { padding: 22px 0; }.detail-name { font-size: 30px; }.detail-actions { position: static; padding: 18px 0; border-bottom: 0; }.related-section { padding: 20px 28px 50px; }
  .order-header, .order-list, .order-total-row, .export-grid { max-width: 900px; margin-left: auto; margin-right: auto; }.order-header { padding-top: 32px; }.order-list { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; }.order-total-row { margin-top: 18px; }.export-grid { margin-bottom: 44px; }
  .profile-head, .profile-rows { max-width: 760px; margin-left: auto; margin-right: auto; }.profile-head { margin-top: 32px; border-radius: 18px 18px 0 0; }.profile-rows { padding: 20px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 18px 18px; background: #fff; }
  .scan-screen { min-height: calc(100vh - 180px); margin: 32px; border-radius: 24px; }
  .install-banner { left: auto; right: 24px; bottom: 24px; width: 410px; }
  .app-toast { bottom: 28px; }
  .admin-users-layout { grid-template-columns: minmax(300px, .72fr) minmax(540px, 1.7fr); align-items: start; }
  .user-editor { position: sticky; top: 82px; }
}

@media (max-width: 680px) {
  .admin-topbar { align-items: flex-start; flex-direction: column; }
  .admin-brand { width: 100%; justify-content: space-between; }
  .admin-brand img { width: 140px; }
  .admin-brand span { display: none; }
  .admin-nav { width: 100%; overflow-x: auto; }
  .admin-nav a { flex: 1 0 auto; text-align: center; }
  .admin-page-heading { align-items: flex-start; flex-direction: column; }
  .home-hero-art { opacity: .7; }
  .hero-brandmark { right: -10%; width: 90%; }
}

@media (min-width: 1320px) {
  .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
