:root {
  --primary: #1E3A5F;
  --primary-dark: #16324D;
  --primary-soft: #2A4A73;
  --background: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #EEF2F6;
  --text: #24303F;
  --muted: #6B7280;
  --border: #D9E1EA;
  --shadow: 0 10px 30px rgba(30, 58, 95, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
}

button, input, select, textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

.logo {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 28px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
}

.title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
}

.title p {
  margin: 6px 0 0;
  color: rgba(255,255,255,0.82);
  font-size: 14px;
}

.controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.controls input,
.controls select,
.controls button,
.panel input,
.panel select,
.panel textarea,
.admin-toolbar input,
.admin-toolbar select,
.admin-toolbar button,
.admin-login input,
.admin-login button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}

.controls input:focus,
.controls select:focus,
.panel input:focus,
.panel select:focus,
.panel textarea:focus,
.admin-toolbar input:focus,
.admin-toolbar select:focus,
.admin-login input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.10);
}

.container {
  padding: 20px 18px 110px;
  max-width: 1500px;
  margin: 0 auto;
}

.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #C6D3E2;
  box-shadow: 0 16px 34px rgba(30, 58, 95, 0.12);
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #fff;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.card .img-fallback {
  height: 200px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 14px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
  color: var(--text);
}

.card-meta {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.price {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin: 10px 0 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid #D8E2ED;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.btn {
  appearance: none;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 8px 18px rgba(30, 58, 95, 0.16);
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.drawerToggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  background: var(--primary);
  border: none;
  border-radius: 999px;
  color: #fff;
  padding: 14px 18px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(30, 58, 95, 0.20);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 45;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,0.12);
}

.drawer.open {
  transform: translateY(0);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(3px);
  display: none;
  z-index: 44;
}

.overlay.show {
  display: block;
}

.drawer-head {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #F8FAFC);
}

.drawer-body {
  padding: 16px 18px;
  overflow: auto;
  flex: 1;
}

.drawer-foot {
  border-top: 1px solid var(--border);
  padding: 16px 18px;
  background: #fff;
  display: grid;
  gap: 10px;
}

#quoteItems {
  display: grid;
  gap: 12px;
}

#quoteTotal {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.admin-wrap {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 16px;
}

.editor {
  padding: 18px;
}

.product-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 200px);
  overflow: auto;
}

.mini {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}

.mini img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.panel,
.admin-login,
.admin-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .controls input {
    grid-column: 1 / -1;
  }

  .admin-wrap {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .drawerToggle {
    left: 10px;
    right: 10px;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .title h1 {
    font-size: 22px;
  }

  .logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 24px;
  }
}

.hidden {
  display: none !important;
}

.admin-wrap {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
}

.admin-login {
  max-width: 420px;
  margin: 60px auto;
  padding: 24px;
  display: grid;
  gap: 12px;
  background: #fff;
  border: 1px solid #d9e1ea;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(30, 58, 95, 0.08);
}

.sidebar {
  border-right: 1px solid #d9e1ea;
  background: #fff;
  padding: 16px;
}

.editor {
  padding: 18px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e1ea;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(30, 58, 95, 0.08);
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.admin-toolbar {
  display: grid;
  gap: 10px;
}

.product-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.mini.active {
  border: 2px solid #1E3A5F;
}

.center-action {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.add-btn {
  background: #1E3A5F;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  min-width: 220px;
  cursor: pointer;
}

.add-btn:hover {
  background: #16324D;
}
.scroll-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 20px;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  z-index: 999;
}

.scroll-top:hover {
  background: #ea580c;
}
.client-login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(30,58,95,0.96), rgba(42,74,115,0.94)),
    radial-gradient(circle at top right, rgba(255,255,255,0.08), transparent 35%);
  z-index: 9999;
}

