:root {
  --spat-nav-navy: #082f5e;
  --spat-nav-blue: #0b4da3;
  --spat-nav-red: #d72e3f;
  --spat-nav-ink: #102338;
  --spat-nav-muted: #687b8d;
  --spat-nav-line: #dce5ed;
}

.app-shell {
  grid-template-columns: 276px minmax(0, 1fr);
  background: #f4f7fa;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  padding: 26px 18px 22px;
  overflow-y: auto;
  border-right: 1px solid #06274d;
  background: var(--spat-nav-navy);
  box-shadow: 10px 0 30px rgba(8, 35, 66, .08);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--spat-nav-red) 0 58px, #237dca 58px 100%);
}

.sidebar > div:first-child {
  min-width: 0;
}

.side-brand {
  gap: 12px;
  margin: 0 4px 24px;
  padding: 2px 0 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .13);
}

.sidebar-logo-emphasis {
  width: 58px !important;
  height: 58px !important;
  min-width: 58px !important;
  min-height: 58px !important;
  padding: 6px !important;
  border: 1px solid rgba(255, 255, 255, .32) !important;
  border-radius: 11px !important;
  box-shadow: 0 8px 18px rgba(0, 19, 42, .26) !important;
}

.side-brand-copy strong {
  color: #fff;
  font-size: 20px;
  letter-spacing: 1.1px;
}

.side-brand-copy small {
  max-width: 132px;
  margin-top: 4px;
  color: #9dc4e2;
  font-size: 9px;
  line-height: 1.45;
  letter-spacing: .75px;
}

.sidebar nav {
  gap: 3px;
  margin-top: 0;
}

.sidebar nav::before {
  content: "SECCIONES";
  display: block;
  margin: 0 11px 8px;
  color: #78a3c4;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.7px;
}

.sidebar nav .nav-item {
  position: relative;
  min-height: 54px;
  gap: 13px;
  padding: 10px 12px 10px 13px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 6px;
  color: #b8d0e2;
  background: transparent;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: .05px;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.sidebar nav .nav-item svg {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: #7ea9c9;
  stroke-width: 1.9;
  transition: color .16s ease, transform .16s ease;
}

.legacy-equipment-icon {
  flex: 0 0 auto;
  width: 35px;
  height: 27px;
  margin: 0 -3px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 16, 34, .28));
  transition: transform .16s ease, filter .16s ease;
}

.sidebar nav .nav-item:hover svg,
.sidebar nav .nav-item.active svg,
.sidebar nav .nav-item:hover .legacy-equipment-icon,
.sidebar nav .nav-item.active .legacy-equipment-icon {
  transform: translateY(-1px) scale(1.05);
}

.sidebar nav .nav-item:hover .legacy-equipment-icon,
.sidebar nav .nav-item.active .legacy-equipment-icon {
  filter: drop-shadow(0 2px 2px rgba(0, 16, 34, .24));
}

.sidebar nav .nav-item:hover svg {
  color: #c6e7fb;
}

.sidebar nav .nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.sidebar nav .nav-item:focus-visible {
  outline: 2px solid #8fc7ee;
  outline-offset: 2px;
}

.sidebar nav .nav-item.active {
  border-left-color: var(--spat-nav-red);
  color: #082f5e;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 20, 45, .16);
}

.sidebar nav .nav-item.active svg {
  color: var(--spat-nav-blue);
}

.side-user {
  gap: 5px;
  margin-top: auto;
  padding: 18px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, .13);
  background: transparent;
}

.side-user small {
  color: #7fa5c1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.side-user strong {
  color: #eef7fd;
  font-size: 12px;
  font-weight: 650;
}

.side-user button {
  min-height: 39px;
  margin-top: 9px;
  padding: 8px 10px;
  border-color: rgba(255, 255, 255, .18);
  border-radius: 6px;
  color: #d7e8f4;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.side-user button:hover {
  border-color: rgba(215, 46, 63, .72);
  color: #fff;
  background: rgba(215, 46, 63, .13);
}

.main {
  padding: 30px clamp(24px, 3vw, 44px) 42px;
}

.topbar {
  position: relative;
  align-items: center;
  gap: 24px;
  margin-bottom: 22px;
  padding: 2px 0 20px;
  border-bottom: 1px solid var(--spat-nav-line);
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 64px;
  height: 3px;
  background: var(--spat-nav-red);
}

.topbar .eyebrow {
  color: var(--spat-nav-blue);
  font-size: 9px;
  letter-spacing: 1.8px;
}

