/**
 * Master Dealer — biblioteca de componentes (§25.11)
 */

/* ─── Botões ─── */
.btn-primary,
.btn-secondary,
.btn-cancel,
.btn-filter,
.btn-filter-clear,
.btn-filter-advanced,
.btn-export,
.btn-create,
.btn-submit,
.btn-action,
.btn-edit,
.btn-delete,
.btn-block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
    line-height: 1.4;
    position: relative;
    white-space: nowrap;
}

.btn-toolbar-icon {
    min-height: 44px;
}

[data-tooltip]::after {
    background: var(--text-primary);
    border-radius: 8px;
    bottom: calc(100% + 0.55rem);
    box-shadow: 0 8px 20px rgba(45, 55, 72, 0.18);
    color: #fff;
    content: attr(data-tooltip);
    display: none;
    font-size: 0.75rem;
    font-weight: 600;
    left: 50%;
    line-height: 1;
    opacity: 0;
    padding: 0.45rem 0.6rem;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    z-index: 500;
}

[data-tooltip]::before {
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
    bottom: calc(100% + 0.15rem);
    content: "";
    display: none;
    left: 50%;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 501;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::after,
[data-tooltip]:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 2px 4px rgba(139, 115, 85, 0.3);
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.92;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--bg-input);
}

.btn-filter {
    background: var(--primary-color);
    color: #fff;
}

.btn-filter-clear {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-filter-clear:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--bg-input);
}

.btn-filter-advanced {
    background: var(--bg-card);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-export {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
}

.btn-export:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-create {
    background: var(--accent-gradient);
    color: #fff;
}

.btn-submit {
    background: var(--accent-gradient);
    color: #fff;
}

.btn-action {
    padding: 0.35rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.btn-edit {
    color: var(--primary-color);
    border-color: var(--secondary-color);
}

.btn-edit:hover {
    background: var(--bg-input);
}

.btn-delete,
.btn-block {
    color: var(--danger-color);
    border-color: #fecaca;
}

.btn-delete:hover,
.btn-block:hover {
    background: #fef2f2;
}

/* ─── Toolbar / filtros ─── */
.list-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.filter-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.65rem;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-group {
    flex: 1 1 360px;
    max-width: 560px;
    min-width: 220px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.filter-input,
.filter-select,
.form-control,
.form-select {
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    min-width: 140px;
    box-sizing: border-box;
    width: 100%;
}

.filter-input:focus,
.filter-select:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.15);
}

.searchable-select-native {
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 1px !important;
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: 0.875rem;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    text-align: left;
    width: 100%;
}

.searchable-select-trigger:hover {
    border-color: rgba(139, 115, 85, 0.55);
}

.searchable-select.is-open .searchable-select-trigger {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.15);
}

.searchable-select-trigger-icon,
.searchable-select-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.searchable-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-chevron {
    transition: transform 0.15s;
}

.searchable-select.is-open .searchable-select-chevron {
    transform: rotate(180deg);
}

.searchable-select-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 32px rgba(45, 55, 72, 0.16);
    display: none;
    left: 0;
    margin-top: 0.35rem;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 80;
}

.searchable-select.is-open .searchable-select-panel {
    display: block;
}

.searchable-select-panel--fixed {
    margin-top: 0;
    right: auto;
}

.modal-dialog:has(.searchable-select.is-open),
.modal-body:has(.searchable-select.is-open),
.modal-cadastro-body:has(.searchable-select.is-open) {
    overflow: visible;
}

.searchable-select-search {
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
}

.searchable-select-search i {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.searchable-select-search input {
    border: 0;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    min-width: 0;
    outline: none;
    width: 100%;
}

.searchable-select-options {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.35rem;
}

.searchable-select-option {
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: block;
    font-family: inherit;
    font-size: 0.86rem;
    line-height: 1.35;
    padding: 0.55rem 0.65rem;
    text-align: left;
    width: 100%;
}

.searchable-select-option:hover,
.searchable-select-option.is-selected {
    background: var(--bg-input);
    color: var(--primary-color);
}

.searchable-select-option:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.65;
}

.searchable-select-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.75rem;
    text-align: center;
}

.toolbar-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.export-actions {
    display: flex;
    gap: 0.35rem;
}

/* Dropdown Exportar (§25.13) */
.export-dropdown {
    position: relative;
}

.btn-export-toggle {
    min-height: 44px;
}

.btn-export-toggle .export-chevron {
    font-size: 0.75rem;
    margin-left: 0.15rem;
    transition: transform 0.2s;
}

.export-dropdown.is-open .btn-export-toggle .export-chevron {
    transform: rotate(180deg);
}

.export-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    z-index: 200;
    overflow: hidden;
}

.export-dropdown.is-open .export-dropdown-menu {
    display: block;
}

.export-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.export-dropdown-item:hover {
    background: var(--bg-input);
}

.export-dropdown-item + .export-dropdown-item {
    border-top: 1px solid var(--border-color);
}

