/* =====================================================================
   HAJIPUR PMR DETAIL VIEW — CSS matching reference screenshot
   Font: inherited from app (same as all other pages)
   ===================================================================== */

/* ---- Header back button (injected via SectionContent) ---- */
.header-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #0A0A0A;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: inherit;
    transition: color 0.12s;
    line-height: 1;
}

.header-back-btn:hover {
    color: #1a2db5;
}

.header-back-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* ================================================================
   PAGE ROOT
   ================================================================ */
.hpdv-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 10px 80px 10px;
    box-sizing: border-box;
    font-family: inherit;
    background: transparent;
    /* page bg from app */
    min-height: calc(100vh - 78px);
}

/* ================================================================
   MAIN TWO-COLUMN GRID
   ================================================================ */
.hpdv-grid {
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 12px;
    align-items: stretch;
}

.hpdv-left-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.hpdv-right-col {
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

/* ================================================================
   CARDS
   ================================================================ */
.hpdv-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
    padding: 14px 16px;
    box-sizing: border-box;
}

/* Cost Summary stretches full height */
.hpdv-cost-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ================================================================
   CARD TITLE ROW
   ================================================================ */
.hpdv-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.hpdv-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0;
    line-height: 1;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
}

.hpdv-card-title-row .hpdv-card-title {
    margin: 0;
}

/* Info icon button next to title */
.hpdv-info-badge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    border-radius: 50%;
    transition: opacity 0.15s;
}

.hpdv-info-badge-btn:hover {
    opacity: 0.7;
}

.hpdv-info-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.hpdv-codification-badge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 0;
    flex-shrink: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.hpdv-codification-badge-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.hpdv-codification-badge-btn img,
.hpdv-codification-icon {
    width: 31px;
    height: 18px;
    display: block;
}

/* Card subtitle */
.hpdv-card-subtitle {
    font-size: 11px;
    color: #808080;
    margin: 0 0 12px 0;
    line-height: 1.4;
    font-family: inherit;
}

/* ================================================================
   PMR INFORMATION — 4-column info grid
   ================================================================ */
.hpdv-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 16px;
    row-gap: 12px;
}

.hpdv-info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.hpdv-info-label {
    font-size: 11px;
    font-weight: 600;
    color: #151515;
    line-height: 1.3;
    font-family: inherit;
}

.hpdv-info-value {
    font-size: 12px;
    font-weight: 400;
    color: #808080;
    line-height: 1.4;
    font-family: inherit;
}

/* ================================================================
   RAW MATERIAL WEIGHTS CARD
   ================================================================ */
.hpdv-rm-card {
    padding: 14px 16px 14px 16px;
    overflow: hidden;
    /* so total row bg clips to card border-radius */
}

.hpdv-rm-table-wrap {
    border: 1px solid #E5E5EE;
    border-radius: 6px;
    overflow-y: auto;
    max-height: 215px;
    margin-top: 4px;
}

/* ---- Table ---- */
.hpdv-rm-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: inherit;
}

/* Column proportions for Admin PMR Details table */
.admin-rm-table .hpdv-col-material,
.admin-pmr-details-page .hpdv-rm-table .hpdv-col-material,
.hpdv-rm-table:has(.hpdv-col-price) .hpdv-col-material,
.hpdv-col-material {
    width: auto;
    min-width: 120px;
}

.admin-rm-table .hpdv-col-pct,
.admin-rm-table .hpdv-col-fweight,
.admin-pmr-details-page .hpdv-rm-table .hpdv-col-pct,
.admin-pmr-details-page .hpdv-rm-table .hpdv-col-fweight,
.hpdv-rm-table:has(.hpdv-col-price) .hpdv-col-pct,
.hpdv-col-pct {
    width: 130px;
    min-width: 120px;
    text-align: right;
}

.admin-rm-table .hpdv-col-new-fweight,
.admin-pmr-details-page .hpdv-rm-table .hpdv-col-new-fweight {
    width: 155px;
    min-width: 145px;
    text-align: right;
}

