/* qubio — estilos de la app (marca: azul qubio, navy, acento naranja; Plus Jakarta Sans) */
:root {
  /* Marca qubio: Qubio Blue #2857EC · Navy #0B1F44 · Acento #F06647 · Gris claro #F5F7FA · Blanco */
  --bg: #f5f7fa;        /* gris claro */
  --paper: #ffffff;
  --ink: #0b1f44;       /* navy */
  --brand: #0b1f44;     /* wordmark */
  --muted: #5e6b85;
  --line: #e1e6ef;
  --accent: #2857ec;    /* qubio blue */
  --accent-ink: #fff;
  --accent2: #f06647;   /* acento naranja (punto de la i, detalles) */
  --ok: #1e9e6a;
  --sage: #1e9e6a;
  --stone: #a3aec2;
  --mark: #dce5ff;      /* resaltado de búsqueda */
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071330; --paper: #0e1e45; --ink: #eef2fa; --brand: #ffffff; --muted: #96a3bf;
    --line: #1f3263; --accent: #4a73f3; --mark: #22408f; --stone: #4a5b80; --ok: #3cc28b; --sage: #3cc28b;
  }
}
:root[data-theme="dark"] {
  --bg: #071330; --paper: #0e1e45; --ink: #eef2fa; --brand: #ffffff; --muted: #96a3bf;
  --line: #1f3263; --accent: #4a73f3; --mark: #22408f; --stone: #4a5b80; --ok: #3cc28b; --sage: #3cc28b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 'Plus Jakarta Sans', system-ui, sans-serif;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
small, .muted { color: var(--muted); }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }

/* ---------- Íconos ---------- */
.ic {
  width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ic.thick { stroke-width: 3.2; }
.chev { color: var(--muted); margin-left: auto; }

/* ---------- Barra superior (PC) y pestañas (celular) ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.logo { color: var(--brand); letter-spacing: -.035em; }
.logo .mark { width: 1.55em; height: 1.55em; flex: none; color: var(--accent); }
.wm { line-height: 1; }
.wi { position: relative; display: inline-block; }
.wi::after { content: ''; position: absolute; left: 50%; top: .06em; width: .21em; height: .21em; margin-left: -.155em; border-radius: 50%; background: var(--accent2); }
.top nav { display: flex; align-items: center; gap: 2px; }
.avatar.sm { width: 34px; height: 34px; font-size: .9rem; text-decoration: none; }

/* ---------- Menú lateral izquierdo (PC y tablet, ≥ 768 px) ---------- */
.side { display: none; }
@media (min-width: 768px) {
  body.has-nav { padding-left: 252px; }
  body.has-nav .top { display: none; }          /* el logo y el usuario pasan al menú lateral */
  body.has-nav .wrap { max-width: 900px; padding-top: 28px; }
  body.has-nav .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 5; width: 252px;
    display: flex; flex-direction: column; gap: 14px; padding: 18px 14px;
    background: var(--paper); border-right: 1px solid var(--line); overflow-y: auto;
  }
  .side .logo { padding: 4px 8px 6px; font-size: 1.2rem; }
  .side-new { width: 100%; }
  .side-group { display: flex; flex-direction: column; gap: 2px; }
  .side-title {
    padding: 6px 12px 4px; font-size: .72rem; font-weight: 800; letter-spacing: .07em;
    text-transform: uppercase; color: var(--muted);
  }
  .side-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--muted);
  }
  .side-link:hover { background: var(--bg); color: var(--ink); }
  .side-link.on { background: var(--bg); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
  .side-link.on .ic { color: var(--accent); }
  .side-link .badge { margin-left: auto; }
  .side-foot {
    margin-top: auto; display: flex; align-items: center; gap: 2px;
    padding-top: 12px; border-top: 1px solid var(--line);
  }
  .side-me {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px;
    text-decoration: none;
  }
  .side-me:hover, .side-me.on { background: var(--bg); }
  .side-me > span:last-child { display: flex; flex-direction: column; min-width: 0; }
  .side-me b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-me small { color: var(--muted); font-size: .75rem; }
  /* En PC el botón "Nueva caja" ya está en el menú lateral */
  body.has-nav .new-btn { display: none; }
}

