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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.ssg-total-chip-danger {
    background: #fff5f5;
    color: #7f1d1d;
    border-color: #fecaca;
}

.ssg-items-header,
.ssg-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px 92px;
    gap: 0.65rem;
    align-items: center;
}

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

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

.ssg-item-amount {
    text-align: right;
}

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

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

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

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

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

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

.ssg-output {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    background:
        radial-gradient(circle at top right, rgba(13, 148, 136, 0.08), transparent 26%),
        linear-gradient(180deg, #fffefb 0%, #ffffff 100%);
    padding: 1rem;
    min-height: 620px;
    overflow-x: auto;
}

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

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

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

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

.ssg-doc-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ssg-doc-sub {
    margin: 0.18rem 0 0;
    font-size: 0.93rem;
    color: #475569;
}

.ssg-meta-grid,
.ssg-foot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.ssg-panel {
    border: 1px solid #dbe3ec;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    background: #fff;
}

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

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

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

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

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

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

.ssg-net-row td {
    background: #f8fafc;
    font-weight: 700;
}

.ssg-words {
    margin-top: 0.9rem;
    font-weight: 600;
}

.ssg-note {
    margin-top: 0.75rem;
    color: #475569;
}

.ssg-foot-grid {
    margin-top: 1rem;
    align-items: end;
}

.ssg-signature {
    text-align: center;
    padding-top: 2.4rem;
}

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

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

    .ssg-meta-grid,
    .ssg-foot-grid {
        grid-template-columns: 1fr;
    }
}

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

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

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

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

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

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

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