@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans/IBMPlexSans-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans/IBMPlexSans-Medium.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/ibm-plex-sans/IBMPlexSans-SemiBold.woff2") format("woff2");
}

:root {
    --page: #f4f6f8;
    --surface: #ffffff;
    --ink: #0f1720;
    --muted: #5c6b7a;
    --label: #3d4b59;
    --line: #e1e6ec;
    --line-strong: #d3dae2;
    --nav: #10181c;
    --nav-text: #d5dee6;
    --nav-muted: #93a2ae;
    --nav-hover: rgba(255, 255, 255, 0.06);
    --teal: #0f6e6a;
    --teal-fill: #0f6e6a;
    --teal-press: #0c5956;
    --teal-wash: #e5f3f2;
    --teal-wash-hover: #d7eeec;
    --teal-ink: #0d3f3c;
    --amber: #8a5a10;
    --amber-wash: #f7f1e4;
    --blue: #1c4f86;
    --blue-wash: #e7f0f8;
    --invalid: #ddc48a;
    --nav-edge: transparent;
    --shadow: 0 1px 2px rgba(15, 23, 32, 0.04), 0 8px 24px rgba(15, 23, 32, 0.05);
    --shadow-pop: 0 16px 40px rgba(15, 23, 32, 0.1);
    color-scheme: light;
    --radius: 12px;
    --radius-control: 10px;
    --radius-nav: 8px;
    --nav-width: 240px;
    --font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --page: #12191f;
    --surface: #1b242c;
    --ink: #e8eef3;
    --muted: #93a2ae;
    --label: #c5d0d8;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --nav: #0c1216;
    --nav-text: #d5dee6;
    --nav-muted: #93a2ae;
    --nav-hover: rgba(255, 255, 255, 0.06);
    --teal: #8fd9d4;
    --teal-fill: #0f6e6a;
    --teal-press: #0c5956;
    --teal-wash: #163632;
    --teal-wash-hover: #1c4540;
    --teal-ink: #d7f3f0;
    --amber: #e2b15a;
    --amber-wash: #3a2c16;
    --blue: #9ec0e6;
    --blue-wash: #1a2d42;
    --invalid: #c9a15a;
    --nav-edge: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 8px 24px rgba(0, 0, 0, 0.32);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        color-scheme: dark;
        --page: #12191f;
        --surface: #1b242c;
        --ink: #e8eef3;
        --muted: #93a2ae;
        --label: #c5d0d8;
        --line: rgba(255, 255, 255, 0.08);
        --line-strong: rgba(255, 255, 255, 0.16);
        --nav: #0c1216;
        --nav-text: #d5dee6;
        --nav-muted: #93a2ae;
        --nav-hover: rgba(255, 255, 255, 0.06);
        --teal: #8fd9d4;
        --teal-fill: #0f6e6a;
        --teal-press: #0c5956;
        --teal-wash: #163632;
        --teal-wash-hover: #1c4540;
        --teal-ink: #d7f3f0;
        --amber: #e2b15a;
        --amber-wash: #3a2c16;
        --blue: #9ec0e6;
        --blue-wash: #1a2d42;
        --invalid: #c9a15a;
        --nav-edge: rgba(255, 255, 255, 0.08);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 8px 24px rgba(0, 0, 0, 0.32);
        --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.45);
    }
}

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

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

body {
    background: var(--page);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

h1,
p {
    margin: 0;
}

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

.icon {
    display: block;
    flex: none;
    height: 18px;
    width: 18px;
}

/* Sign in */

.gate {
    display: grid;
    grid-template-columns: minmax(280px, 5fr) minmax(320px, 7fr);
    min-height: 100vh;
}

.brand {
    background: var(--nav);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 56px;
}

.lockup-mark {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.2em;
    line-height: 1;
}

.lockup-rule {
    background: #3dbeb8;
    border-radius: 1px;
    display: block;
    height: 2px;
    margin-top: 18px;
    width: 28px;
}

.lockup-line {
    color: #b7c3cc;
    font-size: 15px;
    margin-top: 14px;
}

.gate-stage {
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 48px 24px;
    position: relative;
}

.gate-toolbar {
    position: absolute;
    right: 28px;
    top: 24px;
    z-index: 2;
}

.gate-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 32px 28px;
    width: min(100%, 400px);
}

.gate-card h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 22px;
}

.field {
    margin-bottom: 16px;
}

