.rma-control-pro-wrap {
    max-width: 1280px;
}

.rma-actions-top {
    margin: 12px 0 18px;
}

.rma-quick-import-card textarea {
    min-height: 180px;
    margin-top: 8px;
    font-family: Consolas, monospace;
}

.rma-quick-import-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.rma-quick-import-actions .description {
    margin: 0;
}

.rma-quick-import-queue,
.rma-quick-import-results {
    margin-top: 10px;
}

.rma-quick-import-queue-list,
.rma-quick-import-created-list,
.rma-quick-import-error-list {
    margin: 8px 0 0 18px;
}

.rma-quick-import-queue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

/* ── Dashboard legado (mantido por compatibilidade) ─────────────────── */
.rma-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

/* ── Dashboard novo ─────────────────────────────────────────────────── */
.rma-dash-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}

.rma-dash-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    min-width: 0;
    overflow: hidden;
    transition: box-shadow .15s, transform .15s;
}

a.rma-dash-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    transform: translateY(-2px);
    text-decoration: none;
}

.rma-dash-card > div {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.rma-dash-card-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.rma-dash-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rma-dash-card-label {
    font-size: 11px;
    color: #646970;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rma-dash-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.rma-dash-panel {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.rma-dash-panel-wide {
    grid-column: span 2;
}

.rma-dash-panel-full {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 16px;
}

.rma-dash-panel-title {
    margin: 0 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.rma-dash-empty {
    color: #646970;
    font-size: 13px;
    margin: 0;
}

/* Gráfico de barras verticais */
.rma-dash-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 140px;
    padding-bottom: 28px;
    position: relative;
}

.rma-dash-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.rma-dash-bar-wrap {
    width: 100%;
    max-width: 40px;
    height: 100px;
    display: flex;
    align-items: flex-end;
}

.rma-dash-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height .3s ease;
}

.rma-dash-bar-label {
    font-size: 10px;
    color: #646970;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
}

.rma-dash-bar-value {
    font-size: 11px;
    font-weight: 600;
    color: #1d2327;
    text-align: center;
}

/* Lista de status com barra horizontal */
.rma-dash-status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rma-dash-status-row {
    display: grid;
    grid-template-columns: 130px 1fr 60px;
    align-items: center;
    gap: 8px;
}

.rma-dash-status-name {
    font-size: 12px;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rma-dash-status-bar-wrap {
    background: #f0f0f1;
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.rma-dash-status-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .3s ease;
}

.rma-dash-status-count {
    font-size: 12px;
    font-weight: 600;
    color: #1d2327;
    text-align: right;
    white-space: nowrap;
}

.rma-dash-status-count small {
    font-weight: 400;
    color: #646970;
}

/* Tabela recentes */
.rma-dash-recent-table {
    border-radius: 6px;
    overflow: hidden;
}

.rma-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

/* ── Galeria de fotos ───────────────────────────────────────────────── */
.rma-gallery-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 20px;
}

.rma-gallery-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}

.rma-gallery-count {
    background: #f0f0f1;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    color: #646970;
}

.rma-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.rma-gallery-item {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .15s, transform .15s;
}

.rma-gallery-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    transform: translateY(-2px);
}

.rma-gallery-item img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}

.rma-gallery-item-label {
    padding: 6px 8px;
    font-size: 11px;
    color: #646970;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f9f9f9;
    border-top: 1px solid #f0f0f1;
}

/* Lightbox */
.rma-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.rma-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.rma-lightbox-content img {
    max-width: 90vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.rma-lightbox-label {
    color: #fff;
    font-size: 13px;
    text-align: center;
}

.rma-lightbox-actions {
    display: flex;
    gap: 8px;
}

.rma-lightbox-prev,
.rma-lightbox-next {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 24px;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}

.rma-lightbox-prev:hover,
.rma-lightbox-next:hover {
    background: rgba(255,255,255,.3);
}

.rma-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.rma-lightbox-close:hover {
    background: rgba(255,255,255,.3);
}

/* ── Histórico de alterações (audit log) ────────────────────────────── */
.rma-audit-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 16px;
    flex-wrap: wrap;
}

