.teams-widget {
  --accent: var(--pro);
  --tint: #fff0e5;
  --accent-text: #9a450c;
  --team-title-size: 1.15rem;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 3.5vw, 44px);
}
.teams-widget[data-direction="start"] { --accent: var(--start); --tint: #e5f5eb; --accent-text: #116c37; }
.teams-widget[data-direction="junior"] { --accent: var(--junior); --tint: #ffe9eb; --accent-text: #ab2031; }
.teams-widget[data-region-theme] { --accent: var(--theme-accent); --tint: var(--theme-tint); --accent-text: var(--theme-text); }
.teams-heading { margin-bottom: 23px; }
.teams-heading .eyebrow { display: inline-flex; align-items: center; gap: 8px; letter-spacing: .08em; color: #556c88; }
.season-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.teams-heading h1 { margin: 5px 0 0; font-size: clamp(1.65rem, 3.1vw, 2.15rem); line-height: 1.2; letter-spacing: -.025em; }
.team-events { max-width: 100%; margin-bottom: 12px; border: 1px solid var(--line); background: #fff; }
.team-event-options { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.team-events button { justify-content: center; color: var(--accent-text); }
.team-events .team-event-short, .team-events .team-event-expand { display: none; }
.team-events .team-event-options button.active {
  background: var(--theme-accent, var(--pro));
  color: var(--theme-button-text, #fff);
}
.teams-widget[aria-busy="true"] :is(.team-grid, .teams-table-panel) { visibility: hidden; }
@media (width > 680px) {
  .team-events { display: block; width: 100%; padding: 8px; border-radius: 14px; }
  .team-event-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
  }
  .team-events button[data-event] {
    min-height: 44px;
    padding: 7px 8px;
    background: #f1f4f8;
    font-weight: 700;
    text-align: center;
  }
  .team-events .team-event-order {
    display: inline-grid;
    place-items: center;
    flex: 0 0 21px;
    height: 21px;
    border-radius: 6px;
    background: #e6ecf3;
    font-variant-numeric: tabular-nums;
  }
  .team-events button.active .team-event-order { background: #60310b24; }
}
@media (680px < width <= 800px) {
  .team-event-options:has(> :nth-child(6):last-child) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .team-event-options:has(> :nth-child(6):last-child) button[data-event] {
    flex-direction: column;
    gap: 3px;
  }
}
.team-toolbar {
  position: sticky; top: var(--host-top, 0px); z-index: 4;
  display: grid; gap: 8px; padding: 12px 16px; margin-bottom: 12px; background: white;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 10px #263c5e0d;
}
.teams-widget[data-sticky-search="false"] .team-toolbar { position: static; }
.teams-widget[data-region-theme] :is(.teams-heading h1, .teams-summary p, .team-event-expand) { color: var(--accent-text); }
.teams-widget[data-region-theme] .teams-layout button.active { background: var(--tint); color: var(--accent-text); }
.team-toolbar .team-filters {
  display: grid; grid-area: auto; grid-template-columns: minmax(0, 1.7fr) minmax(205px, 1fr);
  gap: 16px; margin: 0; padding: 0; border: 0; border-radius: 0;
}
.team-filters .select-options { right: 0; left: auto; }
.teams-summary { display: flex; align-items: center; gap: 10px; }
.teams-layout { margin-left: auto; }
.teams-summary .reset-button { margin-left: 0; }
.teams-summary .reset-button svg { display: none; }
.teams-summary p { margin: 0; font-weight: 500; font-size: .875rem; color: #4d6280; }
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.team-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: white;
  transition: border-color .16s, box-shadow .16s;
}
.team-identity { display: flex; align-items: baseline; gap: 9px; }
.team-number { flex: none; white-space: nowrap; padding: 2px 7px; border-radius: 7px; color: var(--accent-text); background: var(--tint); font-variant-numeric: tabular-nums; }
.team-number, .team-name { font-size: var(--team-title-size); font-weight: 700; line-height: 1.26; letter-spacing: -.015em; }
.team-card > .team-region { align-self: flex-start; margin: 5px 0; }
.team-region { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; color: #50647d; font-size: .75rem; overflow-wrap: anywhere; }
.team-region i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--region); }
.team-region[href] {
  position: relative; z-index: 1; min-height: 24px;
  color: var(--blue); text-decoration: underline; text-decoration-color: #acbdd4; text-underline-offset: 3px;
}
.team-region[href]:hover, .team-region[href]:focus-visible { text-decoration-color: currentColor; }
.team-name { min-width: 0; margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.team-city { display: flex; align-items: baseline; gap: 5px; margin: 0; font-size: .875rem; color: #3f5877; overflow-wrap: anywhere; }
.team-city svg { align-self: flex-start; width: 15px; height: 15px; margin-top: 3px; }
.team-org { margin: 7px 0 0; font-size: .8125rem; line-height: 1.45; color: #60718a; overflow-wrap: anywhere; }
.team-card .team-action { padding-top: 16px; margin-top: auto; }
.team-card .team-action:empty { display: none; }
.team-project { display: inline-flex; align-items: center; justify-content: center; padding: 7px 12px; border-radius: 10px; background: #eaf1fb; color: var(--blue); text-decoration: none; font-weight: 600; font-size: .79rem; }
.team-project svg { width: 17px; height: 17px; }
.team-card .team-project svg { display: none; }
.team-project::after { position: absolute; inset: 0; content: ''; border-radius: var(--radius); }
.team-card:focus-within { outline: 3px solid var(--sky); outline-offset: 1px; }
@media (hover:hover) {
  .team-card:has(.team-project):hover { border-color: #b3c8e4; box-shadow: 0 4px 14px #17365d14; }
  .team-card:hover .team-project { background: #dce9fa; }
}
.team-message { text-align: center; padding: 32px 18px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.team-message h2 { font-size: 1.1rem; margin: 0 0 4px; }
.team-message p, .team-source { font-size: .8125rem; color: #60718a; }
.team-message p { margin: 0; }
.team-message button { margin-top: 12px; }
.team-source { margin: 18px 0 0; font-size: .75rem; }
.teams-table-panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
.teams-table { --team-title-size: .9375rem; border-collapse: collapse; table-layout: fixed; width: 100%; text-align: left; line-height: 1.4; }
.teams-table th, .teams-table td { padding: 12px 10px; vertical-align: middle; overflow-wrap: anywhere; }
.teams-table thead { background: #edf2f8; color: #50647d; font-size: .75rem; }
.teams-table thead th { font-weight: 600; }
.teams-table thead th:first-child { width: 100px; }
.teams-table thead th:nth-child(2) { width: 21%; }
.teams-table thead th:nth-child(3) { width: 18%; }
.teams-table thead th:nth-child(5) { width: 120px; }
.teams-table thead th:last-child { width: 64px; }
.teams-table tbody tr { position: relative; border-top: 1px solid var(--line); }
.teams-table .team-city { display: table-cell; }
.teams-table .team-number { white-space: nowrap; }
.teams-table .team-project { width: 32px; height: 32px; padding: 0; }
.teams-table .team-project::after { border-radius: 0; }
.teams-table .team-project-label { display: none; }
.teams-table .team-action, .teams-table thead th:last-child { text-align: center; }
.teams-table tr:focus-within { outline: 2px solid var(--sky); outline-offset: -2px; }
@media (hover:hover) {
  .teams-table tbody tr:has(.team-project):hover { background: #f5f8fd; }
}
@media (width < 1025px) {
  .team-toolbar { padding: 10px; margin-bottom: 10px; }
  .team-toolbar .team-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .team-toolbar .select-menu { display: none; }
  .team-filters .filter-field > label { margin: 0 0 4px; }
  .team-toolbar .search-input input, .team-toolbar .team-filters select { display: block; height: 44px; font-size: 16px; border-radius: 10px; }
  .team-toolbar .search-input svg { top: 14px; left: 10px; width: 15px; height: 15px; }
  .team-toolbar .search-input input { padding-inline: 30px 6px; }
  .team-toolbar .team-filters select { padding-inline: 7px 3px; }
  .teams-summary { gap: 8px; min-height: 0; }
  .teams-layout { margin: 0 0 0 auto; padding: 0; gap: 0; border: 1px solid #d4deea; border-radius: 10px; background: white; }
  .teams-layout button { width: 44px; height: 42px; padding: 0; justify-content: center; border-radius: 0; color: #59708c; }
  .teams-layout [data-layout="compact"] { border-radius: 9px 0 0 9px; border-right: 1px solid #d4deea; }
  .teams-layout [data-layout="cards"] { border-radius: 0 9px 9px 0; }
  .teams-layout button.active { background: #e8f1fc; color: var(--blue); box-shadow: none; }
  .teams-layout button:focus-visible { z-index: 1; }
  .teams-layout svg { display: block; width: 19px; height: 19px; }
  .teams-layout button span, .teams-summary .reset-button span { display: none; }
  .teams-summary .reset-button svg { display: block; width: 16px; height: 16px; }
  .teams-summary .reset-button { padding: 8px; }
  .team-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .team-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; }
  .team-card .team-identity { grid-column: 1; grid-row: 1; align-self: center; }
  .team-card > .team-region, .team-card .team-city, .team-card .team-org { grid-column: 1 / -1; justify-self: start; }
  .team-card .team-action { grid-column: 2; grid-row: 1; margin: 0 0 0 8px; padding: 0; }
  .team-card .team-project { width: 34px; height: 34px; padding: 0; }
  .team-card .team-project svg { display: block; }
  .team-card .team-project-label { display: none; }
  .team-grid.compact-list { gap: 8px; align-items: stretch; }
  .team-grid .team-compact { --team-title-size: 1rem; display: flex; flex-direction: column; padding: 0; border-radius: 13px; }
  .compact-head { position: relative; flex: 1 0 auto; padding: 10px 13px 6px; }
  .compact-heading { margin: 0; }
  .compact-toggle { width: 100%; display: flex; align-items: baseline; gap: 8px; padding: 0; border: 0; background: none; text-align: left; }
  .compact-toggle::after { content: ''; position: absolute; inset: 0; border-radius: 13px; }
  .compact-toggle svg { flex: none; align-self: center; width: 17px; height: 17px; margin-left: auto; color: #59708c; transition: transform .15s; }
  .compact-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .compact-head .team-region { margin-top: 2px; }
  .compact-details { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 8px; align-items: start; margin: 0 13px; padding: 9px 0 12px; border-top: 1px solid var(--line); }
  .compact-details .team-city, .compact-details .team-org { grid-column: 1; margin: 0; }
  .compact-details .team-action { grid-column: 2; grid-row: 1 / span 2; }
  .compact-details .team-project::after { content: none; }
}
@media (width < 600px) {
  .team-card { padding: 16px; }
  .teams-heading { margin-bottom: 16px; }
  .has-region-filter .compact-head:has([aria-expanded="false"]) {
    display: grid; grid-template-columns: auto minmax(0,1fr); gap: 5px; align-items: center;
    padding: 6px 13px 6px 7px; min-height: 44px;
  }
  .has-region-filter .compact-head:has([aria-expanded="false"]) .compact-heading { grid-area: 1 / 2; }
  .has-region-filter .compact-head:has([aria-expanded="false"]) .team-region {
    grid-area: 1 / 1; width: 24px; height: 28px; margin: 0; justify-content: center;
  }
  .has-region-filter .compact-head:has([aria-expanded="false"]) .team-region span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}
@media (600px <= width < 1025px) {
  .compact-head {
    display: grid; grid-template-columns: minmax(0,1fr) fit-content(35%); align-items: center;
    gap: 10px; min-height: 44px; padding: 7px 42px 7px 13px;
  }
  .compact-toggle svg { position: absolute; top: calc(50% - 8.5px); right: 13px; }
  .compact-head .team-region { justify-self: end; margin: 0; }
  .team-card:not(.team-compact) {
    grid-template-columns: minmax(0,1fr) fit-content(35%) auto; align-items: center;
    column-gap: 12px; padding: 12px 14px;
  }
  .team-card:not(.team-compact) > .team-region { grid-area: 1 / 2; justify-self: end; align-self: center; margin: 0; }
  .team-card:not(.team-compact) .team-action { grid-area: 1 / 3; margin: 0; }
}
@media (max-width: 680px) {
  .teams-widget:has(.team-events:not([hidden])) {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
  .team-events {
    position: fixed;
    z-index: 10;
    inset-inline: 0;
    bottom: var(--host-bottom, 0px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    margin: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px #17314d12;
  }
  .team-event-options {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .team-events .team-event-full { display: none; }
  .team-events .team-event-short { display: inline; }
  .team-events button {
    min-height: 44px;
    padding: 0;
    border-radius: 10px;
    background: #f1f4f8;
    font-size: .9rem;
    font-weight: 700;
  }
  .team-event-options button { flex: 1 0 36px; }
  .team-events .team-event-expand { display: inline-flex; width: 44px; height: 44px; color: var(--blue); }
  .team-event-expand svg {
    width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease;
  }
  .team-event-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
  .team-events[data-expanded="true"] .team-event-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: normal;
    max-height: min(272px, 65dvh);
    overflow: auto;
  }
  .team-events[data-expanded="true"] .team-event-options button {
    width: 100%;
    padding: 5px 7px;
    border-radius: 10px;
    font-size: .75rem;
    text-align: center;
  }
  .team-events[data-expanded="true"] .team-event-short { display: none; }
  .team-events[data-expanded="true"] .team-event-full { display: inline; }
}
@media (prefers-reduced-motion: reduce) { .team-card, .compact-toggle svg, .team-event-expand svg { transition: none; } }