.client-login-box {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: rgba(255,255,255,0.98);
  border-radius: 22px;
  padding: 34px 28px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo {
  width: 110px;
  height: auto;
  margin-bottom: 14px;
  object-fit: contain;
}

.login-badge {
  display: inline-block;
  background: #eef2f6;
  color: #1E3A5F;
  border: 1px solid #d9e1ea;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.login-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #1E3A5F;
}

.login-subtitle {
  margin: 10px 0 20px;
  color: #5b6574;
  font-size: 14px;
  line-height: 1.5;
  max-width: 320px;
}

.client-login-box input {
  width: 100%;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid #d9e1ea;
  border-radius: 12px;
  background: #fff;
  color: #24303F;
  font-size: 15px;
}

.client-login-box input:focus {
  border-color: #1E3A5F;
  box-shadow: 0 0 0 4px rgba(30,58,95,0.10);
  outline: none;
}

.login-btn {
  width: 100%;
  margin-top: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
}

.login-help {
  margin-top: 14px;
  font-size: 12px;
  color: #6b7280;
}

.login-error {
  margin-top: 10px;
  color: #b91c1c;
  font-size: 14px;
  min-height: 20px;
}
.client-login .btn {
  position: static !important;
  width: 100%;
}
.access-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.access-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.access-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.access-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.access-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.access-table th,
.access-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.access-table th {
  background: #f8fafc;
  color: var(--primary);
  font-weight: 700;
}

.access-ok {
  color: #166534;
  font-weight: 700;
}

.access-fail {
  color: #b91c1c;
  font-weight: 700;
}

@media (max-width: 900px) {
  .access-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .access-stats {
    grid-template-columns: 1fr;
  }
}


.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: #fff;
  color: #24303F;
  padding: 22px;
  border-radius: 16px;
  text-align: center;
  width: min(360px, 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-content h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.modal-content p {
  margin: 0;
  color: #6B7280;
}

.modal-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-danger {
  background: #B42318 !important;
  color: #fff !important;
}

.promo-banner {
  margin: 16px 18px 18px;
  padding: 22px 24px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 20%, rgba(250, 204, 21, 0.34), transparent 28%),
    linear-gradient(135deg, #0B1220 0%, #1E3A5F 58%, #16324D 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  box-shadow: 0 16px 38px rgba(30, 58, 95, .28);
  border: 1px solid rgba(255,255,255,.14);
}

.promo-banner:hover {
  transform: translateY(-2px);
}

.promo-tag {
  display: inline-block;
  background: rgba(250, 204, 21, .16);
  color: #FACC15;
  border: 1px solid rgba(250, 204, 21, .35);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

.promo-banner strong {
  display: block;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.05;
  margin-bottom: 6px;
}

.promo-banner span {
  font-size: 14px;
  opacity: .92;
}

.promo-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.promo-action span {
  font-size: 44px;
  font-weight: 900;
  color: #FACC15;
  opacity: 1;
}

.promo-banner button {
  background: #FACC15;
  color: #111827;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 640px) {
  .promo-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .promo-action {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .logo {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    font-size: 22px;
  }

  .title h1 {
    font-size: 18px;
  }

  #clientLogoutBtn {
    padding: 9px 10px;
    font-size: 12px;
  }

  .promo-banner {
    margin: 10px 10px 12px;
    padding: 16px;
    border-radius: 16px;
    gap: 10px;
  }

  .promo-tag {
    font-size: 10px;
    padding: 5px 8px;
    margin-bottom: 6px;
  }

  .promo-banner strong {
    font-size: 22px;
  }

  .promo-banner span {
    font-size: 13px;
  }

  .promo-action span {
    font-size: 34px;
  }

  .promo-banner button {
    padding: 10px 14px;
    font-size: 13px;
  }

  .controls {
    padding: 10px;
    gap: 8px;
  }

  .controls input,
  .controls select,
  .controls button {
    padding: 12px;
    font-size: 14px;
    border-radius: 10px;
  }

  .container {
    padding: 12px 10px 90px;
  }

  .summary {
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
  }

  .grid {
    gap: 12px;
  }

  .card {
    border-radius: 12px;
  }

  .card img {
    height: 150px;
    padding: 6px;
  }

  .card-body {
    padding: 12px;
  }

  .card-body h3 {
    font-size: 15px;
    line-height: 1.25;
    margin: 0 0 8px;
  }

  .price {
    font-size: 20px;
    margin: 8px 0;
  }

  .chip {
    font-size: 11px;
    padding: 5px 8px;
  }

  .meta {
    font-size: 12px;
    line-height: 1.45;
  }

  .add-btn {
    width: 100%;
    min-width: unset;
    padding: 13px 14px;
    font-size: 15px;
    border-radius: 10px;
  }

  .drawerToggle {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    padding: 14px;
    font-size: 15px;
  }

  .drawer {
    width: 100vw;
  }

  .drawer-head {
    padding: 14px;
  }

  .drawer-body {
    padding: 12px;
  }

  .drawer-foot {
    padding: 12px;
    gap: 8px;
  }

  #quoteTotal {
    font-size: 18px;
  }

  .drawer-foot .btn,
  .drawer-foot button {
    width: 100%;
    padding: 13px;
  }

  .quote-item {
    font-size: 13px;
  }

  .scroll-top {
    bottom: 72px;
    right: 14px;
    width: 42px;
    height: 42px;
  }
}
.drawer-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: #1E3A5F;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
}

.drawer-head {
  position: relative;
  padding-right: 58px;
}

/* ===== MEJORA PROFESIONAL FILTROS / MARCAS ===== */

.catalog-shell {
  margin: 12px 18px 0;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.controls {
  border-bottom: none;
  padding: 0;
  background: transparent;
  grid-template-columns: 2fr 1fr 1fr auto;
  align-items: center;
}

.brand-filter-row {
  margin: 10px 18px 14px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.brand-filter-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-filter-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  min-width: 70px;
}

.brand-chips {
  flex: 1;
}

.brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 2px 0;
  align-items: center;
}

.brand-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(30,58,95,.06);
  transition: all .18s ease;
}
.brand-chip:hover {
  transform: translateY(-1px);
}
.brand-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.brand-chip:hover {
  background: var(--surface-2);
}

.brand-chip.active:hover {
  background: var(--primary-dark);
}

@media (max-width: 640px) {
  .catalog-shell {
    margin: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .brand-filter-row {
    margin: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .brand-filter-title {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .brand-chips {
    padding-bottom: 6px;
  }

  .brand-chip {
    padding: 7px 12px;
    font-size: 12px;
  }
}

.btn-secondary {
  background: #eef2f7;
  color: var(--primary);
  border: 1px solid var(--border);
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.admin-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

.admin-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
@media (max-width: 640px) {
  .drawer {
  width: 100vw;
  max-width: 100vw;
  height: 78vh;
  top: auto;
  bottom: 0;
  border-radius: 22px 22px 0 0;
  transform: translateY(100%);
  border-left: none;
}

  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
  }

  .drawer-body {
    padding-bottom: 150px;
  }

  .drawer-foot {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: #fff;
    box-shadow: 0 -8px 24px rgba(0,0,0,.08);
  }

  #quoteItems {
    gap: 10px;
  }

  .quote-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
  }
}