html {
    font-size: 16px;
}

:root {
    --bg: #07111a;
    --surface: #0d1e2e;
    --surface2: #122333;
    --border: #1b3448;
    --blue: #2571c8;
    --blue-bright: #5ba3f5;
    --blue-dim: #3399cc;
    --text: #cfe8f4;
    --text-muted: #6090a8;
    --text-dim: #3d6478;
    --green: #2dbd7c;
    --red: #d04848;
    --code-bg: #040c12;
    --r: 8px;
    --mono: 'DM Mono', monospace;
    --ui: 'Roboto', sans-serif;
    --display: 'Barlow Condensed', sans-serif;
    --max: 1400px;
}

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

body {
    font-family: var(--ui);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 1rem;
}

    body::before {
        content: '';
        position: fixed;
        inset: 0;
        background-image: linear-gradient(rgba(37,113,200,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(37,113,200,0.025) 1px, transparent 1px);
        background-size: 48px 48px;
        pointer-events: none;
        z-index: 0;
    }

/* ── Nav ──────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 22, 40, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.nav-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.nav-logo {
    font-family: var(--display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

    .nav-logo span {
        color: var(--blue-bright);
    }

.nav-logo-img {
    height: 30px;
    width: auto;
    display: block;
}

@media (max-width: 480px) {
    .nav-logo-img {
        height: 26px;
    }
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

    .nav-links a {
        font-size: 0.875rem;
        font-weight: 500;
        color: rgba(255,255,255,0.6);
        text-decoration: none;
        padding: 0.375rem 0.75rem;
        border-radius: 5px;
        transition: color .18s, background .18s;
        white-space: nowrap;
    }

        .nav-links a:hover {
            color: #fff;
            background: rgba(255,255,255,0.07);
        }

.nav-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.125rem;
    background: var(--blue);
    color: #fff;
    font-family: var(--ui);
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background .18s;
    white-space: nowrap;
}

    .nav-cta:hover {
        background: #1d5db0;
    }

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
}

.wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ── Header ─────────────────────────────── */
header {
    padding: 40px 0 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(37,113,200,0.08);
    border: 1px solid rgba(37,113,200,0.25);
    color: var(--blue-bright);
    font-family: var(--mono);
    font-size: 0.625rem;
    letter-spacing: 0.12em;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--blue-bright);
    border-radius: 50%;
    animation: blink 2.4s infinite;
}

@keyframes blink {
    0%,100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.75);
    }
}

h1 {
    font-size: clamp(1.375rem, 2.8vw, 2.125rem);
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
    letter-spacing: -0.025em;
}

    h1 em {
        color: var(--blue-bright);
        font-style: normal;
    }

.sub {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    max-width: 640px;
    line-height: 1.6;
}

/* ── Layout ──────────────────────────────── */
.grid {
    display: grid;
    grid-template-columns: 1fr 460px;
    gap: 22px;
    align-items: start;
    padding-bottom: 60px;
}

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

/* ── Panel ───────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    container-type: inline-size;
}

.panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Tabs ────────────────────────────────── */
.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

    .tab-nav::-webkit-scrollbar {
        display: none;
    }

.tab-btn {
    flex-shrink: 0;
    padding: 11px 14px;
    font-family: var(--ui);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.03em;
    transition: color .18s, border-color .18s;
}

    .tab-btn:hover {
        color: var(--text);
    }

    .tab-btn.active {
        color: var(--blue-bright);
        border-bottom-color: var(--blue-bright);
    }

    .tab-btn.has-data::after {
        content: '';
        display: inline-block;
        width: 5px;
        height: 5px;
        background: var(--green);
        border-radius: 50%;
        margin-left: 5px;
        vertical-align: middle;
        margin-bottom: 1px;
    }

.tab-panel {
    display: none;
    padding: 22px;
}

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

/* ── Schema description ──────────────────── */
.desc {
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 20px;
    padding: 11px 14px;
    background: var(--surface2);
    border-left: 3px solid var(--blue-dim);
    border-radius: 0 4px 4px 0;
}

    .desc code {
        font-family: var(--mono);
        color: var(--blue-bright);
        font-size: 0.875rem;
        background: rgba(37,113,200,0.08);
        padding: 1px 4px;
        border-radius: 3px;
    }

/* ── Form ────────────────────────────────── */
.field {
    margin-bottom: 14px;
}

    .field:last-child {
        margin-bottom: 0;
    }

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.req {
    color: var(--blue-bright);
    margin-left: 2px;
}

.opt {
    color: var(--text-dim);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8125rem;
    margin-left: 4px;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="date"],
textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 1rem;
    transition: border-color .18s, box-shadow .18s;
    outline: none;
}

    input:focus, textarea:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(37,113,200,0.09);
    }

    input::placeholder, textarea::placeholder {
        color: var(--text-dim);
        font-style: italic;
    }

textarea {
    resize: vertical;
    min-height: 74px;
}

