body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
}

body:not(.settings-page) {
    background: #ffffff;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

h1 {
    font-size: 24px;
    margin: 0 0 8px;
}

p {
    color: #666;
    margin: 0 0 24px;
}

.container {
    width: 100%;
    box-sizing: border-box;
}

body:not(.settings-page) .container {
    text-align: center;
    max-width: 500px;
    padding: 20px;
}

body:not(.settings-page) .container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

body:not(.settings-page) .container li {
    margin-bottom: 12px;
}

body:not(.settings-page) .container ul a {
    text-decoration: none;
    color: #0066cc;
    font-size: 14px;
}

body:not(.settings-page) .container ul a:hover {
    text-decoration: underline;
}

input,
select,
textarea,
button {
    font: inherit;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 10px 12px;
    box-sizing: border-box;
}

button {
    cursor: pointer;
    border: none;
    background: #1d4ed8;
    color: #fff;
}

button.secondary {
    background: #4b5563;
}

button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.settings-page {
    background: #f5f7fb;
    color: #1f2937;
    padding: 24px;
}

.settings-page .container {
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}

.settings-page .container--wide {
    max-width: 1100px;
}

.settings-page .links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.settings-page .links a {
    text-decoration: none;
    color: #0066cc;
    font-size: 14px;
}

.settings-page .links a:hover {
    text-decoration: underline;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    min-width: 260px;
    flex: 1;
}

.field--compact {
    max-width: 220px;
    flex: 0 1 auto;
}

.field--wide {
    flex: 1 1 100%;
    min-width: 100%;
}

.demo-json-body {
    width: 100%;
    min-height: 6rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
    resize: vertical;
}

label {
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}

.actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.hint {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.result-panel {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: #f8fafc;
}

.result-panel--error {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.result-panel--success {
    color: #166534;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

pre {
    background: #0b1020;
    color: #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    overflow: auto;
    font-size: 12px;
    max-height: 320px;
}

pre.inline-json {
    background: #111827;
    max-height: 240px;
    margin-top: 8px;
}

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

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

.badge--warn {
    background: #fef3c7;
    color: #92400e;
}

code {
    font-size: 0.92em;
}

/* ——— Контур: единая демо-страница (kontur-demo.html) ——— */

.kontur-demo-page .kontur-demo-header h1 {
    margin-bottom: 4px;
}

.kontur-demo-lead {
    margin-bottom: 0;
}

.demo-server-offline {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 14px;
    line-height: 1.5;
}

.demo-server-offline code {
    font-size: 12px;
    word-break: break-all;
}

.kontur-demo-shared {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
    background: #f8fafc;
}

.kontur-demo-shared__title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0;
}

.tab-nav__btn {
    background: transparent;
    color: #374151;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: -1px;
}

.tab-nav__btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.tab-nav__btn.is-active {
    background: #fff;
    color: #1d4ed8;
    border-color: #e5e7eb;
    border-bottom-color: #fff;
}

.tab-panels {
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: #fff;
    min-height: 480px;
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.demo-frame {
    display: block;
    width: 100%;
    min-height: calc(100vh - 420px);
    height: 72vh;
    border: none;
    border-radius: 0 0 10px 10px;
    background: #f5f7fb;
}

.kontur-demo-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.kontur-demo-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

.kontur-demo-footer a {
    font-size: 13px;
    color: #0066cc;
    text-decoration: none;
}

.kontur-demo-footer a:hover {
    text-decoration: underline;
}

/* Встраивание в iframe (?embed=1) */
.kontur-embed .kontur-embed-hide {
    display: none !important;
}

.kontur-embed.settings-page {
    padding: 8px;
}

.kontur-embed.settings-page .container {
    max-width: none;
    box-shadow: none;
    padding: 8px 12px 16px;
    border-radius: 0;
}

.kontur-embed #log {
    max-height: 200px;
}

.demo-type-list {
    margin: 8px 0 12px;
    padding-left: 1.25rem;
    max-height: 320px;
    overflow: auto;
}

.demo-type-list li {
    margin-bottom: 4px;
}