.admin-rm-table .hpdv-col-price,
.admin-pmr-details-page .hpdv-rm-table .hpdv-col-price,
.hpdv-rm-table:has(.hpdv-col-price) .hpdv-col-price,
.hpdv-col-price {
    width: 90px;
    min-width: 85px;
    text-align: right;
}

.admin-rm-table .hpdv-col-cost,
.admin-pmr-details-page .hpdv-rm-table .hpdv-col-cost,
.hpdv-rm-table:has(.hpdv-col-price) .hpdv-col-cost,
.hpdv-col-cost {
    width: 105px;
    min-width: 95px;
    text-align: right;
}

/* Production Head table proportions */
.prodhead-rm-table-revised {
    min-width: 440px;
}

.prodhead-rm-table .hpdv-col-material {
    width: auto;
    min-width: 120px;
}

.prodhead-rm-table .hpdv-col-fweight,
.prodhead-rm-table .hpdv-col-pct {
    width: 140px;
    min-width: 125px;
    text-align: right;
}

.prodhead-rm-table .hpdv-col-new-fweight {
    width: 140px;
    min-width: 125px;
    text-align: right;
}

.prodhead-rm-table th.hpdv-th {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.25;
    vertical-align: middle;
}

/* Admin table responsiveness and sizing */
.admin-pmr-details-page .hpdv-rm-table-wrap {
    overflow-x: auto;
}

.admin-pmr-details-page .hpdv-rm-table,
.admin-rm-table {
    min-width: 480px;
}

.admin-pmr-details-page .admin-rm-table-revised,
.admin-rm-table.admin-rm-table-revised {
    min-width: 630px;
}

.admin-pmr-details-page .hpdv-rm-table th,
.admin-rm-table th {
    padding: 8px 10px;
    box-sizing: border-box;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.25;
    vertical-align: middle;
}

.admin-pmr-details-page .hpdv-rm-table td,
.admin-rm-table td {
    padding: 8px 8px;
    box-sizing: border-box;
}

.admin-pmr-details-page .hpdv-select,
.admin-rm-table .hpdv-select {
    height: 32px;
    font-size: 12px;
}

