.table-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.table-toolbar input,
.table-toolbar select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
}

.table-wrapper {
    width: 100%;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    max-height: 70vh;
}

.default-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.default-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f9fafb;
    color: #374151;
    text-align: left;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.default-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}

.default-table tbody tr:hover {
    background: #f9fafb;
}

.default-table tbody tr:nth-child(even) {
    background: #fcfcfd;
}

.default-table .text-right {
    text-align: right;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.table-actions a,
.table-actions button {
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #eef2ff;
    color: #3730a3;
}

.table-empty {
    padding: 32px;
    text-align: center;
    color: #6b7280;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

@media (max-width: 768px) {
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar input,
    .table-toolbar select,
    .table-toolbar button,
    .table-toolbar a {
        width: 100%;
    }

    .table-wrapper {
        max-height: 65vh;
    }

    .default-table {
        min-width: 900px;
    }
}




.table-summary {
    margin: 8px 0 14px;
    color: #4b5563;
    font-size: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.pagination a:hover {
    background: #f3f4f6;
}

.pagination .active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.pagination .disabled {
    color: #9ca3af;
    background: #f9fafb;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 768px) {
    .pagination {
        justify-content: center;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header-actions,
    .page-header-actions a {
        width: 100%;
    }
}

/* ==============================
   Tela Ordens de Serviço - padrão antigo
============================== */

.os-page {
    padding: 0;
}

.os-filters-bar,
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.helper-text {
    font-size: 11px;
    color: #64748b;
    font-weight: 400;
}

.os-actions-top {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.global-filter-input {
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    padding: 8px 13px;
    font-size: 13px;
    min-width: 260px;
    height: 34px;
    background: #ffffff;
    outline: none;
}

.global-filter-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-outline {
    background: #ffffff;
    color: #2563eb;
}

.btn-outline:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.table-wrap {
    width: 100%;
    max-height: calc(100vh - 150px);
    overflow: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.table-sticky {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    color: #0f172a;
    min-width: 1600px;
}

.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8fafc;
    color: #475569;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
    font-weight: 700;
    padding: 10px 11px;
    border-bottom: 1px solid #dbe1ea;
    white-space: normal;
    line-height: 1.25;
}

.table-sticky tbody td {
    padding: 10px 11px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    line-height: 1.25;
    background: #ffffff;
}

.table-sticky tbody tr:hover td {
    background: #f8fafc;
}

.table-sticky tbody tr:last-child td {
    border-bottom: 0;
}

.os-link {
    color: #1d4ed8;
    text-decoration: underline;
    font-weight: 600;
}

.descricao-cell {
    min-width: 280px;
    max-width: 360px;
    white-space: normal;
}

.badge-evento {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
}

.badge-evento-sim {
    background: #fee2e2;
    color: #dc2626;
}

.badge-evento-nao {
    background: #e5e7eb;
    color: #475569;
}

.actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-pill-edit {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.btn-pill-delete {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.btn-pill-edit:hover {
    background: #1e40af;
    border-color: #1e40af;
}

.btn-pill-delete:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.table-empty-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 22px;
    color: #64748b;
    font-size: 13px;
}

.os-pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.table-summary {
    color: #475569;
    font-size: 13px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.pagination a:hover {
    background: #f3f4f6;
}

.pagination .active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.pagination .disabled {
    color: #9ca3af;
    background: #f9fafb;
}

/* Ajuste para esta tela ficar mais parecida com a antiga */
.page-content {
    padding: 18px;
}

.topbar {
    display: none;
}

@media (max-width: 900px) {
    .os-filters-bar,
    .filters-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .os-actions-top {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .global-filter-input,
    .btn,
    .btn-outline {
        width: 100%;
    }

    .table-wrap {
        max-height: calc(100vh - 220px);
    }
}


.alert-ok {
    background: #ecfdf5;
    border: 1px solid #22c55e;
    color: #166534;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

.alert-erro {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 150;
    padding: 16px;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px;
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
    border: 1px solid #e5e7eb;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #64748b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 14px;
    margin-top: 6px;
}

.form-group-os label {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: #374151;
    font-weight: 600;
}

.form-group-os input,
.form-group-os select,
.form-group-os textarea {
    width: 100%;
    padding: 8px 9px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    background: #ffffff;
}

.form-group-os textarea {
    min-height: 90px;
    resize: vertical;
}

.form-group-full {
    margin-top: 12px;
}

.form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.anexo-box {
    padding: 11px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    margin-top: 12px;
    font-size: 12px;
    color: #374151;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.remove-anexo-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

/* ==============================
   Tabelas interativas
   - redimensionar colunas
   - ordenar A-Z / Z-A
============================== */

.table-interactive th[data-column] {
    user-select: none;
    padding-right: 28px;
}

.sortable-column {
    cursor: pointer;
    position: sticky;
}

.sortable-column:hover {
    background: #eef2ff !important;
}

.sort-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    font-size: 11px;
    color: #64748b;
    opacity: 0.75;
}

.sort-asc .sort-indicator,
.sort-desc .sort-indicator {
    color: #1d4ed8;
    opacity: 1;
    font-weight: 800;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 9px;
    height: 100%;
    cursor: col-resize;
    z-index: 20;
}

.column-resize-handle::after {
    content: "";
    position: absolute;
    top: 25%;
    right: 3px;
    width: 1px;
    height: 50%;
    background: #cbd5e1;
    opacity: 0;
    transition: 0.15s ease;
}

.table-interactive th[data-column]:hover .column-resize-handle::after {
    opacity: 1;
}

body.is-resizing-column {
    cursor: col-resize !important;
    user-select: none;
}

body.is-resizing-column * {
    cursor: col-resize !important;
}

.modal-dialog-wide {
    max-width: 860px;
}

.grupo-form {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.grupo-list-wrap {
    width: 100%;
    max-height: 45vh;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}