/* RAWA — consistência dos módulos: alinhamento, legibilidade e navegação acessível */
#app-view .rawa-module-page .module-toolbar {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0;
}
#app-view .rawa-module-page .module-toolbar-left {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-flow: row wrap !important;
    align-items: center !important;
    gap: 10px !important;
    width: auto !important;
    min-width: 0;
}
#app-view .rawa-module-page .module-toolbar .search-box {
    flex: 1 1 240px !important;
    min-width: 190px;
    max-width: none !important;
    width: auto !important;
}
#app-view .rawa-module-page .module-toolbar .toolbar-select {
    flex: 0 1 190px !important;
    min-width: 135px;
    max-width: 225px !important;
    width: auto !important;
}
#app-view .rawa-module-page .module-toolbar .row-actions,
#app-view .rawa-module-page .barcode-trigger { flex: 0 0 auto; }
#app-view .rawa-module-page .module-toolbar :is(input, select, button) {
    min-height: 40px;
    font-size: 13px !important;
}
#app-view .rawa-module-page .module-toolbar button { white-space: nowrap; }
#app-view .rawa-module-page .os-period-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--v3-text);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}
#app-view .rawa-module-page .os-period-filter input {
    width: 133px;
    min-width: 0;
    border: 1px solid var(--v3-border);
    border-radius: 9px;
    padding: 0 8px;
    color: var(--v3-text);
    background: var(--v3-card);
}
#app-view .rawa-module-page .os-clear-filters { flex: 0 0 auto; }
#app-view .rawa-module-page .data-table-wrap { overflow-x: auto; max-width: 100%; }
#app-view .rawa-module-page .data-table {
    width: 100%;
    font-variant-numeric: tabular-nums;
}
#app-view .rawa-module-page .data-table th {
    font-size: 12px !important;
    line-height: 1.45 !important;
    white-space: nowrap;
    vertical-align: middle;
}
#app-view .rawa-module-page .data-table td {
    font-size: 12.5px !important;
    line-height: 1.5 !important;
    vertical-align: middle;
}
#app-view .rawa-module-page .table-main {
    font-size: 13px !important;
    font-weight: 720 !important;
    line-height: 1.45 !important;
}
#app-view .rawa-module-page .table-sub {
    font-size: 11.5px !important;
    line-height: 1.45 !important;
    color: var(--v3-muted) !important;
}
#app-view .rawa-module-page :is(.table-footer, .row-action, .os-status) { font-size: 12px !important; }
#app-view .rawa-module-page .field > span { font-size: 12.5px; font-weight: 650; }
#app-view .rawa-module-page :is(input, textarea, select, button):focus-visible {
    outline: 2px solid #3182f6;
    outline-offset: 2px;
}
#app-view .barcode-trigger { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
#app-view .barcode-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#app-view .barcode-reader-status { margin-top: 8px; font-size: 12px; color: var(--v3-muted); }
#app-view .barcode-reader-status.success { color: var(--v3-text); }
#app-view .barcode-reader-help { font-size: 12px; line-height: 1.5; color: var(--v3-muted); }
#app-view .barcode-reader-result { margin-top: 12px; border-radius: 10px; padding: 12px; background: var(--v3-card-2); }
@media (min-width: 1250px) {
    #app-view .rawa-module-page .module-toolbar,
    #app-view .rawa-module-page .module-toolbar-left { flex-wrap: nowrap !important; }
    #app-view .rawa-os-page .module-toolbar .search-box { flex-basis: 250px !important; }
}
@media (max-width: 1000px) {
    #app-view .rawa-module-page .module-toolbar { flex-wrap: wrap !important; }
    #app-view .rawa-module-page .module-toolbar-left {
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important;
    }
    #app-view .rawa-module-page .module-toolbar .search-box {
        flex: 1 1 100% !important;
        width: 100% !important;
    }
    #app-view .rawa-module-page .module-toolbar .toolbar-select { flex: 1 1 170px !important; max-width: none !important; }
}
@media (max-width: 560px) {
    #app-view .rawa-module-page .module-toolbar .toolbar-select { flex: 1 1 100% !important; }
    #app-view .rawa-module-page .os-period-filter { flex: 1 1 100%; justify-content: space-between; }
    #app-view .rawa-module-page .os-period-filter input { flex: 1 1 auto; }
    #app-view .rawa-module-page .module-toolbar .row-actions { width: 100%; }
}

/* Contraste de texto ajustado para superfícies claras e escuras. */
#app-view .rawa-module-page .data-table th,
#app-view .rawa-module-page .field > span {
    color: var(--v3-text) !important;
}
html[data-theme="light"] #app-view .rawa-module-page .table-sub,
html[data-theme="light"] #app-view .rawa-module-page .table-footer {
    color: #475569 !important;
}
html[data-theme="dark"] #app-view .rawa-module-page .table-sub,
html[data-theme="dark"] #app-view .rawa-module-page .table-footer {
    color: #cbd5e1 !important;
}
html[data-theme="light"] #app-view .rawa-module-page .module-toolbar input::placeholder {
    color: #64748b;
}
html[data-theme="dark"] #app-view .rawa-module-page .module-toolbar input::placeholder {
    color: #cbd5e1;
}
.rawa-scanner-modal .barcode-reader-help,
.modal-backdrop .barcode-reader-help {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--v3-muted);
}
.rawa-scanner-modal .barcode-reader-status {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--v3-text);
}
.rawa-scanner-modal .barcode-reader-status.success {
    font-weight: 650;
}

