.qg-page .qg-subtitle {
    max-width: 760px;
    margin-inline: auto;
}

.qg-page .tool-card {
    height: auto;
}

.qg-card {
    border-radius: 18px;
}

.qg-card .tool-card-header {
    padding: 1rem 1.3rem 0.35rem;
}

.qg-card-head-main {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.qg-card .tool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.qg-tab-tip {
    max-width: 500px;
    border: 1px solid #dbe7ff;
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.qg-tab-tip-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: 0 0 auto;
}

.qg-tab-tip-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    color: #0b2048;
}

.qg-tab-tip-sub {
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.35;
    color: #334e76;
    margin-top: 0.15rem;
}

.qg-card .tool-card-body {
    padding: 0.85rem 1.3rem 1.3rem;
}

.qg-page .form-label {
    margin-bottom: 0.38rem;
    font-weight: 600;
}

.qg-page .form-control,
.qg-page .form-select {
    min-height: 42px;
    border-radius: 5px;
}

.qg-party-box {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    padding: 0.75rem;
    background: #ffffff;
}

.qg-party-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.55rem;
}

.qg-items-wrap {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    padding: 0.9rem;
    background: #fcfdff;
    margin-top: 15px;
}

.qg-items-title {
    font-size: 0.96rem;
    font-weight: 700;
}

.qg-item-hint {
    font-size: 0.84rem;
    color: #51657f;
}

.qg-item-row {
    border: 1px solid #e5ebf2;
    border-radius: 5px;
    padding: 0.7rem;
    background: #fff;
}

.qg-items-header {
    margin-bottom: 0.5rem;
}

.qg-item-grid {
    display: grid;
    gap: 0.5rem;
    align-items: end;
}

.qg-item-grid-header {
    padding: 0 0.2rem;
}

.qg-header-cell {
    font-size: 0.86rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.25;
}

.qg-header-cell-actions {
    text-align: right;
}

.qg-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
}

.qg-row-actions .btn {
    min-width: 38px;
    font-weight: 700;
    padding-inline: 0.45rem;
}

.qg-row-total {
    text-align: right;
    font-weight: 600;
    background: #f8fafc;
}

.qg-extra-box {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    background: #ffffff;
    padding: 0.75rem;
    height: 100%;
}

.qg-extra-title {
    margin-bottom: 0.65rem;
    font-weight: 600;
}

.qg-extra-title .form-check-input {
    margin-top: 0.15rem;
}

.qg-extra-title .form-check-label {
    font-weight: 600;
    color: #1e293b;
}

.qg-extra-body {
    display: grid;
    gap: 0.45rem;
}

.qg-inline-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    align-items: center;
}

.qg-inline-remove {
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    color: #ef4444;
    background: transparent;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
}

.qg-inline-remove:hover,
.qg-inline-remove:focus,
.qg-inline-remove:active {
    color: #dc2626;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: none;
}

.qg-add-term {
    margin-top: 0.35rem;
}

.qg-bank-label {
    margin-bottom: 0.18rem;
    font-weight: 400;
    font-size: 0.94rem;
    color: #475569;
    min-height: 31px;
    display: inline-flex;
    align-items: center;
}

.qg-output {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    background: #fffdf8;
    padding: 1rem;
    min-height: 460px;
    color: #1f2937;
    font-size: 0.94rem;
    line-height: 1.66;
    overflow-x: auto;
}

.qg-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.qg-detail-actions .btn {
    width: auto !important;
    min-width: 102px;
    min-height: 42px;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.qg-detail-actions #qg_reset {
    background-color: #f8f9fa;
    border: 1px solid #8b98a7;
    color: #526070;
}

.qg-detail-actions #qg_reset:hover,
.qg-detail-actions #qg_reset:focus {
    background-color: #eef2f6;
    border-color: #748396;
    color: #3f4c5c;
}

