/* Los colores, la tipografía y demás tokens de diseño viven en ngb-ui.css (compartido). */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  box-shadow: 0 1px 4px rgba(74, 127, 214, 0.08);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-decoration: none;
}

.brand-logo {
  height: 40px;
  width: auto;
  border-radius: 6px;
}

.topbar nav a {
  color: var(--text);
  text-decoration: none;
  margin: 0 12px;
  font-size: 0.95rem;
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}

.topbar nav a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.nav-dropdown {
  display: inline-block;
  position: relative;
  margin: 0 12px;
}

.nav-dropdown summary {
  color: var(--text);
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}

.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: " ▾"; font-size: 0.75em; }

.nav-dropdown[open] summary,
.nav-dropdown summary:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(38, 54, 77, 0.12);
  padding: 6px;
  margin-top: 6px;
}

.nav-dropdown-menu a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.nav-dropdown-menu a:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.user-area { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; color: var(--text-muted); }
.user-area a { color: var(--primary-dark); text-decoration: none; }
.user-area a:hover { text-decoration: underline; }

.content { max-width: 1400px; margin: 0 auto; padding: 28px; }

h1 { margin-top: 0; color: var(--primary-dark); }
h2 { color: var(--primary-dark); font-size: 1.1rem; margin-top: 32px; }

.subtitle { color: var(--text-muted); margin-top: -8px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cards { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  flex: 1;
  min-width: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(74, 127, 214, 0.06);
}

.card-highlight { background: linear-gradient(135deg, var(--primary-light), var(--surface)); }

.card-value { font-size: 2.2rem; font-weight: 700; color: var(--primary-dark); }
.card-label { color: var(--text-muted); font-size: 0.9rem; }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

.search-box {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.search-box:focus {
  outline: none;
  border-color: var(--primary);
}

.filtros-usuarios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.filtros-usuarios .search-box { max-width: 320px; flex: 1; min-width: 200px; }

.filtro-sucursal-form select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
}

@media (max-width: 700px) {
  .filtros-usuarios { flex-direction: column; align-items: stretch; }
  .filtros-usuarios .search-box { max-width: 100%; }
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.92rem;
}

th { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
tr:last-child td { border-bottom: none; }

.rechazo-detalle summary {
  cursor: pointer;
  color: var(--danger);
  font-size: 0.92rem;
  text-decoration: underline;
  list-style: none;
}

.rechazo-detalle summary::-webkit-details-marker { display: none; }

.rechazo-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  min-width: 200px;
}

.editar-en-linea {
  display: flex;
  gap: 8px;
  align-items: center;
}

.editar-en-linea input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
}

.rechazo-form textarea {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.acciones { display: flex; gap: 12px; align-items: center; }
.acciones form { margin: 0; }

.acciones-archivo { display: flex; gap: 12px; white-space: nowrap; }

.link-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
  font-size: 0.92rem;
  text-decoration: underline;
}

.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 9px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn:hover { background: var(--primary-dark); }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }

.btn-secundario {
  background: var(--surface);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.btn-secundario:hover { background: var(--primary-light); }

.badge {
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  text-transform: capitalize;
  font-weight: 600;
}

.badge-activo, .badge-aprobada { background: #dff3e8; color: var(--success); }
.badge-inactivo, .badge-rechazada { background: #fbe6e3; color: var(--danger); }
.badge-pendiente { background: #fdf1d6; color: #b8860b; }

.badge-tipo-vacaciones { background: var(--primary-light); color: var(--primary-dark); }
.badge-tipo-incapacidad { background: #fbe6e3; color: var(--danger); }
.badge-tipo-permiso_especial { background: #eef0fb; color: #5a4fcf; }

.form, .inline-form { display: flex; flex-direction: column; gap: 6px; max-width: 440px; }

.form label { font-weight: 600; margin-top: 10px; font-size: 0.9rem; color: var(--text-muted); }

.form input, .form select, .form textarea, .inline-form input, .inline-form select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-actions { margin-top: 18px; display: flex; gap: 16px; align-items: center; }
.form-actions a { color: var(--text-muted); text-decoration: none; }

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  flex: 1;
  padding-right: 42px !important;
}

.toggle-password {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  line-height: 1;
}

.login-box {
  max-width: 360px;
  margin: 90px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  box-shadow: 0 8px 24px rgba(74, 127, 214, 0.12);
  text-align: center;
}

.login-logo {
  display: block;
  max-width: 260px;
  width: 100%;
  height: auto;
  margin: 0 auto 20px;
  border-radius: 8px;
}

.login-box h1 { color: var(--primary-dark); margin-bottom: 0; }
.login-box .subtitle { margin-bottom: 24px; font-size: 0.9rem; }

.login-box form { display: flex; flex-direction: column; gap: 8px; text-align: left; }

.login-box label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

.login-box input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.login-box button {
  margin-top: 16px;
  padding: 11px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.login-box button:hover { background: var(--primary-dark); }

.flash {
  background: var(--primary-light);
  border: 1px solid var(--border);
  color: var(--primary-dark);
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.flash p { margin: 0; }

@media (max-width: 700px) {
  .topbar {
    padding: 12px 16px;
  }

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

  .topbar nav a {
    margin: 0 8px 0 0;
    font-size: 0.88rem;
  }

  .user-area {
    order: 2;
    margin-left: auto;
  }

  .content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .cards {
    flex-direction: column;
  }

  .card {
    min-width: 0;
  }

  .login-box {
    margin: 32px auto;
    padding: 24px;
    max-width: calc(100% - 32px);
  }

  .form, .inline-form {
    max-width: 100%;
  }

  .acciones {
    flex-wrap: wrap;
    row-gap: 6px;
  }
}

/* Usuarios: que los nombres largos no se partan en 4 líneas */
#tabla-usuarios th, #tabla-usuarios td { padding: 10px 8px; }
#tabla-usuarios th:nth-child(1), #tabla-usuarios td:nth-child(1) { min-width: 170px; }
#tabla-usuarios td.acciones > *, #tabla-usuarios td.acciones form { margin-right: 2px; }

/* ---- Ventana flotante de avisos y confirmaciones (misma que Caja Chica) ---- */
[hidden] { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 40, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-aviso {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 40px rgba(22, 40, 74, 0.3);
  width: min(400px, 100%);
  overflow: hidden;
}

.modal-aviso-titulo {
  background: var(--primary-light);
  color: var(--heading, var(--text));
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-aviso-cuerpo {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 18px;
}

.modal-aviso-icono {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.modal-aviso-icono-exito { background: var(--success); }

.modal-aviso-cuerpo p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.5;
}

.modal-aviso-acciones {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  padding: 0 18px 16px;
}

/* Bitácora de procesos */
.filtros-bitacora {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.filtros-bitacora label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted, #5b6472); margin-bottom: 4px; }
.filtros-bitacora input, .filtros-bitacora select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
}
.nota-bitacora { margin: 6px 0 16px; font-size: 0.9rem; }
.bitacora-detalle { min-width: 280px; }
.bitacora-nowrap { white-space: nowrap; }
@media (max-width: 700px) {
  .filtros-bitacora { flex-direction: column; align-items: stretch; }
}

/* «Descargar PDF» junto a «Descargar Excel» */
.btn.btn-pdf { background: #b3261e; color: #fff; margin-left: 8px; }
.btn.btn-pdf:hover { background: #8c1d18; }
