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

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

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

.rcg-card .tool-card-header {
    padding: 1rem 1.3rem 0.35rem;
    display: grid;
    grid-template-columns: 48px 1fr;
    column-gap: 0.85rem;
    row-gap: 0.25rem;
    align-items: start;
}

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

.rcg-card #rcgForm > .rcg-box:first-child {
    margin-top: -0.65rem;
}

.rcg-card .tool-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
    grid-column: 1;
    grid-row: 1 / span 2;
}

.rcg-card .tool-card-title {
    margin-top: -3px;
    margin-bottom: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    grid-column: 2;
    grid-row: 1;
}

.rcg-card .tool-card-text {
    margin-bottom: 0;
    font-size: 0.98rem;
    line-height: 1.55;
    grid-column: 2;
    grid-row: 2;
}

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

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

.rcg-box {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    padding: 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.rcg-box-title {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.rcg-total-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: #eef7ff;
    color: #0f3a63;
    border: 1px solid #cfe5ff;
    font-size: 0.92rem;
}

.rcg-total-chip strong {
    font-size: 1rem;
}

.rcg-items-header,
.rcg-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) 110px 110px 86px 92px;
    gap: 0.65rem;
    align-items: center;
}

.rcg-items-header {
    font-size: 0.86rem;
    font-weight: 700;
    color: #334155;
    padding-inline: 0.15rem;
    margin-bottom: 0.45rem;
}

.rcg-item-row {
    border: 1px solid #e5ebf2;
    border-radius: 5px;
    padding: 0.65rem;
    background: #fff;
    margin-bottom: 0.5rem;
}

.rcg-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
}

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

.rcg-grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 5px;
    background: #f8fafc;
    border: 1px solid #d9e3ee;
    font-weight: 700;
    color: #1e3a5f;
}

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

.rcg-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;
}

.rcg-actions #rcg_reset {
    background-color: #f8f9fa;
    border: 1px solid #8b98a7;
    color: #526070;
}

.rcg-actions #rcg_reset:hover,
.rcg-actions #rcg_reset:focus {
    background-color: #eef2f6;
    border-color: #748396;
    color: #3f4c5c;
}

.rcg-output {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    background:
        radial-gradient(circle at top right, rgba(31, 119, 180, 0.08), transparent 28%),
        linear-gradient(180deg, #fffefb 0%, #ffffff 100%);
    padding: 1rem;
    min-height: 560px;
    overflow-x: auto;
}

.rcg-preview-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.rcg-preview-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;
}

.rcg-doc {
    width: 100%;
    color: #1f2937;
}

.rcg-doc-head {
    text-align: center;
    margin-bottom: 1rem;
}

.rcg-doc-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.rcg-doc-sub {
    margin: 0.2rem 0 0;
    font-size: 0.95rem;
    color: #475569;
}

.rcg-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    margin-top: 1rem;
}

.rcg-summary-card,
.rcg-panel {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    padding: 0.75rem 0.85rem;
    background: #fff;
}

.rcg-summary-card span {
    display: block;
    font-size: 0.84rem;
    color: #64748b;
}

.rcg-summary-card strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.05rem;
}

.rcg-meta-grid,
.rcg-remarks-grid,
.rcg-sign-grid {
    display: grid;
    gap: 0.8rem;
}

.rcg-meta-grid,
.rcg-sign-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rcg-remarks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

.rcg-meta-grid {
    margin-top: 1rem;
}

.rcg-panel h4 {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.rcg-panel p {
    margin: 0 0 0.22rem;
}

.rcg-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.rcg-table th,
.rcg-table td {
    border: 1px solid #d6e0ea;
    padding: 0.48rem 0.58rem;
    vertical-align: top;
}

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

.rcg-center {
    text-align: center;
}

.rcg-right {
    text-align: right;
}

.rcg-total-row td {
    background: #f8fafc;
    font-weight: 700;
}

.rcg-note-text {
    min-height: 58px;
    white-space: pre-wrap;
}

.rcg-sign-grid {
    margin-top: 1rem;
    align-items: end;
}

.rcg-sign-box {
    text-align: center;
    padding-top: 2.2rem;
}

.rcg-sign-line {
    border-top: 1px solid #cbd5e1;
    margin-bottom: 0.2rem;
}

@media (max-width: 991.98px) {
    .rcg-output {
        min-height: 420px;
    }

    .rcg-summary-strip,
    .rcg-meta-grid,
    .rcg-remarks-grid,
    .rcg-sign-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767.98px) {
    .rcg-summary-strip,
    .rcg-meta-grid,
    .rcg-remarks-grid,
    .rcg-sign-grid {
        grid-template-columns: 1fr;
    }
}

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

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

    .rcg-items-header {
        display: none;
    }

    .rcg-item-row {
        grid-template-columns: 1fr;
    }

    .rcg-item-actions,
    .rcg-actions {
        justify-content: stretch;
        flex-direction: column;
    }

    .rcg-actions .btn,
    .rcg-item-actions .btn {
        width: 100%;
    }

    .rcg-preview-actions {
        grid-template-columns: 1fr;
    }
}
