@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');

:root {
  --chrome: #d5d6d6;
  --paper: #e7e7e5;
  --ink: #1a1a1a;
  --teal: #07343c;
  --cyan: #55e8f2;

  --texto: #0a0a0a;
  --texto-suave: #6b7280;
  --texto-tenue: #9ca3af;
  --linea: #e5e7eb;
  --linea-suave: #f3f4f6;

  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-borde: #fecdca;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --ok-borde: #abefc6;

  --sombra-carta: 0 14px 30px rgba(0, 0, 0, 0.08);
  --sombra-carta-alta: 0 18px 38px rgba(0, 0, 0, 0.12);
  --sombra-tinta: 0 8px 24px rgba(0, 0, 0, 0.18);
  --radio: 1.45rem;
}

html {
  font-size: 90%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--chrome);
  color: var(--texto);
  font-family: 'Lato', 'Segoe UI', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  letter-spacing: -0.025em;
}

code {
  font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
  font-size: 0.85em;
  background: var(--linea-suave);
  padding: 0.1em 0.4em;
  border-radius: 0.35rem;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.shell {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 0.5rem;
}

.surface {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  border-radius: 2rem;
  background: var(--paper);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.05),
    0 8px 30px rgba(0, 0, 0, 0.04);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 68px;
  flex-shrink: 0;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(28px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  z-index: 20;
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.035em;
  color: #000;
}

.marca-icono {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: var(--teal);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #0f172a;
}

.nav-item.activo {
  background: #000;
  color: #fff;
}

.topbar-acciones {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chip-usuario {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 15rem;
  padding: 0.2rem 0.7rem 0.2rem 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.15s ease;
}

.chip-usuario:hover {
  background: rgba(255, 255, 255, 0.9);
}

.chip-texto {
  min-width: 0;
  line-height: 1.15;
}

.chip-nombre {
  display: block;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-rol {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--texto-tenue);
}

.boton-icono {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.boton-icono:hover {
  background: #fff;
  color: #000;
}

.boton-icono.activo {
  background: #000;
  color: #fff;
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--teal);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  object-fit: cover;
}

.avatar-sm {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.7rem;
}

.avatar-xl {
  width: 7rem;
  height: 7rem;
  font-size: 2.25rem;
  box-shadow: var(--sombra-carta);
}

.page {
  min-height: 100%;
  animation: entrada 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.banda {
  padding: 1.75rem 1.75rem;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--sombra-tinta);
}

.banda-fila {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.banda h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
}

.banda p {
  margin: 0.35rem 0 0;
  color: #9ca3af;
}

.banda-migas {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b7280;
}

.banda-migas a:hover {
  color: #fff;
}

.banda-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.banda-datos {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.25rem;
}

.dato-valor {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.1;
}

.dato-etiqueta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b7280;
}

.contenido {
  padding: 1.75rem;
}

.encabezado-pagina {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.encabezado-pagina h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: 1.55rem;
  font-weight: 900;
}

.encabezado-pagina p {
  margin: 0.3rem 0 0;
  color: var(--texto-suave);
}

.contenido-estrecho {
  max-width: 54rem;
}

.seccion + .seccion {
  margin-top: 1.25rem;
}

.seccion-titulo {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 900;
}

.carta {
  padding: 1.35rem 1.5rem;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: var(--sombra-carta);
}

.rejilla {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
}

.rejilla-ancha {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.tarjeta-accion {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 8rem;
  padding: 1rem;
  border: 0;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: var(--sombra-carta);
  text-align: left;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

a.tarjeta-accion:hover {
  transform: translateY(-2px);
  box-shadow: var(--sombra-carta-alta);
}

.tarjeta-accion.inactiva {
  opacity: 0.65;
}

.tarjeta-icono {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: #000;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.tarjeta-accion h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 900;
}

.tarjeta-accion p {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--texto-suave);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-negro {
  background: #000;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.btn-negro:hover {
  background: #1f2937;
}

.btn-blanco {
  background: #fff;
  color: #000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-blanco:hover {
  background: #e5e7eb;
}

.btn-contorno {
  border: 1px solid var(--linea);
  background: #fff;
  color: #374151;
}

.btn-contorno:hover {
  border-color: #000;
  color: #000;
}

.btn-contorno-claro {
  border: 1px solid #4a4a4a;
  background: transparent;
  color: #d1d5db;
}

.btn-contorno-claro:hover {
  background: #3a3a3a;
  color: #fff;
}

.btn-peligro {
  background: var(--danger);
  color: #fff;
}

.btn-peligro:hover {
  background: #8f1c12;
}

.btn-pequeno {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

.formulario {
  display: grid;
  gap: 1rem;
}

.formulario-rejilla {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.campo {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--texto-suave);
}

.campo-ancho {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--linea);
  border-radius: 0.7rem;
  background: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--texto);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #000;
  outline-offset: -1px;
  border-color: #000;
}

input:disabled,
input[readonly],
select:disabled,
textarea:disabled {
  background: var(--linea-suave);
  color: var(--texto-suave);
}

input[type='file'] {
  padding: 0.4rem;
  font-size: 0.8rem;
}

.pista {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--texto-suave);
}

.interruptor {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--texto);
  text-transform: none;
  letter-spacing: normal;
}

