/* Job prices (change orders) inside the job screen.
   Toolbar reuses po-topbar / sc-menu-bar. Header and selected-row paint stay in silvercards-data-grid.css. */

.je-root,
.je-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #222;
    font-size: var(--sc-desktop-font-size, 0.75rem);
    container-type: inline-size;
}

.je-topbar {
    flex-wrap: wrap;
    gap: 0.125rem;
    /* po-topbar paints var(--po-bar), which is only set on the purchase-order page. */
    background: #b4b4b4;
}

.je-page .po-tool:focus-visible,
.je-pencil:focus-visible,
.je-expand:focus-visible,
.je-refresh:focus-visible {
    outline: 2px solid #2828da;
    outline-offset: 1px;
}

.je-stack {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-height: 2.4rem;
    justify-content: center;
}

.je-center {
    text-align: center;
}

.je-right,
.je-money {
    display: block;
    text-align: right;
}

.je-grid .je-money,
.je-prices .je-money {
    font-size: 0.875rem;
    line-height: 1.25;
}

.je-grid .mud-table-head .je-col-money,
.je-grid .mud-table-foot .je-col-money,
.je-grid .mud-table-body .je-col-money {
    text-align: right;
}

.je-grid .mud-table-head .je-col-center,
.je-grid .mud-table-foot .je-col-center,
.je-grid .mud-table-body .je-col-center {
    text-align: center;
}

.je-col-center {
    align-items: center;
}

.je-percent {
    white-space: nowrap;
}

.je-ellipsis {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Smaller sort chevrons so headers stay content-sized (Clock / PO pattern). */
.je-grid .mud-table-head .sort-direction-icon {
    font-size: 0.75rem;
    width: 0.75rem;
    height: 0.75rem;
    margin-inline-start: 0.125rem;
}

.je-grid .mud-table-head .sort-direction-icon svg {
    width: 0.75rem;
    height: 0.75rem;
}

/* MudSelect caret: row hover or selected row (nested bid-prices grid too). */
.je-grid .mud-select .mud-input-adornment-end,
.je-prices .mud-select .mud-input-adornment-end {
    visibility: hidden;
}

.je-grid .mud-table-row:hover .mud-select .mud-input-adornment-end,
.je-grid .mud-table-row.sc-datagrid-row-selected .mud-select .mud-input-adornment-end,
.je-prices .mud-table-row:hover .mud-select .mud-input-adornment-end,
.je-prices .mud-table-row.sc-datagrid-row-selected .mud-select .mud-input-adornment-end {
    visibility: visible;
}

/* Date: plain text when idle; calendar button only while the picker is focused. */
.je-grid .mud-table-body .mud-table-cell:not(.mud-table-cell-edit) .mud-input-adornment-end {
    display: none !important;
}

.je-grid .je-date-picker:not(:focus-within) .mud-input-adornment-end {
    visibility: hidden;
    width: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.je-grid .je-date-picker:focus-within .mud-input-adornment-end {
    visibility: visible;
    width: auto;
}

.je-grid .je-date-picker:not(:focus-within) .mud-input-root {
    padding-inline-end: 0.25rem;
}

.je-date-text {
    white-space: nowrap;
}

.je-number {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
}

.je-sub {
    font-size: 0.75rem;
    line-height: 1.2;
    color: #222;
}

.je-placeholder {
    color: #5c5c5c;
}

.je-wrap {
    white-space: pre-wrap;
}

.je-bid-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}

.je-pencil,
.je-expand,
.je-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #383434;
    cursor: pointer;
    padding: 0;
    min-width: 1.5rem;
    min-height: 1.5rem;
}

.je-pencil {
    opacity: 0;
    transition: opacity 200ms;
}

.je-expand {
    opacity: 0;
    transition: opacity 200ms;
}

.je-grid .mud-table-row:hover .je-pencil,
.je-grid .mud-table-row:hover .je-expand,
.je-pencil:focus-visible,
.je-expand:focus-visible {
    opacity: 1;
}

.je-pencil:disabled {
    opacity: 0;
    cursor: default;
}

.je-check {
    width: 1rem;
    height: 1rem;
    margin: 0.15rem auto;
    display: block;
}

.je-prices {
    margin: 0.5rem 1rem 0.75rem;
}

.je-grid .mud-input-control,
.je-grid .mud-select,
.je-grid .mud-input-slot {
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .je-pencil,
    .je-expand {
        transition: none;
    }
}

.je-edit-body {
    padding: 1rem 1.25rem 1.25rem;
    background: #fff;
}

.je-edit-title {
    font-size: 1rem;
    font-weight: 600;
    color: #222833;
}

.je-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.je-edit-header-end {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.je-edit-header-date {
    flex: 0 0 auto;
    max-width: 7.5rem;
}

.je-edit-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #606a78;
    cursor: pointer;
    border-radius: 4px;
}

.je-edit-close:hover {
    background: #f6f7f9;
}

.je-edit-close:disabled {
    cursor: default;
    opacity: 0.5;
}

.je-edit-dialog .je-edit-header-date .mud-input-label {
    display: none;
}

.je-edit-dialog .je-edit-header-date .mud-input-root {
    min-height: 34px;
}

.je-edit-dialog .je-field-scope .mud-input-slot {
    white-space: normal;
    line-height: 1.35;
}

.je-edit {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: min(50rem, 100%);
    max-width: 52rem;
}

.je-edit-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.je-edit-heading-row {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.je-edit-heading {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #222833;
    letter-spacing: 0.01em;
}

.je-edit-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: #8a919c;
}

.je-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.je-edit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.je-edit-row-price {
    align-items: flex-end;
}

.je-edit-row-order,
.je-edit-row-progress {
    align-items: flex-end;
}

