/* Important declarations in this layer take precedence over the existing palette. */
@layer fastwebRefresh, fastwebActive, fastwebContrast, fastwebLight;
.fw-theme-toggle:not([hidden]) {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-height: 38px;
  padding-inline: .65rem;
  border: 1px solid #6682a4;
  border-radius: 10px;
  background: #152a46;
  color: #fff;
  cursor: pointer;
  font-family: inherit; font-size: .78rem; font-weight: 600; line-height: 1;
}
.fw-theme-toggle:focus-visible { outline: 2px solid #438de6; outline-offset: 3px; }
@media (max-width: 420px) {
  #navbar .fw-theme-toggle:not([hidden]) { padding-inline: .4rem; min-height: 34px; }
  html body #navbar .nav-container { width: calc(100% - 16px); gap: 6px; }
  html body #navbar .nav-actions { gap: 5px; }
  html body #navbar .logo img { width: 72px; }
}
@layer fastwebLight {
  html[data-fw-mode="light"] {
    color-scheme: light !important;
    --fw-bg: #f4f7fc !important;
    --fw-panel: #fff !important;
    --fw-text: #142742 !important;
    --fw-muted: #425771 !important;
    --fw-blue: #1258a8 !important;
    --fw-line: #c5d4e6 !important;
    --bg-subtle: #eaf1fa !important;
    --bg-hover: #e1edfb !important;
    --glass-bg-2: #eaf1fa !important;
    --text-muted: #425771 !important;
    --text-dim: #425771 !important;
    --border-medium: #9fb5ce !important;
  }
  [data-fw-mode="light"] :is(#navbar, #navbar .nav-links, #navbar .nav-container, #navbar .nav-actions, footer, .fw-footer) {
    background: #fff !important;
    border-color: var(--fw-line) !important;
    color: var(--fw-text) !important;
  }
  [data-fw-mode="light"] :is(#navbar .logo, footer a:has(> img[src*="fastweb-wordmark"])) {
    background: transparent !important;
  }
  [data-fw-mode="light"] :is(#navbar .nav-link:hover, #navbar .nav-link[aria-current="page"], #navbar .nav-btn-login, .fw-theme-toggle) {
    background: #e2eefc !important;
    color: #164777 !important;
    border-color: #9ebadc !important;
  }
  [data-fw-mode="light"] :is(#top,.page-hero,#plansPageBanner,#tv-compare,.coverage-editorial,.coverage-contact-cta,.fw-service-hero,.fw-service-more,#mobile-app .fw-download-layout,#refer .wrap,#ott .play-art,#contact .contact-intro) {
    background: linear-gradient(135deg,#ffffff,#e1edfc) !important;
    color: var(--fw-text) !important;
    border-color: var(--fw-line) !important;
  }
  [data-fw-mode="light"] :is(#top,.page-hero,#plansPageBanner,#tv-compare,.coverage-editorial,.coverage-contact-cta,.fw-service,#mobile-app,.fw-footer) :is(h1,h2,h3,h4,p,label,small,figcaption,summary) {
    color: var(--fw-text) !important;
    -webkit-text-fill-color: currentColor !important;
  }
  [data-fw-mode="light"] :is(.hero-accent,.text-gradient,.kicker,.price,.ott-price-value,.coverage-editorial h1 em,.fw-service h1 span,#iptvPage .page-hero h1 span) {
    color: #1258a8 !important;
    -webkit-text-fill-color: #1258a8 !important;
  }
  [data-fw-mode="light"] :is(.catalog-content,.channel-catalog-grid,.catalog-filters,.iptv-language-tabs,#plans>.wrap,#plans .pricing-heading,:is(#pricingCards,#comboPricingCards,#businessPricingCards)) {
    background: var(--fw-bg) !important;
    color: var(--fw-text) !important;
  }
  [data-fw-mode="light"] :is(.catalog-channel,.catalog-offer,.catalog-tools,.catalog-footnote,.iptv-formats,.iptv-formats dl>div,.iptv-guide-stats>div,.fw-service-panel,.fw-service-links a,.about-story,.about-company-facts,.contact-sidebar,.pricing-card,.pricing-card-inner,.pricing-card-top,.price-block,.ott-price-block,.ott-package,.quick-item,details,form,table,thead,tbody,tr,th,td,.channel-group,.channel,.ott-app-logo,.hero-tag,.hero-lead-fact,.hero-trust-item,.hero-status,.contact-note,.legal-copy,.legal-callout,.app-appstore-bar,.app-download-panel,.refer-box,.combo-card-chip,.coverage-contact-details a) {
    background: var(--fw-panel) !important;
    border-color: var(--fw-line) !important;
    color: var(--fw-text) !important;
  }
  [data-fw-mode="light"] :is(.catalog-channel,.catalog-offer,.catalog-tools,.catalog-footnote,.iptv-guide-stats,.iptv-formats,.about-company-facts,.pricing-card,.ott-package,.coverage-contact-details,.legal-copy) :is(h2,h3,h4,p,dt,dd,small,strong,label) {
    color: var(--fw-text) !important;
  }
  [data-fw-mode="light"] :is(input:not([type=checkbox],[type=radio]),textarea,select,option,.btn-outline,.term-tab,.product-btn,.mode-btn,.view-btn,.iptv-language-tab,.iptv-feed-filters button,.catalog-filter,.ott-validity button,.fw-service-button,.coverage-secondary-action,.coverage-cta-outline,.ott-includes-toggle) {
    background: #edf4ff !important;
    border-color: #adc2dc !important;
    color: #143e70 !important;
  }
  [data-fw-mode="light"] :is(input,textarea)::placeholder { color: #506782 !important; }
  [data-fw-mode="light"] :is(.fw-service-primary,.btn-primary,.coverage-primary-action,.coverage-cta-light,.term-tab.active,.product-btn.active,.mode-btn.active,.view-btn.active,.iptv-language-tab.active,.iptv-feed-filters button[aria-pressed=true],.catalog-filter.active,.ott-validity button.active,button[type=submit],.nav-btn-cta) {
    background: #155db8 !important;
    border-color: #155db8 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }
  [data-fw-mode="light"] .fw-app .fw-app-stores .fw-service-button small { color: #fff !important; }
  [data-fw-mode="light"] #tv-compare :is(.tv-broadcast strong,.tv-broadcast small,.tv-flash strong) { color: #fff !important; }
  [data-fw-mode="light"] #tv-compare .tv-keys button { color: #eff6ff !important; }
}

@layer fastwebContrast {
  :where([data-fw-mode="light"]) {
    & :is(#navbar .nav-link,.fw-crumb,.tiny-note,.catalog-count,.iptv-guide-heading p,
      .iptv-reference-price span,.ott-term-label,.ott-ref-foot,.coverage-action-kicker) {
      color: var(--fw-muted) !important;
      -webkit-text-fill-color: currentColor !important;
    }
    & :is(.page-hero .kicker,.home-hero-badges li,.home-service-icon,.audience-icon,
      .quick-bottom .ico,.franchise-process > div,.legal-copy address,
      #plans .plan-validity,#plans .validity-line,#plans .business-annual-note,
      #plans .combo-card-chip,#plans .combo-bundle-chip,.iptv-formats dt b) {
      background: #e8f1fd !important;
      color: #164777 !important;
      border-color: var(--fw-line) !important;
    }
    & :is(.home-service,#about #ott,.iptv-guide-contact,
      #ottPage .ott-package-body,#ottPage .ott-validity,
      #plans #businessPricing,#plans #leasedPricing,#plans #businessPricingControls,
      #plans .business-page-intro,#plans .leased-intro,#plans .leased-benefit-grid,
      #plans #leasedPricing article,
      #plans .pricing-mode,#plans .product-mode,#plans .term-tabs,
      #residentialProducts,.pricing-table-wrap,.responsive-table,.table-intro,
      #contactPage .business-lead-form,.legal-contents,.legal-callout) {
      background: var(--fw-panel) !important;
      color: var(--fw-text) !important;
      border-color: var(--fw-line) !important;
      box-shadow: none !important;
    }
    & :is(#iptvPage,#ottPage,#ottPage .catalog-content,#ottPage .ott-package-grid,
      #ottPage .section-top,#ottPage .wrap:not(.page-hero .wrap),#channelCatalogGrid) {
      background: var(--fw-bg) !important;
      color: var(--fw-text) !important;
    }
    & :is(#plans .pricing-card,#plans table,#plans #leasedPricing,#plans #businessPricing,
      #plans .validity-line,#plans .term-tabs,.franchise-panel,.legal-callout,
      .ott-package,#refer .refer-box,.quick-item,.iptv-guide-contact)
      :is(span,small,strong,b,td,th,p,h2,h3,h4,li,div,label,summary) {
      color: var(--fw-text) !important;
      -webkit-text-fill-color: currentColor !important;
    }
    & :is(.home-services-title span,.home-service svg,#tv-compare .tv-intro em,
      .home-ott-logo span,.ott-showcase-logo span,.logo-fallback,.legal-num,
      #plans .pricing-card .amount,#plans .pricing-card .wifi-icon,.iptv-guide-heading h2) {
      color: var(--fw-blue) !important;
      -webkit-text-fill-color: currentColor !important;
    }
    & :is(#plans button.term-tab,#plans button.mode-btn,#plans button.product-btn,
      #plans button.view-btn,#contactPage .business-lead-form :is(input,select,textarea)) {
      background: #edf4ff !important;
      color: #143e70 !important;
      border-color: #adc2dc !important;
      color-scheme: light !important;
    }
    & #plans table :is(thead th,tbody tr:hover :is(td,th)) { background: #e1edfb !important; }
    & #plans table tbody tr:nth-child(even) :is(td,th) { background: #f3f7fd !important; }
    & :is(.guide-jump,.btn:not(.btn-outline),.choose-plan,.ott-ref-cta,
      .coverage-action-icon,#plans button.active,#ottPage .ott-validity button.active) {
      background: #155db8 !important;
      border-color: #155db8 !important;
      color: #fff !important;
      -webkit-text-fill-color: #fff !important;
    }
    & :is(.btn:not(.btn-outline),.choose-plan,.ott-ref-cta,#plans button.active,
      #mobile-app .app-store-badge,.fw-app .fw-app-stores .fw-service-primary)
      :is(span,strong,b,small) {
      color: #fff !important;
      -webkit-text-fill-color: #fff !important;
    }
    & #iptvPage .page-hero h1 span { background: none !important; }
  }
}

@layer fastwebContrast {
  :where([data-fw-mode="light"]) {
    & :is(#top .home-highlight,#refer .refer-steps li,#ottPage .ott-validity > small) {
      background: #e8f1fd !important;
      border-color: var(--fw-line) !important;
      color: var(--fw-text) !important;
    }
    & :is(#plans .recommended-bar,#plans .choose-plan span,#plans button.active :is(strong,span,small)) {
      color: #fff !important;
      -webkit-text-fill-color: #fff !important;
    }
    & :is(.collection-number,.legal-copy address b) { color: var(--fw-muted) !important; }
  }
}

@layer fastwebActive {
  :where([data-fw-mode="light"]) #plans
    :is(.recommended-bar,.choose-plan span,button.active :is(b,strong,span,small)) {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }
}

/* Keep each pack's artwork distinct and leave the validity row behind the controls clear. */
@layer fastwebActive {
  #ottPage .ott-ref-card { --ott-art: linear-gradient(120deg,#25272a,#255199); }
  #ottPage .ott-ref-max { --ott-art: linear-gradient(120deg,#262c36,#2b5fb4); }
  #ottPage .ott-ref-pro { --ott-art: linear-gradient(120deg,#212428,#2a4776); }
  #ottPage .ott-ref-infinity { --ott-art: linear-gradient(120deg,#171917,#38404e); }
  #ottPage .ott-ref-card .ott-package-art {
    background: var(--ott-art) !important;
    color: #fff !important;
  }
  #ottPage .ott-ref-card .ott-package-art :is(span,small) {
    color: #f1f7ff !important;
    -webkit-text-fill-color: currentColor !important;
  }
  #ottPage .ott-validity > div {
    background: transparent !important;
    box-shadow: none !important;
  }
}

@layer fastwebActive {
  .fw-footer::before { opacity: .5; }
  [data-fw-mode="light"] .fw-footer::before { opacity: .35; }
  .fw-footer .fw-foot-contact address { color: var(--fw-blue) !important; }
  .fw-footer .fw-foot-contact {
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content) !important;
    column-gap: clamp(20px, 6vw, 80px);
    row-gap: 12px;
    align-items: start;
  }
  .fw-foot-contact > :first-child { grid-row: span 2; }
  .fw-foot-contact > :not(:first-child) { grid-column: 2; overflow-wrap: anywhere; }
  @media (max-width: 520px) {
    .fw-footer .fw-foot-contact { grid-template-columns: minmax(0, 1fr) !important; }
    .fw-foot-contact > :first-child { grid-row: auto; }
    .fw-foot-contact > :not(:first-child) { grid-column: auto; }
  }

  #business .ott-showcase-logo img {
    background: #122a46 !important;
    object-fit: contain !important;
    clip-path: none !important;
    mix-blend-mode: normal;
    padding: 4px !important;
    border-radius: 7px !important;
  }
  #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) {
    margin-inline: 0 !important;
    padding-inline: clamp(10px, 1.5vw, 18px);
    scroll-padding-inline: clamp(10px, 1.5vw, 18px);
  }
  #plans .mode-btn:is(.active,[aria-pressed="true"]) .audience-icon {
    background: #d7eaff !important;
    color: #123b6a !important;
  }
  #plans .mode-btn:is(.active,[aria-pressed="true"]) .audience-icon svg {
    color: #123b6a !important;
    opacity: 1 !important;
  }
  #plans .term-tabs {
    gap: 6px;
    padding: 6px !important;
    border: 1px solid #5c83af66 !important;
    border-radius: 18px !important;
  }
  #plans .term-tab {
    border-radius: 12px !important;
    min-width: 0;
  }

  #tv-compare .tv-keys button[aria-pressed="true"] {
    background: #164f98 !important;
    box-shadow: inset 0 0 0 1px #7eb7fb, 0 3px 0 #091729;
    color: #fff !important;
  }
  #tv-compare .tv-keys button[aria-pressed="true"] small {
    color: #e0efff !important;
  }
  #top .home-highlights .home-highlight,
  #aboutPage .about-highlights span {
    background: #155db8 !important;
    border-color: #659de0 !important;
  }
  #top .home-highlights .home-highlight :is(svg,strong,small),
  #aboutPage .about-highlights :is(span,b) {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }
}

