/* ============================================================
   GSQ · Editorial Industrial Catalog
   Typography: Futura Std (Black · Bold · Medium)
   Fallback: Jost (Google Fonts geometric sans) until local files load.
   Place your Futura Std files in: assets/fonts/
     - FuturaStd-Medium.woff2 (or .woff / .otf)
     - FuturaStd-Bold.woff2
     - FuturaStd-Black.woff2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@500;700;900&display=swap');

/* Futura Std @font-face declarations.
   Multiple src formats so users can drop any of woff2 / woff / otf / ttf. */
@font-face {
  font-family: "Futura Std";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/FuturaStd-Medium.woff2") format("woff2"),
       url("fonts/FuturaStd-Medium.woff") format("woff"),
       url("fonts/FuturaStd-Medium.otf") format("opentype"),
       url("fonts/FuturaStd-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Futura Std";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/FuturaStd-Bold.woff2") format("woff2"),
       url("fonts/FuturaStd-Bold.woff") format("woff"),
       url("fonts/FuturaStd-Bold.otf") format("opentype"),
       url("fonts/FuturaStd-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Futura Std";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("fonts/FuturaStd-Black.woff2") format("woff2"),
       url("fonts/FuturaStd-Black.woff") format("woff"),
       url("fonts/FuturaStd-Black.otf") format("opentype"),
       url("fonts/FuturaStd-Black.ttf") format("truetype");
}

:root {
  --paper: #faf7f2;
  --paper-2: #f3ede2;
  --paper-3: #ece4d4;
  --ink: #1a1614;
  --ink-2: #5a5048;
  --ink-3: #8a8076;
  --rule: #e6dfd1;
  --rule-strong: #d8cfbb;
  --brand: #d71920;
  --brand-deep: #a50f16;
  --brand-tint: #fbe5e5;
  --ok: #2d6a4f;
  --warn: #b45309;

  /* All three roles use Futura Std with different weights.
     Jost is the geometric-sans fallback that loads from Google Fonts
     until local Futura Std files are present. */
  --font-display: "Futura Std", "Futura", "Jost", "Avenir Next", "Avenir", "Century Gothic", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Futura Std", "Futura", "Jost", "Avenir Next", "Avenir", "Century Gothic", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Futura Std", "Futura", "Jost", "Avenir Next", "Century Gothic", ui-monospace, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --shadow-card: 0 1px 0 rgba(26, 22, 20, 0.04), 0 12px 28px -12px rgba(26, 22, 20, 0.10);
  --shadow-lift: 0 1px 0 rgba(26, 22, 20, 0.05), 0 24px 48px -16px rgba(26, 22, 20, 0.18);
  --shadow-brand: 0 10px 22px -8px rgba(215, 25, 32, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

html { overflow-x: clip; } /* prevent any rogue child from causing page scroll */

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 80% 50% at 80% -10%, rgba(215, 25, 32, 0.05), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(26, 22, 20, 0.03), transparent 60%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: rgba(215, 25, 32, 0.08);
}

/* paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0 0.06  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

main, header, footer { position: relative; z-index: 1; }

.container {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

/* =================== HEADER =================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo {
  width: 96px;
  height: 44px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* =================== TYPOGRAPHY =================== */

h1, h2, h3, h4 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

h4 { text-transform: none; }

p {
  margin: 0 0 12px;
  color: var(--ink-2);
}

a { color: var(--brand-deep); }

/* =================== LAYOUT =================== */

.page-grid,
.admin-layout {
  display: grid;
  gap: 28px;
  padding: 36px 0 64px;
}

/* =================== CARDS =================== */

.card,
.hero-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}

.hero-card {
  position: relative;
  padding: 38px 38px 42px;
  overflow: hidden;
  background:
    linear-gradient(135deg, #fff 0%, var(--paper-2) 100%);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 320px;
  height: 320px;
  background:
    radial-gradient(circle, rgba(215, 25, 32, 0.10) 0%, transparent 60%);
  border: 1px solid rgba(215, 25, 32, 0.15);
  border-radius: 999px;
}

.hero-card h1 {
  max-width: 18ch;
}

.form-card,
.login-card,
.table-card,
.editor-card {
  padding: 28px;
}

.section-title { margin-bottom: 22px; }
.section-title h2 { margin-bottom: 6px; }
.section-title p { margin: 0; color: var(--ink-2); }

.with-line {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px dashed var(--rule-strong);
}

/* =================== FORMS =================== */

label {
  display: grid;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

label em {
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  font-style: normal;
  color: var(--ink-3);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  letter-spacing: -0.005em;
}

input,
select {
  min-height: 52px;
  padding: 0 16px;
}

textarea {
  min-height: 200px;
  padding: 14px 16px;
  line-height: 1.55;
  resize: vertical;
}

input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(26, 22, 20, 0.06);
}

input:disabled,
select:disabled {
  background: var(--paper-2);
  color: var(--ink-3);
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 22px) 23px, calc(100% - 17px) 23px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 44px;
}

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

.full-width { grid-column: 1 / -1; }

/* =================== BUTTONS =================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
  user-select: none;
}

.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

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

.btn-dark {
  background: var(--ink);
  color: #fff;
}

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

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn-ghost:hover {
  background: var(--paper-2);
  border-color: var(--ink-3);
}

.btn-ghost.danger {
  color: var(--brand-deep);
  border-color: var(--brand-tint);
}

.btn-ghost.danger:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
}

.btn-sm {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.85rem;
}

.btn-block { width: 100%; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--brand-deep);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.align-left { justify-content: flex-start; }

/* =================== TABS =================== */

.tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-card);
}

