:root {
  --mib-customer-bg: #101416;
  --mib-customer-surface: #171d20;
  --mib-customer-surface-raised: #1d2529;
  --mib-customer-line: #344249;
  --mib-customer-text: #edf2f3;
  --mib-customer-muted: #a6b2b7;
  --mib-customer-gold: #d8ad55;
  --mib-customer-cyan: #42b9cf;
}

html,
body.mibBrandTheme,
body.mibBrandTheme > main {
  background: var(--mib-customer-bg) !important;
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
  max-width: 100%;
  overflow-x: clip !important;
}

body.mibBrandTheme :is(h1, h2, h3, h4) {
  color: var(--mib-customer-text) !important;
  letter-spacing: 0 !important;
}

body.mibBrandTheme :is(p, .muted, .small, small) {
  color: var(--mib-customer-muted) !important;
}

body.mibBrandTheme > main > header {
  background: #12181b !important;
  border-bottom: 1px solid var(--mib-customer-line) !important;
}

body.mibBrandTheme .portalHeaderKicker,
body.mibBrandTheme .portalEyebrow,
body.mibBrandTheme .expressBadge {
  color: var(--mib-customer-gold) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell {
  width: min(1240px, calc(100% - 40px)) !important;
  margin-inline: auto !important;
  padding: 24px 0 64px !important;
}

body.mibBrandTheme.portalLocked .portalHeroGrid,
body.mibBrandTheme.portalLocked .portalMainGrid {
  gap: 14px !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .card,
body.mibBrandTheme.portalLocked #portalStartGuide,
body.mibBrandTheme.portalLocked #manualLookupCard,
body.mibBrandTheme.portalLocked #portalRegistrationCard {
  min-width: 0 !important;
  border: 1px solid var(--mib-customer-line) !important;
  border-top: 2px solid var(--mib-customer-gold) !important;
  border-radius: 7px !important;
  background: var(--mib-customer-surface) !important;
  color: var(--mib-customer-text) !important;
  box-shadow: none !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .damageCheckCard {
  border-top-color: var(--mib-customer-cyan) !important;
  border-left: 1px solid var(--mib-customer-line) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .damageCheckCard :is(.expressBadge, h3, p) {
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .damageCheckCard .expressBadge {
  color: var(--mib-customer-cyan) !important;
  background: #14262b !important;
  border-color: #2b6875 !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .expressCheckCard :is(h2, p) {
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .expressCheckCard p {
  color: var(--mib-customer-muted) !important;
}

body.mibBrandTheme .damageCheckCard a[href^="tel:"],
body.mibBrandTheme .portalWhatsappEntry,
body.mibBrandTheme .mibMessengerChannels,
body.mibBrandTheme .mibWhatsappApiPanel {
  border-color: var(--mib-customer-line) !important;
  background: var(--mib-customer-surface-raised) !important;
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme .mibMessengerChannels :is(h3, p, span, a, b),
body.mibBrandTheme .portalWhatsappEntry :is(strong, span) {
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme .mibWhatsappApiPanel textarea {
  border-color: var(--mib-customer-line) !important;
  background: #0d1315 !important;
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme :is(.portalWhatsappEntry, .mibMessengerChannels, .mibWhatsappApiPanel) :is(button, a[role="button"]) {
  border-radius: 5px !important;
  box-shadow: none !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell :is(input, textarea, select) {
  border: 1px solid var(--mib-customer-line) !important;
  border-radius: 5px !important;
  background: #0d1315 !important;
  color: var(--mib-customer-text) !important;
  box-shadow: none !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell :is(input, textarea, select)::placeholder {
  color: #78868c !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell #manualLookupBtn,
body.mibBrandTheme.portalLocked #portalEntryShell #expressOrderBtn,
body.mibBrandTheme.portalLocked #portalEntryShell #portalRegistrationSubmit {
  min-height: 44px !important;
  border: 1px solid #b68c3e !important;
  border-radius: 5px !important;
  background: var(--mib-customer-gold) !important;
  color: #141719 !important;
  box-shadow: none !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .portalAccessNotice {
  display: grid !important;
  gap: 3px !important;
  position: static !important;
  margin: 12px 0 8px !important;
  padding: 11px 12px !important;
  border: 1px solid var(--mib-customer-line) !important;
  border-left: 3px solid var(--mib-customer-cyan) !important;
  border-radius: 5px !important;
  background: #131b1e !important;
  color: var(--mib-customer-muted) !important;
  line-height: 1.45 !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .portalAccessNotice strong {
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .portalPasswordRecoveryButton,
body.mibBrandTheme.portalLocked #portalEntryShell .portalTextAction {
  margin-top: 6px !important;
  color: var(--mib-customer-cyan) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell :is(.portalIntentGrid, .portalCommerceLinks) button {
  min-height: 68px !important;
  border: 1px solid var(--mib-customer-line) !important;
  border-radius: 6px !important;
  background: #12191c !important;
  color: var(--mib-customer-text) !important;
  box-shadow: none !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell :is(.portalIntentGrid, .portalCommerceLinks) button:is(:hover, :focus-visible, .active, [aria-pressed="true"]) {
  border-color: var(--mib-customer-gold) !important;
  background: #252116 !important;
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme.portalLocked #portalEntryShell .portalCommerceLinks span,
body.mibBrandTheme.portalLocked #portalEntryShell .portalRegistrationBenefits li span {
  color: var(--mib-customer-muted) !important;
}

body.mibBrandTheme.portalPageMode:not(.portalLocked) {
  background: var(--mib-customer-bg) !important;
  color: var(--mib-customer-text) !important;
}

body.mibBrandTheme.portalPageMode > aside#sideMenu {
  background: #141a1d !important;
  border-right: 1px solid var(--mib-customer-line) !important;
  box-shadow: none !important;
}

body.mibBrandTheme.portalPageMode > aside#sideMenu .portalNavBrand {
  border-bottom-color: var(--mib-customer-line) !important;
}

body.mibBrandTheme.portalPageMode > aside#sideMenu .navScroll details {
  border-top-color: #293439 !important;
}

body.mibBrandTheme.portalPageMode > aside#sideMenu .navScroll summary {
  color: var(--mib-customer-muted) !important;
}

body.mibBrandTheme.portalPageMode > aside#sideMenu .navScroll summary[aria-current="page"],
body.mibBrandTheme.portalPageMode > aside#sideMenu .navScroll details[data-current="true"] > summary {
  color: var(--mib-customer-gold) !important;
}

body.mibBrandTheme.portalPageMode > main > header {
  background: #12181b !important;
  border-bottom-color: var(--mib-customer-line) !important;
}

#customerQuickNav { display: none; }

@media (min-width: 761px) {
  body.mibBrandTheme.portalLocked #manualLookupCard .portalLoginFields,
  body.mibBrandTheme.portalLocked #manualLookupCard #portalPasswordResetRequest,
  body.mibBrandTheme.portalLocked #manualLookupCard #portalPasswordResetConfirm {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  body.mibBrandTheme.portalLocked #manualLookupCard .portalLoginFields > label,
  body.mibBrandTheme.portalLocked #manualLookupCard #portalPasswordResetRequest > label,
  body.mibBrandTheme.portalLocked #manualLookupCard #portalPasswordResetConfirm > label {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 6px !important;
    min-width: 0 !important;
  }

  body.mibBrandTheme.portalLocked #manualLookupCard .portalLoginFields > label > :is(input, .portalSecretControl),
  body.mibBrandTheme.portalLocked #manualLookupCard #portalPasswordResetRequest > label > input,
  body.mibBrandTheme.portalLocked #manualLookupCard #portalPasswordResetConfirm > label > input {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 760px) {
  body.mibBrandTheme.portalLocked > main > header {
    min-height: 68px !important;
    padding: 8px 14px !important;
  }

  body.mibBrandTheme.portalLocked .portalHeaderInner {
    min-height: 50px !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  body.mibBrandTheme.portalLocked .portalHeaderTitle {
    justify-self: start !important;
    text-align: left !important;
  }

  body.mibBrandTheme.portalLocked .portalHeaderTitle .portalHeaderKicker,
  body.mibBrandTheme.portalLocked .portalHeaderTitle #pageSub,
  body.mibBrandTheme.portalLocked .portalBrandMark {
    display: none !important;
  }

  body.mibBrandTheme.portalLocked .portalHeaderTitle h2 {
    margin: 0 !important;
    font-size: 18px !important;
  }

  body.mibBrandTheme.portalLocked .portalHeaderActions { gap: 6px !important; }
  body.mibBrandTheme.portalLocked .portalHeaderActions .densityToggle,
  body.mibBrandTheme.portalLocked #portalDesktopMenuToggle { display: none !important; }

  body.mibBrandTheme.portalLocked #portalEntryShell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    width: min(calc(100% - 24px), 560px) !important;
    padding: 12px 0 28px !important;
  }

  body.mibBrandTheme.portalLocked #portalEntryShell .portalHeroGrid,
  body.mibBrandTheme.portalLocked #portalEntryShell .portalMainGrid {
    display: contents !important;
  }

  body.mibBrandTheme.portalLocked #portalEntryShell #manualLookupCard { order: 1; }
  body.mibBrandTheme.portalLocked #portalEntryShell #portalStartGuide { order: 2; }
  body.mibBrandTheme.portalLocked #portalEntryShell .expressCheckCard { order: 3; }
  body.mibBrandTheme.portalLocked #portalEntryShell .damageCheckCard { order: 4; }

  body.mibBrandTheme.portalLocked #portalEntryShell .card,
  body.mibBrandTheme.portalLocked #portalEntryShell #portalStartGuide { padding: 16px !important; }

  body.mibBrandTheme.portalLocked #portalEntryShell .expressCheckCard h2 { font-size: 19px !important; }
  body.mibBrandTheme.portalLocked #portalEntryShell .expressCheckCard input { min-width: 0 !important; }

  body.mibBrandTheme.portalPageMode:not(.portalLocked) {
    padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
  }

  #customerQuickNav {
    align-items: stretch;
    background: #0d1316;
    border-top: 1px solid var(--mib-customer-line);
    bottom: 0;
    display: flex;
    gap: 4px;
    left: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    z-index: 1100;
  }

  #customerQuickNav::-webkit-scrollbar { display: none; }
  body.portalLocked #customerQuickNav,
  body:not(.portalPageMode) #customerQuickNav { display: none !important; }

  #customerQuickNav button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #aab6bb;
    display: flex;
    flex: 0 0 68px;
    flex-direction: column;
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    gap: 3px;
    justify-content: center;
    min-height: 58px;
    min-width: 68px;
    padding: 4px 3px;
    white-space: nowrap;
  }

  #customerQuickNav .customerNavIcon {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    display: grid;
    font-size: 17px;
    height: 30px;
    justify-items: center;
    line-height: 1;
    width: 34px;
  }

  #customerQuickNav button:nth-child(1) .customerNavIcon { background: #173b45; border-color: #286a79; color: #5dd9ed; }
  #customerQuickNav button:nth-child(2) .customerNavIcon { background: #3e301b; border-color: #80602b; color: #f0bf59; }
  #customerQuickNav button:nth-child(3) .customerNavIcon { background: #202e48; border-color: #385f93; color: #7db5ff; }
  #customerQuickNav button:nth-child(4) .customerNavIcon { background: #263a2e; border-color: #3d7951; color: #7ed69b; }
  #customerQuickNav button:nth-child(5) .customerNavIcon { background: #302544; border-color: #654d8c; color: #c0a4ff; }
  #customerQuickNav button:nth-child(6) .customerNavIcon { background: #2b3337; border-color: #53636a; color: #d2dde1; }

  #customerQuickNav button[aria-current="page"] { background: #20292e; color: #fff; }
  #customerQuickNav button[aria-current="page"] .customerNavIcon { box-shadow: 0 0 0 2px currentColor; }
  #customerQuickNav button:focus-visible { outline: 2px solid var(--mib-customer-cyan); outline-offset: -2px; }
}

@media (min-width: 761px) {
  #customerQuickNav { display: none !important; }
}

/* Customer portal uses the same MIB dark surface on every entry point. */
html:has(body.theme-dark), body.theme-dark, body.theme-dark > main,
body.theme-dark #portalEntryShell, body.theme-dark #portalApp,
body.theme-dark #portalApp main { background: #090d10 !important; color: #f2f5f6 !important; }
body.theme-dark :is(header, #portalHeader, .portalHeader, .portalHeaderInner, #sideMenu, .portalContent, .portalShell) {
  background: #10161a !important;
  color: #f2f5f6 !important;
  border-color: #303d44 !important;
}
body.theme-dark :is(.card, .panel, .portalCard, .portalEntryShell > *, .portalMainGrid > *, .portalHeroGrid > *, #manualLookupCard, #portalStartGuide, #portalRegistrationCard, .expressCheckCard, .damageCheckCard, .statusCard, .accountCard, .orderCard) {
  background: #151c20 !important;
  color: #f2f5f6 !important;
  border-color: #35444b !important;
  box-shadow: none !important;
}
body.theme-dark :is(h1,h2,h3,h4,strong,b,label) { color: #f2f5f6 !important; }
body.theme-dark :is(p,small,.small,.muted,.portalHeaderSub,.portalHeaderKicker) { color: #aeb9be !important; }
body.theme-dark :is(input,select,textarea) { background: #0b1114 !important; color: #f2f5f6 !important; border-color: #405058 !important; }
body.theme-dark :is(button,.button,.buttonLink) { color: #f2f5f6 !important; border-color: #6b5525 !important; background: #1c252a !important; }
body.theme-dark :is(button.primary,.button.primary,.buttonLink.primary,[data-primary]) { color: #121417 !important; background: #e6b43f !important; border-color: #e6b43f !important; }
body.theme-dark :is(.portalHeaderActions, .portalHeaderTools, #customerQuickNav) { background: #0c1215 !important; border-color: #303d44 !important; }
body.theme-dark #customerQuickNav button { background: transparent !important; color: #aeb9be !important; border-color: transparent !important; }
body.theme-dark #customerQuickNav button[aria-current="page"] { background: #202d33 !important; color: #fff !important; }
body.theme-dark .portalBrandMark { background: #090d10 !important; }
@media (max-width: 760px) {
  body.theme-dark.portalLocked #portalEntryShell { width: min(calc(100% - 20px), 560px) !important; padding: 12px 0 28px !important; }
  body.theme-dark.portalLocked #portalEntryShell :is(.card, #portalStartGuide, #manualLookupCard, #portalRegistrationCard, .expressCheckCard, .damageCheckCard) { border-radius: 6px !important; }
  body.theme-dark.portalPageMode:not(.portalLocked) { padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  body.theme-dark #customerQuickNav { min-height: 66px !important; }
}
