.sw-app-shell,
.sw-app-shell *,
.sw-app-shell *::before,
.sw-app-shell *::after {
    box-sizing: border-box;
}

.sw-app-shell {
    overflow: hidden;
    border: 1px solid rgba(20, 72, 150, 0.12);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 22px 58px rgba(18, 53, 96, 0.09);
}

.sw-app-grid {
    display: grid;
}

.sw-app-panel {
    min-width: 0;
    padding: 22px;
}

.sw-app-panel + .sw-app-panel {
    border-top: 1px solid #e7edf5;
    background: #f8fbff;
}

.sw-app-panel__head {
    margin-bottom: 22px;
}

.sw-app-panel__eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.sw-app-panel__head h2,
.sw-app-panel__head h3 {
    margin: 0;
    color: var(--text-main);
    font-size: clamp(22px, 4vw, 29px);
    font-weight: 820;
    line-height: 1.18;
    letter-spacing: -0.03em;
}

.sw-app-panel__head h3 {
    font-size: 19px;
}

.sw-app-panel__head p {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.62;
}

.sw-app-form {
    display: grid;
    gap: 18px;
}

.sw-app-row {
    display: grid;
    gap: 14px;
}

.sw-app-field {
    min-width: 0;
}

.sw-app-label {
    display: flex;
    margin-bottom: 8px;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: #243247;
    font-size: 13px;
    font-weight: 790;
    line-height: 1.35;
}

.sw-app-label small {
    color: #748399;
    font-size: 10px;
    font-weight: 700;
}

.sw-app-input,
.sw-app-select,
.sw-app-textarea {
    width: 100%;
    border: 1px solid #dce4ef;
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-main);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.sw-app-input,
.sw-app-select {
    min-height: 48px;
    padding: 0 14px;
}

.sw-app-select {
    padding-right: 40px;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #65758b 50%),
        linear-gradient(135deg, #65758b 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 13px) calc(50% - 2px);
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
}

.sw-app-textarea {
    min-height: 130px;
    padding: 13px 14px;
    resize: vertical;
}

.sw-app-textarea--code,
.sw-app-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.6;
    tab-size: 2;
}

.sw-app-textarea--tall {
    min-height: 320px;
}

.sw-app-input:focus,
.sw-app-select:focus,
.sw-app-textarea:focus {
    border-color: rgba(20, 72, 150, 0.55);
    box-shadow: 0 0 0 4px rgba(20, 72, 150, 0.1);
}

.sw-app-input[readonly],
.sw-app-textarea[readonly] {
    background: #f6f9fd;
}

.sw-app-field.is-invalid .sw-app-input,
.sw-app-field.is-invalid .sw-app-select,
.sw-app-field.is-invalid .sw-app-textarea {
    border-color: #ce3545;
    box-shadow: 0 0 0 3px rgba(206, 53, 69, 0.08);
}

.sw-app-hint,
.sw-app-error,
.sw-app-counter {
    display: block;
    margin-top: 7px;
    color: #738197;
    font-size: 11px;
    line-height: 1.45;
}

.sw-app-error {
    min-height: 0;
    color: #b92234;
    font-weight: 700;
}

.sw-app-field-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.sw-app-options {
    display: grid;
    gap: 10px;
}

.sw-app-option {
    display: flex;
    min-height: 42px;
    padding: 10px 12px;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid #e1e8f1;
    border-radius: 11px;
    background: #f9fbfe;
    color: #35455b;
    font-size: 12px;
    font-weight: 680;
    line-height: 1.45;
    cursor: pointer;
}

.sw-app-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    flex: 0 0 17px;
    accent-color: var(--primary);
}

.sw-app-actions,
.sw-app-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sw-app-tabs {
    display: flex;
    padding: 6px;
    overflow-x: auto;
    border-bottom: 1px solid #e6ecf4;
    background: #f6f9fd;
    scrollbar-width: thin;
}

.sw-app-tab {
    min-height: 42px;
    padding: 0 15px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #5e6c80;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition), box-shadow var(--transition);
}

.sw-app-tab[aria-selected="true"] {
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(18, 53, 96, 0.09);
    color: var(--primary);
}

