/*
 RAWA 2.0 — LEGIBILIDADE GLOBAL / LOTE PR #51
 Escopo: todos os modulos autenticados do ERP, modal de operacao,
 dashboard, catalogos, compras, estoque, fornecedores, veiculos,
 usuarios, configuracoes e navegacao mobile.

 Principios:
 - Priorizar texto de leitura de 13-14.5 px, inputs 14-16 px.
 - Titulos, montantes e status sem alterar semantica/cores.
 - Respeitar espaco de densidade das tabelas, com scroll horizontal onde necessario.
 - Contraste especifico light/dark; evitar preto duro em negritos e cinza apagado.
 - Nao redimensionar icones, abreviacoes, badges exclusivamente decorativos.
*/
html[data-theme="light"] {
  --rawa-global-text: #293b54;
  --rawa-global-secondary: #4f617a;
  --rawa-global-focus: #276de3;
}
html[data-theme="dark"] {
  --rawa-global-text: #e4edfb;
  --rawa-global-secondary: #b9c9df;
  --rawa-global-focus: #91bcff;
}

/* Hierarquia editorial comum de todos os modulos. */
#app-view .rawa-module-page {
  font-size: 14.5px !important;
  line-height: 1.55 !important;
}
#app-view .rawa-module-page :is(.hero-row p,.module-header p,.page-intro p,.office-config-intro p),
#app-view :is(.panel-header > span,.panel-header > p,.module-kicker,.dashboard-kicker,.dashboard-date-card span,.reference-date) {
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view .module-kicker,
#app-view .dashboard-kicker,
#app-view :is(.eyebrow,.office-section-heading .eyebrow) {
  font-size: 12px !important;
  letter-spacing: .06em !important;
  line-height: 1.4 !important;
}
/* Preserve deliberate accent labels, but make them readable against each theme. */
html[data-theme="light"] #app-view .module-kicker,
html[data-theme="light"] #app-view .dashboard-kicker { color:#1d65ca !important; }
html[data-theme="dark"] #app-view .module-kicker,
html[data-theme="dark"] #app-view .dashboard-kicker { color:#92bcff !important; }

/* Tabelas em todos os modulos, inclusive os mais antigos que nao usam .rawa-module-page. */
#app-view :is(.table-sub,.table-footer,.table-empty),
.modal-backdrop :is(.table-sub,.table-footer,.table-empty) {
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.data-table,.report-table,.user-table,.estoque-table,.purchase-table,.fornecedor-table,.os-table) td,
.modal-backdrop :is(.data-table,.report-table,.user-table,.estoque-table,.purchase-table,.fornecedor-table,.os-table) td {
  font-size: 14px !important;
  line-height: 1.55 !important;
}
#app-view :is(.data-table,.report-table,.user-table,.estoque-table,.purchase-table,.fornecedor-table,.os-table) th,
.modal-backdrop :is(.data-table,.report-table,.user-table,.estoque-table,.purchase-table,.fornecedor-table,.os-table) th {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
  font-weight: 700 !important;
}
#app-view :is(.data-table,.report-table) .table-main,
.modal-backdrop :is(.data-table,.report-table) .table-main {
  color: var(--rawa-global-text) !important;
  font-size: 14px !important;
  line-height: 1.48 !important;
  font-weight: 650 !important;
}
#app-view :is(.table-footer,.data-panel .table-sub) strong {
  font-weight: 700 !important;
}

/* Legendas estatisticas: valor grande permanece grande, legenda legivel. */
#app-view :is(.rawa-module-page,.rawa-dashboard-page) .module-stat {
  font-size: 13px !important;
  line-height: 1.45 !important;
  min-height: 31px;
  font-weight: 650 !important;
}
#app-view :is(.rawa-module-page,.rawa-dashboard-page) .module-stat strong {
  font-size: 13.5px !important;
  font-weight: 700 !important;
}
#app-view .metric-card .metric-label {
  font-size: 12.5px !important;
  color: var(--rawa-global-secondary) !important;
  line-height: 1.45 !important;
  font-weight: 700 !important;
}
#app-view .metric-card .metric-detail,
#app-view .rawa-dashboard-page .quick-card span,
#app-view .rawa-dashboard-page .status-row span,
#app-view .rawa-dashboard-page .alert-item span,
#app-view .rawa-dashboard-page .dashboard-date-card small {
  color: var(--rawa-global-secondary) !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}
