/* Layout compartilhado (templates/fragments/layout.html): faixa superior, breadcrumb, botões da
   faixa, popover genérico e toasts. Tokens espelham a sidebar (fragments/nav.html, M27 Fase 00). */

:root {
    --tl-border: #e4e7eb;
    --tl-text: #3b424c;
    --tl-muted: #8a919c;
    --tl-hover: #eceef1;
    --tl-strong: #0f172a;
    --tl-accent: #0d9488;
    --tl-accent-strong: #0f766e;
}

/* iOS amplia o viewport ao focar controles com texto menor que 16px. Mantemos o
   tamanho legível em dispositivos de toque, sem bloquear o zoom manual. A regra
   também cobre inputs de combobox e formulários adicionados por HTMX. */
@media (max-width: 767px), (pointer: coarse) {
    html body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    html body select,
    html body textarea,
    html body [contenteditable="true"] {
        font-size: max(16px, 1rem);
    }
}

/* ---- Coluna principal ---- */
.tl-col {
    min-width: 0;
    flex: 1 1 0%;
}

.tl-main {
    padding: 1.25rem 1rem 2rem;
}

@media (max-width: 1023px) {
    /* A tabela mantém sua rolagem interna sem ampliar a viewport. Clip não cria
       um scroll container: a barra sticky e os popovers fixed continuam livres. */
    .tl-main {
        overflow-x: clip;
    }
}

@media (min-width: 640px) {
    .tl-main {
        padding: 1.5rem 1.5rem 2.5rem;
    }
}

@media (min-width: 1024px) {
    .tl-main {
        padding: 1.5rem 2rem 3rem;
    }
}

.tl-content {
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
}

/* Linha de metadados opcional (estado, responsável, datas): abaixo da faixa, rola com o conteúdo. */
.tl-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1rem;
    margin-bottom: 1rem;
    color: var(--tl-muted);
    font-size: 0.8125rem;
}

/* ---- Faixa superior ---- */
.tl-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 3rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--tl-border);
    background: #fff;
}

@media (min-width: 1024px) {
    .tl-topbar {
        padding: 0 2rem;
    }
}

.tl-topbar-menu {
    display: grid;
    flex: none;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin-left: -0.375rem;
    border-radius: 0.375rem;
    color: var(--tl-text);
}

.tl-topbar-menu:hover {
    background: var(--tl-hover);
}

.tl-topbar-menu svg {
    width: 1.125rem;
    height: 1.125rem;
}

@media (min-width: 1024px) {
    .tl-topbar-menu {
        display: none;
    }
}

.tl-topbar a:focus-visible,
.tl-topbar button:focus-visible {
    outline: 2px solid var(--tl-accent);
    outline-offset: 1px;
}

/* ---- Breadcrumb ---- */
.tl-crumbs {
    flex: 1 1 0%;
    min-width: 0;
    container-type: inline-size;
    container-name: tl-breadcrumb;
}

.tl-crumbs ol {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
    overflow: hidden;
}

.tl-crumbs li {
    display: flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.tl-crumbs li + li::before {
    content: "/";
    flex: none;
    padding: 0 0.5rem;
    color: #c4c9d0;
}

.tl-crumbs a {
    color: var(--tl-muted);
    border-radius: 0.25rem;
}

.tl-crumbs li > a,
.tl-crumbs li > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tl-crumbs a:hover {
    color: var(--tl-strong);
    text-decoration: underline;
}

.tl-crumb-title {
    overflow: hidden;
    margin: 0;
    color: var(--tl-strong);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-overflow: ellipsis;
}

.tl-crumbs li:last-child {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 70%;
}

.tl-crumbs li:only-child {
    max-width: 100%;
}

.tl-crumb-ellipsis {
    display: none !important;
}

/* Ações secundárias e níveis intermediários cedem espaço ao título no desktop compacto. */
@media (max-width: 1200px) {
    .tl-crumb-mid {
        display: none !important;
    }

    .tl-crumb-ellipsis {
        display: flex !important;
    }
}

/* A largura disponível considera sidebar e ações: título é a prioridade em qualquer viewport. */
@container tl-breadcrumb (max-width: 22rem) {
    .tl-crumb-mid {
        display: none !important;
    }

    .tl-crumb-ellipsis {
        display: flex !important;
    }
}

@container tl-breadcrumb (max-width: 14rem) {
    .tl-crumbs li:not(:last-child) {
        display: none !important;
    }

    .tl-crumbs li:last-child {
        max-width: 100%;
    }

    .tl-crumbs li:last-child::before {
        display: none;
    }
}

/* ---- Ações da faixa ---- */
.tl-topbar-actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 0.5rem;
}

