/* vitrinaenlinea — consola de multinegocios. Claro por defecto, oscuro según el sistema (o data-theme). */
:root {
  --bg: #f2f4f7; --surface: #ffffff; --surface2: #f7f8fa; --line: #dde2ea; --line-strong: #c3cbd7;
  --text: #17202d; --muted: #5d6b80; --accent: #3a4bc7; --accent-ink: #ffffff; --accent-soft: #e6e9fb;
  --ok: #17794b; --ok-soft: #e0f3e8; --warn: #9a5b00; --warn-soft: #fdf0d6; --bad: #b3261e; --bad-soft: #fbe4e2;
  --sombra: 0 1px 2px rgba(20, 30, 50, .06), 0 6px 20px rgba(20, 30, 50, .05);
  --radio: 8px;
  --f-texto: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131a; --surface: #171d27; --surface2: #1c2431; --line: #29323f; --line-strong: #3a4556;
    --text: #e6ebf3; --muted: #93a0b5; --accent: #8c9bff; --accent-ink: #0f131a; --accent-soft: #232b4d;
    --ok: #55d08d; --ok-soft: #14301f; --warn: #f0b95a; --warn-soft: #3a2c10; --bad: #ff8a80; --bad-soft: #3b1815;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  --bg: #0f131a; --surface: #171d27; --surface2: #1c2431; --line: #29323f; --line-strong: #3a4556;
  --text: #e6ebf3; --muted: #93a0b5; --accent: #8c9bff; --accent-ink: #0f131a; --accent-soft: #232b4d;
  --ok: #55d08d; --ok-soft: #14301f; --warn: #f0b95a; --warn-soft: #3a2c10; --bad: #ff8a80; --bad-soft: #3b1815;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--f-texto); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--f-mono); font-size: .92em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── botones y campos ── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radio); cursor: pointer; font-weight: 500; text-decoration: none; min-height: 38px; }
.btn:hover { border-color: var(--accent); }
.btn.primario { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primario:hover { filter: brightness(1.08); }
.btn.peligro { color: var(--bad); border-color: var(--bad); }
.btn.chico { padding: 4px 10px; min-height: 30px; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.campo label { font-size: .82rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.campo input[type=text], .campo input[type=password], .campo input:not([type]), .campo select, .campo textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radio); background: var(--surface); }
.campo input[type=color] { width: 100%; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radio); background: var(--surface); cursor: pointer; }
.campo .ayuda { font-size: .8rem; color: var(--muted); }
.fila { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.msg { margin: 8px 0; padding: 9px 12px; border-radius: var(--radio); font-size: .92rem; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.msg.aviso { background: var(--warn-soft); color: var(--warn); }

/* ── acceso ── */
.acceso { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; }
.acceso-tarjeta { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: var(--sombra); }
.marca-vitrina { font-family: var(--f-mono); font-weight: 600; font-size: 1.5rem; letter-spacing: -.02em; }
.marca-vitrina b { color: var(--accent); font-weight: 600; }
.acceso h1 { font-size: 1rem; font-weight: 500; color: var(--muted); margin: 4px 0 20px; }

/* ── cabecera ── */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.barra .marca-vitrina { font-size: 1.15rem; }
.barra .sep { color: var(--line-strong); }
.barra .rol { margin-left: auto; font-size: .8rem; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.resumen { display: flex; flex-wrap: wrap; gap: 6px 0; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface2); }
.resumen div { padding: 0 22px 0 0; margin-right: 22px; border-right: 1px solid var(--line); }
.resumen div:last-child { border: 0; }
.resumen .n { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.resumen .t { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── cuerpo: lista + detalle ── */
.cuerpo { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; min-height: calc(100vh - 140px); }
.lista { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.lista-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--line); }
.lista-cab h2 { font-size: .95rem; }
.neg { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.neg:hover { background: var(--surface2); }
.neg[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.neg .nombre { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neg .dom { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neg .cifras { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; line-height: 1.35; }
.insignia { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 1.15rem; position: relative; overflow: hidden; }
.insignia i { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--ok); }
.punto.off { background: var(--line-strong); }

.detalle { padding: 22px 26px 60px; min-width: 0; }
.vacio { color: var(--muted); padding: 50px 10px; text-align: center; }
.encabezado { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.encabezado .insignia { width: 56px; height: 56px; font-size: 1.5rem; }
.encabezado h2 { font-size: 1.4rem; }
.encabezado .acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.etiqueta { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--line); color: var(--muted); }
.etiqueta.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.etiqueta.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.etiqueta.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.pestanas { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; overflow-x: auto; }
.pestanas button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.pestanas button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.bloque { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; max-width: 880px; }
.bloque h3 { font-size: 1rem; margin-bottom: 4px; }
.bloque > p.muted { margin: 0 0 14px; font-size: .9rem; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 22px; }
.datos dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.datos dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.datos dd small { font-weight: 400; color: var(--muted); font-size: .8rem; }

/* vista previa de marca */
.marca-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 22px; align-items: start; max-width: 960px; }
.previa { position: sticky; top: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.previa .cat { padding: 18px 16px 20px; text-align: center; }
.previa .cat .nom { font-size: 1.7rem; line-height: 1.1; font-weight: 600; letter-spacing: .02em; }
.previa .cat .lema { font-size: .62rem; letter-spacing: .26em; text-transform: uppercase; margin-top: 6px; opacity: .8; }
.previa .cat .pildora { display: inline-block; margin-top: 14px; padding: 5px 16px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.previa .cat .tarjeta { margin: 14px auto 0; width: 70%; height: 54px; border-radius: 6px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.previa .pan { padding: 10px 14px; font-size: .78rem; display: flex; gap: 8px; align-items: center; }
.previa .pan b { font-size: .9rem; }
.previa .rotulo { padding: 6px 12px; font-size: .72rem; color: var(--muted); background: var(--surface2); border-top: 1px solid var(--line); }

/* lista de verificacion */
.chequeo { list-style: none; padding: 0; margin: 0 0 14px; }
.chequeo li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.chequeo li:last-child { border: 0; }
.chequeo .ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--line); color: var(--muted); }
.chequeo .ico.ok { background: var(--ok-soft); color: var(--ok); }
.chequeo .ico.no { background: var(--bad-soft); color: var(--bad); }
.chequeo strong { display: block; }
pre.salida { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radio); padding: 10px 12px; font: .8rem/1.45 var(--f-mono); max-height: 260px; overflow: auto; white-space: pre-wrap; }

table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tabla th, table.tabla td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.tabla th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.scroll-x { overflow-x: auto; }

/* dialogo */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); width: min(720px, calc(100vw - 24px)); box-shadow: var(--sombra); }
dialog::backdrop { background: rgba(10, 14, 22, .55); }
.dlg { padding: 22px 24px; max-height: calc(100vh - 40px); overflow-y: auto; }
.dlg h3 { font-size: 1.15rem; margin-bottom: 14px; }
.dlg .pie { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.secreto { display: flex; gap: 8px; align-items: center; background: var(--surface2); border: 1px dashed var(--line-strong); border-radius: var(--radio); padding: 10px 12px; margin: 10px 0; }
.secreto code { font-family: var(--f-mono); font-size: 1.1rem; flex: 1; word-break: break-all; }

.volver { display: none; margin-bottom: 10px; }
@media (max-width: 860px) {
  .cuerpo { grid-template-columns: 1fr; }
  .lista { border-right: 0; }
  .detalle { padding: 16px 14px 50px; }
  .cuerpo[data-vista="detalle"] .lista { display: none; }
  .cuerpo[data-vista="lista"] .detalle { display: none; }
  .volver { display: inline-flex; }
  .marca-grid { grid-template-columns: 1fr; }
  .previa { position: static; }
  .barra, .resumen { padding-left: 14px; padding-right: 14px; }
  .resumen div { padding-right: 14px; margin-right: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