.tab-btn {
  flex: 1 1 auto;
  min-width: 110px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(26, 22, 20, 0.5);
}

.tablet-tab-nav {
  display: none;
  align-items: stretch;
  gap: 8px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.tablet-tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 16px;
}

.tablet-more-nav {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.tablet-more-nav[open] {
  z-index: 5;
}

.tablet-more-nav summary {
  list-style: none;
}

.tablet-more-nav summary::-webkit-details-marker {
  display: none;
}

.tablet-more-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
}

.tablet-more-summary::after {
  content: "▾";
  margin-left: 8px;
  font-size: 0.8rem;
}

.tablet-more-nav[open] .tablet-more-summary::after {
  content: "▴";
}

.tablet-more-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 10px;
  display: grid;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 20px;
  box-shadow: 0 18px 36px -20px rgba(26, 22, 20, 0.35);
}

.tablet-more-item {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.tablet-more-item:hover,
.tablet-more-item.active {
  background: var(--paper-2);
}

.tab-panel { display: grid; gap: 24px; }

/* =================== STATS =================== */

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

.stat-card {
  position: relative;
  padding: 26px 24px;
  border-radius: var(--r-xl);
  background: var(--ink);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
}

.stat-card span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 12px;
}

.stat-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* =================== TABLES =================== */

.table-wrap { overflow-x: auto; border-radius: var(--r-md); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule-strong);
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--paper); }

.table-empty { color: var(--ink-3); text-align: center; padding: 32px; }

/* =================== DASHBOARD HEADER =================== */

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.dashboard-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard {
  display: grid;
  gap: 26px;
}

.admin-section-switcher {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.admin-section-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-section-copy .eyebrow {
  margin-bottom: 0;
}

.admin-section-copy strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.admin-section-field {
  min-width: 190px;
  max-width: 220px;
  gap: 6px;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
}

.admin-section-field span {
  font-size: inherit;
}

.admin-section-field select {
  min-height: 44px;
  background-color: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-weight: 700;
  padding-inline: 16px 42px;
  box-shadow: 0 10px 22px -12px rgba(26, 22, 20, 0.35);
}

/* =================== EMPTY STATES & MESSAGES =================== */

.empty-state {
  padding: 28px;
  border-radius: var(--r-md);
  background: var(--paper-2);
  border: 1px dashed var(--rule-strong);
  color: var(--ink-2);
  text-align: center;
  font-size: 0.95rem;
}

.message {
  min-height: 24px;
  margin: 14px 0 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
}

.message.success { color: var(--ok); }
.message.error { color: var(--brand-deep); }

.hidden { display: none !important; }

/* =================== LOGIN =================== */

.login-card {
  width: min(520px, 100%);
  margin: 60px auto;
  padding: 40px;
  text-align: left;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-toggle {
  justify-self: start;
  margin-top: -2px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

/* =================== PRODUCT BUILDER (form/vendor) =================== */

.product-builder {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 22px;
  background: linear-gradient(180deg, #fff 0%, var(--paper) 100%);
}

.product-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* product cards (touch grid) */
.product-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 200ms ease, border-color 200ms ease;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--ink-3);
}

.product-card.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint), var(--shadow-lift);
}

.product-card .card-photo {
  aspect-ratio: 1 / 1;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.product-card .card-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 18px;
}