.tl-topbar-actions form {
    margin: 0;
}

.tl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border: 1px solid var(--tl-border);
    border-radius: 0.375rem;
    background: #fff;
    color: var(--tl-text);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.tl-btn:hover {
    background: var(--tl-hover);
    color: var(--tl-strong);
}

.tl-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.tl-btn svg {
    width: 0.875rem;
    height: 0.875rem;
}

.tl-btn-primary {
    border-color: transparent;
    background: var(--tl-accent);
    color: #fff;
}

.tl-btn-primary:hover {
    background: var(--tl-accent-strong);
    color: #fff;
}

/* Ação destrutiva: contorno vermelho na barra de seleção; sólido no botão de confirmação do modal. */
.tl-btn-danger {
    border-color: #fca5a5;
    color: #b91c1c;
}

.tl-btn-danger:hover {
    background: #fef2f2;
    color: #991b1b;
}

.tl-btn-danger-solid {
    border-color: transparent;
    background: #dc2626;
    color: #fff;
}

.tl-btn-danger-solid:hover {
    background: #b91c1c;
    color: #fff;
}

.tl-icon-btn-lg {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    color: var(--tl-text);
}

.tl-icon-btn-lg:hover {
    background: var(--tl-hover);
}

.tl-icon-btn-lg svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ---- Popover genérico ([data-tl-popover]) ---- */
.tl-popover {
    position: relative;
    flex: none;
}

.tl-popover[hidden] {
    display: none;
}

.tl-popover-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.25rem);
    right: 0;
    display: flex;
    min-width: 12rem;
    max-width: calc(100vw - 2rem);
    flex-direction: column;
    gap: 1px;
    padding: 0.25rem;
    border: 1px solid var(--tl-border);
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.2);
}

.tl-popover-flip .tl-popover-panel {
    top: auto;
    bottom: calc(100% + 0.25rem);
}

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

.tl-popover-panel > * {
    width: 100%;
}

.tl-popover-panel .tl-btn {
    justify-content: flex-start;
    border-color: transparent;
}

.tl-popover-panel form {
    margin: 0;
}

/* O ⋯ mantém as ações secundárias acessíveis até o desktop compacto. */
.tl-topbar-more {
    display: none;
}

/* Notificações: acesso persistente na AppBar, sem ocupar a navegação operacional. */
.tl-notifications {
    flex: none;
}

.tl-notifications-trigger {
    position: relative;
}

.tl-notifications-trigger::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    display: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--tl-border);
    border-radius: 0.25rem;
    background: #fff;
    color: var(--tl-text);
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
}

.tl-notifications-trigger[aria-expanded="false"]:is(:hover, :focus-visible)::after {
    display: block;
}

.tl-notifications-badge {
    position: absolute;
    top: 0;
    right: -2px;
    display: grid;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--tl-accent-strong);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

.tl-notifications-panel {
    width: 25rem;
    max-height: calc(100dvh - 4rem);
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.tl-notifications-heading,
.tl-notifications-summary,
.tl-notifications-item-heading,
.tl-notifications-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.tl-notifications-heading {
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    border-bottom: 1px solid var(--tl-border);
}

.tl-notifications-heading h2 {
    color: var(--tl-strong);
    font-size: 0.875rem;
    font-weight: 600;
}

.tl-notifications-summary {
    flex-wrap: wrap;
    padding: 0.625rem 1rem;
    color: var(--tl-muted);
    font-size: 0.75rem;
}

.tl-notifications-item {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--tl-border);
    color: var(--tl-text);
    font-size: 0.8125rem;
}

.tl-notifications-item.is-unread {
    background: #f0fdfa;
}

.tl-notifications-item-heading h3 {
    color: var(--tl-strong);
    font-weight: 600;
}