.tabs { display: none; }
@media (max-width: 767px) {
  body.has-nav .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-nav .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
    text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 700; border-radius: 12px;
  }
  .tab .ic { width: 24px; height: 24px; }
  .tab.on { color: var(--accent); }
  .tab.on .ic { stroke-width: 2.4; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 600 .95rem 'Plus Jakarta Sans', system-ui, sans-serif; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: #d9442b; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .85rem; }
.btn.icon { width: 38px; min-height: 38px; padding: 0; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--accent); border-color: var(--line); }
.btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.row { display: flex; flex-wrap: wrap; align-items: center; }
.gap { gap: 8px; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

input, textarea, select {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: 500 1rem 'Plus Jakarta Sans', system-ui, sans-serif;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label.field { display: block; }
label.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}

/* ---------- Inicio ---------- */
.search { display: flex; align-items: center; gap: 8px; position: relative; }
.search input { font-size: 1.1rem; padding: 14px 16px 14px 44px; border-radius: 999px; }
.search span { position: absolute; left: 16px; pointer-events: none; }
.hero { margin-bottom: 20px; }
.search .mic {
  position: absolute; right: 6px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; font-size: 1.15rem; cursor: pointer;
}
.search .mic.on { background: var(--accent); animation: pulse 1s infinite; }
.search input:has(+ .mic) { padding-right: 52px; }
@keyframes pulse { 50% { opacity: .55; } }
.hero .row { margin-top: 12px; }
.stats { font-size: .9rem; color: var(--muted); margin: 0 0 8px; }

.group-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 20px 0 8px;
}
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.box {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.box:hover { border-color: var(--muted); }
.box img, .box .ph {
  width: 56px; height: 56px; flex: none; border-radius: 10px; object-fit: cover;
  background: var(--bg); display: grid; place-items: center; font-size: 1.5rem;
}
.box div { min-width: 0; }
.box span { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box small { display: block; }

.code {
  display: inline-block; font-weight: 800; letter-spacing: .04em; font-size: .78rem;
  padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
}

/* Resultados de búsqueda */
.result {
  display: flex; gap: 12px; align-items: center; padding: 12px; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.result:last-child { border-bottom: 0; }
.result img, .result .ph { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none;
  background: var(--bg); display: grid; place-items: center; }
.result b { font-weight: 700; }
.result .where { margin-left: auto; text-align: right; font-size: .85rem; color: var(--muted); flex: none; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.list { padding: 0; overflow: hidden; }

.empty { text-align: center; padding: 40px 16px; }
.empty .big { font-size: 3rem; }

/* ---------- Caja ---------- */
.box-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.box-head .bigcode { font-size: 2rem; font-weight: 800; letter-spacing: .04em; color: var(--accent); }
.qr-mini { width: 84px; height: 84px; flex: none; background: #fff; padding: 6px; border-radius: 10px; border: 1px solid var(--line); }
.qr-mini svg { width: 100%; height: 100%; display: block; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos img, .photos .add {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in;
  background: var(--bg);
}
.photos .add {
  display: grid; place-items: center; border: 1.5px dashed var(--line); cursor: pointer;
  color: var(--muted); font-weight: 600; text-align: center; font-size: .85rem;
}
.photo-wrap { position: relative; }
.photo-wrap button {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.items .qty { margin-left: auto; color: var(--muted); font-weight: 600; }
.items li.hit { background: var(--mark); border-radius: 8px; padding-left: 8px; padding-right: 8px; }

/* Editor de objetos */
.item-edit { display: grid; grid-template-columns: 1fr 64px 38px 38px; gap: 6px; margin-bottom: 6px; }
.item-edit input { padding: 9px 12px; }
.item-extra { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.item-extra input[data-k=note] { flex: 1; min-width: 180px; font-size: .88rem; padding: 7px 12px; }
.min-field { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.min-field input { width: 56px; padding: 7px 8px; text-align: center; font-size: .88rem; }
.item-edit .btn.on, #dictate.on { border-color: var(--accent); }
#dictate.on { background: var(--accent); color: var(--accent-ink); animation: pulse 1s infinite; }

.tags { color: var(--accent); }

/* Sugerencias de la IA */
.ai-box { border: 1px solid var(--accent); border-radius: 12px; padding: 12px; background: var(--bg); }
.sug { display: grid; grid-template-columns: 22px 1fr 70px; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sug input[type=checkbox] { width: 20px; height: 20px; }
.sug input:not([type]) , .sug input[data-n], .sug input[data-q] { padding: 7px 10px; }
.sug small { grid-column: 2 / 4; color: var(--muted); }
.sug.low input[data-n] { font-style: italic; }
button:disabled { opacity: .6; cursor: progress; }

/* ---------- Accesos, préstamos, mover e historial ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); text-decoration: none; font-size: .85rem; font-weight: 600;
}
.chip.warn { border-color: var(--accent); color: var(--accent); }
.code.big { font-size: .9rem; padding: 4px 10px; text-decoration: none; }
.out { color: var(--accent); font-weight: 600; }
.items li.is-out > span:first-of-type { opacity: .75; }
.items .pickbox { display: none; width: 20px; height: 20px; flex: none; }
.items.selecting .pickbox { display: block; }
.items.selecting [data-out], .items.selecting [data-back] { display: none; }
.movebar { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--accent); }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card[open] summary { margin-bottom: 8px; }
.log { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.log:last-child { border-bottom: 0; }
.log-ic { flex: none; width: 24px; text-align: center; }
.log .code { text-decoration: none; }
.filters select { flex: 1; min-width: 150px; }
.ask-btn { width: 100%; margin-bottom: 10px; justify-content: flex-start; border-color: var(--accent); }
#ask .ai-box { margin-bottom: 10px; }
#ask .result { padding: 10px 0; }

/* ---------- Rediseño: inicio ---------- */
.hello { margin-bottom: 12px; flex-wrap: nowrap; gap: 12px; }
.hello h1 { font-size: 1.5rem; }
.search .lead { position: absolute; left: 16px; color: var(--muted); pointer-events: none; }
.search .mic { display: grid; place-items: center; color: var(--muted); }
.search .mic .ic { width: 22px; height: 22px; }
.search .mic.on { color: var(--accent-ink); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 0 0 4px; }
.stat {
  display: flex; flex-direction: column; padding: 12px 14px; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line); text-decoration: none;
}
.stat b { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat.warn { border-color: var(--accent); }
.stat.warn b, .stat.warn span { color: var(--accent); }
a.stat:hover { border-color: var(--muted); }
.group-title { display: flex; align-items: center; gap: 6px; }
.group-title small { margin-left: auto; font-weight: 700; color: var(--muted); }
.box { padding: 10px 12px 10px 10px; }
.box .code { display: inline-block; font-size: .7rem; padding: 1px 7px; }
.box > div { flex: 1; }
.box .bname { margin-top: 3px; }
.box .ph .ic, .result .ph .ic { width: 26px; height: 26px; color: var(--stone); }
.box .chev { width: 18px; height: 18px; }
.kind { color: var(--muted); font-weight: 600; }
@media (min-width: 768px) {
  .hello h1 { font-size: 1.8rem; }
}
@media (max-width: 420px) {
  .new-btn span { display: none; }       /* en pantallas chicas: solo el "+" */
  .new-btn { width: 44px; padding: 0; }
}

/* ---------- Rediseño: caja ---------- */
.backlink { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.backlink:hover { color: var(--ink); }
.box-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.box-head h1 { margin-top: 8px; overflow-wrap: anywhere; }
.code.big { font-size: .95rem; color: var(--accent); border-color: var(--accent); background: transparent; }
.loc { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.loc:hover { color: var(--accent); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions > .btn:first-child { flex: 1 1 auto; max-width: 200px; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 4; min-width: 240px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink); font: 600 .92rem 'Plus Jakarta Sans', system-ui, sans-serif;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }
.items li { align-items: center; }
.items .iname { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.items .iname small { font-weight: 500; margin-top: 2px; }
.items .ia { color: var(--accent); display: inline; }
.items .ia .ic { width: .9em; height: .9em; }
.items .out .ic { width: 1em; height: 1em; }
.movebar[hidden] { display: none; }
details.card summary .chev { transition: transform .2s; }
details.card[open] summary .chev { transform: rotate(90deg); }

/* ---------- Demo ---------- */
.demo-cta { text-align: center; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: center; }
.guide { border-color: var(--accent); margin-bottom: 14px; }
.guide b .ic { color: var(--accent); }
.guide ol { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.guide li { display: flex; gap: 12px; align-items: flex-start; }
.guide li small { color: var(--muted); }
.gnum {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); font-weight: 800; font-size: .8rem; color: var(--accent);
}
.gact { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- Menú "Más" ---------- */
.me-card { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.menu-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none;
  border-bottom: 1px solid var(--line); font-weight: 600;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:hover { background: var(--bg); }
.menu-row > .ic:first-child { color: var(--accent); }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; font-size: .78rem; font-weight: 800; }
.menu:empty { display: none; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; font: 600 .82rem 'Plus Jakarta Sans', system-ui, sans-serif; cursor: pointer;
}
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- Usuarios ---------- */
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 800;
}
.users-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.user-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); font: inherit; cursor: pointer;
}
.user-tile .avatar { width: 52px; height: 52px; font-size: 1.3rem; }
.user-tile small { color: var(--muted); }
.user-tile .demo-pin { color: var(--accent); font-weight: 700; }
.user-tile.on { border-color: var(--accent); outline: 2px solid var(--accent); }
.result.off { opacity: .55; }
.result.off .avatar { background: var(--stone); }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.radio:last-of-type { border-bottom: 0; }
.radio input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.radio input:disabled + span { opacity: .45; }
.card.warn { border-color: var(--accent); }

/* Personas de la cuenta (nube) */
.cu { flex-wrap: wrap; padding: 12px 0; }
.cu-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cu-act select { width: auto; padding: 6px 10px; font-size: .85rem; }
.add-person summary { list-style: none; display: inline-flex; }
.add-person summary::-webkit-details-marker { display: none; }

/* ---------- Escáner ---------- */
.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3/4; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame {
  position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.35);
}

/* ---------- Etiquetas ---------- */
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pick input { width: 20px; height: 20px; }
.sheet { display: flex; flex-wrap: wrap; gap: 4mm; margin-top: 16px; }
.label {
  width: 70mm; height: 34mm; background: #fff; color: #111;
  border: 1px dashed #bbb; border-radius: 3mm; padding: 3mm;
  display: flex; gap: 3mm; align-items: center; overflow: hidden;
}
.label .lq { width: 28mm; height: 28mm; flex: none; }
.label .lq svg { width: 100%; height: 100%; display: block; }
.label .lc { font-weight: 800; font-size: 17pt; letter-spacing: .04em; line-height: 1; }
.label .ln { font-size: 9pt; margin-top: 2mm; line-height: 1.2; max-height: 3.6em; overflow: hidden; }
.label .ll { font-size: 7.5pt; color: #666; margin-top: 1mm; }
.label .lline { border-bottom: 0.3mm solid #999; height: 7mm; margin-top: 2mm; }   /* para escribir a mano */

/* ---------- Etiquetas: papel o plaquita 3D ---------- */
.seg.fmt { align-self: flex-start; }
.seg.fmt a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; }
.seg.fmt a.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.plate-opts { display: grid; gap: 12px; }
.plate-opts .field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.plate-opts .seg { flex-wrap: wrap; }
.plates-head { width: 100%; margin-bottom: 4px; }
.plate-row {
  width: 100%; display: flex; gap: 16px; align-items: center; padding: 14px; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line);
}
.plate-row.printed { opacity: .65; }
.plate-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* Vista previa de la plaquita: placa clara con relieve oscuro (como sale en "una boquilla") */
.plate3d {
  position: relative; flex: none; width: 180px; height: 62px; border-radius: 10px; padding: 7px 12px;
  display: flex; align-items: center; gap: 10px; background: #eef2fa; color: #0b1f44; border: 1px solid #cdd6e6;
  box-shadow: 0 4px 0 #c2cce0, 0 10px 18px rgba(0, 0, 0, .14);
}
.plate3d .pq { width: 48px; height: 48px; flex: none; }
.plate3d .pq svg { width: 100%; height: 100%; display: block; }
.plate3d .pq svg rect { fill: transparent; }
.plate3d b { font: 800 1.25rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; }
.plate3d.texto { justify-content: center; text-align: center; }
.plate3d.texto small { display: block; font: 700 .7rem/1.2 ui-monospace, Menlo, Consolas, monospace; margin-top: 4px; letter-spacing: .04em; }
.nfc-mark { position: absolute; right: 6px; bottom: 4px; font-size: .6rem; font-weight: 800; color: var(--accent); }
@media (max-width: 520px) { .plate-row { flex-direction: column; align-items: flex-start; } }

/* ---------- Visualizador de la plaquita 3D ---------- */
.plate-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.viewer-wrap { position: sticky; top: 16px; display: grid; gap: 8px; }
.viewer3d {
  position: relative; height: min(62vh, 520px); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: radial-gradient(circle at 50% 40%, var(--paper), var(--bg));
  display: grid; place-items: center; touch-action: none;
}
.viewer3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; }
.viewer3d canvas:active { cursor: grabbing; }
.viewer-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.plate-side .plate-opts { gap: 10px; }
.field.dim { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 8px; margin: 6px 0; }
.field.dim > span:first-child { margin: 0; }
label.field > .dim-in { display: flex; align-items: center; gap: 6px; margin: 0; }
.dim-in input { padding: 7px 10px; }
.dim-in small { color: var(--muted); }
#p-dims[open] summary .chev { transform: rotate(90deg); }
/* Etiquetas → Plaquita 3D: opciones a la izquierda, vista 3D al costado */
.labels-3d { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.labels-3d .viewer-wrap { top: 16px; }
.viewer3d.compact { height: min(48vh, 380px); }
button.plate3d { font: inherit; cursor: pointer; text-align: left; }
button.plate3d:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
.plate-row.selected { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 860px) {
  .labels-3d { grid-template-columns: 1fr; }
  .labels-3d .viewer-wrap { order: -1; position: static; }   /* en el celular la vista 3D va arriba de las opciones */
  .viewer3d.compact { height: 40vh; }
}
ul.p-info { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .9rem; }
ul.p-info code { font-size: .78rem; word-break: break-all; }
@media (max-width: 860px) {
  .plate-layout { grid-template-columns: 1fr; }
  .viewer-wrap { position: static; }
  .viewer3d { height: 52vh; }
}

/* ---------- Visor y avisos ---------- */
#viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
#viewer::backdrop { background: rgba(0,0,0,.85); }
#viewer img { max-width: 96vw; max-height: 86vh; border-radius: 8px; margin: 0 auto; }
#viewer .btn { margin: 12px auto 0; display: flex; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- Impresión: solo la hoja de etiquetas ---------- */
/* ---------- Cuenta: entrar, registrarse, recuperar ---------- */
.auth { min-height: calc(100vh - 120px); display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px 0; }
.auth-card { width: min(440px, calc(100vw - 32px)); padding: 26px; gap: 14px; }
.auth-card h1 { margin: 4px 0 0; font-size: 1.5rem; display: flex; align-items: center; gap: 8px; }
.auth-card .logo { font-size: 1.25rem; }
.auth-foot, .auth-alt { margin: 0; text-align: center; color: var(--muted); font-size: .9rem; }
.auth-alt a, .auth-foot a, .small-link { color: var(--accent); font-weight: 600; }
.small-link { font-size: .9rem; text-align: center; text-decoration: none; }
.small-link:hover { text-decoration: underline; }
.btn.google, .auth-card form .btn.primary { width: 100%; justify-content: center; font-weight: 700; }
.auth-on .top { display: none; }
.auth-card .small-link { display: block; }
.ic.g { width: 1.25em; height: 1.25em; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.auth-err { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; font-size: .92rem; }
.ok-card { border-color: var(--ok); display: flex; gap: 10px; align-items: flex-start; }
.ok-card .ic { color: var(--ok); margin-top: 2px; }
.badge.ok { background: var(--ok); }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .top, .tabs, .side, .no-print, #toast { display: none !important; }
  body.has-nav { padding-left: 0 !important; }
  .wrap { max-width: none; padding: 0; }
  .sheet { margin: 0; }
  .label { break-inside: avoid; }
}

/* ---------- Depósitos ---------- */
.depot-pick { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted); }
.depot-pick select { border: 0; background: transparent; padding: 7px 4px; font-weight: 700; color: var(--ink, inherit); min-width: 0; max-width: 46vw; box-shadow: none; }
.depot-pick select:focus { outline: none; }
.depot-pick:focus-within { border-color: var(--accent); }
.top nav { gap: 8px; }
.side .depot-pick { width: 100%; }
.side .depot-pick select { flex: 1; max-width: none; }
.depot-sub { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.depot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.depot-row:last-child { border-bottom: 0; }
.depot-move { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.depot-move select { width: auto; }

/* ---------- Revisión nov-2026 ---------- */
[hidden] { display: none !important; }   /* que ninguna regla de display pise al atributo hidden */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.late { color: var(--accent2); font-weight: 800; }
.low { color: var(--accent2); display: flex; align-items: center; gap: 4px; font-weight: 700; }
.low .ic { width: 14px; height: 14px; }
.qty-btn { border: 1px solid transparent; background: transparent; color: inherit; font: inherit; font-weight: 700; border-radius: 8px; padding: 2px 6px; cursor: pointer; }
.qty-btn:hover { border-color: var(--line); background: var(--bg); }
/* Diálogo chico (préstamo) */
dialog.sheet { border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(420px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); box-shadow: 0 30px 60px rgba(11, 31, 68, .25); }
dialog.sheet::backdrop { background: rgba(7, 19, 48, .55); }
/* Campo de contraseña con botón para verla */
.pw { position: relative; display: block; }
.pw input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 50%; cursor: pointer; }
.pw-eye:hover, .pw.on .pw-eye { color: var(--accent); }
/* Sesiones abiertas */
.ses { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ses:last-child { border-bottom: 0; }
/* Zona de peligro */
.danger-zone { border-top: 1px solid var(--line); padding-top: 12px; }
.danger-zone summary { cursor: pointer; color: #d9442b; font-weight: 700; font-size: .9rem; }
/* Aviso sin conexión */
#offline { position: sticky; top: 0; z-index: 6; background: var(--ink); color: var(--bg); text-align: center; font-size: .85rem; font-weight: 600; padding: 7px 14px; }

/* Listas desplegables y controles del navegador según el tema (en oscuro las opciones salían blancas con letra clara) */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
select option, select optgroup { background: var(--paper); color: var(--ink); font-weight: 600; }

/* Idioma (i18n.js) */
.i18n-wait body { visibility: hidden; }
.lang-pick { width: auto; font: 600 .88rem 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