.admin-pmr-details-page .hpdv-rm-table input.hpdv-plain-val,
.admin-pmr-details-page .hpdv-rm-table .hpdv-plain-val,
.admin-rm-table input.hpdv-plain-val,
.admin-rm-table .hpdv-plain-val {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    text-align: right;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.admin-pmr-details-page .hpdv-plain-text,
.admin-rm-table .hpdv-plain-text {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    text-align: right;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.admin-pmr-details-page .hpdv-rm-cost-pill,
.admin-rm-table .hpdv-rm-cost-pill {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: #FF2D55;
    background-color: #F3F4FF;
    border-radius: 5px;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}

/* Production Revised Weight Pill */
.hpdv-new-weight-val,
.admin-pmr-details-page .hpdv-new-weight-val {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: #1D4ED8;
    background-color: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 5px;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    user-select: none;
}

/* Total row alignment directly corresponding to columns above */
.admin-pmr-details-page .hpdv-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-top: 14px;
    margin-left: -16px;
    margin-right: -16px;
    margin-bottom: -14px;
    border-top: 1px solid #E5E5EE;
    background-color: #FFFFFF;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-pmr-details-page .hpdv-total-label {
    flex: 1;
    min-width: 140px;
    font-size: 12px;
    font-weight: 600;
    color: #151515;
    font-family: inherit;
    padding-right: 12px;
}

.admin-pmr-details-page .hpdv-total-values-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-pmr-details-page .hpdv-total-val-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-pmr-details-page .hpdv-total-sublabel {
    font-size: 11px;
    font-weight: 500;
    color: #6B7280;
    user-select: none;
}

.admin-pmr-details-page .hpdv-total-val-box {
    cursor: default;
    user-select: none;
}

.admin-pmr-details-page .hpdv-total-col-cost {
    width: 95px;
    display: flex;
    justify-content: flex-end;
    box-sizing: border-box;
    padding-right: 8px;
    flex-shrink: 0;
}

.admin-pmr-details-page .hpdv-total-pill-grey {
    width: 80px;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}

.admin-pmr-details-page .hpdv-select,
.admin-rm-table .hpdv-select {
    height: 32px;
    font-size: 12px;
}

.admin-pmr-details-page .hpdv-rm-table input.hpdv-plain-val,
.admin-pmr-details-page .hpdv-rm-table .hpdv-plain-val,
.admin-rm-table input.hpdv-plain-val,
.admin-rm-table .hpdv-plain-val {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    text-align: right;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.admin-pmr-details-page .hpdv-plain-text,
.admin-rm-table .hpdv-plain-text {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    text-align: right;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.admin-pmr-details-page .hpdv-rm-cost-pill,
.admin-rm-table .hpdv-rm-cost-pill {
    width: 80px;
    max-width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: #FF2D55;
    background-color: #F3F4FF;
    border-radius: 5px;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}

/* Total row alignment directly corresponding to columns above */
.admin-pmr-details-page .hpdv-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 17px;
    margin-top: 14px;
    margin-left: -16px;
    margin-right: -16px;
    margin-bottom: -14px;
    border-top: 1px solid #E5E5EE;
    background-color: #FFFFFF;
}

.admin-pmr-details-page .hpdv-total-label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #151515;
    font-family: inherit;
    padding-right: 12px;
}

.admin-pmr-details-page .hpdv-total-col-cost {
    width: 95px;
    display: flex;
    justify-content: flex-end;
    box-sizing: border-box;
    padding-right: 8px;
    flex-shrink: 0;
}

.admin-pmr-details-page .hpdv-total-pill-grey {
    width: 80px;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}

/* Header — sticky on scroll */
.hpdv-tr-head {
    background-color: #F8F9FA;
    position: sticky;
    top: 0;
    z-index: 2;
}

.hpdv-th {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #808080;
    border-bottom: 1px solid #E5E5EE;
    white-space: nowrap;
    background-color: #F8F9FA;
    font-family: inherit;
    line-height: 1.3;
}

.hpdv-th-left {
    text-align: left;
}

.hpdv-th-center {
    text-align: center;
}

.hpdv-th-right {
    text-align: right;
}

.hpdv-td-left {
    text-align: left;
}

.hpdv-td-center {
    text-align: center;
}

.hpdv-td-right {
    text-align: right;
}

/* Edit pencil button inside Percentage header */
.hpdv-edit-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    outline: none;
}

.hpdv-edit-btn:hover .hpdv-edit-icon {
    opacity: 0.8;
}

img.hpdv-edit-icon,
.hpdv-edit-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    vertical-align: middle;
    margin-left: 4px;
    position: relative;
    top: -1px;
}

.hpdv-plain-text {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 28px;
    width: 80px;
    padding: 0 8px;
    font-size: 12px;
    color: #808080;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid #E0E0E6;
    border-radius: 5px;
    background-color: #F4F5F7;
    box-sizing: border-box;
    text-align: right;
    user-select: none;
}

/* Data rows */
.hpdv-tr {
    background-color: #FFFFFF;
    border-bottom: 1px solid #F0F1F5;
}

.hpdv-tr-last {
    border-bottom: none;
}

.hpdv-td {
    padding: 8px 12px;
    vertical-align: middle;
    font-size: 12px;
    color: #0A0A0A;
    font-family: inherit;
}

.hpdv-td-center {
    text-align: center;
}

/* ---- Raw Material Dropdown ---- */
.hpdv-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.hpdv-select {
    width: 100%;
    height: 28px;
    padding: 0 26px 0 10px;
    font-size: 12px;
    color: #808080;
    background: #FFFFFF;
    border: 1px solid #E2E2E6;
    border-radius: 5px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
}