/* Histórico de atendimento — modal aproveita os dados reais do catálogo e da OS. */
.client-history-modal { width: min(1050px, calc(100vw - 32px)); max-height: min(90vh, 880px); }
.client-history-modal .modal-body { overflow-y: auto; }
.client-history-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.client-history-kpis article { border: 1px solid var(--v3-border); background: var(--v3-card-2); padding: 14px; border-radius: 12px; min-width: 0; }
.client-history-kpis span { display:block; color:var(--v3-muted); font-size:12px; line-height:1.45; }
.client-history-kpis strong { display:block; color:var(--v3-text); font-size:17px; margin-top:5px; overflow-wrap:anywhere; }
.client-history-modal h4 { font-size: 15px; margin: 0 0 6px; }
.client-history-help { color:var(--v3-muted); font-size:12px; line-height:1.5; }
@media(max-width:620px){ .client-history-kpis { grid-template-columns:1fr; } .client-history-modal { width: min(100vw - 12px, 1050px); } }

.peca-list-item { display:flex; align-items:center; gap:12px; min-width:205px; }
.peca-list-item > div:last-child { min-width:0; }
.peca-photo-thumb { flex:0 0 48px; height:48px; border:1px solid var(--v3-border); border-radius:9px; background:var(--v3-card-2); overflow:hidden; display:grid; place-items:center; }
.peca-photo-thumb img { width:100%; height:100%; object-fit:cover; }
.peca-photo-thumb span { color:var(--v3-muted); font-size:9px; text-align:center; }
#peca-gallery { margin-top:22px; padding-top:16px; border-top:1px solid var(--v3-border); }
#peca-gallery h4 { margin:0 0 5px; font-size:14px; }
#peca-gallery p,.peca-gallery-hint { color:var(--v3-muted); font-size:12px; line-height:1.5; }
.peca-gallery-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:12px; }
.peca-gallery-card { min-width:0; border:1px solid var(--v3-border); border-radius:12px; padding:10px; display:flex; flex-direction:column; gap:9px; background:var(--v3-card); }
.peca-gallery-card strong { font-size:12px; color:var(--v3-text); }
.peca-gallery-preview { width:100%; aspect-ratio:4/3; border-radius:8px; background:var(--v3-card-2); color:var(--v3-muted); display:grid; place-items:center; font-size:12px; overflow:hidden; }
.peca-gallery-preview img { width:100%; height:100%; object-fit:contain; }
.peca-gallery-upload { display:block; font-size:12px; border:1px solid var(--v3-border); padding:8px; text-align:center; border-radius:8px; cursor:pointer; }
.peca-gallery-upload input { display:block; width:100%; font-size:11px; margin-top:8px; }
.peca-gallery-actions { display:flex; flex-wrap:wrap; gap:6px; }
@media(max-width:640px) { .peca-gallery-grid { grid-template-columns:1fr; } }
.os-checklist-modal { width:min(760px,calc(100vw - 20px)); max-height:90vh; }
.os-checklist-modal .modal-body { overflow-y:auto; }
.os-checklist-tabs { display:flex; gap:8px; margin-bottom:15px; }
.os-checklist-tabs .active { border-color:#3182f6 !important; }
.os-checklist-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
@media(max-width:560px) { .os-checklist-grid { grid-template-columns:1fr; } }

.weekly-billing-modal { width:min(860px,calc(100vw - 20px)); max-height:90vh; }
.weekly-billing-modal .modal-body { overflow-y:auto; }
.weekly-explanation { font-size:12.5px; color:var(--v3-muted); line-height:1.55; margin:12px 0; }
.weekly-summary { display:flex; flex-wrap:wrap; align-items:center; gap:12px; background:var(--v3-card-2); border:1px solid var(--v3-border); border-radius:12px; padding:14px; margin:14px 0; color:var(--v3-text); }
.weekly-summary b,.weekly-summary strong { font-size:15px; }
.weekly-billing-modal .data-table-wrap { margin:12px 0; }
.weekly-history { display:flex; flex-direction:column; gap:8px; }
.weekly-history-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:11px; border:1px solid var(--v3-border); border-radius:9px; }
.weekly-history-item strong,.weekly-history-item span { display:block; }
.weekly-history-item span { color:var(--v3-muted); font-size:12px; margin-top:3px; }
.cliente-finance-setting strong { font-size:13px; }
.cliente-finance-setting small { font-size:12px; color:var(--v3-muted); }
@media (max-width:600px) { .weekly-history-item { flex-direction:column; align-items:stretch; } }