.product-card .card-photo .no-photo {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.product-card .card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-card .card-cat {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.product-card .card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 2px 0;
}

.product-card .card-base {
  font-size: 0.85rem;
  color: var(--ink-2);
}

.product-card .card-base strong {
  font-family: var(--font-mono);
  font-weight: 500;
}

.product-card .card-codes {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .card-actions {
  display: flex;
  gap: 8px;
  padding: 0 18px 18px;
}

.product-card .card-actions .btn { flex: 1; }

.product-card.inactive {
  opacity: 0.5;
}

.product-card.inactive .card-photo::after {
  content: "INACTIVO";
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  background: rgba(26, 22, 20, 0.85);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  border-radius: var(--r-pill);
}

@media (max-width: 1180px) {
  body[data-page="form"] .product-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  body[data-page="form"] .product-card .card-photo img {
    padding: 10px;
  }

  body[data-page="form"] .product-card .card-body {
    padding: 10px 10px 12px;
    gap: 4px;
  }

  body[data-page="form"] .product-card .card-cat {
    font-size: 0.5rem;
    letter-spacing: 0.14em;
  }

  body[data-page="form"] .product-card .card-name {
    font-size: 0.72rem;
    line-height: 1.08;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body[data-page="form"] .product-card .card-base {
    font-size: 0.58rem;
    line-height: 1.2;
  }
}

@media (min-width: 900px) and (max-width: 1180px) {
  body[data-page="form"] .product-cards {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* =================== CATALOG TOOLBAR =================== */

.catalog-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

.catalog-toolbar .search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}

.catalog-toolbar .search-wrap input {
  padding-left: 44px;
}

.catalog-toolbar .search-wrap::before {
  content: "🔍";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  font-size: 0.95rem;
}

.catalog-toolbar select {
  flex: 0 0 220px;
}

/* =================== PRODUCT EDITOR =================== */

.editor-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px 0;
}

.editor-back:hover { color: var(--brand-deep); }

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.editor-card {
  padding: 28px;
}

.editor-grid .editor-card.full {
  grid-column: 1 / -1;
}

.editor-fields {
  display: grid;
  gap: 18px;
}

.photo-upload {
  display: grid;
  gap: 12px;
}

.photo-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 280px;
  background: var(--paper-2);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 18px;
}

.photo-preview .ph-empty {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.photo-actions { display: inline-flex; gap: 10px; flex-wrap: wrap; }

input[type="file"] { display: none; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.toggle input { display: none; }

.toggle .switch {
  width: 46px;
  height: 26px;
  background: var(--rule-strong);
  border-radius: 999px;
  position: relative;
  transition: background 200ms ease;
}

.toggle .switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 999px;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.toggle input:checked ~ .switch { background: var(--brand); }
.toggle input:checked ~ .switch::after { transform: translateX(20px); }

/* presentation checkboxes */
.pres-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pres-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background: #fff;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.01em;
  transition: border-color 160ms ease, background 160ms ease;
}

.pres-check:hover { border-color: var(--ink-3); }

.pres-check input { display: none; }

.pres-check .check-box {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: background 160ms ease, border-color 160ms ease;
  flex-shrink: 0;
}

.pres-check .check-box::after {
  content: "";
  width: 12px;
  height: 7px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  transition: transform 160ms ease;
}

.pres-check input:checked ~ .check-box {
  background: var(--brand);
  border-color: var(--brand);
}

.pres-check input:checked ~ .check-box::after { transform: rotate(-45deg) scale(1); }

.pres-check input:checked ~ span:not(.check-box) { color: var(--ink); }

/* color editor */
.color-add-form {
  display: grid;
  grid-template-columns: 2fr 1fr 60px 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}

.color-add-form .swatch-preview {
  width: 100%;
  height: 52px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background: #ccc;
}

.color-table {
  display: grid;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}

.color-table-head, .color-row {
  display: grid;
  grid-template-columns: 140px 1fr 110px 60px auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}

.color-table-head {
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}

.color-row {
  background: #fff;
  border-bottom: 1px solid var(--rule);
}

.color-row:last-child { border-bottom: 0; }

.color-row:hover { background: var(--paper); }

.color-row .final-code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
}

.color-row input[type="text"] {
  min-height: 44px;
}

.color-row .swatch-cell {
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
}

.color-row .row-actions {
  display: inline-flex;
  gap: 6px;
}

/* =================== COLOR PALETTE TAB =================== */

.color-list, .simple-list {
  display: grid;
  gap: 10px;
  margin-bottom: 6px;
}

.palette-row, .simple-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: #fff;
}

.palette-row input[type="text"],
.simple-row input[type="text"] {
  flex: 1 1 auto;
  min-height: 44px;
}

.palette-row input[type="color"] {
  width: 56px;
  height: 44px;
  padding: 2px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid var(--rule-strong);
}

.palette-row input[data-field="hex-text"] {
  flex: 0 0 120px;
  font-family: var(--font-mono);
}

.swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.swatch-lg { width: 36px; height: 36px; border-radius: var(--r-sm); }
.swatch-inline { width: 12px; height: 12px; vertical-align: middle; margin: 0 4px; border-radius: 3px; }

/* =================== TREE (legacy: stores, locations) =================== */

.catalog-tree {
  display: grid;
  gap: 12px;
  margin-bottom: 6px;
}

.tree-node {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: #fff;
  overflow: hidden;
}

.tree-cat { background: linear-gradient(180deg, #fff 0%, var(--paper) 100%); }
.tree-sub { background: var(--paper); }
.tree-prod { background: var(--paper-2); }

.tree-node > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}

.tree-node > summary::-webkit-details-marker { display: none; }
.tree-node[open] > summary { border-bottom: 1px solid var(--rule); }

.tree-icon { font-size: 1.1rem; }

.tree-input {
  flex: 1 1 auto;
  min-height: 42px;
  border-radius: var(--r-sm);
}

.tree-btn {
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ink);
}

.tree-btn:hover { background: var(--paper-2); }

.tree-children { display: grid; gap: 10px; padding: 14px; }

.tree-empty {
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  color: var(--ink-3);
  font-size: 0.88rem;
  text-align: center;
}

.tree-count {
  margin-left: auto;
  margin-right: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  letter-spacing: 0.1em;
}

.branch-info {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.branch-row, .city-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: #fff;
  margin-bottom: 8px;
}

.branch-row input, .city-row input {
  flex: 1 1 auto;
  min-height: 44px;
}

.branch-row select {
  flex: 1 1 140px;
  min-height: 44px;
}

.city-list { margin-bottom: 8px; }

/* =================== VENDOR FORM SELECTED ITEMS =================== */

.selected-panel {
  margin-top: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: #fff;
  overflow: hidden;
}

.selected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--ink);
  color: #fff;
}