.rma-audit-count {
    color: #646970;
    font-size: 13px;
    margin-bottom: 12px;
}

.rma-audit-table {
    font-size: 13px;
}

.rma-audit-table th,
.rma-audit-table td {
    vertical-align: middle;
}

.rma-audit-date {
    white-space: nowrap;
    color: #646970;
    font-size: 12px;
}

.rma-audit-detalhe {
    max-width: 280px;
    word-break: break-word;
    color: #646970;
    font-size: 12px;
}

.rma-audit-acao {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #f0f0f1;
    color: #1d2327;
}

.rma-audit-acao-create {
    background: #d1fae5;
    color: #065f46;
}

.rma-audit-acao-status {
    background: #dbeafe;
    color: #1e40af;
}

.rma-audit-acao-upload {
    background: #fef3c7;
    color: #92400e;
}

/* ── Status inline na lista ─────────────────────────────────────────── */
.rma-inline-status-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    width: 100%;
    min-width: 0;
}

.rma-inline-status-select {
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #dcdcde;
    background: #f9f9f9;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    transition: border-color .15s, box-shadow .15s;
}

.rma-inline-status-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.rma-inline-status-select.rma-status-saving {
    opacity: .6;
    pointer-events: none;
}

.rma-inline-status-select.rma-status-saved {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e;
}

/* SLA */
.rma-inline-status-wrap.rma-sla-warning .rma-inline-status-select {
    border-color: #f59e0b;
    background: #fffbeb;
}

.rma-inline-status-wrap.rma-sla-critical .rma-inline-status-select {
    border-color: #ef4444;
    background: #fef2f2;
}

.rma-sla-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 20px;
    background: #fef3c7;
    color: #92400e;
    white-space: nowrap;
}

.rma-sla-critical .rma-sla-badge {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Barra de progresso de status ───────────────────────────────────── */
.rma-status-progress {
    display: flex;
    align-items: center;
    margin: 14px 0 20px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    padding: 14px 20px;
    overflow-x: auto;
    gap: 0;
}

.rma-sp-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    min-width: 80px;
    position: relative;
}

.rma-sp-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dcdcde;
    border: 2px solid #dcdcde;
    display: block;
    transition: background .2s;
}

.rma-sp-label {
    font-size: 10px;
    color: #646970;
    margin-top: 5px;
    text-align: center;
    white-space: nowrap;
}

.rma-sp-done .rma-sp-dot {
    background: #22c55e;
    border-color: #22c55e;
}

.rma-sp-done .rma-sp-label {
    color: #166534;
}

.rma-sp-active .rma-sp-dot {
    background: #2271b1;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,.2);
}

.rma-sp-active .rma-sp-label {
    color: #2271b1;
    font-weight: 700;
}

.rma-sp-line {
    flex: 1;
    height: 2px;
    background: #dcdcde;
    align-self: flex-start;
    margin-top: 20px;
    min-width: 20px;
    transition: background .2s;
}

.rma-sp-line-done {
    background: #22c55e;
}

/* ── Botão salvar e marcar Recebido ─────────────────────────────────── */
.rma-btn-save-recebido {
    background: #dcfce7 !important;
    border-color: #22c55e !important;
    color: #166534 !important;
}

.rma-btn-save-recebido:hover {
    background: #bbf7d0 !important;
}

/* ── Modal de confirmação status irreversível ───────────────────────── */
#rma-confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#rma-confirm-modal.is-open {
    display: flex;
}

.rma-confirm-box {
    background: #fff;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    text-align: center;
}

.rma-confirm-box h3 {
    margin-top: 0;
    font-size: 17px;
}

.rma-confirm-box p {
    color: #646970;
    margin-bottom: 20px;
}

.rma-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.rma-card,
.rma-form-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.rma-card h2,
.rma-card h3 {
    margin-top: 0;
}

.rma-card strong {
    font-size: 26px;
    color: #1d2327;
}

.rma-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.rma-field {
    margin-bottom: 14px;
}

