/* RAWA | Legibilidade e status v1 — camada final (dark e light)
 * Modais ficam fora do #app-view. Alteracao estritamente de apresentacao.
 * Nunca deduzir pagamento pela situacao da OS.
 */

/* Fontes que estavam em 9–12px: ampliar sem comprometer tabelas densas. */
#app-view .rawa-module-page { font-size: 15px; line-height: 1.52; }
#app-view .rawa-module-page .hero-row p,
#app-view .rawa-module-page .table-footer,
#app-view .rawa-module-page .table-empty,
#app-view .rawa-module-page .module-stat,
#app-view .rawa-module-page .module-stat strong { font-size: 13.5px !important; line-height: 1.5 !important; }
#app-view .rawa-module-page :is(.data-table,.report-table) th,
.modal-backdrop :is(.data-table,.report-table) th {
    font-size: 13px !important;
    font-weight: 760 !important;
    letter-spacing: .035em !important;
    line-height: 1.45 !important;
    text-transform: uppercase;
}
#app-view .rawa-module-page :is(.data-table,.report-table) td,
.modal-backdrop :is(.data-table,.report-table) td {
    font-size: 14px !important;
    line-height: 1.55 !important;
    vertical-align: middle;
}
#app-view .rawa-module-page .table-main,
.modal-backdrop .table-main { font-size: 14.5px !important; line-height: 1.45 !important; font-weight: 730 !important; }
#app-view .rawa-module-page .table-sub,
.modal-backdrop .table-sub { font-size: 12.5px !important; line-height: 1.5 !important; margin-top: 4px; }
#app-view .rawa-module-page .row-action,
.modal-backdrop .row-action { font-size: 13px !important; min-height: 36px; padding: 7px 10px; }
#app-view .rawa-module-page :is(.status-badge,.os-status),
.modal-backdrop :is(.status-badge,.os-status) { font-size: 12.5px !important; }
#app-view .rawa-module-page .module-toolbar :is(input,select,button) {
    font-size: 14px !important;
    min-height: 42px !important;
}
#app-view .rawa-module-page .field > span,
.modal-backdrop .field > span,
.modal-backdrop .field > label {
    font-size: 13.5px !important;
    font-weight: 680 !important;
    text-transform: uppercase;
    letter-spacing: .025em;
}
.modal-backdrop .field small,
.modal-backdrop .modal-header p,
.modal-backdrop .client-history-help,
.modal-backdrop .weekly-explanation { font-size: 13px !important; line-height: 1.5 !important; }
.modal-backdrop .modal-body { font-size: 14px; line-height: 1.55; }
.modal-backdrop .modal-header h3 { font-size: 19px !important; line-height: 1.35 !important; }
.modal-backdrop .client-history-kpis span { font-size: 13px !important; }
.modal-backdrop .client-history-kpis strong { font-size: 18px !important; }
.modal-backdrop .client-history-modal h4 { font-size: 16px !important; }

/* Navegacao tambem estava muito pequena em telas comuns. */
#app-view .menu-item { font-size: 14px !important; line-height: 1.42 !important; }
#app-view .menu-section-title { font-size: 11.5px !important; letter-spacing: .10em !important; }
#app-view .sidebar-user strong { font-size: 13px !important; }
#app-view .sidebar-user span { font-size: 12px !important; }
#app-view .topbar .eyebrow { font-size: 11.5px !important; letter-spacing: .09em !important; }
#app-view .topbar h1 { font-size: 17px !important; }

/* Nomenclaturas e titulos, sem mexer em email, senha, URL nem IDs fiscais. */
#app-view .rawa-servicos-page .table-main,
#app-view .rawa-pecas-page .table-main,
.modal-backdrop #servico-form input[name="nome"],
.modal-backdrop #servico-form input[name="codigo"],
.modal-backdrop #peca-form input[name="nome"],
.modal-backdrop #peca-form input[name="codigo"],
#app-view .rawa-module-page :is(.data-table,.report-table) thead th {
    text-transform: uppercase;
}

/* Zebra universal em tabelas e listas operacionais. Usa as CELULAS:
 * alguns estilos herdados pintam os td de branco, ignorando o fundo do tr. */