.selected-header h3 {
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.selected-header span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.selected-items {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.selected-items.empty-state {
  display: block;
  padding: 28px;
  margin: 16px;
}

.selected-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper);
}

.selected-item strong {
  font-family: var(--font-display);
  font-size: 1rem;
}

.selected-item p,
.selected-item small {
  display: block;
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 0.88rem;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.88rem;
}

/* =================== PICKER MODAL (vendor product picker) =================== */

.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 20, 0.5);
  backdrop-filter: blur(6px);
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

@media (min-width: 768px) {
  /* On tablet/desktop, center the sheet with breathing room */
  .picker-overlay { place-items: center; padding: 24px; }
}

.picker-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.picker-sheet {
  width: min(680px, 100%);
  max-height: 92vh;
  background: var(--paper);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(40px);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 768px) {
  .picker-sheet { border-radius: var(--r-xl); max-height: 88vh; }
  .picker-handle { display: none; }
}

.picker-overlay.open .picker-sheet {
  transform: translateY(0);
}

.picker-handle {
  width: 56px;
  height: 5px;
  background: var(--rule-strong);
  border-radius: 999px;
  margin: 12px auto 4px;
}

.picker-head {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--rule);
}

.picker-head .picker-photo {
  width: 88px;
  height: 88px;
  border-radius: var(--r-md);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.picker-head .picker-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.picker-head h2 {
  font-size: 1.4rem;
  margin: 0;
}

.picker-head .picker-cat {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-deep);
  margin-bottom: 4px;
}

.picker-close {
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.picker-body {
  padding: 20px 22px 22px;
  overflow-y: auto;
  display: grid;
  gap: 20px;
}

.picker-section h4 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.option-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 100ms ease;
}

.option-pill:hover { border-color: var(--ink); }
.option-pill:active { transform: scale(0.97); }

.option-pill.active {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-deep);
}

.option-pill .swatch { width: 18px; height: 18px; }

.qty-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  overflow: hidden;
  background: #fff;
}

.qty-stepper button {
  width: 48px;
  height: 48px;
  background: transparent;
  border: 0;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}

.qty-stepper button:hover { background: var(--paper-2); }

