.twl-global-header {
  position: sticky;
  top: 0;
  z-index: 10000;
  border-bottom: 1px solid rgba(58,66,83,.65);
  background: rgba(15,17,23,.94);
  backdrop-filter: blur(16px);
}

.twl-global-shell {
  width: min(1180px, calc(100% - 28px));
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.twl-global-brand {
  flex: 0 0 auto;
  width: 88px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
}

.twl-global-brand img {
  width: 86px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.28));
}

.twl-global-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.twl-global-nav,
.twl-global-language,
.twl-global-actions,
.twl-global-social {
  display: flex;
  align-items: center;
}

.twl-global-nav {
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.twl-global-actions {
  gap: 10px;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.twl-global-language {
  gap: 6px;
}

.twl-global-social {
  gap: 3px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.twl-global-link,
.twl-global-lang {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #B5BCC7;
  font: 800 .80rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.twl-global-link:hover,
.twl-global-link.is-active,
.twl-global-lang:hover,
.twl-global-lang.active {
  color: #F1F3F5;
  border-color: rgba(77,166,255,.30);
  background: rgba(77,166,255,.10);
}

.twl-global-link:hover,
.twl-global-lang:hover {
  transform: translateY(-1px);
}

.twl-global-lang {
  padding: 0 10px;
}

.twl-global-social-link {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  flex: 0 0 30px;
  padding: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(77,166,255,.20);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(34,40,52,.95) 0%, rgba(24,28,36,.95) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 1px rgba(0,0,0,.10);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.twl-global-social-link:hover {
  transform: translateY(-1px) scale(1.05);
  border-color: rgba(77,166,255,.45);
  background: linear-gradient(180deg, rgba(54,65,86,.98) 0%, rgba(31,37,49,.98) 100%);
  box-shadow: 0 0 0 1px rgba(77,166,255,.12), 0 0 14px rgba(77,166,255,.18);
}

.twl-global-social-link img {
  width: 17px;
  height: 17px;
  max-width: 17px;
  max-height: 17px;
  min-width: 17px;
  min-height: 17px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.28));
}

.twl-global-menu-toggle {
  display: none;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-left: auto;
  padding: 0 13px;
  border: 1px solid rgba(77,166,255,.24);
  border-radius: 12px;
  background: rgba(77,166,255,.08);
  color: #F1F3F5;
  font: 900 .82rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
}

.twl-global-menu-icon {
  width: 18px;
  height: 14px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}

.twl-global-menu-icon span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .18s ease, opacity .18s ease;
}

.twl-global-header.is-open .twl-global-menu-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.twl-global-header.is-open .twl-global-menu-icon span:nth-child(2) {
  opacity: 0;
}

.twl-global-header.is-open .twl-global-menu-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* CBC: navegación interna compacta y en una sola fila */
.cbc-main-tabs-wrap {
  width: min(760px, calc(100% - 28px)) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.cbc-shared-tabs {
  width: 100% !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 1080px) {
  .twl-global-shell { min-height: 56px; }
  .twl-global-brand { width: 76px; }
  .twl-global-brand img { width: 74px; }
  .twl-global-link,
  .twl-global-lang {
    padding: 0 9px;
    font-size: .75rem;
  }
  .twl-global-actions { gap: 7px; }
}

@media (max-width: 920px) {
  .twl-global-shell {
    min-height: 58px;
    flex-wrap: wrap;
    padding: 8px 0;
  }

  .twl-global-brand {
    width: 86px;
    min-height: 38px;
  }

  .twl-global-brand img { width: 82px; }
  .twl-global-menu-toggle { display: inline-flex; }

  .twl-global-panel {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    transition: max-height .22s ease, opacity .18s ease, padding .18s ease;
  }

  .twl-global-header.is-open .twl-global-panel {
    max-height: calc(100vh - 72px);
    overflow: auto;
    opacity: 1;
    pointer-events: auto;
    padding: 8px 0 4px;
  }

  .twl-global-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .twl-global-link {
    min-height: 42px;
    width: 100%;
    justify-content: flex-start;
    padding: 0 13px;
    border-color: rgba(58,66,83,.75);
    background: rgba(34,40,52,.70);
    font-size: .80rem;
  }

  .twl-global-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    padding-top: 2px;
  }

  .twl-global-social,
  .twl-global-language {
    justify-content: center;
  }
}

@media (max-width: 620px) {
  .twl-global-nav { grid-template-columns: 1fr; }
  .twl-global-link { justify-content: center; }

  .cbc-main-tabs-wrap {
    width: min(420px, calc(100% - 24px)) !important;
  }

  .cbc-shared-tabs {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 420px) {
  .twl-global-shell { width: min(100% - 20px, 1180px); }
  .twl-global-brand,
  .twl-global-brand img { width: 74px; }
  .twl-global-menu-toggle { padding: 0 11px; }
  .twl-global-social-link {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    flex-basis: 28px;
  }
  .twl-global-social-link img {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
    min-width: 16px;
    min-height: 16px;
  }
}