#app-view .metric-card .metric-value {
  color: var(--rawa-global-text) !important;
}

/* Formulario operacional, configuracoes, lancamentos e modais:
   nao ampliar input de checkbox/radio ou botoes apenas de icone. */
#app-view .field > span,
#app-view .field > label,
#app-view .office-config-page :is(.compact-field > span,.parameter-full > span),
.modal-backdrop .field > span,
.modal-backdrop .field > label,
.modal-backdrop .form-grid .field > span {
  font-size: 13.5px !important;
  line-height: 1.5 !important;
  font-weight: 650 !important;
  color: var(--rawa-global-text) !important;
}
#app-view .field small,
#app-view .field .field-help,
#app-view .office-config-card p,
#app-view .office-logo-card p,
#app-view .office-document-hint,
#app-view .office-readonly-note,
.modal-backdrop .field small,
.modal-backdrop .field > small,
.modal-backdrop .form-hint,
.modal-backdrop .help-text,
.modal-backdrop .modal-header p {
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),.field select,.field textarea),
.modal-backdrop :is(.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),.field select,.field textarea) {
  font-size: 14.5px !important;
  line-height: 1.5 !important;
}
#app-view :is(input,textarea)::placeholder,
.modal-backdrop :is(input,textarea)::placeholder {
  color: var(--rawa-global-secondary) !important;
  opacity: 1 !important;
}
/* Blocos sem HTML de campo padrao, usados pelos modulos mais recentes. */
#app-view :is(.search-box input,.toolbar-select,.module-toolbar input,.module-toolbar select),
#app-view :is(.finance-caixa-filter input,.finance-caixa-filter select,.reports-filter input,.reports-filter select),
.modal-backdrop :is(.rawa-select-trigger,.rawa-select-value) {
  font-size: 14px !important;
}
#app-view .module-toolbar button:not(.icon-button),
#app-view .rawa-module-page :is(.row-action,.secondary-button,.action-button) {
  font-size: 13.5px !important;
  line-height: 1.4 !important;
}
.modal-backdrop :is(.row-action,.action-button,.secondary-button,.mini-action) {
  font-size: 13px !important;
  line-height: 1.45 !important;
}
.modal-backdrop .modal-body {
  font-size: 14.5px !important;
  line-height: 1.55 !important;
}
.modal-backdrop .modal-header h3 {
  color: var(--rawa-global-text) !important;
  font-weight: 700 !important;
}
.modal-backdrop :is(.form-error,.os-empty-items,.page-loading,.empty-state p),
#app-view :is(.empty-state p,.page-loading,.os-empty-items) {
  font-size: 13px !important;
  line-height: 1.55 !important;
}

/* Listas auxiliares presentes em varios modulos: estoque, compras,
   fornecedores, usuarios, perfis, configuracoes e checklists. */
#app-view :is(.estoque-kpi,.purchase-kpis,.purchase-api-note,.purchase-note,.purchase-item-progress,.purchase-receipt-meta),
#app-view :is(.supplier-link-item,.supplier-link-flags,.supplier-purchase-item,.management-note,.profile-card,.permission-list),
#app-view :is(.vehicle-preset-manager,.preset-hint,.preset-save-hint,.preset-search-label,.vehicle-preset-advanced summary),
.modal-backdrop :is(.estoque-history-item,.mov-main,.mov-cost,.reposicao-summary,.purchase-item-card,.purchase-receipt-meta,.purchase-idempotency) {
  font-size: 13px !important;
  line-height: 1.55 !important;
}
#app-view :is(.purchase-api-note,.purchase-note,.purchase-item-progress,.purchase-receipt-meta,.management-note,.preset-hint,.preset-save-hint),
.modal-backdrop :is(.purchase-receipt-meta,.purchase-idempotency,.os-section-header span,.os-item-main small,.os-item-side small) {
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.vehicle-preset-manager label,.vehicle-preset-manager strong,.preset-search-label,.vehicle-preset-advanced summary),
.modal-backdrop :is(.vehicle-preset-save strong,.purchase-section-head strong,.purchase-receipts-head strong) {
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: var(--rawa-global-text) !important;
}
#app-view :is(.vehicle-color-label,.vehicle-color-choice) {
  font-size: 13px !important;
  line-height: 1.45 !important;
}
#app-view .rawa-users-page :is(.permission-pill,.self-badge),
.modal-backdrop :is(.permission-pill,.self-badge) {
  font-size: 12px !important;
}

