/* VisionPb: APM contracts (list, contract editor). Cotton sheet for the grid, cotton cards for the record. */

/* List: the grid sits on one cotton sheet (the paper that directly wraps the capped grid). */
.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper:has(> .mud-table.pb-capped-grid) {
    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"] .pb-capped-grid.mud-table,
.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-container {
    background: transparent;
    box-shadow: none;
}

/* Quiet heads: muted, 500, sentence case, one line. */
.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-head .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-head .mud-table-cell .column-header {
    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;
    white-space: nowrap;
}

/* Horizontal hairlines only. */
.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-cell {
    border-inline: 0;
    border-block-start: 0;
    border-block-end: 1px solid var(--color-rule);
}

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

.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-body .mud-table-row:last-child .mud-table-cell {
    border-block-end: 0;
}

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

.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-body .mud-table-row.mud-selected-item > .mud-table-cell {
    background: var(--vpb-accent-soft);
}

/* Editor: the summary strip (the paper holding the contract id heading) and the tab set are cotton records.
   Only on the contract editor page (the one holding .apm-edit-tabs), so other pages' card headings are untouched. */
.vision-theme-scope[data-vision-theme="visionpb"] .mud-main-content:has(.apm-edit-tabs) .mud-paper:has(> .d-flex > .mud-typography-h6),
.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs.mud-tabs {
    background: var(--vpb-cotton);
    border: 0;
    border-radius: var(--vpb-radius-card);
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock);
}

/* The contract id in the strip reads as an identifier (contract editor only). */
.vision-theme-scope[data-vision-theme="visionpb"] .mud-main-content:has(.apm-edit-tabs) .mud-paper > .d-flex > .mud-typography-h6 {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
}

/* Tabs: sticky header sits on cotton (its inline <style> uses the surface colour); blue accent bar stays. */
.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tabs-header {
    background: var(--vpb-cotton);
    border-radius: var(--vpb-radius-card) var(--vpb-radius-card) 0 0;
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tabs-tabbar {
    border-block-end: 1px solid var(--color-rule);
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tab {
    font-family: var(--vpb-font-body);
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-ink-2);
    transition: color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tab:hover {
    color: var(--color-ink);
    background: var(--vpb-paper-3);
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tab.mud-tab-active {
    color: var(--color-accent);
    font-weight: 600;
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tab-slider {
    background: var(--color-accent);
}

/* Form sections inside a tab share the tab's cotton: a hairline frame and the quiet title, no second cast. */
.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tabs-panels .mud-paper,
.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tabs-panels .mud-card {
    background: var(--vpb-cotton);
    border: 1px solid var(--color-rule);
    border-radius: var(--vpb-radius-card);
    box-shadow: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .form-section-title {
    color: var(--color-ink);
    font-family: var(--vpb-font-body);
    font-weight: 600;
}

/* Tables inside the editor (chemicals, orders): quiet heads, hairlines, tabular figures. */
.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-table {
    background: transparent;
    box-shadow: none;
    border: 0;
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-table-head .mud-table-cell,
.vision-theme-scope[data-vision-theme="visionpb"] .chemicals-header {
    background: transparent;
    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"] .apm-edit-tabs .mud-table-cell {
    border-inline: 0;
    border-block-end: 1px solid var(--color-rule);
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .chemicals-row {
    border-block-start-color: var(--color-rule);
}

/* Generated-visit rows (updated/created orders diff). */
.vision-theme-scope[data-vision-theme="visionpb"] .apm-visit-row:nth-child(even) {
    background: var(--vpb-paper-3);
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-visit-row:hover {
    background: var(--vpb-accent-soft);
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-visit-date {
    background: var(--vpb-paper-3);
    color: var(--color-ink);
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .apm-visit-meta,
.vision-theme-scope[data-vision-theme="visionpb"] .apm-visit-was {
    color: var(--color-ink-2);
}

/* Touch: 44px tab targets. */
@media (any-pointer: coarse) {
    .vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tab {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vision-theme-scope[data-vision-theme="visionpb"] .apm-edit-tabs .mud-tab {
        transition: none;
    }
}
