/* VisionPb: Accounting and payroll (invoices, payments, statements, receivables, deposits, pay periods). Area sheet; every rule under the VisionPb scope. */

/* Filter strip above a money grid: a pressed groove, like Orders. */
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel:is(:has(~ .report-table-frame), :has(~ .mud-data-grid)) {
    background: var(--color-surface-2);
    border: 0;
    border-radius: var(--vpb-radius-card);
    box-shadow: var(--vpb-press-groove);
}

/* The grid sheet: cotton, lit edge, soft cast; the grid's own surface goes transparent. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame > .mud-table,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid.mud-table {
    background: var(--vpb-cotton);
    border: 0;
    border-radius: var(--vpb-radius-card);
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock);
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-container,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-container {
    background: transparent;
}

/* Quiet heads: muted, 500, sentence case, one line. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-head .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-head .column-header,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-head .mud-table-cell {
    background: var(--vpb-cotton);
    color: var(--color-ink-2);
    font-family: var(--vpb-font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

/* Horizontal hairlines only; strong rule under the head. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-cell {
    border-inline: 0;
    border-block-start: 0;
    border-block-end: 1px solid var(--color-rule);
    color: var(--color-ink);
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-head .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-head .mud-table-cell {
    color: var(--color-ink-2);
    border-block-end-color: var(--color-rule-strong);
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-body .mud-table-row:last-child .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-body .mud-table-row:last-child .mud-table-cell {
    border-block-end: 0;
}

/* Row hover: a faint warm wash; selected rows take the blue tint. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-body .mud-table-row:hover > .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-body .mud-table-row:hover > .mud-table-cell {
    background: var(--vpb-paper-3);
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-body .mud-table-row.selected > .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-body .mud-table-row.selected > .mud-table-cell {
    background: var(--vpb-accent-soft);
}

/* Links in grids are the blue accent; money drill-downs and ids set in mono, tabular. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-link,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-link {
    color: var(--color-accent);
    font-weight: 500;
    text-decoration: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-link:hover,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-link:hover {
    color: var(--vpb-accent-2);
    text-decoration: underline;
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .report-amount-drill,
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-link[href*="/payments/"],
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-link[href*="/orders/"] {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .report-amount-drill {
    text-decoration-color: var(--color-ink-2);
}

/* Row actions stay quiet until hovered. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-icon-button:not(.mud-button-outlined) {
    color: var(--color-ink-2);
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-icon-button:not(.mud-button-outlined):hover {
    color: var(--color-accent);
    background: var(--vpb-accent-soft);
}

/* Pager: muted, tabular. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-pagination,
.vision-theme-scope[data-vision-theme="visionpb"] .filter-panel ~ .mud-data-grid .mud-table-pagination {
    border-block-start: 1px solid var(--color-rule);
    color: var(--color-ink-2);
    font-variant-numeric: tabular-nums;
}

/* Hover motion: colour only. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-row > .mud-table-cell {
    transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
    .vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-row > .mud-table-cell {
        transition: none;
    }
}

/* Focus stays visible inside the grids. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame :is(.mud-link, .mud-icon-button, button, a, .report-amount-drill):focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Summary tiles over AR and reconciliation tables: a quiet cotton card, big mono figures. */
.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper.px-3.py-2.mb-2:has(> .mud-grid) {
    background: var(--vpb-cotton);
    border-radius: var(--vpb-radius-card);
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock);
    padding: var(--space-md, 16px) var(--space-lg, 24px);
}

.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper.px-3.py-2.mb-2 > .mud-grid > .mud-grid-item > .mud-typography-caption:first-child,
.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper.px-3.py-2.mb-2 > .mud-grid > .mud-grid-item > .mud-tooltip-root .mud-typography-caption {
    color: var(--color-ink-2);
    font-size: var(--text-sm);
    font-weight: 500;
}

.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper.px-3.py-2.mb-2 > .mud-grid > .mud-grid-item > .mud-typography-h6 {
    color: var(--color-ink);
    font-family: var(--vpb-font-mono);
    font-size: var(--text-xl);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.25;
}

.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper.px-3.py-2.mb-2 > .mud-grid > .mud-grid-item > .mud-typography-caption:last-child {
    color: var(--color-ink-2);
}

