/* ═══════════════════════════════════════════════════════════════
   § 31 — FORMULARIOS — LAYOUTS Y CONTROLES
   ═══════════════════════════════════════════════════════════════ */

/* Layout principal crear/editar: columna principal + sidebar */
.layout-cols { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout-cols { grid-template-columns: 1fr; } }

/* Filas de campos en dos y tres columnas */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row-2, .form-row-3, .form-row { grid-template-columns: 1fr; } }

/* Sección de formulario (tarjeta) — usada en crear/editar */
.form-section       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; }
.form-section-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* Grupo de campo individual */
.form-group { margin-bottom: 16px; }

/* Etiqueta de campo */
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }

/* Controles de texto e input */
.form-control,
.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s;
}
.form-control:focus,
.form-select:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; }

/* Hint / ayuda bajo el campo */
.form-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Fila de checkbox */
.form-check     { display: flex; align-items: center; gap: 8px; }
.form-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-row   { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* Textarea especial para contenido narrativo (Relatos) */
textarea.contenido { font-family: var(--font-head); font-size: 15px; line-height: 1.8; }

/* ═══════════════════════════════════════════════════════════════
   § 32 — BOTONES DE FORMULARIO
   ═══════════════════════════════════════════════════════════════ */

/* Botón principal de submit */
.btn-submit {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500; padding: 9px 20px;
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: var(--radius);
  cursor: pointer; transition: opacity .12s;
}
.btn-submit:hover { opacity: .88; }

/* Botón cancelar */
.btn-cancel {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500; padding: 9px 20px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
}
.btn-cancel:hover { border-color: var(--accent); color: var(--accent); }

/* Fila de botones */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* Botón "Nuevo …" en toolbars de index y dashboard */
.btn-new {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; padding: 8px 18px;
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: var(--radius);
  text-decoration: none; transition: opacity .12s;
}
.btn-new:hover { opacity: .88; }

/* Botón editar en vistas de detalle */
.btn-edit {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; padding: 7px 16px;
  border-radius: var(--radius); border: 1px solid var(--border);
  color: var(--text-muted); background: transparent;
  text-decoration: none; transition: border-color .1s, color .1s;
}
.btn-edit:hover { border-color: var(--accent); color: var(--accent); }

/* Botón eliminar imagen en formularios */
.btn-del-img {
  margin-top: 8px; font-size: 12px; color: var(--danger);
  background: none; border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 4px 10px; cursor: pointer;
}
.btn-del-img:hover { opacity: .75; }

/* Contenedor de imagen actual en formulario de edición */
.img-current { position: relative; display: inline-block; }
.img-current img { max-height: 160px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); display: block; }

/* ═══════════════════════════════════════════════════════════════
   § 33 — VISTAS DE DETALLE (ver.php)
   ═══════════════════════════════════════════════════════════════ */

/* Hero (cabecera con portada + datos) */
.detail-hero  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px; }
.detail-cover { height: 200px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 72px; overflow: hidden; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-body  { padding: 24px; }
.detail-title { font-family: var(--font-head); font-size: 28px; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.detail-subtitle { font-size: 16px; color: var(--text-muted); margin-top: 4px; }
.detail-meta  { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

/* Acciones en el hero (botón editar, etc.) */
.hero-actions { margin-left: auto; display: flex; gap: 8px; }

/* Grid de secciones de detalle */
.detail-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.full-width   { grid-column: 1 / -1; }

/* Tarjeta de sección dentro del grid */
.detail-section       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.detail-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* Fila de dato etiqueta–valor */
.detail-row   { display: flex; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.detail-label { color: var(--text-dim); min-width: 90px; flex-shrink: 0; font-size: 13px; }
.detail-value { color: var(--text); }

/* Bloque de texto largo (descripción, contenido) */
.detail-text  { font-size: 14px; color: var(--text); line-height: 1.9; white-space: pre-wrap; }

/* Texto vacío */
.detail-empty { font-size: 13px; color: var(--text-dim); font-style: italic; }

/* ═══════════════════════════════════════════════════════════════
   § 34 — TABLAS DE ÍNDICE (index.php)
   ═══════════════════════════════════════════════════════════════ */

/* Toolbar superior (botón nuevo + contador) */
.entity-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

/* Tabla principal de entidades */
.entity-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.entity-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); padding: 10px 16px; background: var(--surface-alt); border-bottom: 1px solid var(--border); text-align: left; }
.entity-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); vertical-align: middle; }
.entity-table tr:last-child td { border-bottom: none; }
.entity-table tr:hover td { background: var(--surface-alt); }

