.spg-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: 20px;
}

.spg-table,
.sng-templates-table { min-width: 0; table-layout: fixed; }

.spg-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-cell .tournaments-actions,
.actions-cell .spg-actions { flex-wrap: nowrap; justify-content: flex-end; }

.tournaments-section .btn--sm { padding: 8px 12px; font-size: 12px; }

.spg-table .actions-cell .btn--sm { padding-left: 9px; padding-right: 9px; }

.tournaments-table th,
.tournaments-table td { padding-left: 12px; padding-right: 12px; }

.spg-multipliers { overflow: hidden; text-overflow: ellipsis; }

.spg-table td:nth-child(1),
.spg-table td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }

.spg-table th:nth-child(1), .spg-table td:nth-child(1) { width: 14%; }
.spg-table th:nth-child(2), .spg-table td:nth-child(2) { width: 14%; }
.spg-table th:nth-child(3), .spg-table td:nth-child(3) { width: 7%; }
.spg-table th:nth-child(4), .spg-table td:nth-child(4) { width: 9%; }
.spg-table th:nth-child(5), .spg-table td:nth-child(5) { width: 14%; }
.spg-table th:nth-child(6), .spg-table td:nth-child(6) { width: 10%; }
.spg-table th:nth-child(7), .spg-table td:nth-child(7) { width: 8%; }
.spg-table th:nth-child(8), .spg-table td:nth-child(8) { width: 6%; }
.spg-table th:nth-child(9), .spg-table td:nth-child(9) { width: 18%; }

.spg-instances-table .actions-cell { overflow: visible; text-overflow: clip; }
.spg-instances-table .actions-cell .spg-actions { flex-wrap: wrap; min-width: 128px; }
.spg-instances-table th:nth-child(1), .spg-instances-table td:nth-child(1) { width: 15%; }
.spg-instances-table th:nth-child(2), .spg-instances-table td:nth-child(2) { width: 10%; }
.spg-instances-table th:nth-child(3), .spg-instances-table td:nth-child(3) { width: 24%; }
.spg-instances-table th:nth-child(4), .spg-instances-table td:nth-child(4) { width: 11%; }
.spg-instances-table th:nth-child(5), .spg-instances-table td:nth-child(5) { width: 8%; }
.spg-instances-table th:nth-child(6), .spg-instances-table td:nth-child(6) { width: 10%; }
.spg-instances-table th:nth-child(7), .spg-instances-table td:nth-child(7) { width: 22%; }

.spg-template-row td {
    background: rgba(255, 255, 255, 0.04);
}

.spg-template-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.spg-instance-id {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.spg-auto-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 6px;
    border: 1px solid rgba(34, 197, 94, 0.45);
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.sng-templates-table th,
.sng-templates-table td { overflow: hidden; text-overflow: ellipsis; }

.sng-templates-table th:nth-child(1), .sng-templates-table td:nth-child(1) { width: 13%; }
.sng-templates-table th:nth-child(2), .sng-templates-table td:nth-child(2) { width: 12%; }
.sng-templates-table th:nth-child(3), .sng-templates-table td:nth-child(3) { width: 5%; }
.sng-templates-table th:nth-child(4), .sng-templates-table td:nth-child(4) { width: 9%; }
.sng-templates-table th:nth-child(5), .sng-templates-table td:nth-child(5) { width: 7%; }
.sng-templates-table th:nth-child(6), .sng-templates-table td:nth-child(6) { width: 8%; }
.sng-templates-table th:nth-child(7), .sng-templates-table td:nth-child(7) { width: 8%; }
.sng-templates-table th:nth-child(8), .sng-templates-table td:nth-child(8) { width: 7%; }
.sng-templates-table th:nth-child(9), .sng-templates-table td:nth-child(9) { width: 8%; }
.sng-templates-table th:nth-child(10), .sng-templates-table td:nth-child(10) { width: 5%; }
.sng-templates-table th:nth-child(11), .sng-templates-table td:nth-child(11) { width: 18%; }

.sng-templates-table .actions-cell { overflow: visible; text-overflow: clip; }

@media (max-width: 799px) {
    .actions-cell .tournaments-actions,
    .actions-cell .spg-actions { flex-wrap: wrap; }
}

.spg-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.spg-editor {
    display: grid;
    gap: 10px;
}

.spg-editor__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.spg-auto-settings__details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.spg-auto-settings__details[hidden] {
    display: none;
}

.spg-radio-field {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.spg-radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
}

.spg-radio-option input {
    accent-color: var(--accent);
}

.spg-mini-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

.spg-mini-table th,
.spg-mini-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}

.spg-mini-table th {
    color: var(--text-muted);
    font-size: 12px;
}

.spg-mini-table tr:last-child td {
    border-bottom: 0;
}

.spg-mini-table .input {
    min-width: 92px;
}

.spg-locked-multiplier {
    color: var(--text-strong);
    font-weight: 800;
    white-space: nowrap;
}

.spg-weight-slider {
    width: 100%;
    min-width: 180px;
    accent-color: var(--accent);
}

.spg-weight-sum {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.spg-weight-sum.is-ok {
    color: #86efac;
}

.spg-weight-sum.is-bad {
    color: #fecaca;
}

.spg-error {
    padding: 10px 12px;
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: 8px;
    background: rgba(248, 113, 113, 0.1);
    color: #fecaca;
    font-size: 13px;
}

.spg-error[hidden] {
    display: none;
}

.spg-snippet {
    width: 100%;
    min-height: 96px;
    resize: vertical;
}

@media (max-width: 760px) {
    .spg-form-grid {
        grid-template-columns: 1fr;
    }

    .spg-auto-settings__details {
        grid-template-columns: 1fr;
    }
}
