:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-muted: #f7f7f7;
    --ink: #111111;
    --ink-soft: #4a4a4a;
    --line: #e8e8e8;
    --line-strong: #d9d9d9;
    --accent-green: #8de58f;
}

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

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Space Grotesk", system-ui, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

.site-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.site-nav-inner {
    width: min(1200px, calc(100% - 2rem));
    margin-inline: auto;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0;
}

.site-brand {
    color: #111111;
    text-decoration: none;
    font-family: "Syne", "Space Grotesk", system-ui, sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-weight: 600;
}

.site-links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.site-links a {
    color: #333333;
    text-decoration: none;
    font-size: 0.77rem;
    border: 1px solid transparent;
    border-radius: 0.35rem;
    padding: 0.38rem 0.62rem;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.site-links a:hover {
    background: #f2f2f2;
    border-color: #e3e3e3;
    color: #111111;
}

.site-links a.site-link-open-network {
    background: var(--accent-green);
    color: #ffffff;
    border-color: rgba(17, 17, 17, 0.2);
    font-weight: 600;
}

.site-links a.site-link-open-network:hover {
    background: color-mix(in srgb, var(--accent-green) 88%, #ffffff 12%);
    color: #ffffff;
}

.site-nav-toggle {
    display: none;
    margin-left: auto;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.35rem;
    background: #ffffff;
    color: #222222;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.site-nav-toggle-open,
.site-nav-toggle-close {
    display: inline-block;
}

.site-nav-toggle-close {
    display: none;
}

.site-nav.is-open .site-nav-toggle-open {
    display: none;
}

.site-nav.is-open .site-nav-toggle-close {
    display: inline-block;
}

.api-shell {
    width: min(1200px, calc(100% - 1.4rem));
    min-height: calc(100vh - 3.7rem);
    height: auto;
    margin: 0.8rem auto 1rem;
}

.api-panel {
    min-height: calc(100vh - 5.1rem);
    height: auto;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--surface);
    display: grid;
    grid-template-rows: auto auto 1fr;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(17, 17, 17, 0.05);
}

.api-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 1rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.api-title-wrap {
    min-width: 0;
}

h1,
h2,
h3 {
    font-family: "Syne", "Space Grotesk", system-ui, sans-serif;
    color: #111111;
    letter-spacing: 0.01em;
}

h1 {
    margin: 0;
    font-size: clamp(1.35rem, 2.8vw, 1.9rem);
}

h2 {
    margin: 0 0 0.8rem;
    font-size: 1.08rem;
}

h3 {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
}

.api-title-wrap h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
}

.api-title-wrap h2 {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2f2f2f;
}

.version-info {
    color: #666666;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
  padding: 0.62rem 0.72rem;
  border: 1px solid var(--line);
  border-left: 3px solid #111111;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.group-head h2 {
  margin: 0;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.group-head p {
  margin: 0;
  color: #666666;
  font-size: 0.76rem;
  line-height: 1.35;
}

.explore-sections {
    display: grid;
    gap: 1rem;
}

.explore-section {
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 0.72rem;
    background: #ffffff;
}

.login-compact {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    width: min(360px, 100%);
}

.compact-login-btn {
    white-space: nowrap;
    margin: 0;
}

.login-compact-status {
    flex: 1;
    min-width: 0;
}

.login-compact-status span {
    display: block;
    font-size: 0.74rem;
    color: #666666;
    margin-bottom: 0.35rem;
}

.compact-status-body {
    margin: 0;
    min-height: 2.1rem;
    max-height: 2.1rem;
    display: flex;
    align-items: center;
    padding: 0.32rem 0.55rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-tabs {
    display: flex;
    gap: 0.45rem;
    padding: 0.62rem 1rem;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.group-tab {
    margin: 0;
    border: 1px solid var(--line-strong);
    background: #ffffff;
    color: #333333;
    border-radius: 999px;
    padding: 0.42rem 0.78rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.group-tab:hover {
    background: #f7f7f7;
    border-color: #cfcfcf;
}

.group-tab.is-active {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

.tab-panels {
    min-height: 0;
    overflow: auto;
}

.tab-panel {
    display: none;
    height: auto;
    padding: 0.8rem 1rem 1rem;
}

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

.tab-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.9rem;
    height: auto;
    min-height: 0;
    align-items: start;
}

.tab-column {
    min-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 0.8rem;
    background: #fcfcfc;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tab-hint {
    margin: 0.2rem 0 0;
    color: #666666;
    font-size: 0.83rem;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
}

.form-row .action-button {
    margin-bottom: 0;
}

.form-field {
    flex: 1;
    min-width: 0;
}

.single-action-row {
    align-items: center;
}

.helper-info {
    color: #666666;
    font-size: 0.8rem;
    min-width: 0;
    line-height: 1.35;
}

.helper-text {
    color: #666666;
    font-size: 0.79rem;
    margin: -0.1rem 0 0.5rem;
    line-height: 1.35;
}

label {
    display: block;
    width: 100%;
    margin: 0 0 0.36rem;
    font-size: 0.78rem;
    color: #555555;
}

input,
select,
textarea {
    display: block;
    width: 100%;
    margin: 0 0 0.74rem;
    border: 1px solid var(--line-strong);
    border-radius: 0.45rem;
    background: #ffffff;
    color: #111111;
    padding: 0.5rem 0.58rem;
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-size: 0.88rem;
}

textarea {
    min-height: 120px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #111111;
}

input:disabled,
select:disabled,
textarea:disabled,
button.is-disabled-control {
    background: #f2f2f2;
    color: #8b8b8b;
    border-color: #dadada;
    cursor: not-allowed;
}

input:disabled::placeholder,
textarea:disabled::placeholder {
    color: #9a9a9a;
}

button.is-disabled-control {
    box-shadow: inset 0 0 0 1px #d3d3d3;
}

button {
    border: 1px solid #111111;
    border-radius: 0.45rem;
    background: #111111;
    color: #ffffff;
    padding: 0.5rem 0.8rem;
    font-weight: 600;
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 160ms ease, transform 120ms ease, border-color 160ms ease;
}

button:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.disabled-field-tooltip {
    position: fixed;
    z-index: 12000;
    max-width: min(320px, calc(100vw - 24px));
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
    background: #1b1b1b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.5rem;
    padding: 0.44rem 0.56rem;
    font-size: 0.76rem;
    line-height: 1.35;
}

.disabled-field-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.button-row {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin: 0.2rem 0 0.6rem;
}

.button-row button {
    margin: 0;
    flex: 1;
    min-width: 140px;
}

#btn_clearConnectorDimensions {
    border-color: #b42318;
    background: #d92d20;
}

#btn_clearConnectorDimensions:hover {
    border-color: #b42318;
    background: #b42318;
}

#btn_clearConnectorDimensions:active {
    border-color: #912018;
    background: #912018;
}

.response-row {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
    align-items: stretch;
}

.response-code {
    background: #141414;
    color: #ffffff;
    padding: 0.42rem 0.5rem;
    border-radius: 0.45rem;
    text-align: center;
    min-width: 66px;
    max-height: fit-content;
    font-size: 0.74rem;
    font-weight: 600;
}

.response-body,
.request-body {
    background: var(--surface-muted);
    color: #111111;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.58rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.79rem;
    line-height: 1.42;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    max-height: 220px;
    overflow: auto;
}

.response-row .response-body,
.response-row .response-wrapper,
.request-row .response-wrapper {
    flex: 1;
    min-width: 0;
}

.request-row .request-body {
    min-height: 130px;
}

.response-row .response-body {
    min-height: 120px;
}

.response-wrapper .response-body,
.response-wrapper .request-body {
    padding-right: 2rem;
}

pre.response-body,
pre.request-body {
    margin: 0;
}

.request-row {
    display: flex;
    gap: 0.7rem;
    margin: 0.3rem 0 0.8rem;
}

.tab-column-request-response {
    min-height: 0;
}

.tab-column-request-response .request-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.tab-column-request-response .request-row {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0.3rem 0 0;
}

.tab-column-request-response .request-row .response-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tab-column-request-response .request-row .request-body {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: none;
}

.tab-column-request-response .response-pane {
    flex: 0 0 auto;
    margin-top: 0.7rem;
}

.tab-column-request-response .response-pane .response-row {
    margin-bottom: 0;
}

.tab-panel[data-tab-panel="transformations"] .tab-grid,
.tab-panel[data-tab-panel="conditions"] .tab-grid {
    align-items: stretch;
}

.tab-column-code-editor {
    align-self: stretch;
    min-height: 0;
    overflow: hidden;
}

.tab-column-code-editor textarea {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
}

#POST_transformationCode,
#POST_conditionCode {
    resize: none;
}

.response-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffffff;
    border: 1px solid var(--line-strong);
    color: #444444;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0.16rem 0.3rem;
    z-index: 10;
}

