:root {
  --verde: #145c32;
  --verde-btn: #1f7a45;
  --fondo: #f4f7f4;
  --linea: #d5e4d8;
  --texto: #1c2b22;
  --error: #8d1d1d;
}

body.con-barra {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: "Segoe UI", sans-serif;
}

.marco {
  display: flex;
  min-height: 100vh;
}

.barra {
  width: 240px;
  flex: 0 0 240px;
  background: var(--verde);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 6px;
}

.barra-marca {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #fff;
  text-decoration: none;
  margin-bottom: 16px;
}

.barra-marca small { display: block; opacity: 0.8; }

.barra-grupo {
  margin: 8px 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.barra-enlace {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 10px;
}

.barra-enlace:hover { background: rgba(255, 255, 255, 0.08); }

.barra-icono { flex: 0 0 20px; opacity: 0.85; }

.barra-enlace[aria-current="page"] .barra-icono { opacity: 1; }

.barra-enlace[aria-current="page"] { background: rgba(255, 255, 255, 0.16); }

.barra-principal { margin-top: 8px; }

.barra-sesion {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px;
}

.barra-sesion button {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}

.barra-sesion button:hover { background: rgba(255, 255, 255, 0.22); }

.contenido { flex: 1; min-width: 0; padding: 28px 32px; }

.contenido > h1 { margin: 0 0 20px; color: #1d4d2b; font-size: 28px; }

.tarjeta {
  position: relative;
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(20, 60, 30, 0.05);
}

.tarjeta > h2 { margin: 6px 0 18px; font-size: 18px; color: #1d4d2b; }

:where(.contenido) button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--linea);
  border-radius: 10px;
  background: #fff;
  color: #1d4d2b;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

:where(.contenido button:hover) { background: #f1f7f2; border-color: #b9d3be; }

:where(.contenido button:focus-visible) {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 122, 69, 0.25);
}

:where(.contenido button:disabled) { opacity: 0.55; cursor: not-allowed; }

#btn-nuevo { position: absolute; top: 20px; right: 24px; }

#btn-nuevo::before { content: "+"; font-size: 18px; line-height: 1; }

.pasos { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.paso {
  border: 1px solid var(--linea);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #5c6b60;
}

.paso.activo { background: #2a6e36; color: #fff; border-color: #2a6e36; }

[data-paso="datos"]:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 4px 20px;
  align-items: start;
}

[data-paso="datos"] > .btn-primario { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }

[data-paso="revisar"]:not([hidden]) { display: flex; flex-wrap: wrap; gap: 10px; }

#resumen {
  flex: 1 0 100%;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid var(--linea);
  border-radius: 12px;
  overflow: hidden;
}

#resumen li { padding: 12px 16px; font-size: 14px; background: #fafcf9; }

#resumen li + li { border-top: 1px solid var(--linea); }

.filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 20px;
  align-items: start;
}

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.campo label,
.buscador-etiqueta { font-size: 13px; font-weight: 600; color: #3a4a3f; }

.campo-error { color: var(--error); font-size: 13px; margin: 0; }

.buscador-input, .campo input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9e3db;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--texto);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.buscador-input:focus, .campo input:focus {
  outline: none;
  border-color: var(--verde-btn);
  box-shadow: 0 0 0 3px rgba(31, 122, 69, 0.15);
}

.buscador-input:disabled { background: #f3f5f2; color: #8a978d; cursor: not-allowed; }

.campo:has(.campo-error:not([hidden])) input { border-color: var(--error); }

.buscador-lista {
  list-style: none;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--linea);
  border-radius: 10px;
  background: #fff;
  max-height: 200px;
  overflow: auto;
  box-shadow: 0 8px 20px rgba(20, 60, 30, 0.08);
}

.buscador-opcion {
  width: 100%;
  text-align: left;
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.buscador-opcion:hover, .buscador-opcion:focus-visible { background: #e6f2e8; outline: none; }

.btn-primario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2a6e36;
  color: #fff;
  border: none;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primario:hover { background: #1d4d2b; }

.btn-primario:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(31, 122, 69, 0.3); }

.btn-primario:disabled { opacity: 0.6; cursor: wait; }

.tabla-tarjeta {
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(20, 60, 30, 0.05);
  overflow: hidden;
}

.tabla-barra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--linea);
}

.tabla-titulo { display: flex; align-items: center; gap: 10px; color: #1d4d2b; }

.tabla-contador {
  background: #e6f2e8;
  color: #2a6e36;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}

.tabla-buscar {
  width: 260px;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9e3db;
  border-radius: 10px;
  padding: 9px 12px 9px 34px;
  font: inherit;
  font-size: 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c6b60' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 11px center;
}

.tabla-buscar:focus {
  outline: none;
  border-color: var(--verde-btn);
  box-shadow: 0 0 0 3px rgba(31, 122, 69, 0.15);
}

.tabla-wrap { overflow-x: auto; margin-top: 20px; }

.tabla-tarjeta .tabla-wrap { margin-top: 0; }

table.datos { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }

table.datos th {
  background: #f1f6f1;
  color: #3a4a3f;
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--linea);
}

table.datos td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2ee;
  vertical-align: middle;
}

table.datos tbody tr:nth-child(even) td { background: #fbfcfa; }

table.datos tbody tr:hover td { background: #f1f7f2; }

table.datos td:last-child { white-space: nowrap; text-align: right; }

table.datos .enlace {
  color: #1f6b8a;
  text-decoration: none;
  overflow-wrap: anywhere;
}

table.datos .enlace:hover { text-decoration: underline; }

table.datos .editar,
table.datos .eliminar {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  margin-left: 6px;
}

table.datos .editar::before,
table.datos .eliminar::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: var(--icono) no-repeat center / contain;
  mask: var(--icono) no-repeat center / contain;
}

table.datos .editar {
  --icono: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E");
}

table.datos .eliminar {
  color: var(--error);
  --icono: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6'/%3E%3C/svg%3E");
}

table.datos .eliminar:hover { background: #fbeeee; border-color: #e7c2c2; }

.tabla-vacia { margin: 0; padding: 28px 20px; text-align: center; color: #5c6b60; }

.paginador {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 12px 20px;
  border-top: 1px solid var(--linea);
  font-size: 13px;
  color: #5c6b60;
}

.paginador-info { margin-right: auto; }

.paginador-tamano { display: flex; align-items: center; gap: 6px; }

.paginador-tamano select {
  border: 1px solid #d9e3db;
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  background: #fff;
}

.paginador-botones { display: flex; align-items: center; gap: 4px; }

.paginador .paginador-btn {
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
}

.paginador .paginador-btn.activo { background: #2a6e36; border-color: #2a6e36; color: #fff; }

.paginador-puntos { padding: 0 4px; }

.vacio { color: #5c6b60; }

.inicio-titulo { margin: 0 0 4px; color: #1d4d2b; }

.inicio-sub { margin: 0 0 20px; color: #5c6b60; }

.accesos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-width: 900px;
}

.acceso {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 14px;
  color: var(--texto);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(20, 60, 30, 0.05);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.acceso:hover,
.acceso:focus-visible {
  transform: translateY(-2px);
  border-color: var(--verde-btn);
  box-shadow: 0 10px 22px rgba(20, 60, 30, 0.12);
  outline: none;
}

.acceso-icono {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e6f2e8;
  color: #2a6e36;
}

.acceso-texto { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.acceso-texto strong { font-size: 16px; color: #1d4d2b; }

.acceso-texto small { font-size: 13px; line-height: 1.4; color: #5c6b60; }

.acceso-flecha { color: #2a6e36; font-size: 20px; transition: transform 0.15s; }

.acceso:hover .acceso-flecha { transform: translateX(3px); }

.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #e8f3dc 0%, #fbf5e6 45%, #fdf3e0 100%);
  color: var(--texto);
  font-family: "Segoe UI", sans-serif;
}

.login-marco {
  display: flex;
  width: 100%;
  max-width: 760px;
  min-height: 330px;
  border-radius: 20px;
  overflow: hidden;
  background: #fdfdf0;
  box-shadow: 0 12px 32px rgba(20, 60, 30, 0.12);
}

.login-marca {
  flex: 0 0 42%;
  background: linear-gradient(160deg, #1d4d2b 0%, #2a6e36 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 26px 22px;
  box-sizing: border-box;
}

.login-logo {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.login-logo img { width: 50px; height: 50px; }

.login-marca h1 { margin: 0 0 8px; font-size: 22px; }

.login-marca p { margin: 0; font-size: 13px; line-height: 1.6; opacity: 0.92; }

.login-pie { margin-top: auto; padding-top: 24px; font-size: 13px; }

.login-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 20px;
  box-sizing: border-box;
}

.login-panel h2 { margin: 0 0 8px; font-size: 18px; color: #1d4d2b; }

.login-ayuda { margin: 0 0 16px; font-size: 13px; color: #5c6b60; }

.login-panel label { font-size: 11px; font-weight: 600; color: #3a4a3f; }

.login-panel .campo input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e3e6d4;
  border-radius: 10px;
  padding: 14px 12px;
  font-size: 13px;
  background: #fdfdf0;
}

.login-panel .campo input:focus {
  outline: none;
  border-color: var(--verde-btn);
  box-shadow: 0 0 0 3px rgba(31, 122, 69, 0.15);
}

.campo-pass { position: relative; }

.campo-pass input { padding-right: 44px; }

.btn-ojo {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  color: #3a4a3f;
  cursor: pointer;
  display: flex;
}

.login-panel .btn-primario {
  width: 100%;
  margin-top: 4px;
  min-height: 36px;
  border-radius: 8px;
  background: #2a6e36;
  font-weight: 600;
  font-size: 12px;
}

.login-panel .btn-primario:hover { background: #1d4d2b; }

@media (max-width: 800px) {
  .marco, .login-marco { flex-direction: column; }
  .barra { width: 100%; flex-basis: auto; }
}
