/* ══════════════════════════════════════════════════════════════════════════
   Amapola · panel de administración
   Materiales, jerarquía y movimiento según Human Interface Guidelines.
   Un solo archivo, sin dependencias.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --tinta: #171310;
  --tinta-2: #3b3430;
  --tenue: #6e635c;
  --tenue-2: #948a83;
  --linea: rgba(23, 19, 16, .085);
  --linea-fuerte: rgba(23, 19, 16, .16);
  --lienzo: #faf8f5;
  --papel: #fff;
  --vino: #7a2e33;
  --vino-claro: rgba(122, 46, 51, .1);
  --verde: #1e6f52;
  --verde-claro: rgba(30, 111, 82, .1);
  --lateral: #1b1614;
  --radio: 10px;
  --radio-g: 16px;
  --sombra-1: 0 1px 2px rgba(23, 19, 16, .05), 0 0 0 .5px rgba(23, 19, 16, .04);
  --sombra-2: 0 2px 6px rgba(23, 19, 16, .06), 0 12px 32px -12px rgba(23, 19, 16, .18);
  --sombra-3: 0 24px 70px -20px rgba(23, 19, 16, .34), 0 2px 8px rgba(23, 19, 16, .08);
  --curva: cubic-bezier(.32, .72, 0, 1);
  --lateral-w: 252px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--lienzo);
  color: var(--tinta);
  font: 400 13.5px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(122, 46, 51, .16); }

:focus-visible {
  outline: 2px solid var(--vino);
  outline-offset: 2px;
  border-radius: 6px;
}

a { color: inherit; text-decoration: none; }

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

svg { display: block; }

/* ─────────────────────────────────────────────────────────── armazón */
.app { display: flex; min-height: 100vh; }

/* ─────────────────────────────────────────────────────────── lateral */
.lateral {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--lateral-w);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(122, 46, 51, .22), transparent 60%),
    linear-gradient(178deg, #221b18 0%, var(--lateral) 46%, #14100e 100%);
  color: rgba(255, 255, 255, .78);
  z-index: 40;
}

.lateral::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .02) 40%, transparent);
}

.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px;
  color: #fff;
}

.marca__flor { width: 26px; height: 26px; color: #f6ece3; flex: none; }
.marca__centro { fill: var(--vino); }

.marca__texto { display: flex; flex-direction: column; line-height: 1.15; }
.marca__nombre { font-size: 15px; font-weight: 600; letter-spacing: -.012em; }
.marca__sub {
  font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255, 255, 255, .42);
}

.menu { display: flex; flex-direction: column; gap: 2px; }

.menu__rotulo {
  padding: 14px 10px 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase;
  color: rgba(255, 255, 255, .34);
}

.menu__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -.006em;
  color: rgba(255, 255, 255, .74);
  transition: background .18s var(--curva), color .18s var(--curva), transform .18s var(--curva);
}

.menu__item svg { width: 18px; height: 18px; flex: none; opacity: .82; }

.menu__item:hover { background: rgba(255, 255, 255, .065); color: #fff; }
.menu__item:active { transform: scale(.985); }

.menu__item[aria-current="page"] {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12);
}

.menu__item[aria-current="page"] svg { opacity: 1; }

.menu__item[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #d98c8c;
  box-shadow: 0 0 0 3px rgba(217, 140, 140, .16);
}

.menu__item--ext svg { opacity: .6; }
.menu__flecha { margin-left: auto; width: 13px !important; height: 13px !important; opacity: .42 !important; }

.lateral__pie { margin-top: auto; padding-top: 14px; }

