/* ===== Công cụ Online (/cong-cu) & Tính lương Gross ↔ Net (/cong-cu/tinh-luong) ===== */

/* Đầu trang sáng: nền xanh rất nhạt, chữ xanh EMD. */
.tools-hero {
    padding: 2.75rem 0 2.25rem;
    border-bottom: 1px solid var(--emd-line);
    background: linear-gradient(180deg, #f0f7f3 0%, #fff 100%);
}

.tools-hero h1 {
    margin-bottom: .6rem;
    color: var(--emd-primary);
    font-size: clamp(1.6rem, 3.2vw, 2.3rem);
    line-height: 1.3;
}

.tools-hero p {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--emd-muted);
}

.tools-hero-compact {
    padding: 2rem 0 1.6rem;
}

.tools-note {
    display: inline-flex;
    gap: .5rem;
    align-items: flex-start;
    max-width: 900px !important;
    padding: .55rem .9rem;
    border: 1px solid #cfe6da;
    border-radius: 10px;
    background: #fff;
    color: #0f5132 !important;
    font-size: .92rem;
    line-height: 1.5;
}

.tools-note i {
    margin-top: .15rem;
    color: var(--emd-primary);
}

/* ---------- Danh mục công cụ ---------- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

/* Lưới cân đối: máy tính 3 thẻ/hàng (hàng cuối 2 thẻ thì giãn đều), máy tính bảng 2 thẻ/hàng (thẻ lẻ cuối trải hết hàng). */
@media (min-width: 768px) and (max-width: 991.98px) {
    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tools-grid > .tool-card:last-child:nth-child(odd) {
        grid-column: span 2;
    }
}

@media (min-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-rows: 1fr;
    }

    .tools-grid > .tool-card {
        grid-column: span 2;
    }

    .tools-grid > .tool-card:nth-last-child(2):nth-child(3n+1),
    .tools-grid > .tool-card:last-child:nth-child(3n+2) {
        grid-column: span 3;
    }

    .tools-grid > .tool-card:last-child:nth-child(3n+1) {
        grid-column: 3 / span 2;
    }
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 1px solid var(--emd-line);
    border-radius: var(--emd-radius);
    background: #fff;
    box-shadow: var(--emd-shadow);
    color: var(--emd-ink);
    text-decoration: none;
    transition: transform var(--emd-ease), box-shadow var(--emd-ease), border-color var(--emd-ease);
}

a.tool-card:hover,
a.tool-card:focus-visible {
    border-color: #9fcfb6;
    box-shadow: var(--emd-shadow-hover);
    color: var(--emd-ink);
    transform: translateY(-2px);
}

.tool-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: #ecfdf5;
    color: var(--emd-primary);
    font-size: 1.4rem;
}

.tool-card-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: .2rem .65rem;
    border-radius: 999px;
    background: #fff7ed;
    color: var(--emd-accent-ink);
    font-size: .75rem;
    font-weight: 700;
}

.tool-card-title {
    margin-bottom: .5rem;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
}

.tool-card-desc {
    margin-bottom: .9rem;
    color: var(--emd-muted);
    font-size: .94rem;
}

.tool-card-points {
    margin: 0 0 1.1rem;
    padding: 0;
    list-style: none;
    font-size: .9rem;
}

.tool-card-points li {
    display: flex;
    gap: .4rem;
    margin-bottom: .3rem;
}

.tool-card-points i {
    color: var(--emd-primary);
}

.tool-card-cta {
    margin-top: auto;
    color: var(--emd-primary);
    font-weight: 700;
}

.tool-card-soon {
    align-items: center;
    justify-content: center;
    border-style: dashed;
    border-width: 2px;
    background: #fafcfb;
    box-shadow: none;
    text-align: center;
}

.tool-card-soon .tool-card-title,
.tool-card-soon .tool-card-desc {
    max-width: 19rem;
    text-wrap: balance;
}

.tool-card-soon .tool-card-icon {
    background: #f1f5f9;
    color: #94a3b8;
}

.tools-help {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #cfe6da;
    border-radius: var(--emd-radius);
    background: #f0f7f3;
}

.tools-help h2 {
    color: var(--emd-primary);
    text-wrap: balance;
}

.tools-help-text {
    flex: 1 1 28rem;
    min-width: 0;
}

.tools-help-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

@media (max-width: 575.98px) {
    .tools-help-actions,
    .tools-help-actions .btn {
        flex: 1 1 100%;
    }
}

.tools-help a:not(.btn) {
    color: var(--emd-primary);
    font-weight: 600;
}

/* ---------- Công cụ tính lương ---------- */
.tool-section {
    padding-top: 2rem;
}

.tool-panel {
    position: sticky;
    top: 96px;
    padding: 1.5rem;
    border: 1px solid var(--emd-line);
    border-radius: var(--emd-radius);
    background: #fff;
    box-shadow: var(--emd-shadow);
}

.tool-panel .form-label {
    color: #0f172a;
    font-weight: 600;
}

.tool-field {
    margin-bottom: 1.15rem;
}

.tool-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .25rem;
    margin-bottom: 1.25rem;
    padding: .25rem;
    border-radius: 10px;
    background: #f1f5f3;
}

.tool-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem .5rem;
    border-radius: 8px;
    color: var(--emd-muted);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.btn-check:checked + .tool-mode-btn {
    background: var(--emd-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 83, 49, .25);
}

.btn-check:focus-visible + .tool-mode-btn {
    outline: 2px solid var(--emd-accent);
    outline-offset: 2px;
}

