/* ==========================================================================
   Panel de administración — misma paleta de marca, interfaz simple y clara
   ========================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: optional; src: url("../fonts/inter-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: optional; src: url("../fonts/space-grotesk-latin.woff2") format("woff2"); }
:root {
  --color-primario: #570606;
  --color-primario-oscuro: #3a0303;
  --color-secundario: #F97316;
  --color-secundario-texto: #c2410c;
  --color-acento: #5d3a8e;
  --color-acento-2: #7c55b5;
  --color-acento-claro: #efe9f7;
  --fondo: #f6f3f1;
  --superficie: #fff;
  --texto: #1f1720;
  --texto-suave: #5b5160;
  --borde: #e6dfdb;
  --ok: #15803d;
  --error: #b91c1c;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(40, 10, 20, .07), 0 4px 14px rgba(40, 10, 20, .05);
  --nav-w: 240px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 400 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--texto); background: var(--fondo); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: "Space Grotesk", system-ui, sans-serif; line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 1.2rem; }
a { color: var(--color-acento); }
a:hover { color: var(--color-primario); }
img { max-width: 100%; height: auto; }
code { background: var(--color-acento-claro); padding: .1rem .35rem; border-radius: 5px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--color-secundario); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 1rem; top: -100px; background: var(--color-secundario); color: #2a0303; padding: .6rem 1rem; border-radius: 8px; z-index: 200; font-weight: 700; }
.skip:focus { top: 1rem; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.texto-suave { color: var(--texto-suave); }
.centro { text-align: center; }
hr { border: 0; border-top: 1px solid var(--borde); margin: 1.25rem 0; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .55rem 1.1rem; border-radius: 999px; border: 2px solid transparent; background: var(--color-acento); color: #fff; font: 600 .93rem/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; transition: background .2s, transform .2s, box-shadow .2s; }
.btn:hover { background: var(--color-acento-2); color: #fff; transform: translateY(-1px); }
.btn-sec { background: #fff; color: var(--color-acento); border-color: var(--color-acento); }
.btn-sec:hover { background: var(--color-acento); color: #fff; }
.btn-cta { background: var(--color-secundario); color: #2a0303; }
.btn-wa { background: #0f7a40; color: #fff; }
.btn-wa:hover { background: #0b6334; }
.btn-peligro { background: #fff; color: var(--error); border-color: #f3c4c4; }
.btn-peligro:hover { background: var(--error); color: #fff; }
.btn-link { background: none; color: var(--color-acento); text-decoration: underline; }
.btn-link:hover { background: none; color: var(--color-primario); transform: none; }
.btn-peligro-txt { color: var(--error); }
.btn-mini { min-height: 34px; padding: .3rem .8rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: 1rem; padding: .7rem 1.6rem; }

/* ---------- Estructura ---------- */
.adm-top { position: sticky; top: 0; z-index: 30; height: 58px; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; color: #fff; background: linear-gradient(100deg, var(--color-primario), #4b1446); box-shadow: 0 2px 12px rgba(58, 3, 3, .25); }
.adm-burger { width: 42px; height: 42px; display: grid; place-items: center; border: 0; background: rgba(255, 255, 255, .1); color: #fff; border-radius: 10px; cursor: pointer; }
.adm-burger .ico { width: 22px; height: 22px; }
.adm-marca { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.02rem; min-width: 0; }
.adm-marca span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-marca img { border-radius: 8px; }
.adm-ver-tienda { margin-left: auto; color: #fde8dc; font-size: .88rem; white-space: nowrap; }
.adm-ver-tienda:hover { color: var(--color-secundario); }
.adm-nav { position: fixed; top: 58px; bottom: 0; left: 0; width: var(--nav-w); background: var(--superficie); border-right: 1px solid var(--borde); padding: 1rem .75rem; overflow-y: auto; z-index: 25; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .25s; }
.adm-nav.abierto { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .15); }
.adm-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.adm-nav a { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 10px; color: var(--texto); text-decoration: none; font-weight: 500; }
.adm-nav a .ico { color: var(--texto-suave); }
.adm-nav a:hover { background: var(--color-acento-claro); color: var(--color-acento); }
.adm-nav a[aria-current="page"] { background: var(--color-acento); color: #fff; }
.adm-nav a[aria-current="page"] .ico { color: #fff; }
.adm-badge { margin-left: auto; background: var(--color-secundario); color: #2a0303; border-radius: 999px; font-size: .75rem; padding: 0 .5rem; min-width: 22px; text-align: center; }
.adm-salir { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--borde); font-size: .88rem; }
.adm-salir p { margin: 0 0 .6rem; }
.adm-overlay { position: fixed; inset: 58px 0 0; background: rgba(20, 5, 10, .45); z-index: 20; }
.adm-main { padding: 1.25rem 1rem 4rem; max-width: 1280px; }
.adm-main:focus { outline: none; }
@media (min-width: 1024px) {
  .adm-burger { display: none; }
  .adm-nav { transform: none; }
  .adm-overlay { display: none !important; }
  .adm-main { margin-left: var(--nav-w); padding: 1.75rem 2rem 4rem; }
}

/* ---------- Tarjetas y grillas ---------- */
.adm-card { background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.25rem; margin-bottom: 1.25rem; min-width: 0; }
.adm-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.adm-card-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.adm-card-angosta { max-width: 520px; }
.adm-grid { display: grid; gap: 0 1.25rem; }
@media (min-width: 1100px) {
  .adm-grid { grid-template-columns: 1.7fr 1fr; align-items: start; }
  .adm-grid-form { grid-template-columns: minmax(0, 1fr) 340px; }
}
.barra-acciones { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }
.kpi { background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; border-top: 4px solid var(--color-acento); text-decoration: none; color: var(--texto); min-width: 0; }
.kpi:first-child { border-top-color: var(--color-primario); }
.kpi-link:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(40, 10, 20, .1); color: var(--texto); }
.kpi-alerta { border-top-color: var(--color-secundario); }
.kpi-label { font-size: .8rem; color: var(--texto-suave); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-valor { font-family: "Space Grotesk", sans-serif; font-size: clamp(1.35rem, 3vw, 1.9rem); line-height: 1.15; overflow-wrap: anywhere; }
.kpi-sub { font-size: .82rem; color: var(--texto-suave); }

/* Gráfico */
.grafico { margin: 0; position: relative; }
.grafico svg { width: 100%; height: auto; display: block; overflow: visible; }
.g-grid { stroke: #ece6e3; stroke-width: 1; }
.g-base { stroke: #b9aeb0; stroke-width: 1; }
.g-eje { font-size: 11px; fill: var(--texto-suave); font-family: "Inter", sans-serif; }
.g-barra { fill: var(--color-acento); transition: fill .15s; }
.g-hit { fill: transparent; cursor: default; }
.g-col:hover .g-barra, .g-col.activa .g-barra { fill: var(--color-primario); }
.g-col:hover .g-hit, .g-col.activa .g-hit { fill: rgba(93, 58, 142, .06); }
.g-tooltip { position: absolute; pointer-events: none; background: var(--texto); color: #fff; font-size: .8rem; font-weight: 600; padding: .35rem .6rem; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.tabla-alt { margin-top: .75rem; font-size: .88rem; }
.tabla-alt summary { cursor: pointer; color: var(--color-acento); font-weight: 600; }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-suave); padding: .6rem .7rem; border-bottom: 2px solid var(--borde); white-space: nowrap; }
.tabla td { padding: .7rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla tbody tr:hover { background: #fcfaf9; }
.tabla tfoot th, .tabla tfoot td { text-transform: none; font-size: .92rem; color: var(--texto); border-bottom: 0; padding: .4rem .7rem; text-align: right; letter-spacing: 0; }
.fila-total th, .fila-total td { font-size: 1.1rem !important; font-weight: 700; color: var(--color-primario) !important; border-top: 2px solid var(--texto) !important; }
.num-col { text-align: right !important; white-space: nowrap; }
.fila-apagada { opacity: .55; }
.fila-nueva { background: #fff8f2; }
.mini { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; display: block; }
.acciones-fila { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.acciones-fila form { margin: 0; }
.tabla-compacta td, .tabla-compacta th { padding: .35rem .5rem; }
.txt-oferta { color: var(--color-secundario-texto); }
.txt-ok { color: var(--ok); }
/* En celular las tablas se transforman en tarjetas */
@media (max-width: 760px) {
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
  .tabla tr { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: .75rem; padding: .5rem .75rem; }
  .tabla td { border: 0; padding: .35rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .tabla td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--texto-suave); font-size: .8rem; text-align: left; }
  .tabla td:not([data-label]) { justify-content: flex-start; }
  .tabla .acciones-fila { justify-content: flex-end; }
  .tabla tfoot, .tabla tfoot tr, .tabla tfoot th { display: block; }
  .tabla tfoot tr { display: flex; justify-content: space-between; }
  .tabla tfoot td { display: block; width: auto; }
}

/* Estados */
.estado, .chip { display: inline-block; padding: .18rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--color-acento-claro); color: var(--color-acento); }
.est-nuevo, .chip-nuevo { background: #ffedd5; color: #9a3412; }
.est-produccion { background: #ede4f8; color: #5d3a8e; }
.est-listo { background: #dbeafe; color: #1e40af; }
.est-enviado { background: #e0f2fe; color: #075985; }
.est-entregado, .chip-aceptado { background: #dcfce7; color: #166534; }
.est-cancelado, .chip-rechazado { background: #f3f4f6; color: #4b5563; }
.chip-respondido { background: #e0f2fe; color: #075985; }
.estados-botones { display: flex; flex-wrap: wrap; gap: .5rem; }
.estados-botones form { margin: 0; }
.btn-estado { min-height: 44px; padding: .5rem 1rem; border-radius: 999px; border: 2px solid currentColor; font: 700 .9rem inherit; font-family: inherit; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.btn-estado:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, .12); }
.btn-estado.actual { box-shadow: 0 0 0 3px var(--superficie), 0 0 0 5px currentColor; cursor: default; }
.stock-pill { display: inline-block; min-width: 36px; text-align: center; padding: .12rem .5rem; border-radius: 999px; background: #dcfce7; color: #166534; font-weight: 700; font-size: .82rem; }
.stock-bajo { background: #ffedd5; color: #9a3412; }
.stock-cero { background: #fee2e2; color: #991b1b; }

/* Switch y estrella */
.switch { width: 46px; height: 26px; border-radius: 999px; border: 0; background: #d6cdc9; position: relative; cursor: pointer; transition: background .2s; padding: 0; }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"] span { transform: translateX(20px); }
.estrella { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #cfc6c2; padding: .2rem; transition: transform .15s; }
.estrella.on { color: var(--color-secundario); }
.estrella:hover { transform: scale(1.2); }

/* Tabs */
.tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: 1rem; }
.tabs a { white-space: nowrap; padding: .45rem .9rem; border-radius: 999px; background: var(--superficie); color: var(--texto); text-decoration: none; font-weight: 600; font-size: .88rem; box-shadow: var(--sombra); }
.tabs a b { font-weight: 700; color: var(--texto-suave); margin-left: .2rem; }
.tabs a[aria-current="page"] { background: var(--color-acento); color: #fff; }
.tabs a[aria-current="page"] b { color: #e9ddf7; }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; font-weight: 600; font-size: .88rem; }
.campo small { font-weight: 400; color: var(--texto-suave); }
.campo-chico { font-size: .8rem; margin: .4rem 0 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 42px; padding: .5rem .75rem; border: 1.5px solid #d6cdc9; border-radius: 10px; font: 400 .95rem inherit; font-family: inherit; background: #fff; color: var(--texto); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-acento); box-shadow: 0 0 0 3px rgba(93, 58, 142, .18); }
input[type=file] { padding: .7rem; border: 2px dashed #cbbfd9; border-radius: 10px; background: var(--color-acento-claro); width: 100%; font-size: .88rem; }
.campo.invalido input, .campo.invalido select, .campo.invalido textarea { border-color: var(--error); }
.campo-error { color: var(--error); font-weight: 500; font-size: .82rem; }
.opcion-adm { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; cursor: pointer; font-size: .92rem; min-height: 36px; }
.opcion-adm input { width: 18px; height: 18px; accent-color: var(--color-acento); }
.opcion-peligro { color: var(--error); }
.grid-2 { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .campo-full { grid-column: 1 / -1; } }
.filtros-adm { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; background: var(--superficie); padding: 1rem; border-radius: var(--radio); box-shadow: var(--sombra); margin-bottom: 1rem; }
.filtros-adm .campo { margin: 0; flex: 1 1 160px; }
.filtros-adm .opcion-adm { padding-bottom: .4rem; }
.form-inline .campo { margin-bottom: .6rem; }
.guardar-sticky { position: sticky; bottom: 1rem; z-index: 5; }
.guardar-sticky-ancho { display: flex; justify-content: flex-end; background: rgba(246, 243, 241, .92); backdrop-filter: blur(4px); padding: .75rem; border-radius: var(--radio); }
.imgs-admin { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.imgs-admin li { background: var(--fondo); border-radius: 10px; padding: .5rem; }
.imgs-admin img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.var-fila { display: grid; grid-template-columns: 130px 1fr; gap: .6rem; }
.var-fila .campo { margin-bottom: .5rem; }
.img-actual { display: block; width: 120px; height: 120px; object-fit: cover; border-radius: 10px; margin-bottom: .5rem; }
.grid-imgs-config { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.img-config img { width: 100%; height: 140px; object-fit: cover; border-radius: 10px; background: var(--fondo); margin-bottom: .5rem; }
.img-config img.logo-prev { object-fit: contain; padding: 1rem; background: var(--color-primario); }
.testimonio-admin { border: 1px solid var(--borde); border-radius: 10px; padding: .75rem 1rem 0; margin: 0 0 .75rem; }
.testimonio-admin legend { font-weight: 700; padding: 0 .3rem; }

/* Detalles */
.lista-simple { list-style: none; padding: 0; margin: 0; }
.lista-simple li { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--borde); }
.lista-simple li:last-child { border: 0; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; font-size: .9rem; }
.timeline li { padding-left: 1rem; border-left: 3px solid var(--color-acento-claro); }
.timeline-fecha { color: var(--texto-suave); font-size: .8rem; display: block; }
.ficha-adm { margin: 0 0 1rem; display: grid; gap: 0; }
.ficha-adm div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--borde); }
.ficha-adm dt { color: var(--texto-suave); }
.ficha-adm dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.caja-texto { background: var(--fondo); border-radius: 10px; padding: .9rem 1rem; white-space: normal; overflow-wrap: anywhere; }
.adjunto-img { max-height: 320px; border-radius: 10px; display: block; margin-bottom: .5rem; }
.botones-respuesta { display: grid; gap: .5rem; margin: 1rem 0; }
.mensaje.no-leido { border-left: 4px solid var(--color-secundario); }
.mensaje .caja-texto { margin-bottom: .75rem; }
.link-corto { word-break: break-all; }

/* Alertas */
.alerta { padding: .85rem 1rem; border-radius: 10px; margin: 0 0 1rem; border-left: 5px solid; background: #fff; }
.alerta ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.alerta-ok { border-color: var(--ok); background: #effaf3; color: #14532d; }
.alerta-error { border-color: var(--error); background: #fdf0f0; color: #7f1d1d; }
.alerta-aviso { border-color: #d97706; background: #fff8eb; color: #92400e; }

/* Login / instalación */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, var(--color-primario) 0%, #44082f 55%, var(--color-acento) 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 2rem 1.5rem; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.login-card-ancha { max-width: 560px; }
.login-card h1 { font-size: 1.45rem; margin-bottom: .25rem; }
.login-logo { display: block; margin-bottom: 1rem; border-radius: 12px; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Instalador */
.requisitos { list-style: none; padding: .75rem 1rem; margin: 0 0 1rem; background: var(--fondo); border-radius: 10px; font-size: .88rem; display: grid; gap: .2rem; }
.req-ok { color: var(--ok); }
.req-mal { color: var(--error); font-weight: 600; }
.config-manual { font-family: Consolas, monospace; font-size: .8rem; margin-bottom: 1rem; }
