/* Compra Sur — UI mobile-first, moderna y amigable */

:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --bg: #f0f4f1;
  --bg-accent: linear-gradient(165deg, #e8f7f1 0%, #f5f0e8 48%, #eef6ff 100%);
  --surface: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.72);
  --text: #122018;
  --muted: #5a6b62;
  --muted-2: #8a9a91;
  --accent: #0d9f73;
  --accent-hover: #0b855f;
  --accent-soft: rgba(13, 159, 115, 0.12);
  --accent-ring: rgba(13, 159, 115, 0.35);
  --citrus: #f4a01b;
  --danger: #dc2626;
  --border: rgba(18, 32, 24, 0.08);
  --border-strong: rgba(18, 32, 24, 0.12);
  --shadow-sm: 0 1px 2px rgba(18, 32, 24, 0.06);
  --shadow: 0 8px 28px rgba(18, 32, 24, 0.08);
  --shadow-lg: 0 20px 50px rgba(18, 32, 24, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --header-h: 56px;
  --touch: 44px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a {
  color: var(--accent-hover);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

/* ——— Header ——— */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 8px max(16px, env(safe-area-inset-right)) 8px
    max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.nav-links a,
.nav-links button {
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  padding: 10px 14px;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, border-color 0.18s,
    transform 0.12s;
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--text);
  background: #fff;
  border-color: var(--border-strong);
}

.nav-links a:active,
.nav-links button:active {
  transform: scale(0.97);
}

#btn-admin {
  font-size: 1.15rem;
  padding-inline: 12px;
}

/* ——— Main layout ——— */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

body.page-products main {
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

body.page-carrito main {
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

h1 {
  font-size: clamp(1.45rem, 4.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 8px;
}

h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin: 28px 0 12px;
}

h2:first-of-type {
  margin-top: 0;
}

.lead {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 1rem;
  max-width: 52ch;
}

/* ——— Hero / secciones inicio ——— */
.hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fdfb 100%);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 20px 18px 22px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.section-block {
  margin-top: 8px;
}

/* ——— Tarjetas selección ——— */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr));
  gap: 12px;
}

.card-select {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: var(--shadow-sm);
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  overflow: hidden;
}

.card-select::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 80% at 10% 0%,
    var(--accent-soft),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.25s;
}

.card-select:hover {
  border-color: rgba(13, 159, 115, 0.35);
}

.card-select:hover::before {
  opacity: 1;
}

.card-select:active {
  transform: scale(0.98);
}

.card-select.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow);
}

.card-select.selected::before {
  opacity: 1;
}

.card-select .card-ico {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
}

.card-select .card-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f3f6f4;
  margin-bottom: 8px;
}

.card-select .title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.card-select .sub {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ——— Botones ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  min-height: var(--touch);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(145deg, #10b981 0%, var(--accent) 45%, #0a7d5c 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(13, 159, 115, 0.35);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(13, 159, 115, 0.42);
}

.btn-primary:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-lg {
  width: 100%;
  max-width: 100%;
  padding-block: 16px;
  font-size: 1.05rem;
  border-radius: 16px;
}

.btn-secondary {
  background: #eef2f0;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #e4eae7;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.btn-block {
  width: 100%;
}

/* ——— Pestañas ——— */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 10px 18px;
  min-height: var(--touch);
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.tab.active {
  background: #fff;
  color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

/* ——— Buscador ——— */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--muted-2);
  pointer-events: none;
  opacity: 0.85;
}

.search-wrap.no-icon::before {
  display: none;
}

.search-wrap.no-icon .search {
  padding-left: 16px;
}

.search {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search::placeholder {
  color: var(--muted-2);
}

/* ——— Lista productos ——— */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.product-row:active,
.cart-row:active {
  box-shadow: var(--shadow);
}

.product-row img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, #eef2f0, #e4e9e6);
}

.product-meta .name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.product-meta .sub {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f3f6f4;
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--border);
}

.qty-control button {
  width: var(--touch);
  height: var(--touch);
  min-width: var(--touch);
  border-radius: 999px;
  border: none;
  background: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, transform 0.1s;
}

.qty-control button:active {
  transform: scale(0.92);
  background: #eef2f0;
}

.qty-control span {
  min-width: 28px;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0 4px;
}

/* ——— FAB / barra carrito ——— */
.fab-cart {
  position: fixed;
  z-index: 90;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  left: auto;
}