.hpdv-chevron {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #808080;
    display: flex;
    align-items: center;
}

.hpdv-chevron svg {
    width: 12px;
    height: 12px;
    stroke-width: 2;
}

/* ---- Plain values (Percentage & RM Price) — interactive input controls ---- */
input.hpdv-plain-val,
.hpdv-plain-val {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 28px;
    width: 80px;
    padding: 0 8px;
    font-size: 12px;
    color: #808080;
    font-weight: 400;
    font-family: inherit;
    border: 1px solid #E0E0E6;
    border-radius: 5px;
    background: #FFFFFF;
    box-sizing: border-box;
    text-align: right;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input.hpdv-plain-val:focus {
    border-color: #9CA3AF;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.2);
    color: #151515;
    background-color: #FFFFFF;
}

/* ---- RM Cost/Kg pill (lavender bg, red text) ---- */
.hpdv-rm-cost-pill {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 28px;
    width: 80px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: #FF2D55;
    background-color: #F3F4FF;
    border-radius: 5px;
    text-align: right;
    font-family: inherit;
    box-sizing: border-box;
}

/* ---- Total Row — full card width, separate grey separator ---- */
.hpdv-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 17px;
    margin-top: 14px;
    margin-left: -16px;
    margin-right: -16px;
    margin-bottom: -14px;
    border-top: 1px solid #E5E5EE;
    background-color: #FFFFFF;
}

.hpdv-total-label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #151515;
    font-family: inherit;
    padding-right: 12px;
}

/* Three column layout for Total row matching Percentage, RM Price, RM Cost/Kg */
.hpdv-total-cols {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.hpdv-total-col-cost {
    width: 95px;
    display: flex;
    justify-content: flex-end;
    box-sizing: border-box;
    padding-right: 8px;
    flex-shrink: 0;
}

/* Grey total pill (weight) */
.hpdv-total-pill-grey {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 32px;
    width: 80px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    color: #808080;
    background-color: #EFEFEF;
    border-radius: 5px;
    text-align: right;
    font-family: inherit;
    box-sizing: border-box;
}

/* ================================================================
   COST SUMMARY ROWS
   ================================================================ */
.hpdv-cost-card .hpdv-card-subtitle {
    padding-bottom: 12px;
    margin-bottom: 10px;
    border-bottom: 1px solid #F0F0F5;
}

.hpdv-cost-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.hpdv-cost-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    min-height: 28px;
    margin: 0;
}

.hpdv-cost-label {
    font-size: 12px;
    font-weight: 500;
    color: #151515;
    font-family: inherit;
    flex-shrink: 0;
    margin: 0;
    height: 28px;
    display: flex;
    align-items: center;
}

/* RMC value — light gray rectangular field */
input.hpdv-cost-input,
.hpdv-cost-input {
    width: 88px;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    color: #808080;
    background-color: #EFEFEF;
    border: none;
    border-radius: 5px;
    text-align: right;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: background-color 0.15s;
}

input.hpdv-cost-input:focus {
    background-color: #E5E5E8;
    color: #151515;
}

/* Opp Cost — lavender field, blue text */
.hpdv-cost-pill-blue {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 28px;
    width: 88px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #3449D8;
    background-color: #F2F3FF;
    border-radius: 5px;
    font-family: inherit;
    box-sizing: border-box;
}