.tl-notifications-dot {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tl-accent);
}

.tl-notifications-item > p {
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
}

.tl-notifications-item-footer {
    flex-wrap: wrap;
    margin-top: 0.625rem;
    color: var(--tl-muted);
    font-size: 0.6875rem;
}

.tl-notifications-read {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 2rem;
    color: var(--tl-accent-strong);
    font-size: 0.75rem;
}

.tl-notifications-read:hover {
    text-decoration: underline;
}

.tl-notifications-read:disabled {
    opacity: 0.6;
    cursor: wait;
}

.tl-notifications-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.8125rem;
}

.tl-notifications-empty p:first-child {
    color: var(--tl-strong);
    font-weight: 500;
}

.tl-notifications-empty p + p {
    margin-top: 0.375rem;
    color: var(--tl-muted);
}

.tl-notifications-footer {
    display: block;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--tl-border);
    color: var(--tl-accent-strong);
    text-align: center;
    font-size: 0.8125rem;
}

.tl-notifications-footer:hover {
    background: var(--tl-hover);
}

.tl-notifications-more {
    padding: 0.5rem 1rem;
    color: var(--tl-muted);
    font-size: 0.75rem;
}

.tl-notifications-loading {
    display: none;
    padding: 0.5rem 1rem;
    color: var(--tl-muted);
    font-size: 0.75rem;
}

.tl-notifications-loading.htmx-request {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tl-notifications-skeleton {
    display: grid;
    gap: 0.625rem;
    padding: 1rem;
}

.tl-notifications-skeleton span {
    height: 0.75rem;
    border-radius: 0.25rem;
    background: var(--tl-hover);
}

.tl-notifications-skeleton span:last-child {
    width: 65%;
}

@media (max-width: 639px) {
    .tl-notifications-panel {
        position: fixed;
        top: 3.25rem;
        right: 0.5rem;
        width: calc(100vw - 1rem);
        max-width: none;
    }
}

@media (max-width: 1200px) {
    .tl-topbar-more:not([hidden]) {
        display: block;
    }
}

/* ---- Modal aberto: trava a rolagem da página ---- */
html.tl-modal-open {
    overflow: hidden;
}

/* ---- Toasts ---- */
.tl-toasts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 90;
    display: flex;
    width: min(24rem, calc(100vw - 2rem));
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

@media (max-width: 1023px) {
    body:has(.tl-tabbar) .tl-toasts {
        bottom: calc(4.5rem + env(safe-area-inset-bottom));
    }
}

.tl-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--tl-border);
    border-left-width: 3px;
    border-radius: 0.5rem;
    background: #fff;
    color: var(--tl-strong);
    font-size: 0.8125rem;
    line-height: 1.25rem;
    box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.25);
    pointer-events: auto;
    animation: tl-toast-in 0.16s ease-out;
}

.tl-toast-success {
    border-left-color: #10b981;
}

.tl-toast-error {
    border-left-color: #ef4444;
}

.tl-toast-message {
    flex: 1 1 0%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.tl-toast-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    color: var(--tl-muted);
    font-size: 1rem;
    line-height: 1;
}

.tl-toast-close:hover {
    background: var(--tl-hover);
    color: var(--tl-strong);
}

@keyframes tl-toast-in {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tl-toast {
        animation: none;
    }
}

/* ---- Datatable v2 (fragments/datatable.html) ---- */
.tl-datatable {
    font-size: 0.8125rem;
}

/* Compacta (padrão): linha de ~40px. Confortável (~52px) é a classe no <html> (techlabs.js). */
.tl-datatable tbody td {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

.tl-datatable tbody tr:not(.tl-empty-row) td {
    height: 2.5rem;
}

html.tl-density-comfortable .tl-datatable {
    font-size: 0.875rem;
}

html.tl-density-comfortable .tl-datatable tbody td {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

html.tl-density-comfortable .tl-datatable tbody tr:not(.tl-empty-row) td {
    height: 3.25rem;
}

.tl-select-col {
    width: 2.5rem;
    padding-left: 1rem !important;
    padding-right: 0.25rem !important;
}

.tl-select-col input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--tl-accent);
    cursor: pointer;
}