@media (max-width: 1180px) {
    [data-tooltip]::after,
    [data-tooltip]::before {
        display: block;
    }

    .filter-form .btn-toolbar-icon,
    .toolbar-actions .btn-toolbar-action {
        flex: 0 0 44px;
        height: 44px;
        min-width: 44px;
        padding: 0.55rem;
    }

    .filter-form .btn-toolbar-icon .toolbar-btn-label,
    .toolbar-actions .btn-toolbar-action .toolbar-btn-label,
    .toolbar-actions .btn-export-toggle .export-chevron {
        border: 0;
        clip: rect(0, 0, 0, 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }
}

/* ─── Tabelas (§25.12) ─── */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-container thead {
    background: var(--bg-input);
}

.table-container th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-container td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-container tbody tr:hover {
    background: rgba(247, 245, 242, 0.6);
}

.table-container tbody tr:last-child td {
    border-bottom: none;
}

.table-container th.col-actions,
.table-container td.col-actions {
    text-align: center;
    width: 1%;
    min-width: 5.5rem;
    white-space: nowrap;
    vertical-align: middle;
}

.table-container td.table-actions {
    display: table-cell;
}

.table-container td.table-actions .btn-action {
    margin: 0 0.12rem;
    vertical-align: middle;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.no-results i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* ─── Paginação ─── */
.table-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 0.8rem;
}

.pagination-info {
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.per-page-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    background: var(--bg-input);
}

.pagination-wrapper {
    display: flex;
    gap: 0.25rem;
}

.pagination-wrapper .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-wrapper .page-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
}

.pagination-wrapper .page-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
}