/* ── Dynamic lists ───────────────────────── */
.dyn-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 7px;
}

.dyn-item {
    display: flex;
    gap: 7px;
    align-items: center;
}

    .dyn-item input {
        flex: 1;
    }

.btn-rm {
    flex-shrink: 0;
    width: 32px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.0625rem;
    line-height: 1;
    transition: all .18s;
}

    .btn-rm:hover {
        border-color: var(--red);
        color: var(--red);
        background: rgba(208,72,72,0.08);
    }

.btn-add {
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px dashed var(--border);
    border-radius: 5px;
    color: var(--blue);
    font-family: var(--ui);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: all .18s;
}

    .btn-add:hover {
        border-color: var(--blue);
        background: rgba(37,113,200,0.04);
    }

/* ── FAQ items ───────────────────────────── */
.faq-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
}

    .faq-item .btn-rm {
        position: absolute;
        top: 10px;
        right: 10px;
        height: 26px;
        width: 26px;
    }

    .faq-item .field {
        margin-bottom: 10px;
    }

        .faq-item .field:last-child {
            margin-bottom: 0;
        }

.faq-counter {
    font-family: var(--mono);
    font-size: 0.625rem;
    color: var(--blue-dim);
    font-weight: 500;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* ── Breadcrumb items ────────────────────── */
.crumb-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
}

.crumb-row {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-top: 8px;
}

    .crumb-row input {
        flex: 1;
    }

.crumb-num {
    font-family: var(--mono);
    font-size: 0.625rem;
    color: var(--blue-dim);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Combined tab ────────────────────────── */
.info-box {
    padding: 12px 14px;
    background: rgba(37,113,200,0.05);
    border: 1px solid rgba(37,113,200,0.18);
    border-radius: 6px;
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 18px;
}

    .info-box code {
        font-family: var(--mono);
        color: var(--blue-bright);
        font-size: 0.75rem;
        background: rgba(37,113,200,0.08);
        padding: 1px 4px;
        border-radius: 3px;
    }

.status-heading {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
}

.status-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-status {
    font-size: 0.6875rem;
    font-family: var(--mono);
    padding: 2px 8px;
    border-radius: 4px;
}

    .badge-status.ready {
        background: rgba(45,189,124,0.09);
        border: 1px solid rgba(45,189,124,0.3);
        color: var(--green);
    }

    .badge-status.empty {
        background: rgba(74,109,130,0.08);
        border: 1px solid rgba(74,109,130,0.25);
        color: var(--text-dim);
    }

.btn-combine {
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    background: rgba(37,113,200,0.09);
    border: 1px solid rgba(37,113,200,0.3);
    border-radius: 6px;
    color: var(--blue-bright);
    font-family: var(--ui);
    font-size: 0.9375rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all .18s;
}

    .btn-combine:hover {
        background: rgba(37,113,200,0.16);
        border-color: var(--blue-bright);
    }

/* ── Output panel ────────────────────────── */
.output-panel {
    position: sticky;
    top: 22px;
}

.type-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--blue-bright);
    font-weight: 500;
}

    .type-indicator::before {
        content: '';
        display: block;
        width: 7px;
        height: 7px;
        background: var(--blue-bright);
        border-radius: 50%;
    }

.btn-copy {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: rgba(37,113,200,0.09);
    border: 1px solid rgba(37,113,200,0.28);
    border-radius: 5px;
    color: var(--blue-bright);
    font-family: var(--ui);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all .18s;
}

    .btn-copy:hover {
        background: rgba(37,113,200,0.18);
        border-color: var(--blue-bright);
    }

    .btn-copy.copied {
        background: rgba(45,189,124,0.09);
        border-color: rgba(45,189,124,0.35);
        color: var(--green);
    }

.code-out {
    padding: 18px;
    background: var(--code-bg);
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.72;
    overflow: auto;
    min-height: 180px;
    max-height: 580px;
    white-space: pre;
    color: var(--text);
}

/* Syntax colours */
.jk {
    color: var(--blue-bright);
}
/* key */
.js {
    color: #9ad6ae;
}
/* string value */
.jn {
    color: #f7c060;
}
/* number */
.jt {
    color: var(--text-muted);
}
/* script tags */
.jc {
    color: #c0a0e8;
}
/* @context / @type / @graph */

.out-foot {
    padding: 11px 18px;
    background: var(--surface2);
    border-top: 1px solid var(--border);
}

.place-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

    .place-note strong {
        color: var(--blue);
    }

/* ── Mobile tab menu ────────────────────────
           When the form panel is narrower than 760px
           the horizontal tab row is replaced by a
           compact bar and collapsible vertical list.
           Uses a container query so the trigger is
           based on the panel's own width, not the
           viewport — correctly handling both the
           single-column and two-column grid layouts.
        ──────────────────────────────────────────── */
.tab-mobile-bar {
    display: none;
}

