:root {
    --lab-bg: #f6faf9;
    --lab-surface: #ffffff;
    --lab-soft: #eef7f6;
    --lab-ink: #0b1724;
    --lab-text: #273849;
    --lab-muted: #647382;
    --lab-border: #d8e7e4;
    --lab-border-strong: #afd5d0;
    --lab-teal: #008a83;
    --lab-teal-dark: #006d67;
    --lab-coral: #f26d5b;
    --lab-blue: #2c72c7;
    --lab-green: #18895e;
    --lab-red: #c53d3d;
    --lab-shadow: 0 18px 55px rgba(20, 54, 60, 0.09);
    --lab-radius: 8px;
    --lab-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.integration-lab {
    min-height: 100vh;
    margin: 0;
    color: var(--lab-text);
    background: linear-gradient(180deg, #ffffff 0%, var(--lab-bg) 42%, #ffffff 100%);
    font-family: var(--lab-font);
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

.lab-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 74px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.93);
    border-bottom: 1px solid var(--lab-border);
    backdrop-filter: blur(16px);
}

.brand-lockup,
.nav-meta {
    display: flex;
    align-items: center;
}

.brand-lockup {
    gap: 15px;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 128px;
    height: auto;
}

.preview-logo {
    display: block;
    width: 74px;
    height: auto;
    flex: 0 0 auto;
}

.brand-divider {
    width: 1px;
    height: 34px;
    background: var(--lab-border-strong);
}

.brand-product {
    color: var(--lab-ink);
    font-size: 21px;
    font-weight: 760;
}

.nav-meta {
    gap: 18px;
    color: var(--lab-muted);
    font-size: 13px;
}

.nav-meta a {
    padding: 10px 14px;
    color: var(--lab-teal-dark);
    border: 1px solid var(--lab-border-strong);
    border-radius: var(--lab-radius);
    text-decoration: none;
    font-weight: 700;
    background: #fff;
}

.hero,
.product-tabs,
.lab-shell {
    width: min(1460px, calc(100% - 48px));
    margin-inline: auto;
}

.hero {
    padding: 34px 0 18px;
}

.hero h1 {
    max-width: 980px;
    margin: 0 0 12px;
    color: var(--lab-ink);
    font-size: clamp(32px, 3vw, 46px);
    line-height: 1.08;
    font-weight: 820;
}

.hero p {
    max-width: 1120px;
    margin: 0;
    color: #465767;
    font-size: 17px;
    line-height: 1.62;
}

.product-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.product-tab {
    min-height: 96px;
    padding: 18px 20px;
    text-align: left;
    color: var(--lab-text);
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: #fff;
    box-shadow: 0 8px 26px rgba(11, 23, 36, 0.04);
}

[dir="rtl"] .product-tab {
    text-align: right;
}

.product-tab strong,
.product-tab span {
    display: block;
}

.product-tab strong {
    color: var(--lab-ink);
    font-size: 18px;
}

.product-tab span {
    margin-top: 8px;
    color: var(--lab-muted);
    font-size: 13px;
    line-height: 1.5;
}

.product-tab:hover,
.product-tab.active {
    border-color: var(--lab-teal);
    background: linear-gradient(180deg, #ffffff, #f4fbfa);
}

.product-tab.active {
    box-shadow: 0 12px 34px rgba(0, 138, 131, 0.13);
}

.lab-shell {
    display: grid;
    grid-template-columns: 230px 300px minmax(420px, 1fr);
    width: 100%;
    max-width: 95%;
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: var(--lab-surface);
    box-shadow: var(--lab-shadow);
    overflow: hidden;
}

.capability-rail,
.configuration-panel,
.workspace {
    min-width: 0;
}

.capability-rail {
    padding: 22px 0;
    border-right: 1px solid var(--lab-border);
    background: #fbfdfd;
}

[dir="rtl"] .capability-rail {
    border-right: 0;
    border-left: 1px solid var(--lab-border);
}

.rail-group h2,
.configuration-panel h2,
.preview-card h2,
.overview-card h2,
.code-card h2 {
    margin: 0;
    color: var(--lab-ink);
}

.rail-group h2 {
    padding: 0 22px;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rail-group p {
    margin: 8px 22px 16px;
    color: var(--lab-muted);
    font-size: 13px;
    line-height: 1.45;
}

.capability-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 86px;
    padding: 14px 18px;
    color: var(--lab-text);
    text-align: left;
    border: 0;
    border-left: 4px solid transparent;
    border-bottom: 1px solid #edf4f3;
    background: transparent;
}

[dir="rtl"] .capability-item {
    grid-template-columns: 1fr 42px;
    text-align: right;
    border-right: 4px solid transparent;
    border-left: 0;
}

.capability-item:hover,
.capability-item.active {
    background: linear-gradient(90deg, rgba(0, 138, 131, 0.1), rgba(0, 138, 131, 0.02));
    border-left-color: var(--lab-teal);
}

[dir="rtl"] .capability-item:hover,
[dir="rtl"] .capability-item.active {
    border-right-color: var(--lab-teal);
}

.capability-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--lab-teal-dark);
    border: 1px solid var(--lab-border-strong);
    border-radius: var(--lab-radius);
    background: #fff;
    font-size: 12px;
    font-weight: 800;
}