.pagination-wrapper .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── Badges ─── */
.badge-status {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-ativo,
.badge-validado,
.badge-validada,
.badge-conciliado,
.badge-conciliada,
.badge-aprovado {
    background: #d1fae5;
    color: var(--success-color);
}

.badge-aprovada {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-inativo,
.badge-bloqueado,
.badge-rejeitado,
.badge-rejeitada,
.badge-recusado,
.badge-recusada,
.badge-cancelado,
.badge-cancelada {
    background: #fee2e2;
    color: var(--danger-color);
}

.badge-pendente_aprovacao,
.badge-pendente,
.badge-importada,
.badge-processada,
.badge-divergente,
.badge-disponivel_para_emitir {
    background: #fef3c7;
    color: var(--warning-color);
}

.badge-solicitada,
.badge-separada {
    background: #fef3c7;
    color: var(--warning-color);
}

.badge-recebida {
    background: #d1fae5;
    color: var(--success-color);
}

.badge-enviada {
    background: #e0e7ff;
    color: #4338ca;
}

.badge-extrato_gerado,
.badge-gerado,
.badge-liberado,
.badge-nota_validada,
.badge-pago,
.badge-paga {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-suspenso_financeiro {
    background: #e0e7ff;
    color: #4338ca;
}

/* ─── Formulários ─── */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.form-group .form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.form-check-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 160px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.password-field-wrapper {
    position: relative;
}

.password-field-wrapper .form-control {
    width: 100%;
    padding-right: 2.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
}

.password-toggle:hover {
    color: var(--primary-color);
}

/* Password strength (§12.7) */
.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    overflow: hidden;
}

.password-strength-bar .fill {
    height: 100%;
    width: 0;
    transition: width 0.2s, background 0.2s;
    border-radius: 2px;
}

.password-strength-bar.fraca .fill {
    width: 33%;
    background: var(--danger-color);
}

.password-strength-bar.media .fill {
    width: 66%;
    background: var(--warning-color);
}

.password-strength-bar.forte .fill {
    width: 100%;
    background: var(--success-color);
}

.password-strength-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.password-strength-label.fraca { color: var(--danger-color); }
.password-strength-label.media { color: var(--warning-color); }
.password-strength-label.forte { color: var(--success-color); }

.is-invalid {
    border-color: var(--danger-color) !important;
}

.field-error {
    font-size: 0.75rem;
    color: var(--danger-color);
    margin-top: 0.25rem;
}

/* ─── Modais ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 55, 72, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    transform: translateY(-12px);
    transition: transform 0.2s;
    overflow: hidden;
}

.modal-overlay.is-open .modal-dialog {
    transform: translateY(0);
}

.modal-dialog.modal-lg {
    max-width: 720px;
}

.modal-dialog.modal-filtros {
    max-width: 560px;
}

.modal-cadastro .modal-cadastro-dialog {
    max-width: 1120px;
    width: min(96vw, 1120px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.35rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    display: flex;
    flex-shrink: 0;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.modal-cadastro .modal-cadastro-body {
    background: var(--bg-page);
    padding: 1.15rem 1.35rem;
}

.modal-cadastro .modal-form-fields {
    min-height: 0;
}

.modal-cadastro .modal-tab-panels {
    padding-right: 0.15rem;
}

.modal-form-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.25rem 0 0.75rem;
}

.modal-form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 18px rgba(45, 55, 72, 0.05);
    padding: 1.05rem;
}

.modal-form-section-header {
    border-bottom: 1px solid rgba(226, 232, 240, 0.75);
    margin-bottom: 0.9rem;
    padding-bottom: 0.7rem;
}

.modal-form-section-header h4 {
    color: var(--text-primary);
    font-size: 0.96rem;
    font-weight: 700;
    margin: 0;
}

.modal-form-section-header p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0.2rem 0 0;
}

.modal-form-section-grid {
    display: grid;
    gap: 0.9rem 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-form-section .form-group {
    margin-bottom: 0;
}

.modal-form-section .form-control,
.modal-form-section .form-select {
    min-height: 42px;
    min-width: 0;
    width: 100%;
}

.modal-form-field-wide {
    grid-column: 1 / -1;
}

.modal-form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

/* Modal motivo — textarea largura total (§25.14) */
.modal-motivo .modal-dialog {
    width: 100%;
    max-width: 520px;
}

.modal-motivo-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.modal-motivo .campo-motivo {
    width: 100%;
}

.modal-motivo .campo-motivo label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-motivo .campo-motivo-textarea,
.campo-motivo .campo-motivo-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 120px;
    resize: vertical;
}

/* Modal editar campo auditado — edição inline (§25.14) */
.modal-editar-campo-auditado .modal-dialog {
    width: 100%;
    max-width: 520px;
}

.modal-editar-campo-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.modal-editar-campo-contexto {
    background: var(--bg-muted, #f4f5f7);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.modal-editar-campo-contexto strong {
    display: block;
    margin-bottom: 0.25rem;
}

.modal-editar-campo-contexto span {
    color: var(--text-muted, #6c757d);
    font-size: 0.875rem;
}

/* Modal cadastro com abas — Empresa / Endereço / Telefone (§25.14) */
.modal-form-with-tabs .modal-body-tabs {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top: 0;
}

.modal-form-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin: 0 -1.25rem 1rem;
}

.modal-form-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: -1px;
    padding: 0.85rem 1rem;
    transition: color 0.15s, border-color 0.15s;
}

.modal-form-tab:hover {
    color: var(--text-primary);
}

.modal-form-tab.is-active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.modal-form-tab.is-disabled {
    opacity: 0.55;
}

.modal-tab-panels {
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
}

.modal-tab-panel {
    display: none;
}

.modal-tab-panel.is-active {
    display: block;
}

.modal-tab-hint {
    align-items: flex-start;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    font-size: 0.875rem;
    gap: 0.5rem;
    line-height: 1.5;
    margin: 0;
    padding: 1rem;
}

.modal-tab-hint i {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.field-label-with-hint {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
}

.field-label-with-hint > span {
    line-height: 1.3;
}

.field-hint-icon {
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--primary-color);
    cursor: help;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 1rem;
    height: 1.35rem;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: color 0.15s ease, transform 0.15s ease;
    width: 1.35rem;
}

.field-hint-icon:hover,
.field-hint-icon:focus-visible {
    color: var(--primary-color-dark, #8b6914);
    outline: none;
    transform: scale(1.08);
}

.field-hint-icon.is-empty {
    color: var(--text-muted);
    opacity: 0.65;
}

.modal-form-with-tabs .modal-form-fields .form-control,
.modal-form-with-tabs .modal-form-fields .form-select,
.modal-form-with-tabs .modal-form-fields textarea.form-control {
    width: 100%;
    box-sizing: border-box;
}

.modal-alert .modal-body {
    text-align: center;
}

.modal-alert-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.modal-alert-icon.success { color: var(--success-color); }
.modal-alert-icon.error { color: var(--danger-color); }
.modal-alert-icon.warning { color: var(--warning-color); }
.modal-alert-icon.info { color: var(--primary-color); }

@media (max-width: 1024px) {
    .modal-cadastro .modal-cadastro-dialog {
        max-width: calc(100vw - 2rem);
    }

    .modal-form-section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .filter-form {
        flex-wrap: wrap;
        width: 100%;
    }

    .filter-group {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }

    .toolbar-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-left: 0;
        width: 100%;
    }

    .modal-overlay {
        align-items: flex-start;
        padding: 0.75rem;
    }

    .modal-dialog {
        max-height: calc(100vh - 1.5rem);
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-form-section-grid {
        grid-template-columns: 1fr;
    }

    .modal-form-section {
        padding: 0.85rem;
    }
}

@media (max-width: 480px) {
    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn-cancel,
    .modal-footer .btn-submit,
    .modal-footer .btn-primary {
        width: 100%;
    }
}

.modal-filtros-body .form-group {
    margin-bottom: 0.85rem;
}

.advanced-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

.advanced-filter-grid .form-group {
    margin-bottom: 0;
}

.filtro-date-range {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 0.85rem;
}

.filtro-date-range .form-group {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .advanced-filter-grid,
    .filtro-date-range {
        grid-template-columns: 1fr;
    }

    .filtro-date-range {
        flex-direction: column;
        align-items: stretch;
    }
}

.loading-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.form-atalho-tela a {
    font-weight: 500;
}

.import-arquivo-modelo-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.75rem;
}

.import-arquivo-modelo-row .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.import-arquivo-modelo-btn {
    flex: 0 0 auto;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .import-arquivo-modelo-row {
        flex-wrap: wrap;
    }

    .import-arquivo-modelo-btn {
        width: 100%;
        justify-content: center;
    }
}
