/* VisionPb: inventory, purchasing, deliveries and catalog content. Record pages (product edit, purchase order,
   CMS product edit) get cotton cards, tabs on a rule and mono figures. Lists keep the shared layer's sheet.
   PurchaseOrder.razor.css writes card, table and panel rules with !important (copied from Order.razor.css);
   where a rule below repeats a property under !important it is only to beat that scoped declaration. */

/* ---------- Product edit: overview card and tab set are cotton records ---------- */

/* The product header strip and the tab set sit on cotton with a lit edge and soft cast. */
.vision-theme-scope[data-vision-theme="visionpb"] .product-overview-card.mud-paper,
.vision-theme-scope[data-vision-theme="visionpb"] .product-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 product name is the record's title: 600, tight, never heavy. */
.vision-theme-scope[data-vision-theme="visionpb"] .product-overview-card .mud-typography-h5 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Tabs sit on a rule: quiet labels, the active one in ink with the blue bar. */
.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-tabs-tabbar {
    background: var(--vpb-cotton);
    border-block-end: 1px solid var(--color-rule);
    border-radius: var(--vpb-radius-card) var(--vpb-radius-card) 0 0;
}

.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-tab {
    font-family: var(--vpb-font-body);
    font-weight: 500;
    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"] .product-tabs .mud-tab:hover {
    color: var(--color-ink);
    background: var(--vpb-paper-3);
}

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

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

.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-tabs-panels {
    background: var(--vpb-cotton);
    border-radius: 0 0 var(--vpb-radius-card) var(--vpb-radius-card);
}

/* Cards inside a tab share the tab's cotton: hairline frame, no second cast (never a card inside a card). */
.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-tabs-panels .mud-paper:not(.mud-popover),
.vision-theme-scope[data-vision-theme="visionpb"] .product-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;
}

/* Tables in a tab: transparent over the cotton, quiet heads, hairlines, tabular figures. */
.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-table {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-table-head .mud-table-cell {
    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"] .product-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"] .product-tabs .mud-table-body .mud-table-row:hover > .mud-table-cell {
    background: var(--vpb-paper-3);
}

/* Quantities and costs: right-aligned cells set in mono. */
.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-table-body .mud-table-cell-align-right,
.vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-table-body .mud-table-cell.mud-table-cell-align-right {
    font-family: var(--vpb-font-mono);
    text-align: end;
}

/* ---------- CMS product edit and any FormSection page: quiet section heads on cotton ---------- */

/* A form section is a hairline-framed block; its head is a quiet strip, not a grey bar. */
.vision-theme-scope[data-vision-theme="visionpb"] .form-section.mud-paper {
    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"] .form-section-header {
    background: var(--vpb-paper-3);
    border-block-end: 1px solid var(--color-rule);
}

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

.vision-theme-scope[data-vision-theme="visionpb"] .form-section-content {
    background: transparent;
}

/* The CMS page title (the only h5 directly in the cotton page paper). */
.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper > .mud-typography-h5 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ---------- Purchase order page: same family as the order page, tokens re-pointed ---------- */

/* PurchaseOrder.razor.css defines --po-* aliases on .po-root; point them at the warm system. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root {
    --po-card-radius: var(--vpb-radius-card);
    --po-card-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock);
    --po-card-shadow-hover: var(--vpb-edge-stock), var(--vpb-cast-stock);
    --po-text-primary: var(--color-ink);
    --po-text-secondary: var(--color-ink-2);
    --po-accent-blue: var(--color-accent);
    --po-border-color: var(--color-rule);
    font-family: var(--vpb-font-body);
}

/* The pinned section nav and summary hide scrolling content with the paper ground. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .order-sticky-stack {
    background: var(--color-paper);
}

/* Page title: ink, 600, with the blue underline kept as the single accent. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-typography-h5 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Cards: cotton, lit edge, soft cast; no lift on hover (beats the page's border and hover !important). */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-card {
    background: var(--vpb-cotton) !important;
    border: 0 !important;
    border-radius: var(--vpb-radius-card) !important;
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock) !important;
    transition: none !important;
    transform: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-card:hover {
    box-shadow: var(--vpb-edge-stock), var(--vpb-cast-stock) !important;
    transform: none;
}

/* Card heads: clear, 600. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-card .mud-card-header .mud-typography,
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-typography-h6 {
    font-weight: 600 !important;
    letter-spacing: -0.015em;
}

/* Tables (items, receipts, payments): cotton sheet, quiet sentence-case heads, hairlines. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-table {
    background: var(--vpb-cotton);
    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"] .po-root .mud-table thead th {
    background: var(--vpb-cotton) !important;
    color: var(--color-ink-2) !important;
    font-size: var(--text-sm) !important;
    font-weight: 500 !important;
    letter-spacing: 0;
    text-transform: none;
    border-bottom: 1px solid var(--color-rule-strong) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-table tbody td {
    border-bottom-color: var(--color-rule) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-table tbody tr:hover {
    background-color: var(--vpb-paper-3) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--color-surface-2) !important;
}

/* Quantities and costs: right-aligned cells in mono with tabular figures; their heads stay in body type. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-table-cell-align-right {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root thead .mud-table-cell-align-right {
    font-family: var(--vpb-font-body);
}

/* Status and notes panels: stock edge, cotton heads, recessed bodies. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-expansion-panels {
    border: 0 !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"] .po-root .mud-expansion-panel-header {
    background: var(--vpb-cotton) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-expansion-panel-header:hover {
    background: var(--vpb-paper-3) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-expansion-panel-content {
    background: var(--color-surface-2) !important;
    border-top-color: var(--color-rule) !important;
}

/* Links are the accent; alerts of info kind take the soft tint. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-link {
    color: var(--color-accent) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-link:hover {
    color: var(--vpb-accent-2) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-alert-info {
    background: var(--vpb-accent-soft) !important;
    border: 0 !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-divider {
    border-color: var(--color-rule) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-button-root {
    letter-spacing: 0 !important;
    transition: color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out) !important;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-button-root:hover {
    box-shadow: none;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-chip {
    transition: none !important;
}

/* Focus stays visible on the panel heads. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-expansion-panel-header:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* ---------- Lists: figures in mono ---------- */

/* PO list total and balance pairs: amounts in mono, the small labels stay in body type. */
.vision-theme-scope[data-vision-theme="visionpb"] .po-amounts {
    font-variant-numeric: tabular-nums;
}

.vision-theme-scope[data-vision-theme="visionpb"] .po-amounts > :not(.po-amounts__label) {
    font-family: var(--vpb-font-mono);
}

/* Right-aligned grid cells (price, cost, quantity) in body rows: mono, tabular. */
.vision-theme-scope[data-vision-theme="visionpb"] .pb-capped-grid .mud-table-body .mud-table-cell-align-right {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
}

/* Products summary tiles: the figure is a number, so mono and tabular (tile = a paper holding a caption then an h6). */
.vision-theme-scope[data-vision-theme="visionpb"] .mud-paper.mud-paper-outlined > .mud-typography-caption + .mud-typography-h6 {
    font-family: var(--vpb-font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* ---------- Touch ---------- */

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

    .vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-expansion-panel-header {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vision-theme-scope[data-vision-theme="visionpb"] .product-tabs .mud-tab,
    .vision-theme-scope[data-vision-theme="visionpb"] .po-root .mud-button-root {
        transition: none !important;
    }
}