/* Miniatura de imagen en tablas */
.thumb { width: 36px; height: 36px; border-radius: var(--radius); overflow: hidden; background: var(--surface-alt); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Celda de nombre con thumb */
.name-cell { display: flex; align-items: center; gap: 10px; }

/* Contenedor de acciones por fila */
.actions { display: flex; gap: 6px; }

/* Vista previa de nota en tabla de notas */
.nota-preview { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Fecha formateada en tablas */
.text-fecha { font-size: 12px; color: var(--text-dim); }

/* Estado vacío en tablas */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-dim); }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ═══════════════════════════════════════════════════════════════
   § 35 — BADGES ESPECÍFICOS DE ENTIDAD
   ═══════════════════════════════════════════════════════════════ */

/* Base badge (si no está ya definido en secciones anteriores) */
.badge { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 3px; display: inline-flex; align-items: center; gap: 4px; }

/* Estados (estado_id de entidades) */
.badge-estado  { background: var(--accent-soft); color: var(--accent); }

/* Visibilidad epistémica */
.badge-vis     { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--border); }

/* Cronología / fecha */
.badge-crono   { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--border); font-size: 11px; }

/* Tipo de entidad (criaturas, objetos, etc.) */
.badge-tipo    { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--border); }

/* Peligrosidad de criaturas */
.badge-peligro { background: var(--danger-soft); color: var(--danger); }

/* Estado activo/inactivo de facciones */
.badge-activa  { background: rgba(45,106,79,.1); color: #2d6a4f; border-radius: 3px; font-size: 11px; padding: 2px 8px; }
.badge-inactiva { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--border); border-radius: 3px; font-size: 11px; padding: 2px 8px; }

