/* Cambios en productos · Simétrica Group */
:root {
  --paper: #eef1ef;
  --surface: #ffffff;
  --ink: #1c2926;
  --ink-2: #33423e;
  --muted: #5d6b67;
  --line: #d3dbd7;
  --line-soft: #e4e9e6;
  --pine: #2f5d50;
  --pine-dark: #234840;
  --pine-tint: #e3ece8;
  --brass: #a88336;
  --brass-tint: #f5eedd;
  --danger: #a8392d;
  --radius: 8px;
  --font: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
}
img { max-width: 100%; }
a { color: var(--pine); text-underline-offset: 2px; }
a:hover { color: var(--pine-dark); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--pine) 45%, transparent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3, .h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 .8em; }
code { font-size: .9em; background: var(--line-soft); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.measure { max-width: 70ch; }
[hidden] { display: none !important; }

/* ---------- Barra superior ---------- */
.topbar { background: var(--ink); color: #fff; }
.topbar-in {
  max-width: 1280px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.mode-public .topbar-in, .mode-install .topbar-in, .mode-login .topbar-in { max-width: 820px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand strong { display: block; font-size: 1rem; font-weight: 600; }
.brand small { display: block; color: #a9b8b3; font-size: .8rem; }
.brand-mark {
  width: 28px; height: 34px; border: 2px solid var(--brass); border-radius: 4px 4px 12px 12px; position: relative; flex: none;
}
.brand-mark::before {
  content: ""; position: absolute; top: 5px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px;
  border-radius: 50%; border: 2px solid var(--brass);
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #d2ddd9; text-decoration: none; padding: 7px 12px; border-radius: 6px; font-size: .94rem;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.nav a.out { color: #a9b8b3; }

/* ---------- Contenedor ---------- */
.wrap { max-width: 820px; margin: 0 auto; padding: 32px 24px 80px; }
.wrap.wide { max-width: 1280px; }
.intro { margin-bottom: 28px; max-width: 64ch; }
.intro p { color: var(--ink-2); font-size: 1.05rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.section-title { margin: 32px 0 12px; }
.back { margin: 0 0 12px; }
.back a { text-decoration: none; }
.back a::before { content: "‹ "; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.panel.narrow { max-width: 440px; margin: 24px auto; }
.narrow-left { max-width: 720px; margin-top: 24px; }

/* ---------- Mensajes ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash-ok { background: var(--pine-tint); border-color: #b9cfc6; color: var(--pine-dark); }
.flash-error { background: #f8e8e5; border-color: #e7c1bb; color: #7d2a21; }

/* ---------- Formularios ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: .92rem; font-weight: 500; color: var(--ink-2); margin-bottom: 14px; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 1px solid #bfcac5; border-radius: 6px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--pine); outline: 2px solid var(--pine-tint); outline-offset: 0; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="file"] { padding: 8px; background: var(--paper); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 0 14px; }
.stack { display: flex; flex-direction: column; }
.hint { color: var(--muted); font-size: .92rem; margin-top: -4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .96rem; line-height: 1;
  background: var(--pine); color: #fff; border: 1px solid var(--pine);
  border-radius: 6px; padding: 11px 18px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--pine-dark); border-color: var(--pine-dark); color: #fff; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--pine); border-color: #b3c6be; }
.btn.ghost:hover { background: var(--pine-tint); color: var(--pine-dark); }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn.small { padding: 8px 12px; font-size: .88rem; }
.link {
  font: inherit; font-size: .9rem; background: none; border: 0; padding: 0; color: var(--pine);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link.danger { color: var(--danger); }

/* ---------- Formulario de solicitud ---------- */
.block { border: 0; padding: 0; margin: 0 0 32px; }
.block legend {
  font-size: 1.25rem; font-weight: 700; padding: 0; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.block legend::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.item {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pine);
  border-radius: var(--radius); padding: 16px 20px 6px; margin-bottom: 14px;
}
.item.has-error { border-left-color: var(--danger); box-shadow: 0 0 0 1px #e7c1bb; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.item-title { font-size: 1rem; }
.add-item::before { content: "+"; font-size: 1.2em; font-weight: 500; }

.store-pick { display: inline-flex; border: 1px solid #bfcac5; border-radius: 7px; padding: 3px; margin-bottom: 14px; background: var(--paper); }
.seg { flex-direction: row; margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 7px 16px; border-radius: 5px; font-weight: 500; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(28,41,38,.15); }
.seg input:focus-visible + span { outline: 3px solid var(--pine-tint); }

.product-zone { position: relative; margin-bottom: 14px; }
.product-zone .search-label { margin-bottom: 6px; }
.manual-toggle { margin-bottom: 4px; }
.manual { margin-top: 10px; }
.results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 70px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(28,41,38,.16); max-height: 360px; overflow-y: auto; padding: 4px;
}
.res {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 6px; padding: 8px; cursor: pointer; font: inherit; color: var(--ink);
}
.res:hover, .res:focus { background: var(--pine-tint); outline: none; }
.res-empty { padding: 12px; margin: 0; color: var(--muted); font-size: .92rem; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 5px; flex: none; background: var(--paper); }
.thumb.ph { display: inline-block; background: var(--paper); border: 1px dashed var(--line); }
.res-txt { display: flex; flex-direction: column; min-width: 0; }
.res-title { font-weight: 500; }
.res-meta { font-size: .85rem; color: var(--muted); }
.res-meta em { color: var(--brass); font-style: normal; font-weight: 500; }
.picked {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--pine-tint); border-radius: var(--radius); margin-bottom: 6px;
}
.picked .res-txt { flex: 1; }
.values input { background: #fbfcfb; }

.submit-row { display: flex; align-items: center; gap: 16px; padding-top: 8px; border-top: 1px solid var(--line); padding-top: 24px; }

/* ---------- Confirmación: etiqueta colgante ---------- */
.done { display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center; padding: 24px 0; }
.tag-card {
  position: relative; width: 260px; padding: 58px 24px 26px; text-align: center;
  background: var(--brass-tint); border: 2px solid var(--brass); border-radius: 10px 10px 34px 34px;
  display: flex; flex-direction: column; gap: 6px;
  transform-origin: 50% 0; animation: swing 1.4s ease-out 1;
}
.tag-hole {
  position: absolute; top: 18px; left: 50%; width: 18px; height: 18px; margin-left: -9px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--brass);
}
.tag-hole::before {
  content: ""; position: absolute; bottom: 14px; left: 50%; width: 2px; height: 46px; background: var(--brass);
  transform: translateX(-50%);
}
.tag-label { color: var(--brass); font-weight: 600; font-size: .95rem; }
.tag-code { white-space: nowrap; font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--ink); }
.tag-meta { color: var(--muted); font-size: .86rem; }
.done-text h1 { font-size: 2rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
@keyframes swing {
  0% { transform: rotate(-9deg); }
  35% { transform: rotate(6deg); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(1.2deg); }
  100% { transform: rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .tag-card { animation: none; } }

/* ---------- Códigos y estados ---------- */
.code-chip {
  display: inline-block; font-weight: 700; font-size: .92rem; color: var(--ink); text-decoration: none;
  background: var(--brass-tint); border: 1px solid #dcc899; border-radius: 4px 4px 4px 12px; padding: 3px 9px;
}
a.code-chip:hover { border-color: var(--brass); color: var(--ink); }
.code-chip.big { font-size: 1.6rem; padding: 4px 14px; }
.badge { display: inline-block; font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.st-pendiente { background: #f7ecd4; color: #7b5714; }
.st-en_proceso { background: #e2ecf6; color: #25507a; }
.st-aplicado { background: #dcefe3; color: #1f6038; }
.st-rechazado { background: #f5e1dd; color: #8a2f25; }
.urgent-tag { display: inline-block; font-size: .78rem; font-weight: 600; color: var(--danger); margin-top: 4px; }
.urgent-tag::before { content: "● "; }

/* ---------- Panel: lista ---------- */
.counters { display: flex; gap: 8px; flex-wrap: wrap; }
.counter {
  text-decoration: none; color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; font-size: .9rem;
}
.counter span { color: var(--ink); font-weight: 700; font-size: 1.05rem; margin-right: 2px; }
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; align-items: end; }
.filters .f-q { grid-column: span 4; }
.filters label { margin-bottom: 12px; }
.filters .check { align-self: center; }
.f-actions { grid-column: span 4; display: flex; gap: 8px; flex-wrap: wrap; }
.result-count { margin: 8px 2px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th {
  text-align: left; font-weight: 600; font-size: .85rem; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f7f9f8;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.urgent td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.tbl tr.inactive td { color: var(--muted); }
.tbl.compact td { padding: 8px 14px; }
.tbl .num { text-align: right; }
a.plain { color: var(--ink); text-decoration: none; }
a.plain:hover { color: var(--pine); }
.type-name { font-weight: 500; }
.delta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: .9rem; }
.delta .from { color: var(--muted); text-decoration: line-through; text-decoration-color: #b7c2be; }
.delta .arrow { color: var(--brass); font-weight: 700; }
.delta .to { color: var(--ink); }
.pager { display: flex; justify-content: center; gap: 18px; margin-top: 18px; }
.empty { text-align: center; padding: 36px; }

/* ---------- Panel: detalle ---------- */
.req-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.req-title { display: flex; align-items: center; gap: 14px; }
.person { margin: 0; min-width: 280px; }
.person div { margin-top: 2px; }
.notes p { margin: 0; }
.files { margin: 0; padding-left: 18px; }
.bulk summary { cursor: pointer; font-weight: 600; color: var(--pine); }
.bulk form { margin-top: 16px; }
.change { border-left: 4px solid var(--line); }
.change:target { border-left-color: var(--brass); }
.change-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.change-head h3 { font-size: 1.2rem; margin: 2px 0; }
.links { margin-top: 4px; }
.delta-big {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: start;
  background: var(--paper); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0 12px;
}
.delta-big p { margin: 2px 0 0; }
.arrow-big { color: var(--brass); font-size: 1.8rem; font-weight: 700; line-height: 1; padding-top: 14px; }
.detail-text p { margin-top: 2px; }
.item-form { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 8px; }
.item-form label { margin-bottom: 10px; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-foot .check { margin: 0; }
.timeline { list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line); font-size: .88rem; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 4px 0; }
.t-date { color: var(--muted); }
.t-note { display: block; color: var(--ink-2); background: var(--paper); border-radius: 5px; padding: 4px 8px; margin-top: 3px; }

/* ---------- Estado público ---------- */
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; flex: 1 1 200px; }
.inline-form .grow { flex: 3 1 260px; }
.req-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.sl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.reply { margin-top: 6px; background: var(--pine-tint); border-radius: 6px; padding: 6px 10px; font-size: .92rem; }

/* ---------- Historial por producto ---------- */
.product-hero { display: flex; gap: 20px; align-items: center; }
.hero-img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); }
.history { list-style: none; margin: 0; padding: 0; position: relative; }
.history li { position: relative; margin-left: 22px; }
.history li::before {
  content: ""; position: absolute; left: -22px; top: 0; bottom: -16px; width: 2px; background: var(--line);
}
.history li::after {
  content: ""; position: absolute; left: -27px; top: 24px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brass);
}
.history li:last-child::before { bottom: 50%; }
.h-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.h-top .badge { margin-left: auto; }
.h-detail { margin: 8px 0 0; color: var(--ink-2); }
.prod-results { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.prod-results a {
  display: flex; align-items: center; gap: 12px; padding: 10px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.prod-results a:hover { border-color: var(--pine); }

/* ---------- Catálogo y usuarios ---------- */
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-n { font-size: 2rem; font-weight: 700; }
.stat-n small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.steps { padding-left: 20px; }
.inline { display: inline; }
.inline-details { display: inline-block; margin-right: 12px; }
.inline-details summary { cursor: pointer; color: var(--pine); font-size: .9rem; }
.inline-details form { margin-top: 8px; min-width: 260px; }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  .wrap { padding: 22px 16px 60px; }
  h1 { font-size: 1.55rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .f-q, .f-actions { grid-column: span 2; }
  .done { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .actions { justify-content: center; }
  .delta-big { grid-template-columns: 1fr; }
  .arrow-big { transform: rotate(90deg); padding: 0; justify-self: start; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .item { padding: 14px 14px 4px; }
  .store-pick { display: flex; }
  .seg { flex: 1; }
  .seg span { flex: 1; display: block; text-align: center; padding: 8px 6px; }
  .product-hero { flex-direction: column; align-items: flex-start; }
  .submit-row { flex-direction: column; align-items: stretch; }
}