.fab-cart a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(145deg, #10b981, var(--accent));
  color: #fff;
  padding: 14px 22px;
  min-height: 52px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 10px 32px rgba(13, 159, 115, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.fab-cart a:active {
  transform: scale(0.98);
}

.badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent-hover);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

@media (max-width: 560px) {
  .fab-cart {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .fab-cart a {
    width: 100%;
    border-radius: 16px;
    padding-block: 16px;
    font-size: 1rem;
  }
}

/* ——— Barra fija checkout (carrito) ——— */
.sticky-action {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.97) 55%,
    rgba(255, 255, 255, 0.75) 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 40px rgba(18, 32, 24, 0.06);
}

.sticky-action .btn-primary {
  width: 100%;
  box-shadow: 0 6px 24px rgba(13, 159, 115, 0.4);
}

/* ——— Resumen / formularios ——— */
.summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.summary-row span:last-child {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.summary-row.total {
  font-weight: 800;
  color: var(--text);
  font-size: 1.05rem;
  border-top: 1px dashed var(--border-strong);
  margin-top: 6px;
  padding-top: 14px;
}

.form-grid label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  color: var(--muted-2);
}

.form-grid input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 14px;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-grid input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.warn {
  background: linear-gradient(135deg, #fffbeb, #fff7ed);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #92400e;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 10px;
  line-height: 1.45;
}

.success-panel {
  background: linear-gradient(165deg, #ffffff, #f4fdf9);
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--border);
  padding: 28px 20px 26px;
  text-align: center;
  box-shadow: var(--shadow);
}

.order-code {
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-hover);
  margin: 14px 0;
  padding: 12px 8px;
  background: rgba(13, 159, 115, 0.08);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(13, 159, 115, 0.25);
}

.status-pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.st-pendiente {
  background: #fff7ed;
  color: #c2410c;
}
.st-confirmado {
  background: #eff6ff;
  color: #1d4ed8;
}
.st-en_compra {
  background: #f5f3ff;
  color: #6d28d9;
}
.st-en_camino {
  background: #ecfeff;
  color: #0e7490;
}
.st-entregado {
  background: #ecfdf5;
  color: #047857;
}
.st-cancelado {
  background: #fef2f2;
  color: #b91c1c;
}

/* ——— Tablas ——— */
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table.data th,
table.data td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

table.data th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted-2);
  background: #f8faf9;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr:hover td {
  background: #fafcfb;
}

/* ——— Modal ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 28, 22, 0.48);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 540px) {
  .modal-backdrop {
    align-items: center;
    padding: 18px;
  }
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 440px;
  max-height: min(90dvh, 560px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 540px) {
  .modal {
    border-radius: var(--radius);
    padding: 24px;
  }
}

@keyframes sheetUp {
  from {
    transform: translateY(18px);
    opacity: 0.85;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal h2 {
  margin-top: 0;
  font-size: 1.15rem;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ——— Admin ——— */
.admin-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 18px;
  align-items: start;
}

.admin-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--header-h) + 12px);
}

.admin-nav button {
  text-align: left;
  padding: 12px 14px;
  min-height: var(--touch);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  transition: background 0.18s, color 0.18s;
}

.admin-nav button:hover {
  background: #f3f6f4;
  color: var(--text);
}

.admin-nav button.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 280px;
  box-shadow: var(--shadow-sm);
}

.admin-panel h2 {
  margin-top: 0;
  font-size: 0.78rem;
}

/* ——— Admin: respaldo visual para inputs nativos (evita look “Windows 95”) ——— */
#panel-products input[type="text"],
#panel-products input[type="number"],
#panel-products input[type="email"],
#panel-products input[type="password"],
#panel-products input:not([type]),
#panel-products select,
#panel-supers input:not([type]),
#panel-supers input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  min-height: 48px;
  box-shadow: var(--shadow-sm);
  outline: none;
}

#panel-products select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted-2) 50%),
    linear-gradient(135deg, var(--muted-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

#panel-products input:focus,
#panel-products select:focus,
#panel-supers input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-sm);
}

/* ——— Admin: arregla chips aunque el checkbox sea visible (fallback) ——— */
.super-chip input[type="checkbox"] {
  margin: 0;
  width: 18px;
  height: 18px;
}

/* Si el CSS nuevo no se aplicó, al menos alinea bien */
.super-chip {
  gap: 10px;
}

/* ——— Admin: oculta file input nativo dentro de photo-drop SIEMPRE ——— */
.photo-drop input[type="file"].photo-input-native {
  position: absolute !important;
  opacity: 0 !important;
  width: 0.01px !important;
  height: 0.01px !important;
  pointer-events: none !important;
}

.inline-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-edit input {
  flex: 1;
  min-width: 160px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
}

.inline-edit select {
  min-width: 160px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
}

/* ——— Admin: supermercados (logo + acciones) ——— */
.super-admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.super-admin-head {
  display: grid;
  /* `auto` permite que, si no hay logo (hidden), no se reserve espacio */
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.super-admin-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f3f6f4;
}

/* Si no hay logo, que no “coma” ancho en la grilla */
.super-admin-logo[hidden] {
  display: none !important;
}

.super-admin-title input {
  width: 100%;
}

.super-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Evita cortes: nombre + tipo en columna, ancho completo */
.super-admin-title {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.super-admin-title .pf-input,
.super-admin-title .pf-select,
.super-admin-title input,
.super-admin-title select {
  width: 100%;
}

/* Hace más legible el nombre (no se “achica” tanto) */
.super-admin-title .pf-input {
  font-size: 1.06rem;
  padding: 12px 14px;
}

/* En pantallas chicas, que el título tenga más aire */
@media (max-width: 560px) {
  .super-admin-head {
    gap: 10px;
  }
  .super-admin-title {
    gap: 8px;
  }
}

.super-admin-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  min-height: var(--touch);
  border-radius: 14px;
  border: 1px dashed rgba(13, 159, 115, 0.45);
  background: rgba(13, 159, 115, 0.06);
  color: var(--accent-hover);
  font-weight: 800;
  cursor: pointer;
}

.super-admin-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 560px) {
  .super-admin-head {
    grid-template-columns: 44px 1fr;
  }
  .super-admin-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  .super-admin-actions > * {
    width: 100%;
  }
}

