.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9999;
    transform: translateY(-160%);
    background: #031c36;
    color: #ffffff;
    border: 2px solid #bfdbfe;
    border-radius: 12px;
    padding: 10px 14px;
    font: 800 13px/1.2 Inter, Arial, sans-serif;
    text-decoration: none;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

:where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(147, 197, 253, 0.35);
}

:where(button, input, select, textarea, .icon-menu-button, .icon-button, .choice-trigger, .choice-option) {
    min-height: 24px;
}

:where(.icon-menu-button, .icon-button) {
    min-width: 24px;
}

.a11y-font-large {
    font-size: 120%;
    -webkit-text-size-adjust: 120%;
    text-size-adjust: 120%;
}

.a11y-font-larger {
    font-size: 140%;
    -webkit-text-size-adjust: 140%;
    text-size-adjust: 140%;
}

.a11y-font-large :where(h1, h2, h3, h4, h5, h6, p, span, li, td, th, label, input, select, textarea, button, a, .choice-value, .generated-content, #generated-text, #caderno-content) {
    font-size: 1.08em !important;
}

.a11y-font-larger :where(h1, h2, h3, h4, h5, h6, p, span, li, td, th, label, input, select, textarea, button, a, .choice-value, .generated-content, #generated-text, #caderno-content) {
    font-size: 1.15em !important;
}

html.a11y-high-contrast {
    --emerj-navy: #031225;
    --emerj-blue: #064a8f;
    --text-main: #061225;
    background: #dbeafe !important;
    color: #061225 !important;
}

html.a11y-high-contrast body {
    background: #dbeafe !important;
    color: #061225 !important;
}

html.a11y-high-contrast :where(main, section, article, header, footer, nav, aside) {
    color: #061225;
}