.tool-money {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.tool-choice {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
}

.tool-radio {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    cursor: pointer;
}

.tool-radio input {
    accent-color: var(--emd-primary);
    width: 1.05rem;
    height: 1.05rem;
}

.tool-stepper .form-control {
    font-weight: 700;
}

.tool-stepper input::-webkit-outer-spin-button,
.tool-stepper input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.tool-stepper input[type=number] {
    -moz-appearance: textfield;
}

.tool-slip-info {
    padding: .75rem .9rem;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #fafcfb;
}

.tool-slip-info summary {
    color: #0f5132;
    font-weight: 600;
    cursor: pointer;
}

.tool-slip-info summary span {
    font-weight: 400;
    font-size: .85rem;
}

.tool-privacy {
    margin: .75rem 0 0;
    color: var(--emd-muted);
    font-size: .82rem;
    text-align: center;
}

.tool-privacy i {
    color: var(--emd-primary);
}

/* Trang Tính lương, máy tính ≥ 1200px: ghi chú bảo mật vừa 1 dòng dưới nút "Tính lương". */
@media (min-width: 1200px) {
    #payrollForm .tool-privacy {
        font-size: .75rem;
        white-space: nowrap;
    }
}

/* 3 thẻ kết quả lớn */
.tool-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.tool-stat {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1.1rem 1rem;
    border: 1px solid var(--emd-line);
    border-radius: var(--emd-radius);
    background: #fff;
}

.tool-stat-label {
    color: var(--emd-muted);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.35;
}

.tool-stat-value {
    color: #0f172a;
    font-family: var(--font-heading, inherit);
    font-size: clamp(1.25rem, 2.2vw, 1.6rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    word-break: break-word;
}

.tool-stat-deduct .tool-stat-value {
    color: #b45309;
}

.tool-stat-net {
    border-color: var(--emd-primary);
    background: var(--emd-primary);
}

.tool-stat-net .tool-stat-label {
    color: rgba(255, 255, 255, .85);
}

.tool-stat-net .tool-stat-value {
    color: #fff;
}

.tool-warning {
    padding: .6rem .85rem;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: .88rem;
}

.tool-card-box {
    margin-bottom: 1rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--emd-line);
    border-radius: var(--emd-radius);
    background: #fff;
}

.tool-box-title {
    margin-bottom: .6rem;
    color: var(--emd-primary);
    font-size: 1.02rem;
    font-weight: 700;
}

.tool-unit {
    color: var(--emd-muted);
    font-size: .82rem;
    font-weight: 500;
}

.tool-table {
    font-size: .93rem;
    font-variant-numeric: tabular-nums;
}

.tool-table th,
.tool-table td {
    padding: .5rem .35rem;
    border-color: #eef2f0;
    vertical-align: middle;
}

.tool-table tbody th {
    font-weight: 500;
}

.tool-table td.text-end {
    white-space: nowrap;
}

.tool-row-note {
    display: block;
    color: #64748b;
    font-size: .78rem;
    font-weight: 400;
}

.tool-row-note:empty {
    display: none;
}

.tool-table .tool-row-strong th,
.tool-table .tool-row-strong td {
    font-weight: 700;
}

.tool-table .tool-row-sub th,
.tool-table .tool-row-sub td {
    background: #f8fafc;
    font-weight: 600;
}

.tool-table .tool-row-total th,
.tool-table .tool-row-total td {
    border-bottom: 0;
    background: #ecfdf5;
    color: var(--emd-primary);
    font-weight: 800;
}

