/* Store notification sheet - the Requisition Approval / Recommend dialog chrome.
   Shared by every Store form that raises an approval (Requisition, Requisition Approval) and
   kept global on purpose: the sheet projects its content from the host page, and a scoped
   stylesheet cannot reach the InputSelect / InputTextArea elements those pages render.

   Same chrome, fonts and sizes as the CFS Cost Review / EIR notification dialogs:
   gold title + opened-at stamp, one dotted meta row, underline fields in the approval strip,
   summary/detail tabs, collapsible section grids and a pill footer. */

.store-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(1.5px);
}

.store-sheet-dialog {
    /* The app header is a sticky 56px bar (z-index 1000) and this sheet renders inside
       .d365-main-content, so no z-index can paint over it — anchor below it instead of centring. */
    --sheet-top: calc(var(--d365-header-height, 56px) + 10px);
    --sheet-gap: 12px;
    --sheet-max-h: min(46rem, calc(100vh - var(--sheet-top) - var(--sheet-gap)));
    position: fixed;
    top: var(--sheet-top);
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    width: min(92rem, 96vw);
    max-width: 96vw;    height: fit-content;
    max-height: var(--sheet-max-h);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1300;
}

/* Approval / reference sheets carry one short grid, so they open at reading width instead of
   stretching across a wide monitor. */
.store-sheet-dialog-narrow {
    width: min(54rem, 94vw);
    max-width: 94vw;
}

.store-sheet-toast {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: var(--sheet-max-h, calc(100vh - 96px));
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28), 0 2px 8px rgba(15, 23, 42, 0.08);
}

.store-sheet-toast .apple-toast-header {
    flex: 0 0 auto;
    align-items: center;
    padding: 7px 14px 4px;
}

.store-sheet-toast .apple-toast-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
}

.store-sheet-toast .apple-toast-datetime {
    font-size: 10.5px;
}

.store-sheet-toast .apple-toast-close {
    width: 22px;
    height: 22px;
}

.store-sheet-toast .apple-toast-separator {
    flex: 0 0 auto;
}

/* ---- meta row ---- */
.store-sheet-meta {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 4px 14px 5px;
    font-size: 10.5px;
    line-height: 1.3;
    color: #38414d;
    background: #fff;
}

.store-sheet-meta-code {
    color: #0078d4;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.store-sheet-meta-sep {
    flex: 0 0 auto;
    width: 3px;
    height: 3px;
    margin: 0 7px;
    border-radius: 50%;
    background: #c2c8d0;
}

.store-sheet-meta-item {
    color: #38414d;
    font-weight: 500;
}

/* ---- page shell ---- */
.store-sheet-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    font-family: 'SF Pro Text', 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---- approval strip ---- */
.store-sheet-approval {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 14px 0;
    padding: 0;
}

.store-sheet-approval-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4f7396;
    white-space: nowrap;
}

.store-sheet-approval-stamp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: #6b6257;
    white-space: nowrap;
    padding: 2px 8px;
    border: 1px solid #d3e3f3;
    border-radius: 999px;
    background: #f3f8fd;
}

.store-sheet-approval-stamp span {
    font-variant-numeric: tabular-nums;
}

.store-sheet-approval .d365-form-control {
    min-height: 24px;
    height: 24px;
    padding: 0 2px;
    border: 0;
    border-bottom: 1px solid #c6d5e2;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    /* select elements do not inherit the card font on their own */
    font-family: inherit;
    font-size: 11.5px;
    line-height: 1.2;
    color: #323130;
}

.store-sheet-approval .d365-form-control:focus {
    border-bottom-color: #0078d4;
    box-shadow: none;
}

/* dynamics365.css renders every select as a native "menulist", which ignores the underline
   chrome above and squeezes the option text into the 24px box. Draw the field ourselves and
   render the chevron as an icon element, so it cannot be swallowed by the global select reset. */
.store-sheet-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 1 12rem;
    min-width: 9.5rem;
    max-width: 100%;
}

.store-sheet-approval .store-sheet-approval-status {
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0 18px 0 2px;
    background: transparent;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}

.store-sheet-select > i {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    line-height: 1;
    color: #0078d4;
    pointer-events: none;
}

.store-sheet-approval-lock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #f3f2f1;
    color: #605e5c;
    border: 1px solid #d2d0ce;
    white-space: nowrap;
}

/* Remarks keeps the legacy multi-line box, drawn as an underline field so it matches the strip. */
.store-sheet-remarks-row {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 14px 0;
}