.rma-field.full {
    width: 100%;
}

.rma-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

#rma_customer_hint {
    display: block;
    margin-top: 6px;
}

.rma-field input[type="text"],
.rma-field input[type="date"],
.rma-field input[type="datetime-local"],
.rma-field select,
.rma-field textarea {
    width: 100%;
}

.rma-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.rma-image-preview a {
    display: inline-flex;
}

.rma-image-preview img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dcdcde;
}

.rma-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}

.rma-badge.status-finalizado {
    background: #d1f3d6;
    color: #0a5c1f;
}

.rma-badge.status-andamento {
    background: #fff1c2;
    color: #7a5800;
}

.rma-badge.status-pendente {
    background: #ffd8d8;
    color: #8a1f1f;
}

.rma-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}

.rma-filters input,
.rma-filters select {
    min-width: 120px;
}

.rma-filters input[type="search"] {
    min-width: 260px;
}

.wp-list-table .column-numero_rma { width: 120px; }
.wp-list-table .column-cliente_nome { width: 180px; }
.wp-list-table .column-produto { width: 240px; }

.rma-sku-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.rma-nf-tag {
    display: inline-block;
    background: #f0f0f1;
    color: #50575e;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #c3c4c7;
    vertical-align: middle;
    white-space: nowrap;
}

.rma-itens-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
    max-width: 100%;
}
.wp-list-table .column-numero_serie { width: 190px; }
.wp-list-table .column-status_rma { width: 150px; }
.wp-list-table .column-tracking { width: 230px; }
.wp-list-table .column-data_entrada { width: 140px; }

/* Campo valor unitário nos itens RMA */
.rma-item-valor-wrap {
    min-width: 120px;
    max-width: 160px;
}
.rma-item-valor-unitario {
    width: 100%;
}

/* Cards de custo no dashboard */
.rma-dash-cost-header.rma-dash-panel {
    padding-bottom: 4px;
    border-bottom: none;
}
.rma-dash-cost-cards {
    margin-top: 8px;
}

.rma-list-table {
    table-layout: fixed;
}

.rma-list-table td,
.rma-list-table th {
    overflow: hidden;
}

.rma-tracking-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}

.rma-tracking-link-chip {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rma-compact-cell {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.wp-list-table td,
.wp-list-table th {
    vertical-align: top;
}

.rma-request-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rma-invoice-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.rma-invoice-upload input {
    flex: 1;
}

.rma-invoice-preview {
    margin-top: 10px;
}

/* ── Section cards (formulário) ─────────────────────────────────────── */
.rma-section-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
}

.rma-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
}

.rma-section-header h2 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: #1d2327;
    line-height: 1.4;
}

.rma-section-header .dashicons {
    color: #2271b1;
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.rma-section-card > .rma-form-grid,
.rma-section-card .rma-subsection .rma-form-grid {
    padding: 14px 18px 16px;
    margin: 0;
}

.rma-subsection + .rma-subsection {
    border-top: 1px solid #f0f0f1;
}

.rma-subsection-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #8c8f94;
    margin: 12px 18px 0;
    padding: 0;
}

/* Grid helpers */
.rma-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.rma-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.rma-field-span2 {
    grid-column: span 2;
}

@media (max-width: 1280px) {
    .rma-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .rma-field-span2 { grid-column: span 1; }
}

@media (max-width: 900px) {
    .rma-grid-3,
    .rma-grid-4 { grid-template-columns: 1fr; }
    .rma-field-span2 { grid-column: span 1; }
}

/* ── Items section card ──────────────────────────────────────────────── */
.rma-items-body {
    padding: 14px 18px 4px;
}

.rma-items-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px 16px;
}

.rma-items-footer #rma-add-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rma-items-footer .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1.1;
}

/* ── Barcode scanner ────────────────────────────────────────────────── */
.rma-barcode-scanner-wrap {
    background: #f0f7ff;
    border: 1.5px dashed #2271b1;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rma-barcode-label {
    font-weight: 600;
    color: #2271b1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rma-barcode-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rma-barcode-input {
    flex: 1;
    max-width: 360px;
    font-size: 15px;
    padding: 5px 10px;
    border: 2px solid #2271b1;
    border-radius: 4px;
}