.tool-table-brackets thead th {
    color: #475569;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

.tool-table-brackets tbody tr:not(.is-active):not(.tool-row-total) td {
    color: #94a3b8;
}

.tool-table-brackets tbody tr.is-active td {
    color: #0f172a;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-end;
    margin: 1.25rem 0;
}

.tool-paper {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.tool-paper label {
    white-space: nowrap;
}

.tool-paper .form-select {
    min-width: 5.5rem;
}

.btn-zalo {
    --bs-btn-color: #fff;
    --bs-btn-bg: #0068ff;
    --bs-btn-border-color: #0068ff;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0052cc;
    --bs-btn-hover-border-color: #0052cc;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0052cc;
    --bs-btn-active-border-color: #0052cc;
}

/* Thông báo nổi (sao chép Zalo) */
.tool-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    z-index: 1090;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: .8rem 1.2rem;
    border-radius: 10px;
    background: #065f46;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    color: #fff;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity .2s ease, transform .2s ease;
}

.tool-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.tool-toast.is-error {
    background: #b91c1c;
}

.payslip-print {
    display: none;
}

@media (max-width: 991.98px) {
    .tool-panel {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .tool-summary {
        grid-template-columns: 1fr;
    }

    .tool-stat {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: .85rem 1rem;
    }

    .tool-stat-value {
        font-size: 1.3rem;
        text-align: right;
    }
}

@media (max-width: 575.98px) {
    .tool-panel,
    .tool-card-box {
        padding: 1rem;
    }

    .tool-table {
        font-size: .86rem;
    }

    /* Điện thoại: ẩn cột "Phần thu nhập" để bảng biểu thuế vừa màn hình, không cuộn ngang. */
    .tool-table-brackets th:nth-child(4),
    .tool-table-brackets td:nth-child(4) {
        display: none;
    }

    .tool-actions .btn {
        flex: 1 1 100%;
    }

    .tool-paper {
        flex-direction: row;
        align-items: center;
        gap: .5rem;
    }
}

/* ---------- Phiếu thanh toán lương (bản in / PDF) ----------
   Kiểu dáng phiếu khai báo ngoài @media print (khung .payslip-print luôn ẩn trên màn hình) để kiểm thử mô phỏng dễ dàng;
   mặc định là khổ A5 thu gọn, body.payslip-a4 chuyển sang khổ A4 rộng rãi. */
.ps {
    --ps-font: 11px;
    --ps-cell: 4px 8px;
    --ps-sign: 34px;
    --ps-gap: 8px;
    box-sizing: border-box;
    width: 100%;
    color: #0f172a;
    font-family: "Inter", "Be Vietnam Pro", Arial, sans-serif;
    font-size: var(--ps-font);
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.payslip-a4 .ps {
    --ps-font: 13px;
    --ps-cell: 7px 12px;
    --ps-sign: 54px;
    --ps-gap: 14px;
}

.ps *,
.ps *::before,
.ps *::after {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.ps-head {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #005331;
}

.ps-company {
    margin-bottom: 2px;
    color: #005331;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
}

.ps-title {
    margin: 0;
    color: #0f172a;
    font-family: "Be Vietnam Pro", "Inter", Arial, sans-serif;
    font-size: 1.55em;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .03em;
}

.ps-head-right {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.ps-brand {
    padding: 1px 7px;
    border-radius: 4px;
    background: #005331;
    color: #fff;
    font-size: .82em;
    font-weight: 800;
    letter-spacing: .08em;
}

.ps-period {
    padding: 3px 9px;
    border: 1px solid #a7d7c0;
    border-radius: 6px;
    background: #ecfdf5;
    color: #005331;
    font-size: .9em;
    font-weight: 700;
    white-space: nowrap;
}

.ps-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    margin-bottom: var(--ps-gap);
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.ps-info > div {
    min-width: 0;
}

.ps-info-label {
    display: block;
    color: #64748b;
    font-size: .82em;
}

.ps-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
}

.ps-table th,
.ps-table td {
    padding: var(--ps-cell);
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

.ps-table thead th {
    border-color: #005331;
    background: #005331;
    color: #fff;
    font-weight: 700;
    text-align: left;
}

.ps-table .ps-amount {
    width: 34%;
    text-align: right;
    white-space: nowrap;
}

.ps-table thead th.ps-amount {
    text-align: right;
}

.ps-no {
    display: inline-block;
    min-width: 1.6em;
    color: #64748b;
}

.ps-group td {
    padding-top: 3px;
    padding-bottom: 3px;
    background: #f1f5f9;
    color: #475569;
    font-size: .82em;
    font-weight: 700;
    letter-spacing: .02em;
}

.ps-table .is-strong td {
    font-weight: 700;
}

.ps-table .is-total td {
    background: #f8fafc;
    font-weight: 700;
}

.ps-net {
    margin-top: var(--ps-gap);
    padding: 8px 12px;
    border: 1.5px solid #005331;
    border-radius: 6px;
    background: #ecfdf5;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ps-net-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.ps-net-label {
    color: #0f172a;
    font-weight: 800;
}

.ps-net-amount {
    color: #005331;
    font-size: 1.45em;
    font-weight: 800;
    white-space: nowrap;
}

.ps-words {
    margin-top: 2px;
    color: #334155;
}

.ps-words em {
    font-style: italic;
}

.ps-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: var(--ps-gap);
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
}

.ps-sign div {
    display: flex;
    flex-direction: column;
    padding-bottom: var(--ps-sign);
}

.ps-sign span {
    color: #64748b;
    font-size: .85em;
    font-style: italic;
}

.ps-foot {
    margin: 4px 0 0;
    padding-top: 4px;
    border-top: 1px solid #e2e8f0;
    color: #94a3b8;
    font-size: .78em;
    text-align: center;
}

/* ---------- In: chỉ in phiếu (1 trang duy nhất), ẩn Header / Footer / công cụ ---------- */
@media print {
    .site-header,
    .site-footer,
    .emd-fab,
    .emd-breadcrumb,
    .tool-toast,
    main > :not(.payslip-print) {
        display: none !important;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    main {
        padding: 0 !important;
    }

    .payslip-print {
        display: block;
        break-inside: avoid;
        page-break-inside: avoid;
        break-after: avoid;
        page-break-after: avoid;
    }
}
/* ===== Công cụ Tính Cost Đồ uống & Định giá Menu (/cong-cu/tinh-cost-do-uong) ===== */
.tool-card-icon.tool-card-icon-accent {
    background: #fff7ed;
    color: var(--emd-accent);
}

.dc-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.dc-presets-label {
    margin-right: .25rem;
    color: #0f172a;
    font-weight: 700;
}

.dc-presets-label i {
    color: var(--emd-accent);
}

.dc-preset,
.dc-reset {
    display: inline-flex;
    gap: .4rem;
    align-items: center;
    padding: .45rem .9rem;
    border: 1px solid #cfe6da;
    border-radius: 999px;
    background: #fff;
    color: #0f5132;
    font-size: .9rem;
    font-weight: 600;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.dc-preset:hover,
.dc-preset:focus-visible {
    border-color: var(--emd-primary);
    background: #f0f7f3;
}

.dc-preset.is-active {
    border-color: var(--emd-primary);
    background: var(--emd-primary);
    color: #fff;
}

.dc-reset {
    margin-left: auto;
    border-style: dashed;
    border-color: #cbd5e1;
    color: #475569;
}

.dc-reset:hover,
.dc-reset:focus-visible {
    border-color: #dc2626;
    color: #dc2626;
}

.dc-form .tool-box-title i {
    color: var(--emd-accent);
}

.dc-form .form-label {
    color: #0f172a;
    font-weight: 600;
}

.dc-target-value {
    color: var(--emd-primary);
    font-size: 1.05rem;
}

.dc-range {
    accent-color: var(--emd-primary);
}

.dc-range::-webkit-slider-thumb {
    background: var(--emd-primary);
}

.dc-range::-moz-range-thumb {
    background: var(--emd-primary);
}

.dc-range-scale {
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
    font-size: .75rem;
}

/* Bảng nguyên liệu: lưới 6 cột trên máy tính, mỗi dòng thành 1 thẻ trên điện thoại. */
.dc-row {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.2fr) minmax(0, 1.65fr) minmax(0, 1.05fr) minmax(0, .9fr) 2rem;
    gap: .45rem;
    align-items: center;
    padding: .4rem 0;
    border-bottom: 1px solid #eef2f0;
}

.dc-row-head {
    padding-top: 0;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.3;
}

.dc-cell {
    min-width: 0;
}

.dc-cell-label {
    display: none;
}

/* Ô đơn vị gọn (g / ml / cái), nhường chỗ cho số quy cách (ghi đè flex 1 1 auto của .input-group). */
.input-group > .dc-unit {
    flex: 0 0 3.6rem;
    width: 3.6rem;
    padding-right: 1.25rem;
    padding-left: .4rem;
    background-position: right .25rem center;
    background-size: 10px 8px;
}

.dc-unit-label {
    min-width: 2.4rem;
    justify-content: center;
}

.dc-cell-cost {
    text-align: right;
}

.dc-line-cost {
    color: #0f172a;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dc-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
}

.dc-del:hover,
.dc-del:focus-visible {
    background: #fef2f2;
    color: #dc2626;
}

.dc-hint {
    margin: .75rem 0 .25rem;
    color: #64748b;
    font-size: .82rem;
}

.dc-result {
    position: sticky;
    top: 96px;
}

.dc-stats {
    display: grid;
    gap: .75rem;
    margin-bottom: 1rem;
}

.dc-stats .tool-stat {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .25rem .75rem;
    align-items: center;
}

.dc-stats .tool-stat-value {
    text-align: right;
}

.dc-badge {
    grid-column: 1 / -1;
    justify-self: start;
    padding: .2rem .65rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: .8rem;
    font-weight: 700;
}

.dc-stat-ratio.is-good { border-color: #005331; }
.dc-stat-ratio.is-good .tool-stat-value { color: #005331; }
.dc-stat-ratio.is-good .dc-badge { background: #ecfdf5; color: #005331; }
.dc-stat-ratio.is-mid { border-color: #D97706; }
.dc-stat-ratio.is-mid .tool-stat-value { color: #D97706; }
.dc-stat-ratio.is-mid .dc-badge { background: #fff7ed; color: #b45309; }
.dc-stat-ratio.is-high { border-color: #DC2626; }
.dc-stat-ratio.is-high .tool-stat-value { color: #DC2626; }
.dc-stat-ratio.is-high .dc-badge { background: #fef2f2; color: #DC2626; }

.dc-suggest-main {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
    padding: .85rem 1rem;
    border: 1.5px solid var(--emd-primary);
    border-radius: 10px;
    background: #ecfdf5;
}

.dc-suggest-main > div {
    display: flex;
    flex-direction: column;
}

.dc-suggest-label {
    color: #0f5132;
    font-size: .85rem;
    font-weight: 600;
}

.dc-suggest-price {
    color: var(--emd-primary);
    font-family: var(--font-heading, inherit);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
}

.dc-suggest-exact {
    color: #64748b;
    font-size: .76rem;
}

.dc-sim th,
.dc-sim td {
    padding: .45rem .3rem;
    font-size: .84rem;
    white-space: nowrap;
}

.dc-sim thead th {
    color: #475569;
    font-size: .76rem;
    font-weight: 600;
}

/* ===== Khung CTA xanh cuối trang — mẫu dùng chung cho mọi Công cụ Online (Pages/Shared/_ToolCtaBox.cshtml) =====
   2 cột căn giữa theo trục dọc: dù cột phải có 1, 2 hay 3 nút, chữ bên trái và cụm nút luôn cân đối ở tâm khung. */
.tool-cta-box {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 32px;
    align-items: center;
    margin-top: 2.5rem;
    padding: 32px 36px;
    border-radius: 16px;
    background: #005331;
    color: #fff;
}

.tool-cta-box-text h2 {
    margin: 0 0 .6rem;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.35;
}

.tool-cta-box-text p {
    margin: 0;
    color: rgba(255, 255, 255, .88);
    font-size: .95rem;
    line-height: 1.6;
}

.tool-cta-box-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.tool-cta-box-link {
    display: flex;
    gap: .65rem;
    align-items: center;
    min-height: 48px;
    padding: .7rem 1rem;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease;
}

.tool-cta-box-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    color: var(--emd-accent-light);
    font-size: 1.05rem;
}

.tool-cta-box-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.tool-cta-box-label {
    flex: 1 1 auto;
    min-width: 0;
}

.tool-cta-box-arrow {
    flex: none;
    margin-left: auto;
    transition: transform .15s ease;
}

.tool-cta-box-link:hover,
.tool-cta-box-link:focus-visible {
    border-color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .14);
    color: #fff;
}

.tool-cta-box-link:hover .tool-cta-box-arrow,
.tool-cta-box-link:focus-visible .tool-cta-box-arrow {
    transform: translateX(3px);
}

@media (max-width: 991.98px) {
    .tool-cta-box {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 575.98px) {
    .tool-cta-box {
        padding: 22px 20px;
    }

    .tool-cta-box-text h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 991.98px) {
    .dc-result {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .dc-reset {
        margin-left: 0;
    }

    .dc-row-head {
        display: none;
    }

    .dc-row {
        grid-template-columns: 1fr 1fr;
        gap: .5rem .6rem;
        margin-bottom: .6rem;
        padding: .75rem;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #fafcfb;
    }

    .dc-cell-label {
        display: block;
        margin-bottom: .15rem;
        color: #64748b;
        font-size: .74rem;
        font-weight: 600;
    }

    /* Tên nguyên liệu chiếm cả hàng đầu, nút xóa nổi ở góc phải thẻ. */
    .dc-cell-name {
        grid-column: 1 / -1;
        padding-right: 2.4rem;
    }

    .dc-row {
        position: relative;
    }

    .dc-cell-del {
        position: absolute;
        top: .55rem;
        right: .5rem;
    }

    /* Hàng cuối thẻ: "Dùng cho 1 ly" bên trái, "Thành tiền 1 ly" bên phải. */
    .dc-cell-cost {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        align-self: stretch;
        justify-content: space-between;
    }

    .dc-cell-cost .dc-line-cost {
        padding: .2rem 0;
        color: var(--emd-primary);
        font-size: 1.05rem;
    }

    .dc-presets-label {
        flex: 1 1 100%;
    }

    .dc-preset,
    .dc-reset {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* Điện thoại: bảng mô phỏng bỏ cột Doanh thu để vừa màn hình, không cuộn ngang. */
@media (max-width: 575.98px) {
    .dc-sim th:nth-child(2),
    .dc-sim td:nth-child(2) {
        display: none;
    }
}

/* ---------- Bảng định lượng (bản in A4, 1 trang) ---------- */
.rs {
    color: #0f172a;
    font-family: "Inter", "Be Vietnam Pro", Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    break-inside: avoid;
    page-break-inside: avoid;
}

.rs,
.rs * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.rs-head {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #005331;
}

.rs-title {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .03em;
}

.rs-name {
    margin-top: 2px;
    color: #005331;
    font-size: 15px;
    font-weight: 700;
}

.rs-meta {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    color: #475569;
}

.rs-brand {
    padding: 1px 7px;
    border-radius: 4px;
    background: #005331;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.rs-table {
    width: 100%;
    border-collapse: collapse;
}

.rs-table th,
.rs-table td {
    padding: 6px 9px;
    border: 1px solid #e2e8f0;
}

.rs-table thead th {
    border-color: #005331;
    background: #005331;
    color: #fff;
    font-weight: 700;
    text-align: left;
}

.rs-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.rs-table tfoot td {
    background: #ecfdf5;
    color: #005331;
    font-size: 13px;
    font-weight: 800;
}

.rs-table .rs-r,
.rs-table thead .rs-r {
    text-align: right;
    white-space: nowrap;
}

.rs-table .rs-c,
.rs-table thead .rs-c {
    width: 32px;
    text-align: center;
}

.rs-b {
    font-weight: 700;
}

.rs-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.rs-summary div {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.rs-summary span {
    color: #64748b;
    font-size: 10.5px;
}

.rs-summary strong {
    color: #005331;
    font-size: 15px;
}

.rs-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 16px;
    text-align: center;
}

.rs-sign div {
    display: flex;
    flex-direction: column;
    padding-bottom: 54px;
}

.rs-sign span {
    color: #64748b;
    font-size: 11px;
    font-style: italic;
}

.rs-foot {
    margin: 0;
    padding-top: 5px;
    border-top: 1px solid #e2e8f0;
    color: #94a3b8;
    font-size: 10px;
    text-align: center;
}
/* ===== Công cụ Đọc, Kiểm tra & Gộp Hóa đơn XML (/cong-cu/doc-hoa-don-xml) ===== */
.tool-card-icon.tool-card-icon-blue {
    background: #eff6ff;
    color: #1d4ed8;
}

.xi-upload {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
}

.xi-drop {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: 1.5rem;
    border: 2px dashed #94c9b0;
    border-radius: var(--emd-radius);
    background: #f4fbf7;
    color: #334155;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.xi-drop:hover,
.xi-drop.is-over,
.xi-drop:focus-within {
    border-color: var(--emd-primary);
    background: #e6f5ed;
}

.xi-drop-icon {
    color: var(--emd-primary);
    font-size: 2.4rem;
    line-height: 1;
}

.xi-drop-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.xi-drop-sub {
    color: #64748b;
    font-size: .88rem;
}

.xi-upload-side {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    justify-content: center;
}

.xi-upload-side .btn {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    justify-content: center;
}

.xi-privacy {
    display: flex;
    gap: .5rem;
    margin: .25rem 0 0;
    padding: .65rem .8rem;
    border-radius: 10px;
    background: #ecfdf5;
    color: #065f46;
    font-size: .84rem;
    line-height: 1.45;
}

.xi-privacy i {
    flex: none;
    margin-top: .1rem;
}

.xi-errors {
    display: flex;
    gap: .6rem;
    margin-top: 1rem;
    padding: .75rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-size: .88rem;
}

.xi-errors[hidden],
.xi-issues[hidden],
.xi-empty[hidden],
.xi-workspace[hidden],
.xi-panel[hidden] {
    display: none;
}

.xi-empty {
    margin-top: 1.5rem;
    padding: 2rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--emd-radius);
    color: #64748b;
    text-align: center;
}

.xi-empty i {
    color: #cbd5e1;
    font-size: 2.5rem;
}

.xi-empty p {
    margin: .5rem 0 0;
}

.xi-workspace {
    margin-top: 1.5rem;
}

.xi-tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.xi-tab {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    margin-bottom: -2px;
    padding: .65rem 1rem;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: #475569;
    font-weight: 600;
}

.xi-tab:hover {
    color: var(--emd-primary);
}

.xi-tab.is-active {
    border-bottom-color: var(--emd-primary);
    color: var(--emd-primary);
}

.xi-tab-count {
    min-width: 1.5rem;
    padding: .05rem .45rem;
    border-radius: 999px;
    background: var(--emd-primary);
    color: #fff;
    font-size: .75rem;
    text-align: center;
}

.xi-viewbar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    margin-bottom: .75rem;
}

.xi-pager {
    display: flex;
    gap: .35rem;
    align-items: center;
}

.xi-pager .form-select {
    width: auto;
    min-width: 13rem;
}

.xi-badge {
    display: inline-flex;
    gap: .35rem;
    align-items: center;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.xi-badge.is-ok {
    background: #dcfce7;
    color: #166534;
}

.xi-badge.is-warn {
    background: #ffedd5;
    color: #c2410c;
}

.xi-issues {
    margin-bottom: .75rem;
    padding: .75rem 1rem;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
    font-size: .88rem;
}

.xi-issues ul {
    margin: .35rem 0 0;
    padding-left: 1.2rem;
}

.xi-paper-wrap {
    overflow-x: auto;
    padding: 1rem;
    border-radius: var(--emd-radius);
    background: #f1f5f9;
}

.xi-paper {
    min-width: 680px;
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 32px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .1);
}

.xi-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.xi-table {
    font-size: .86rem;
}

.xi-table th,
.xi-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.xi-table td.xi-name {
    min-width: 11rem;
    white-space: normal;
}


.xi-swipe {
    display: none;
    margin: 0 0 .4rem;
    color: #64748b;
    font-size: .8rem;
}

@media (max-width: 991.98px) {
    .xi-upload {
        grid-template-columns: 1fr;
    }

    .xi-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .xi-drop {
        min-height: 150px;
        padding: 1.1rem;
    }

    .xi-tab {
        flex: 1 1 50%;
        justify-content: center;
        padding: .6rem .4rem;
        font-size: .86rem;
    }

    .xi-viewbar .xi-pager {
        flex: 1 1 100%;
    }

    .xi-pager .form-select {
        flex: 1;
        min-width: 0;
    }

    .xi-viewbar #xiPrint {
        margin-left: auto;
    }

    .xi-paper-wrap {
        padding: .5rem;
    }

    .xi-tab-long {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .xi-swipe {
        display: block;
    }

    /* Thẻ thống kê dạng hàng ngang (nhãn trái, số phải) → 1 cột để số tiền lớn không xuống dòng. */
    .xi-stats {
        grid-template-columns: 1fr;
        gap: .5rem;
    }
}

/* ---------- Bản thể hiện hóa đơn (màn hình + bản in A4) ---------- */
.inv {
    color: #0f172a;
    font-family: "Times New Roman", Times, serif;
    font-size: 13.5px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.inv,
.inv * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.inv-head {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid #cbd5e1;
}

.inv-seller-name {
    margin-bottom: 2px;
    color: #003d24;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
}

.inv-seller span,
.inv-buyer span,
.inv-meta span {
    color: #475569;
}

.inv-meta {
    flex: none;
    min-width: 150px;
    text-align: left;
}

.inv-no {
    color: #b91c1c;
    font-size: 16px;
}

.inv-title {
    margin: 12px 0 10px;
    text-align: center;
}

.inv-title h2 {
    margin: 0 0 2px;
    color: #b91c1c;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .02em;
}

.inv-title > div {
    font-style: italic;
}

.inv-mccqt {
    margin-top: 2px;
    font-style: normal !important;
}

.inv-mccqt b {
    font-family: Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}

.inv-mccqt.is-missing {
    color: #c2410c;
}

.inv-buyer {
    margin-bottom: 10px;
    padding: 6px 0;
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
}

.inv-table,
.inv-rates {
    width: 100%;
    border-collapse: collapse;
}

.inv-table th,
.inv-table td,
.inv-rates th,
.inv-rates td {
    padding: 4px 6px;
    border: 1px solid #94a3b8;
}

.inv-table th,
.inv-rates th {
    background: #f1f5f9;
    font-weight: 700;
    text-align: center;
}

.inv-table .c,
.inv-rates .c {
    text-align: center;
}

.inv-table .r,
.inv-rates .r,
.inv-table th.r,
.inv-rates th.r {
    text-align: right;
    white-space: nowrap;
}

.inv-table tr.is-note td {
    color: #475569;
    font-style: italic;
}

.inv-totals {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-top: 10px;
}

.inv-rates {
    font-size: 12.5px;
}

.inv-sum {
    margin: 0;
}

.inv-sum > div {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dotted #cbd5e1;
}

.inv-sum dt {
    font-weight: 400;
}

.inv-sum dd {
    margin: 0;
    font-weight: 700;
}

.inv-sum .is-total {
    border-bottom: 0;
    color: #b91c1c;
    font-size: 15px;
}

.inv-sum .is-total dt {
    font-weight: 700;
}

.inv-words {
    margin: 8px 0 0;
}

.inv-signs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 14px;
    text-align: center;
}

.inv-sign strong {
    display: block;
    margin-bottom: 6px;
}

.inv-sigbox {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    margin: 0 auto;
    padding: 8px 10px;
    max-width: 280px;
    border: 1.5px solid #16a34a;
    border-radius: 6px;
    color: #166534;
    font-size: 12px;
    text-align: left;
}

.inv-sigbox i {
    font-size: 22px;
}

.inv-sigbox.is-missing {
    border: 1px dashed #cbd5e1;
    color: #94a3b8;
    font-style: italic;
    text-align: center;
}

.inv-cqt {
    margin: 10px 0 0;
    color: #166534;
    font-size: 12px;
    text-align: center;
}

.inv-foot {
    margin: 12px 0 0;
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
    color: #94a3b8;
    font-family: Arial, sans-serif;
    font-size: 10.5px;
    text-align: center;
}

.inv.is-compact {
    font-size: 12px;
}

.inv.is-compact .inv-table th,
.inv.is-compact .inv-table td {
    padding: 2px 5px;
}

/* Bản in (khung #xiPrintSheet chỉ hiện khi in): hóa đơn dài > 14 dòng được thu gọn để vừa 1 trang A4. */
#xiPrintSheet .inv {
    font-size: 12.5px;
}

#xiPrintSheet .inv.is-compact {
    font-size: 10.5px;
    line-height: 1.3;
}

#xiPrintSheet .inv.is-compact .inv-table th,
#xiPrintSheet .inv.is-compact .inv-table td,
#xiPrintSheet .inv.is-compact .inv-rates th,
#xiPrintSheet .inv.is-compact .inv-rates td {
    padding: 1px 4px;
}

#xiPrintSheet .inv.is-compact .inv-title {
    margin: 6px 0;
}

#xiPrintSheet .inv.is-compact .inv-sigbox {
    min-height: 52px;
    padding: 4px 8px;
}

#xiPrintSheet .inv.is-compact .inv-signs {
    margin-top: 8px;
}

/* ===== Công cụ Tính Tiền Điện – Nước Phòng trọ (/cong-cu/tinh-tien-phong-tro) ===== */
.tool-card-icon.tool-card-icon-violet {
    background: #f5f3ff;
    color: #6d28d9;
}

.tool-card-icon.tool-card-icon-rose {
    background: #fff1f2;
    color: #be123c;
}

.pt-tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e2e8f0;
}

.pt-tab {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    margin-bottom: -2px;
    padding: .7rem 1.1rem;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: #475569;
    font-weight: 600;
}

.pt-tab:hover {
    color: var(--emd-primary);
}

.pt-tab.is-active {
    border-bottom-color: var(--emd-primary);
    color: var(--emd-primary);
}

.pt-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.pt-toolbar .pt-privacy {
    margin: 0 0 0 auto;
    text-align: right;
}

.pt-switch {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: .9rem;
    padding: 3px;
    border-radius: 10px;
    background: #f1f5f9;
}

.pt-switch-btn {
    display: inline-flex;
    gap: .35rem;
    align-items: center;
    justify-content: center;
    padding: .42rem .85rem;
    border-radius: 8px;
    color: #475569;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.pt-switch-btn:hover {
    color: var(--emd-primary);
}

.btn-check:checked + .pt-switch-btn {
    background: #fff;
    color: var(--emd-primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .14);
}

.btn-check:focus-visible + .pt-switch-btn {
    outline: 2px solid var(--emd-primary);
    outline-offset: 1px;
}

.pt-usage {
    margin: .7rem 0 0;
    padding: .5rem .75rem;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: .88rem;
}

.pt-usage.is-warn {
    background: #fef2f2;
    color: #b91c1c;
}

.pt-tier {
    margin-top: .75rem;
}

.pt-tier-table th,
.pt-tier-table td {
    font-size: .86rem;
    vertical-align: middle;
    white-space: nowrap;
}

.pt-tier-table .pt-tier-price {
    width: 6.5rem;
    margin-left: auto;
    text-align: right;
}

.pt-tier-table tfoot td {
    font-weight: 600;
}

.pt-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.pt-result .tool-card-box {
    margin: 0;
}

.pt-breakdown td {
    font-size: .92rem;
}

.pt-breakdown td.text-end {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pt-preview {
    overflow-x: auto;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #fff;
}

.pt-preview .pts {
    font-size: 12px;
}

.pt-print-group {
    display: flex;
    gap: .5rem;
}

.pt-print-group .form-select {
    width: 5.2rem;
}

/* Cột kết quả hẹp: 2 nút hành động xếp thành 2 hàng rộng bằng nhau. */
.pt-result .tool-actions > .btn,
.pt-result .pt-print-group {
    flex: 1 1 100%;
}

.pt-result .pt-print-group .btn {
    flex: 1 1 auto;
}

/* Tab nhiều phòng */
.pt-many-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.pm-head-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.pm-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.input-group > .pm-elec-mode {
    flex: 0 0 auto;
    width: auto;
    max-width: 9.5rem;
}

.pm-row {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.35fr) minmax(0, 1.15fr) repeat(4, minmax(0, .8fr)) minmax(0, 1fr) minmax(0, 1.45fr) 9.2rem;
    gap: .4rem;
    align-items: center;
    padding: .4rem 0;
    border-bottom: 1px solid #eef2f0;
}

.pm-row-head {
    padding-top: 0;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.3;
}

.pm-cell {
    min-width: 0;
}

.pm-cell-label {
    display: none;
}

.pm-cell-total {
    padding-right: .6rem;
    text-align: right;
}

.pm-total {
    display: block;
    color: #0f172a;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pm-detail {
    display: block;
    color: #64748b;
    font-size: .72rem;
    white-space: nowrap;
}

.pm-detail.is-warn {
    color: #b91c1c;
}

.pm-cell-act {
    display: flex;
    gap: .25rem;
    align-items: center;
    justify-content: flex-end;
}

.pm-copy {
    white-space: nowrap;
}

.pm-del {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
}

.pm-del:hover,
.pm-del:focus-visible {
    background: #fef2f2;
    color: #dc2626;
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .pm-row {
        grid-template-columns: minmax(0, .8fr) minmax(0, 1.35fr) minmax(0, 1.25fr) repeat(4, minmax(0, .85fr)) minmax(0, 1.1fr) minmax(0, 1.3fr) 4.6rem;
    }

    .pm-copy span {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .pt-many-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pm-row-head {
        display: none;
    }

    .pm-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: .55rem .6rem;
        margin-bottom: .75rem;
        padding: .8rem;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fbfdfc;
    }

    .pm-cell-label {
        display: block;
        margin-bottom: .15rem;
        color: #64748b;
        font-size: .74rem;
        font-weight: 600;
    }

    .pm-cell-room { order: 1; }
    .pm-cell-tenant { order: 2; grid-column: span 3; }
    .pm-cell-rent { order: 3; grid-column: span 2; }
    .pm-cell-service { order: 4; grid-column: span 2; }
    .pm-cell-eOld { order: 5; }
    .pm-cell-eNew { order: 6; }
    .pm-cell-wOld { order: 7; }
    .pm-cell-wNew { order: 8; }

    .pm-cell-total {
        order: 9;
        grid-column: span 2;
        text-align: left;
    }

    .pm-cell-act {
        order: 10;
        grid-column: span 2;
    }
}

@media (max-width: 575.98px) {
    .pt-tab {
        padding: .65rem .75rem;
    }

    .pt-tab-long {
        display: none;
    }

    .pt-toolbar .pt-privacy {
        flex-basis: 100%;
        margin: 0;
        text-align: left;
    }

    .pt-switch {
        display: flex;
    }

    .pt-switch-btn {
        flex: 1 1 0;
        padding: .45rem .5rem;
        font-size: .84rem;
        text-align: center;
    }

    .pt-many-stats {
        grid-template-columns: 1fr;
        gap: .6rem;
    }

    .pm-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pm-cell-act {
        gap: 0;
    }

    .pm-cell-tenant,
    .pm-cell-rent,
    .pm-cell-service,
    .pm-cell-total,
    .pm-cell-act {
        grid-column: span 1;
    }

    .pt-preview {
        padding: .6rem;
    }

    .pt-preview .pts {
        font-size: 9.5px;
    }

    .pt-preview .pts-table td:first-child {
        min-width: 6.5em;
    }

    .pt-preview .pts-table th,
    .pt-preview .pts-table td {
        padding: .3em .3em;
    }

    .pt-print-group {
        flex: 1 1 100%;
    }

    .pt-print-group .btn {
        flex: 1 1 auto;
    }

    .pt-result .tool-actions > .btn {
        flex: 1 1 100%;
    }
}

/* Phiếu báo / phiếu tính lãi (dùng chung cho xem trước và bản in). Đơn vị em để co giãn theo cỡ chữ khung chứa. */
.pts {
    color: #0f172a;
    line-height: 1.4;
}

.pts-head {
    margin-bottom: .7em;
    padding-bottom: .6em;
    border-bottom: 2px solid #005331;
    text-align: center;
}

.pts-house {
    color: #005331;
    font-size: .92em;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.pts-title {
    margin: .2em 0;
    color: #0f172a;
    font-size: 1.35em;
    font-weight: 800;
    letter-spacing: .04em;
}

.pts-period {
    color: #475569;
    font-weight: 600;
}

.pts-info {
    display: flex;
    flex-wrap: wrap;
    gap: .25em 1.4em;
    margin-bottom: .6em;
}

.pts-info span {
    color: #64748b;
}

.pts-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.pts-table th,
.pts-table td {
    padding: .3em .45em;
    border: 1px solid #cbd5e1;
}

.pts-table th {
    background: #f1f5f9;
    font-size: .88em;
    font-weight: 700;
}

.pts-table .r {
    text-align: right;
    white-space: nowrap;
}

.pts-table td:first-child {
    min-width: 9.6em;
}

.pts-table th {
    white-space: nowrap;
}

.pts-table .b {
    font-weight: 600;
}

.pts-table small {
    color: #64748b;
    font-size: .85em;
}

.pts-table tr.is-minus .r {
    color: #b91c1c;
}

.pts-table tfoot td {
    background: #ecfdf5;
    color: #005331;
    font-size: 1.05em;
    font-weight: 800;
}

.pts-tier,
.pts-warn,
.pts-words,
.pts-note {
    margin: .5em 0 0;
}

.pts-tier {
    color: #475569;
    font-size: .85em;
}

.pts-warn {
    color: #b91c1c;
    font-weight: 600;
}

.pts-note {
    padding: .4em .6em;
    border-left: 3px solid #005331;
    background: #f8fafc;
}

.pts-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 6.5em;
    margin-top: .8em;
    text-align: center;
}

.pts-sign strong {
    display: block;
}

.pts-sign span {
    color: #64748b;
    font-size: .8em;
    font-style: italic;
}

.pts-foot {
    margin: .6em 0 0;
    color: #94a3b8;
    font-size: .75em;
    text-align: center;
}

.pts-sheet.pts-a5 {
    font-size: 11.5px;
}

.pts-sheet.pts-a4 {
    font-size: 14px;
}

@media print {
    .pts-table th,
    .pts-table tfoot td,
    .pts-note {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Công cụ Tính Lãi suất Cầm đồ (/cong-cu/tinh-lai-cam-do) — dùng chung pt-switch, pt-result, pts ===== */
.cd-days-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1rem;
    align-items: center;
    margin-top: .9rem;
}

.cd-days-row .cd-days {
    flex: 1 1 14rem;
    margin: 0;
}

.input-group > .cd-unit {
    flex: 0 0 auto;
    width: auto;
    max-width: 11rem;
}

.cd-stats {
    display: grid;
    gap: .75rem;
}

.cd-stats .tool-stat {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    align-items: center;
    justify-content: space-between;
}

.cd-stat-interest .tool-stat-value {
    color: #be123c;
}

.cd-pts-info .cd-pts-asset {
    flex-basis: 100%;
}

.cd-pts-table td:nth-child(2) {
    color: #334155;
    font-size: .9em;
}

.cd-pts-table td:first-child {
    min-width: 0;
    font-weight: 600;
    white-space: nowrap;
}

.cd-pts-table tr.is-give td {
    background: #fff7ed;
}

@media (max-width: 575.98px) {
    .cd-mode-switch .pt-switch-btn,
    .cd-period-switch .pt-switch-btn,
    .cd-days-row .pt-switch-btn {
        padding: .45rem .3rem;
        font-size: .8rem;
        white-space: nowrap;
    }

    .cd-mode-switch .pt-switch-btn i {
        display: none;
    }

    .cd-days-row .pt-switch {
        flex: 1 1 100%;
    }

    .cd-pts-table td:first-child {
        white-space: normal;
    }
}