.copy-button:hover {
    background: #f1f1f1;
    color: #111111;
}

#treeContainer {
    display: none;
    width: 100%;
    height: clamp(250px, 72vh, 768px);
    overflow: visible;
    position: relative;
    z-index: 0;
    background: #f6f6f6 !important;
    border: 1px solid var(--line) !important;
    border-radius: 0.5rem;
}

#executeRunningInstances {
    min-height: 160px;
}

#executeBody {
    min-height: 140px;
}

#POST_transformationRequestBody,
#POST_conditionRequestBody {
    min-height: 220px;
    max-height: none;
}

#POST_connectorRequestBody,
#connectorResponseBody {
    min-height: 180px;
    max-height: min(34vh, 340px);
    overflow: auto;
}

.inline-code-fragment {
    max-height: none;
    min-height: 32px;
    overflow: visible;
    padding: 0.45rem 0.58rem;
    white-space: pre-wrap;
}

#connectorDimensionsContainer {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.tab-panel[data-tab-panel="connectors"] .tab-column-request-response {
    display: grid;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 0.7rem;
}

.tab-panel[data-tab-panel="connectors"] .tab-column-request-response .request-pane,
.tab-panel[data-tab-panel="connectors"] .tab-column-request-response .response-pane {
    min-width: 0;
}