/* Nivel de misión */
.badge-nivel   { background: rgba(45,106,79,.08); color: #2d6a4f; }

/* Rareza de objetos */
.badge-rareza  { background: rgba(120,80,20,.08); color: #7a5010; }

/* Estado vital de personajes */
.badge-vivo    { background: rgba(45,106,79,.1); color: #2d6a4f; }
.badge-muerto  { background: var(--danger-soft); color: var(--danger); }

/* Notas públicas / publicado */
.badge-pub     { background: #d1fae5; color: #065f46; }

/* Indicador vivo/muerto en index de personajes */
.vivo-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; }
.vivo-si    { background: rgba(45,106,79,.12); color: #2d6a4f; }
.vivo-no    { background: var(--danger-soft); color: var(--danger); }

/* ═══════════════════════════════════════════════════════════════
   § 36 — DASHBOARD DE MUNDOS
   ═══════════════════════════════════════════════════════════════ */

/* Grid de tarjetas de mundos */
.mundos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 8px; }

/* Tarjeta de mundo */
.mundo-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  overflow: hidden; transition: box-shadow .15s, border-color .15s, transform .15s;
  text-decoration: none; display: flex; flex-direction: column;
}
.mundo-card:hover { box-shadow: var(--shadow-lg); border-color: var(--accent); transform: translateY(-2px); }

/* Portada del mundo */
.mundo-cover { height: 120px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 40px; flex-shrink: 0; overflow: hidden; }
.mundo-cover img { width: 100%; height: 100%; object-fit: cover; }

/* Cuerpo de la tarjeta */
.mundo-body   { padding: 18px 20px 20px; flex: 1; display: flex; flex-direction: column; }
.mundo-nombre { font-family: var(--font-head); font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -.01em; margin-bottom: 6px; }
.mundo-desc   { font-size: 13px; color: var(--text-muted); line-height: 1.55; flex: 1; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mundo-meta   { display: flex; align-items: center; justify-content: space-between; }
.mundo-date   { font-size: 11px; color: var(--text-dim); }
.mundo-actions { display: flex; gap: 6px; margin-top: 12px; }

/* Badges de visibilidad en dashboard */
.badge-vis.pub  { background: var(--accent-soft); color: var(--accent); }
.badge-vis.priv { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--border); }

/* Badges pub/priv en Mundos/ver */
.badge-pub-m  { background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 3px; }
.badge-priv-m { background: var(--surface-alt); color: var(--text-dim); border: 1px solid var(--border); font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 3px; }

/* Toolbar del dashboard */
.dash-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.dash-count   { font-size: 14px; color: var(--text-dim); }
.dash-sep     { flex: 1; }

/* Empty state del dashboard */
.empty-icon  { font-size: 52px; margin-bottom: 16px; }
.empty-title { font-family: var(--font-head); font-size: 24px; font-weight: 600; color: var(--text); margin-bottom: 8px; letter-spacing: -.02em; }
.empty-sub   { font-size: 15px; color: var(--text-muted); margin-bottom: 28px; }

/* Botones de acción en Mundos/index */
.btn-primary-sm {
  font-size: 12px; padding: 5px 12px; border-radius: var(--radius);
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  text-decoration: none; cursor: pointer; transition: opacity .12s;
}
.btn-primary-sm:hover { opacity: .88; }

.btn-ghost-sm {
  font-size: 12px; padding: 5px 12px; border-radius: var(--radius);
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
  text-decoration: none; cursor: pointer; transition: border-color .1s, color .1s;
}
.btn-ghost-sm:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger-sm {
  font-size: 12px; padding: 5px 12px; border-radius: var(--radius);
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
  text-decoration: none; cursor: pointer; transition: opacity .12s;
}
.btn-danger-sm:hover { opacity: .75; }

/* Hero de mundo en Mundos/ver */
.mundo-hero       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px; }
.mundo-hero-cover { height: 240px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 80px; overflow: hidden; }
.mundo-hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.mundo-hero-body  { padding: 28px; }
.mundo-hero-title { font-family: var(--font-head); font-size: 32px; font-weight: 700; color: var(--text); letter-spacing: -.02em; margin-bottom: 6px; }
.mundo-hero-desc  { font-size: 15px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.mundo-hero-meta  { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Botones hero */
.btn-hero      { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 8px 18px; border-radius: var(--radius); text-decoration: none; transition: opacity .12s, border-color .1s, color .1s; }
.btn-hero-edit { border: 1px solid var(--border); color: var(--text-muted); background: transparent; }
.btn-hero-edit:hover { border-color: var(--accent); color: var(--accent); }

/* Tira de estadísticas */
.stats-strip  { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card    { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; text-align: center; }
.stat-num     { font-family: var(--font-head); font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.stat-label   { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }

/* Grid de recientes */
.recientes-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.recientes-card   { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.recientes-title  { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.reciente-item    { font-size: 13px; color: var(--text); padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.reciente-item:last-child { border-bottom: none; }
.recientes-empty  { font-size: 13px; color: var(--text-dim); font-style: italic; padding: 8px 0; }

/* Creación rápida */
.quick-create       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px; }
.quick-create-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.quick-btns         { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-quick          { font-size: 12px; font-weight: 500; padding: 6px 14px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-alt); text-decoration: none; transition: border-color .1s, color .1s; }
.btn-quick:hover    { border-color: var(--accent); color: var(--accent); }

/* Etiqueta de sección */
.section-label { font-family: var(--font-head); font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px; }

/* Sistemas info en Mundos/editar */
.sys-info dt { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.sys-info dd { font-size: 13px; color: var(--text); margin: 0 0 12px 0; }

/* ═══════════════════════════════════════════════════════════════
   § 37 — WIDGET DE NOTAS (wb_notas_widget)
   ═══════════════════════════════════════════════════════════════ */

/* Overlay del modal */
.wb-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; align-items: center; justify-content: center; }
.wb-modal-overlay.open,
.wb-modal-overlay.activo { display: flex; }

/* Contenedor del modal */
.wb-modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }

/* Encabezado del modal */
.wb-modal-titulo { font-family: var(--font-head); font-size: 16px; font-weight: 600; color: var(--text); padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

/* Botón cerrar */
.wb-modal-cerrar { background: none; border: none; font-size: 18px; color: var(--text-dim); cursor: pointer; padding: 0 4px; line-height: 1; }
.wb-modal-cerrar:hover { color: var(--text); }

/* Ítem de nota */
.wb-nota-item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.wb-nota-item:last-child { border-bottom: none; }
.wb-nota-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.wb-nota-titulo { font-size: 13px; font-weight: 600; color: var(--text); }
.wb-nota-contenido { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.wb-nota-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.wb-nota-fecha { font-size: 11px; color: var(--text-dim); }
.wb-nota-acciones { display: flex; gap: 6px; }
.wb-nota-badge { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 600; letter-spacing: .04em; flex-shrink: 0; }
.wb-nota-badge--publica { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.wb-nota-badge--privada { background: var(--bg-sub); color: var(--text-dim); border: 1px solid var(--border); }
[data-theme="dark"] .wb-nota-badge--publica { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
.wb-nota-check-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.wb-btn-nota { font-size: 11px; padding: 3px 8px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--text-dim); background: transparent; cursor: pointer; text-decoration: none; transition: border-color .1s, color .1s; }
.wb-btn-nota:hover { border-color: var(--accent); color: var(--accent); }
.wb-notas-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-dim); font-style: italic; }

/* Formulario de nota rápida */
.wb-nota-form-group { padding: 12px 16px; border-top: 1px solid var(--border); }
.wb-nota-label      { display: block; font-size: 12px; font-weight: 500; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }
.wb-nota-input      { width: 100%; padding: 7px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); resize: vertical; }
.wb-nota-input:focus { outline: none; border-color: var(--accent); }

/* ── Tabs de edición ──────────────────────────────────────────────────────── */
.wb-tabs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px; }
.wb-tab-bar { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-alt); }
.wb-tab-btn { padding: 11px 20px; font-size: 13px; font-weight: 500; color: var(--text-dim); border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer; margin-bottom: -1px; transition: color .15s, border-color .15s; white-space: nowrap; }
.wb-tab-btn:hover { color: var(--text); }
.wb-tab-btn.activo { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); }
.wb-tab-panel { display: none; padding: 24px; }
.wb-tab-panel.activo { display: block; }
.wb-tab-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin: 20px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.wb-tab-section-title:first-child { margin-top: 0; }

/* Nota card en tab */
.wb-nota-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.wb-nota-card-titulo { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.wb-nota-card-contenido { font-size: 13px; color: var(--text-muted); line-height: 1.55; white-space: pre-wrap; }
.wb-nota-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.wb-nota-card-fecha { font-size: 11px; color: var(--text-dim); }

/* Formulario inline de nota */
.wb-nota-nueva { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.wb-nota-nueva-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.wb-nota-nueva input, .wb-nota-nueva textarea { width: 100%; padding: 7px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); box-sizing: border-box; margin-bottom: 8px; }
.wb-nota-nueva textarea { resize: vertical; }
.wb-nota-nueva input:focus, .wb-nota-nueva textarea:focus { outline: none; border-color: var(--accent); }

/* ── Wikilinks: tooltip de ayuda en edición ─────────────────────────────── */
.wl-help-wrap { position: relative; display: inline-block; margin-bottom: 14px; }
.wl-help-trigger { font-size: 12px; color: var(--accent); cursor: pointer; border-bottom: 1px dashed var(--accent); user-select: none; }
.wl-help-tooltip { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 200; width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,.12)); }
.wl-help-wrap:hover .wl-help-tooltip,
.wl-help-wrap:focus-within .wl-help-tooltip { display: block; }
.wl-help-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 10px; }
.wl-help-row { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.wl-help-row code { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 12px; }
.wl-help-types { font-size: 12px; color: var(--text-muted); margin: 10px 0 8px; line-height: 1.6; }
.wl-help-note { font-size: 11px; color: var(--text-dim); font-style: italic; }

/* ═══════════════════════════════════════════════════════════════
   § 38 — FUSIÓN Y PURGA DE PERSONAJES
   ═══════════════════════════════════════════════════════════════ */

/* Botón Fusionar en bulk-bar */
.btn-fusionar {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--accent, #6c63ff);
  border-radius: var(--radius);
  color: var(--accent, #6c63ff);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-fusionar:not(:disabled):hover { background: var(--accent, #6c63ff); color: #fff; }
.btn-fusionar:disabled { opacity: .4; cursor: default; border-color: var(--border); color: var(--text-dim); }

/* Link a pantalla de purga */
.btn-purgar {
  font-size: 12px;
  color: var(--danger, #c0392b);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--danger, #c0392b) 40%, transparent);
  white-space: nowrap;
  transition: background .15s;
}
.btn-purgar:hover { background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent); }

/* Badge de estado Purgable en índice */
.badge-purgable {
  background: color-mix(in srgb, var(--danger, #c0392b) 12%, transparent) !important;
  color: var(--danger, #c0392b) !important;
  border: 1px solid color-mix(in srgb, var(--danger, #c0392b) 30%, transparent);
}

/* ── Pantalla de fusión ────────────────────────────────────────── */
.fusion-aviso {
  background: color-mix(in srgb, var(--accent, #6c63ff) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #6c63ff) 30%, transparent);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 13px;
}

.fusion-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.fusion-grid-2 { grid-template-columns: 1fr 1fr 1fr; }
.fusion-grid-3 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.fusion-col { border-right: 1px solid var(--border); min-width: 0; }
.fusion-col:last-child { border-right: none; }
.fusion-col-resultado { background: color-mix(in srgb, var(--accent, #6c63ff) 5%, var(--surface)); }

.fusion-col-header {
  padding: 12px 14px;
  background: var(--surface-alt, var(--surface));
  border-bottom: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.fusion-col-header-resultado {
  background: color-mix(in srgb, var(--accent, #6c63ff) 12%, var(--surface-alt, var(--surface)));
  border-bottom-color: var(--accent, #6c63ff);
}

.fusion-oficial-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.fusion-oficial-label input[type="radio"] { accent-color: var(--accent, #6c63ff); }
.fusion-col-nombre { font-weight: 600; font-size: 14px; }
.fusion-col-id { font-size: 11px; color: var(--text-dim); }

.fusion-field {
  padding: 10px 14px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fusion-col:last-child .fusion-field { border-bottom-color: color-mix(in srgb, var(--accent, #6c63ff) 20%, transparent); }

.fusion-field-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }

.fusion-input,
.fusion-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.fusion-textarea { min-height: 90px; }
.fusion-readonly { background: var(--surface-alt, #f8f8f8); color: var(--text-muted); cursor: default; }

.btn-usar-version {
  align-self: flex-start;
  padding: 3px 10px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color .15s, color .15s;
}
.btn-usar-version:hover { border-color: var(--accent, #6c63ff); color: var(--accent, #6c63ff); }

.fusion-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

@media (max-width: 768px) {
  .fusion-grid-2,
  .fusion-grid-3 { grid-template-columns: 1fr; }
  .fusion-col { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Pantalla de purga ─────────────────────────────────────────── */
.purga-aviso {
  background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger, #c0392b) 30%, transparent);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.purga-masiva { margin-bottom: 16px; }

.btn-danger {
  background: var(--danger, #c0392b);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity .15s;
}
.btn-danger:hover { opacity: .85; }
.btn-danger.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════
   § 39 — BULK BAR E ICONOS DE ACCIÓN (entity indexes)
   ═══════════════════════════════════════════════════════════════ */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.bulk-bar-count { font-size: 13px; font-weight: 600; color: var(--text-dim); min-width: 110px; }
.bulk-bar-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.bulk-bar-fields .form-select { width: 180px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-icon:hover { color: var(--text); border-color: var(--accent); background: var(--surface-hover, var(--surface)); }
.btn-icon.danger { color: var(--danger, #c0392b); }
.btn-icon.danger:hover { border-color: var(--danger, #c0392b); background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent); }

/* ═══════════════════════════════════════════════════════════════
   § 40 — DATATABLES (controles integrados al tema)
   ═══════════════════════════════════════════════════════════════ */

.dt-layout-row { margin: 10px 0; }
.dt-layout-full { width: 100%; }

.dt-search { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.dt-search input {
  height: 32px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  outline: none; width: 220px;
}
.dt-search input:focus { border-color: var(--accent); }

.dt-info { font-size: 12px; color: var(--text-dim); }

.dt-paging { display: flex; gap: 2px; }
.dt-paging-button {
  min-width: 30px; height: 30px; padding: 0 8px;
  font-size: 13px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.dt-paging-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.dt-paging-button.current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dt-paging-button:disabled { opacity: .35; cursor: default; }

/* ── Nivel de acceso — color en badges de tabla ── */
.badge-vis.acceso-publico   { background: color-mix(in srgb,var(--success) 10%,transparent); color: var(--success); border-color: color-mix(in srgb,var(--success) 30%,transparent); }
.badge-vis.acceso-jugadores { background: color-mix(in srgb,var(--accent) 10%,transparent);  color: var(--accent);  border-color: color-mix(in srgb,var(--accent) 30%,transparent); }
.badge-vis.acceso-gm        { background: color-mix(in srgb,var(--danger) 10%,transparent);  color: var(--danger);  border-color: color-mix(in srgb,var(--danger) 30%,transparent); }
