:root{
  --paper:#faf9f5;
  --surface:#ffffff;
  --ink:#181a1f;
  --muted:#6c706f;
  --line:#e2ded3;
  --accent:#ff5a1f;
  --accent-ink:#3a1400;
  --danger:#b6342a;
  --danger-bg:#fbe9e6;
  --good:#1c7a44;
  --focus:#1a6fe0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --paper:#111214;
    --surface:#1b1d20;
    --ink:#f1f0ec;
    --muted:#9c9f9d;
    --line:#333632;
    --accent:#ff7a45;
    --accent-ink:#1a0a00;
    --danger:#ff8a7a;
    --danger-bg:#3a1a16;
    --good:#5fd68e;
    --focus:#6aa8ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"]{
  --paper:#111214;
  --surface:#1b1d20;
  --ink:#f1f0ec;
  --muted:#9c9f9d;
  --line:#333632;
  --accent:#ff7a45;
  --accent-ink:#1a0a00;
  --danger:#ff8a7a;
  --danger-bg:#3a1a16;
  --good:#5fd68e;
  --focus:#6aa8ff;
  color-scheme: dark;
}

*{ box-sizing:border-box; }
html,body{ margin:0; }
body{
  background:var(--paper);
  color:var(--ink);
  font-family:'Inter', system-ui, sans-serif;
  padding-inline:16px;
  padding-block:20px 48px;
}
.wrap{ max-width:1080px; margin-inline:auto; }
.wrap.center{ text-align:center; padding-top:12vh; }
a{ color:inherit; }
a:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; border-radius:4px; }
[hidden]{ display:none !important; }