.qty-stepper input {
  width: 64px;
  text-align: center;
  border: 0;
  border-radius: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  min-height: 48px;
}

.qty-stepper input:focus { box-shadow: none; }

.picker-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.picker-foot .btn { flex: 1 1 140px; }

/* On larger sheets, primary action gets a bit more weight */
.detail-sheet .picker-foot .btn-primary { flex: 1.2 1 160px; }

/* =================== STORES (Ferreterías) =================== */

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.store-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 200ms ease, border-color 200ms ease;
}

.store-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink-3);
  box-shadow: var(--shadow-card);
}

.store-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.store-icon {
  width: 48px; height: 48px;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  font-size: 1.4rem;
}

.store-card-title { min-width: 0; flex: 1; }

.store-card-title h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.15;
  word-break: break-word;
}

.store-card-title p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.store-card-locations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loc-badge {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  border: 1px solid var(--rule);
}

.loc-badge.dim { color: var(--ink-3); }

.store-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px dashed var(--rule);
}

.store-card-actions .btn { flex: 1; }

/* Editor: branches list */
.branches-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.branch-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}

.branch-card-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.branch-card-info strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.branch-card-info p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.branch-card-edit {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 10px;
  padding: 12px 16px;
}

.branch-card-edit input,
.branch-card-edit select {
  min-height: 44px;
}

/* Add branch form */
.branch-add-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
  background: var(--paper);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-md);
}

.branch-add-form .btn { min-height: 52px; }

@media (max-width: 720px) {
  .store-grid { grid-template-columns: 1fr; }
  .branch-card-edit,
  .branch-add-form {
    grid-template-columns: 1fr 1fr;
  }
  .branch-card-edit > input[data-field="name"],
  .branch-add-form > label:first-child { grid-column: 1 / -1; }
  .branch-card-edit > [data-action="del-branch"],
  .branch-add-form > .btn { grid-column: 1 / -1; }
}

/* =================== SELLERS =================== */

.seller-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.seller-chip::before {
  content: "👤";
  font-size: 0.95rem;
}

.seller-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.seller-card:hover { border-color: var(--ink-3); box-shadow: var(--shadow-card); }
.seller-card.inactive { opacity: 0.55; }
.seller-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.seller-avatar {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.seller-info strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.seller-info p {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.seller-info p em { font-style: normal; color: var(--brand-deep); }
.seller-actions { display: inline-flex; gap: 8px; flex-shrink: 0; }

.seller-sheet { width: min(540px, 100%); }
.seller-sheet .editor-fields { gap: 16px; }
.seller-sheet input[type="text"],
.seller-sheet input[type="password"] { font-family: var(--font-body); }

/* =================== SUBMISSION CARDS (admin Registros) =================== */

.submission-card-v2 {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.submission-card-v2:hover {
  border-color: var(--ink-3);
  box-shadow: var(--shadow-card);
}

.submission-card-v2 .sub-main { flex: 1; min-width: 0; }

.submission-card-v2 .sub-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.submission-card-v2 .sub-head strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.submission-card-v2 .sub-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
}

.submission-card-v2 .sub-meta {
  margin: 0;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--ink-2);
}

.submission-card-v2 .sub-meta strong { color: var(--ink); font-weight: 700; }

.submission-card-v2 .sub-pill {
  padding: 3px 10px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.submission-card-v2 .sub-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* =================== DETAIL SHEET =================== */

.detail-sheet {
  width: min(1100px, 100%);
  max-height: 94vh;
}

/* Custom head — full width, title not cropped by close button */
.detail-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 16px 22px 18px;
  border-bottom: 1px solid var(--rule);
}

.detail-head-text { min-width: 0; }

.detail-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-deep);
  margin-bottom: 6px;
}

.detail-head h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.2rem, 3.4vw, 1.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--ink);
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.detail-branch {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink-2);
  letter-spacing: 0;
  text-transform: none;
}

.detail-branch:empty { display: none; }

.detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  margin-bottom: 4px;
}

.detail-stat {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
}

.detail-stat span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.detail-stat strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
  word-break: break-word;
}

.detail-stat.highlight {
  background: var(--ink);
  border-color: var(--ink);
}
.detail-stat.highlight span { color: rgba(255,255,255,0.55); }
.detail-stat.highlight strong { color: #fff; font-size: 1.4rem; }

.detail-group { margin-top: 18px; }

.detail-group h4 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

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

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.88rem;
  vertical-align: top;
}

.detail-table tr:last-child td { border-bottom: 0; }
.detail-table th {
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-align: left;
  white-space: nowrap;
}

