/* =========================
   PORTAL CLIENTES CDIMEX
========================= */

:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.86);
  --solid: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17, 24, 39, 0.09);
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #ca8a04;
  --blue: #2563eb;
  --cidix: #9cad81;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(156, 173, 129, 0.20), transparent 30%),
    radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.08), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font-family: inherit;
}

.app {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cidix);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 900;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 42px;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 720px;
  line-height: 1.5;
}

.hero-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
}

.hero-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.hero-card strong {
  font-size: 18px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px;
  width: fit-content;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.tab {
  border: 0;
  border-radius: 15px;
  padding: 11px 16px;
  background: transparent;
  color: #374151;
  font-weight: 800;
  cursor: pointer;
}

.tab.active {
  background: #111827;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.16);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

#view-stock .toolbar {
  grid-template-columns: 2fr repeat(5, 1fr);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(156, 173, 129, 0.70);
  box-shadow: 0 0 0 4px rgba(156, 173, 129, 0.16);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.4 1.2L6 5.8L10.6 1.2' stroke='%23111827' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
  padding-right: 42px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 12px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.product-image-wrap {
  height: 210px;
  background: #ffffff;
  display: grid;
  place-items: center;
  padding: 16px;
}

.product-image-wrap img {
  max-width: 100%;
  max-height: 178px;
  object-fit: contain;
  display: block;
  background: #ffffff;
}

.image-placeholder {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: rgba(17, 24, 39, 0.06);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 28px;
}

.product-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-codes {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.product-price {
  margin-top: auto;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.badge-gray {
  background: #f3f4f6;
  color: #374151;
}

.table-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 320px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
  background: rgba(255, 255, 255, 0.72);
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(249, 250, 251, 0.98);
  color: #374151;
  font-size: 12px;
}

td.product-name {
  font-weight: 800;
}

.footer {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  padding-top: 22px;
}

.empty {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar,
  #view-stock .toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 800px) {
  .app {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .tabs {
    width: 100%;
    overflow: auto;
  }

  .tab {
    white-space: nowrap;
  }

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

  .toolbar,
  #view-stock .toolbar {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
