/* =========================
   RESET + BASE
========================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #f5f5f5, #eef2ff);
  color: #111827;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* =========================
   HEADER GLOBAL
========================= */
.app-header {
  background: #2c1f47;
  color: white;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.app-header .logo {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  place-items: center;
}

.logo-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.app-header.public-header {
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-header.public-header .public-logo {
  font-size: 1.1rem;
  font-weight: 800;
}


.app-header .empresa-header-nombre {
  text-align: center;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.app-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header nav a {
  color: white;
  text-decoration: none;
  font-size: 0.95rem;
}

.app-header nav a:hover {
  text-decoration: underline;
}

.app-header .logout-btn {
  padding: 6px 12px;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #ffffff;
}

.app-header .logout-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* =========================
   CONTENEDOR PRINCIPAL BASE
========================= */
.main {
  max-width: 420px;
  margin: 60px auto;
  background: white;
  padding: 28px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  flex: 1 0 auto;
}

.main h1,
.main h2 {
  text-align: center;
  margin-bottom: 12px;
  font-weight: 600;
}

.main p {
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 20px;
}

/* =========================
   FORMULARIOS BASE
========================= */
form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

input,
select,
textarea {
  padding: 11px;
  font-size: 0.95rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background-color: #f9fafb;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #4f46e5;
  background-color: #ffffff;
}

/* =========================
   BOTONES
========================= */
button {
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: #5b3a8f;
  color: white;
}

button:hover {
  background: #2c1f47;
}

/* =========================
   LOGIN / REGISTRO
========================= */
.login-extra {
  margin-top: 18px;
  text-align: center;
}

.registro-link {
  color: #4f46e5;
  text-decoration: none;
  font-size: 0.9rem;
}

.registro-link:hover {
  text-decoration: underline;
}

/* =========================
   UTILIDADES
========================= */
#status {
  margin-top: 14px;
  font-size: 0.9rem;
  text-align: center;
}


.app-header .nav-dropdown {
  position: relative;
}

.app-header .nav-dropdown-toggle {
  background: transparent;
  border: 1px solid #4b5563;
  color: white;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.app-header .nav-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.app-header .nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #2c1f47;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 8px;
  z-index: 1000;
}

.app-header .nav-dropdown.open .nav-dropdown-menu {
  display: grid;
  gap: 6px;
}

.app-header .nav-dropdown-menu a {
  display: block;
  padding: 8px;
  border-radius: 6px;
}

.app-header .nav-dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.app-header .user-menu-toggle {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 56px;
}

.app-header .user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #c4b5fd;
  color: #312e81;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.app-header .user-name {
  font-size: 0.72rem;
  color: #ddd6fe;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header .user-dropdown-menu {
  min-width: 230px;
}

.app-header .menu-group-title {
  font-size: 0.72rem;
  color: #9ca3af;
  padding: 6px 8px 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}


/* =========================
   TABLAS: CONTROL DE DESBORDE DE TEXTO
========================= */
.main table th,
.main table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
}


/* =========================
   FOOTER LEGAL GLOBAL
========================= */
body.has-legal-footer {
  padding-bottom: var(--legal-footer-offset, 120px);
}

.legal-footer {
  margin-top: 0;
  background: #2c1f47;
  color: #e5e7eb;
  padding: 16px 20px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 1000;
}

.legal-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.legal-copy {
  margin: 0;
  font-size: 0.9rem;
  color: #d1d5db;
}

.legal-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
}

.legal-links a {
  color: #c7d2fe;
  text-decoration: none;
}

.legal-links a:hover {
  text-decoration: underline;
}

.legal-links .sep {
  color: #6b7280;
}

.app-header nav > .nav-link-btn {
  border: 1px solid #4b5563;
  border-radius: 6px;
  padding: 6px 10px;
  text-decoration: none;
  line-height: 1.2;
}

.app-header nav > .nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}






@media (max-width: 900px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 12px;
    justify-items: center;
  }

  .app-header .empresa-header-nombre {
    font-size: 0.95rem;
  }

  .app-header nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .main {
    width: min(100%, 100vw - 16px);
    margin: 16px auto;
    padding: 16px;
    border-radius: 8px;
  }
}


@media (min-width: 1200px) {
  .main {
    box-shadow: 0 14px 30px rgba(59, 40, 99, 0.18);
  }

  .app-header nav {
    gap: 10px;
  }
}
