/* Price List: the register (/pricelist, one row per price list) and its Add/Edit form
   (/pricelist/create, /pricelist/edit/...). The form sits under the shared single-row
   .top-btns-container (SaleAccount.css), which ends at 105px -- so it starts at 7rem like the master
   tables and shares the toolbar's left/right edges, then scrolls as one column of cards. */

.pl-page {
    position: fixed;
    top: 7rem;
    bottom: 1rem;
    left: 14.5rem;
    right: 1rem;
    overflow-y: auto;
    transition: left 0.2s ease;
    font-size: 13px;
    color: #1f2937;
}

.pl-page.sidebar-collapsed {
    left: 5.5rem;
}

.pl-card {
    background: #ffffff;
    border: 1px solid #e5e9f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.05);
    padding: 12px 16px;
    margin-bottom: 10px;
}

.pl-card-title {
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.pl-card-title.pl-inline {
    margin: 0;
}

.pl-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pl-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 1 240px;
    min-width: 180px;
}

.pl-field-narrow {
    flex-basis: 200px;
}

.pl-field label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
}

.pl-page select,
.pl-page input[type=date] {
    height: 34px;
    width: 100%;
    padding: 0 8px;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    font: inherit;
}

.pl-page select:focus,
.pl-page input:focus {
    outline: none;
    border-color: #3399ff;
    box-shadow: 0 0 0 2px #cce5ff;
}

.pl-hint {
    font-size: 11px;
    color: #6b7280;
}

.pl-badge-active,
.pl-badge-off {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.pl-badge-active {
    background: #dcfce7;
    color: #166534;
}

.pl-badge-off {
    background: #f1f1f1;
    color: #6b7280;
}

/* Figure switch above the grid */
.pl-grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.pl-spacer {
    flex: 1;
}

.pl-seg {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    overflow: hidden;
}

.pl-seg button {
    height: 30px;
    padding: 0 12px;
    border: none;
    border-right: 1px solid #e5e9f0;
    background: #ffffff;
    color: #1f2937;
    font: inherit;
    cursor: pointer;
}

.pl-seg button:last-child {
    border-right: none;
}

.pl-seg button.on {
    background: #3399ff;
    color: #ffffff;
    font-weight: 600;
}

/* The price grid */
.pl-table-scroll {
    overflow: auto;
    max-height: 60vh;
    border: 1px solid #e5e9f0;
    border-radius: 8px;
}

.pl-matrix {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
}

.pl-matrix th,
.pl-matrix td {
    padding: 6px 8px;
    white-space: nowrap;
    background: #ffffff;
    border-bottom: 1px solid #eef0f3;
    border-right: 1px solid #eef0f3;
}

.pl-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    /* Product Name and Rows by span both header rows; top-aligned, their dropdowns sit on the
       same line as Columns by instead of dropping to the middle. */
    vertical-align: top;
}

/* Second header row (column items) sits under the first, which is ~47px tall */
.pl-matrix thead .pl-sub-head th {
    top: 47px;
    text-align: center;
}

.pl-matrix thead select {
    height: 30px;
    min-width: 150px;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.pl-head-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pl-sticky-1 {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 200px;
    max-width: 260px;
}

.pl-sticky-2 {
    position: sticky;
    left: 200px;
    z-index: 1;
    min-width: 160px;
}

.pl-matrix thead .pl-sticky-1,
.pl-matrix thead .pl-sticky-2 {
    z-index: 3;
}

.pl-product-cell {
    vertical-align: top;
    font-weight: 600;
    white-space: normal !important;
}

.pl-row-label {
    font-weight: 500;
}

.pl-muted {
    color: #6b7280;
    font-style: italic;
}

/* Each price input fills its column; the column is at least wide enough for a 7-digit rate. */
.pl-matrix td.pl-cell {
    padding: 3px;
    min-width: 120px;
}

.pl-matrix td.pl-cell input {
    display: block;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e5e9f0;
    border-radius: 4px;
    background: transparent;
    color: #1f2937;
    font: inherit;
    text-align: right;
}

.pl-matrix td.pl-cell input:hover {
    border-color: #99c2ff;
}

.pl-matrix td.pl-cell input:focus {
    border-color: #3399ff;
    background: #ffffff;
}

.pl-matrix td.pl-cell input.has {
    background: #eef6ff;
}

/* All Products: a product that does not use the classification the grid is split by */
.pl-matrix td.pl-cell-na {
    text-align: center;
    color: #b0b6bf;
    background: #fafbfc;
}

.pl-empty {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

/* Saved prices */
.pl-saved-scroll {
    max-height: 50vh;
}

.pl-saved {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.pl-saved th,
.pl-saved td {
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid #eef0f3;
    background: #ffffff;
}

.pl-saved thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #6b7280;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pl-saved .pl-num {
    text-align: right;
}

.pl-saved .pl-action {
    position: sticky;
    right: 0;
    width: 90px;
    text-align: center;
}

.pl-saved tr.active td {
    background: #eef6ff;
}

.pl-saved .edit-icon,
.pl-saved .delete-icon {
    cursor: pointer;
    fill: #808080;
}

.pl-saved .edit-icon:hover {
    fill: #3399ff;
}

.pl-saved .delete-icon:hover {
    fill: #e53935;
}

/* The form leaves room under its last card for the Save / Cancel bar (.welcome-footer-invoice). */
.pl-form-page {
    bottom: 0;
    padding-bottom: 5rem;
}

/* Register: one row per price list */
.pl-register {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.pl-register th,
.pl-register td {
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid #eef0f3;
    background: #ffffff;
}

.pl-register thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #6b7280;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pl-register .pl-num {
    text-align: right;
}

/* Stays on screen when the table is wider than the card, as on the other registers. */
.pl-register .pl-action {
    position: sticky;
    right: 0;
    width: 110px;
    text-align: center;
}

.pl-register .edit-icon,
.pl-register .delete-icon {
    cursor: pointer;
    fill: #808080;
}

.pl-register .edit-icon:hover {
    fill: #3399ff;
}

.pl-register .delete-icon:hover {
    fill: #e53935;
}

/* Status badge that switches the list on/off */
.pl-status-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.pl-status-btn:disabled {
    cursor: default;
    opacity: 0.6;
}

/* Phone: the toolbar drops out of position:fixed (SaleAccount.css), so the page follows it. */
@media (max-width: 700px) {
    .pl-page {
        position: static;
        margin: 1rem;
        overflow: visible;
    }

    .pl-field {
        flex: 1 1 100%;
    }

    .pl-sticky-1 {
        min-width: 120px;
    }

    .pl-sticky-2 {
        left: 120px;
        min-width: 110px;
    }
}
