/* ==========================================================================
   components.css — Piezas reutilizables: botones, formularios, diálogos, aviso
   ========================================================================== */

/* ---- Botones ---- */
.btn { font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 14px; }
/* Botón con aspecto de enlace (acciones secundarias dentro de las fichas) */
.linkish { border: 0; background: none; color: var(--accent); padding: 4px 0; text-decoration: underline; cursor: pointer; font-weight: 600; font-size: 14px; }

/* ---- Formularios ---- */
label.l { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input[type=text], input[type=date], input[type=url], input[type=email], input[type=password], textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field);
}
select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); flex: none; }
textarea { min-height: 110px; resize: vertical; font: inherit; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.row > .btn { flex: none; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.err { margin: 0; color: var(--danger); font-weight: 600; min-height: 0; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
details > div { margin-top: 10px; }
#diag { white-space: pre-line; margin: 8px 0 0; font-size: 14px; color: var(--muted); }

/* Casilla con texto (".sm" = versión pequeña para la barra de filtros) */
.chk { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.chk.sm { font-weight: 500; font-size: 14px; }
.chk.sm input { width: 16px; height: 16px; }

/* ---- Diálogos (<dialog>): cabecera, cuerpo con scroll y pie de botones ---- */
dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--ink);
  width: min(700px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(10, 14, 20, .55); }
.dlg-head { padding: 18px 22px 0; }
.dlg-head h3 { margin: 0; font: 600 26px/1.15 var(--serif); }
.dlg-body { padding: 16px 22px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.dlg-foot .grow { flex: 1; }

/* ---- Aviso emergente (toast) ---- */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50;
}
#toast.on { opacity: 1; }
