/* Shared switch: the light theme keeps the site's original palette. */
.theme-toggle, .icon-button.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #cbdce8;
  border-radius: 8px;
  background: #edf4f9;
  color: #234b65;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.theme-toggle:hover, .icon-button.theme-toggle:hover { background: #dfedf6; border-color: #91bdd4; }
.theme-toggle svg { width: 20px; height: 20px; pointer-events: none; }
.theme-toggle:focus-visible { outline: 2px solid #118ab5; outline-offset: 4px; }
.rd-readable .rd-readable-header nav:has(.theme-toggle) { align-items: center; }

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #071423;
  --ink: #edf5fc;
  --muted: #a0b6c9;
  --accent: #62cee9;
  --cyan: #62cee9;
  --blue: #126581;
  --line: #243b50;
  --theme-surface: #0b2035;
  --theme-raised: #112a41;
  --theme-soft: #152f46;
  --theme-subtle: #8fa9bd;
  --theme-success: #7cddae;
  --theme-alert: #ffa28c;
  color: var(--ink);
  background: var(--paper);
  scrollbar-color: #35566e #091827;
}
html[data-theme="dark"] body { color: var(--ink); background: var(--paper); }
html[data-theme="dark"] ::selection { background: #245671; color: #fff; }
html[data-theme="dark"] :is(button, a, input, select, textarea, canvas, summary):focus-visible {
  outline-color: #78def5;
}
html[data-theme="dark"] :is(.header, .rd-readable-header) {
  background: #091827;
  border-color: var(--line);
  box-shadow: 0 8px 26px #02091433;
}
html[data-theme="dark"] .navigation { background: #091827; border-color: var(--line); }
html[data-theme="dark"] .navigation a { color: #abc0d0; }
html[data-theme="dark"] .navigation a:is(:hover, .nav-active) { color: #f3f9ff; }
html[data-theme="dark"] .navigation a.nav-active::after { background: var(--accent); }
html[data-theme="dark"] :is(.brand img, .rd-readable-brand img, .rd-footer-wordmark img) {
  filter: grayscale(1) invert(1) brightness(1.5);
  mix-blend-mode: screen;
}
html[data-theme="dark"] :is(.icon-button, .language-picker select) { color: #d8e9f6; }
html[data-theme="dark"] :is(.icon-button:hover, .theme-toggle:hover) { background: #1a3c54; color: #a6edff; }
html[data-theme="dark"] .theme-toggle { background: #112a41; border-color: #35546b; color: #b4e8f7; }
html[data-theme="dark"] .language-picker option { background: #0b2035; color: #edf5fc; }
html[data-theme="dark"] :is(.button-dark, .rd-submit) {
  background: #69d0e9;
  border-color: #69d0e9;
  color: #071b2a;
  box-shadow: 0 4px 20px #08131f26;
}
html[data-theme="dark"] :is(.button-dark:hover, .rd-submit:hover) { background: #94e3f5; border-color: #94e3f5; color: #071b2a; }
html[data-theme="dark"] .skip-link { background: #75d9ef; color: #071b2a; }

/* Static gradients add depth without an animated layer or a canvas filter. */
html[data-theme="dark"] .experience {
  background: radial-gradient(ellipse at 74% 21%, #163f586b, transparent 61%), linear-gradient(160deg, #0b1c2e, #071423 64%);
}
html[data-theme="dark"] .canvas-holder::before { background: radial-gradient(ellipse at center, #2189ad14, transparent 70%); }
html[data-theme="dark"] :is(.scene-overview-title, .story h1, .rd-heading) { color: #f0f7fe; }
html[data-theme="dark"] .story h1 .accent-line { color: var(--accent); }
html[data-theme="dark"] :is(.scene-overview-description, .hero-description, .detail-description, .rd-lead, .rd-solution-card p) { color: #adc3d3; }
html[data-theme="dark"] :is(.story-kicker, .experience-index, .camera-label, .scene-map-label, .scene-instruction,
  .event-card-kicker, .event-card-description, .experience-foot, .event-number, .detail-note, .metric-note,
  .event-navigation-title > span:last-child, .event-timestamp div > span, .event-timeline > .eyebrow,
  .checkout-comparison div > span, .flow-metrics div > span, .scene-counter-dock div > span) { color: #a0b7ca; }
html[data-theme="dark"] :is(.story-secondary, .rd-text-link) { color: #dbeff9; border-color: #3b627b; }
html[data-theme="dark"] :is(.story-secondary:hover, .rd-text-link:hover) { color: #92e2f5; border-color: #70c5dc; }
html[data-theme="dark"] .orbit-stamp { color: #8bd8ed; border-color: #33556d; background: #0d263a; }
html[data-theme="dark"] .experience :is(.scene-controls, .scene-back, .scene-counter-dock) {
  background: #0d2238f2;
  color: #e1f0fa;
  border-color: #35566f;
  box-shadow: 0 8px 24px #010b1752;
}
html[data-theme="dark"] .controls-separator { background: #355269; }
html[data-theme="dark"] .live-label { color: #83d8ef; }
html[data-theme="dark"] .live-label i { background: #6ed8ee; box-shadow: 0 0 0 3px #62cee91c; }
html[data-theme="dark"] .live-label.is-paused i { background: #d5b47b; }
html[data-theme="dark"] .scene-marker { color: var(--theme-alert); }
html[data-theme="dark"] :is(.marker-flow, .person-marker, .product-marker) { color: #72d1ed; }
html[data-theme="dark"] :is(.marker-tag, .event-marker:hover .marker-tag) {
  background: #10293ef7;
  border-color: #7f554b;
  box-shadow: 0 4px 18px #010b1752;
}
html[data-theme="dark"] .marker-description { color: #c1d8e6; background: #0b2035f2; }
html[data-theme="dark"] .marker-flow .marker-tag { border-color: #368ca6; }
html[data-theme="dark"] .marker-normal .marker-tag { color: #91e7ba; background: #102f2bf7; border-color: #438d70; }
html[data-theme="dark"] .marker-normal .marker-description { color: #a1e6c0; }
html[data-theme="dark"] .marker-normal .tracking-outline { border-color: #75dca6; }
html[data-theme="dark"] .person-tag, html[data-theme="dark"] .product-tag { color: #e4f7ff; background: #174660; }
html[data-theme="dark"] .product-missing { color: #ffa28c; }
html[data-theme="dark"] .product-missing .product-tag { background: #763d37; color: #fff1ec; }
html[data-theme="dark"] .scene-event-box { color: #fa9983; }
html[data-theme="dark"] .event-box-normal { color: #75dca6; background: linear-gradient(0deg, #75dca60a, transparent); }
html[data-theme="dark"] .marker-connectors line { stroke: #ef9e8b; }
html[data-theme="dark"] .marker-connectors line:is([data-key="flow"], [data-key^="p"]) { stroke: #72d1ed; }
html[data-theme="dark"] .marker-connectors line[data-key="product2"] { stroke: #ffa28c; }
html[data-theme="dark"] .marker-connectors line[data-key="normal"] { stroke: #75dca6; }
html[data-theme="dark"] .attention-bubble { background: #135d7a; color: #eefaff; box-shadow: 0 6px 22px #010b1766; }
html[data-theme="dark"] .attention-bubble::after { border-top-color: #135d7a; }
html[data-theme="dark"] .marker-flow .attention-bubble { background: #176b86; }
html[data-theme="dark"] .marker-flow .attention-bubble::after { border-top-color: #176b86; }

html[data-theme="dark"] .event-card { background: var(--theme-surface); border-color: #2b465d; color: var(--ink); box-shadow: 0 4px 14px #020c181f; }
html[data-theme="dark"] .event-card:hover { background: #112b42; border-color: #43768d; box-shadow: 0 8px 20px #020c1838; }
html[data-theme="dark"] .event-card.selected { background: #14354b; border-color: #67c5df; }
html[data-theme="dark"] .event-card[data-event="normal"].selected { background: #12322f; border-color: #5baa87; }
html[data-theme="dark"] :is(.event-card-icon, .event-card-icon.icon-flow) { background: #173a51; color: #80d7ed; }
html[data-theme="dark"] .event-card-arrow { color: #85d3e8; }
html[data-theme="dark"] .event-card :is(.icon-normal, .event-card-status) { color: inherit; }
html[data-theme="dark"] .event-card .icon-normal { background: #163c35; color: #8fe1b6; }
html[data-theme="dark"] .event-card[data-event="normal"] .event-card-status { color: #8fe1b6; }
html[data-theme="dark"] .event-timestamp strong { color: #c2e1f3; }
html[data-theme="dark"] .event-timeline li { color: #b0c9da; }
html[data-theme="dark"] .event-timeline li > svg { color: #e0b189; }
html[data-theme="dark"] .step-number { color: #9eddf0; background: #173b53; }
html[data-theme="dark"] .status-red { color: #ffb09d; background: #482c2e; }
html[data-theme="dark"] .status-green { color: #8cddf1; background: #12394d; }
html[data-theme="dark"] .status-normal { color: #94e3b9; background: #173c31; }
html[data-theme="dark"] .normal-metrics strong { color: #8ae0b2; }
html[data-theme="dark"] .checkout-comparison div:last-child strong { color: #e7b38e; }
html[data-theme="dark"] .compare-line { color: #48647b; }
html[data-theme="dark"] .discrepancy { background: #392c29; color: #efbb94; border-color: #6b4e3b; }
html[data-theme="dark"] :is(.scene-loading, .scene-fallback) { background: #091a2b; }
html[data-theme="dark"] .scene-loading p { color: #b0cadd; }
html[data-theme="dark"] .loading-orbit span { border-color: #529fba; }
html[data-theme="dark"] .experience:not([data-mode="overview"]) .story { background: #091a2b; }

html[data-theme="dark"] .trust-strip { background: #091827; border-color: var(--line); }
html[data-theme="dark"] .trust-strip > span { color: #a7bece; }
html[data-theme="dark"] .trust-strip img { filter: grayscale(1) invert(1) brightness(1.5); mix-blend-mode: screen; opacity: .8; }
html[data-theme="dark"] .trust-strip a:hover img { filter: grayscale(1) invert(1) brightness(1.5); opacity: 1; }
html[data-theme="dark"] .rd-solutions { background: #091a2b; }
html[data-theme="dark"] .rd-mini-scene {
  background-color: #0f2a40;
  background-image: linear-gradient(#88cbe10a 1px, transparent 1px), linear-gradient(90deg, #88cbe10a 1px, transparent 1px);
}
html[data-theme="dark"] .rd-mini-label { color: #d5eaf7; background: #10283ef2; border-color: #35556e; }
html[data-theme="dark"] :is(.rd-mini-scene, .scene-fallback) svg :is([fill="#102332"], [fill="#0d5b86"]) { fill: #69b3ce; }
html[data-theme="dark"] :is(.rd-mini-scene, .scene-fallback) svg :is([fill="#c8e1ee"], [fill="#deeff7"], [fill="#c4deed"], [fill="#dcecf5"], [fill="#dbeef7"], [fill="#d6e8f4"], [fill="#dcecf6"]) { fill: #28506a; }
html[data-theme="dark"] .rd-mini-scene svg [stroke="#0d5b86"] { stroke: #77d1e9; }
html[data-theme="dark"] .rd-presence { background: #071423; border-color: var(--line); }
html[data-theme="dark"] :is(.rd-presence-title, .rd-presence-stores, .rd-presence-people strong) { color: var(--ink); }
html[data-theme="dark"] .rd-presence-count { color: #77d6ef; }
html[data-theme="dark"] .rd-presence-people { border-color: var(--line); }
html[data-theme="dark"] .rd-presence-people p > span { color: #abc0d0; }
html[data-theme="dark"] .rd-presence-people-icon { color: #91dbee; background: #102e43; border-color: #34576e; }
html[data-theme="dark"] .rd-presence-map-panel { background: #0b2035; border-color: #2a4860; box-shadow: 0 16px 44px #020a152e; }
html[data-theme="dark"] :is(.rd-map-topline, .rd-map-footnote, .rd-map-footnote a) { color: #b3c9d9; }
html[data-theme="dark"] :is(.rd-map-coordinate, .rd-map-compass) { color: #9cb8cb; }
html[data-theme="dark"] .rd-map-orbit { border-color: #4d77913d; }
html[data-theme="dark"] .rd-brazil-map { filter: drop-shadow(0 10px 14px #020b183d); }
html[data-theme="dark"] .rd-map-region { fill: #31607c; stroke: #0b2035; }
html[data-theme="dark"] .rd-map-region[data-region="north"] { fill: #315a75; }
html[data-theme="dark"] .rd-map-region[data-region="northeast"] { fill: #39718d; }
html[data-theme="dark"] .rd-map-region[data-region="midwest"] { fill: #3c7792; }
html[data-theme="dark"] .rd-map-region[data-region="southeast"] { fill: #4286a2; }
html[data-theme="dark"] .rd-map-region[data-region="south"] { fill: #34617b; }
html[data-theme="dark"] .rd-map-region:is(.is-active, :focus-visible) { fill: #6bcfe7; }
html[data-theme="dark"] .rd-map-region:focus-visible { stroke: #d8f6ff; }
html[data-theme="dark"] .rd-region-button { background: #112d43; color: #c1d8e7; border-color: #34566e; }
html[data-theme="dark"] .rd-region-button:hover { background: #1b3f57; border-color: #6498ae; }
html[data-theme="dark"] .rd-region-button:is(.is-active, [aria-pressed="true"]) { background: #73d4eb; color: #082033; border-color: #73d4eb; }
html[data-theme="dark"] .rd-contact { background: #0b2035; color: #edf5fc; border-top: 1px solid var(--line); }
html[data-theme="dark"] :is(.rd-field label, .rd-contact .rd-eyebrow) { color: #c4d9e6; }
html[data-theme="dark"] :is(.rd-contact .rd-lead, .rd-contact-note, .rd-form-caption, .rd-optional) { color: #a6bfce; }
html[data-theme="dark"] .rd-field :is(input, select, textarea) { background: #091a2c; color: #edf5fc; border-color: #35536b; }
html[data-theme="dark"] .rd-field :is(input, textarea)::placeholder { color: #90aabd; opacity: 1; }
html[data-theme="dark"] .rd-field :is(input, select, textarea):focus { background: #0e2940; border-color: #75d6ed; box-shadow: 0 0 0 2px #75d6ed20; }
html[data-theme="dark"] .rd-field input:autofill { box-shadow: 0 0 0 100px #102d43 inset; -webkit-text-fill-color: #edf5fc; caret-color: #edf5fc; }
html[data-theme="dark"] :is(.rd-form-caption a, .rd-form-status, .rd-form-status a) { color: #a2e3f3; }
html[data-theme="dark"] .rd-footer { background: #06111f; color: #9fb8ca; }
html[data-theme="dark"] .rd-footer-nav a { color: #b8cede; }
html[data-theme="dark"] .rd-footer-nav a:hover { color: #fff; }
html[data-theme="dark"] :is(.rd-footer-tagline, .rd-footer-bottom) { border-color: #284157; }
html[data-theme="dark"] .whatsapp-floating { background: #123951; color: #ecf8ff; border-color: #4b819b; box-shadow: 0 6px 26px #020b185e; }
html[data-theme="dark"] .whatsapp-floating:hover { background: #1a4b65; border-color: #78bbd3; box-shadow: 0 8px 30px #020b1866; }

/* The HTML fallback and /solucoes/ share the same independent palette. */
html[data-theme="dark"] .rd-readable {
  --rd-ink: #edf5fc;
  --rd-blue: #88d8ed;
  --rd-muted: #adc2d2;
  --rd-line: #284157;
  color: var(--rd-ink);
  background: #071423;
}
html[data-theme="dark"] .rd-readable .rd-readable-header { background: #091827; }
html[data-theme="dark"] .rd-readable .rd-readable-hero { background: radial-gradient(ellipse at 18% 15%, #16446033, transparent 68%); }
html[data-theme="dark"] .rd-readable .rd-readable-service { background: #0b2035; border-color: #2a4860; box-shadow: 0 8px 22px #020b1826; }
html[data-theme="dark"] .rd-readable .rd-readable-normal h4 { color: #8cddaf; }
html[data-theme="dark"] .rd-readable .rd-readable-footer { background: #06111f; }
html[data-theme="dark"] .rd-readable :is(.rd-readable-button, .rd-readable-button:hover) { background: #76d2e9; color: #082033; border-color: #76d2e9; }
html[data-theme="dark"] .rd-readable .rd-readable-button:hover { background: #a0e6f5; border-color: #a0e6f5; }
html[data-theme="dark"] .rd-readable .rd-readable-whatsapp { background: #123951; color: #ecf8ff; border-color: #4b819b; box-shadow: 0 6px 24px #020b185e; }
html[data-theme="dark"] .rd-readable .rd-readable-whatsapp:hover { background: #1a4b65; color: #fff; }
html[data-theme="dark"] .rd-readable .rd-readable-skip { color: #082033; background: #87deef; }
html[data-theme="dark"] .rd-readable a:focus-visible { outline-color: #78def5; }

/* Four controls occupy the existing first mobile header row in either theme. */
@media (max-width: 600px) {
  html .header-inner:has(.theme-toggle) { grid-template-columns: minmax(0, 1fr) 40px auto 40px; column-gap: 6px; }
  html .header-inner:has(.theme-toggle) .brand img { width: clamp(112px, 35vw, 175px); height: auto; }
  html .header .theme-toggle { grid-column: 2; grid-row: 1; width: 40px; height: 40px; }
  html .header .theme-toggle ~ .language-picker { grid-column: 3; grid-row: 1; }
  html .header .theme-toggle ~ .mobile-menu { grid-column: 4; grid-row: 1; width: 40px; height: 40px; }
  .rd-readable .theme-toggle { width: 40px; height: 40px; }
}
@media (max-width: 360px) {
  html .header-inner:has(.theme-toggle) { column-gap: 4px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  html .header-inner:has(.theme-toggle) .brand img { width: 154px; }
  html .header .theme-toggle { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .theme-toggle { transition: none; } }
@media print {
  .theme-toggle, .icon-button.theme-toggle { display: none; }
  html[data-theme="dark"] .rd-readable {
    --rd-ink: #102332;
    --rd-blue: #0d5b86;
    --rd-muted: #476172;
    --rd-line: #d5e3ed;
    background: #fff;
    color: #102332;
  }
  html[data-theme="dark"] .rd-readable :is(.rd-readable-header, .rd-readable-service, .rd-readable-hero, .rd-readable-footer) { background: #fff; box-shadow: none; }
  html[data-theme="dark"] .rd-readable .rd-readable-brand img { filter: none; mix-blend-mode: normal; }
  html[data-theme="dark"] .rd-readable .rd-readable-normal h4 { color: #176d44; }
}

.theme-toggle[hidden] { display: none !important; }
