/* Shared WCAG 2.2 accessibility foundations. Keep this after tenant styles. */
:root { --a11y-link: #174f78; --a11y-muted: #525b65; --a11y-border: #737b85; --a11y-surface: #fff; --a11y-focus: #005fcc; }
[data-theme="dark"] { --a11y-link: #a8d2ff; --a11y-muted: #c1c8d0; --a11y-border: #9aa4af; --a11y-surface: #2d2d2d; --a11y-focus: #ffdf6c; --text-muted: #c1c8d0; }
html { scroll-padding-top: 1rem; }
*, *::before, *::after { scroll-margin-block: 1rem; }
:focus-visible { outline: 3px solid var(--a11y-focus) !important; outline-offset: 3px !important; box-shadow: 0 0 0 2px var(--a11y-surface) !important; }
#main-content:focus { outline: none; }
.skip-link { position: fixed; top: -12rem; left: 1rem; z-index: 20000; padding: .75rem 1rem; border-radius: .25rem; background: #fff; color: #174f78 !important; font-weight: 700; text-decoration: underline; }
.skip-link:focus { top: .5rem; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }
button, [role="button"], input, select, textarea, a { touch-action: manipulation; }
button, [role="button"], .btn, .nav-link, .dropdown-item, .accordion-button, .tab-btn { min-height: 2.75rem; }
button, [role="button"], .btn { min-width: 2.75rem; }
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: max(1rem, 16px); }
.form-control, .form-select { border-color: var(--a11y-border) !important; }
.form-control::placeholder, textarea::placeholder { color: var(--a11y-muted) !important; opacity: 1; }
.text-muted, .text-secondary, .section-label, .line-items thead th { color: var(--a11y-muted) !important; }
main a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item), .content-link { color: var(--a11y-link); text-decoration: underline; text-underline-offset: .16em; }
.btn-primary, .btn-accept, .btn-pay, .btn-resub, .chatbot-send-btn, .chatbot-toggle { background: #174f78 !important; color: #fff !important; border: 2px solid #174f78 !important; }
.btn-primary:hover, .btn-accept:hover, .btn-pay:hover { background: #103b5b !important; opacity: 1 !important; }
.btn-outline-primary, .btn-outline-secondary { color: var(--a11y-link) !important; border: 2px solid var(--a11y-link) !important; background: transparent; }
.btn-outline-primary:hover, .btn-outline-secondary:hover { color: var(--a11y-surface) !important; background: var(--a11y-link) !important; }
.btn-success, .badge.bg-success { background-color: #146c43 !important; color: #fff !important; }
.btn-danger, .bg-danger { background-color: #b02a37 !important; color: #fff !important; }
.bg-warning, .btn-warning { color: #212529 !important; }
.badge.text-warning { color: #694d00 !important; background: #fff3cd !important; }
[data-theme="dark"] .text-primary { color: #a8d2ff !important; }
[data-theme="light"] .text-primary { color: #174f78 !important; }
.navbar .nav-link:focus-visible, .navbar .nav-link:hover { text-decoration: underline; text-underline-offset: .3em; }
.footer .text-muted { color: inherit !important; opacity: 1 !important; }
.footer a { text-decoration: underline; text-underline-offset: .16em; }
.estimate-header, .invoice-header, .co-header, .portal-header, .unsub-header, .chatbot-header { background: #174f78 !important; color: #fff !important; }
.estimate-header .text-muted, .invoice-header .text-muted, .portal-header .text-muted { color: #fff !important; opacity: 1 !important; }
.carousel-caption { background: rgba(0,0,0,.82) !important; color: #fff; border-radius: .5rem; }
.carousel-caption p { color: #fff !important; }
.carousel-control-prev-icon, .carousel-control-next-icon { background-color: #174f78; background-size: 70%; border-radius: 50%; width: 2.75rem; height: 2.75rem; }
.carousel-control-prev, .carousel-control-next { opacity: 1; }
.carousel-indicators [data-bs-target] { min-width: 2.75rem; min-height: 2.75rem; height: 2.75rem; box-sizing: border-box; border: .5rem solid transparent; background-clip: content-box; }
.carousel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem; }
.choice-control { min-height: 2.75rem; border-color: #737b85 !important; }
.choice-control[aria-pressed="true"] { border: 2px solid #174f78 !important; }
.choice-control[aria-disabled="true"] { cursor: default !important; }
.signature-controls { border: 1px solid #737b85; border-radius: .5rem; padding: 1rem; }
.signature-error { color: #b02a37; font-weight: 600; }
.chatbot-close-btn { min-width: 2.75rem; min-height: 2.75rem; }
.chatbot-badge { animation: none !important; }
.chatbot-input { border: 1px solid var(--a11y-border); }
.chatbot-window { max-height: min(32.5rem, calc(100dvh - 8.75rem)); }
@media (max-width: 575px) {
  .chatbot-toggle { width: 2.75rem; height: 2.75rem; right: .75rem; bottom: .75rem; }
  .chatbot-window { right: .5rem; bottom: 4rem; max-width: calc(100vw - 1rem); max-height: calc(100dvh - 5rem); }
  .estimate-header, .invoice-header, .co-header { overflow-wrap: anywhere; }
  .carousel-toolbar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .fade-in { opacity: 1 !important; transform: none !important; }
}
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight !important; }
  .btn, .choice-control, input, select, textarea { border: 1px solid ButtonText !important; }
}
@media print { .skip-link, .carousel-toolbar, #a11y-status { display: none !important; } }
/* The demo banner uses a gold surface; its links need dark text. */
.demo-banner a, [data-theme] .bg-warning a, .bg-warning a, [style*="background: #fbbf24"] a { color: #17364d !important; text-decoration: underline; }
dialog::backdrop { background: rgba(0,0,0,.6); }

[role="button"][aria-pressed] { border-width: 2px !important; }