.je-edit-accepted {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding-bottom: 0.15rem;
}

/* Figma field labels */
.je-edit-dialog .mud-input-label,
.je-edit-dialog label.mud-input-label {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: #606a78 !important;
}

.je-edit-dialog .mud-input-control {
    margin-top: 0.125rem;
}

/* 34px underline inputs */
.je-edit-dialog .je-field-edit .mud-input-root,
.je-edit-dialog .je-field-edit .mud-select-input {
    min-height: 34px;
}

.je-edit-dialog .je-field-edit .mud-input-underline::before {
    border-bottom-color: #bec5cf !important;
}

.je-edit-dialog .je-field-edit .mud-input-underline:hover::before {
    border-bottom-color: #9aa3b0 !important;
}

.je-edit-dialog .je-field-edit.mud-input-error .mud-input-underline::before {
    border-bottom-color: var(--mud-palette-error) !important;
}

/* Read-only fields */
.je-edit-dialog .je-field-readonly .mud-input-slot {
    background-color: #f6f7f9 !important;
    border: 1px solid #dde1e7 !important;
    border-radius: 2px;
    min-height: 34px;
    padding-inline: 0.5rem;
}

.je-edit-dialog .je-field-readonly .mud-input-underline::before,
.je-edit-dialog .je-field-readonly .mud-input-underline::after {
    display: none;
}

.je-edit-dialog .je-edit-money input,
.je-edit-dialog .je-edit-money .mud-input-slot {
    text-align: right;
}

.je-edit-dialog .je-percent-field input {
    text-align: right;
}

.je-w-price {
    flex: 0 0 15rem;
    max-width: 15rem;
}

.je-w-fob {
    flex: 0 0 11.25rem;
    max-width: 11.25rem;
}

.je-w-order {
    flex: 0 0 21.75rem;
    max-width: 21.75rem;
}

.je-w-bid {
    flex: 0 0 12.5rem;
    max-width: 12.5rem;
}

.je-field-detailer {
    flex: 1 1 10rem;
    min-width: 8rem;
}

.je-field-status {
    flex: 1 1 9rem;
    min-width: 7rem;
}

.je-w-pct {
    flex: 0 0 7.5rem;
    max-width: 7.5rem;
}

.je-w-sov {
    flex: 0 0 9rem;
    max-width: 9rem;
}

.je-edit-bid-inline {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.je-edit-bid-inline .je-edit-bid-field {
    width: 100%;
}

.je-edit-bid-inline .je-pencil-inline {
    position: absolute;
    right: 0.25rem;
    bottom: 0.35rem;
    opacity: 1;
}

.je-edit-bid-inline .je-pencil-inline:disabled {
    opacity: 0.35;
}

.je-edit-dialog .je-accepted-check .mud-checkbox-icon {
    color: #4a5568;
}

.je-edit-dialog .mud-dialog-actions {
    padding: 0.75rem 1.25rem 1rem;
    gap: 0.5rem;
}

/* Bid prices table inside dialog */
.je-prices-dialog {
    margin: 0;
    border: 1px solid #dde1e7;
    border-radius: 2px;
    overflow: hidden;
}

.je-prices-loading {
    min-height: 6.5rem;
}

.je-edit-error {
    margin: 0;
}

.je-edit-dialog .je-prices-grid.mud-data-grid {
    border: 0;
}

.je-edit-dialog .je-prices-dialog .mud-table-root {
    border-collapse: collapse;
}

.je-edit-dialog .je-prices-dialog .mud-table-head .mud-table-cell {
    background-color: #424242 !important;
    color: #f0f0f0 !important;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem !important;
}

.je-edit-dialog .je-prices-dialog .mud-table-body .mud-table-cell {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem;
    border-bottom: 1px solid #e8eaed;
}

.je-edit-dialog .je-prices-dialog .je-check-round {
    accent-color: #5146c8;
}

.je-edit-dialog .je-prices-dialog .je-money {
    font-size: 0.75rem;
}

.je-edit-dialog .je-prices-dialog .mud-select .mud-input-adornment-end {
    visibility: visible;
}

.je-edit-dialog .je-prices {
    margin: 0;
}

@container (max-width: 24rem) {
    .po-topbar.je-topbar {
        height: auto;
        max-height: none;
        min-height: var(--sc-toolbar-row, 30px);
    }
}

/* Job contracts tab: Prices-tab grid plus the WPF summary block under it. */
.jc-attach {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    border: 0;
    background: transparent;
    color: #383434;
    cursor: pointer;
    padding: 0;
    min-width: 1.5rem;
    min-height: 1.5rem;
}

/* Cell edit mode renders the input in every editable cell; keep money right-aligned like WPF. */
.jc-grid .mud-table-body .je-col-money input {
    text-align: right;
}

.jc-attach-count {
    font-size: 0.7rem;
}

.jc-hover-only {
    opacity: 0;
    transition: opacity 200ms;
}

.jc-grid .mud-table-row:hover .jc-hover-only,
.jc-grid .mud-table-row.sc-datagrid-row-selected .jc-hover-only,
.jc-attach:focus-visible {
    opacity: 1;
}

.jc-attach:focus-visible {
    outline: 2px solid #2828da;
    outline-offset: 1px;
}

.jc-summary {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(6.25rem, auto) auto minmax(6.25rem, auto);
    justify-content: start;
    column-gap: 1.25rem;
    row-gap: 0.5rem;
    padding: 0.6rem 0.6rem 0.75rem;
    color: #424242;
    font-size: 0.875rem;
}

.jc-sum-percent,
.jc-sum-label,
.jc-sum-value {
    text-align: right;
    white-space: nowrap;
}

.jc-sum-strong {
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .jc-hover-only {
        transition: none;
    }
}