.cuenta-lateral {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .07);
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(160deg, #8d3a40, #5e2126);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.cuenta-lateral__texto { min-width: 0; flex: 1; }
.cuenta-lateral__nombre {
  font-size: 12.5px; font-weight: 570; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cuenta-lateral__rol {
  font-size: 10.5px; letter-spacing: .02em; color: rgba(255, 255, 255, .44);
}

.salir {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .5);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.salir:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.salir svg { width: 15px; height: 15px; }

/* ─────────────────────────────────────────────────────────── contenido */
.contenido {
  flex: 1;
  min-width: 0;
  margin-left: var(--lateral-w);
  display: flex;
  flex-direction: column;
}

.barra {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
  padding: 0 28px;
  background: rgba(250, 248, 245, .82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--linea);
}

.barra__titulo { min-width: 0; }
.barra__titulo h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -.018em;
  white-space: nowrap;
}

.barra__titulo p {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--tenue-2);
  letter-spacing: -.004em;
}

.barra > .btn, .barra > .btn--suave { margin-left: auto; }

.buscador {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(340px, 34vw);
  height: 34px;
  margin-left: auto;
  padding: 0 10px;
  border-radius: 9px;
  background: rgba(23, 19, 16, .045);
  box-shadow: inset 0 0 0 .5px rgba(23, 19, 16, .06);
  transition: background .18s, box-shadow .18s;
}

.buscador:focus-within {
  background: var(--papel);
  box-shadow: inset 0 0 0 1px var(--linea-fuerte), 0 1px 3px rgba(23, 19, 16, .06);
}

.buscador svg { width: 15px; height: 15px; flex: none; stroke: var(--tenue-2); fill: none; stroke-width: 1.7; }

.buscador input {
  flex: 1; min-width: 0;
  height: 100%;
  border: 0; background: none; outline: none;
  font-size: 13px;
  letter-spacing: -.004em;
}

.buscador input::placeholder { color: var(--tenue-2); }
.buscador input::-webkit-search-cancel-button { -webkit-appearance: none; }

.buscador kbd {
  font: 500 10.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--tenue-2);
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(23, 19, 16, .05);
  box-shadow: inset 0 0 0 .5px rgba(23, 19, 16, .07);
}

.lienzo {
  width: 100%;
  max-width: 1180px;
  margin: 0;
  padding: 22px 28px 64px;
}

/* ─────────────────────────────────────────────────────────── filtros */
.filtros {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 16px 28px 0;
  max-width: 1180px;
  margin: 0;
  width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 19, 16, .045);
  box-shadow: inset 0 0 0 .5px rgba(23, 19, 16, .06);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -.004em;
  color: var(--tinta-2);
  cursor: pointer;
  transition: background .18s var(--curva), color .18s var(--curva), box-shadow .18s var(--curva), transform .18s var(--curva);
}

.chip:hover { background: rgba(23, 19, 16, .075); }
.chip:active { transform: scale(.97); }

.chip span {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--tenue-2);
  transition: color .18s;
}

.chip--activo {
  background: var(--tinta);
  color: #f8f3ec;
  box-shadow: 0 1px 2px rgba(23, 19, 16, .22);
}

.chip--activo span { color: rgba(255, 255, 255, .55); }

/* ─────────────────────────────────────────────────────────── resumen */
.resumen {
  margin: 18px 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--tenue-2);
}

/* ─────────────────────────────────────────────────────────── piezas */
.piezas {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: var(--radio-g);
  background: var(--papel);
  box-shadow: var(--sombra-1);
  overflow: hidden;
}

.pieza {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 132px 104px 116px;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--linea);
  cursor: pointer;
  transition: background .16s var(--curva);
  animation: entrar .42s var(--curva) both;
}