.sw-app-result {
    min-height: 250px;
    border: 1px solid #e1e8f1;
    border-radius: 16px;
    background: #ffffff;
}

.sw-app-result__empty {
    display: flex;
    min-height: 250px;
    padding: 28px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #708096;
}

.sw-app-result__empty svg {
    width: 42px;
    height: 42px;
    margin-bottom: 15px;
    color: #8da4c4;
}

.sw-app-result__empty strong {
    color: #2a3a50;
    font-size: 15px;
}

.sw-app-result__empty span {
    max-width: 360px;
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.55;
}

.sw-app-result__content {
    padding: 18px;
}

.sw-app-status {
    display: flex;
    padding: 14px;
    align-items: flex-start;
    gap: 11px;
    border: 1px solid #dfe7f1;
    border-radius: 12px;
    background: #f7faff;
    color: #40516a;
    font-size: 12px;
    line-height: 1.5;
}

.sw-app-status strong {
    display: block;
    margin-bottom: 2px;
    color: #24354c;
    font-size: 13px;
}

.sw-app-status--success {
    border-color: #bfe6d2;
    background: #f0fbf5;
    color: #176543;
}

.sw-app-status--warning {
    border-color: #f0d89f;
    background: #fff9e9;
    color: #765518;
}

.sw-app-status--error {
    border-color: #efc0c6;
    background: #fff4f5;
    color: #9d2433;
}

.sw-app-badges {
    display: flex;
    margin: 14px 0;
    flex-wrap: wrap;
    gap: 7px;
}

.sw-app-badge {
    display: inline-flex;
    min-height: 27px;
    padding: 0 9px;
    align-items: center;
    border-radius: 999px;
    background: #edf3fb;
    color: #4a5d76;
    font-size: 10px;
    font-weight: 800;
}

.sw-app-notice {
    padding: 13px 14px;
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    background: #eff5fe;
    color: #40516a;
    font-size: 12px;
    line-height: 1.55;
}

.sw-app-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e2e9f2;
    border-radius: 12px;
    background: #ffffff;
}

.sw-app-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    color: #40516a;
    font-size: 12px;
}

.sw-app-table th,
.sw-app-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #e7edf5;
    text-align: left;
    vertical-align: top;
}

.sw-app-table th {
    background: #f5f8fc;
    color: #53647b;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.sw-app-table tr:last-child td {
    border-bottom: 0;
}

.sw-app-guide-grid {
    display: grid;
    gap: 14px;
}

.sw-app-guide-card {
    padding: 21px;
    border: 1px solid #e2e9f2;
    border-radius: 16px;
    background: #ffffff;
}

.sw-app-guide-card > span {
    display: block;
    margin-bottom: 13px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.05em;
}

.sw-app-guide-card h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 810;
}

.sw-app-guide-card p {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.sw-app-faq {
    display: grid;
    gap: 10px;
}

.sw-app-faq details {
    border: 1px solid #e1e8f1;
    border-radius: 13px;
    background: #ffffff;
}

.sw-app-faq summary {
    padding: 16px 18px;
    color: #29394f;
    font-size: 13px;
    font-weight: 790;
    cursor: pointer;
}

.sw-app-faq details p {
    padding: 0 18px 17px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.65;
}

.sw-app-color {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.sw-app-color input[type="color"] {
    width: 48px;
    height: 48px;
    padding: 3px;
    border: 1px solid #dce4ef;
    border-radius: 11px;
    background: #ffffff;
    cursor: pointer;
}

.sw-app-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(20, 72, 150, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: sw-app-spin 0.75s linear infinite;
}

@keyframes sw-app-spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 641px) {
    .sw-app-panel {
        padding: 30px;
    }

    .sw-app-row--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sw-app-row--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sw-app-guide-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 940px) {
    .sw-app-grid--2 {
        grid-template-columns: minmax(0, 1fr) minmax(360px, 0.92fr);
    }

    .sw-app-panel + .sw-app-panel {
        border-top: 0;
        border-left: 1px solid #e7edf5;
    }
}

@media (max-width: 520px) {
    .sw-app-actions .sw-tools-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sw-app-spinner {
        animation-duration: 1.8s;
    }
}