.tab-panel[data-tab-panel="connectors"] .tab-column-request-response .request-pane {
    flex: 0 0 auto;
}

.tab-panel[data-tab-panel="connectors"] .tab-column-request-response .response-pane {
    flex: 0 0 auto;
    margin-top: 0;
}

.tab-panel[data-tab-panel="connectors"] .tab-column-request-response .request-row,
.tab-panel[data-tab-panel="connectors"] .tab-column-request-response .response-row {
    margin: 0.3rem 0 0;
}

.muted-note {
    color: #888888;
    font-size: 0.8rem;
}

.dimension-fieldset {
    border: 1px solid var(--line-strong);
    border-radius: 0.55rem;
    padding: 0.68rem;
    margin-bottom: 0.55rem;
    background: #ffffff;
}

.dimension-fieldset legend {
    color: #555555;
    font-size: 0.78rem;
}

.connector-dimension-remove {
    display: inline-flex;
    margin: 0;
    flex: 0 0 auto;
    white-space: nowrap;
    border-color: #b42318;
    background: #d92d20;
}

.connector-dimension-remove:hover {
    border-color: #b42318;
    background: #b42318;
}

.connector-dimension-remove:active {
    border-color: #912018;
    background: #912018;
}

.connector-dimension-composite-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
    margin-bottom: 0.58rem;
}

.connector-dimension-composite-row .connector-dimension-composite {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}

.connector-dimension-composite-row .connector-dimension-remove {
    margin-bottom: 0;
}

.connector-binding-add {
    margin: 0 0 0.62rem;
    white-space: nowrap;
    align-self: flex-start;
}

.connector-transformation {
    margin-bottom: 0.9rem;
}

.connector-bindings {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
}

.connector-transformations {
    margin: 0.35rem 0 0.72rem;
    padding-top: 0.62rem;
    border-top: 1px solid var(--line-strong);
}