/* cabecera */
header.top{
  display:flex; align-items:center; gap:14px 22px; flex-wrap:wrap;
  padding-bottom:16px; margin-bottom:26px;
  border-bottom:1px solid var(--line);
}
.brand{
  display:inline-flex; align-items:center; gap:9px; text-decoration:none;
  font-family:'Archivo', sans-serif; font-weight:800; font-size:24px; letter-spacing:-0.01em;
}
.brand b{ color:var(--accent); }
.brand .logo{ width:30px; height:30px; flex:none; }
.brand.small{ font-size:18px; }
.tabs{ display:flex; gap:6px; flex-wrap:wrap; flex:1; }
.tabs a{
  font-weight:600; font-size:13.5px; text-decoration:none; color:var(--muted);
  padding:8px 13px; border-radius:9px; border:1px solid var(--line);
}
.tabs a:hover{ color:var(--ink); }
.tabs a[aria-current="page"], .tabs a.active{ background:var(--ink); border-color:var(--ink); color:var(--paper); }
.langs{ display:flex; gap:2px; }
.langs a{
  font-family:'IBM Plex Mono', monospace; font-size:12px; text-decoration:none; color:var(--muted);
  padding:6px 8px; border-radius:6px;
}
.langs a[aria-current="true"]{ color:var(--ink); background:var(--surface); border:1px solid var(--line); }
@media (max-width:640px){
  header.top{ column-gap:10px; }
  .langs{ margin-left:auto; }
  .langs a{ padding:6px 5px; }
  .tabs{ order:3; flex:1 1 100%; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
  .tabs a{ white-space:nowrap; padding:8px 11px; }
  .tabs .long{ display:none; }
}
@media (min-width:641px){ .tabs .short{ display:none; } }

.intro{ margin-bottom:24px; }
.intro h1{
  font-family:'Archivo', sans-serif; font-weight:800; letter-spacing:-0.015em; line-height:1.15;
  font-size:clamp(25px,4vw,36px); margin:0; max-width:24ch;
}
.intro .lead{ margin:10px 0 0; color:var(--muted); font-size:15.5px; line-height:1.55; max-width:62ch; }
.pills{ list-style:none; padding:0; margin:14px 0 0; display:flex; gap:6px; flex-wrap:wrap; }
.pills li{
  font-family:'IBM Plex Mono', monospace; font-size:11.5px; letter-spacing:.04em; text-transform:uppercase;
  color:var(--good); border:1px solid var(--good); border-radius:100px; padding:4px 10px;
}

/* herramienta */
main.layout{
  display:grid; grid-template-columns:minmax(0,360px) minmax(0,1fr);
  gap:28px; align-items:start;
}
@media (max-width:760px){
  main.layout{ grid-template-columns:1fr; }
}
.preview{ position:sticky; top:16px; }
@media (max-width:760px){ .preview{ position:static; } }
/* en móvil, el resultado justo después de los datos; la apariencia, debajo */
@media (max-width:760px){
  main.layout{ gap:18px; }
  main.layout:has(.after-preview) .controls{ display:contents; }
  main.layout:has(.after-preview) .panel{ margin-top:0; }
  main.layout:has(.after-preview) .preview{ order:1; }
  main.layout .panel.after-preview{ order:2; }
}

.panel{
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:22px;
}
.panel + .panel{ margin-top:18px; }
.panel h2{
  font-family:'Archivo', sans-serif; font-size:13px; font-weight:700;
  text-transform:uppercase; letter-spacing:.06em; margin:0 0 16px;
  color:var(--muted);
}

.field{ display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.field:last-child{ margin-bottom:0; }
.field label{ font-size:13px; font-weight:600; }
.field .hint, .hint{ font-size:12px; color:var(--muted); font-family:'IBM Plex Mono', monospace; }

select, input[type="text"], input[type="number"]{
  font:inherit; font-family:'IBM Plex Mono', monospace; font-size:14px;
  padding:10px 11px; border-radius:8px; border:1px solid var(--line);
  background:var(--paper); color:var(--ink); width:100%;
}
select:focus-visible, input:focus-visible, button:focus-visible, .btn:focus-visible{
  outline:2px solid var(--focus); outline-offset:1px;
}

optgroup{ font-family:'Inter',sans-serif; font-style:normal; font-weight:700; }
option{ font-family:'IBM Plex Mono', monospace; }

.row2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.row3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }

.check{ display:flex; align-items:center; gap:8px; font-size:13px; font-weight:600; }
.check input{ width:16px; height:16px; accent-color:var(--accent); }

.colorfield{ display:flex; align-items:center; gap:8px; }
.colorfield input[type="color"]{
  width:38px; height:36px; padding:2px; border-radius:8px; border:1px solid var(--line);
  background:var(--surface); cursor:pointer; flex:none;
}
.colorfield input[type="text"]{ flex:1; min-width:0; }
.inputrow{ display:flex; gap:8px; }
.inputrow input{ flex:1; min-width:0; }
.inputrow button{ flex:none; white-space:nowrap; }
.note{
  font-size:12.5px; line-height:1.45; color:var(--muted); margin:2px 0 0;
  border-left:3px solid var(--accent); padding:6px 10px; background:var(--paper); border-radius:0 6px 6px 0;
}

.error{
  display:none; font-size:13px; color:var(--danger); background:var(--danger-bg);
  border-radius:8px; padding:10px 12px; margin-top:14px; font-family:'IBM Plex Mono',monospace;
}
.error.show{ display:block; }

.chips{ display:flex; flex-wrap:wrap; gap:6px; }
.chips button{
  background:transparent; border-color:var(--line); color:var(--muted); padding:7px 11px; font-size:13px;
}
.chips button[aria-pressed="true"]{ background:var(--ink); border-color:var(--ink); color:var(--paper); }

/* vista previa */
.ticket{
  background:var(--surface); border:1px solid var(--line); border-radius:16px;
  padding:30px 24px 22px; position:relative; overflow:hidden;
}
.ticket::before{
  content:""; position:absolute; inset:0 0 auto 0; height:6px;
  background:repeating-linear-gradient(90deg, var(--accent) 0 14px, transparent 14px 24px);
  opacity:.55;
}
.canvas-shell{
  background:#fff; border-radius:10px; padding:22px 16px;
  display:flex; justify-content:center; align-items:center;
  min-height:150px; overflow-x:auto;
}
#barcode{ max-width:100%; height:auto; }
.qr-shell canvas{ width:min(280px, 100%); height:auto; image-rendering:pixelated; }
.ticket .meta{
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px;
  margin-top:16px; padding-top:14px; border-top:1px dashed var(--line);
}
.ticket .meta .fmt{
  font-family:'IBM Plex Mono', monospace; font-size:12px; color:var(--muted);
  letter-spacing:.03em; text-transform:uppercase;
}
.ticket .meta .fmt b{ color:var(--ink); }

.actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }
button, .btn{
  font:inherit; font-weight:600; font-size:13.5px; border-radius:9px; cursor:pointer;
  padding:10px 16px; border:1px solid transparent; text-decoration:none; display:inline-flex;
  align-items:center; gap:6px;
}
button.primary, .btn.primary{ background:var(--accent); color:var(--accent-ink); }
button.primary:hover, .btn.primary:hover{ filter:brightness(1.06); }
button.ghost, .btn.ghost{ background:transparent; border-color:var(--line); color:var(--ink); }
button.ghost:hover, .btn.ghost:hover{ background:var(--paper); }
button:disabled{ opacity:.5; cursor:not-allowed; }