/* White bordered rectangular input boxes (Profit/Margin, Min price, Quoted Price) */
input.hpdv-cost-plain-val,
.hpdv-cost-plain-val {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    height: 28px;
    width: 88px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 400;
    color: #151515;
    background-color: #FFFFFF;
    border: 1px solid #E5E5EE;
    border-radius: 5px;
    text-align: right;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

input.hpdv-cost-plain-val:focus {
    border-color: #9CA3AF;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.2);
    color: #151515;
}

input.hpdv-cost-plain-val.hpdv-input-error,
.hpdv-cost-plain-val.hpdv-input-error,
input.hpdv-cost-input-white.hpdv-input-error,
.hpdv-cost-input-white.hpdv-input-error {
    border-color: #EF4444 !important;
    background-color: #FEF2F2 !important;
    color: #B91C1C;
}

input.hpdv-cost-plain-val.hpdv-input-error:focus,
.hpdv-cost-plain-val.hpdv-input-error:focus,
input.hpdv-cost-input-white.hpdv-input-error:focus,
.hpdv-cost-input-white.hpdv-input-error:focus {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18) !important;
}

input.hpdv-cost-input-white::placeholder,
.hpdv-cost-input-white::placeholder {
    text-align: right !important;
}

.hpdv-cost-field-section,
.hpdv-cost-selling-section {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.hpdv-cost-field-section .hpdv-cost-row,
.hpdv-cost-selling-section .hpdv-cost-row {
    width: 100%;
}

.hpdv-cost-error-wrap {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 0;
    background: transparent;
    border: none;
    box-sizing: border-box;
}

.hpdv-error-icon {
    display: none;
}

.hpdv-cost-input-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
}

.hpdv-error-text {
    font-size: 11px;
    color: #DC2626;
    font-weight: 500;
    text-align: right;
    line-height: 1.35;
    word-break: normal;
    margin: 0;
    display: block;
}

@keyframes hpdvSlideDown {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================================
   BOTTOM FOOTER CARD (Bottom Attached Frosted Glass Dock)
   ================================================================ */
.hpdv-footer-card {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
    padding: 14px 24px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .hpdv-footer-card {
    left: 70px;
}

@media (max-width: 768px) {
    .hpdv-footer-card {
        left: 0;
    }
}

.hpdv-submit-btn {
    background-color: #0808AE;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 2px rgba(8, 8, 174, 0.2);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.hpdv-submit-btn:hover {
    background-color: #0606a0;
    box-shadow: 0 3px 6px -1px rgba(8, 8, 174, 0.35);
    transform: translateY(-1px);
}

.hpdv-submit-btn:active {
    transform: translateY(0);
}

.hpdv-submit-btn:disabled,
.hpdv-submit-btn.disabled {
    background-color: #B5B5F0;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* ================================================================
   COST SUMMARY ACTION ICONS (R and N)
   ================================================================ */
.hpdv-cost-title-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    position: relative;
}

.hpdv-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hpdv-cost-action-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 0;
    /* placed right after Cost Summary text */
}

.hpdv-icon-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, transform 0.1s;
}

.hpdv-icon-btn:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.hpdv-action-icon {
    width: 18px;
    height: 18px;
    display: block;
}

/* ================================================================
   REVISED RATE DIALOG (hrrd-*)
   ================================================================ */
/* Lock background scrolling while Revised Rate dialog is open */
html:has(.hrrd-overlay),
body:has(.hrrd-overlay) {
    overflow: hidden !important;
}

.hrrd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    overscroll-behavior: contain;
    font-family: inherit;
}

.hrrd-modal {
    background: #FFFFFF;
    border-radius: 10px;
    width: 320px;
    max-width: 92vw;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border: 1px solid #E5E7EB;
    overflow: hidden;
    animation: hrrdFadeIn 0.2s ease-out;
}

@keyframes hrrdFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hrrd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 12px 18px;
    border-bottom: 1px solid #EBEBF0;
    background: #FFFFFF;
}

.hrrd-title {
    font-size: 15px;
    font-weight: 700;
    color: #151515;
    margin: 0;
    line-height: 1.2;
}

.hrrd-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #808080;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.hrrd-close-btn:hover {
    color: #151515;
}

.hrrd-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.hrrd-split-row {
    display: flex;
    border-bottom: 1px solid #EBEBF0;
}