.capability-item.active .capability-icon {
    color: #fff;
    border-color: var(--lab-teal);
    background: var(--lab-teal);
    box-shadow: 0 8px 22px rgba(0, 138, 131, 0.24);
}

.capability-item strong,
.capability-item small {
    display: block;
}

.capability-item strong {
    color: var(--lab-ink);
    font-size: 14px;
    line-height: 1.25;
}

.capability-item small {
    margin-top: 5px;
    color: var(--lab-muted);
    font-size: 12px;
    line-height: 1.35;
}

.configuration-panel {
    padding: 24px;
    border-right: 1px solid var(--lab-border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fcfb 100%);
}

[dir="rtl"] .configuration-panel {
    border-right: 0;
    border-left: 1px solid var(--lab-border);
}

.configuration-panel header > span,
#capability-kind {
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    color: var(--lab-teal-dark);
    border: 1px solid var(--lab-border-strong);
    border-radius: 999px;
    background: var(--lab-soft);
    font-size: 12px;
    font-weight: 800;
}

.configuration-panel h2 {
    margin-top: 12px;
    font-size: 24px;
    line-height: 1.15;
}

.configuration-panel p {
    margin: 10px 0 20px;
    color: var(--lab-muted);
    font-size: 14px;
    line-height: 1.5;
}

.config-grid {
    display: grid;
    gap: 14px;
}

.config-grid label {
    display: grid;
    gap: 7px;
}

.config-grid label > span {
    color: var(--lab-ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.config-grid input,
.config-grid select,
.config-grid textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--lab-text);
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: #fff;
    outline: none;
}

.config-grid textarea {
    min-height: 118px;
    resize: vertical;
    line-height: 1.45;
}

.config-grid input:focus,
.config-grid select:focus,
.config-grid textarea:focus {
    border-color: var(--lab-teal);
    box-shadow: 0 0 0 3px rgba(0, 138, 131, 0.13);
}

.config-grid small {
    color: var(--lab-muted);
    text-align: right;
}

[dir="rtl"] .config-grid small {
    text-align: left;
}

.static-config {
    display: grid;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--lab-border);
}

.static-config div {
    min-width: 0;
}

.static-config span {
    display: block;
    margin-bottom: 6px;
    color: var(--lab-muted);
    font-size: 12px;
    font-weight: 700;
}