/* Payment page: record cards become cotton stock, like the order page. */
.vision-theme-scope[data-vision-theme="visionpb"] .payment-view :is(.record-summary, .record-section, .record-trail) {
    background: var(--vpb-cotton);
    border-radius: var(--vpb-radius-card);
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock);
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .record-summary-icon {
    background: var(--vpb-accent-soft);
    border-radius: var(--vpb-radius-input);
    color: var(--color-accent);
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .record-summary-title {
    font-family: var(--vpb-font-mono);
    font-weight: 500;
    letter-spacing: 0;
}

/* The payment amount is the key figure: large, mono, tabular. */
.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .record-summary-figure-label {
    color: var(--color-ink-2);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .record-summary-figure-value {
    color: var(--color-ink);
    font-family: var(--vpb-font-mono);
    font-size: var(--text-2xl);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    line-height: 1.15;
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .record-summary-figure-note {
    color: var(--color-ink-2);
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .record-fact dt {
    color: var(--color-ink-2);
}

/* Money in the allocations table: mono, tabular, right-aligned. */
.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .payment-view-amount {
    font-family: var(--vpb-font-mono);
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .payment-view-unapplied {
    color: var(--vpb-state-warn);
}

.vision-theme-scope[data-vision-theme="visionpb"] .payment-view .mud-table-root .mud-table-head .mud-table-cell {
    border-block-end-color: var(--color-rule-strong);
}

/* Payrolls: pay-period toolbar, label and pill match the portal's quiet labels (scoped to the payroll pages). */
.vision-theme-scope[data-vision-theme="visionpb"] .tw-time-page:has(.pb-timerecords-table, .tw-payroll-grid) :is(.tw-time-hero, .tw-time-panel) {
    background: var(--vpb-cotton);
    border-radius: var(--vpb-radius-card);
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock);
}

.vision-theme-scope[data-vision-theme="visionpb"] .tw-time-page:has(.pb-timerecords-table, .tw-payroll-grid) .tw-time-label {
    color: var(--color-ink-2);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .tw-time-page:has(.pb-timerecords-table, .tw-payroll-grid) .tw-time-pill {
    background: var(--vpb-accent-soft);
    border-color: transparent;
    color: var(--color-accent);
    font-family: var(--vpb-font-body);
}

/* Payroll table: quiet heads, hairlines, hours and cost in mono tabular figures. */
.vision-theme-scope[data-vision-theme="visionpb"] .pb-timerecords-table .mud-table-head .mud-table-cell {
    background: var(--vpb-cotton);
    color: var(--color-ink-2);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .pb-timerecords-table .mud-table-body .mud-table-cell {
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .pb-timerecords-table .mud-table-body .mud-table-row:hover > .mud-table-cell {
    background: var(--vpb-paper-3);
}

.vision-theme-scope[data-vision-theme="visionpb"] .tw-payroll-grid .mud-table-head .mud-table-cell {
    background: var(--vpb-cotton);
    color: var(--color-ink-2);
    font-weight: 500;
}

.vision-theme-scope[data-vision-theme="visionpb"] .tw-payroll-grid .mud-table-body .mud-table-cell {
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .tw-payroll-grid .mud-table-body .mud-table-row:hover > .mud-table-cell {
    background: var(--vpb-paper-3);
}

/* Payroll summary stats bar is inline-styled in markup (white, slate); !important beats those inline styles. */
.vision-theme-scope[data-vision-theme="visionpb"] .tw-time-shell > div[style*="flex-wrap"] {
    background: var(--vpb-cotton) !important;
    border-color: transparent !important;
    border-radius: var(--vpb-radius-card) !important;
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .tw-time-shell > div[style*="flex-wrap"] span[style*="font-weight: 700"] {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500 !important;
}

/* Pinned columns (Account, Total) keep the sheet's cotton instead of Mud's grey, and follow row hover. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-body .mud-table-cell:is(.sticky-left, .sticky-right) {
    background: var(--vpb-cotton);
}

.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-body .mud-table-row:hover > .mud-table-cell:is(.sticky-left, .sticky-right) {
    background: var(--vpb-paper-3);
}

/* Plain (non-drill) money cells render as a classless span: mono and tabular like the drill-downs. */
.vision-theme-scope[data-vision-theme="visionpb"] .report-table-frame .mud-table-body .mud-table-cell > span[class=""]:only-child {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
}
