/* DRIVEOS_ACCOUNTS_PROFESSIONAL_V2_CSS
 * Finance contract:
 * - cards summarize;
 * - A/R and A/P details remain tables;
 * - aging looks backward from due date;
 * - schedule looks forward;
 * - due date and expected cash date are distinct.
 */

#page-accounts.driveos-accounts-professional-v2 .driveos-account-filters{display:none!important}

#page-accounts .driveos-accounts-pro-toolbar{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:12px 16px;border-top:1px solid #eef2f7;border-bottom:1px solid #eef2f7;background:#fbfdff
}
#page-accounts .driveos-accounts-pro-toolbar select,
#page-accounts .driveos-accounts-pro-toolbar input{
  min-height:36px;border:1px solid #dbe2ea;border-radius:9px;background:#fff;padding:7px 9px;font-size:12px;color:#0f172a
}
#page-accounts .driveos-accounts-pro-toolbar input{min-width:240px;flex:1 1 260px}
#page-accounts .driveos-accounts-pro-toolbar .spacer{flex:1 1 auto}

#page-accounts .driveos-accounts-pro-kpis{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;padding:14px 16px 6px
}
#page-accounts .driveos-accounts-pro-kpi{
  border:1px solid #e2e8f0;border-radius:12px;background:#fff;padding:12px;cursor:pointer;min-width:0
}
#page-accounts .driveos-accounts-pro-kpi span{display:block;color:#64748b;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.035em}
#page-accounts .driveos-accounts-pro-kpi strong{display:block;margin-top:5px;color:#0f172a;font-size:19px;line-height:1.15;font-variant-numeric:tabular-nums}
#page-accounts .driveos-accounts-pro-kpi small{display:block;margin-top:5px;color:#64748b;font-size:10px;line-height:1.35}
#page-accounts .driveos-accounts-pro-kpi.attention{border-color:#fecaca;background:#fffafa}
#page-accounts .driveos-accounts-pro-kpi.attention strong{color:#b91c1c}
#page-accounts .driveos-accounts-pro-kpi.info{border-color:#bfdbfe;background:#f8fbff}

#page-accounts .driveos-accounts-pro-section-title{
  display:flex;justify-content:space-between;align-items:flex-end;gap:12px;padding:12px 16px 8px
}
#page-accounts .driveos-accounts-pro-section-title strong{font-size:13px;color:#0f172a}
#page-accounts .driveos-accounts-pro-section-title span{font-size:11px;color:#64748b}

#page-accounts .driveos-accounts-pro-table-wrap{width:100%;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
#page-accounts .driveos-accounts-pro-table{width:100%;min-width:1320px;border-collapse:collapse;table-layout:auto}
#page-accounts .driveos-accounts-pro-table th,
#page-accounts .driveos-accounts-pro-table td{padding:9px 10px;border-bottom:1px solid #e5e7eb;text-align:left;vertical-align:middle;white-space:nowrap}
#page-accounts .driveos-accounts-pro-table th{background:#f8fafc;color:#64748b;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.04em;position:sticky;top:0;z-index:2}
#page-accounts .driveos-accounts-pro-table td{font-size:11px;color:#0f172a}
#page-accounts .driveos-accounts-pro-table tr[data-accounts-detail]{cursor:pointer}
#page-accounts .driveos-accounts-pro-table tr[data-accounts-detail]:hover td{background:#f8fafc}
#page-accounts .driveos-accounts-pro-table tr.is-overdue td{background:#fff8f8}
#page-accounts .driveos-accounts-pro-table tr.is-overdue:hover td{background:#fff2f2}
#page-accounts .driveos-accounts-pro-table .desc{max-width:320px;white-space:normal;line-height:1.35}
#page-accounts .driveos-accounts-pro-table .money{text-align:right;font-variant-numeric:tabular-nums}
#page-accounts .driveos-accounts-pro-table .open{font-weight:850}
#page-accounts .driveos-accounts-pro-table .actions{display:flex;gap:5px;align-items:center}
#page-accounts .driveos-accounts-pro-table .tiny-btn{white-space:nowrap}