.topbar h1 {
  margin: 5px 0 6px;
  color: var(--spat-nav-ink);
  font-size: clamp(27px, 2.4vw, 35px);
  font-weight: 750;
  letter-spacing: -1px;
}

.scope-names {
  gap: 7px;
  color: var(--spat-nav-muted);
}

.scope-names span {
  color: var(--spat-nav-muted);
  font-size: 12px;
}

.scope-separator {
  color: #b7c1ca !important;
}

.top-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.system-health {
  display: grid;
  grid-template-columns: 4px auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-width: 190px;
  min-height: 44px;
  padding: 4px 12px 4px 0;
  color: #24435e;
}

.system-health-marker {
  grid-row: 1 / 3;
  align-self: stretch;
  width: 4px;
  min-height: 36px;
  border-radius: 1px;
  background: #2c9a5d;
}

.system-health-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}

.system-health-copy small {
  color: #758899;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 1.35px;
}

.system-health-copy strong {
  color: #173b5b;
  font-size: 12px;
  font-weight: 750;
}

.system-health-time {
  align-self: end;
  color: #718394;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.top-actions .secondary-btn {
  min-height: 40px;
  border-radius: 7px;
  box-shadow: none;
}

.spat-monitor-cycle {
  display: grid;
  grid-template-columns: 4px auto;
  align-items: stretch;
  gap: 10px;
  min-height: 42px;
  padding: 3px 10px 3px 0;
}

.spat-monitor-cycle > span {
  width: 4px;
  border-radius: 1px;
  background: #38b66f;
}

.spat-monitor-cycle strong,
.spat-monitor-cycle small {
  display: block;
}

.spat-monitor-cycle strong {
  color: #b9d7ed;
  font-size: 9px;
  letter-spacing: 1.25px;
}

.spat-monitor-cycle small {
  margin-top: 5px;
  color: #829db2;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1220px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    max-width: 480px;
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 11px 16px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #06274d;
    box-shadow: 0 8px 24px rgba(5, 34, 63, .16);
  }

  .sidebar::before {
    height: 3px;
  }

  .sidebar > div:first-child {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .side-brand {
    flex: 0 0 auto;
    gap: 9px;
    margin: 0;
    padding: 0 14px 0 0;
    border-right: 1px solid rgba(255, 255, 255, .15);
    border-bottom: 0;
  }

  .sidebar-logo-emphasis {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 4px !important;
    border-radius: 8px !important;
  }

  .side-brand-copy strong {
    font-size: 15px;
  }

  .side-brand-copy small {
    display: none;
  }

  .sidebar nav {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: row;
    gap: 3px;
    min-width: 0;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .sidebar nav::before {
    display: none;
  }

  .sidebar nav .nav-item {
    flex: 0 0 auto;
    min-height: 46px;
    gap: 9px;
    padding: 7px 11px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 5px 5px 2px 2px;
    font-size: 12px;
  }

  .sidebar nav .nav-item.active {
    border-bottom-color: var(--spat-nav-red);
    color: #fff;
    background: rgba(255, 255, 255, .12);
    box-shadow: none;
  }

  .sidebar nav .nav-item svg {
    width: 22px;
    height: 22px;
  }

  .sidebar nav .nav-item.active svg {
    color: #9dcced;
  }

  .legacy-equipment-icon {
    width: 31px;
    height: 23px;
  }

  .side-user {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 0 0 12px;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, .14);
  }

  .side-user small,
  .side-user strong {
    display: none;
  }

  .side-user button {
    min-height: 40px;
    margin: 0;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 22px 14px 34px;
  }

  .topbar {
    gap: 18px;
    padding-bottom: 18px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
  }

  .system-health {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 3px 0;
  }

  .top-actions .secondary-btn {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .sidebar {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 7px;
    padding: 9px 10px;
  }

  .sidebar > div:first-child {
    gap: 8px;
  }

  .side-brand {
    padding-right: 8px;
  }

  .side-brand-copy {
    display: none;
  }

  .sidebar-logo-emphasis {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
  }

  .sidebar nav .nav-item {
    min-height: 42px;
    gap: 7px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .sidebar nav .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .legacy-equipment-icon {
    width: 28px;
    height: 21px;
  }

  .side-user {
    padding-left: 6px;
  }

  .side-user button {
    width: 36px;
    min-height: 36px;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .side-user button svg {
    width: 16px;
    height: 16px;
  }
}