/* Elementos pequenos de fluxo operacional — evitar forcar a vista. */
.modal-backdrop .os-detail-modal :is(.os-summary-top,.os-description,.os-detail-section,.os-item-main,.os-item-side,.os-section-header),
.modal-backdrop :is(.purchase-receipt-card,.purchase-receipt-top,.purchase-receipt-items,.supplier-link-form,.supplier-links-list) {
  font-size: 13px !important;
  line-height: 1.55 !important;
}
.modal-backdrop .os-detail-modal :is(.os-summary-top strong,.os-description strong,.os-item-main strong,.os-item-side strong) {
  color: var(--rawa-global-text) !important;
  font-weight: 650 !important;
}
.modal-backdrop .os-detail-modal :is(.os-summary-top span,.os-description span,.os-section-header span,.os-item-main small) {
  color: var(--rawa-global-secondary) !important;
}

/* Navegacao, cabecalho e acoes de facil toque — desktop e mobile. */
#app-view .menu-section-title { font-size: 12px !important; line-height: 1.5 !important; }
#app-view .sidebar-user :is(span,small),
#app-view .user-chip-copy small,
#app-view .topbar .eyebrow {
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view .menu-item { font-size: 14px !important; }
.v11-mobile-nav button:not(.icon-only) {
  font-size: 11.5px !important;
  line-height: 1.25 !important;
  min-height: 52px !important;
}
#app-view .toast-container .toast,
.toast-container .toast {
  font-size: 13.5px !important;
  line-height: 1.5 !important;
}

/* Estado desabilitado precisa continuar distinguivel, mas sem sumir. */
#app-view :is(input,textarea,select):disabled,
.modal-backdrop :is(input,textarea,select):disabled {
  opacity: .75 !important;
}

/* Indicacao de foco acessivel para controles de teclado. */
#app-view :is(input,select,textarea,button,a):focus-visible,
.modal-backdrop :is(input,select,textarea,button,a):focus-visible {
  outline: 2px solid var(--rawa-global-focus) !important;
  outline-offset: 2px;
}

/* Tela estreita: texto legivel sem quebrar tabelas e grupos de estatistica. */
@media (max-width: 760px) {
  #app-view :is(.data-table-wrap,.report-table-wrap) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #app-view .rawa-module-page .module-stat { font-size: 12.5px !important; }
  #app-view .rawa-module-page .table-sub,
  .modal-backdrop .table-sub { font-size: 12.5px !important; }
  #app-view .rawa-module-page :is(.data-table,.report-table) th {
    font-size: 12.5px !important;
  }
  .modal-backdrop .form-grid .field small { font-size: 12.5px !important; }
  .v11-mobile-nav button:not(.icon-only) { font-size: 11px !important; }
}
@media (max-width: 420px) {
  #app-view .rawa-module-page .hero-row p { font-size: 13px !important; }
  #app-view .rawa-module-page :is(.module-stat,.module-stat strong) {
    font-size: 12.5px !important;
  }
}


/* SUBCOMPONENTES DIAGNOSTICADOS EM 8–11 PX QUE NAO HERDAM
   O TAMANHO DA PAGINA POR USAREM FONT-SIZE PROPRIO. */
#app-view .rawa-estoque-page .estoque-kpi span,
#app-view .rawa-compras-page .purchase-kpis span,
#app-view .rawa-pecas-page .peca-photo-thumb span,
#app-view .rawa-pecas-page :is(.commission-preview span,.commission-preview small),
.modal-backdrop :is(.commission-preview span,.commission-preview small) {
  font-size: 12.5px !important;
  line-height: 1.5 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view .rawa-estoque-page .estoque-kpi strong,
#app-view .rawa-compras-page .purchase-kpis strong {
  color: var(--rawa-global-text) !important;
  font-weight: 700 !important;
}
#app-view :is(.vehicle-preset-save small,.vehicle-preset-config small,
  .cliente-veiculo-shortcut > span,.preset-save-hint),