/* A coluna de ações nunca sai da tela: sticky à direita dentro da região rolável. */
.tl-datatable .tl-actions-col {
    position: sticky;
    right: 0;
    z-index: 1;
    width: 1%;
    background: #fff;
    text-align: right;
    white-space: nowrap;
}

.tl-datatable thead .tl-actions-col {
    background: #f8fafc;
}

.tl-actions-cluster {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.tl-actions-cluster form {
    margin: 0;
}

.tl-row-btn {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    color: var(--tl-muted);
    cursor: pointer;
}

.tl-row-btn:hover,
.tl-row-btn[aria-expanded="true"] {
    background: var(--tl-hover);
    color: var(--tl-strong);
}

.tl-row-btn:focus-visible {
    outline: 2px solid var(--tl-accent);
    outline-offset: 1px;
}

.tl-row-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Linha de tabela: o painel do ⋯ é posicionado em `fixed` por techlabs.js (a região rola e corta). */
.tl-popover[data-tl-popover-fixed] .tl-popover-panel {
    text-align: left;
}

/* Ajuda contextual de medições: compacta no rótulo, legível também no celular. */
.tl-field-help { display: inline-flex; vertical-align: middle; margin-left: 0.2rem; }
.tl-field-help-trigger {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid #94a3b8;
    border-radius: 50%;
    color: #475569;
    background: white;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.tl-field-help-trigger:focus-visible { outline: 2px solid #0d9488; outline-offset: 2px; }
.tl-field-help .tl-field-help-panel {
    z-index: 1001;
    width: min(19rem, calc(100vw - 1rem));
    padding: 0.65rem 0.75rem;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
}

@media (max-width: 639px) {
    .tl-row-hide-sm {
        display: none;
    }
}

@media (min-width: 640px) {
    .tl-menu-only-sm {
        display: none !important;
    }
}

/* Itens de menu (popovers do usuário e das linhas). */
.tl-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
    color: var(--tl-text);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.tl-menu-item:hover,
.tl-menu-item:focus-visible {
    background: var(--tl-hover);
    color: var(--tl-strong);
    outline: none;
}

.tl-menu-item svg {
    width: 1rem;
    height: 1rem;
    color: var(--tl-muted);
}

.tl-menu-danger,
.tl-menu-danger svg {
    color: #b91c1c;
}

.tl-menu-danger:hover,
.tl-menu-danger:focus-visible {
    background: #fef2f2;
    color: #991b1b;
}

.tl-menu-sep {
    margin: 0.25rem 0;
    border: 0;
    border-top: 1px solid var(--tl-border);
}

/* Barra de seleção múltipla. */
.tl-bulkbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #ccfbf1;
    background: #f0fdfa;
}

.tl-bulkbar[hidden] {
    display: none;
}

/* Separa a ação destrutiva das demais na barra de seleção. */
.tl-bulkbar-sep {
    align-self: stretch;
    width: 1px;
    margin: 0.125rem 0.25rem;
    background: #99f6e4;
}

@media (max-width: 639px) {
    /* a barra quebra em várias linhas: o traço ficaria solto no fim de uma delas */
    .tl-bulkbar-sep {
        display: none;
    }
}

.tl-bulkbar-count {
    margin-right: auto;
    color: #115e59;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Chevron da linha expansível (tabela de ensaios da OS): gira conforme o botão está aberto. */
.tl-row-chevron {
    transition: transform 0.15s ease;
}

[data-tl-row-toggle][aria-expanded="true"] .tl-row-chevron {
    transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
    .tl-row-chevron {
        transition: none;
    }
}

/* ---- Tela do ensaio (fragments/ensaio-shell.html, M27 Fase 12) ---- */
.tl-section {
    margin-bottom: 0.75rem;
    border: 1px solid var(--tl-border);
    border-radius: 0.75rem;
    background: #fff;
}

.tl-section-head,
.tl-resumo-head {
    display: flex;
    min-height: 2.75rem;
    cursor: pointer;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    list-style: none;
}

.tl-section-head::-webkit-details-marker,
.tl-resumo-head::-webkit-details-marker {
    display: none;
}

.tl-section-head:focus-visible,
.tl-resumo-head:focus-visible {
    outline: 2px solid var(--tl-accent);
    outline-offset: -2px;
    border-radius: 0.75rem;
}

.tl-section-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--tl-strong);
}

[data-tl-section-edit][hidden] {
    display: none;
}

.tl-section :is(input, select, textarea, button)[inert] {
    background-color: #f8fafc;
    color: #475569;
}

.tl-section-badge {
    flex: none;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #f8fafc;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
}

.tl-section-badge[data-state="completo"] {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #047857;
}

.tl-section-badge[data-state="parcial"],
.tl-section-badge[data-state="nao-salva"] {
    border-color: #fde68a;
    background: #fffbeb;
    color: #b45309;
}

.tl-section-chevron {
    flex: none;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

details[open] > summary > .tl-section-chevron,
details[open] > .tl-resumo-head > .tl-section-chevron {
    transform: rotate(180deg);
}

.tl-section-body {
    border-top: 1px solid var(--tl-border);
    padding: 0.875rem;
}

@media (min-width: 640px) {
    .tl-section-body {
        padding: 1.25rem;
    }
}

/* Grade de campos de uma seção do ensaio. Input nativo e combobox pesquisável (min 2.5rem) ficam com a mesma
   altura e como bloco: a linha alinha pelo rodapé dos controles e, sem isso, os rótulos vizinhos saem do prumo
   (input inline deixa ~4px de folga de linha de texto embaixo). */
.tl-fields input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="file"], [readonly]) {
    display: block;
    min-height: 2.5rem;
}