label {
    color: var(--label);
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

input {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    color: var(--ink);
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

select,
textarea {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    color: var(--ink);
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

select:focus-visible,
textarea:focus-visible,
input:focus-visible {
    border-color: var(--teal);
    outline: 2px solid var(--teal);
    outline-offset: 1px;
}

input[type="checkbox"] {
    accent-color: var(--teal);
    height: 16px;
    min-height: 16px;
    width: 16px;
}

input.is-invalid {
    border-color: var(--invalid);
}

.primary {
    background: var(--teal-fill);
    border: 0;
    border-radius: var(--radius-control);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 6px;
    min-height: 42px;
    padding: 10px 14px;
    width: 100%;
}

.primary:hover {
    background: var(--teal-press);
}

.primary:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.error {
    background: var(--amber-wash);
    border-radius: 8px;
    color: var(--amber);
    font-size: 13px;
    line-height: 1.4;
    margin-top: 8px;
    padding: 8px 10px;
}

/* Console shell */

.console {
    display: grid;
    grid-template-columns: var(--nav-width) minmax(0, 1fr);
    min-height: 100vh;
}

.nav {
    background: var(--nav);
    border-right: 1px solid var(--nav-edge);
    color: var(--nav-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.nav-mark {
    padding: 22px 20px 14px;
}

.nav-mark .lockup-mark {
    font-size: 15px;
    letter-spacing: 0.16em;
}

.nav-mark .lockup-line {
    color: var(--nav-muted);
    font-size: 12px;
    margin-top: 5px;
}

.nav nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow: auto;
    padding: 4px 10px 12px;
}

.nav nav a {
    align-items: center;
    border-radius: var(--radius-nav);
    color: var(--nav-text);
    display: flex;
    font-size: 14px;
    font-weight: 500;
    gap: 10px;
    line-height: 1.2;
    padding: 8px 10px;
    text-decoration: none;
}

.nav nav a:hover {
    background: var(--nav-hover);
    color: #fff;
}

.nav nav a.active {
    background: var(--teal-wash);
    color: var(--teal-ink);
}

.nav nav a.active:hover {
    background: var(--teal-wash-hover);
    color: var(--teal-ink);
}

.nav nav a:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.topbar {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    min-height: 64px;
    padding: 12px 28px;
    position: sticky;
    top: 0;
    z-index: 4;
}

.topbar-tools {
    align-items: center;
    display: flex;
    gap: 12px;
    min-width: 0;
}

.menu {
    position: relative;
}

.menu-trigger {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    font-size: 13px;
    font-weight: 600;
    gap: 6px;
    letter-spacing: 0.04em;
    list-style: none;
    min-height: 40px;
    padding: 4px 10px 4px 4px;
}

.menu-trigger::-webkit-details-marker,
.menu-trigger::marker {
    content: "";
    display: none;
}

.menu-trigger:hover,
.menu[open] .menu-trigger {
    background: var(--page);
}

.menu-trigger:focus-visible,
.sign-out:focus-visible,
.langs a:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.chevron {
    display: block;
    flex: none;
    height: 16px;
    width: 16px;
}

.menu[open] .chevron {
    transform: rotate(180deg);
}

.gate-toolbar .menu-trigger {
    gap: 8px;
    padding: 4px 10px 4px 12px;
}

.menu-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow), var(--shadow-pop);
    min-width: 232px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 8;
}

.menu-email {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
    padding: 8px 10px 10px;
}

.menu-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1;
    padding: 4px 10px 6px;
    text-transform: uppercase;
}

.operator-initial {
    align-items: center;
    background: var(--teal-fill);
    border-radius: 999px;
    color: #fff;
    display: flex;
    flex: none;
    font-size: 13px;
    font-weight: 600;
    height: 32px;
    justify-content: center;
    letter-spacing: 0;
    width: 32px;
}

.menu-panel form {
    border-top: 1px solid var(--line);
    margin: 6px 0 0;
    padding-top: 6px;
}

.sign-out {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
    min-height: 36px;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.sign-out:hover {
    background: var(--teal-wash);
    color: var(--teal-ink);
}

.langs {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.langs a {
    align-items: center;
    border-radius: 8px;
    color: var(--ink);
    display: flex;
    font-size: 14px;
    font-weight: 500;
    gap: 12px;
    justify-content: space-between;
    line-height: 1.2;
    padding: 8px 10px;
    text-decoration: none;
}

.langs a:hover {
    background: var(--page);
}

.langs a.is-current {
    background: var(--teal-wash);
    color: var(--teal-ink);
}

.lang-code {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.langs a.is-current .lang-code {
    color: var(--teal);
}

.themes {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.themes button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
    min-height: 36px;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.themes button:hover {
    background: var(--page);
}

.themes button.is-current {
    background: var(--teal-wash);
    color: var(--teal-ink);
}

.themes button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.work {
    min-width: 0;
    padding: 32px 36px 48px;
}

.page-head {
    margin-bottom: 18px;
}

.page-head h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.page-sub {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.panel {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    min-height: 360px;
    padding: 48px 24px;
}

.empty {
    align-items: center;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.empty-icon {
    align-items: center;
    background: var(--teal-wash);
    border-radius: var(--radius-control);
    color: var(--teal);
    display: flex;
    height: 40px;
    justify-content: center;
    margin-bottom: 12px;
    width: 40px;
}

.empty-icon svg {
    display: block;
    height: 20px;
    width: 20px;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
}

.empty-note {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.sheet {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    padding: 18px 20px 20px;
}

.sheet h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 18px 0 12px;
}

.sheet h2:first-child,
.split h2 {
    margin-top: 0;
}

.metrics {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}

.metrics dt,
.urls dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metrics dd {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 6px 0 0;
}

.pill,
.verb,
.badge {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 6px 8px;
    text-transform: uppercase;
}

.pill,
.verb {
    background: var(--teal-wash);
    color: var(--teal-ink);
}

.badge {
    background: var(--blue-wash);
    color: var(--blue);
    letter-spacing: 0;
    text-transform: none;
}

.badge.off {
    background: var(--amber-wash);
    color: var(--amber);
}

.urls {
    align-items: center;
    display: grid;
    gap: 12px 16px;
    grid-template-columns: 160px minmax(0, 1fr);
    margin: 0;
}

.urls dd {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0;
    min-width: 0;
}

.url,
code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 13px;
}

.url {
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 8px 10px;
}

.hint {
    color: var(--muted);
    font-size: 13px;
    margin: 8px 0 0;
}

.form-grid {
    display: grid;
    gap: 12px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide,
.form-grid .check {
    grid-column: 1 / -1;
}

.sheet .field {
    margin-bottom: 0;
}

.sheet .primary,
.actions .primary,
.secondary {
    width: auto;
}

.secondary,
.icon-button,
button.text {
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    color: var(--ink);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    text-decoration: none;
}

.secondary:hover,
.icon-button:hover,
button.text:hover {
    background: var(--page);
}

.icon-button {
    align-self: end;
    height: 42px;
    padding: 0 12px;
}

button.text {
    border: 0;
    font-size: 13px;
    font-weight: 500;
    min-height: 0;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

.check {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0;
}

.check span {
    margin: 0;
}

.status {
    background: var(--teal-wash);
    border-radius: var(--radius-control);
    color: var(--teal-ink);
    font-size: 14px;
    margin: 0 0 14px;
    padding: 10px 12px;
}

.form-errors {
    background: var(--amber-wash);
    border-radius: 8px;
    color: var(--amber);
    font-size: 13px;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.form-errors p {
    margin: 0;
}

.form-errors p + p {
    margin-top: 4px;
}

.table-wrap {
    overflow-x: auto;
}

table.data {
    border-collapse: collapse;
    width: 100%;
}

table.data th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-align: left;
    text-transform: uppercase;
}

table.data th,
table.data td {
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    vertical-align: middle;
    white-space: nowrap;
}

table.data tr:last-child td {
    border-bottom: 0;
}

.row-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    white-space: nowrap;
}

.row-actions a,
.row-actions form {
    margin: 0;
}

.row-actions a {
    color: var(--teal);
    font-size: 13px;
    font-weight: 600;
}

.split,
.head-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.head-row {
    margin-bottom: 14px;
}

.head-row .hint {
    margin: 0;
}

.repeat-row {
    align-items: end;
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.repeat-row.parameter {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) auto auto;
}

.repeat-row.response {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1.1fr) auto;
}

.repeat-row label span {
    color: var(--label);
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
}

.preview {
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0 0;
    min-height: 96px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

@media (max-width: 760px) {
    .gate {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .brand {
        align-items: flex-start;
        padding: 24px 20px 22px;
    }

    .lockup-mark {
        font-size: 16px;
    }

    .lockup-rule {
        margin-top: 14px;
    }

    .lockup-line {
        font-size: 14px;
        margin-top: 10px;
    }

    .gate-stage {
        align-items: stretch;
        flex-direction: column;
        justify-content: flex-start;
        padding: 16px 16px 32px;
    }

    .gate-toolbar {
        align-items: center;
        display: flex;
        justify-content: flex-end;
        margin-bottom: 16px;
        position: relative;
        width: 100%;
        z-index: 2;
    }

    .gate-card {
        align-self: center;
        padding: 24px 20px 20px;
    }

    input,
    .primary {
        font-size: 16px;
        min-height: 44px;
    }

    .console {
        display: block;
    }

    .nav {
        display: grid;
        gap: 10px 12px;
        grid-template-areas:
            "brand"
            "menu";
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        max-width: 100%;
        padding: 12px 0 10px;
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .shell {
        min-height: 0;
    }

    .topbar {
        padding: 10px 12px;
        position: relative;
        z-index: 4;
    }

    .nav-mark {
        min-width: 0;
        padding: 0 0 0 12px;
    }

    .nav-mark .lockup-line {
        display: none;
    }

    .nav nav {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        grid-area: menu;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding: 0 12px 2px;
    }

    .nav nav a {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 999px;
        flex: 0 0 auto;
        padding: 7px 12px;
        white-space: nowrap;
    }

    .nav nav a.active {
        background: var(--teal-wash);
    }

    .work {
        padding: 18px 16px 32px;
    }

    .page-head {
        margin-bottom: 14px;
    }

    .page-head h1 {
        font-size: 18px;
    }

    .page-sub {
        font-size: 13px;
    }

    .panel {
        min-height: 280px;
        padding: 36px 16px;
    }

    .metrics,
    .form-grid,
    .urls,
    .repeat-row.parameter,
    .repeat-row.response {
        grid-template-columns: 1fr;
    }

    .urls dt {
        padding-top: 0;
    }

    .split,
    .head-row {
        align-items: stretch;
        flex-direction: column;
    }
}