.connector-binding {
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    padding: 0.5rem;
    background: #fcfcfc;
}

.transformation-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
}

.binding-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
}

.transformation-col {
    flex: 1;
    min-width: 0;
}

.binding-col {
    flex: 1;
    min-width: 0;
}

.connector-binding-remove,
.connector-transformation-remove {
    flex: 0 0 auto;
    border-color: #b42318;
    background: #d92d20;
}

.connector-binding-remove {
    margin: 0 0 0.72rem;
}

.connector-transformation-remove {
    margin: 0 0 0.74rem;
    align-self: flex-end;
}

.connector-binding-remove:hover,
.connector-transformation-remove:hover {
    border-color: #b42318;
    background: #b42318;
}

.connector-binding-remove:active,
.connector-transformation-remove:active {
    border-color: #912018;
    background: #912018;
}

.connector-binding-status {
    margin: 0 0 0.58rem;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 0.8rem;
}

.account-grid .response-body {
    min-height: 120px;
    max-height: 220px;
}

.account-item {
    padding: 0.42rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 0.4rem;
    margin-bottom: 0.32rem;
    background: #ffffff;
}

.page-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
}

#accountPageLabel,
#formatPageLabel {
    font-weight: 600;
    color: #555555;
    font-size: 0.84rem;
}

.popup-instance-editor,
.popup-instance-editor * {
    box-sizing: border-box;
}

.popup-instance-editor {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, calc(100% - 1.6rem));
    background: #ffffff;
    color: #111111;
    border: 1px solid var(--line-strong);
    border-radius: 0.65rem;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    z-index: 9999;
}

.vis-tooltip {
    position: absolute !important;
    z-index: 9999 !important;
    background: #1f1f1f;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    max-width: 300px;
}

@media (max-width: 1100px) {
    .api-shell {
        height: auto;
        min-height: calc(100vh - 3.7rem);
    }

    .api-panel {
        height: auto;
    }

    .tab-panel {
        height: auto;
    }

    .tab-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .tab-column {
        max-height: none;
        overflow: visible;
    }

    .api-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .login-compact {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .site-nav-inner {
        align-items: center;
        flex-wrap: wrap;
    }

    .site-brand {
        max-width: calc(100% - 2.8rem);
        font-size: 0.78rem;
    }

    .site-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
        padding-top: 0.25rem;
    }

    .site-nav.is-open .site-links {
        display: flex;
    }

    .site-links a {
        width: 100%;
        text-align: left;
        background: #ffffff;
        border: 1px solid var(--line);
    }

    .site-links a.site-link-open-network {
        color: #ffffff;
        border-color: rgba(17, 17, 17, 0.22);
    }
}

@media (min-width: 1101px) {
    .tab-column {
        max-height: calc(100vh - 16.2rem);
    }

    .tab-panel[data-tab-panel="transformations"] .tab-column-code-editor,
    .tab-panel[data-tab-panel="transformations"] .tab-column-request-response,
    .tab-panel[data-tab-panel="conditions"] .tab-column-code-editor,
    .tab-panel[data-tab-panel="conditions"] .tab-column-request-response {
        height: calc(100vh - 16.2rem);
    }
}

@media (max-width: 720px) {
    .api-shell {
        width: calc(100% - 1rem);
        margin: 0.45rem auto;
    }

    h1 {
        font-size: clamp(1.2rem, 7vw, 1.55rem);
        line-height: 1.15;
    }

    h2 {
        font-size: 1rem;
    }

    .form-row,
    .response-row,
    .request-row,
    .transformation-row,
    .binding-row,
    .page-controls,
    .login-compact {
        flex-direction: column;
        align-items: stretch;
    }

    .account-grid {
        grid-template-columns: 1fr;
    }

    .compact-status-body {
        max-height: none;
        white-space: normal;
    }

    .group-head {
      flex-direction: column;
      align-items: flex-start;
      gap: 0.25rem;
    }

    .group-tab {
        font-size: 0.76rem;
        padding: 0.4rem 0.7rem;
    }
}