@layer fastwebActive {
  :where([data-fw-mode="light"]) #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards),
  :where([data-fw-mode="light"]) #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) .pricing-card {
    box-shadow: none !important;
  }
}

@layer fastwebRefresh {
  html {
    --refresh-surface: #111e30;
    --refresh-panel: #0c1625;
    --refresh-line: #354e6e;
    --refresh-text: #eff6ff;
    --refresh-muted: #b9cce3;
    --refresh-accent: #a2ceff;
    --refresh-selected: #163f72;
    --refresh-hero: linear-gradient(118deg, #101a2a, #132b4e);
  }
  html[data-fw-mode="light"] {
    --refresh-surface: #fff;
    --refresh-panel: #edf4fc;
    --refresh-line: #bccfe6;
    --refresh-text: #122944;
    --refresh-muted: #425d7b;
    --refresh-accent: #174e8d;
    --refresh-selected: #d8eaff;
    --refresh-hero: linear-gradient(118deg, #f8fbff, #e0edff);
  }

  #mobile-app .fw-home-app-rail { align-items: flex-start; gap: 16px; padding: 6px 3px 14px; }
  #mobile-app .fw-android-mockup {
    position: relative;
    display: block;
    flex: 0 0 136px;
    padding: 14px 5px 8px;
    border: 1px solid #70839b;
    border-radius: 21px;
    background: #101722;
    box-shadow: inset 0 0 0 1px #1c293c;
    scroll-snap-align: start;
  }
  #mobile-app .fw-android-mockup::before {
    content: "";
    position: absolute;
    top: 4px;
    left: calc(50% - 3px);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #03070c;
    box-shadow: 0 0 0 1px #495c74;
  }
  #mobile-app .fw-home-app-rail .fw-android-mockup img {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    border-radius: 13px;
  }

  #about .fw-ott-collection {
    grid-template-columns: minmax(230px, .68fr) minmax(0, 1.32fr) !important;
    align-items: stretch;
    gap: 18px;
  }
  #about .fw-ott-collection > :is(#ott,#business) {
    min-width: 0;
    padding: clamp(18px, 3vw, 30px);
    border: 1px solid var(--refresh-line) !important;
    border-radius: 22px;
    background: var(--refresh-surface) !important;
    color: var(--refresh-text) !important;
  }
  #about .fw-ott-collection > #ott {
    order: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    background: var(--refresh-hero) !important;
  }
  #about .fw-ott-collection > #business { order: 1; }
  #about .fw-ott-collection h3 {
    margin: 0 0 10px;
    font-size: clamp(1.2rem, 2.4vw, 2rem);
    color: var(--refresh-text) !important;
  }
  #about .fw-ott-collection :is(p,.mini-label) {
    margin: 0;
    color: var(--refresh-muted) !important;
  }
  #about .fw-ott-collection .ott-showcase-grid {
    grid-template-columns: repeat(auto-fit, minmax(67px, 1fr)) !important;
    gap: 8px !important;
  }
  #about .fw-ott-collection .ott-showcase-logo {
    padding: 8px 3px;
    border-radius: 10px;
    background: var(--refresh-panel);
  }
  #about .fw-ott-collection .ott-showcase-logo span {
    color: var(--refresh-text) !important;
    -webkit-text-fill-color: currentColor !important;
    font-size: .68rem;
  }

  #plans :is(.pricing-mode,#residentialProducts,.term-tabs):not([hidden]) {
    display: grid !important;
    gap: 8px;
    padding: 6px !important;
    border-radius: 18px !important;
  }
  #plans .pricing-mode { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #plans #residentialProducts {
    width: min(100%, 600px);
    grid-template-columns: repeat(2,minmax(0,1fr));
    margin-inline: auto;
  }
  #plans .term-tabs { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #plans :is(.mode-btn,.product-btn,.term-tab) {
    min-width: 0;
    min-height: 53px;
    padding: 9px 10px !important;
    border-radius: 12px !important;
    white-space: normal;
  }
  #plans .term-tab { display: grid; align-content: center; justify-items: center; text-align: center; }
  #plans .term-tab small {
    border-radius: 99px;
    padding: 2px 6px;
    font-size: .68rem;
  }

  :is(#termsPage,#privacyPage,#refundPage) > .legal-hero {
    background: var(--refresh-hero) !important;
    border-bottom: 1px solid var(--refresh-line) !important;
    color: var(--refresh-text) !important;
  }
  :is(#termsPage,#privacyPage,#refundPage) > .legal-hero :is(h1,p,.kicker,.legal-updated) {
    color: var(--refresh-text) !important;
    -webkit-text-fill-color: currentColor !important;
  }
  :is(#termsPage,#privacyPage,#refundPage) > .legal-hero :is(.kicker,.legal-updated) {
    background: var(--refresh-panel) !important;
    border: 1px solid var(--refresh-line) !important;
  }

  @media (max-width: 740px) {
    #about .fw-ott-collection { grid-template-columns: minmax(0, 1fr) !important; }
    #plans .pricing-mode { grid-template-columns: 1fr; }
  }
  @media (max-width: 540px) {
    #plans .term-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  }
}

/* Every plan uses the Broadband card palette and the same rail dimensions. */
@layer fastwebRefresh {
  #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) > .pricing-card {
    flex: 0 0 clamp(240px, calc((100% - 42px) / 4), 280px);
    width: clamp(240px, calc((100% - 42px) / 4), 280px);
    min-height: 410px;
  }
  #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) .amount {
    font-size: inherit !important;
  }
  #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) .pricing-card .choose-plan {
    background: #164987 !important;
    border-color: #568bd0 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }
  #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) .pricing-card .choose-plan:hover {
    background: #205fa8 !important;
  }
  [data-fw-mode="light"] #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) .pricing-card .choose-plan {
    background: #155db8 !important;
    border-color: #155db8 !important;
  }
  @media (max-width: 760px) {
    #plans :is(#pricingCards,#comboPricingCards,#businessPricingCards) > .pricing-card {
      flex-basis: min(84vw, 340px);
      width: min(84vw, 340px);
      max-width: calc(100vw - 38px);
      min-height: 0;
    }
  }
}