.store-sheet-remarks-row .store-sheet-approval-label {
    padding-top: 3px;
}

.store-sheet-remarks-row .store-sheet-remarks-input {
    flex: 1 1 auto;
    /* The shared .d365-form-control rule pins inputs to 32px high; a textarea needs both rows. */
    height: auto;
    min-height: 34px;
    padding: 2px 2px 3px;
    border: 0;
    border-bottom: 1px solid #c6d5e2;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 11.5px;
    font-family: inherit;
    line-height: 1.35;
    color: #323130;
    resize: vertical;
}

.store-sheet-remarks-row .store-sheet-remarks-input:focus {
    border-bottom-color: #0078d4;
    box-shadow: none;
    outline: none;
}

/* ---- tabs ---- */
.store-sheet-tabs {
    display: flex;
    gap: 18px;
    padding: 0 14px;
    margin-top: 4px;
    border-bottom: 1px solid #dde5ed;
    background: #fff;
    flex: 0 0 auto;
}

.store-sheet-tab {
    padding: 4px 0;
    font-family: inherit;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.2px;
    color: #7b8a99;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.store-sheet-tab:hover {
    color: #5d6773;
}

.store-sheet-tab.active {
    font-weight: 600;
    color: #005a9e;
    border-bottom-color: #0078d4;
}

/* ---- body ---- */
.store-sheet-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 5px 12px 6px;
    min-height: 80px;
    background: #fff;
}

.store-sheet-body-flat {
    padding-top: 0;
}

.store-sheet-empty {
    text-align: center;
    color: #888;
    padding: 28px;
    font-size: 11px;
}

/* ---- details: collapsible ref sections ---- */
.store-sheet-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.store-sheet-group {
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
}

.store-sheet-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 26px;
    padding: 4px 2px;
    border: none;
    border-bottom: 1px solid #dde5ed;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background 0.15s ease;
}

.store-sheet-group-header:hover {
    background: rgba(0, 120, 212, 0.05);
}

.store-sheet-toggle {
    display: inline-flex;
    color: #4a6f92;
    font-size: 11px;
    width: 14px;
    justify-content: center;
    flex-shrink: 0;
}

.store-sheet-group-count {
    font-size: 10px;
    color: #7b8a99;
}

.store-sheet-group-amount {
    margin-left: auto;
    font-weight: 700;
    font-size: 12px;
    color: #323130;
    font-variant-numeric: tabular-nums;
}

.store-sheet-group-table {
    padding: 0;
    background: #fff;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    border-top: 1px solid #edebe9;
}

/* ---- grid (11px cells, 9px uppercase headers) ---- */
.store-sheet-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: auto;
}

.store-sheet-grid th {
    background: transparent;
    padding: 3px 7px 4px;
    white-space: nowrap;
    border-bottom: 1px solid #dde5ed;
    text-transform: uppercase;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #7b8a99;
    text-align: left;
}

.store-sheet-grid td {
    padding: 4px 7px;
    border-bottom: 1px solid #eef2f6;
    white-space: nowrap;
    vertical-align: middle;
    color: #323130;
}

.store-sheet-grid th,
.store-sheet-grid td {
    width: 1%;
}

.store-sheet-grid th:last-child,
.store-sheet-grid td:last-child {
    width: auto;
}

.store-sheet-grid tbody tr:last-child td {
    border-bottom: none;
}

.store-sheet-grid td:not(.num) {
    max-width: 26rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-sheet-grid tbody tr:hover {
    background-color: #f8fbff;
}

.store-sheet-grid tbody tr.selected {
    background-color: #eaf4fd;
}

.store-sheet-grid td.num,
.store-sheet-grid th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 3.25rem;
    padding-right: 12px;
}

/* Section headers read like the underline form labels — gold, plain weight, rule below. */
.store-sheet-group-header .store-sheet-badge {
    background: transparent;
    color: #4a6f92;
    padding: 0;
    border-radius: 0;
    min-width: 0;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.2px;
    text-transform: none;
}

.store-sheet-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    min-width: 4.5rem;
}

.group-first {
    background: #e6f4ea;
    color: #0b5a0b;
}

.group-second {
    background: #e0e6ff;
    color: #2b3d9e;
}

.group-third {
    background: #f2e6ff;
    color: #5a1e8a;
}

.group-ref {
    background: #f3f2f1;
    color: #605e5c;
}

/* ---- summary cards ---- */
.store-sheet-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.store-sheet-summary-card {
    border: 1px solid #dfe6ec;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    border-left: 3px solid #0078d4;
}