.save-hint{ font-size:12.5px; color:var(--muted); margin-top:10px; line-height:1.5; }
.copy-status{ font-size:12.5px; color:var(--good); margin-top:8px; display:none; }
.copy-status.show{ display:block; }
.copy-status.bad{ color:var(--danger); }
.warn{ font-size:12.5px; color:var(--danger); margin-top:10px; line-height:1.5; }

/* códigos en pantalla */
.stack-bar{ display:flex; justify-content:flex-end; align-items:center; gap:8px; margin-bottom:8px; }
.stack-count{ margin-right:auto; font-family:'IBM Plex Mono', monospace; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
button.mini, .btn.mini{ padding:5px 10px; font-size:12.5px; border-radius:7px; gap:4px; white-space:nowrap; }
button.strong{ border-color:var(--ink); }
/* la tarjeta principal conserva el aire de Rótulo Barras; las añadidas, compactas */
.ticket.code-card.item, .preview:fullscreen .ticket.code-card{ padding:14px 14px 12px; }
.ticket.code-card.item::before{ display:none; }
.code-card.item .canvas-shell, .preview:fullscreen .code-card .canvas-shell{ padding:14px 10px; min-height:0; }
.code-bar{ display:flex; align-items:center; gap:6px 10px; flex-wrap:wrap; margin-top:10px; }
#mainTicket > .code-bar{ margin-top:16px; padding-top:14px; border-top:1px dashed var(--line); }
.preview:fullscreen #mainTicket > .code-bar{ margin-top:10px; padding-top:0; border-top:0; }
.code-bar .fmt{ font-family:'IBM Plex Mono', monospace; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; white-space:nowrap; }
.code-bar .fmt b{ color:var(--ink); }
.mini-actions{ display:flex; gap:6px; margin-left:auto; flex-wrap:wrap; }
.code-card .copy-status, .code-card .save-hint{ margin:8px 0 0; }
.board{ margin-top:12px; }
.board-list{ display:flex; flex-direction:column; gap:12px; }
.ticket.bad .card-code{ outline:2px solid var(--danger); }
.ticket.flash{ animation:flash 1.2s ease-out; }
@keyframes flash{ from{ box-shadow:0 0 0 4px var(--accent); } to{ box-shadow:0 0 0 4px transparent; } }
@media (prefers-reduced-motion:reduce){ .ticket.flash{ animation:none; outline:3px solid var(--accent); } }
input.card-name{
  font-family:'Inter', system-ui, sans-serif; font-weight:600; font-size:13px;
  padding:4px 8px; border-color:transparent; background:transparent; flex:1 1 50px; min-width:0; width:auto;
}
input.card-name:hover{ border-color:var(--line); }
.card-code{ width:100%; border:0; cursor:zoom-in; font:inherit; }
.card-code canvas{ max-width:100%; height:auto; }
.card-del{ font-size:15px; line-height:1; }
/* pantalla completa: todos los códigos en cuadrícula, sin textos de ayuda */
.preview:fullscreen{ background:var(--paper); padding:20px; overflow:auto; display:grid; grid-template-columns:repeat(auto-fill, minmax(380px, 1fr)); gap:14px; align-content:start; }
.preview:fullscreen .stack-bar{ grid-column:1 / -1; margin:0; }
.preview:fullscreen .board, .preview:fullscreen .board-list{ display:contents; }
.preview:fullscreen .save-hint, .preview:fullscreen .copy-status, .preview:fullscreen #boardAdd{ display:none; }

dialog.zoom{
  border:1px solid var(--line); border-radius:16px; padding:20px;
  background:var(--surface); color:var(--ink);
  width:min(1160px, calc(100vw - 24px)); max-width:none; max-height:calc(100vh - 24px);
}
dialog.zoom::backdrop{ background:rgba(0,0,0,.6); }
.zoom-name{ font-family:'Archivo', sans-serif; font-weight:700; font-size:22px; margin:0 0 12px; text-align:center; overflow-wrap:anywhere; }
.zoom-shell{ background:#fff; border-radius:10px; padding:16px 0; display:flex; justify-content:center; overflow-x:auto; }
.zoom-shell canvas{ max-width:none; }
.zoom-nav{ display:flex; justify-content:center; align-items:center; gap:10px; margin-top:14px; flex-wrap:wrap; }
.zoom-nav button.ghost{ font-size:20px; padding:6px 16px; line-height:1; }

/* lote */
textarea{
  font:inherit; font-family:'IBM Plex Mono', monospace; font-size:13.5px; line-height:1.5;
  padding:10px 12px; border-radius:9px; border:1px solid var(--line);
  background:var(--paper); color:var(--ink); min-height:180px; resize:vertical; width:100%;
}
textarea.short{ min-height:84px; }
textarea:focus-visible{ outline:2px solid var(--focus); outline-offset:1px; }
.btnrow{ display:flex; gap:8px; flex-wrap:wrap; }
.center .btnrow{ justify-content:center; }
.btnrow button, .btnrow .btn{ padding:8px 12px; font-size:13px; }
.seq{ border:1px dashed var(--line); border-radius:10px; padding:14px; margin-bottom:16px; }
.summary{ font-size:13px; font-family:'IBM Plex Mono', monospace; margin-top:4px; }
.summary .ok{ color:var(--good); }
.summary .bad{ color:var(--danger); }
.badlist{ font-size:12px; color:var(--danger); font-family:'IBM Plex Mono', monospace; margin:6px 0 0; padding-left:18px; }
.sheet-shell{
  background:var(--paper); border-radius:10px; padding:16px;
  display:flex; justify-content:center;
}
#sheetPreview{ background:#fff; box-shadow:0 1px 6px rgba(0,0,0,.18); max-width:100%; }

/* artículo */
.info{ margin-top:44px; font-size:15.5px; line-height:1.65; max-width:72ch; }
.info h2{ font-family:'Archivo', sans-serif; font-size:22px; line-height:1.25; margin:34px 0 8px; }
.info h2:first-child{ margin-top:0; }
.info h3{ font-size:16px; margin:22px 0 4px; }
.info p, .info ul, .info ol{ margin:0 0 12px; }
.info li{ margin-bottom:4px; }
.info code{ font-family:'IBM Plex Mono', monospace; font-size:.9em; background:var(--surface); border:1px solid var(--line); border-radius:5px; padding:1px 5px; overflow-wrap:anywhere; }
.info table{ border-collapse:collapse; width:100%; font-size:14px; margin:6px 0 14px; display:block; overflow-x:auto; }
.info th, .info td{ text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); vertical-align:top; }
.info th{ font-weight:600; }
.info .faq{ margin-top:34px; padding-top:6px; border-top:1px solid var(--line); }
.info .note{ background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:8px; padding:12px 14px; }

/* pie */
footer.foot{
  margin-top:48px; padding-top:22px; border-top:1px solid var(--line);
  font-size:13px; color:var(--muted); display:flex; justify-content:space-between;
  gap:20px 40px; flex-wrap:wrap;
}
footer.foot p{ margin:8px 0 0; max-width:42ch; line-height:1.5; }
footer.foot .brand{ color:var(--ink); }
.footlinks{ list-style:none; padding:0; margin:0; columns:2; column-gap:32px; }
.footlinks li{ margin-bottom:6px; }
.footlinks a{ text-decoration:none; }
.footlinks a:hover{ color:var(--ink); text-decoration:underline; }
@media (max-width:480px){ .footlinks{ columns:1; } .row3{ grid-template-columns:1fr 1fr; } }