.static-config code,
.url-preview code {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    color: var(--lab-ink);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

.workspace {
    display: grid;
    grid-template-rows: auto minmax(390px, auto) auto;
    gap: 16px;
    padding: 22px;
    background: var(--lab-bg);
}

.overview-card,
.preview-card,
.code-card {
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: #fff;
    box-shadow: 0 8px 26px rgba(11, 23, 36, 0.04);
}

.overview-card {
    display: grid;
    grid-template-columns: minmax(190px, 0.7fr) minmax(260px, 1.2fr) minmax(220px, 0.8fr);
    gap: 18px;
    padding: 18px;
    align-items: start;
}

.overview-card h2 {
    margin-top: 10px;
    font-size: 22px;
}

.overview-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}

.overview-card dt,
.requirements h3 {
    margin: 0 0 7px;
    color: var(--lab-ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.overview-card dd {
    margin: 0;
    color: var(--lab-muted);
    font-size: 13px;
    line-height: 1.45;
}

.requirements ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 18px;
    color: var(--lab-muted);
    font-size: 13px;
    line-height: 1.4;
}

[dir="rtl"] .requirements ul {
    padding-left: 0;
    padding-right: 18px;
}

.preview-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border-bottom: 1px solid var(--lab-border);
}

.preview-card h2 {
    font-size: 19px;
}

.preview-card p {
    margin: 5px 0 0;
    color: var(--lab-muted);
    font-size: 13px;
    line-height: 1.45;
}

.preview-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.preview-actions button,
.copy-code,
.clear-log {
    min-height: 38px;
    padding: 9px 12px;
    color: var(--lab-teal-dark);
    border: 1px solid var(--lab-border-strong);
    border-radius: var(--lab-radius);
    background: #fff;
    font-size: 13px;
    font-weight: 800;
}

.preview-actions button:first-child {
    color: #fff;
    border-color: var(--lab-teal);
    background: var(--lab-teal);
}

.preview-actions button:hover,
.copy-code:hover,
.clear-log:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(11, 23, 36, 0.08);
}

.preview-surface {
    height: 100%;
    padding: 16px;
    background: #eef6f5;
}

.browser-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0 14px;
    color: var(--lab-muted);
    border: 1px solid var(--lab-border);
    border-bottom: 0;
    border-radius: var(--lab-radius) var(--lab-radius) 0 0;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
}

.preview-stage {
    height: 100%;
    position: relative;
    min-height: 430px;
    border: 1px solid var(--lab-border);
    border-radius: 0 0 var(--lab-radius) var(--lab-radius);
    background: #fff;
    overflow: hidden;
}

.preview-panel {
    display: none;
    height: 100%;
    width: 100%;
    min-height: 430px;
    padding: 18px;
}

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

#hosted-trip-planner-preview {
    padding: 0;
}

.launcher-preview {
    display: none;
    align-content: center;
}

.launcher-preview.active {
    display: grid;
}

.preview-empty {
    margin-bottom: 22px;
}

.preview-empty h3 {
    margin: 0 0 8px;
    color: var(--lab-ink);
    font-size: 20px;
}

.button-widget-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.sdk-preview.active {
    display: grid;
    align-items: stretch;
}

.pipeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-self: start;
}

.pipeline span {
    min-height: 70px;
    display: grid;
    place-items: center;
    padding: 12px;
    color: var(--lab-teal-dark);
    border: 1px solid var(--lab-border-strong);
    border-radius: var(--lab-radius);
    background: var(--lab-soft);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.url-preview {
    align-self: start;
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: #fbfdfd;
}

.url-preview span {
    display: block;
    margin-bottom: 8px;
    color: var(--lab-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.iframe-shell {
    position: relative;
    min-height: 390px;
    border: 1px dashed var(--lab-border-strong);
    border-radius: var(--lab-radius);
    background: #fbfdfd;
    overflow: hidden;
}

#internal-demo-frame {
    display: block;
    height: 100%;
    width: 100%;
    min-height: 420px;
    border: 0;
    background: #fff;
}

#iframe-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    max-width: 360px;
    margin: auto;
    padding: 20px;
    color: var(--lab-muted);
    text-align: center;
}

#internal-demo-frame:not([src]) {
    display: none;
}