.store-sheet-summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid #eef2f6;
}

.store-sheet-summary-card-title {
    font-weight: 600;
    font-size: 11.5px;
    color: #323130;
}

.store-sheet-summary-card-body {
    padding: 8px 10px;
}

.store-sheet-summary-card-vendor {
    font-size: 10.5px;
    color: #6b6459;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-sheet-summary-card-amount {
    font-size: 15px;
    font-weight: 700;
    color: #201f1e;
    text-align: right;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.store-sheet-summary-card-pct {
    height: 6px;
    background: #f3f2f1;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.store-sheet-summary-card-bar {
    height: 100%;
    background: #0078d4;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.store-sheet-summary-card-meta {
    font-size: 11px;
    color: #605e5c;
    text-align: right;
}

/* ---- totals ---- */
.store-sheet-totals-panel {
    border: 0;
    border-top: 1px solid #dde5ed;
    background: transparent;
    padding: 6px 2px 0;
    max-width: 28rem;
    margin-left: auto;
}

.store-sheet-totals-compact {
    margin-top: 12px;
}

.store-sheet-total-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
    color: #323130;
    border-bottom: 1px solid #eef2f6;
    font-variant-numeric: tabular-nums;
}

.store-sheet-total-row:last-child {
    border-bottom: none;
}

.store-sheet-total-row.net {
    font-weight: 700;
    font-size: 12px;
    color: #201f1e;
    padding-top: 5px;
    margin-top: 2px;
    border-top: 1px solid #dde5ed;
}

/* ---- footer pills ---- */
.store-sheet-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 5px 12px 7px;
    background: #fff;
    border-top: 1px solid #f1f3f5;
}

.store-sheet-page .store-sheet-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    border-radius: 8px;
    background: #f1f3f5;
    color: #38414d;
    font-family: 'SF Pro Text', 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    padding: 6px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.store-sheet-page .store-sheet-pill i {
    font-size: 11px;
    line-height: 1;
}

.store-sheet-page .store-sheet-pill:hover {
    background: #e6e9ed;
}

.store-sheet-page .store-sheet-pill.icon {
    width: 24px;
    height: 24px;
    padding: 0;
    justify-content: center;
}

.store-sheet-page .store-sheet-pill.primary {
    background: #0078d4;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.28);
}

.store-sheet-page .store-sheet-pill.primary:hover {
    background: #106ebe;
}

.store-sheet-page .store-sheet-pill:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #e9edf1;
    color: #8b9198;
    box-shadow: none;
}

/* Keep the notification bar compact on narrower screens */
@media (max-width: 900px) {
    .store-sheet-approval {
        flex-wrap: wrap;
    }

    .store-sheet-select {
        flex: 1 1 12rem;
        max-width: none;
    }
}

/* ---- requisition approval specifics ---- */
.store-sheet-req {
    color: #d64545;
    font-weight: 700;
}

/* The approver trims the requisition here: qty stays editable in the grid, and a ticked line
   is drawn struck-through so the removal is obvious before Update is pressed. */
.store-sheet-grid-approval td {
    vertical-align: middle;
}

/* The generic ".store-sheet-grid th, td { width: 1% }" rule left the qty cell sized by an input
   that was itself width:100% - a circular width that resolved to zero, so the qty value was
   clipped away. Give the column and the box a real width instead. */
.store-sheet-grid-approval th.num,
.store-sheet-grid-approval td.num {
    width: 96px;
}

.store-sheet-grid-approval .store-sheet-edit-num {
    display: block;
    width: 5.5rem;
    max-width: 100%;
    box-sizing: border-box;
    height: 22px;
    padding: 0 4px 1px;
    border: 0;
    border-bottom: 1px solid #c6d5e2;
    border-radius: 0;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: #323130;
    outline: none;
    box-shadow: none;
    /* Number spinners stole the right-hand pixels the qty needs. */
    -moz-appearance: textfield;
    appearance: textfield;
}

.store-sheet-grid-approval .store-sheet-edit-num::-webkit-outer-spin-button,
.store-sheet-grid-approval .store-sheet-edit-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.store-sheet-grid-approval .store-sheet-edit-num:focus {
    border-bottom-color: #0078d4;
}

.store-sheet-grid-approval .store-sheet-edit-num:disabled {
    color: #a19f9d;
    border-bottom-color: transparent;
}

.store-sheet-row-removed td {
    color: #a19f9d;
    text-decoration: line-through;
    background: #fdf3f3;
}

.store-sheet-row-removed td:first-child {
    text-decoration: none;
}