.driveos-accounts-badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 7px;font-size:9px;font-weight:850;border:1px solid #dbe2ea;background:#f8fafc;color:#475569}
.driveos-accounts-badge.good{background:#f0fdf4;border-color:#bbf7d0;color:#166534}
.driveos-accounts-badge.warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.driveos-accounts-badge.bad{background:#fff1f2;border-color:#fecdd3;color:#be123c}
.driveos-accounts-badge.blue{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}

#page-accounts .driveos-accounts-prebilling{
  margin:10px 16px 14px;border:1px solid #bfdbfe;border-radius:12px;background:#f8fbff;overflow:hidden
}
#page-accounts .driveos-accounts-prebilling-head{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:11px 13px;border-bottom:1px solid #dbeafe}
#page-accounts .driveos-accounts-prebilling-head strong{font-size:12px;color:#1e3a8a}
#page-accounts .driveos-accounts-prebilling-head span{font-size:10px;color:#64748b}

#page-accounts .driveos-accounts-exceptions{
  margin:10px 16px 14px;padding:11px 13px;border:1px solid #fed7aa;border-radius:12px;background:#fffaf3;color:#7c2d12;font-size:11px;line-height:1.45
}

.driveos-accounts-detail-dialog{width:min(980px,96vw)}
.driveos-accounts-detail-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-bottom:14px}
.driveos-accounts-detail-stat{border:1px solid #e2e8f0;border-radius:10px;padding:10px;background:#f8fafc}
.driveos-accounts-detail-stat span{display:block;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.035em;color:#64748b}
.driveos-accounts-detail-stat strong{display:block;margin-top:4px;font-size:13px;color:#0f172a}
.driveos-accounts-detail-actions{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 14px}
.driveos-accounts-detail-block{margin-top:14px}
.driveos-accounts-detail-block h3{font-size:13px;margin:0 0 8px}
.driveos-accounts-history{width:100%;border-collapse:collapse;min-width:700px}
.driveos-accounts-history th,.driveos-accounts-history td{padding:8px 9px;border-bottom:1px solid #e5e7eb;text-align:left;font-size:11px;white-space:nowrap}
.driveos-accounts-history th{background:#f8fafc;color:#64748b;font-size:9px;text-transform:uppercase;letter-spacing:.04em}

.driveos-accounts-settle-dialog{width:min(620px,94vw)}
.driveos-accounts-settle-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:8px 0}
.driveos-accounts-settle-grid .field.full{grid-column:1/-1}
.driveos-accounts-settle-summary{display:flex;justify-content:space-between;gap:12px;padding:10px 12px;margin-bottom:8px;border-radius:10px;background:#f8fafc;border:1px solid #e2e8f0;font-size:12px}
.driveos-accounts-settle-summary strong{font-variant-numeric:tabular-nums}

#page-company .driveos-accounts-settings-card{margin-top:18px}
#page-company .driveos-accounts-settings-body{padding:14px 18px 18px}
#page-company .driveos-accounts-settings-option{display:grid;grid-template-columns:1fr auto;gap:14px;align-items:center}
#page-company .driveos-accounts-settings-option strong{display:block;font-size:13px}
#page-company .driveos-accounts-settings-option span{display:block;margin-top:4px;color:#64748b;font-size:11px;line-height:1.45}
#page-company .driveos-accounts-settings-option select{min-width:290px;border:1px solid #dbe2ea;border-radius:9px;padding:8px 10px;background:#fff}
#page-company .driveos-accounts-settings-actions{display:flex;justify-content:flex-end;margin-top:12px}

@media(max-width:1000px){
  #page-accounts .driveos-accounts-pro-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .driveos-accounts-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  #page-accounts .driveos-accounts-pro-toolbar{padding:10px 12px}
  #page-accounts .driveos-accounts-pro-toolbar input{min-width:100%;width:100%}
  #page-accounts .driveos-accounts-pro-kpis{padding:12px 12px 4px;gap:8px}
  #page-accounts .driveos-accounts-pro-table{width:max-content!important;min-width:1260px!important}
  #page-accounts .driveos-accounts-pro-table th,#page-accounts .driveos-accounts-pro-table td{padding:8px 9px!important;font-size:10px!important}
  #page-accounts .driveos-accounts-pro-table th{font-size:8px!important}
  .driveos-accounts-detail-dialog{width:100%}
  .driveos-accounts-detail-grid{grid-template-columns:1fr 1fr}
  .driveos-accounts-settle-grid{grid-template-columns:1fr}
  .driveos-accounts-settle-grid .field.full{grid-column:auto}
  #page-company .driveos-accounts-settings-option{grid-template-columns:1fr}
  #page-company .driveos-accounts-settings-option select{min-width:0;width:100%}
}


/* DRIVEOS_ACCOUNTS_PAYABLE_COLUMNS_V1
 * A/P: credor compacto; descrição recebe o espaço principal.
 */
#payablesTable .driveos-accounts-pro-table{table-layout:fixed;min-width:1450px}
#payablesTable .driveos-accounts-pro-table th:nth-child(1),#payablesTable .driveos-accounts-pro-table td:nth-child(1){width:105px}
#payablesTable .driveos-accounts-pro-table th:nth-child(2),#payablesTable .driveos-accounts-pro-table td:nth-child(2){width:115px}
#payablesTable .driveos-accounts-pro-table th:nth-child(3),#payablesTable .driveos-accounts-pro-table td:nth-child(3){width:165px;max-width:165px;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
#payablesTable .driveos-accounts-pro-table th:nth-child(4),#payablesTable .driveos-accounts-pro-table td:nth-child(4){width:90px}
#payablesTable .driveos-accounts-pro-table th:nth-child(5),#payablesTable .driveos-accounts-pro-table td:nth-child(5){width:300px;max-width:300px;white-space:normal;overflow-wrap:anywhere;line-height:1.35}
#payablesTable .driveos-accounts-pro-table th:nth-child(6),#payablesTable .driveos-accounts-pro-table td:nth-child(6){width:90px}
#payablesTable .driveos-accounts-pro-table th:nth-child(7),#payablesTable .driveos-accounts-pro-table td:nth-child(7){width:85px}
#payablesTable .driveos-accounts-pro-table th:nth-child(8),#payablesTable .driveos-accounts-pro-table td:nth-child(8){width:100px}
#payablesTable .driveos-accounts-pro-table th:nth-child(9),#payablesTable .driveos-accounts-pro-table td:nth-child(9){width:75px}
#payablesTable .driveos-accounts-pro-table th:nth-child(10),#payablesTable .driveos-accounts-pro-table td:nth-child(10){width:90px}
#payablesTable .driveos-accounts-pro-table th:nth-child(11),#payablesTable .driveos-accounts-pro-table td:nth-child(11){width:235px}


/* DRIVEOS_ACCOUNTS_PAYABLE_LAYOUT_V2
 * A/P: sem checkbox de seleção, linhas sem negrito e ações sempre utilizáveis.
 */
#page-accounts [data-driveos-check-all],
#page-accounts [data-driveos-row-check]{display:none!important}

#payablesTable .driveos-accounts-pro-table{table-layout:fixed;min-width:1320px}
#payablesTable .driveos-accounts-pro-table th:nth-child(1),#payablesTable .driveos-accounts-pro-table td:nth-child(1){width:90px}
#payablesTable .driveos-accounts-pro-table th:nth-child(2),#payablesTable .driveos-accounts-pro-table td:nth-child(2){width:100px}
#payablesTable .driveos-accounts-pro-table th:nth-child(3),#payablesTable .driveos-accounts-pro-table td:nth-child(3){width:125px;max-width:125px;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
#payablesTable .driveos-accounts-pro-table th:nth-child(4),#payablesTable .driveos-accounts-pro-table td:nth-child(4){width:80px}
#payablesTable .driveos-accounts-pro-table th:nth-child(5),#payablesTable .driveos-accounts-pro-table td:nth-child(5){width:250px;max-width:250px;white-space:normal;overflow-wrap:anywhere;line-height:1.35}
#payablesTable .driveos-accounts-pro-table th:nth-child(6),#payablesTable .driveos-accounts-pro-table td:nth-child(6){width:80px}
#payablesTable .driveos-accounts-pro-table th:nth-child(7),#payablesTable .driveos-accounts-pro-table td:nth-child(7){width:70px}
#payablesTable .driveos-accounts-pro-table th:nth-child(8),#payablesTable .driveos-accounts-pro-table td:nth-child(8){width:90px}
#payablesTable .driveos-accounts-pro-table th:nth-child(9),#payablesTable .driveos-accounts-pro-table td:nth-child(9){width:70px}
#payablesTable .driveos-accounts-pro-table th:nth-child(10),#payablesTable .driveos-accounts-pro-table td:nth-child(10){width:80px}
#payablesTable .driveos-accounts-pro-table th:nth-child(11),#payablesTable .driveos-accounts-pro-table td:nth-child(11){width:265px;min-width:265px}

/* Dados da conta em peso normal. Cabeçalhos, badges e botões mantêm hierarquia própria. */
#payablesTable .driveos-accounts-pro-table tbody td,
#payablesTable .driveos-accounts-pro-table tbody td strong,
#payablesTable .driveos-accounts-pro-table tbody td.money,
#payablesTable .driveos-accounts-pro-table tbody td.open{font-weight:400!important}
#payablesTable .driveos-accounts-pro-table tbody .driveos-accounts-badge{font-weight:850!important}
#payablesTable .driveos-accounts-pro-table tbody .tiny-btn{font-weight:700}

/* Ações ficam visíveis e não espremidas no canto direito. */
#payablesTable .driveos-accounts-pro-table th:nth-child(11){position:sticky;right:0;z-index:5;background:#f8fafc;box-shadow:-8px 0 12px -12px rgba(15,23,42,.35)}
#payablesTable .driveos-accounts-pro-table td:nth-child(11){position:sticky;right:0;z-index:3;background:#fff;box-shadow:-8px 0 12px -12px rgba(15,23,42,.35)}
#payablesTable .driveos-accounts-pro-table tr.is-overdue td:nth-child(11){background:#fff8f8}
#payablesTable .driveos-accounts-pro-table tr.is-overdue:hover td:nth-child(11){background:#fff2f2}
#payablesTable .driveos-accounts-pro-table tr:not(.is-overdue):hover td:nth-child(11){background:#f8fafc}
#payablesTable .driveos-accounts-pro-table td:nth-child(11) .actions{display:flex;align-items:center;justify-content:flex-start;gap:6px;flex-wrap:nowrap;min-width:245px}
#payablesTable .driveos-accounts-pro-table td:nth-child(11) .tiny-btn{padding:7px 10px;font-size:10px;line-height:1.1}


/* DRIVEOS_ACCOUNTS_PAYABLE_LAYOUT_V3
 * Desktop financeiro: menos colunas, tipografia legível e ações sem esmagamento.
 */
#payablesTable .driveos-accounts-pro-table{table-layout:fixed;min-width:1160px!important;width:100%}
#payablesTable .driveos-accounts-pro-table th,#payablesTable .driveos-accounts-pro-table td{padding:10px 9px}
#payablesTable .driveos-accounts-pro-table td{font-size:12px;line-height:1.35}
#payablesTable .driveos-accounts-pro-table th{font-size:9px}

#payablesTable .driveos-accounts-pro-table th:nth-child(1),#payablesTable .driveos-accounts-pro-table td:nth-child(1){width:95px}
#payablesTable .driveos-accounts-pro-table th:nth-child(2),#payablesTable .driveos-accounts-pro-table td:nth-child(2){width:110px}
#payablesTable .driveos-accounts-pro-table th:nth-child(3),#payablesTable .driveos-accounts-pro-table td:nth-child(3){width:145px;max-width:145px;white-space:normal;overflow-wrap:anywhere}
#payablesTable .driveos-accounts-pro-table th:nth-child(4),#payablesTable .driveos-accounts-pro-table td:nth-child(4){width:85px}
#payablesTable .driveos-accounts-pro-table th:nth-child(5),#payablesTable .driveos-accounts-pro-table td:nth-child(5){width:340px;max-width:340px;white-space:normal;overflow-wrap:anywhere}
#payablesTable .driveos-accounts-pro-table th:nth-child(6),#payablesTable .driveos-accounts-pro-table td:nth-child(6){width:110px}
#payablesTable .driveos-accounts-pro-table th:nth-child(7),#payablesTable .driveos-accounts-pro-table td:nth-child(7){width:120px}
#payablesTable .driveos-accounts-pro-table th:nth-child(8),#payablesTable .driveos-accounts-pro-table td:nth-child(8){width:155px;min-width:155px}

#payablesTable .driveos-payable-description{display:block;font-weight:400!important;color:#0f172a}
#payablesTable .driveos-payable-category{display:block;margin-top:2px;font-size:10px;line-height:1.25}
#payablesTable .driveos-payable-open>span{display:block;font-weight:400!important}
#payablesTable .driveos-payable-paid-note{display:block;margin-top:2px;font-size:9px;color:#64748b;white-space:normal;font-weight:400!important}
#payablesTable .driveos-payable-status{white-space:normal!important}
#payablesTable .driveos-payable-status .driveos-accounts-badge{display:inline-flex}
#payablesTable .driveos-payable-aging{display:block;margin-top:3px;color:#64748b;font-size:9px;font-weight:400;white-space:normal}

#payablesTable .driveos-accounts-pro-table th:nth-child(8){position:sticky;right:0;z-index:6;background:#f8fafc;border-left:1px solid #eef2f7;box-shadow:-5px 0 10px -10px rgba(15,23,42,.35)}
#payablesTable .driveos-accounts-pro-table td:nth-child(8){position:sticky;right:0;z-index:4;background:#fff;border-left:1px solid #eef2f7;box-shadow:-5px 0 10px -10px rgba(15,23,42,.35)}
#payablesTable .driveos-accounts-pro-table tr.is-overdue td:nth-child(8){background:#fff8f8}
#payablesTable .driveos-accounts-pro-table tr.is-overdue:hover td:nth-child(8){background:#fff2f2}
#payablesTable .driveos-accounts-pro-table tr:not(.is-overdue):hover td:nth-child(8){background:#f8fafc}
#payablesTable .driveos-payable-actions{display:flex;align-items:center;justify-content:flex-start;gap:6px;flex-wrap:nowrap;min-width:135px}
#payablesTable .driveos-payable-actions .tiny-btn{padding:7px 11px;font-size:10px;line-height:1.1;min-width:56px}

.driveos-payable-more-actions{display:grid;grid-template-columns:1fr;gap:9px;padding:4px 0}
.driveos-payable-more-actions .btn,.driveos-payable-more-actions .tiny-btn{width:100%;min-height:40px;justify-content:flex-start;text-align:left;padding:9px 12px;font-size:12px}

@media(max-width:760px){
  #payablesTable .driveos-accounts-pro-table{min-width:1160px!important;width:1160px!important}
}


/* DRIVEOS_ACCOUNTS_CANONICAL_LIST_V1
 * Professional A/R + A/P tables are isolated from legacy render targets.
 */
/* The stable legacy host is now the canonical mount point itself.
 * Do NOT hide it: Professional V2 renders the live A/R/A/P table inside it.
 * Hiding [data-accounts-legacy-host] removed the transaction grid while KPIs
 * remained visible, producing a summary-only finance screen. */
#page-accounts.driveos-accounts-professional-v2 [data-accounts-legacy-host="1"].driveos-accounts-canonical-list{
  display:block!important;
  visibility:visible!important;
  width:100%;
  min-height:48px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
#page-accounts.driveos-accounts-professional-v2 .driveos-accounts-canonical-list{
  display:block!important;
  visibility:visible!important;
  width:100%;
  min-height:48px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
#page-accounts.driveos-accounts-professional-v2 .driveos-filter-bar:has(+ .driveos-account-filters){
  display:none!important;
}
#page-accounts.driveos-accounts-professional-v2 .driveos-account-filters{
  display:none!important;
}

/* DRIVEOS_ACCOUNTS_CANONICAL_HOST_HARDENING_V1
 * The canonical transaction host must remain paintable on mobile even if a
 * legacy utility leaves stale visibility/layout state behind. */
#page-accounts.driveos-accounts-professional-v2 .accounts-receivable-card > #receivablesTable.driveos-accounts-canonical-list,
#page-accounts.driveos-accounts-professional-v2 .accounts-payable-card > #payablesTable.driveos-accounts-canonical-list{
  display:block!important;
  visibility:visible!important;
  opacity:1!important;
  height:auto!important;
  max-height:none!important;
  min-height:48px!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  position:relative!important;
}


/* DRIVEOS_ACCOUNTS_GRID_VISIBILITY_V2
 * Canonical A/R + A/P grids remain paintable regardless of generic mobile/filter rules. */
#page-accounts.driveos-accounts-professional-v2 #receivablesTable.driveos-accounts-canonical-list > .driveos-accounts-pro-table-wrap,
#page-accounts.driveos-accounts-professional-v2 #payablesTable.driveos-accounts-canonical-list > .driveos-accounts-pro-table-wrap{
  display:block!important;visibility:visible!important;opacity:1!important;width:100%!important;max-width:100%!important;min-height:1px!important;overflow-x:auto!important;
}
#page-accounts.driveos-accounts-professional-v2 #receivablesTable.driveos-accounts-canonical-list table.driveos-accounts-pro-table,
#page-accounts.driveos-accounts-professional-v2 #payablesTable.driveos-accounts-canonical-list table.driveos-accounts-pro-table{
  display:table!important;visibility:visible!important;opacity:1!important;height:auto!important;max-height:none!important;
}
#page-accounts.driveos-accounts-professional-v2 #receivablesTable.driveos-accounts-canonical-list thead,
#page-accounts.driveos-accounts-professional-v2 #payablesTable.driveos-accounts-canonical-list thead{display:table-header-group!important;visibility:visible!important}
#page-accounts.driveos-accounts-professional-v2 #receivablesTable.driveos-accounts-canonical-list tbody,
#page-accounts.driveos-accounts-professional-v2 #payablesTable.driveos-accounts-canonical-list tbody{display:table-row-group!important;visibility:visible!important}
#page-accounts.driveos-accounts-professional-v2 #receivablesTable.driveos-accounts-canonical-list tr,
#page-accounts.driveos-accounts-professional-v2 #payablesTable.driveos-accounts-canonical-list tr{display:table-row!important;visibility:visible!important}