.tl-resumo {
    margin-bottom: 0.75rem;
    border: 1px solid var(--tl-border);
    border-radius: 0.75rem;
    background: #f8fafc;
}

.tl-resumo-head {
    font-size: 0.875rem;
}

.tl-resumo-list {
    display: grid;
    gap: 0.5rem 1.5rem;
    padding: 0 0.875rem 0.5rem;
    font-size: 0.8125rem;
}

@media (min-width: 640px) {
    .tl-resumo-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.tl-resumo-item dt {
    color: #64748b;
}

.tl-resumo-item dd {
    font-weight: 500;
    color: var(--tl-strong);
}

.tl-resumo-link {
    display: inline-block;
    padding: 0 0.875rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--tl-accent-strong);
}

/* Barra da etapa: fixa no rodapé (acima da barra de abas dos técnicos no celular), destacada no desktop. */
.tl-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 1rem -1rem -2rem;
    border-top: 1px solid var(--tl-border);
    background: rgba(255, 255, 255, 0.96);
    padding: 0.625rem 1rem calc(0.625rem + env(safe-area-inset-bottom));
    backdrop-filter: blur(6px);
}

@media (max-width: 1023px) {
    body:has(.tl-tabbar) .tl-action-bar {
        bottom: calc(3.5rem + env(safe-area-inset-bottom));
        padding-bottom: 0.625rem;
    }
}

@media (min-width: 640px) {
    .tl-action-bar {
        margin: 1.25rem 0 0;
        border: 1px solid var(--tl-border);
        border-radius: 0.75rem;
        box-shadow: 0 -4px 16px -8px rgba(15, 23, 42, 0.18);
    }
}

.tl-action-count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
}

.tl-action-count[data-pending="true"] {
    color: #b45309;
}

.tl-action-count[data-pending="false"] {
    color: #047857;
}

.tl-action-button {
    min-height: 2.75rem;
    min-width: 8rem;
    justify-content: center;
}

/* Conteúdo recolhido pode ser menor que a viewport: no mobile o rodapé continua fixo. */
@media (max-width: 1023px) {
    .tl-action-bar {
        position: fixed;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
    }
    [data-tl-ensaio-form]:has(.tl-action-bar) {
        padding-bottom: 6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tl-section-chevron {
        transition: none;
    }
}

/* Com a barra da etapa na tela, o toast sobe para não cobrir o botão de finalizar. */
@media (max-width: 1023px) {
    body:has(.tl-action-bar) .tl-toasts {
        bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
    body:has(.tl-tabbar):has(.tl-action-bar) .tl-toasts {
        bottom: calc(8.5rem + env(safe-area-inset-bottom));
    }
}

@media (min-width: 1024px) {
    body:has(.tl-action-bar) .tl-toasts {
        bottom: 5.5rem;
    }
}