.hrrd-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 18px;
    gap: 3px;
}

.hrrd-col-bordered {
    border-left: 1px solid #EBEBF0;
}

.hrrd-bottom-row {
    display: flex;
    flex-direction: column;
    padding: 12px 18px 14px 18px;
    gap: 3px;
}

.hrrd-val-dark {
    font-size: 18px;
    font-weight: 700;
    color: #151515;
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.hrrd-val-blue {
    font-size: 18px;
    font-weight: 700;
    color: #1D35D8;
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.hrrd-label {
    font-size: 13px;
    color: #71717A;
    font-weight: 500;
    line-height: 1.2;
}

.hrrd-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 18px;
    border-top: 1px solid #EBEBF0;
    background-color: #FFFFFF;
}

.hrrd-footer-close-btn {
    background-color: #FFFFFF;
    color: #334155;
    border: 1px solid #CBD5E1;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    outline: none;
}

.hrrd-footer-close-btn:hover {
    background-color: #F8FAFC;
    border-color: #94A3B8;
}

/* ================================================================
   NEGOTIATION DIALOG (hnd-*)
   ================================================================ */
.hnd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    overscroll-behavior: contain;
    font-family: inherit;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Capped at 90vh like the base .dialog-card: on 720–768px tall laptops the
   header stays visible and only the body scrolls. */
.hnd-modal {
    background: #FFFFFF;
    border-radius: 10px;
    width: 820px;
    max-width: 95vw;
    max-height: 88vh;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    border: 1px solid #E5E5EE;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: hndFadeIn 0.2s ease-out;
    box-sizing: border-box;
    margin: auto;
}

@keyframes hndFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hnd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #E5E5EE;
    flex-shrink: 0;
    background-color: #FFFFFF;
}

.hnd-title {
    font-size: 15px;
    font-weight: 700;
    color: #151515;
    margin: 0;
}

.hnd-close-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: #808080;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
}

.hnd-close-btn:hover {
    color: #151515;
    background-color: #F1F5F9;
}

.hnd-body {
    padding: 16px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 #F8FAFC;
}

/* Progress Stepper Animations & Interactivity */
@keyframes stepperPulseGreen {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes stepperLineShimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Stepper */
.hnd-stepper-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    position: relative;
    padding: 6px 12px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.hnd-step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
    width: 110px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hnd-step-node:hover {
    transform: translateY(-2px);
}

.hnd-step-node:active {
    transform: translateY(0) scale(0.96);
}

.hnd-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hnd-circle-green {
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    color: #FFFFFF;
    animation: stepperPulseGreen 2.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.hnd-step-node:hover .hnd-circle-green {
    transform: scale(1.14);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.22), 0 4px 12px rgba(22, 163, 74, 0.4);
}

.hnd-circle-gray {
    background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
    color: #FFFFFF;
}

.hnd-step-node:hover .hnd-circle-gray {
    transform: scale(1.12);
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
    box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.2);
}

.hnd-circle svg {
    width: 15px;
    height: 15px;
    transition: transform 0.25s ease;
}

.hnd-step-node:hover .hnd-circle svg {
    transform: scale(1.12);
}

.hnd-step-label {
    font-size: 11.5px;
    text-align: center;
    line-height: 1.3;
    transition: color 0.2s ease, transform 0.2s ease;
}

.hnd-step-node:hover .hnd-step-label {
    transform: translateY(-1px);
}

.hnd-connector {
    flex: 1;
    height: 3px;
    margin-top: 13px;
    margin-left: -35px;
    margin-right: -35px;
    border-radius: 999px;
    z-index: 1;
    transition: background 0.3s ease;
}

.hnd-line-green {
    background: linear-gradient(90deg, #16A34A, #4ADE80, #16A34A);
    background-size: 200% 100%;
    animation: stepperLineShimmer 3s ease infinite;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.35);
}

.hnd-line-gray {
    background-color: #E2E8F0;
}