.detail-table .mono { font-family: var(--font-mono); color: var(--ink-2); }
.detail-table .num  { text-align: right; font-family: var(--font-mono); font-weight: 700; }
.detail-table .dim  { color: var(--ink-3); font-size: 0.85rem; }

/* ===== MOBILE: stack table rows as cards (≤640px portrait) ===== */
@media (max-width: 640px) {
  .submission-card-v2 { flex-direction: column; align-items: stretch; }
  .submission-card-v2 .sub-actions { justify-content: flex-end; }

  .detail-summary {
    grid-template-columns: 1fr 1fr;
    padding: 10px;
  }
  .detail-stat.highlight { grid-column: 1 / -1; }

  .detail-head { padding: 12px 16px 14px; }
  .picker-body { padding: 14px 16px 16px; gap: 16px; }
  .picker-foot { padding: 12px 16px 14px; }

  /* Collapse the table to per-row cards. Each <td> shows its label inline. */
  .detail-table,
  .detail-table thead,
  .detail-table tbody,
  .detail-table tr,
  .detail-table th,
  .detail-table td { display: block; }

  .detail-table thead { display: none; }

  .detail-table tr {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    margin-bottom: 8px;
    padding: 6px 0;
  }

  .detail-table td {
    border-bottom: 0;
    padding: 6px 14px;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 8px;
    align-items: baseline;
  }

  .detail-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
  }

  .detail-table td.empty { display: none; }
  .detail-table .num { text-align: left; }
}

/* Tablet landscape and small laptops: keep table compact */
@media (min-width: 641px) and (max-width: 900px) {
  .detail-summary { grid-template-columns: repeat(3, 1fr); }
  .detail-table th,
  .detail-table td { padding: 8px 10px; font-size: 0.85rem; }
}

/* =================== FOOTER =================== */

.site-footer {
  padding: 32px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  border-top: 1px solid var(--rule);
  margin-top: 40px;
}

/* =================== RESPONSIVE =================== */

@media (max-width: 880px) {
  .editor-grid { grid-template-columns: 1fr; }
  .form-grid, .product-grid, .stats-grid { grid-template-columns: 1fr; }
  .pres-grid { grid-template-columns: 1fr; }
  .color-add-form { grid-template-columns: 1fr 1fr; }
  .color-add-form > *:nth-child(3) { grid-column: 1 / 2; }
  .color-add-form > *:nth-child(4) { grid-column: 2 / 3; }
  .color-table-head { display: none; }
  .color-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .color-row .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .header-content, .dashboard-header { flex-direction: column; align-items: flex-start; }
  .header-content { gap: 16px; }
  .header-actions,
  .dashboard-actions {
    width: 100%;
    align-items: stretch;
  }
  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .header-actions .seller-chip,
  .header-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .header-actions .seller-chip {
    min-height: 38px;
  }
  .dashboard-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .dashboard-actions .btn {
    width: 100%;
  }
  .login-card { margin: 24px auto; padding: 28px; }
  .product-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .product-card .card-photo img { padding: 12px; }
}

@media (max-width: 640px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }

  .page-grid,
  .admin-layout {
    gap: 20px;
    padding: 24px 0 42px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 88px;
    height: 40px;
  }

  .brand strong {
    font-size: 1rem;
  }

  .eyebrow {
    font-size: 0.64rem;
    letter-spacing: 0.14em;
  }

  .hero-card,
  .form-card,
  .login-card,
  .table-card,
  .editor-card {
    padding: 20px;
  }

  .hero-card::after {
    width: 220px;
    height: 220px;
    right: -110px;
    top: -95px;
  }

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

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

  .admin-section-switcher {
    display: flex;
  }

  .admin-section-field {
    min-width: 170px;
    max-width: 190px;
  }

  .tab-nav {
    display: none;
  }

  .tablet-tab-nav {
    display: none;
  }

  .stat-card {
    padding: 22px 20px;
  }

  .stat-card strong {
    font-size: 2.6rem;
  }

  .table-card {
    overflow: hidden;
  }

  .table-wrap {
    margin-inline: -20px;
    padding-inline: 20px;
  }

  table {
    min-width: 620px;
    font-size: 0.9rem;
  }

  th,
  td {
    padding: 12px 14px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .tab-nav {
    display: none;
  }

  .tablet-tab-nav {
    display: flex;
  }

  .tablet-tab-btn,
  .tablet-more-summary {
    min-height: 52px;
    font-size: 0.95rem;
  }
}
