/* ====================== SUPERPANEL DORDIV · estilos ======================
   Misma identidad que el Portal (verde Dordiv, tipografía Inter).
   Pensado primero para móvil y tablet (gente de planta) y después escritorio. */

:root {
  --green: #00803c; --green-d: #016a32; --green-dd: #014a23; --green-l: #e7f4ec; --green-ll: #f4faf6;
  --ink: #14241c; --body: #46584e; --muted: #7d8b83; --line: #e3e9e5; --bg: #f5f8f6; --panel: #fff;
  --amber: #b4690e; --amber-l: #fff3e0; --red: #c63434; --red-l: #fdecec; --blue: #2a4bd0; --blue-l: #e8edff;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(20, 36, 28, .05), 0 4px 14px rgba(20, 36, 28, .05);
  --lateral: 264px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--body); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.con-modal { overflow: hidden; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.02em; line-height: 1.2; }
a { color: var(--green-d); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid rgba(0, 128, 60, .35); outline-offset: 2px; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 11px; background: var(--green); color: #fff;
  font-weight: 600; font-size: 14px; padding: 11px 16px; min-height: 44px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s;
}
.btn:hover { background: var(--green-d); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sec { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-sec:hover { background: var(--green-ll); }
.btn-ancho { width: 100%; }
.btn-icono {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer;
}
.btn-icono:hover { background: var(--green-l); }
.btn-icono.claro { color: #cfe9da; }
.btn-icono.claro:hover { background: rgba(255, 255, 255, .1); }

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
input:not([type=checkbox]):not([type=color]), select, textarea {
  width: 100%; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: #fff; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
input[type=color] { width: 64px; height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 500; color: var(--body); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.error { color: var(--red); font-size: 13.5px; min-height: 20px; margin: 10px 0 0; }
.suave { color: var(--muted); }
.pequeno { font-size: 13px; }
.centro { text-align: center; }
kbd { font: 600 12px/1 ui-monospace, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; color: var(--ink); }

.cargando { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-marca {
  background: radial-gradient(circle at 20% 15%, #0a9a4c 0, var(--green) 35%, var(--green-dd) 100%);
  color: #e3f5ea; display: flex; flex-direction: column; justify-content: center; padding: 48px 56px;
}
.login-logo { width: 84px; height: 84px; border-radius: 20px; background: #fff; padding: 6px; margin-bottom: 26px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.login-marca h1 { color: #fff; font-size: 42px; margin: 0 0 12px; font-weight: 800; }
.login-marca p { font-size: 17px; max-width: 420px; margin: 0; color: #cdebd8; }
.login-caja { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; }
.login-form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 26px; margin: 0 0 6px; font-weight: 800; }
.login-form .suave { margin: 0 0 12px; }
.login-form .btn { margin-top: 6px; }
.aviso-maqueta { background: var(--amber-l); color: var(--amber); font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 10px; }
.pie-version { font-size: 11.5px; color: var(--muted); margin-top: 28px; }

.mensaje-central { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; max-width: 520px; margin: 0 auto; }
.mensaje-logo { width: 72px; height: 72px; margin-bottom: 18px; }
.mensaje-central h1 { font-size: 24px; margin: 0 0 10px; }
.mensaje-central p { margin: 0 0 22px; }

/* ---------- Estructura ---------- */
.marco { min-height: 100vh; }
.lateral {
  position: fixed; inset: 0 auto 0 0; width: var(--lateral); z-index: 30;
  background: var(--green-dd); color: #cfe9da; display: flex; flex-direction: column;
}
.lateral-marca { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; }
.lateral-marca img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 3px; }
.lateral-marca span { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.lateral-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-grupo { margin-bottom: 14px; }
.nav-grupo-t { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #7fb89a; padding: 6px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 11px;
  color: #cfe9da; text-decoration: none; font-weight: 600; font-size: 14px; transition: background .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.activo { background: rgba(255, 255, 255, .14); color: #fff; }
.nav-item svg { flex: 0 0 auto; }
.nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-pronto { font-style: normal; font-size: 10px; font-weight: 700; color: #9fd3b3; background: rgba(255, 255, 255, .08); border-radius: 99px; padding: 2px 7px; }
.lateral-usuario { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .1); }
.usuario-datos { flex: 1; min-width: 0; }
.usuario-datos b { display: block; color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-datos span { display: block; font-size: 12px; color: #9fd3b3; }
.sello-maqueta { background: var(--amber); color: #fff; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .1em; padding: 5px; }

.avatar {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.avatar.peq { width: 34px; height: 34px; font-size: 12.5px; border-radius: 9px; }

.barra-movil { display: none; }
.velo { display: none; }
.contenido { margin-left: var(--lateral); padding: 32px 40px 60px; max-width: calc(1240px + var(--lateral)); outline: none; }

/* ---------- Cabecera de página y bloques ---------- */
.cabecera { margin-bottom: 26px; }
.cabecera h1 { font-size: 28px; font-weight: 800; margin: 0 0 6px; }
.cabecera p { margin: 0; color: var(--muted); }
.cabecera-fecha { font-size: 13px; font-weight: 600; color: var(--green-d) !important; margin-bottom: 4px !important; }
.bloque { margin-bottom: 30px; }
.bloque-t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.bloque-t svg { color: var(--green); }

.tarjeta { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra); }
.tarjeta-pendiente { background: var(--green-ll); border-style: dashed; border-color: #bfe0cb; }
.tarjeta-pendiente p { margin: 0; }
.tarjeta-centro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 24px; max-width: 620px; }
.tarjeta-centro h2 { margin: 6px 0 0; font-size: 20px; }
.tarjeta-centro p { margin: 0; }
.ico-grande { width: 72px; height: 72px; border-radius: 18px; background: var(--green-l); color: var(--green); display: flex; align-items: center; justify-content: center; }

.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tarjeta-mod {
  display: flex; align-items: flex-start; gap: 14px; text-decoration: none; color: inherit; position: relative;
  transition: border-color .15s, transform .15s;
}
.tarjeta-mod:hover { border-color: #b9dcc6; transform: translateY(-1px); }
.tarjeta-ico { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; background: var(--green-l); color: var(--green); display: flex; align-items: center; justify-content: center; }
.tarjeta-txt { flex: 1; min-width: 0; padding-right: 60px; }
.tarjeta-txt b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }
.tarjeta-txt small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
.etiqueta { position: absolute; top: 14px; right: 14px; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--green-d); background: var(--green-l); border-radius: 99px; padding: 2px 8px; }
.es-pronto { box-shadow: none; background: transparent; }
.es-pronto .tarjeta-ico { background: #edf1ee; color: var(--muted); }
.es-pronto .etiqueta { color: var(--muted); background: #edf1ee; }

.vacio { text-align: center; padding: 60px 20px; color: var(--muted); }
.vacio h2 { margin: 12px 0 6px; font-size: 20px; }

/* ---------- Ruta de red ---------- */
.ruta { display: flex; gap: 10px; align-items: stretch; margin: 14px 0; }
.ruta code { flex: 1; min-width: 0; display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 13px ui-monospace, Consolas, monospace; color: var(--ink); overflow-wrap: anywhere; }
.pasos { margin: 0 0 14px; padding-left: 22px; }
.btn-grande { font-size: 16px; padding: 14px 24px; min-height: 52px; margin-top: 6px; }
.ayuda-lanzador { max-width: 620px; margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radio); padding: 4px 20px; }
.ayuda-lanzador[open] { padding-bottom: 12px; }
.ayuda-lanzador summary { cursor: pointer; font-weight: 700; color: var(--ink); padding: 12px 0; }
.ayuda-lanzador p { margin: 8px 0; }
.pasos li { margin: 6px 0; }

/* ---------- Pestañas, filtros, tablas ---------- */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.pestanas button { border: 0; background: none; padding: 11px 16px; min-height: 44px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.pestanas button.activo { color: var(--green-d); border-bottom-color: var(--green); }

.herramientas { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.herramientas select { width: auto; min-width: 200px; }
.herramientas .check { margin: 0; }
.buscador { flex: 1 1 260px; position: relative; margin: 0; }
.buscador svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.buscador input { padding-left: 40px !important; }

.tabla { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radio); overflow: hidden; }
.tabla th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--green-ll); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla-personas tbody tr { cursor: pointer; transition: background .12s; }
.tabla-personas tbody tr:hover { background: var(--green-ll); }
.de-baja { opacity: .55; }
.persona { display: flex; align-items: center; gap: 11px; }
.persona b { display: block; color: var(--ink); font-size: 14px; }
.persona small, .contacto small { display: block; color: var(--muted); font-size: 12.5px; }
.contacto { font-size: 13.5px; overflow-wrap: anywhere; }
.pastilla { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); white-space: nowrap; }
.punto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.punto::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.punto.si { color: var(--green-d); }
.punto.no { color: var(--muted); }

.tarjeta-dep { text-align: left; cursor: pointer; border-left: 5px solid var(--c); font: inherit; }
.tarjeta-dep b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.tarjeta-dep small { color: var(--muted); font-size: 13px; }
.tarjeta-dep:hover { border-color: var(--c); border-left-width: 5px; }

.tabla-scroll { overflow-x: auto; border-radius: var(--radio); margin: 14px 0; }
.matriz { min-width: 760px; }
.matriz th[scope=row] { background: #fff; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); white-space: nowrap; position: sticky; left: 0; z-index: 1; }
.matriz th[scope=row] svg { vertical-align: -3px; color: var(--green); margin-right: 4px; }
.matriz td { padding: 8px; }
.matriz select { min-width: 118px; font-size: 13px; min-height: 38px; padding: 6px 8px; }
.matriz .nivel-ver { background: var(--blue-l); border-color: #c9d3ff; }
.matriz .nivel-editar { background: var(--green-l); border-color: #bfe0cb; }
.matriz .nivel-admin { background: var(--amber-l); border-color: #f2d6b0; }

/* ---------- Ventanas ---------- */
.modal-fondo { position: fixed; inset: 0; z-index: 50; background: rgba(10, 25, 17, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { width: 100%; background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 6px 24px; }
.modal-cab h2 { font-size: 19px; margin: 0; }
.modal-cuerpo { padding: 0 24px 22px; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.checks { margin-top: 12px; }
.nota { background: var(--blue-l); color: #24388f; font-size: 13px; border-radius: 10px; padding: 10px 12px; margin: 8px 0 0; }
.permisos-persona { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.permisos-persona summary { cursor: pointer; font-weight: 700; color: var(--ink); padding: 10px 0; }
.permisos-persona summary small { font-weight: 500; color: var(--muted); }
.permiso-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.permiso-fila span { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.permiso-fila span svg { color: var(--green); }
.permiso-fila select { width: 230px; min-height: 38px; font-size: 13px; padding: 6px 8px; }
.botonera { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.botonera.izq { justify-content: flex-start; }

/* ---------- Avisos flotantes ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .4s, transform .4s; max-width: 340px; }
.toast-error { background: var(--red); }
.toast.fuera { opacity: 0; transform: translateY(8px); }

/* ====================== Tablet y móvil ====================== */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-marca { padding: 36px 24px 30px; }
  .login-marca h1 { font-size: 32px; }
  .login-logo { width: 64px; height: 64px; margin-bottom: 16px; }

  .barra-movil {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    background: #fff; border-bottom: 1px solid var(--line); padding: 8px 12px; min-height: 56px;
  }
  .barra-logo { width: 32px; height: 32px; }
  .barra-titulo { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lateral { transform: translateX(-100%); transition: transform .22s ease; }
  .lateral.abierto { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .velo.visible { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 25, 17, .4); }
  .contenido { margin-left: 0; padding: 20px 16px 48px; }
  .cabecera h1 { font-size: 23px; }
}

@media (max-width: 640px) {
  .rejilla { grid-template-columns: 1fr; }
  .campos { grid-template-columns: 1fr; }
  .herramientas select, .herramientas .btn { width: 100%; }
  .modal-fondo { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .permiso-fila { flex-direction: column; align-items: stretch; gap: 6px; }
  .permiso-fila select { width: 100%; }
  .ruta { flex-direction: column; }
  #toasts { left: 16px; right: 16px; }

  /* La tabla de personas se convierte en tarjetas */
  .tabla-personas, .tabla-personas tbody, .tabla-personas tr, .tabla-personas td { display: block; }
  .tabla-personas { border: 0; background: none; }
  .tabla-personas thead { display: none; }
  .tabla-personas tr { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 0; }
  .tabla-personas td { border: 0; padding: 6px 14px; }
  .tabla-personas td[data-t="Contacto"]:empty { display: none; }
}