.modal-backdrop :is(.vehicle-preset-save small,.vehicle-preset-config small,
  .cliente-veiculo-shortcut > span,.inline-section-head span) {
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.preset-chip,.vehicle-preset-manager .preset-chip,.preset-add-row button),
.modal-backdrop .vehicle-preset-save strong {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
}
#app-view .vehicle-color-palette-title,
.modal-backdrop .vehicle-color-palette-title {
  font-size: 13px !important;
  font-weight: 700 !important;
}
#app-view .rawa-module-page :is(.status-badge,.os-status) {
  font-size: 12px !important;
  line-height: 1.4 !important;
  font-weight: 700 !important;
}
.modal-backdrop :is(.peca-gallery-card strong,.peca-gallery-upload,.peca-gallery-preview,
  .peca-gallery-upload input,.barcode-reader-help,.barcode-reader-status,
  .weekly-history-item span,.weekly-explanation,.cliente-finance-setting small) {
  font-size: 13px !important;
  line-height: 1.5 !important;
}
.modal-backdrop .peca-gallery-preview span,
#app-view .rawa-pecas-page .peca-photo-thumb span {
  color: var(--rawa-global-secondary) !important;
}

/* DASHBOARD V11: atividades, atalhos, menu de acoes, indicacoes de versao
   e etapas da OS tinham diversos rotulos entre 8 e 11 px. */
#app-view :is(.v11-panel-head span,.v11-activity-item span,.v11-activity-item time,
  .v11-shortcut small,.v11-command-copy span,.v11-command-empty,.v11-version-card),
:is(.v11-panel-head span,.v11-activity-item span,.v11-activity-item time,
  .v11-shortcut small,.v11-command-copy span,.v11-command-empty,.v11-version-card) {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.v11-command-section,.v11-command-type,.v11-os-step),
:is(.v11-command-section,.v11-command-type,.v11-os-step) {
  font-size: 11.5px !important;
  line-height: 1.45 !important;
}
#app-view :is(.v11-activity-item strong,.v11-shortcut b,.v11-command-copy strong),
:is(.v11-activity-item strong,.v11-shortcut b,.v11-command-copy strong) {
  font-size: 13.5px !important;
  line-height: 1.45 !important;
  color: var(--rawa-global-text) !important;
  font-weight: 700 !important;
}
:is(.v11-fab-menu button,.v11-install-button) {
  font-size: 13px !important;
  line-height: 1.4 !important;
}
:is(.v11-global-search-trigger > span,.v11-global-search-trigger input) {
  font-size: 13px !important;
}


/* Revisao complementar do CSS legado: excecoes de 8 a 11 px que
   nao estavam cobertas pelo primeiro lote global. */
#app-view #page-eyebrow {
  font-size: 12px !important;
  line-height: 1.45 !important;
  letter-spacing: .07em !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.session-chip,.user-menu-head span,.theme-picker-label,
  .theme-option small,.v11-notifications-head span,.v11-notification-item small) {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.theme-option strong,.v11-notification-item strong,
  .v11-notifications-head strong) {
  font-size: 13.5px !important;
  line-height: 1.4 !important;
  color: var(--rawa-global-text) !important;
}
#app-view .menu-badge {
  font-size: 11.5px !important;
  line-height: 1.4 !important;
  color: #d3def0 !important;
}
#app-view :is(.finance-list-row strong,.finance-history-item strong,
  .finance-extrato-row strong,.finance-daily-row strong) {
  font-size: 13.5px !important;
  line-height: 1.45 !important;
}
#app-view :is(.finance-list-row span,.finance-history-item span,
  .finance-history-item small,.finance-extrato-row span,
  .finance-daily-row span,.finance-empty-mini) {
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: var(--rawa-global-secondary) !important;
}
#app-view :is(.finance-tab,.finance-daily-row,.finance-balance-strip,
  .finance-error-box) {
  font-size: 13px !important;
  line-height: 1.5 !important;
}
#app-view .finance-bar-line {
  min-height: 24px !important;
}
#app-view .finance-bar-line small {
  font-size: 12px !important;
  line-height: 1.55 !important;
  padding-block: 3px !important;
}
#app-view .office-switch-card span {
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: var(--rawa-global-secondary) !important;
}
/* O dialogo de confirmacao pode ser montado fora de #app-view. */
.motrix-confirm-detail {
  font-size: 13px !important;
  line-height: 1.55 !important;
}
@media (max-width: 760px) {
  #app-view .finance-list-row {
    flex-wrap: wrap;
  }
  #app-view .finance-list-value {
    margin-left: auto;
  }
}


/* Evitar zoom automatico do Safari/iOS ao focar campos operacionais. */
@media (max-width: 760px) {
  #app-view :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="submit"]):not([type="button"]),select,textarea),
  .modal-backdrop :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="submit"]):not([type="button"]),select,textarea) {
    font-size: 16px !important;
  }
}
