*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a2e;
    background: #f0f2f5;
}

.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

header {
    margin-bottom: 24px;
}

header h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
    font-weight: 700;
}

header p {
    margin: 0;
    color: #5a6270;
    font-size: 0.875rem;
}

.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    border-bottom: 2px solid #dde1e7;
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: #5a6270;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
    color: #1a1a2e;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.panel {
    display: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 20px;
}

.panel.active {
    display: block;
}

.panel h2 {
    margin: 0 0 4px;
    font-size: 1.125rem;
}

.panel .desc {
    margin: 0 0 16px;
    color: #5a6270;
    font-size: 0.8125rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #5a6270;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.field input,
.field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cdd3dc;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #fff;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e8ecf1;
    color: #1a1a2e;
}

.btn-secondary:hover:not(:disabled) {
    background: #dde1e7;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.result-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-warn {
    background: #fef9c3;
    color: #854d0e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.meta-info {
    font-size: 0.8125rem;
    color: #5a6270;
    margin-bottom: 8px;
}

.meta-info span {
    margin-right: 16px;
}

.json-output {
    margin: 0;
    padding: 14px;
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 6px;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow: auto;
    max-height: 480px;
    white-space: pre-wrap;
    word-break: break-word;
}

.json-output.empty {
    background: #f8f9fb;
    color: #9aa3b0;
    border: 1px dashed #cdd3dc;
}

.loading {
    display: none;
    align-items: center;
    gap: 8px;
    color: #5a6270;
    font-size: 0.8125rem;
    margin-bottom: 12px;
}

.loading.visible {
    display: flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #dde1e7;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.divider {
    border: none;
    border-top: 1px solid #e8ecf1;
    margin: 16px 0;
}

.detail-section .field {
    max-width: 200px;
}

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