/* JJ Archivos — estilos */
:root {
  --fondo: #f6f7f9;
  --panel: #ffffff;
  --borde: #e3e6ea;
  --borde-fuerte: #cfd4da;
  --texto: #1f2328;
  --texto-2: #5b636d;
  --texto-3: #8a929b;
  --acento: #1a5fb4;
  --acento-suave: #e6effa;
  --acento-borde: #b9d0ee;
  --seleccion: #dce9f8;
  --peligro: #c0362c;
  --ok: #1f7a44;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .08);
  --sombra-fuerte: 0 8px 40px rgba(16, 24, 40, .22);
  --radio: 10px;
  --fila: 44px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 60px 1fr; height: 100vh; }
.cabecera { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px; background: var(--panel); border-bottom: 1px solid var(--borde); }
.marca { display: flex; align-items: center; gap: 10px; width: 212px; font-weight: 650; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none; color: var(--texto); }
.marca .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--acento); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.buscador { flex: 1; max-width: 720px; position: relative; }
.buscador input { width: 100%; height: 42px; border: 1px solid transparent; border-radius: 21px; background: #eef1f4; padding: 0 40px 0 44px; font: inherit; font-size: 15px; outline: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.buscador input:focus { background: #fff; border-color: var(--acento-borde); box-shadow: var(--sombra); }
.buscador > svg { position: absolute; left: 14px; top: 11px; color: var(--texto-2); }
.buscador .limpiar { position: absolute; right: 6px; top: 5px; }
.usuario { margin-left: auto; position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #2d6a4f; color: #fff; font-weight: 650; cursor: pointer; }

.lateral { padding: 14px 12px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--borde); }
.btn-nuevo { display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 22px 0 16px; border: 1px solid var(--borde); border-radius: 14px; background: #fff; box-shadow: var(--sombra); font-weight: 600; font-size: 15px; cursor: pointer; margin: 0 0 14px 4px; }
.btn-nuevo:hover { background: #f4f8fd; }
.btn-nuevo svg { color: var(--acento); }
.nav a { display: flex; align-items: center; gap: 14px; height: 38px; padding: 0 14px; border-radius: 19px; color: var(--texto); text-decoration: none; margin-bottom: 2px; }
.nav a:hover { background: #eef1f4; }
.nav a.activo { background: var(--acento-suave); color: var(--acento); font-weight: 600; }
.nav hr { border: 0; border-top: 1px solid var(--borde); margin: 10px 8px; }
.lateral .nota { margin: 18px 12px 0; color: var(--texto-3); font-size: 12px; line-height: 1.45; }

.principal { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); margin: 0; }
.barra { display: flex; align-items: center; gap: 8px; padding: 10px 16px 6px 20px; min-height: 58px; }
.migas { display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; min-width: 0; flex: 1; font-size: 19px; }
.migas button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; color: var(--texto-2); max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.migas button:hover { background: #eef1f4; color: var(--texto); }
.migas button:last-child { color: var(--texto); font-weight: 500; }
.migas .sep { color: var(--texto-3); flex: none; }
.titulo-vista { font-size: 19px; padding: 6px 10px; }
.herramientas { display: flex; gap: 4px; align-items: center; }
.btn-icono { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--texto-2); }
.btn-icono:hover { background: #eef1f4; color: var(--texto); }
.btn-icono.activo { background: var(--acento-suave); color: var(--acento); }

.acciones { display: flex; align-items: center; gap: 4px; margin: 0 16px 6px 20px; padding: 4px 6px 4px 4px; background: #eef3fa; border-radius: 22px; min-height: 44px; }
.acciones .cuenta { margin: 0 10px 0 4px; font-weight: 500; }
.acciones button.txt { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 7px 12px; border-radius: 18px; cursor: pointer; color: var(--texto); }
.acciones button.txt:hover { background: #dfe8f4; }

.encabezado-lista, .fila { display: grid; grid-template-columns: minmax(200px, 1fr) var(--col-donde, 0px) 170px 110px 44px; align-items: center; gap: 8px; padding: 0 12px 0 20px; }
.con-donde { --col-donde: minmax(140px, .55fr); }
.encabezado-lista { height: 40px; border-bottom: 1px solid var(--borde); color: var(--texto-2); font-weight: 500; font-size: 13px; }
.encabezado-lista button { border: 0; background: none; padding: 4px 6px; margin-left: -6px; border-radius: 6px; cursor: pointer; color: inherit; font-weight: inherit; text-align: left; display: inline-flex; align-items: center; gap: 4px; }
.encabezado-lista button:hover { background: #eef1f4; color: var(--texto); }
.encabezado-lista .orden-activo { color: var(--texto); }

.lista { flex: 1; overflow-y: auto; position: relative; outline: none; }
.lienzo { position: relative; }
.fila { position: absolute; left: 0; right: 0; height: var(--fila); border-bottom: 1px solid #eff1f3; cursor: default; user-select: none; }
.fila:hover { background: #f5f7f9; }
.fila.sel { background: var(--seleccion); border-bottom-color: #cfe0f4; }
.fila.foco { box-shadow: inset 0 0 0 2px var(--acento-borde); }
.fila.soltar { background: var(--acento-suave); box-shadow: inset 0 0 0 2px var(--acento); }
.fila .nombre { display: flex; align-items: center; gap: 14px; min-width: 0; }
.fila .nombre span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .dato { color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.fila .donde { cursor: pointer; }
.fila .donde:hover { text-decoration: underline; }
.fila .mas { opacity: 0; }
.fila:hover .mas, .fila.sel .mas { opacity: 1; }

.cuadricula .celda { position: absolute; border: 1px solid var(--borde); border-radius: 12px; background: #f1f3f5; overflow: hidden; cursor: default; user-select: none; display: flex; flex-direction: column; }
.cuadricula .celda:hover { background: #e9ecef; }
.cuadricula .celda.sel { background: var(--seleccion); border-color: var(--acento-borde); }
.cuadricula .celda .cab { display: flex; align-items: center; gap: 10px; padding: 10px 8px 8px 12px; min-height: 44px; }
.cuadricula .celda .cab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-weight: 500; font-size: 13px; }
.cuadricula .celda .vista { flex: 1; margin: 0 8px 8px; border-radius: 6px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.cuadricula .celda .vista img { width: 100%; height: 100%; object-fit: cover; }
.cuadricula .celda .vista svg { width: 64px; height: 64px; }
.cuadricula .celda.carpeta { height: 50px; }
.cuadricula .celda.carpeta .cab { padding: 0 8px 0 14px; height: 48px; }

.vacio { position: absolute; inset: 40px 0 0; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--texto-2); text-align: center; padding: 40px 20px; }
.vacio svg { width: 120px; height: 120px; color: #c8d1db; }
.vacio h2 { margin: 6px 0 0; font-weight: 500; font-size: 19px; color: var(--texto); }
.vacio p { margin: 0; max-width: 420px; line-height: 1.5; }
.cargando { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; }
.cargando::after { content: ""; position: absolute; height: 100%; width: 30%; background: var(--acento); animation: barra 1s ease-in-out infinite; }
@keyframes barra { from { left: -30%; } to { left: 100%; } }

/* ---------- iconos de tipo ---------- */
.tipo { width: 24px; height: 24px; flex: none; }

/* ---------- menús ---------- */
.menu { position: fixed; z-index: 50; min-width: 240px; background: #fff; border-radius: 10px; box-shadow: var(--sombra-fuerte); padding: 6px 0; border: 1px solid var(--borde); }
.menu button { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 18px; cursor: pointer; font-size: 14px; }
.menu button:hover, .menu button:focus-visible { background: #f1f3f5; outline: none; }
.menu button:disabled { color: var(--texto-3); cursor: default; background: none; }
.menu button .atajo { margin-left: auto; color: var(--texto-3); font-size: 12px; }
.menu button.peligro { color: var(--peligro); }
.menu hr { border: 0; border-top: 1px solid var(--borde); margin: 6px 0; }
.menu .info { padding: 8px 18px 10px; color: var(--texto-2); font-size: 13px; line-height: 1.4; }
.menu .info b { color: var(--texto); display: block; font-size: 14px; }

/* ---------- diálogos ---------- */
.velo { position: fixed; inset: 0; background: rgba(15, 20, 28, .45); z-index: 60; display: grid; place-items: center; padding: 20px; animation: aparecer .12s ease-out; }
@keyframes aparecer { from { opacity: 0; } }
.dialogo { background: #fff; border-radius: 14px; box-shadow: var(--sombra-fuerte); width: min(440px, 100%); padding: 22px 24px 18px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.dialogo.ancho { width: min(620px, 100%); }
.dialogo h3 { margin: 0 0 16px; font-weight: 550; font-size: 19px; }
.dialogo p { margin: 0 0 14px; color: var(--texto-2); line-height: 1.5; }
.dialogo .botones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 13px; color: var(--texto-2); margin-bottom: 6px; font-weight: 500; }
input.texto, select.texto { width: 100%; height: 42px; border: 1px solid var(--borde-fuerte); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 15px; outline: none; background: #fff; }
input.texto:focus, select.texto:focus { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.btn { height: 38px; padding: 0 18px; border-radius: 19px; border: 1px solid var(--borde-fuerte); background: #fff; cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: #f4f6f8; }
.btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn.primario:hover { background: #154f97; }
.btn.peligro { background: var(--peligro); border-color: var(--peligro); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.error-campo { color: var(--peligro); font-size: 13px; margin-top: 6px; min-height: 18px; }

/* explorador de carpetas (mover) */
.explorador { border: 1px solid var(--borde); border-radius: 10px; height: 340px; display: flex; flex-direction: column; overflow: hidden; }
.explorador .ex-migas { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-bottom: 1px solid var(--borde); background: #fafbfc; font-size: 13px; }
.explorador .ex-migas button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; cursor: pointer; color: var(--texto-2); }
.explorador .ex-migas button:hover { background: #eef1f4; }
.explorador .ex-lista { flex: 1; overflow-y: auto; }
.explorador .ex-lista button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 9px 14px; cursor: pointer; text-align: left; }
.explorador .ex-lista button:hover { background: #f3f5f7; }
.explorador .ex-lista button:disabled { color: var(--texto-3); cursor: default; }
.explorador .ex-vacio { padding: 20px; color: var(--texto-3); text-align: center; }

/* ---------- vista previa ---------- */
.previa { position: fixed; inset: 0; z-index: 70; background: rgba(10, 12, 16, .92); display: flex; flex-direction: column; color: #fff; animation: aparecer .12s ease-out; }
.previa .pcab { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 12px 0 16px; flex: none; }
.previa .pcab .pnombre { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 12px; }
.previa .btn-icono { color: #e8eaed; }
.previa .btn-icono:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.previa .pcuerpo { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 64px 24px; position: relative; }
.previa img, .previa video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: #000; }
.previa iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.previa audio { width: min(560px, 100%); }
.previa .flecha { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; background: rgba(255, 255, 255, .1); }
.previa .flecha.izq { left: 8px; }
.previa .flecha.der { right: 8px; }
.previa .sin-previa { text-align: center; color: #c9ccd1; }
.previa .sin-previa svg { width: 96px; height: 96px; }

/* ---------- subidas / avisos ---------- */
.subidas { position: fixed; right: 20px; bottom: 20px; width: 380px; background: #fff; border-radius: 12px; box-shadow: var(--sombra-fuerte); z-index: 40; overflow: hidden; border: 1px solid var(--borde); }
.subidas .scab { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 18px; background: #1f2937; color: #fff; font-weight: 500; }
.subidas .scab span { flex: 1; }
.subidas .scab .btn-icono { color: #d1d5db; width: 32px; height: 32px; }
.subidas .scab .btn-icono:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.subidas .slista { max-height: 260px; overflow-y: auto; }
.subidas .sfila { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid #f0f1f3; font-size: 13px; }
.subidas .sfila .snombre { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subidas .sfila .sestado { color: var(--texto-2); font-size: 12px; white-space: nowrap; }
.subidas .sfila .sestado.error { color: var(--peligro); }
.subidas .sfila .sestado.listo { color: var(--ok); }
.subidas progress { width: 64px; height: 6px; }

.avisos { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.aviso { background: #1f2328; color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: var(--sombra-fuerte); max-width: 560px; pointer-events: auto; display: flex; align-items: center; gap: 16px; animation: subir .18s ease-out; line-height: 1.4; }
.aviso.error { background: #8f2219; }
.aviso button { border: 0; background: none; color: #8ab4f8; font-weight: 600; cursor: pointer; padding: 4px; }
@keyframes subir { from { transform: translateY(12px); opacity: 0; } }

.soltar-aqui { position: absolute; inset: 0; z-index: 30; border: 2px dashed var(--acento); background: rgba(230, 239, 250, .85); border-radius: 8px; display: grid; place-items: center; pointer-events: none; color: var(--acento); font-size: 17px; font-weight: 600; }
.principal { position: relative; }

/* ---------- entrar ---------- */
.pantalla-entrar { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #eef3fa 0%, #f6f7f9 60%); }
.tarjeta-entrar { width: min(400px, 100%); background: #fff; border-radius: 16px; box-shadow: var(--sombra); border: 1px solid var(--borde); padding: 34px 32px 28px; }
.tarjeta-entrar .marca { width: auto; margin-bottom: 26px; }
.tarjeta-entrar h1 { font-size: 22px; font-weight: 550; margin: 0 0 6px; }
.tarjeta-entrar p { margin: 0 0 22px; color: var(--texto-2); }
.tarjeta-entrar .btn { width: 100%; justify-content: center; height: 44px; margin-top: 6px; }

/* ---------- editor ---------- */
.pagina-editor { display: flex; flex-direction: column; height: 100vh; background: #fff; }
.editor-barra { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 12px 4px 8px; border-bottom: 1px solid var(--borde); flex: none; }
.editor-barra .enombre { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.editor-barra .eaviso { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--texto-2); font-size: 13px; }
.editor-barra .eaviso.formato { background: #fff7e0; color: #6b4e00; border: 1px solid #f1dc9c; border-radius: 8px; padding: 6px 6px 6px 12px; }
.editor-barra .eaviso .btn { height: 32px; }
#oo { flex: 1; min-height: 0; }
.editor-error { margin: 60px auto; max-width: 480px; text-align: center; color: var(--texto-2); line-height: 1.5; }

/* ---------- administración ---------- */
.admin { max-width: 1100px; margin: 0 auto; padding: 24px 24px 60px; }
.admin h1 { font-weight: 550; font-size: 24px; margin: 6px 0 4px; }
.admin .sub { color: var(--texto-2); margin: 0 0 24px; }
.admin-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.admin-cab a { color: var(--acento); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tabla { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; }
.tabla th, .tabla td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #eff1f3; vertical-align: top; }
.tabla th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); font-weight: 600; background: #fafbfc; }
.tabla tr:last-child td { border-bottom: 0; }
.etiqueta { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #eef1f4; color: var(--texto-2); margin: 0 4px 4px 0; }
.etiqueta.admin { background: #e6effa; color: var(--acento); }
.etiqueta.inactivo { background: #fde8e6; color: var(--peligro); }
.etiqueta.editar { background: #e5f4ea; color: var(--ok); }
.permiso-fila { display: grid; grid-template-columns: 1fr 120px 38px; gap: 8px; align-items: center; margin-bottom: 8px; }
.permiso-fila .ruta-perm { border: 1px solid var(--borde-fuerte); border-radius: 8px; padding: 9px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #fafbfc; font-size: 13px; }
.seccion { margin-top: 36px; }
.seccion h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr; }
  .marca span.txt { display: none; }
  .marca { width: auto; }
  .lateral { grid-row: 2; display: flex; align-items: center; gap: 6px; padding: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--borde); }
  .btn-nuevo { margin: 0; height: 40px; padding: 0 14px; box-shadow: none; }
  .nav { display: flex; gap: 4px; }
  .nav a { white-space: nowrap; padding: 0 12px; gap: 8px; }
  .nav hr, .lateral .nota { display: none; }
  .encabezado-lista, .fila { grid-template-columns: 1fr 0 0 64px 40px; }
  .encabezado-lista > :nth-child(2), .encabezado-lista > :nth-child(3), .fila > :nth-child(2), .fila > :nth-child(3) { display: none; }
  .previa .pcuerpo { padding: 0 8px 12px; }
  .subidas { left: 12px; right: 12px; width: auto; }
}