html.a11y-high-contrast :where(.glass-panel, .inner-card, .plain-preview, .plain-chapter, .audio-toolbar, .choice-list, .choice-trigger, .choice-panel, .form-input, .form-textarea, .data-table, .table-shell, .history-item, .stat-card, .info-table, .juris-table) {
    background: #ffffff !important;
    color: #061225 !important;
    border-color: #064a8f !important;
    box-shadow: 0 14px 32px rgba(3, 18, 37, 0.18) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.a11y-high-contrast :where(.brand-area, .logo-box) {
    background: #ffffff !important;
    color: #061225 !important;
    border-color: #064a8f !important;
}

html.a11y-high-contrast :where(.app-name-top, .app-name-bottom, .user-credits, .user-email, .step-title, .choice-value, .choice-label, .choice-subtitle, .folder-tab, .plain-preview, .plain-chapter, .generated-content, #generated-text, #caderno-content, td, th, label, h1, h2, h3, h4, p, span, strong) {
    color: #061225 !important;
}

html.a11y-high-contrast :where(.text-slate-300, .text-slate-400, .text-slate-500, .text-slate-600, .text-blue-100, .text-blue-200, .text-blue-300, .text-brand-blue, .text-brand-dark) {
    color: #061225 !important;
}

html.a11y-high-contrast :where(.folder-tab, .choice-trigger, input, select, textarea) {
    background: #ffffff !important;
    color: #061225 !important;
    border-color: #60a5fa !important;
}

html.a11y-high-contrast :where(.folder-tab.active-tab, .icon-menu-button, .icon-button, .primary-button, .bottom-action-button, button, a.button-like) {
    background: #082f5f !important;
    color: #ffffff !important;
    border-color: #082f5f !important;
    box-shadow: none !important;
}

html.a11y-high-contrast :where(.folder-tab.active-tab *, .icon-menu-button *, .icon-button *, .primary-button *, .bottom-action-button *, button *) {
    color: inherit !important;
}

html.a11y-high-contrast :where(.folder-tab.disabled-tab, .folder-tab:not(.active-tab)) {
    background: #e5edf7 !important;
    color: #061225 !important;
    opacity: 1 !important;
}

html.a11y-high-contrast :where(.folder-tab.disabled-tab *, .folder-tab:not(.active-tab) *) {
    color: #061225 !important;
}

html.a11y-high-contrast :where(a:hover, button:hover, .icon-menu-button:hover, .icon-button:hover),
html.a11y-high-contrast :where(a:focus-visible, button:focus-visible, .icon-menu-button:focus-visible, .icon-button:focus-visible) {
    background: #0b5cad !important;
    color: #ffffff !important;
}

html.a11y-high-contrast :where(input::placeholder, textarea::placeholder) {
    color: #36536f !important;
}

html.a11y-high-contrast :where(svg, i) {
    color: currentColor !important;
    stroke: currentColor !important;
}

html.a11y-high-contrast :where(.choice-trigger, .icon-menu-button, .icon-button, .primary-button, .bottom-action-button, button) :where(svg, i),
html.dark.a11y-high-contrast :where(.choice-trigger, .icon-menu-button, .icon-button, .primary-button, .bottom-action-button, button) :where(svg, i) {
    color: inherit !important;
    stroke: currentColor !important;
}

html.a11y-high-contrast .relative:has(.choice-trigger) > .absolute {
    color: #064a8f !important;
}

html.dark.a11y-high-contrast {
    --emerj-navy: #f8fbff;
    --emerj-blue: #93c5fd;
    --text-main: #f8fbff;
    background: #061225 !important;
    color: #f8fbff !important;
}

html.dark.a11y-high-contrast body {
    background: #061225 !important;
    color: #f8fbff !important;
}

html.dark.a11y-high-contrast :where(main, section, article, header, footer, nav, aside) {
    color: #f8fbff;
}

html.dark.a11y-high-contrast :where(.glass-panel, .inner-card, .plain-preview, .plain-chapter, .audio-toolbar, .choice-list, .choice-trigger, .choice-panel, .form-input, .form-textarea, .data-table, .table-shell, .history-item, .stat-card, .info-table, .juris-table) {
    background: #020817 !important;
    color: #f8fbff !important;
    border-color: #93c5fd !important;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34) !important;
}

html.dark.a11y-high-contrast :where(.brand-area, .logo-box) {
    background: #020817 !important;
    color: #f8fbff !important;
    border-color: #93c5fd !important;
}

html.dark.a11y-high-contrast :where(.app-name-top, .app-name-bottom, .user-credits, .user-email, .step-title, .choice-value, .choice-label, .choice-subtitle, .folder-tab, .plain-preview, .plain-chapter, .generated-content, #generated-text, #caderno-content, td, th, label, h1, h2, h3, h4, p, span, strong) {
    color: #f8fbff !important;
}

html.dark.a11y-high-contrast :where(.text-slate-300, .text-slate-400, .text-slate-500, .text-slate-600, .text-blue-100, .text-blue-200, .text-blue-300, .text-brand-blue, .text-brand-dark) {
    color: #f8fbff !important;
}

html.dark.a11y-high-contrast :where(.folder-tab, .choice-trigger, input, select, textarea) {
    background: #020817 !important;
    color: #f8fbff !important;
    border-color: #93c5fd !important;
}

html.dark.a11y-high-contrast :where(.folder-tab.active-tab, .icon-menu-button, .icon-button, .primary-button, .bottom-action-button, button, a.button-like) {
    background: #0f3a68 !important;
    color: #ffffff !important;
    border-color: #bfdbfe !important;
}

html.dark.a11y-high-contrast :where(.folder-tab.active-tab *, .icon-menu-button *, .icon-button *, .primary-button *, .bottom-action-button *, button *) {
    color: inherit !important;
}

html.dark.a11y-high-contrast :where(.folder-tab.disabled-tab, .folder-tab:not(.active-tab)) {
    background: #14243a !important;
    color: #f8fbff !important;
    opacity: 1 !important;
}

html.dark.a11y-high-contrast :where(.folder-tab.disabled-tab *, .folder-tab:not(.active-tab) *) {
    color: #f8fbff !important;
}

html.dark.a11y-high-contrast :where(a:hover, button:hover, .icon-menu-button:hover, .icon-button:hover),
html.dark.a11y-high-contrast :where(a:focus-visible, button:focus-visible, .icon-menu-button:focus-visible, .icon-button:focus-visible) {
    background: #dbeafe !important;
    color: #061225 !important;
}

html.dark.a11y-high-contrast :where(input::placeholder, textarea::placeholder) {
    color: #c7d2fe !important;
}

html.dark.a11y-high-contrast .relative:has(.choice-trigger) > .absolute {
    color: #f8fbff !important;
}

.a11y-reduce-transparency :where(.glass-panel, .inner-card, .audio-toolbar, .choice-list, .choice-trigger, .form-input, .form-textarea, .preview-box) {
    background-color: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.dark.a11y-reduce-transparency :where(.glass-panel, .inner-card, .audio-toolbar, .choice-list, .choice-trigger, .form-input, .form-textarea, .preview-box) {
    background-color: #0f172a !important;
}

.a11y-enhanced-focus :where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 5px solid #f59e0b !important;
    outline-offset: 5px !important;
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0.34) !important;
}

