/* Buscador de documentos eBDI · estilo Cápsula, en pequeño. Solo tokens; claro y oscuro. */
:root, :root[data-tema="claro"] {
  color-scheme: light;
  --suelo: #f2f2f4;
  --tarjeta: #ffffff;
  --texto: #111111;
  --gris: #5c5f66;
  --linea: #e3e3e8;
  --campo: #e8e8ed;
  --acento: #0a5fc2;
  --acento-letra: #0a5fc2;
  --sobre-color: #ffffff;
  --verde: #1a7f37;
  --verde-letra: #1a7f37;
  --rojo-letra: #c62828;
  --ambar-letra: #8a5a00;
  --sombra: 0 1px 2px rgb(17 17 17 / .05), 0 8px 24px rgb(17 17 17 / .05);
}
:root[data-tema="oscuro"] {
  color-scheme: dark;
  --suelo: #111214;
  --tarjeta: #1c1d20;
  --texto: #f5f5f7;
  --gris: #a3a6ad;
  --linea: #2e2f34;
  --campo: #28292d;
  --acento: #2a66cc;
  --acento-letra: #7cb2ff;
  --sobre-color: #ffffff;
  --verde: #1a7f37;
  --verde-letra: #56c271;
  --rojo-letra: #ff7b7b;
  --ambar-letra: #f0b429;
  --sombra: 0 1px 2px rgb(0 0 0 / .3);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--suelo);
  color: var(--texto);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
h1, h2 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gris { color: var(--gris); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace; }

.pagina { max-width: 880px; margin: 0 auto; padding: 20px 16px 48px; }

/* Cabecera: título a la izquierda; fecha y tema a la derecha. */
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.cabecera h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.cabecera-derecha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fecha { font-size: 13px; color: var(--gris); font-variant-numeric: tabular-nums; }

.boton-tema {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 999px;
  background: var(--campo); color: var(--texto); cursor: pointer; transition: transform 140ms ease-out;
}
.boton-tema:active { transform: scale(.97); }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Buscador */
.busqueda { position: relative; }
.busqueda svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--gris); pointer-events: none; }
.busqueda input {
  width: 100%; height: 52px; border-radius: 999px; border: 1px solid var(--linea);
  background: var(--tarjeta); padding: 0 20px 0 48px; font-size: 16px; box-shadow: var(--sombra);
}
.busqueda input::placeholder { color: var(--gris); }
.busqueda input::-webkit-search-cancel-button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--acento-letra); outline-offset: 2px; }
.busqueda input:focus-visible { outline-offset: 0; }

.filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 12px 0 16px; }
.filtros select {
  appearance: none; border: 0; background: var(--campo); border-radius: 999px;
  min-height: 40px; padding: 0 36px 0 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 18px center, right 13px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.cuenta { font-size: 13px; color: var(--gris); font-variant-numeric: tabular-nums; margin-left: auto; }

.aviso { margin: 0 0 12px; font-size: 13.5px; color: var(--gris); }
.aviso.error { color: var(--rojo-letra); }

/* Resultados */
.lista { list-style: none; margin: 0; padding: 0; background: var(--tarjeta); border-radius: 20px; box-shadow: var(--sombra); overflow: hidden; }
.lista:empty { display: none; }
.fila { padding: 14px 20px; border-top: 1px solid var(--linea); display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: start; }
.fila:first-child { border-top: 0; }
.fila .titulo { grid-column: 1; font-size: 16px; font-weight: 700; line-height: 1.35; overflow-wrap: break-word; text-wrap: pretty; }
.fila .codigo { grid-column: 1; font-size: 14px; overflow-wrap: anywhere; }
.fila .lugar { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--gris); }
.pildora { display: inline-block; background: var(--campo); color: var(--texto); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; font-weight: 700; }
.copiar { grid-column: 2; grid-row: 1 / span 3; align-self: center; }

.boton {
  border: 0; border-radius: 999px; min-height: 38px; padding: 0 18px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--acento); color: var(--sobre-color);
  transition: background-color 140ms ease-out, transform 140ms ease-out;
}
.boton:active { transform: scale(.97); }
.boton.secundario { background: var(--campo); color: var(--texto); }
.boton.hecho { background: var(--verde); animation: pulso 200ms ease-out; }
.boton:disabled { opacity: .55; cursor: default; }
@keyframes pulso { 50% { transform: scale(1.04); } }

.mas { display: block; margin: 16px auto 0; }

.fuera-cabecera { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 28px 0 12px; }
.fuera-cabecera .aviso { margin: 0; }

/* «Código … copiado al portapapeles»: abajo, solo cuando ya está copiado. */
.aviso-copiado {
  position: fixed; left: 50%; bottom: 24px; max-width: calc(100% - 32px); z-index: 10;
  background: var(--texto); color: var(--suelo); border-radius: 999px; padding: 12px 20px;
  font-size: 14px; font-weight: 600; box-shadow: var(--sombra); pointer-events: none;
  opacity: 0; transform: translate(-50%, 8px);
  transition: opacity 140ms ease-in, transform 140ms ease-in;
}
.aviso-copiado.visible { opacity: 1; transform: translate(-50%, 0); transition: opacity 180ms cubic-bezier(.23,1,.32,1), transform 180ms cubic-bezier(.23,1,.32,1); }

@media (max-width: 560px) {
  .cabecera h1 { font-size: 21px; }
  .fila { padding: 12px 16px; }
  .cuenta { margin-left: 0; width: 100%; }
}
@media (pointer: coarse) { .boton { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Admin */
.tarjeta { background: var(--tarjeta); border-radius: 20px; box-shadow: var(--sombra); padding: 20px; margin-bottom: 16px; }
.tarjeta h2 { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.tarjeta > p + p, .tarjeta > p + .acciones, .tarjeta > .acciones { margin-top: 12px; }
.campo { display: block; font-size: 12.5px; font-weight: 700; color: var(--gris); margin-bottom: 6px; }
.entrada { width: 100%; max-width: 360px; min-height: 44px; border: 1px solid var(--linea); border-radius: 14px; background: var(--tarjeta); padding: 0 14px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.avisos { margin: 12px 0 0; padding-left: 20px; color: var(--ambar-letra); font-size: 13.5px; }
.ok { color: var(--verde-letra); font-weight: 700; }
.mal { color: var(--rojo-letra); }
.tabla-caja { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--gris); padding: 8px 10px; border-bottom: 1px solid var(--linea); }
td { padding: 8px 10px; border-bottom: 1px solid var(--linea); vertical-align: top; overflow-wrap: break-word; }
td.titulo { min-width: 200px; }
td.area { min-width: 140px; }
td.claves { color: var(--gris); min-width: 220px; }
td.mono { white-space: nowrap; }
.separada { margin-top: 12px; }
[hidden] { display: none !important; }
.estado { margin: 0 0 16px; min-height: 0; }
.estado:empty { display: none; }
.casilla { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; min-height: 36px; }
.claves-caja { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cambiado { color: var(--texto); font-weight: 600; }
.boton.pequeno { min-height: 32px; padding: 0 14px; font-size: 12.5px; flex: none; }
.editor { max-width: none; min-height: 72px; padding: 8px 12px; resize: vertical; font-size: 13.5px; }