html[data-theme="dark"] #app-view .rawa-module-page,
html[data-theme="dark"] .modal-backdrop {
    --rawa-list-a: #18273d;
    --rawa-list-b: #21334e;
    --rawa-list-hover: #294363;
}
html[data-theme="light"] #app-view .rawa-module-page,
html[data-theme="light"] .modal-backdrop {
    --rawa-list-a: #ffffff;
    --rawa-list-b: #eff4fa;
    --rawa-list-hover: #e5effc;
}
#app-view .rawa-module-page :is(.data-table,.report-table) tbody tr:nth-of-type(odd) > td,
.modal-backdrop :is(.data-table,.report-table) tbody tr:nth-of-type(odd) > td {
    background-color: var(--rawa-list-a) !important;
}
#app-view .rawa-module-page :is(.data-table,.report-table) tbody tr:nth-of-type(even) > td,
.modal-backdrop :is(.data-table,.report-table) tbody tr:nth-of-type(even) > td {
    background-color: var(--rawa-list-b) !important;
}
#app-view .rawa-module-page :is(.data-table,.report-table) tbody tr:hover > td,
#app-view .rawa-module-page :is(.data-table,.report-table) tbody tr:focus-within > td,
.modal-backdrop :is(.data-table,.report-table) tbody tr:hover > td,
.modal-backdrop :is(.data-table,.report-table) tbody tr:focus-within > td {
    background-color: var(--rawa-list-hover) !important;
}
#app-view .rawa-module-page :is(.data-table,.report-table) td,
.modal-backdrop :is(.data-table,.report-table) td { transition: background-color .12s ease; }
html[data-theme="dark"] #app-view .rawa-module-page :is(.data-table,.report-table) td,
html[data-theme="dark"] .modal-backdrop :is(.data-table,.report-table) td {
    color: #e3ecf8 !important;
    border-bottom-color: rgba(171,195,226,.18) !important;
}
html[data-theme="dark"] #app-view .rawa-module-page :is(.data-table,.report-table) th,
html[data-theme="dark"] .modal-backdrop :is(.data-table,.report-table) th {
    background: #15243a !important;
    color: #e5eefb !important;
    border-bottom: 1px solid rgba(171,195,226,.22) !important;
}
html[data-theme="dark"] .modal-backdrop :is(.data-table-wrap,.report-table-wrap,.data-table,.report-table) {
    background: #18273d !important;
    color: #e4eefb !important;
    border-color: rgba(171,195,226,.20) !important;
}
/* Sobretudo no historico: proibir linhas com fundo branco e texto quase branco. */
html[data-theme="dark"] .client-history-modal .data-table-wrap {
    overflow-x: auto !important;
    max-width: 100%;
    border-radius: 11px;
}
html[data-theme="dark"] .client-history-modal .data-table { min-width: 760px; border-spacing: 0; }
html[data-theme="dark"] .client-history-modal .table-main,
html[data-theme="dark"] .client-history-modal .table-sub,
html[data-theme="dark"] .client-history-modal .client-history-help {
    color: #d4e1f2 !important;
}

/* Itens em listas que nao usam table/tr. */
html[data-theme="dark"] :is(#app-view,.modal-backdrop) :is(
    .weekly-history-item,.estoque-history-item,.supplier-purchase-item,
    .supplier-link-item,.purchase-item-card
):nth-child(even) { background-color: #21334e !important; }
html[data-theme="dark"] :is(#app-view,.modal-backdrop) :is(
    .weekly-history-item,.estoque-history-item,.supplier-purchase-item,
    .supplier-link-item,.purchase-item-card
):nth-child(odd) { background-color: #18273d !important; }
html[data-theme="light"] :is(#app-view,.modal-backdrop) :is(
    .weekly-history-item,.estoque-history-item,.supplier-purchase-item,
    .supplier-link-item,.purchase-item-card
):nth-child(even) { background-color: #eff4fa !important; }

/* Historico: cor indica estados diferentes, sem alterar o valor do status.
 * Pago = verde, pendente = ambar, concluido = azul, outros neutros. */
.rawa-status-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12.5px;
    line-height: 1.3;
    font-weight: 720;
    letter-spacing: .015em;
    text-transform: uppercase;
    white-space: normal;
    overflow-wrap: anywhere;
}
html[data-theme="dark"] .rawa-status-chip.rawa-status-success { color:#a6edd0; background:rgba(31,154,111,.19); border-color:rgba(100,212,166,.32); }
html[data-theme="dark"] .rawa-status-chip.rawa-status-warning { color:#f4d899; background:rgba(184,128,33,.18); border-color:rgba(236,187,83,.33); }
html[data-theme="dark"] .rawa-status-chip.rawa-status-complete { color:#b2d5ff; background:rgba(63,121,206,.19); border-color:rgba(118,173,240,.32); }
html[data-theme="dark"] .rawa-status-chip.rawa-status-info { color:#b9deeb; background:rgba(53,146,162,.17); border-color:rgba(115,194,206,.30); }
html[data-theme="dark"] .rawa-status-chip.rawa-status-neutral { color:#d0ddef; background:rgba(138,159,188,.12); border-color:rgba(158,181,210,.22); }
html[data-theme="dark"] .rawa-status-chip.rawa-status-danger { color:#f4b5b5; background:rgba(189,74,92,.16); border-color:rgba(233,136,150,.29); }
html[data-theme="light"] .rawa-status-chip.rawa-status-success { color:#146746; background:#e5f7ef; border-color:#b9e7d1; }
html[data-theme="light"] .rawa-status-chip.rawa-status-warning { color:#8e5b0d; background:#fff4dd; border-color:#efd6a5; }
html[data-theme="light"] .rawa-status-chip.rawa-status-complete { color:#245c9b; background:#e6f1ff; border-color:#bdd8f7; }
html[data-theme="light"] .rawa-status-chip.rawa-status-info { color:#156879; background:#e6f7f9; border-color:#bde1e8; }
html[data-theme="light"] .rawa-status-chip.rawa-status-neutral { color:#526276; background:#edf2f7; border-color:#d4dfeb; }
html[data-theme="light"] .rawa-status-chip.rawa-status-danger { color:#9b3f45; background:#fdeced; border-color:#f1c4c7; }

/* Lucro estimado: nao confundir valor apos comissao com resultado final. */
#app-view .rawa-profit-positive { color: #7ae4bc !important; }
#app-view .rawa-profit-negative { color: #f7aeb5 !important; }
html[data-theme="light"] #app-view .rawa-profit-positive { color:#167a55 !important; }
html[data-theme="light"] #app-view .rawa-profit-negative { color:#a13d43 !important; }

@media (max-width: 680px) {
    .modal-backdrop .client-history-modal .data-table-wrap { overflow-x: auto !important; }
    #app-view .rawa-module-page .data-table-wrap { overflow-x: auto !important; }
    .modal-backdrop .client-history-modal .modal-body { padding: 14px !important; }
}
@media (prefers-reduced-motion: reduce) {
    #app-view .rawa-module-page :is(.data-table,.report-table) td,
    .modal-backdrop :is(.data-table,.report-table) td { transition: none !important; }
}