/* ——— Utilidades ——— */
.gate-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  max-width: 420px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}

code {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.86em;
  background: #eef2f0;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}

.success-panel h1 {
  font-size: clamp(1.35rem, 5vw, 1.65rem);
  text-transform: none;
  letter-spacing: -0.03em;
  color: var(--text);
}

#order-detail h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ——— Responsive productos / carrito filas ——— */
@media (max-width: 520px) {
  .product-row {
    grid-template-columns: 64px 1fr;
    grid-template-rows: auto auto;
  }

  .product-row img {
    width: 64px;
    height: 64px;
    grid-row: span 2;
  }

  .product-row .qty-control {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: center;
    margin-top: 4px;
  }

  .cart-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    text-align: left;
  }

  .cart-row .qty-control {
    justify-self: stretch;
    justify-content: center;
    margin-top: 6px;
  }
}

@media (max-width: 720px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 8px;
  }

  .admin-nav button {
    white-space: nowrap;
    flex: 0 0 auto;
  }
}

/* ——— Admin: formulario producto (móvil / simple) ——— */
.admin-product-form {
  margin-bottom: 24px;
}

.product-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .product-fields-grid {
    grid-template-columns: 1fr;
  }
}

.pf-span-2 {
  grid-column: 1 / -1;
}

.pf-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 8px;
}

.pf-input,
.pf-select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  min-height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pf-input:focus,
.pf-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.product-field-block {
  margin-top: 20px;
  padding: 18px 16px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcfb 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.product-field-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.product-field-block-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.product-field-block-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.product-field-block-badge.opt {
  background: #eef2f0;
  color: var(--muted);
}

.product-field-block-hint {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.super-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr));
  gap: 10px;
}

.super-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 12px;
  margin: 0;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--text);
  transition: border-color 0.18s, background 0.18s, transform 0.12s,
    box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.super-chip:active {
  transform: scale(0.98);
}

.super-chip-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.super-chip-text {
  pointer-events: none;
}

.super-chip:has(.super-chip-input:checked),
.super-chip.super-chip--on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
  box-shadow: 0 0 0 1px rgba(13, 159, 115, 0.2);
}

@supports not selector(:has(*)) {
  .super-chip.super-chip--on {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-hover);
  }
}

.photo-existing {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f6f4;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

.photo-existing img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.photo-drop {
  display: block;
  position: relative;
  margin: 0;
  cursor: pointer;
  border-radius: 18px;
  border: 2px dashed rgba(13, 159, 115, 0.35);
  background: linear-gradient(165deg, #f6fbf9, #ffffff);
  min-height: min(200px, 42vw);
  max-height: 280px;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}

.photo-drop:active {
  border-color: var(--accent);
  background: #f0faf6;
}

.photo-input-native {
  position: absolute;
  opacity: 0;
  width: 0.01px;
  height: 0.01px;
  overflow: hidden;
  z-index: -1;
}

.photo-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  text-align: center;
  min-height: 160px;
}

.photo-drop--has-preview .photo-drop-inner {
  display: none;
}

.photo-drop-icon {
  font-size: 2.25rem;
  line-height: 1;
  opacity: 0.9;
}

.photo-drop-text {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  max-width: 280px;
}

.photo-drop-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.photo-drop-preview {
  display: block;
  width: 100%;
  max-height: 240px;
  height: auto;
  object-fit: contain;
  background: transparent;
}

/* Respeta el atributo hidden (evita “cuadro negro”) */
.photo-drop-preview[hidden] {
  display: none !important;
}

.photo-clear-btn {
  margin-top: 12px;
  width: 100%;
  max-width: 100%;
}

.product-form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

@media (min-width: 480px) {
  .product-form-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .product-form-actions .btn-lg {
    flex: 1;
    min-width: 200px;
  }
}