.qg-doc-company {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.qg-doc-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.qg-doc-meta-date {
    text-align: right;
}

.qg-party-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.qg-party-card {
    border: 1px solid #d6e0ea;
    border-radius: 5px;
    padding: 0.65rem 0.75rem;
    background: #fff;
}

.qg-party-card h4 {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.qg-party-card p {
    margin: 0 0 0.28rem;
}

.qg-party-pair {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
}

.qg-party-pair p {
    flex: 1;
    min-width: 0;
    margin: 0 0 0.28rem;
    word-break: break-word;
}

.qg-doc-line {
    margin: 0 0 0.28rem;
}

.qg-doc-list {
    margin: 0;
    padding-left: 1.2rem;
}

.qg-doc-list li {
    margin: 0 0 0.25rem;
}

.qg-doc-subject {
    margin: 20px 0;
}

.qg-subject-label {
    font-weight: 400;
}

.qg-subject-text {
    font-weight: 700;
}

.qg-doc-section-title {
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
}

.qg-doc-extra {
    margin-top: 0.8rem;
}

.qg-doc-extra-grid {
    display: grid;
    grid-template-columns: 75% 25%;
    gap: 0;
    margin-top: 0.8rem;
    border: 1px solid #d6e0ea;
    border-radius: 5px;
    overflow: hidden;
}

.qg-doc-extra-card {
    border: 0;
    border-radius: 0;
    padding: 0.65rem 0.75rem;
    background: #fff;
    min-height: 100%;
    font-size: 9px;
}

.qg-doc-extra-bank {
    border-left: 1px solid #d6e0ea;
}

.qg-doc-extra-bank .qg-doc-section-title {
    margin: 0 0 4px;
    font-size: 9px;
}

.qg-doc-extra-card .qg-doc-section-title {
    margin: 0 0 4px;
    font-size: 9px;
}

.qg-doc-extra-card p,
.qg-doc-extra-card li {
    font-size: 9px;
}

.qg-doc-amount-words {
    margin-top: 0.85rem;
}

.qg-signature {
    margin-top: 0;
    margin-left: auto;
    width: 240px;
    text-align: center;
}

.qg-signature p.qg-signature-company {
    margin: 0 0 45px;
}

.qg-signature-line {
    border-top: 1px solid #d6e0ea;
    margin-bottom: 0.08rem;
}

.qg-signature p {
    margin: 0;
    font-size: 0.88rem;
}

.qg-table-wrap {
    width: 100%;
}

.qg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.qg-table th,
.qg-table td {
    border: 1px solid #d6e0ea;
    padding: 0.45rem 0.55rem;
    vertical-align: top;
}

.qg-table th {
    background: #f8fafc;
    font-weight: 700;
    text-align: left;
}

.qg-cell-right {
    text-align: right;
}

.qg-summary-row td {
    background: #fff;
}

.qg-summary-label {
    text-align: right;
    font-weight: 600;
}

.qg-summary-row.qg-total-final td {
    background: #f8fafc;
    font-weight: 700;
}

.qg-doc-foot {
    margin-top: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.qg-doc-foot-note {
    margin: 0;
    max-width: 64%;
}

.qg-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.qg-actions .btn {
    width: auto !important;
    min-width: 102px;
    min-height: 42px;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (max-width: 991.98px) {
    .qg-card .tool-card-header {
        flex-direction: column;
    }

    .qg-tab-tip-title {
        font-size: 1rem;
    }

    .qg-tab-tip-sub {
        font-size: 0.9rem;
    }

    .qg-output {
        min-height: 340px;
    }

    .qg-party-grid {
        grid-template-columns: 1fr;
    }

    .qg-doc-extra-grid {
        grid-template-columns: 1fr;
    }

    .qg-doc-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .qg-doc-foot-note {
        max-width: 100%;
    }

    .qg-signature {
        margin-left: 0;
    }

    .qg-actions { justify-content: flex-start; }

    .qg-bank-label {
        min-height: auto;
        padding-top: 0.2rem;
    }
}

@media (max-width: 575.98px) {
    .qg-card .tool-card-header,
    .qg-card .tool-card-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .qg-actions { display: grid; grid-template-columns: 1fr; }

    .qg-detail-actions {
        flex-direction: column;
    }

    .qg-detail-actions .btn {
        width: 100%;
    }

    .qg-tab-tip-title {
        font-size: 0.98rem;
    }

    .qg-tab-tip-sub {
        font-size: 0.88rem;
    }

    .qg-card .tool-card-title {
        font-size: 1.45rem;
    }

    .qg-item-grid {
        grid-template-columns: 1fr !important;
    }

    .qg-header-cell {
        display: none;
    }

    .qg-row-actions {
        justify-content: flex-start;
    }

    .qg-inline-item {
        grid-template-columns: 1fr;
    }

    .qg-inline-remove {
        width: 100%;
    }
}
