.cg-page .cg-subtitle {
    max-width: 780px;
    margin-inline: auto;
}

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

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

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

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

.cg-card #cgForm > .row.g-3:first-child {
    margin-top: -0.65rem;
}

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

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

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

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

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

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

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

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

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

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

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

.cg-output {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    background: #f8fafc;
    padding: 1rem;
    min-height: 560px;
    overflow-x: auto;
}

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

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

.cg-cert {
    --cg-accent: #1d4ed8;
    --cg-soft: #dbeafe;
    width: 100%;
    min-width: 680px;
    aspect-ratio: 1.414 / 1;
    background: #fff;
    border: 10px solid var(--cg-accent);
    padding: 24px;
    color: #111827;
}

.cg-cert-green {
    --cg-accent: #047857;
    --cg-soft: #d1fae5;
}

.cg-cert-gold {
    --cg-accent: #b45309;
    --cg-soft: #fef3c7;
}

.cg-cert-rose {
    --cg-accent: #be123c;
    --cg-soft: #ffe4e6;
}

.cg-cert-inner {
    min-height: 100%;
    border: 2px solid var(--cg-soft);
    padding: 24px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,255,255,0.94)),
        repeating-linear-gradient(45deg, var(--cg-soft) 0, var(--cg-soft) 1px, transparent 1px, transparent 16px);
}

.cg-cert-org {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--cg-accent);
}

.cg-cert-sub {
    margin: 0.15rem 0 0;
    color: #475569;
    font-size: 0.94rem;
}

.cg-cert-title {
    margin: 1.2rem 0 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #111827;
    text-transform: uppercase;
}

.cg-cert-kicker {
    margin: 0.35rem 0 0;
    color: #64748b;
    font-size: 0.95rem;
}

.cg-cert-name {
    display: inline-block;
    margin: 1.1rem auto 0.75rem;
    padding: 0.15rem 2rem 0.45rem;
    border-bottom: 2px solid var(--cg-accent);
    font-size: 2rem;
    font-weight: 800;
    color: var(--cg-accent);
}

.cg-cert-body {
    max-width: 680px;
    margin: 0 auto;
    color: #334155;
    font-size: 1rem;
    line-height: 1.7;
}

.cg-cert-meta {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 0.85rem;
    color: #475569;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.cg-cert-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: end;
    margin-top: 2rem;
}

.cg-cert-id {
    text-align: left;
    color: #475569;
    font-size: 0.9rem;
}

.cg-cert-sign {
    text-align: center;
}

.cg-cert-line {
    border-top: 1px solid #94a3b8;
    margin-bottom: 0.35rem;
}

.cg-cert-sign strong {
    display: block;
    font-size: 0.95rem;
}

.cg-cert-sign span {
    color: #64748b;
    font-size: 0.88rem;
}

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

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

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

    .cg-actions {
        flex-direction: column;
    }

    .cg-actions .btn {
        width: 100%;
    }

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