.sw-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sw-brand {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 6px 0;
    letter-spacing: 0.2px;
}

.sw-subtitle {
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.sw-notice {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    padding: 8px 12px;
    border-left: 3px solid var(--primary-purple);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
}

.sw-heading {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 14px 0;
}

.sw-muted {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.sw-error {
    color: #c0392b;
    font-size: 14px;
    margin: 0;
}

.sw-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.sw-chip {
    border: 1px solid var(--border-light, #e3e3e3);
    background: #ffffff;
    color: var(--text-dark);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}

.sw-chip.active {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
    color: #ffffff;
}

.sw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.sw-card {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
}

.sw-card[hidden] {
    display: none;
}

.sw-thumb {
    aspect-ratio: 4 / 3;
    background: linear-gradient(180deg, #f7f7fa 0%, #eeeef3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sw-thumb svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sw-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.sw-card-category {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

.sw-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.sw-card-description {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.sw-btn {
    display: inline-block;
    align-self: flex-start;
    margin-top: 8px;
    padding: 9px 16px;
    border-radius: var(--btn-radius, 10px);
    background: var(--main-gradient);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.sw-btn.secondary {
    background: #ffffff;
    color: var(--text-dark);
    border: 1px solid var(--border-light, #e3e3e3);
}

.sw-projects {
    display: flex;
    flex-direction: column;
}

.sw-project {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sw-project:last-child {
    border-bottom: none;
}

.sw-project-name {
    font-weight: 600;
    color: var(--text-dark);
    flex: 1 1 200px;
    overflow-wrap: anywhere;
}

.sw-project-meta {
    color: var(--text-muted);
    font-size: 13px;
    flex: 2 1 240px;
}

.sw-project .sw-btn {
    margin-top: 0;
}

@media (max-width: 480px) {
    .sw-grid {
        grid-template-columns: 1fr;
    }

    .sw-brand {
        font-size: 22px;
    }
}

.sw-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
}

.sw-toolbar .sw-brand {
    margin: 0;
    flex: 1 1 240px;
    font-size: 22px;
    overflow-wrap: anywhere;
}

.sw-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sw-overall {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 999px;
    padding: 6px 12px;
}

.sw-xray-banner {
    background: #29465c;
    color: #ffffff;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
}

.sw-xray-banner[hidden] {
    display: none;
}

.sw-editor-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sw-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-light, #e3e3e3);
    margin-bottom: 10px;
    font-size: 14px;
}

.sw-part-list {
    list-style: none;
    margin: 0 0 14px 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.sw-part-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    color: var(--text-dark);
    font-size: 14px;
}

.sw-part-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.sw-part-item.active {
    background: rgba(179, 91, 20, 0.12);
    color: #7a3c0b;
    font-weight: 600;
}

.sw-part-item.is-hidden {
    color: var(--text-muted);
}

.sw-part-label {
    flex: 1;
}

.sw-part-id {
    font-size: 11px;
    color: var(--text-muted);
}

.sw-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 13px;
    margin: 6px 0 0 0;
}

.sw-details dt {
    color: var(--text-muted);
}

.sw-details dd {
    margin: 0;
    color: var(--text-dark);
    overflow-wrap: anywhere;
}

.sw-views,
.sw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sw-chip:disabled {
    opacity: 0.45;
    cursor: default;
}

.sw-viewport {
    position: relative;
    height: min(70vh, 640px);
    min-height: 360px;
    border-radius: 14px;
    overflow: hidden;
    background: #f4f4f7;
    touch-action: none;
}

.sw-viewport canvas {
    display: block;
    cursor: grab;
}

.sw-dim-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sw-dim-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: #6b3fa0;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .sw-editor-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sw-viewport {
        height: 55vh;
        min-height: 300px;
    }
}

.sw-params-card {
    margin-top: 16px;
}

.sw-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.sw-name-row .sw-search {
    flex: 1 1 220px;
    max-width: 420px;
}

.sw-name-row .sw-search.has-error {
    border-color: #c0392b;
}

.sw-param-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sw-param-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
}

.sw-param-row.has-error {
    background: #fdecea;
}

.sw-param-label {
    flex: 0 0 180px;
    font-weight: 600;
    color: var(--text-dark);
}

.sw-param-input {
    width: 110px;
    padding: 6px 8px;
    border: 1px solid var(--border-light, #e3e3e3);
    border-radius: 8px;
    font-size: 14px;
}

.sw-param-input:disabled {
    background: #f4f4f4;
    color: var(--text-muted);
}

.sw-param-row.has-error .sw-param-input {
    border-color: #c0392b;
}

.sw-param-unit,
.sw-param-hint {
    color: var(--text-muted);
    font-size: 13px;
}

.sw-param-allowed {
    color: var(--primary-purple);
}

.sw-badge-readonly {
    font-size: 12px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #eeeeee;
    color: var(--text-muted);
}

.sw-issues,
.sw-adjust-notice {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.sw-issues {
    background: #fdecea;
    color: #8e2a1f;
}

.sw-adjust-notice {
    background: #fff7e0;
    color: #6d5200;
}

.sw-issues ul,
.sw-adjust-notice ul {
    margin: 6px 0;
    padding-left: 20px;
}

.sw-save-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.sw-save-bar .sw-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sw-drag-badge {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    background: #6b3fa0;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.sw-drag-badge .sw-limit {
    color: #ffd966;
}

@media (max-width: 600px) {
    .sw-param-label {
        flex-basis: 100%;
    }
}

.sw-admin-link {
    display: inline-block;
    margin-top: 8px;
    color: #6b3fa0;
    font-weight: 600;
}

.sw-admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.sw-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sw-admin-table th,
.sw-admin-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    vertical-align: top;
}

.sw-admin-table th {
    font-weight: 600;
    white-space: nowrap;
}

.sw-admin-version {
    display: inline-block;
    margin-right: 10px;
    white-space: nowrap;
}

.sw-admin-latest {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #6b3fa0;
    color: #ffffff;
    font-size: 11px;
}

.sw-admin-errors {
    margin: 0;
    padding-left: 18px;
    color: #a12a2a;
}

.sw-admin-errors ul {
    padding-left: 18px;
    color: inherit;
}

.sw-admin-subnav {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.sw-admin-subnav a {
    padding: 6px 2px;
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.sw-admin-subnav a.active {
    color: #6b3fa0;
    border-bottom-color: #6b3fa0;
}

.sw-admin-notice {
    margin: 8px 0 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #eaf6ee;
    color: #1d6b3a;
}

.sw-admin-notice-error {
    background: #fbeaea;
    color: #a12a2a;
}

.sw-admin-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.sw-admin-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sw-admin-form-row .sw-search {
    flex: 1 1 220px;
    min-width: 0;
}

.sw-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sw-admin-actions form {
    margin: 0;
}

.sw-status-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eeeef3;
    color: #4a4a68;
}

.sw-status-active,
.sw-status-published {
    background: #eaf6ee;
    color: #1d6b3a;
}

.sw-status-invited,
.sw-status-draft {
    background: #fff4e0;
    color: #8a5a00;
}

.sw-status-blocked,
.sw-status-unpublished {
    background: #fbeaea;
    color: #a12a2a;
}

.sw-admin-new {
    display: inline-block;
    margin: 8px 12px 0 0;
    text-decoration: none;
}

a.sw-admin-version {
    color: inherit;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 6px;
}

a.sw-admin-version:hover {
    background: rgba(107, 63, 160, 0.08);
}

.sw-admin-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.sw-admin-edit-card {
    min-width: 0;
}

.sw-admin-json-label {
    display: block;
    font-weight: 600;
    margin: 8px 0 6px;
}

.sw-json {
    width: 100%;
    min-height: 360px;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
    padding: 10px;
    border: 1px solid var(--border-light, #e3e3e3);
    border-radius: 8px;
    resize: vertical;
    tab-size: 2;
}

.sw-json[readonly] {
    background: #f6f6f9;
}

.sw-admin-upload {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
    font-size: 13px;
}

.sw-admin-upload input {
    max-width: 100%;
}

.sw-admin-edit-card .sw-admin-actions {
    margin-top: 8px;
}

.sw-danger {
    color: #a12a2a;
}

.sw-admin-preview {
    min-width: 0;
}

.sw-admin-preview-heading {
    margin: 0 0 8px;
}

.sw-admin-preview .sw-editor-page {
    padding: 0;
    margin: 0;
    max-width: none;
    min-height: 0;
    width: auto;
}

@media (min-width: 1100px) {
    .sw-admin-editor-layout {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        align-items: start;
    }
}