@container (max-width: 760px) {
    /* Show the mobile bar */
    .tab-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 1rem;
        min-height: 3.25rem;
        background: var(--surface2);
        border-bottom: 1px solid var(--border);
    }

    .tab-mobile-bar-left {
        display: flex;
        flex-direction: column;
        gap: 0.125rem;
    }

    .tab-mobile-eyebrow {
        font-size: 0.625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-dim);
        line-height: 1;
    }

    .tab-mobile-current {
        font-size: 1rem;
        font-weight: 700;
        color: var(--blue-bright);
        line-height: 1.25;
    }
    /* Hamburger button */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 2.25rem;
        height: 2.25rem;
        padding: 0.4375rem 0.375rem;
        background: none;
        border: 1px solid var(--border);
        border-radius: 5px;
        cursor: pointer;
        flex-shrink: 0;
        transition: border-color .18s, background .18s;
    }

        .hamburger-btn:hover {
            border-color: var(--blue);
            background: rgba(37,113,200,0.08);
        }

        .hamburger-btn.is-open {
            border-color: var(--blue-bright);
            background: rgba(91,163,245,0.1);
        }

    .hamburger-line {
        display: block;
        height: 2px;
        background: var(--text-muted);
        border-radius: 2px;
        transform-origin: center;
        transition: transform .22s ease, opacity .18s ease;
    }
    /* Animate lines to × when open */
    .hamburger-btn.is-open .hamburger-line:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .hamburger-btn.is-open .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .hamburger-btn.is-open .hamburger-line:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    /* Collapse horizontal nav; reveal as vertical list when toggled */
    .tab-nav {
        display: none;
        flex-direction: column;
        overflow-x: visible;
        border-bottom: 1px solid var(--border);
    }

        .tab-nav.mobile-open {
            display: flex;
        }
        /* Vertical tab button overrides */
        .tab-nav .tab-btn {
            border-bottom: none;
            border-left: 3px solid transparent;
            text-align: left;
            padding: 0.875rem 1.125rem;
            font-size: 1rem;
            border-radius: 0;
        }

            .tab-nav .tab-btn + .tab-btn {
                border-top: 1px solid var(--border);
            }

            .tab-nav .tab-btn.active {
                color: var(--blue-bright);
                border-bottom-color: transparent;
                border-left-color: var(--blue-bright);
                background: rgba(91,163,245,0.05);
            }
            /* Green dot: float right on vertical layout */
            .tab-nav .tab-btn.has-data::after {
                float: right;
                margin-top: 0.5rem;
                margin-left: 0;
            }
}

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--blue-dim);
    }

/* ── Import tab ──────────────────────────── */
.import-heading {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.import-textarea {
    width: 100%;
    min-height: 11rem;
    padding: 0.75rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.75rem;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
    margin-bottom: 0.625rem;
}

    .import-textarea:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(37,113,200,0.09);
    }

    .import-textarea::placeholder {
        color: var(--text-dim);
        font-style: italic;
    }

.import-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.875rem 0;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

    .import-divider::before, .import-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border);
    }

.import-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem;
    border: 1px dashed var(--border);
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    margin-bottom: 0.875rem;
}

    .import-file-label:hover {
        border-color: var(--blue);
        color: var(--blue-bright);
        background: rgba(37,113,200,0.04);
    }

#import-file {
    display: none;
}

.btn-load {
    width: 100%;
    padding: 0.75rem;
    background: var(--blue);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-family: var(--ui);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background .18s;
}

    .btn-load:hover {
        background: #1d5db0;
    }

.import-status {
    display: none;
    padding: 0.625rem 0.875rem;
    border-radius: 5px;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 0.75rem;
}

    .import-status.success {
        background: rgba(45,189,124,0.09);
        border: 1px solid rgba(45,189,124,0.3);
        color: var(--green);
    }

    .import-status.error {
        background: rgba(208,72,72,0.09);
        border: 1px solid rgba(208,72,72,0.3);
        color: #e07878;
    }

    .import-status.warn {
        background: rgba(247,192,96,0.09);
        border: 1px solid rgba(247,192,96,0.3);
        color: #e8bf60;
    }

/* Select all / Deselect all row */
.status-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.status-ctrl-btn {
    font-family: var(--ui);
    font-size: 0.8125rem;
    color: var(--blue);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 5px;
}

    .status-ctrl-btn:hover {
        color: var(--blue-bright);
    }

.status-ctrl-sep {
    font-size: 0.8125rem;
    color: var(--text-muted);
    user-select: none;
}

/* Each checkbox row */
.status-check-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

    /* Dimmed row for schemas with no data */
    .status-check-label.status-empty {
        opacity: 0.45;
        cursor: default;
    }

/* The checkbox itself */
.schema-include {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    accent-color: var(--blue);
    cursor: pointer;
}

    .schema-include:disabled {
        cursor: not-allowed;
    }