.rma-barcode-status {
    font-size: 13px;
    min-height: 20px;
}

/* ── Item row card ──────────────────────────────────────────────────── */
.rma-item-row {
    background: #fafafa;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.rma-item-row:hover {
    border-color: #c3c4c7;
    background: #fff;
}

.rma-item-top {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.rma-item-bottom {
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.rma-item-bottom > .rma-item-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    grid-column: span 3;
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
}

.rma-item-field > label {
    font-size: 11px;
    font-weight: 600;
    color: #646970;
    line-height: 1;
}

.rma-item-field select,
.rma-item-field input[type="text"] {
    width: 100%;
}

.rma-item-field input[type="number"] {
    width: 100%;
}

.rma-item-bottom > .rma-item-valor-wrap {
    grid-column: 10 / span 3;
    grid-row: 2;
}

.rma-item-bottom > .rma-item-document-invoice {
    grid-column: 1 / span 3;
    grid-row: 2;
}

.rma-item-bottom > .rma-item-document-customer-return {
    grid-column: 4 / span 3;
    grid-row: 2;
}

.rma-item-bottom > .rma-item-document-return {
    grid-column: 7 / span 3;
    grid-row: 2;
}

.rma-item-bottom > .rma-item-photo {
    grid-column: 13 / span 3;
    grid-row: 2;
}

.rma-item-valor-actions {
    margin-top: 4px;
}

.rma-item-valor-actions .button {
    width: 100%;
}

.rma-item-field input.rma-item-serial {
    border-color: #d63638;
    background: #fff5f5;
}

.rma-item-field input.rma-item-serial-rma {
    border-color: #2f8f46;
    background: #f2fff5;
}

.rma-item-field:has(> input.rma-item-serial) > label {
    color: #b32d2e;
}

.rma-item-field:has(> input.rma-item-serial-rma) > label {
    color: #1e6f35;
}

.rma-remove-item-icon {
    padding: 4px 8px !important;
    min-height: 30px;
    color: #d63638 !important;
    border-color: #d63638 !important;
    align-self: flex-end;
}

.rma-remove-item-icon:hover {
    background: #fce8e8 !important;
}

.rma-remove-item-icon .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1.1;
    pointer-events: none;
}

.rma-item-document,
.rma-item-photo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.rma-item-document .button,
.rma-item-photo .button {
    width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    min-height: 30px;
}

.rma-item-invoice-preview,
.rma-item-customer-return-invoice-preview,
.rma-item-return-invoice-preview,
.rma-item-image-preview {
    min-height: 88px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: flex-start;
}

.rma-attachment-origin {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.rma-attachment-origin-sharepoint {
    color: #0f4c81;
    background: #e8f2ff;
    border: 1px solid #cfe3ff;
}

.rma-attachment-origin-local {
    color: #1f6f3e;
    background: #eaf8ef;
    border: 1px solid #cdebd8;
}

.rma-item-image-preview img {
    max-width: 72px;
    max-height: 72px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    object-fit: cover;
}

.rma-item-image-origin {
    display: flex;
    align-items: center;
}

@media (max-width: 1100px) {
    .rma-item-top {
        grid-template-columns: 1fr auto;
    }

    .rma-item-sku-wrap {
        grid-column: 1 / 2;
    }

    .rma-item-name-wrap {
        grid-column: 1 / 2;
    }

    .rma-item-bottom {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
    }

    .rma-item-bottom > .rma-item-field,
    .rma-item-bottom > .rma-item-valor-wrap,
    .rma-item-bottom > .rma-item-document,
    .rma-item-bottom > .rma-item-photo,
    .rma-item-bottom > .rma-item-document-invoice,
    .rma-item-bottom > .rma-item-document-customer-return,
    .rma-item-bottom > .rma-item-document-return {
        grid-column: auto;
        grid-row: auto;
        padding: 9px;
    }
}

@media (max-width: 782px) {
    .rma-item-top,
    .rma-item-bottom {
        grid-template-columns: 1fr;
    }
}

.rma-shipping-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.rma-side-card {
    padding-bottom: 6px;
}

.rma-side-grid {
    grid-template-columns: repeat(1, minmax(220px, 1fr));
}

.rma-tracking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.rma-tracking-card {
    border: 1px solid #dcdcde;
    border-radius: 10px;
    padding: 14px;
    background: #fafafa;
}

.rma-tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rma-tracking-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.rma-import-tracking-file {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.rma-tracking-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.rma-tracking-service {
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    text-transform: uppercase;
}

.rma-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.rma-timeline-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    position: relative;
}

.rma-timeline-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 18px;
    bottom: -12px;
    width: 2px;
    background: #dcdcde;
}