.interruptor input {
  width: auto;
  accent-color: #000;
}

.formulario-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  grid-column: 1 / -1;
}

.buscador {
  position: relative;
  flex: 1;
  min-width: 12rem;
}

.buscador svg {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  transform: translateY(-50%);
  color: var(--texto-tenue);
  pointer-events: none;
}

.buscador input {
  padding-left: 2.1rem;
  border-radius: 999px;
}

.tabla-carta {
  overflow: hidden;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: var(--sombra-carta);
}

.tabla-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

thead {
  background: #f9fafb;
  border-bottom: 1px solid var(--linea-suave);
}

th {
  padding: 0.7rem 1.15rem;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--texto-tenue);
  white-space: nowrap;
}

td {
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--linea-suave);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.fila-enlace:hover {
  background: #f9fafb;
}

.celda-persona {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.celda-persona strong {
  display: block;
  font-weight: 700;
}

.celda-persona span {
  display: block;
  font-size: 0.75rem;
  color: var(--texto-suave);
}

.celda-derecha {
  text-align: right;
}

.sin-resultados td {
  padding: 2.5rem 1.15rem;
  text-align: center;
  color: var(--texto-suave);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-negro {
  background: #000;
  color: #fff;
}

.tag-neutro {
  background: var(--linea-suave);
  color: #4b5563;
}

.tag-ms {
  background: #ecfeff;
  color: #0e7490;
}

.tag-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.tag-apagado {
  background: #f3f4f6;
  color: var(--texto-tenue);
}

.tag-cerrado {
  background: #dcfce7;
  color: #166534;
}

.tag-enviado { background: #dbeafe; color: #1e40af; }
.tag-aprobado { background: #dcfce7; color: #166534; }
.tag-rechazado { background: #fee2e2; color: #991b1b; }

.input {
  padding: 0.55rem 0.9rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  font: inherit;
  background: #fff;
}

.input:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
  border-color: #111;
}

.menu { position: relative; display: inline-flex; }
.menu-lista {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
  min-width: 13rem; padding: 0.35rem; border-radius: 0.85rem;
  background: #fff; border: 1px solid #e5e7eb; box-shadow: 0 12px 28px rgba(0,0,0,.12);
}
.menu.abierto .menu-lista { display: block; }
.menu-lista a {
  display: block; padding: 0.55rem 0.7rem; border-radius: 0.55rem;
  color: inherit; text-decoration: none; font-size: 0.82rem; font-weight: 600;
}
.menu-lista a:hover { background: #f3f4f6; }

.mp-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
}
.mp-card {
  display: flex; flex-direction: column; gap: 0.85rem;
  padding: 1.1rem 1.15rem 1rem;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: var(--sombra-carta);
  border: 1px solid #e5e7eb;
}
.mp-card-top {
  display: flex; justify-content: space-between; gap: 0.85rem; align-items: flex-start;
}
.mp-proy {
  margin: 0 0 0.2rem;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: #9ca3af;
}
.mp-card h3 { margin: 0; font-size: 1.05rem; font-weight: 900; }
.mp-meta { margin: 0.35rem 0 0; color: var(--texto-suave); font-size: 0.85rem; }
.mp-importe {
  font-size: 1.15rem; font-weight: 900; font-variant-numeric: tabular-nums;
  white-space: nowrap; color: #111;
}
.mp-card-pie {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 0.7rem; padding-top: 0.7rem; border-top: 1px solid #f3f4f6;
}
.mp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.mp-tipo { font-size: 0.72rem; color: #6b7280; font-weight: 600; }
.mp-acciones { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.pila-avisos {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
  display: flex; flex-direction: column; gap: 0.45rem; max-width: 22rem;
}

.aviso {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.aviso-ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-borde);
  color: var(--ok);
}

.aviso-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-borde);
  color: var(--danger);
}

.vacio {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 4rem 1.5rem;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: var(--sombra-carta);
  text-align: center;
}

/* `hidden` lo anula el display:grid de arriba (igual que en motor.css) */
.vacio[hidden] {
  display: none !important;
}

.vacio-icono {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.5rem;
  border-radius: 1rem;
  background: var(--linea-suave);
  color: var(--texto-tenue);
}

.vacio h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
}

.vacio p {
  margin: 0;
  max-width: 30rem;
  color: var(--texto-suave);
}

.ficha {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  align-items: start;
}

.ficha-foto {
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: var(--sombra-carta);
  text-align: center;
}

.ficha-foto-nombre {
  font-size: 0.95rem;
  font-weight: 900;
}

.ficha-foto-email {
  font-size: 0.75rem;
  color: var(--texto-suave);
  word-break: break-all;
}

.ficha-foto-acciones {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at top, rgba(85, 232, 242, 0.18), transparent 55%),
    linear-gradient(160deg, #0a0f18, #07343c 55%, #1a1a1a);
}

.login-carta {
  width: min(26rem, 100%);
  padding: 2rem;
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.login-marca {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-marca .marca-icono {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
}

.login-marca h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 900;
}

.login-marca p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--texto-suave);
}

.btn-exafan {
  width: 100%;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: var(--teal);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 10px 24px rgba(7, 52, 60, 0.28);
}

.btn-exafan:hover {
  background: #0a4a55;
}

.btn-exafan img {
  height: 2.4rem;
  width: auto;
  filter: brightness(0) invert(1);
}

.login-local {
  margin-top: 1rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--linea);
}

.login-local summary {
  padding: 0.7rem 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--texto-suave);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.login-local summary::-webkit-details-marker {
  display: none;
}

.login-local summary::after {
  content: '▾';
  float: right;
  transition: transform 0.15s ease;
}

.login-local[open] summary::after {
  transform: rotate(180deg);
}

.suave {
  color: var(--texto-suave);
}

.pequeno {
  font-size: 0.8rem;
}

.mono {
  font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
}

.fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.oculto {
  display: none !important;
}

@keyframes entrada {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page {
    animation-duration: 1ms;
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav {
  scrollbar-width: none;
}

@media (max-width: 60rem) {
  .ficha {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 45rem) {
  html {
    font-size: 85%;
  }

  .topbar {
    height: auto;
    padding: 0.6rem 0.75rem;
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
  }

  .chip-texto {
    display: none;
  }

  .chip-usuario {
    padding: 0.2rem;
  }

  .shell {
    padding: 0.35rem;
  }

  .surface {
    border-radius: 1.5rem;
  }

  .banda,
  .contenido {
    padding: 1.25rem;
  }
}