.hnd-text-dark {
    font-weight: 700;
    color: #0F172A;
}

.hnd-step-node:hover .hnd-text-dark {
    color: #0405AB;
}

.hnd-text-gray {
    font-weight: 500;
    color: #64748B;
}

.hnd-step-node:hover .hnd-text-gray {
    color: #334155;
}

/* Table Wrapper & Table */
.hnd-table-wrap {
    border: 1px solid #E5E5EE;
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 380px;
    flex: 1 1 auto;
    min-height: 110px;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 #F8FAFC;
    position: relative;
    background-color: #FFFFFF;
}

.hnd-table-wrap::-webkit-scrollbar,
.hnd-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.hnd-table-wrap::-webkit-scrollbar-thumb,
.hnd-body::-webkit-scrollbar-thumb {
    background-color: #CBD5E1;
    border-radius: 3px;
}

.hnd-table-wrap::-webkit-scrollbar-track,
.hnd-body::-webkit-scrollbar-track {
    background-color: #F8FAFC;
}

.hnd-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 11.5px;
}

.hnd-table th {
    background-color: #F8F9FA;
    padding: 10px 12px;
    color: #64748B;
    font-weight: 600;
    font-size: 11px;
    text-align: left;
    border-bottom: 1px solid #E5E5EE;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 #E5E5EE;
}

.hnd-table td {
    padding: 9px 12px;
    color: #1E293B;
    border-bottom: 1px solid #F1F5F9;
    font-size: 11.5px;
    white-space: nowrap;
}

.hnd-table td:last-child {
    white-space: normal;
    min-width: 140px;
    max-width: 260px;
    word-break: break-word;
}

.hnd-table tbody tr:hover td {
    background-color: #F8FAFC;
}

.hnd-table th.text-center,
.hnd-table td.text-center {
    text-align: center;
}

.hnd-table th.text-start,
.hnd-table td.text-start {
    text-align: left !important;
}

.hnd-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .hnd-modal {
        width: 100%;
        max-width: 100%;
        max-height: 94vh;
        border-radius: 8px;
    }

    .hnd-header {
        padding: 12px 14px;
    }

    .hnd-body {
        padding: 12px 12px 16px 12px;
        gap: 12px;
    }

    .hnd-stepper-wrapper {
        padding: 0 4px;
    }

    .hnd-step-node {
        width: 75px;
    }

    .hnd-step-label {
        font-size: 10px;
    }

    .hnd-connector {
        margin-left: -18px;
        margin-right: -18px;
    }

    .hnd-table-wrap {
        max-height: 300px;
    }
}

.hpdv-mat-box,
.admin-pmr-details-page .hpdv-mat-box,
.prodhead-pmr-page .hpdv-mat-box {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
    color: #151515;
    background-color: #F4F5F7;
    border: 1px solid #E0E0E6;
    border-radius: 5px;
    box-sizing: border-box;
    user-select: none;
}
/* Suppress number input spinners for cost inputs */
input.hpdv-cost-plain-val::-webkit-outer-spin-button,
input.hpdv-cost-plain-val::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input.hpdv-cost-plain-val {
    -moz-appearance: textfield;
}

/* ================================================================
   PRODUCT COSTING CARD (Separate portion below Raw Material Weights)
   ================================================================ */
.hpdv-cost-calc-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
    padding: 14px 16px;
    box-sizing: border-box;
}

.hpdv-cost-calc-card .hpdv-card-subtitle {
    margin-bottom: 12px;
}

.hpdv-cost-calc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .hpdv-cost-calc-grid {
        grid-template-columns: 1fr;
    }
}

.hpdv-cost-calc-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hpdv-cost-calc-label {
    font-size: 12px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
    line-height: 1.3;
}

.hpdv-cost-calc-box {
    display: flex;
    align-items: center;
    width: 100%;
    height: 36px;
    padding: 0 12px;
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    box-sizing: border-box;
}

