/**
 * Estructura de navegacion lateral corporativa, barra superior y contenedor principal.
 */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #1f2937;
}

.brand {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #1f2937;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f9fafb;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.72rem;
  color: var(--sidebar-text);
  display: block;
  font-weight: 400;
}

.nav-group-label {
  padding: 1.1rem 1.25rem 0.4rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  font-weight: 600;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.75rem;
  flex: 1;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--sidebar-text);
  border: 1px solid transparent;
  padding: 0.6rem 0.75rem;
  min-height: 2.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.tab-btn:hover {
  background: var(--sidebar-hover);
  color: #f3f4f6;
}

.tab-btn:focus-visible {
  outline: 3px solid var(--focus-ring-on-dark);
  outline-offset: 2px;
}

.tab-btn:focus:not(:focus-visible) {
  outline: none;
}

.tab-btn.active,
.tab-btn[aria-current="page"] {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-util-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  background: transparent;
  border: 1px solid #374151;
  color: #d1d5db;
  padding: 0.45rem 0.65rem;
  min-height: 2.125rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-util-btn:hover {
  background: #1f2937;
  border-color: #4b5563;
  color: #ffffff;
}

.sidebar-util-btn:focus-visible {
  outline: 3px solid var(--focus-ring-on-dark);
  outline-offset: 2px;
}

.sidebar-util-btn:focus:not(:focus-visible) {
  outline: none;
}

.sidebar-util-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Contenedor central */
.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-left h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.topbar-left p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  color: var(--success-strong);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-strong);
}

main {
  flex: 1;
  padding: 1.5rem 1.75rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Control de vistas */
.section,
.view-seccion {
  display: none;
}

.section.active,
.view-seccion.active {
  display: block;
}

/* Responsividad en pantallas estrechas */
@media (max-width: 980px) {
  body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #1f2937;
  }
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .tab-btn {
    white-space: nowrap;
    width: auto;
  }
  .sidebar-footer {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-util-btn {
    width: auto;
  }
  .topbar {
    padding: 0.75rem 1rem;
  }
  main {
    padding: 1rem;
  }
}