#internal-demo-frame[src] + #iframe-placeholder {
    display: none;
}

.openchat-container {
    display: grid;
    min-height: 390px;
    place-items: center;
    padding: 20px;
    color: var(--lab-muted);
    border: 1px dashed var(--lab-border-strong);
    border-radius: var(--lab-radius);
    background: #fbfdfd;
    text-align: center;
}

.openchat-container iframe {
    width: 100%;
    min-height: 420px;
    border: 0;
    border-radius: var(--lab-radius);
    background: #fff;
}

.code-card {
    overflow: hidden;
}

.card-tabs,
.snippet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--lab-border);
    background: #fff;
}

.snippet-tabs {
    padding: 0 0 12px;
    border-bottom: 0;
}

.card-tabs button,
.snippet-tabs button {
    padding: 8px 11px;
    color: var(--lab-muted);
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: #fff;
    font-size: 12px;
    font-weight: 800;
}

.card-tabs button.active,
.snippet-tabs button.active {
    color: #fff;
    border-color: var(--lab-teal);
    background: var(--lab-teal);
}

.artifact-panel {
    display: none;
    padding: 14px;
}

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

.code-block,
.payload-block {
    max-height: 300px;
    margin: 0;
    padding: 16px;
    overflow: auto;
    color: #dce9ec;
    border-radius: var(--lab-radius);
    background: #102128;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.copy-code {
    margin-top: 12px;
}

.event-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.event-header h2 {
    font-size: 16px;
}

.event-header span {
    color: var(--lab-green);
    font-size: 12px;
    font-weight: 800;
}

.event-log {
    display: grid;
    gap: 8px;
    max-height: 240px;
    min-height: 120px;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.event-log li {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 10px;
    padding: 10px;
    color: var(--lab-text);
    border: 1px solid var(--lab-border);
    border-radius: var(--lab-radius);
    background: #fbfdfd;
    font-size: 12px;
}

.event-log time {
    color: var(--lab-muted);
    font-variant-numeric: tabular-nums;
}

.event-log li.error {
    border-color: rgba(197, 61, 61, 0.28);
    background: rgba(197, 61, 61, 0.06);
}

.clear-log {
    margin-top: 12px;
}

.lab-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    width: min(1460px, calc(100% - 48px));
    margin: 22px auto 34px;
    color: var(--lab-muted);
    font-size: 13px;
}

@media (max-width: 1180px) {
    .lab-shell {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .configuration-panel {
        border-right: 0;
        border-bottom: 1px solid var(--lab-border);
    }

    [dir="rtl"] .configuration-panel {
        border-left: 0;
    }

    .workspace {
        grid-column: 1 / -1;
    }

    .overview-card {
        grid-template-columns: 1fr;
    }

    .overview-card dl {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .lab-nav {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 20px;
    }

    .nav-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .hero,
    .product-tabs,
    .lab-shell,
    .lab-footer {
        width: min(100% - 28px, 1460px);
    }

    .product-tabs,
    .lab-shell {
        grid-template-columns: 1fr;
    }

    .capability-rail,
    .configuration-panel {
        border-right: 0;
        border-left: 0;
        border-bottom: 1px solid var(--lab-border);
    }

    .capability-item {
        min-height: 74px;
    }

    .workspace {
        padding: 16px;
    }

    .overview-card dl,
    .pipeline {
        grid-template-columns: 1fr;
    }

    .preview-card-header,
    .lab-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .preview-actions {
        justify-content: flex-start;
    }

    .preview-stage,
    .preview-panel {
        min-height: 360px;
    }
}

@media (max-width: 560px) {
    .brand-logo {
        width: 112px;
    }

    .brand-product {
        font-size: 17px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .product-tab,
    .configuration-panel,
    .workspace,
    .preview-surface,
    .artifact-panel {
        padding: 14px;
    }

    .preview-card-header {
        padding: 14px;
    }

    .event-log li {
        grid-template-columns: 1fr;
    }
}