.hpdv-cost-calc-text {
    font-size: 13px;
    font-weight: 500;
    color: #0F172A;
    text-align: right;
    width: 100%;
}

input.hpdv-cost-calc-input,
.hpdv-cost-calc-input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    background-color: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 13px;
    font-weight: 500;
    color: #0F172A;
    font-family: inherit;
    text-align: right;
    outline: none;
    transition: all 0.15s ease;
}

input.hpdv-cost-calc-input:focus,
.hpdv-cost-calc-input:focus {
    border-color: #0405AB;
    box-shadow: 0 0 0 2px rgba(4, 5, 171, 0.15);
    outline: none;
}

input.hpdv-cost-calc-input.has-error,
.hpdv-cost-calc-input.has-error {
    border-color: #EF4444 !important;
    background-color: #FFF5F5;
}

input.hpdv-cost-calc-input.has-error:focus,
.hpdv-cost-calc-input.has-error:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
    outline: none;
}

.hpdv-cost-calc-input::-webkit-outer-spin-button,
.hpdv-cost-calc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hpdv-cost-calc-input {
    -moz-appearance: textfield;
}

.hpdv-cost-calc-input::placeholder {
    color: #94A3B8;
    font-weight: 400;
}

.hpdv-cost-calc-error {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #EF4444;
    margin-top: 2px;
}


/* ================================================================
   RESPONSIVE — Hajipur detail pages that share hpdv-* styles:
     Admin PMR Details           (.admin-pmr-details-page)
     Production Head PMR Details (.prodhead-pmr-page)
   Laptop & desktop only (1200px – 1920px). Breakpoints follow
   css/responsive-layout.css. The 768px / 640px blocks above are below
   the supported width (html min-width: 1200px) and are kept as a fallback.
   ================================================================ */

/* All sizes: the Raw Material Weights table was capped at 215px (~4 rows)
   on every screen. Let it grow with the screen height, never below 215px,
   so 720–768px tall laptops look the same as before. The number is roughly
   everything else on each page (header, PMR info, card titles, Total row,
   Product Costing card, footer buttons). */
.admin-pmr-details-page .hpdv-rm-table-wrap {
    max-height: max(215px, calc(100vh - 560px));
}

.prodhead-pmr-page .hpdv-rm-table-wrap {
    max-height: max(215px, calc(100vh - 420px));
}

/* Small laptops (1240 / 1280) */
@media (max-width: 1280px) {
    .hpdv-page {
        gap: 12px;
        padding: 4px 4px 16px 4px;
    }

    .hpdv-grid {
        gap: 10px;
    }

    .hpdv-info-grid {
        column-gap: 12px;
        row-gap: 10px;
    }

    .hpdv-info-value {
        overflow-wrap: anywhere;
    }

    /* Admin, Prod Revised: the 5-column table needed 630px, more than the
       ~600px left column when the sidebar is open on a 1240px screen.
       Narrow the number columns so it fits in ~540px. */
    .admin-pmr-details-page .hpdv-rm-table .hpdv-col-fweight {
        width: 110px;
        min-width: 100px;
    }

    .admin-pmr-details-page .hpdv-rm-table .hpdv-col-new-fweight {
        width: 125px;
        min-width: 115px;
    }

    .admin-pmr-details-page .hpdv-rm-table .hpdv-col-price {
        width: 85px;
        min-width: 80px;
    }

    .admin-pmr-details-page .hpdv-rm-table .hpdv-col-cost {
        width: 95px;
        min-width: 90px;
    }

    .admin-pmr-details-page .admin-rm-table.admin-rm-table-revised {
        min-width: 540px;
    }

    /* Product Costing card (Admin) */
    .hpdv-cost-calc-grid {
        gap: 12px;
    }

    .hpdv-footer-card {
        padding: 10px 12px;
    }

    .hpdv-submit-btn {
        padding: 8px 20px;
    }
}