.pieza:last-child { border-bottom: 0; }
.pieza:hover { background: #fcfaf7; }
.pieza:active { background: #f7f4ef; }

@keyframes entrar {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.pieza__foto {
  width: 46px; height: 46px;
  border-radius: 9px;
  overflow: hidden;
  background: #f1ece4;
  box-shadow: inset 0 0 0 .5px rgba(23, 19, 16, .07);
}

.pieza__foto img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pieza__texto { min-width: 0; }

.pieza__nombre {
  margin: 0;
  font-size: 13.5px;
  font-weight: 570;
  letter-spacing: -.012em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pieza__mat {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--tenue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pieza__cat {
  margin: 0;
  font-size: 12.5px;
  color: var(--tenue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pieza__precio {
  margin: 0;
  font-size: 13.5px;
  font-weight: 570;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  text-align: right;
}

.pieza__estado { display: flex; justify-content: flex-end; }

.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: -.002em;
  white-space: nowrap;
  background: rgba(23, 19, 16, .055);
  color: var(--tinta-2);
}

.etiqueta--wine { background: var(--vino-claro); color: #6d2a2f; }
.etiqueta--verde { background: var(--verde-claro); color: var(--verde); }
.etiqueta--nuevo { background: rgba(23, 19, 16, .88); color: #f7f1e8; }
.etiqueta--apagada { background: rgba(23, 19, 16, .05); color: var(--tenue-2); }

.vacio {
  margin: 40px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--tenue-2);
}

/* ─────────────────────────────────────────────────────────── hoja */
.velo {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(23, 19, 16, .3);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: velo .28s var(--curva) both;
}

@keyframes velo { from { opacity: 0; } to { opacity: 1; } }

.hoja {
  position: fixed;
  z-index: 70;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(430px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--papel);
  box-shadow: var(--sombra-3);
  transform: translateX(calc(100% + 24px));
  transition: transform .38s var(--curva);
  overflow: hidden;
}

.hoja[aria-hidden="false"] { transform: none; }

.hoja__asa {
  width: 36px; height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: rgba(23, 19, 16, .16);
  display: none;
}

.hoja__cerrar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(250, 248, 245, .86);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 1px 3px rgba(23, 19, 16, .18), inset 0 0 0 .5px rgba(23, 19, 16, .08);
  color: var(--tinta-2);
  cursor: pointer;
  transition: background .16s, transform .16s var(--curva);
}
.hoja__cerrar:hover { background: #fff; transform: scale(1.06); box-shadow: 0 2px 10px rgba(23,19,16,.16); }
.hoja__cerrar svg { width: 15px; height: 15px; }

.hoja__cuerpo {
  padding: 22px 24px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hoja__foto {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
  background: #f1ece4;
}

.hoja__nombre {
  margin: 0 0 3px;
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -.026em;
}

.hoja__mat { margin: 0; font-size: 12.5px; color: var(--tenue); }
.hoja__precio {
  margin: 12px 0 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.028em;
  font-variant-numeric: tabular-nums;
}

.hoja__desc {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--tinta-2);
}

.ficha {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 9px 12px;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--linea);
  font-size: 12.5px;
}

.ficha dt { color: var(--tenue-2); }
.ficha dd { margin: 0; font-weight: 500; }

/* ─────────────────────────────────────────────────────────── botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--tinta);
  color: #fbf6ef;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -.006em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(23, 19, 16, .18);
  transition: transform .16s var(--curva), background .16s var(--curva), box-shadow .16s var(--curva), opacity .16s;
}

.btn:hover { background: #241d1a; box-shadow: 0 2px 8px rgba(23, 19, 16, .22); }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }

.btn--suave {
  background: var(--papel);
  color: var(--tinta);
  box-shadow: inset 0 0 0 1px var(--linea-fuerte), 0 1px 2px rgba(23, 19, 16, .04);
}
.btn--suave:hover { background: #fbf8f4; box-shadow: inset 0 0 0 1px rgba(23, 19, 16, .22); }

.btn--vino { background: var(--vino); box-shadow: 0 1px 2px rgba(122, 46, 51, .3); }
.btn--vino:hover { background: #6b272c; }

.btn svg { width: 15px; height: 15px; }

/* ─────────────────────────────────────────────────────────── personas */
.personas {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: var(--radio-g);
  background: var(--papel);
  box-shadow: var(--sombra-1);
  overflow: hidden;
}

.persona {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 128px auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--linea);
}

.persona:last-child { border-bottom: 0; }
.persona__texto { min-width: 0; }
.persona__nombre {
  margin: 0;
  font-size: 13.5px;
  font-weight: 570;
  letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.persona__mail {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--tenue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.persona .apagado { opacity: .45; }

.rol {
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(23, 19, 16, .045);
  box-shadow: inset 0 0 0 .5px rgba(23, 19, 16, .07);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.rol:disabled { opacity: .55; cursor: default; }

.acciones { display: flex; gap: 6px; justify-content: flex-end; }

.mini {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--tenue);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.mini:hover { background: rgba(23, 19, 16, .055); color: var(--tinta); }
.mini--peligro:hover { background: rgba(160, 40, 40, .09); color: #a02828; }

/* ─────────────────────────────────────────────────────────── campos */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.campo > label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--tenue);
}

.entrada {
  height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: var(--papel);
  box-shadow: inset 0 0 0 1px var(--linea-fuerte);
  font-size: 13.5px;
  outline: none;
  transition: box-shadow .16s var(--curva);
}

.entrada:focus {
  box-shadow: inset 0 0 0 1px var(--tinta), 0 0 0 3.5px rgba(122, 46, 51, .12);
}

select.entrada { appearance: none; background-image: none; cursor: pointer; }

.clave {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 9px;
  background: #f6f2ec;
  box-shadow: inset 0 0 0 .5px var(--linea);
}

.clave code {
  font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .01em;
}

/* ─────────────────────────────────────────────────────────── publicar */
.tarjeta {
  border-radius: var(--radio-g);
  background: var(--papel);
  box-shadow: var(--sombra-1);
  padding: 22px 24px;
}

.tarjeta + .tarjeta { margin-top: 14px; }

.tarjeta__titulo {
  margin: 0;
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -.014em;
}

.tarjeta__nota { margin: 3px 0 0; font-size: 12.5px; color: var(--tenue); }

.metricas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metrica {
  padding: 13px 14px;
  border-radius: 12px;
  background: #faf7f2;
  box-shadow: inset 0 0 0 .5px var(--linea);
}

.metrica__valor {
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.metrica__rotulo {
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tenue-2);
}

.aviso {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--verde-claro);
  color: #14513c;
  font-size: 12.5px;
  line-height: 1.5;
}

.aviso--malo { background: rgba(160, 40, 40, .085); color: #7d2020; }
.aviso svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

.aviso ul { margin: 6px 0 0; padding-left: 16px; }
.aviso li + li { margin-top: 3px; }

.pie-tarjeta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--linea);
}

.pie-tarjeta__nota { font-size: 12px; color: var(--tenue-2); }

.nota {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 90;
  transform: translate(-50%, 0);
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 11px;
  background: rgba(23, 19, 16, .94);
  color: #fbf6ef;
  font-size: 13px;
  box-shadow: var(--sombra-2);
  animation: subir .3s var(--curva) both;
}

.nota--error { background: #7d2020; }

@keyframes subir {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ─────────────────────────────────────────────────────────── acceso */
.acceso {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(122, 46, 51, .09), transparent 70%),
    var(--lienzo);
}

.acceso__caja {
  width: min(384px, 100%);
  padding: 32px 30px 28px;
  border-radius: 20px;
  background: var(--papel);
  box-shadow: var(--sombra-2);
}

.acceso__marca { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }
.acceso__marca svg { width: 26px; height: 26px; color: var(--tinta); }
.acceso__marca span { font-size: 15px; font-weight: 600; letter-spacing: -.012em; }

.acceso h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 640;
  letter-spacing: -.028em;
}

.acceso p.sub { margin: 0 0 22px; font-size: 13px; color: var(--tenue); }
.acceso .btn { width: 100%; height: 40px; margin-top: 4px; }

.alerta {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(160, 40, 40, .08);
  color: #7d2020;
  font-size: 12.5px;
}

/* ─────────────────────────────────────────────────────────── móvil */
.solo-movil { display: none; }

@media (max-width: 1080px) {
  .pieza { grid-template-columns: 46px minmax(0, 1fr) 116px 104px; }
  .pieza__cat { display: none; }
}

@media (max-width: 860px) {
  :root { --lateral-w: 0px; }

  .lateral {
    inset: auto 0 0 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: .5px solid rgba(255, 255, 255, .1);
    background: rgba(23, 19, 16, .93);
    backdrop-filter: saturate(160%) blur(24px);
    -webkit-backdrop-filter: saturate(160%) blur(24px);
  }

  .lateral::after { display: none; }
  .marca, .lateral__pie, .menu__rotulo { display: none; }

  .menu { flex-direction: row; flex: 1; gap: 2px; }

  .menu__item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 48px;
    padding: 0;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .01em;
    border-radius: 10px;
  }

  .menu__item[aria-current="page"] { background: rgba(255, 255, 255, .09); }
  .menu__item[aria-current="page"]::after { display: none; }
  .menu__flecha { display: none; }

  .contenido { margin-left: 0; padding-bottom: 74px; }

  .barra { height: 56px; padding: 0 16px; gap: 10px; }
  .barra__titulo h1 { font-size: 15px; }
  .solo-movil { display: grid; }
  .buscador { width: auto; flex: 1; min-width: 0; }
  .buscador kbd { display: none; }

  .filtros { padding: 12px 16px 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .filtros::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .lienzo { padding: 16px 16px 48px; }

  .piezas { border-radius: 14px; }

  .pieza {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 14px;
  }

  .pieza__cat { display: none; }
  .pieza__precio { text-align: right; }
  .pieza__estado { display: none; }

  .hoja {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(calc(100% + 20px));
  }

  .hoja__asa { display: block; }
  .hoja__cuerpo { padding: 16px 20px calc(26px + env(safe-area-inset-bottom)); }

  .persona { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 12px 14px; }
  .persona .acciones { grid-column: 2 / -1; justify-content: flex-start; margin-top: 2px; }

  .metricas { grid-template-columns: 1fr 1fr; }
  .tarjeta { padding: 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ─────────────────────────────────────────────────────────── editor de pieza */
#nueva { height: 36px; padding: 0 14px; font-size: 13px; gap: 6px; flex: none; }

.editor { padding-top: 2px; }
.editor .hoja__nombre { margin-bottom: 16px; }

.editor .grupo {
  padding: 14px 14px 2px;
  border-radius: 14px;
  background: var(--papel);
  box-shadow: var(--sombra-1);
  margin-bottom: 14px;
}

.grupo__titulo {
  margin: 20px 4px 8px;
  font-size: 11px;
  font-weight: 620;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--tenue-2);
}

.editor .campo { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; position: relative; }

.editor .campo > span {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .015em;
  color: var(--tenue);
}

.editor .campo input,
.editor .campo select,
.editor .campo textarea {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--linea-fuerte);
  font: inherit;
  font-size: 13.5px;
  color: var(--tinta);
  outline: none;
  transition: box-shadow .16s var(--curva), background .16s;
}

.editor .campo textarea { height: auto; min-height: 76px; padding: 10px 11px; line-height: 1.5; resize: vertical; }

.editor .campo select { appearance: none; cursor: pointer; padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238b8078' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center;
}

.editor .campo input:focus,
.editor .campo select:focus,
.editor .campo textarea:focus {
  box-shadow: inset 0 0 0 1px var(--tinta), 0 0 0 3.5px rgba(122, 46, 51, .12);
}

.editor .campo em { position: absolute; right: 11px; bottom: 12px; font-size: 11px; font-style: normal; color: var(--tenue-2); pointer-events: none; }
.editor .campo:has(em) input { padding-right: 44px; }

.campo--mal { box-shadow: inset 0 0 0 1px #c0392b !important; background: #fff9f8 !important; }
.campo__error { margin: -6px 0 10px; font-size: 11.5px; line-height: 1.4; color: #a02828; font-weight: 500; }

.par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.interruptor { display: flex; align-items: center; gap: 10px; padding: 2px 2px 14px; font-size: 13px; color: var(--tinta); cursor: pointer; }
.interruptor input { width: 17px; height: 17px; accent-color: var(--vino); }

.fotos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }

.foto-mini { position: relative; margin: 0; aspect-ratio: 1 / 1; border-radius: 11px; overflow: hidden; background: #f2ece4; }
.foto-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-mini--principal { box-shadow: 0 0 0 2px var(--vino); }
.foto-mini figcaption {
  position: absolute; left: 5px; bottom: 5px; padding: 2px 5px; border-radius: 5px;
  background: var(--vino); color: #fff; font-size: 9px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.foto-mini__acciones { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; }
.foto-mini__acciones button {
  width: 23px; height: 23px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .94); color: var(--tinta);
  font-size: 13px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  display: grid; place-items: center; padding: 0;
  transition: transform .14s var(--curva), background .14s;
}
.foto-mini__acciones button:hover { background: #fff; transform: scale(1.08); }
.fotos__vacio { grid-column: 1 / -1; margin: 0 0 8px; font-size: 12px; color: var(--tenue); }

.subir {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; margin-bottom: 6px; border-radius: 11px;
  border: 1px dashed rgba(23, 19, 16, .24);
  color: var(--tenue); font-size: 13px; font-weight: 550; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.subir:hover { background: rgba(23, 19, 16, .035); color: var(--tinta); border-color: rgba(23, 19, 16, .34); }
.subir svg { width: 16px; height: 16px; }
.subir input { display: none; }

.btn--peligro { background: #fbf1f1; color: #a02828; box-shadow: inset 0 0 0 .5px rgba(160, 40, 40, .2); }
.btn--peligro:hover { background: #f6e3e3; box-shadow: inset 0 0 0 .5px rgba(160, 40, 40, .3); }
.btn--ancho { flex: 1; }

.editor .acciones { flex-wrap: wrap; justify-content: stretch; margin-top: 18px; }
.editor .acciones .btn { height: 40px; font-size: 13px; }
.editor .acciones .btn--vino { flex-basis: 100%; }
.acciones--ficha { margin-top: 20px; }

.hoja__desc { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: var(--tenue); }

.nota--flotante {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translateX(-50%) translateY(0);
  max-width: min(520px, calc(100vw - 32px));
  margin: 0; box-shadow: 0 12px 34px rgba(23, 19, 16, .3);
  animation: subir-nota .28s var(--curva);
}
@keyframes subir-nota { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

.pieza--arrastrando { opacity: .4; box-shadow: 0 12px 26px rgba(23, 19, 16, .2); }
.piezas li[draggable="true"] { cursor: grab; }

@media (max-width: 720px) {
  /* barra: título a la izquierda, acciones en su fila, buscador a todo el ancho */
  .barra { height: auto; flex-wrap: wrap; row-gap: 10px; padding: 12px 16px; }
  .barra__titulo { flex: 1 1 55%; min-width: 0; }
  .barra__titulo h1 { font-size: 23px; }
  .barra__titulo p { max-width: 56vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .acciones-barra { display: contents; }
  #nueva { order: 2; }
  .barra > .avatar { order: 3; }
  .buscador { order: 4; flex: 1 1 100%; height: 38px; }
  .lienzo { padding: 16px 16px 96px; }

  .editor .grupo { padding: 12px 12px 2px; border-radius: 13px; }
  .fotos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .nota--flotante { bottom: 86px; }
  #nueva { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
  #nueva span { display: none; }
  #nueva svg { width: 17px; height: 17px; }
}