.a11y-show-menu-labels header .app-shell {
    gap: 10px !important;
}

.a11y-show-menu-labels .brand-area {
    flex: 0 0 auto;
}

.a11y-show-menu-labels .desktop-menu {
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin;
    padding: 4px 2px;
}

.a11y-show-menu-labels .desktop-menu::-webkit-scrollbar {
    height: 6px;
}

.a11y-show-menu-labels .desktop-menu::-webkit-scrollbar-thumb {
    background: rgba(26, 75, 140, 0.28);
    border-radius: 999px;
}

.a11y-show-menu-labels .desktop-menu .icon-menu-button {
    width: auto !important;
    flex: 0 0 auto;
    min-width: 46px;
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
}

.a11y-show-menu-labels .icon-menu-button[data-label]::after,
.a11y-show-menu-labels .icon-menu-button[data-label]::before {
    display: none !important;
}

.a11y-show-menu-labels .icon-menu-button[data-label]::marker {
    content: "";
}

.a11y-show-menu-labels .desktop-menu .icon-menu-button[data-label] .a11y-menu-label {
    display: inline;
}

.a11y-menu-label {
    display: none;
    font-size: 11px;
    font-weight: 850;
    white-space: nowrap;
    line-height: 1;
}

.a11y-floating {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9998;
    font-family: Inter, Arial, sans-serif;
}

.a11y-floating-button {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    border: 2px solid rgba(191, 219, 254, 0.95);
    background: #031c36;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.28);
}

.a11y-floating-button svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.a11y-panel {
    position: absolute;
    right: 0;
    bottom: 62px;
    width: min(320px, calc(100vw - 36px));
    border-radius: 18px;
    border: 1px solid rgba(203, 213, 225, 0.92);
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.24);
    padding: 14px;
}

.a11y-panel[hidden] {
    display: none;
}

.a11y-panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 900;
    color: #031c36;
}

.a11y-panel-close {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #031c36;
}

.a11y-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid #e2e8f0;
}

.a11y-control-row:first-of-type {
    border-top: 0;
}

.a11y-control-label {
    font-size: 12px;
    font-weight: 850;
    color: #334155;
}

.a11y-control-copy {
    display: grid;
    gap: 3px;
}

.a11y-control-description {
    max-width: 180px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
}

.a11y-segment {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
}

.a11y-segment button,
.a11y-toggle {
    min-height: 34px;
    border: 0;
    background: #f8fafc;
    color: #1a4b8c;
    font-size: 12px;
    font-weight: 900;
    padding: 0 10px;
}

.a11y-segment button[aria-pressed="true"],
.a11y-toggle[aria-pressed="true"] {
    background: #1a4b8c;
    color: #ffffff;
}

.dark .a11y-panel {
    background: #0f172a;
    color: #dbeafe;
    border-color: rgba(147, 197, 253, 0.22);
}

.dark .a11y-panel-title,
.dark .a11y-control-label,
.dark .a11y-panel-close {
    color: #dbeafe;
}

.dark .a11y-control-description {
    color: #bfdbfe;
}

.dark .a11y-panel-close,
.dark .a11y-segment button,
.dark .a11y-toggle {
    background: #020617;
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.22);
}

.dark .a11y-control-row {
    border-top-color: rgba(147, 197, 253, 0.14);
}

a[target="_blank"]::after {
    content: " (abre em nova aba)";
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:target {
    scroll-margin-top: 24px;
}

.dark :where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline-color: #bfdbfe;
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.36);
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (forced-colors: active) {
    :where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
        outline: 3px solid Highlight;
        box-shadow: none;
    }

    .skip-link {
        background: Canvas;
        color: CanvasText;
        border-color: Highlight;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