.rma-timeline-item:last-child::before {
    display: none;
}

.rma-timeline-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #9aa0a6;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

.rma-timeline-item.is-current .rma-timeline-dot {
    background: #2271b1;
    box-shadow: 0 0 0 4px rgba(34, 113, 177, 0.15);
}

.rma-timeline-content strong {
    display: block;
    margin-bottom: 4px;
}

.rma-timeline-content p,
.rma-timeline-content small {
    display: block;
    margin: 0 0 4px;
}

.rma-timeline-date {
    font-size: 12px;
    color: #50575e;
}

.rma-tracking-link {
    margin: 10px 0 0;
}

.rma-monitor-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0 16px;
}

.rma-monitor-filter-form input[type="search"] {
    min-width: 280px;
}

.rma-monitor-filter-form select {
    min-width: 160px;
}

.rma-tracking-monitor-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 20px;
    align-items: start;
}

.rma-tracking-monitor-layout.is-single-column {
    grid-template-columns: 1fr;
}

.rma-monitor-group {
    margin-top: 16px;
    overflow: hidden;
}

.rma-monitor-group-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 8px;
}

.rma-monitor-group-title span {
    color: #50575e;
    font-size: 12px;
}

.rma-monitor-table {
    table-layout: fixed;
    width: 100%;
}

.rma-monitor-table th,
.rma-monitor-table td {
    padding: 8px 10px;
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.rma-monitor-table th:nth-child(1),
.rma-monitor-table td:nth-child(1) { width: 30%; }
.rma-monitor-table th:nth-child(2),
.rma-monitor-table td:nth-child(2) { width: 24%; }
.rma-monitor-table th:nth-child(3),
.rma-monitor-table td:nth-child(3) { width: 18%; }
.rma-monitor-table th:nth-child(4),
.rma-monitor-table td:nth-child(4) { width: 18%; }
.rma-monitor-table th:nth-child(5),
.rma-monitor-table td:nth-child(5) { width: 10%; text-align: center; }

.rma-monitor-table .rma-badge {
    margin: 0;
}

@media (max-width: 900px) {
    .rma-shipping-columns {
        grid-template-columns: 1fr;
    }

    .rma-tracking-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Permissões de usuário frontend ─────────────────────────────────── */
.rma-caps-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.rma-cap-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.rma-cap-label:has(input:checked) {
    border-color: #6366f1;
    background: #f0f4ff;
    color: #4338ca;
}

.rma-cap-label input[type="checkbox"] {
    margin: 0;
    accent-color: #6366f1;
}

/* ── [rma_login] ─────────────────────────────────────────────────────── */
.rma-login-card {
    max-width: 400px;
    margin: 0 auto;
}

.rma-login-title {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 700;
    color: #1d2327;
}

.rma-login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #b91c1c;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

.rma-login-form .rma-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.rma-login-form .rma-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.rma-login-form input[type="text"],
.rma-login-form input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color .15s;
}

.rma-login-form input[type="text"]:focus,
.rma-login-form input[type="password"]:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}

.rma-login-remember {
    flex-direction: row !important;
    align-items: center;
    gap: 6px !important;
}

.rma-login-btn {
    width: 100%;
    padding: 10px;
    font-size: 15px;
    font-weight: 600;
    margin-top: 4px;
}
