/* The icon follows the existing language controls on desktop and the AI icon on mobile. */
:root {
  --dst-page-backdrop-color: #eaf5fd;
  --dst-ai-panel-bg: #cbd8e3;
  --dst-ai-panel-border: rgba(28, 45, 73, .28);
  --dst-ai-header-start: #cbd8e3;
  --dst-ai-header-end: #cbd8e3;
  --dst-ai-header-text: #173650;
  --dst-ai-header-muted: #536b7d;
  --dst-ai-muted-text: #607189;
  --dst-ai-placeholder: #64788b;
  --dst-ai-close-bg: #dce9f3;
  --dst-ai-close-text: #173f65;
  --dst-ai-disclaimer-bg: linear-gradient(180deg, #fff4d6, #fff9e9);
  --dst-ai-disclaimer-text: #614711;
  --dst-ai-system-bg: #fff7df;
  --dst-ai-system-text: #68490e;
  --dst-ai-action-bg: #e5eef4;
  --dst-ai-chip-bg: #ffffff;
  --dst-ai-chip-hover: #d8e8f3;
  --dst-ai-chip-text: #173e63;
  --dst-ai-messages-bg: #e4edf4;
  --dst-ai-bubble-bg: #ffffff;
  --dst-ai-bubble-text: #1b344d;
  --dst-ai-composer-bg: #dfe9f0;
  --dst-ai-input-bg: #ffffff;
  --dst-ai-input-text: #1b2a40;
  --dst-ai-control-bg: #dce9f3;
  --dst-ai-control-text: #173e63;
  --dst-ai-control-border: rgba(24, 91, 157, .30);
  --dst-ai-launcher-bg: #dceaf3;
  --dst-ai-launcher-text: #23557e;
  --dst-ai-launcher-border: #aac4d5;
  --dst-ai-avatar-bg: #e7f0f7;
}
html[data-theme="dark"] {
  --dst-page-backdrop-color: #416f91;
  --dst-ai-panel-bg: #385f7c;
  --dst-ai-panel-border: rgba(221, 237, 248, .28);
  --dst-ai-header-start: #385f7c;
  --dst-ai-header-end: #385f7c;
  --dst-ai-header-text: #f7fbff;
  --dst-ai-header-muted: #d3e2ed;
  --dst-ai-muted-text: #d3e1e9;
  --dst-ai-placeholder: #eff5f8;
  --dst-ai-close-bg: #4a738d;
  --dst-ai-close-text: #ffffff;
  /* The contact security note renders to this same opaque surface on white. */
  --dst-ai-disclaimer-bg: #fff6df;
  --dst-ai-disclaimer-text: #614711;
  --dst-ai-system-bg: #4c4121;
  --dst-ai-system-text: #fff0bf;
  --dst-ai-action-bg: #3c6480;
  --dst-ai-chip-bg: #4b7591;
  --dst-ai-chip-hover: #5582a0;
  --dst-ai-chip-text: #f2f7fb;
  --dst-ai-messages-bg: #3a617d;
  --dst-ai-bubble-bg: #476f89;
  --dst-ai-bubble-text: #f3f7fa;
  --dst-ai-composer-bg: #416c89;
  --dst-ai-input-bg: #456f8b;
  --dst-ai-input-text: #f3f7fa;
  --dst-ai-control-bg: #4a738d;
  --dst-ai-control-text: #f3f7fa;
  --dst-ai-control-border: rgba(211, 231, 244, .32);
  --dst-ai-launcher-bg: #4b7591;
  --dst-ai-launcher-text: #f3f7fa;
  --dst-ai-launcher-border: #7598b2;
  --dst-ai-avatar-bg: #426b86;
}

/* Keep the mobile assistant icon legible against the dark header. */
html[data-theme="dark"] .language-switch-mobile .mobile-ai-toggle {
  color: #23557e !important;
  background: #dceaf3 !important;
  border-color: #aac4d5 !important;
}
html[data-theme="dark"] .language-switch-mobile .mobile-ai-bubble-icon {
  border-color: #23557e !important;
}
html[data-theme="dark"] .language-switch-mobile .mobile-ai-bubble-icon::after {
  border-left-color: #23557e !important;
  border-bottom-color: #23557e !important;
  background: #dceaf3 !important;
}

/* The assistant shell, its header shortcut, and its welcome hint share the
   selected theme palette. */
.ai-widget .ai-toggle,
.language-switch-mobile .mobile-ai-toggle {
  color: var(--dst-ai-launcher-text) !important;
  background: var(--dst-ai-launcher-bg) !important;
  border-color: var(--dst-ai-launcher-border) !important;
}

/* v1047: light mobile launcher uses a gray-beige surface, including the
   chat bubble tail. Keep these tokens local to the mobile button. */
html:not([data-theme="dark"]) .language-switch-mobile .mobile-ai-toggle {
  --dst-ai-launcher-bg: #e8e3da;
  --dst-ai-launcher-border: #c9c1b5;
  background: var(--dst-ai-launcher-bg) !important;
  border-color: var(--dst-ai-launcher-border) !important;
}
.ai-widget .ai-toggle-avatar,
.ai-widget .ai-avatar {
  background: var(--dst-ai-avatar-bg) !important;
}
.language-switch-mobile .mobile-ai-bubble-icon {
  border-color: var(--dst-ai-launcher-text) !important;
}
.language-switch-mobile .mobile-ai-bubble-icon::after {
  border-left-color: var(--dst-ai-launcher-text) !important;
  border-bottom-color: var(--dst-ai-launcher-text) !important;
  background: var(--dst-ai-launcher-bg) !important;
}
.mobile-ai-onboarding-hint {
  color: var(--dst-ai-input-text) !important;
  background: var(--dst-ai-panel-bg) !important;
  border-color: var(--dst-ai-panel-border) !important;
}
.mobile-ai-onboarding-hint::after {
  background: var(--dst-ai-panel-bg) !important;
  border-top-color: var(--dst-ai-panel-border) !important;
  border-right-color: var(--dst-ai-panel-border) !important;
}
.ai-widget .ai-message.system .ai-bubble {
  color: var(--dst-ai-system-text) !important;
  background: var(--dst-ai-system-bg) !important;
}
.ai-widget .ai-context-palette {
  background: var(--dst-ai-action-bg) !important;
  border-top-color: var(--dst-ai-control-border) !important;
}
.ai-widget .ai-context-palette button {
  color: var(--dst-ai-chip-text) !important;
  background: var(--dst-ai-chip-bg) !important;
  border-color: var(--dst-ai-control-border) !important;
}
.ai-widget .ai-context-palette button:hover:not(:disabled),
.ai-widget .ai-context-palette button:focus-visible:not(:disabled) {
  background: var(--dst-ai-chip-hover) !important;
}
.ai-widget .ai-speak,
.ai-widget .ai-input-clear {
  color: var(--dst-ai-control-text) !important;
  background: var(--dst-ai-control-bg) !important;
  border-color: var(--dst-ai-control-border) !important;
}
.ai-widget .ai-voice-note {
  color: var(--dst-ai-header-muted) !important;
}

.language-switch .theme-divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  margin: 0 2px 0 4px;
  flex: 0 0 1px;
  align-self: center;
  background: rgba(13, 59, 102, .26);
}
.language-switch .theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 32px;
  min-width: 34px;
  min-height: 32px;
  padding: 0 !important;
  border: 1px solid rgba(35, 85, 126, .26);
  border-radius: 9px;
  background: #e8f2f8;
  color: #23557e;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(33, 79, 120, .08);
}
.language-switch .theme-toggle:hover { background: #dceaf3; border-color: #86aac4; }
.language-switch .theme-toggle:focus-visible { outline: 2px solid #d49419; outline-offset: 2px; }
.theme-icon { width: 19px; height: 19px; pointer-events: none; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: none; }

/* Both palettes use light paper for text-heavy standalone pages. */
html[data-theme="dark"] body.legal-page {
  background-color: #416f91 !important;
  background-image: linear-gradient(rgba(65,111,145,.50), rgba(65,111,145,.50)), image-set(url("../img/tax_documents_bg_v1010.webp") type("image/webp"), url("../img/tax_documents_bg_v1010.png") type("image/png")) !important;
  background-blend-mode: normal, multiply !important;
  background-position: center top !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}
html[data-theme="dark"] body.legal-page .site-footer,
html[data-theme="dark"] body.legal-page .site-footer .footer-note,
html[data-theme="dark"] body.legal-page .site-footer .footer-links a {
  color: #f3f7fa !important;
  text-shadow: 0 1px 3px rgba(8, 31, 48, .42);
}
html[data-theme="dark"] body.legal-page .site-footer .footer-links a:hover { color: #fff0c5 !important; }

@media (max-width: 820px) {
  .language-switch-mobile .theme-divider {
    height: 18px !important;
    margin: 0 1px 0 2px !important;
  }
  .language-switch-mobile .theme-toggle {
    flex: 0 0 31px !important;
    width: 31px !important;
    min-width: 31px !important;
    height: 25px !important;
    min-height: 25px !important;
    border-radius: 8px !important;
  }
  .language-switch-mobile .theme-icon { width: 16px; height: 16px; }
  .language-switch-mobile .mobile-ai-onboarding-hint { right: 73px !important; }
  html[data-theme="dark"] body.legal-page { background-attachment: scroll !important; }
  .legal-page .language-switch .theme-toggle {
    width: 27px !important;
    min-width: 27px !important;
    height: 25px !important;
    min-height: 25px !important;
  }
  .legal-page .main-nav > .language-switch {
    position: absolute !important;
    top: 11px !important;
    right: 14px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    align-items: center !important;
  }
}
@media (max-width: 390px) {
  .language-switch-mobile .theme-toggle { flex-basis: 28px !important; width: 28px !important; min-width: 28px !important; }
  .language-switch-mobile .mobile-ai-onboarding-hint { right: 67px !important; }
}

/* v1045: soften the document texture by half while preserving the warm
   canvas and color toning. Both themes use a 50% wash in their own color. */
html:not([data-theme="dark"]) {
  --dst-page-backdrop-color: #e3dacb;
  --bg: #e3dacb;
  --line: #d5caba;
  --line-strong: #c9bda9;
  --mobile-ui-surface: #fffdf8;
  --mobile-ui-surface-strong: #f8f4ec;
  --mobile-ui-border: #d5caba;
  --mobile-ui-border-strong: #c9bda9;
  --dst-ai-panel-bg: #e4dccd;
  --dst-ai-panel-border: rgba(84, 68, 43, .27);
  --dst-ai-header-start: #e4dccd;
  --dst-ai-header-end: #e4dccd;
  --dst-ai-header-text: #173650;
  --dst-ai-header-muted: #536b7d;
  --dst-ai-muted-text: #607189;
  --dst-ai-placeholder: #64788b;
  --dst-ai-close-bg: #f4eee3;
  --dst-ai-close-text: #173f65;
  --dst-ai-action-bg: #f1ebdf;
  --dst-ai-chip-bg: #fffdf8;
  --dst-ai-chip-hover: #eee5d6;
  --dst-ai-messages-bg: #f6f1e8;
  --dst-ai-bubble-bg: #fffdf8;
  --dst-ai-composer-bg: #eee8dc;
  --dst-ai-input-bg: #fffdf8;
  --dst-ai-control-bg: #f4eee3;
  --dst-ai-avatar-bg: #f8f4ec;
}

html:not([data-theme="dark"]) body {
  background-color: #e3dacb !important;
  background-image: linear-gradient(rgba(227,218,203,.50), rgba(227,218,203,.50)), linear-gradient(#e3dacb, #e3dacb), image-set(url("../img/tax_documents_bg_v1010.webp") type("image/webp"), url("../img/tax_documents_bg_v1010.png") type("image/png")) !important;
  background-blend-mode: normal, color, multiply !important;
  background-position: center top !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}

html:not([data-theme="dark"]) .site-header {
  background: rgba(255,253,248,.96) !important;
  border-bottom-color: #d5caba !important;
}

html:not([data-theme="dark"]) :is(
  .hero-card, .panel, .info-card, .step-card, .price-card, .contact-link,
  .faq-columns, .faq-accordion details, .resource-card, .legal-card,
  .error-card, .credential-item, .process-principle-step, .early-start-item,
  .contact-form select
) {
  background: #fffdf8 !important;
  border-color: #d5caba !important;
}

html:not([data-theme="dark"]) :is(.fact-item, .price-factor-chip, .btn-secondary) {
  background: #f8f4ec !important;
  border-color: #d5caba !important;
}

html:not([data-theme="dark"]) .hero-card {
  background: linear-gradient(135deg, #fffdf8 0%, #fffdf8 68%, #f8f4ec 100%) !important;
  box-shadow: 0 32px 82px rgba(73, 60, 42, .15), inset 0 1px 0 rgba(255,255,255,.96) !important;
}

html:not([data-theme="dark"]) .legal-page .site-header {
  background: rgba(255,253,248,.97) !important;
}


@media (max-width: 899px) {
  html:not([data-theme="dark"]) body,
  html:not([data-theme="dark"]) body.legal-page {
    background-attachment: scroll !important;
  }
}

/* v1037: Center every header control in its row at all viewport widths. */
.site-header .header-inner {
  align-items: center !important;
}
.site-header .header-inner > .brand {
  display: flex !important;
  align-items: center !important;
  align-self: center !important;
}
.site-header .header-inner > .main-nav,
.site-header .header-inner > .language-switch,
.site-header .header-inner > .menu-toggle,
.site-header .header-inner > .header-ai-toggle {
  align-self: center !important;
}
.site-header .main-nav,
.site-header .header-links,
.site-header .language-switch {
  align-items: center !important;
}

.site-header .header-links > a {
  display: inline-flex !important;
  align-items: center !important;
  align-self: center !important;
}
.site-header .language-switch > :is(a, button, .theme-divider) {
  align-self: center !important;
}

/* v1038: Keep the desktop header and assistant title row the same height. */
@media (min-width: 1200px) {
  :root {
    --dst-stable-header-height: max(74px, var(--dst-ld-header-height, var(--dst-header-height)));
  }
  html body .site-header,
  html.ai-compact-open body .site-header,
  html.ai-rail-enabled body .site-header,
  html.ai-rail-collapsed body .site-header {
    height: var(--dst-stable-header-height) !important;
    min-height: var(--dst-stable-header-height) !important;
    max-height: var(--dst-stable-header-height) !important;
  }
  html body .site-header .header-inner,
  html.ai-compact-open body .site-header .header-inner,
  html.ai-rail-enabled body .site-header .header-inner,
  html.ai-rail-collapsed body .site-header .header-inner {
    height: var(--dst-stable-header-height) !important;
    min-height: var(--dst-stable-header-height) !important;
    max-height: var(--dst-stable-header-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  html.ai-compact-open,
  html.ai-rail-enabled,
  html.ai-rail-collapsed {
    --dst-compact-active-header-height: var(--dst-stable-header-height);
    --dst-nonrail-header-height: var(--dst-stable-header-height);
  }
  html.ai-compact-open body .ai-widget.is-open .ai-compact-shell {
    top: var(--dst-stable-header-height) !important;
  }
  html.ai-compact-open body .ai-widget.is-open .ai-panel-header,
  html.ai-rail-enabled body .ai-widget.is-open .ai-panel-header,
  html.ai-rail-collapsed body .ai-widget.is-open .ai-panel-header {
    height: var(--dst-stable-header-height) !important;
    min-height: var(--dst-stable-header-height) !important;
    max-height: var(--dst-stable-header-height) !important;
    align-items: center !important;
  }
}

/* Icon identifies the active appearance; tooltip names the next one. */
html .theme-toggle .theme-icon {display:none!important;}
html[data-appearance="light"] .theme-toggle .theme-icon-sun,
html[data-appearance="dark"] .theme-toggle .theme-icon-moon,
html[data-appearance="open-light"] .theme-toggle .theme-icon-open-light,
html[data-appearance="open-dark"] .theme-toggle .theme-icon-open-dark {display:block!important;}
