/* ===========================================================
   PURCHASES MODULE — PO list, form, details
   =========================================================== */

/* status pills */
.po-status { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 11.5px; }
.po-status.draft   { background: var(--c-bg-soft); color: var(--c-text-soft); }
.po-status.pending { background: var(--c-amber-soft); color: var(--c-amber); }
.po-status.issued  { background: var(--c-green-soft); color: var(--c-green); }
.po-status.partial { background: var(--c-teal-soft); color: var(--c-teal); }
.po-status.received{ background: var(--c-purple-soft); color: var(--c-purple); }
.po-status.cancelled{ background: var(--c-red-soft); color: var(--c-red); }

/* PO form layout */
.po-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 14px;
    margin-bottom: 14px;
}
@media (max-width: 1280px) { .po-grid { grid-template-columns: 1fr; } }

.po-meta-card {
    background: linear-gradient(135deg, #F4F5FA 0%, #EFEBFF 100%);
    border-radius: 18px;
    padding: 24px 22px;
    text-align: center;
}
.po-meta-card .ico-circle {
    width: 70px; height: 70px;
    border-radius: 50%;
    background: var(--c-surface);
    display: grid; place-items: center;
    margin: 0 auto 14px;
    box-shadow: var(--shadow-card);
}
.po-meta-card .ico-circle .material-symbols-rounded {
    font-size: 34px; color: var(--c-primary);
}
.po-meta-card .small-lbl { color: var(--c-text-muted); font-size: 12px; }
.po-meta-card .pno {
    font-weight: 800; font-size: 19px; color: var(--c-text);
    margin: 6px 0 14px;
    direction: ltr;
}
.po-meta-card .creator {
    background: var(--c-surface);
    padding: 10px 14px;
    border-radius: 12px;
    display: flex; align-items: center; gap: 8px; justify-content: flex-end;
    margin-top: 10px;
}
.po-meta-card .creator .material-symbols-rounded { font-size: 18px; color: var(--c-text-muted); }
.po-meta-card .creator .name { font-weight: 700; color: var(--c-text); font-size: 13px; }

/* PO inner tabs row */
.po-tabs {
    background: var(--c-surface);
    border-radius: 14px 14px 0 0;
    border-bottom: 1px solid var(--c-border);
    padding: 0 18px;
    display: flex; gap: 4px;
    margin: 18px 0 0;
}
.po-tab {
    padding: 14px 18px;
    color: var(--c-text-muted);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.po-tab.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
}
.po-tab .count { font-weight: 500; color: var(--c-text-muted); }

/* PO items editable table */
.po-items-card {
    background: var(--c-surface);
    border-radius: 0 0 14px 14px;
    box-shadow: var(--shadow-card);
    padding: 14px 18px 18px;
    margin-bottom: 14px;
}
.po-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.po-items-table thead th {
    background: var(--c-surface-2);
    padding: 10px 8px;
    text-align: end;
    color: var(--c-text-muted);
    font-weight: 700;
    font-size: 11.5px;
    border-bottom: 1px solid var(--c-border);
}
.po-items-table thead th .sub { display: block; font-size: 10px; color: var(--c-text-faint); margin-top: 2px; font-weight: 500; }
.po-items-table thead th:first-child { width: 40px; text-align: center; }
.po-items-table thead th:last-child  { width: 50px; text-align: center; }

.po-items-table tbody td {
    padding: 8px;
    vertical-align: middle;
    border-bottom: 1px solid var(--c-border);
}
.po-items-table tbody tr:last-child td { border-bottom: 0; }
.po-items-table tbody td input,
.po-items-table tbody td select {
    width: 100%;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: 8px;
    height: 36px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--c-text);
    text-align: end;
    outline: none;
}
.po-items-table tbody td input:focus,
.po-items-table tbody td select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.po-items-table tbody td .row-num {
    background: var(--c-bg-soft); width: 24px; height: 24px;
    border-radius: 6px; display: grid; place-items: center;
    font-weight: 800; font-size: 11.5px; margin: 0 auto;
}
.po-items-table tbody td .del-line {
    background: var(--c-red-soft); color: var(--c-red);
    border: 0; width: 32px; height: 32px;
    border-radius: 8px; cursor: pointer;
    display: grid; place-items: center;
}
.po-items-table tbody td .del-line:hover { background: var(--c-red); color: #fff; }

.po-items-add {
    display: flex; gap: 10px; justify-content: flex-start;
    margin-top: 10px;
}
.po-items-add .btn { background: var(--c-primary-soft); color: var(--c-primary); border-color: transparent; }

/* PO totals + terms bottom row */
.po-bottom {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 14px;
}
@media (max-width: 1100px) { .po-bottom { grid-template-columns: 1fr; } }

.po-terms-card {
    background: var(--c-surface);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 16px 18px;
}
.po-terms-card h4 {
    margin: 0 0 12px;
    font-size: 14px; font-weight: 800;
    color: var(--c-text);
    display: flex; gap: 8px; align-items: center; justify-content: flex-end;
}
.po-terms-card h4 .ico {
    width: 30px; height: 30px;
    background: var(--c-bg-soft);
    color: var(--c-text-muted);
    border-radius: 8px; display: grid; place-items: center;
}
.po-terms-card .ph { color: var(--c-text-muted); font-size: 12.5px; text-align: end; padding: 16px 0; }
.po-terms-card textarea {
    width: 100%; min-height: 90px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px; color: var(--c-text);
    resize: vertical;
}

.po-totals-card {
    background: var(--c-surface);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 16px 18px;
}
.po-totals-row {
    display: grid; grid-template-columns: 1fr auto;
    padding: 8px 0;
    color: var(--c-text-soft); font-size: 13px;
}
.po-totals-row .v { font-weight: 700; color: var(--c-text); }
.po-totals-row .v.neg { color: var(--c-red); }
.po-totals-row .v .small { color: var(--c-text-muted); font-size: 11px; font-weight: 500; margin-inline-start: 6px; }
.po-totals-row.grand {
    border-top: 2px dashed var(--c-border);
    margin-top: 6px; padding-top: 14px;
}
.po-totals-row.grand .v { color: var(--c-primary); font-size: 17px; font-weight: 800; }

/* ============================
   GOODS RECEIVING PAGE
   ============================ */
.grn-summary-card {
    background: var(--c-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 18px 20px;
}
.grn-summary-card h4 {
    margin: 0 0 14px;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--c-text);
    display: flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.grn-summary-card h4 .ok-ico {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--c-green);
    color: #fff;
    display: grid; place-items: center;
}
.grn-summary-card h4 .ok-ico .material-symbols-rounded { font-size: 16px; }

.grn-3metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.grn-metric { text-align: center; }
.grn-metric .l { color: var(--c-text-muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.grn-metric .v { font-size: 22px; font-weight: 800; }
.grn-metric .v.green { color: var(--c-green); }
.grn-metric .v.purple { color: var(--c-primary); }
.grn-metric .v.amber { color: var(--c-amber); }
.grn-metric .currency { color: var(--c-text-muted); font-size: 11px; margin-top: 2px; }

.grn-progress-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px;
    color: var(--c-text-soft);
    margin-bottom: 6px;
}
.grn-progress {
    height: 8px;
    background: var(--c-bg-soft);
    border-radius: 99px;
    overflow: hidden;
}
.grn-progress > div {
    height: 100%;
    background: linear-gradient(90deg, var(--c-blue), var(--c-primary));
    border-radius: 99px;
    transition: width 360ms ease;
}

/* small notes textarea on top form */
.form-card .field textarea {
    width: 100%; border: 1px solid var(--c-border);
    background: var(--c-surface); border-radius: 10px;
    padding: 10px 12px; font-family: inherit;
    color: var(--c-text); font-size: 13px;
    min-height: 78px; resize: vertical;
}
