.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: 72px;
  height: auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  /* Mismo tono que el panel de marca del login (.login-split-brand) */
  background: linear-gradient(165deg, #062a4a 0%, #0a3a5c 42%, #0c2744 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
}

.logo {
  max-height: 44px;
  width: auto;
  max-width: min(200px, 38vw);
  object-fit: contain;
  object-position: left center;
}

.logo-header-iso {
  display: block;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  max-height: 48px;
  max-width: 48px;
  object-fit: contain;
}

/* Igual que .login-brand-mark: iso blanco sobre el azul del header */
.header .logo.logo-header-iso {
  filter: brightness(0) invert(1);
  opacity: 0.98;
}

.header-sep {
  font-size: 1.75rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1;
  user-select: none;
}

.header-product-name {
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  white-space: normal;
  line-height: 1.2;
  overflow: visible;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.app-shell {
  display: flex;
  align-items: stretch;
  margin-top: var(--app-header-offset, 72px);
  min-height: calc(100vh - var(--app-header-offset, 72px));
}

.sidebar {
  width: 272px;
  flex-shrink: 0;
  background: #f7f8fa;
  border-right: 1px solid #e7eaf0;
  padding: 1rem 0.85rem 1.5rem;
  position: sticky;
  top: var(--app-header-offset, 72px);
  align-self: stretch;
  min-height: calc(100vh - var(--app-header-offset, 72px));
  height: calc(100vh - var(--app-header-offset, 72px));
  max-height: none;
  overflow-y: auto;
  box-sizing: border-box;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.65rem 1.1rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid #e7eaf0;
}

.sidebar-brand-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  object-fit: contain;
  opacity: 0.95;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-brand-text strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: #0c2744;
}

.header-brand--compact {
  gap: 0.75rem;
}

#btn-sidebar-toggle {
  display: none;
}

.sidebar-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eef1f5;
}

.sidebar-title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #00568e;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #00568e;
  margin-bottom: 0.35rem;
}

/* Campos estilo “Material Expressive”: superficie tonal, radio amplio, elevación suave */
.field-input,
.field-select {
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0, 44, 74, 0.12);
  border-radius: 14px;
  font-size: 0.95rem;
  font-family: inherit;
  background: linear-gradient(180deg, #f6f8fb 0%, #eef2f7 100%);
  color: #1a2330;
  box-shadow: 0 1px 2px rgba(0, 44, 74, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  margin-bottom: 0.6rem;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.field-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300568e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.5rem;
}

.field-select-wrap {
  position: relative;
}

.field-label-floating {
  margin-bottom: 0.45rem;
}

.field-input::placeholder {
  color: #7a8796;
}

.field-input:hover,
.field-select:hover {
  border-color: rgba(0, 86, 142, 0.35);
}

.field-input:focus,
.field-select:focus {
  outline: none;
  border-color: #00568e;
  box-shadow:
    0 0 0 3px rgba(0, 86, 142, 0.18),
    0 2px 8px rgba(0, 44, 74, 0.08);
  background: #fff;
}

.btn-block {
  width: 100%;
  margin-top: 0.25rem;
}

.sidebar-hint {
  font-size: 0.8rem;
  color: #0d6b3a;
  min-height: 1.2em;
  margin: 0.5rem 0 0;
}

.sidebar-nav-group {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e8edf3;
}

.nav-group-title {
  margin: 0 0 0.4rem 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #00568e;
  opacity: 0.88;
}

.sidebar-nav-nested {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0;
}

.sidebar-nav--admin {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e7eaf0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  text-decoration: none;
  color: #3a4452;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.menu-item-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00568e;
  opacity: 0.88;
}

.menu-item-icon svg {
  display: block;
}

.menu-item-text {
  min-width: 0;
}

.menu-item:hover {
  background: rgba(12, 39, 68, 0.05);
  color: #0c2744;
}

.menu-item:hover .menu-item-icon {
  opacity: 1;
}

.menu-item.active {
  background: #e8eef5;
  color: #0c2744;
  border-color: transparent;
  box-shadow: none;
}

.menu-item.active .menu-item-icon {
  color: #0c2744;
  opacity: 1;
}

.main-content {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  max-width: min(100%, 1680px);
  width: 100%;
}

@media (max-width: 900px) {
  #btn-sidebar-toggle {
    display: inline-flex;
  }

  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: min(288px, 86vw);
    position: fixed;
    left: 0;
    top: var(--app-header-offset, 72px);
    bottom: 0;
    z-index: 90;
    height: auto;
    min-height: 0;
    max-height: none;
    border-right: 1px solid #e7eaf0;
    border-bottom: none;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 28px rgba(12, 39, 68, 0.12);
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  body.sidebar-drawer-open::after {
    content: '';
    position: fixed;
    inset: var(--app-header-offset, 72px) 0 0 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 80;
  }
}

/* Acordeón lateral (Nomad, Traefik, …) */
.nav-accordion {
  margin-bottom: 0.2rem;
}

.nav-accordion--flush {
  margin-bottom: 0;
}

.nav-accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: stretch;
  padding: 0.55rem 0.65rem;
  margin: 0;
  border: 1px solid rgba(0, 86, 142, 0.12);
  border-radius: 12px;
  background: #f4f8fc;
  color: #00568e;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.nav-accordion-trigger:hover {
  background: #e8f2fa;
  border-color: rgba(0, 86, 142, 0.22);
}

.nav-accordion-trigger-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
}

.nav-accordion-chevron {
  display: flex;
  color: #00568e;
  opacity: 0.75;
  transition: transform 0.18s ease;
}

.nav-accordion-trigger[aria-expanded="false"] .nav-accordion-chevron {
  transform: rotate(-90deg);
}

.nav-accordion-panel {
  padding: 0.25rem 0 0.15rem 0.15rem;
}

.nav-accordion-panel[hidden] {
  display: none !important;
}
