:root { --bg:#f3f7f4; --card:#fff; --txt:#183425; --mut:#5b6f61; --pri:#074321; --err:#b42332; --bd:#d9e3dd; --soft:#edf5ef; }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--txt); font:14px/1.5 'Segoe UI',Arial,sans-serif; }
button,input,select { font:inherit; }
button { border:1px solid transparent; padding:10px 17px; border-radius:7px; font-weight:600; cursor:pointer; white-space:nowrap; }
button:disabled { cursor:wait; opacity:.55; }
button:focus-visible,input:focus-visible,select:focus-visible,.table-scroll:focus-visible { outline:3px solid #91b89f; outline-offset:2px; }
input,select { width:100%; min-width:0; border:1px solid #becfc3; border-radius:7px; background:#fff; color:var(--txt); padding:10px 11px; height:43px; }
input::placeholder { color:#73877a; }
select:disabled { background:#f3f7f4; color:#344e3f; opacity:1; }
label { display:block; font-size:13px; font-weight:600; margin:0 0 7px; }
.primary { background:var(--pri); color:#fff; }
.primary:hover:not(:disabled) { background:#053219; }
.secondary { border-color:var(--bd); background:#fff; color:#35523e; }
.secondary:hover:not(:disabled) { background:#eff5f0; }
.full { display:block; width:100%; margin-top:12px; }
.text-button { background:transparent; color:var(--mut); padding:6px 8px; }
.auth-shell { min-height:100vh; display:grid; place-items:center; padding:24px 16px; }
.auth-card { width:100%; max-width:408px; background:var(--card); border:1px solid var(--bd); border-radius:12px; padding:32px; box-shadow:0 8px 30px #0743210a; }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; font-size:16px; letter-spacing:-.2px; }
.brand-icon { display:grid; place-items:center; width:32px; height:32px; border-radius:8px; background:#074321; color:white; font-size:20px; }
.brand-light { color:var(--mut); font-weight:400; }
.auth-card .brand { margin-bottom:30px; }
h1 { font-size:28px; line-height:1.25; letter-spacing:-.6px; margin:0 0 10px; font-weight:650; }
.auth-card h1 { font-size:24px; }
.sub { color:var(--mut); margin:0; }
.auth-card .sub { margin-bottom:24px; }
.auth-card form label:not(:first-child) { margin-top:17px; }
.auth-note { font-size:12px; color:var(--mut); text-align:center; margin:22px 0 0; }
.erro { color:var(--err); font-size:13px; }
.auth-card .erro { margin-top:12px; min-height:20px; }
.app-shell { min-height:100vh; }
.topbar { min-height:72px; display:flex; justify-content:space-between; align-items:center; gap:20px; padding:16px 36px; border-bottom:1px solid var(--bd); background:white; }
.account { display:flex; align-items:center; gap:15px; font-size:13px; }
.branch-badge { background:var(--soft); color:#074321; border-radius:5px; padding:4px 9px; font-weight:600; }
.branch-badge:not(:disabled):hover { background:#e1eee4; border-color:#9fc1aa; }
.branch-badge:disabled { cursor:default; opacity:1; }
.workspace { max-width:1440px; margin:auto; padding:36px; }
.page-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:28px; }
.eyebrow { font-size:11px; letter-spacing:1px; font-weight:700; color:#627968; margin-bottom:12px; }
.readonly-badge { font-size:12px; color:#536b5b; padding:5px 10px; border:1px solid var(--bd); border-radius:20px; white-space:nowrap; }
.filters-panel,.results-panel { background:var(--card); border:1px solid var(--bd); border-radius:10px; }
.filters-panel { padding:24px; margin-bottom:24px; }
.filter-grid { display:grid; grid-template-columns:160px 160px minmax(180px,1fr) minmax(220px,1.5fr); gap:20px; }
.field-help { display:block; color:var(--mut); font-size:11px; margin-top:6px; }
.filter-actions { display:flex; justify-content:space-between; align-items:center; gap:20px; padding-top:20px; margin-top:20px; border-top:1px solid #e7eee9; }
.check-label { display:flex; gap:9px; align-items:center; margin:0; font-weight:400; }
.check-label input { width:16px; height:16px; min-height:16px; flex-shrink:0; margin:0; accent-color:var(--pri); }
.button-group { display:flex; align-items:center; gap:10px; }
.results-heading { padding:18px 24px; border-bottom:1px solid #e7eee9; display:flex; justify-content:space-between; align-items:center; gap:16px; }
h2 { font-size:16px; font-weight:650; margin:0; }
.results-heading span { font-size:12px; color:var(--mut); }
.empty-state { padding:54px 24px 62px; text-align:center; color:var(--mut); }
.empty-symbol { display:block; color:#71987c; font-size:40px; line-height:1.2; margin-bottom:16px; }
.empty-state h3 { font-size:16px; color:#34573e; font-weight:600; margin:0 0 8px; }
.empty-state p { font-size:13px; margin:0; }
.table-scroll { width:100%; overflow:auto; }
table { width:100%; border-collapse:collapse; font-size:13px; text-align:left; }
th { padding:12px 16px; color:#536e5c; background:#f7faf8; font-size:11px; font-weight:700; white-space:nowrap; }
td { padding:14px 16px; border-top:1px solid #e7eee9; vertical-align:top; }
td:nth-child(3) { font-weight:600; min-width:130px; }
td:nth-child(4) { min-width:240px; max-width:460px; }
tbody tr:hover { background:#f5f9f6; }
.numeric { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.negative { color:var(--err); font-weight:600; }
.pagination { display:flex; justify-content:space-between; align-items:center; padding:16px 24px; border-top:1px solid var(--bd); color:var(--mut); font-size:12px; }
.pagination button { padding:7px 12px; font-size:12px; }
.pagination button:disabled { cursor:default; }
.footer-note { font-size:12px; color:#637b6a; margin:18px 0; }
.query-error { margin:0 0 18px; }
.module-nav { display:flex; gap:8px; padding:0 36px; background:white; border-bottom:1px solid var(--bd); }
.module-nav button { color:var(--mut); background:transparent; border-radius:0; padding:14px 22px; border-bottom:3px solid transparent; }
.module-nav button[aria-current="page"] { color:var(--pri); border-bottom-color:var(--pri); }
.client-filters { grid-template-columns:1.2fr 1fr 1fr 1fr; }
.client-summary { position:relative; display:grid; grid-template-columns:minmax(0,1fr) minmax(180px,.55fr) 20px; align-items:center; gap:24px; width:100%; text-align:left; white-space:normal; padding:22px 24px; border-radius:0; background:white; border:0; border-bottom:1px solid #e7eee9; color:var(--txt); font-weight:400; }
.client-summary:last-child { border-bottom:0; border-radius:0 0 10px 10px; }
.client-summary:hover { background:#eff6f0; }
.client-summary strong { font-size:14px; overflow-wrap:anywhere; }
.client-cnpj { color:var(--mut); font-size:13px; }
.client-arrow { font-size:27px; color:#73977f; }
dialog { width:calc(100% - 32px); max-width:720px; max-height:calc(100dvh - 40px); padding:28px; background:white; color:var(--txt); border:1px solid var(--bd); border-radius:12px; overflow:auto; box-shadow:0 24px 90px #163c2530; }
dialog::backdrop { background:#102b1b80; }
.dialog-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; border-bottom:1px solid var(--bd); padding-bottom:22px; }
.dialog-heading h2 { font-size:22px; line-height:1.4; overflow-wrap:anywhere; margin-bottom:8px; }
.dialog-heading button { min-height:44px; }
.client-details { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:22px 30px; margin:24px 0 0; }
.client-details dt { color:var(--mut); font-size:12px; margin-bottom:5px; }
.client-details dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }
.detail-wide { grid-column:1 / -1; }
.purchase-summary { display:grid; gap:4px; margin-top:22px; padding-bottom:22px; border-bottom:1px solid var(--bd); }
.purchase-label { color:var(--mut); font-size:12px; }
.purchase-summary strong { font-size:30px; line-height:1.3; }
.purchase-status { margin-top:8px; font-size:13px; font-weight:600; }
.purchase-summary[data-status="verde"] strong,.purchase-summary[data-status="verde"] .purchase-status { color:#166534; }
.purchase-summary[data-status="amarelo"] strong,.purchase-summary[data-status="amarelo"] .purchase-status { color:#92400e; }
.purchase-summary[data-status="vermelho"] strong,.purchase-summary[data-status="vermelho"] .purchase-status { color:#b42332; }
.purchase-summary[data-status="sem-historico"] strong,.purchase-summary[data-status="sem-historico"] .purchase-status { color:#5b6f61; }
[hidden] { display:none !important; }
@media(max-width:1000px) { .filter-grid { grid-template-columns:1fr 1fr; } }
@media(max-width:600px) {
  input,select { font-size:16px; min-height:46px; }
  button { min-height:44px; touch-action:manipulation; }
  .topbar { padding:15px 18px; flex-wrap:wrap; gap:12px; }
  .account { width:100%; justify-content:space-between; gap:8px; }
  .account #nomeUsuario { flex:1; min-width:0; overflow-wrap:anywhere; }
  .branch-badge { padding:8px 12px; }
  .workspace { padding:24px 16px; }
  h1 { font-size:25px; }
  .page-heading { align-items:flex-start; }
  .readonly-badge { display:none; }
  .filters-panel { padding:18px; }
  .filter-grid { grid-template-columns:1fr; gap:16px; }
  .filter-actions { align-items:stretch; flex-direction:column; }
  .filter-actions .button-group button { flex:1; padding:10px; }
  .results-heading { padding:16px; align-items:flex-start; flex-direction:column; gap:6px; }
  .pagination { padding:14px; gap:10px; flex-wrap:wrap; }
  .auth-card { padding:27px; }
  .module-nav { padding:0 16px; }
  .module-nav button { flex:1; }
  .client-filters { grid-template-columns:1fr; }
  .client-summary { grid-template-columns:minmax(0,1fr) 20px; gap:7px 15px; padding:20px 16px; }
  .client-summary strong { font-size:15px; }
  .client-cnpj { grid-row:2; grid-column:1; }
  .client-arrow { grid-column:2; grid-row:1 / 3; }
  dialog { padding:20px; max-height:calc(100dvh - 24px); }
  .dialog-heading { gap:12px; }
  .dialog-heading h2 { font-size:18px; }
  .client-details { gap:20px 18px; }
  .table-scroll { overflow:visible; }
  table,tbody { display:block; width:100%; }
  thead { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  tbody tr { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px 20px; padding:20px 16px; border-top:1px solid var(--bd); }
  tbody tr:first-child { border-top:0; }
  tbody tr:nth-child(even) { background:#f8faf8; }
  tbody td,tbody td:nth-child(3),tbody td:nth-child(4) { display:block; padding:0; border:0; min-width:0; max-width:none; white-space:normal; text-align:left; overflow-wrap:anywhere; }
  tbody td::before { content:attr(data-label); display:block; margin-bottom:4px; font-size:11px; font-weight:500; color:var(--mut); }
  tbody td:nth-child(3) { grid-column:1 / -1; grid-row:1; font-size:16px; }
  tbody td:nth-child(4) { grid-column:1 / -1; grid-row:2; }
  tbody td:nth-child(5) { grid-column:1 / -1; }
  tbody td.numeric { font-size:16px; }
  .empty-state { padding:32px 18px; }
}
@media(max-width:380px) {
  .filter-actions .button-group { display:grid; grid-template-columns:1fr; }
  .auth-card { padding:23px; }
}

.module-nav { overflow-x:auto; }
.module-nav button { white-space:nowrap; }
#tabelaReceber table { min-width:1450px; }
@media(max-width:600px) { #tabelaReceber table { min-width:0; } }
#formReceber .filter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
#formReceber .filter-grid > div:nth-child(4) { grid-column:span 2; }
@media(max-width:1000px) {
  #formReceber .filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #formReceber .filter-grid > div:nth-child(4) { grid-column:auto; }
}
@media(max-width:600px) {
  .module-nav { display:grid; grid-template-columns:1fr 1fr; }
  #formReceber .filter-grid { grid-template-columns:1fr; }
  #tabelaReceber tbody td:nth-child(3),#tabelaReceber tbody td:nth-child(4) { grid-row:auto; grid-column:auto; font-size:inherit; }
  #tabelaReceber tbody td:nth-child(3) { grid-column:1 / -1; }
  #tabelaReceber tbody td:nth-child(5) { grid-row:1; font-size:16px; }
}
/* Resumo financeiro por cliente. */
.receivable-totals { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin:0 0 22px; }
.receivable-total { padding:20px; border:1px solid var(--bd); border-radius:12px; background:white; min-width:0; display:flex; flex-direction:column; gap:10px; }
.receivable-total > span { font-size:13px; color:var(--mut); }
.receivable-total strong { font-size:24px; line-height:1.3; overflow-wrap:anywhere; }
.receivable-total small { color:var(--mut); font-size:12px; line-height:1.5; }
.receivable-total.overdue { background:#fff7f7; border-color:#f4cbd0; }
.receivable-total.overdue strong { color:#bd2439; }
.receivable-total.upcoming strong,.receivable-total.paid strong { color:#074321; }
.receivable-total.average { background:#f1f6f2; }
.receivable-scope { color:var(--mut); font-size:13px; line-height:1.6; margin:18px 0; }
.totals-scope { grid-column:1 / -1; margin:0; color:var(--mut); font-size:12px; }
#tabelaReceber table { min-width:0; width:100%; table-layout:fixed; }
#tabelaReceber th:first-child { width:80px; }
#tabelaReceber th:nth-child(3) { width:220px; }
#tabelaReceber th:last-child { width:100px; }
#tabelaReceber td { max-width:none; white-space:normal; overflow-wrap:anywhere; vertical-align:middle; }
#tabelaReceber td:nth-child(2) { font-weight:600; }
.status-column { text-align:center; }
.receivable-client { cursor:pointer; }
.receivable-client:hover { background:#f1f6f2; }
.receivable-client:focus-visible { outline:3px solid #91b89f; outline-offset:-3px; }
.receivable-inspect { border:0; background:transparent; padding:6px; width:54px; height:54px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; }
.receivable-inspect svg { width:42px; height:42px; }
.receivable-inspect.ok { color:#2b548d; }
.receivable-inspect.overdue { color:#c52d41; }
.receivable-inspect:hover { background:#e6f1e9; }
#detalhesReceber { max-width:1050px; }
.client-totals { grid-template-columns:repeat(3,minmax(0,1fr)); margin-top:16px; }
#regraMediaReceber { margin:10px 0 20px; line-height:1.6; }
.receivable-title-card { border:1px solid var(--bd); border-radius:12px; padding:20px; margin:16px 0; }
.receivable-title-card header { display:flex; gap:14px; align-items:center; justify-content:space-between; }
.receivable-title-card h3 { margin:0; font-size:16px; overflow-wrap:anywhere; }
.receivable-title-card dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; margin:20px 0 0; }
.receivable-title-card dt { font-size:12px; color:var(--mut); margin:0 0 5px; }
.receivable-title-card dd { margin:0; font-size:14px; overflow-wrap:anywhere; white-space:pre-wrap; }
.receivable-title-card .title-history { grid-column:1 / -1; }
.title-state { font-size:12px; font-weight:600; border-radius:20px; padding:6px 10px; color:#586d60; background:#f0f4f1; white-space:nowrap; }
.title-state.atrasado { color:#b42339; background:#fff0f1; }
.title-state.a_vencer,.title-state.pago { color:#074321; background:#edf5ef; }
@media(max-width:1000px) { .receivable-totals { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:600px) {
  #tabelaReceber tbody tr { grid-template-columns:minmax(0,1fr) 58px; gap:12px; }
  #tabelaReceber tbody td:nth-child(1) { grid-column:1; grid-row:3; font-size:13px; }
  #tabelaReceber tbody td:nth-child(2) { grid-column:1; grid-row:1; font-size:16px; }
  #tabelaReceber tbody td:nth-child(3) { grid-column:1; grid-row:2; font-size:14px; }
  #tabelaReceber tbody td:nth-child(4) { grid-column:2; grid-row:1 / 4; align-self:center; }
  #tabelaReceber tbody td:nth-child(4)::before { display:none; }
  .receivable-total { padding:14px; }
  .receivable-total strong { font-size:21px; }
  .receivable-title-card { padding:16px; }
  .receivable-title-card header { align-items:flex-start; flex-direction:column; }
  .receivable-title-card dl { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
  #detalhesReceber { padding:18px; }
}
.order-total { display:flex; justify-content:space-between; align-items:center; gap:24px; padding:22px 24px; margin:0 0 22px; background:#f0f7f2; border:1px solid #d1e3d7; border-radius:12px; }
.order-total > div { display:flex; flex-direction:column; gap:8px; }
.order-total span { color:var(--mut); font-size:13px; }
.order-total strong { color:#074321; font-size:28px; }
.order-total p { color:var(--mut); font-size:13px; max-width:560px; line-height:1.7; margin:0; }
.order-row { cursor:pointer; }
.order-row:focus-visible { outline:3px solid #91b89f; outline-offset:-3px; }
.order-row:hover { background:#f1f6f2; }
.order-open { border:0; padding:4px 0; background:transparent; color:#074321; text-decoration:underline; font:inherit; font-weight:600; }
#detalhesPedido { max-width:1050px; }
#conteudoDetalhesPedido { margin-top:22px; }
.order-header-fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin:24px 0; }
.order-header-fields dt { color:var(--mut); font-size:12px; margin:0 0 6px; }
.order-header-fields dd { margin:0; font-size:14px; overflow-wrap:anywhere; }
#tabelaItensPedido table { width:100%; table-layout:fixed; }
#tabelaItensPedido th:first-child { width:105px; }
#tabelaItensPedido th:nth-child(2) { width:40%; }
#tabelaItensPedido td { white-space:normal; max-width:none; overflow-wrap:anywhere; }
@media(max-width:600px) {
  .order-total { flex-direction:column; align-items:flex-start; padding:18px; gap:14px; }
  .order-total strong { font-size:25px; }
  #detalhesPedido { padding:18px; }
  .order-header-fields { grid-template-columns:1fr; gap:16px; }
  #tabelaItensPedido tbody td:nth-child(1) { grid-column:1; grid-row:2; }
  #tabelaItensPedido tbody td:nth-child(2) { grid-column:1 / -1; grid-row:1; font-size:16px; }
  #tabelaItensPedido tbody td:nth-child(3) { grid-column:2; grid-row:2; font-size:14px; }
  #tabelaItensPedido tbody td:nth-child(4) { grid-column:1; grid-row:3; }
  #tabelaItensPedido tbody td:nth-child(5) { grid-column:2; grid-row:3; }
}

/* Identidade do Grupo Cardan Norte: verde #074321, vermelho #FF202B e branco. */
:root { --brand-green:#074321; --brand-red:#FF202B; --brand-red-text:#b71927; }
.access-notice { max-width:1368px; margin:20px auto 0; padding:14px 20px; background:#fff6f6; border:1px solid #f2ccd1; border-radius:8px; }
.branch-badge { white-space:normal; text-align:left; max-width:340px; }
#formPedidos .filter-grid,#formEstoque .filter-grid { grid-template-columns:minmax(280px,1.5fr) minmax(150px,.8fr) minmax(150px,.8fr) minmax(180px,1fr); }
@media(max-width:1000px) { #formPedidos .filter-grid,#formEstoque .filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:600px) { #formPedidos .filter-grid,#formEstoque .filter-grid { grid-template-columns:1fr; } }
#tabelaReceber th:first-child { width:180px; }
.brand { min-width:0; gap:14px; color:var(--brand-green); letter-spacing:0; }
.brand-logo { width:76px; height:auto; flex:0 0 auto; object-fit:contain; display:block; }
.brand-copy { display:flex; flex-direction:column; min-width:0; gap:3px; }
.brand-copy strong { font-size:18px; line-height:1.3; font-weight:700; overflow-wrap:normal; }
.brand-copy .brand-light { font-size:12px; line-height:1.4; color:var(--mut); }
.brand-header { padding-bottom:20px; border-bottom:1px solid var(--bd); }
.auth-card { border-top:3px solid var(--brand-red); }
.auth-card .brand { margin-bottom:24px; }
.auth-card .brand-copy strong { font-size:17px; }
.topbar { position:sticky; top:0; z-index:20; border-top:3px solid var(--brand-red); box-shadow:0 2px 14px #07432108; }
.module-nav button[aria-current="page"] { color:var(--brand-green); border-bottom-color:var(--brand-red); }
.dialog-brand { padding-bottom:16px; margin-bottom:20px; border-bottom:1px solid var(--bd); }
.dialog-brand .brand-logo { width:54px; }
.dialog-brand .brand-copy strong { font-size:16px; }
.dialog-brand .brand-light { font-size:11px; }
dialog { border-top:3px solid var(--brand-red); }
.primary:disabled { cursor:wait; }
@media(max-width:600px) {
  .brand { gap:12px; }
  .brand-logo { width:66px; }
  .brand-copy strong { font-size:17px; }
  .auth-card .brand-copy strong { font-size:16px; }
  .topbar { padding:12px 18px; gap:12px; }
  .topbar .brand { width:100%; }
  .dialog-brand .brand-copy strong { font-size:15px; }
}
