/* ════════════════════════════════════════════════════════════
   LAYOUT GENERAL
   ════════════════════════════════════════════════════════════ */

#app-shell {
  display: flex;
  min-height: 100vh;
}

/* — Sidebar — */
.sidebar {
  width: var(--sidebar-width);
  background: var(--verde-oscuro);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0;
  flex-shrink: 0;
  box-shadow: var(--sombra-sidebar);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__marca {
  width: 36px;
  height: 36px;
  border-radius: var(--radio-sm);
  background: var(--acento);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--texto-sobre-oscuro);
  margin-bottom: var(--space-6);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  align-items: center;
}

.sidebar__item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radio-md);
  color: var(--texto-sobre-oscuro-tenue);
  background: transparent;
  border: none;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.sidebar__item:hover {
  background: var(--verde-oscuro-2);
  color: var(--texto-sobre-oscuro);
}

.sidebar__item.activo {
  background: var(--verde-oscuro-2);
  color: var(--texto-sobre-oscuro);
}

.sidebar__item.activo::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--texto-sobre-oscuro);
  border-radius: 2px;
}

.sidebar__item svg { width: 20px; height: 20px; }

.sidebar__tooltip {
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--verde-oscuro-2);
  color: var(--texto-sobre-oscuro);
  padding: 6px 10px;
  border-radius: var(--radio-sm);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 50;
}

.sidebar__item:hover .sidebar__tooltip { opacity: 1; }

.sidebar__spacer { flex: 1; }

.sidebar__usuario {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--verde-oscuro-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-sobre-oscuro);
  margin-bottom: var(--space-2);
  cursor: pointer;
  border: none;
}

/* — Contenedor principal — */
#vista-contenedor {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--blanco-calido);
  border-bottom: 1px solid var(--borde);
}

.topbar__titulo {
  font-size: 13px;
  color: var(--texto-secundario);
}

.topbar__titulo strong {
  color: var(--texto-principal);
  font-weight: 600;
}

.topbar__acciones {
  display: flex;
  gap: var(--space-2);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: var(--radio-sm);
  border: 1px solid var(--borde-fuerte);
  background: var(--blanco-calido);
  color: var(--texto-principal);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: var(--crema-2); }

.btn--primario {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--texto-sobre-oscuro);
  font-weight: 600;
}

.btn--primario:hover { background: var(--acento-hover); }

.btn--peligro {
  background: var(--blanco-calido);
  border-color: var(--coral);
  color: var(--coral);
}

.btn--peligro:hover { background: var(--coral-suave); }

.btn--texto {
  background: transparent;
  border-color: transparent;
  color: var(--texto-secundario);
}

.btn--texto:hover { background: var(--crema-2); color: var(--texto-principal); }

.vista {
  padding: var(--space-6);
  flex: 1;
  overflow-y: auto;
}

.vista__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.vista__titulo {
  font-size: 26px;
}

.vista__subtitulo {
  font-size: 13px;
  color: var(--texto-secundario);
  margin-top: 4px;
}

/* — Estados vacíos / carga / error — */
.estado-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--texto-secundario);
  background: var(--blanco-calido);
  border: 1px dashed var(--borde-fuerte);
  border-radius: var(--radio-lg);
}

.estado-vacio__icono {
  width: 40px;
  height: 40px;
  color: var(--texto-terciario);
  margin-bottom: var(--space-3);
}

.estado-vacio__titulo {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--texto-principal);
  margin-bottom: var(--space-1);
}

.skeleton {
  background: linear-gradient(90deg, var(--crema-2) 25%, var(--borde) 37%, var(--crema-2) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radio-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* — Toast — */
#toast-contenedor {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
}

.toast {
  background: var(--verde-oscuro);
  color: var(--texto-sobre-oscuro);
  padding: 12px 16px;
  border-radius: var(--radio-md);
  font-size: 13px;
  box-shadow: var(--sombra-modal);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 220px;
  animation: toast-in 0.2s ease;
}

.toast--error { background: var(--coral); }
.toast--exito { background: var(--salvia); color: var(--verde-oscuro); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* — Responsive — */
@media (max-width: 720px) {
  .vista { padding: var(--space-4); }
  .topbar { padding: var(--space-3) var(--space-4); }
}
