:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #647084;
    --line: #d9e0ea;
    --brand: #176b87;
    --brand-dark: #0d4d63;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 Arial, Helvetica, sans-serif;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.button-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

.button-link:hover {
    background: var(--brand-dark);
    color: #fff;
    text-decoration: none;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 22px;
    background: #102a43;
    color: #fff;
}

.brand {
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #dbeafe;
    line-height: 1.2;
}

.topbar nav a img {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.page {
    width: min(1180px, calc(100% - 32px));
    min-width: 0;
    margin: 24px auto 56px;
}

h1 {
    margin: 0 0 18px;
    font-size: 28px;
}

h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.panel,
table {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.panel {
    padding: 18px;
    margin-bottom: 18px;
    min-width: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
    background: #eef3f8;
}

tr:last-child td {
    border-bottom: 0;
}

input,
textarea,
select,
button {
    width: 100%;
    min-width: 0;
    border-radius: 6px;
    border: 1px solid var(--line);
    padding: 10px 11px;
    font: inherit;
}

textarea {
    resize: vertical;
}

button {
    width: auto;
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    background: var(--brand-dark);
}

button.secondary {
    border-color: #9aa4b2;
    background: #e5e9ef;
    color: var(--text);
}

label {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 700;
}

.auth-form {
    max-width: 420px;
}

.notice,
.error {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.notice {
    background: #e7f8ef;
    color: #14532d;
}

.error {
    background: #fef3f2;
    color: var(--danger);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stats div {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stats strong {
    display: block;
    font-size: 30px;
}

.stats span {
    color: var(--muted);
}

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

.health-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.health-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 20px;
}

.health-item span {
    color: var(--muted);
}

.health-item.is-ok {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.health-item.is-ok strong {
    color: #166534;
}

.health-item.is-bad {
    border-color: #fecaca;
    background: #fef2f2;
}

.health-item.is-bad strong {
    color: var(--danger);
}

.toolbar,
.actions,
.row-form,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.toolbar {
    margin-bottom: 14px;
}

.toolbar a {
    padding: 7px 10px;
    background: #e8eef5;
    border-radius: 6px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.message {
    border-left: 4px solid var(--line);
    padding: 10px 12px;
    background: #f8fafc;
    margin-bottom: 10px;
}

.message div {
    color: var(--muted);
    font-size: 13px;
}

.message.client {
    border-left-color: #f59e0b;
}

.message.specialist,
.message.admin {
    border-left-color: var(--brand);
}

.small {
    width: 76px;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    min-width: 0;
    overflow: visible;
}

.settings-form button {
    align-self: end;
}

.setting-field {
    margin-bottom: 0;
    min-width: 0;
}

.setting-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
}

.help-wrap {
    position: relative;
    display: inline-flex;
}

.help-dot {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #93a4b8;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    cursor: help;
    line-height: 1;
    user-select: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.help-dot:hover,
.help-dot:focus {
    border-color: var(--brand);
    background: #e8f4f8;
    color: var(--brand-dark);
}

.help-tooltip {
    position: absolute;
    z-index: 10;
    left: 0;
    bottom: calc(100% + 10px);
    width: 300px;
    max-width: calc(100vw - 64px);
    padding: 10px 12px;
    border-radius: 8px;
    background: #102a43;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
    transform: translateY(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}

.help-tooltip::after {
    content: "";
    position: absolute;
    left: 12px;
    top: 100%;
    border: 6px solid transparent;
    border-top-color: #102a43;
}

.help-wrap:hover .help-tooltip,
.help-dot:focus + .help-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.settings-form .setting-field:nth-child(even) .help-tooltip {
    right: 0;
    left: auto;
}

.settings-form .setting-field:nth-child(even) .help-tooltip::after {
    right: 12px;
    left: auto;
}

.field-help {
    color: var(--muted);
    font-weight: 400;
}

.copy-row {
    margin-top: 12px;
    min-width: 0;
}

.copy-row label {
    margin-bottom: 0;
    min-width: 0;
}

input[readonly] {
    background: #f8fafc;
    color: #334155;
    text-overflow: ellipsis;
}

.checkbox-input {
    width: auto;
}

.debug-box {
    max-width: 100%;
    overflow-x: auto;
    padding: 12px;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font: 13px/1.45 Consolas, monospace;
}

.switch-control {
    display: inline-grid;
    grid-template-columns: auto 54px auto;
    align-items: center;
    gap: 9px;
    justify-content: start;
    justify-self: start;
    width: max-content;
    min-height: 39px;
    color: var(--muted);
    font-weight: 700;
}

.switch-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    position: relative;
    width: 54px;
    height: 30px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background .16s ease;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
    transition: transform .16s ease;
}

.switch-control input:checked + .switch-track {
    background: var(--brand);
}

.switch-control input:checked + .switch-track::after {
    transform: translateX(24px);
}

.switch-control input:focus + .switch-track {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.flow-builder {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
    min-width: 0;
}

.flow-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    overflow: visible;
}

.flow-card.is-dragging {
    opacity: .55;
}

.flow-drag {
    display: grid;
    place-items: start center;
    padding-top: 22px;
    background: #eef3f8;
    color: var(--muted);
    font-size: 22px;
    cursor: grab;
    user-select: none;
}

.flow-card-body {
    padding: 16px;
    min-width: 0;
}

.flow-card-head,
.flow-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.flow-card-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.flow-add-form {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.flow-add-form label {
    margin-bottom: 0;
}

.flow-buttons {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.flow-buttons-head,
.flow-button-row-head,
.flow-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.flow-buttons-head {
    margin-bottom: 10px;
}

.flow-button-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.flow-button-row + .flow-button-row {
    margin-top: 10px;
}

.flow-button-row-head {
    margin-bottom: 10px;
    color: var(--muted);
    font-weight: 700;
}

.flow-button-editor {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) minmax(120px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
    gap: 8px;
    align-items: end;
    padding: 10px 0;
    border-top: 1px solid #edf1f6;
}

.flow-button-editor:first-child {
    border-top: 0;
    padding-top: 0;
}

.flow-button-editor label {
    margin-bottom: 0;
}

.flow-card-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

.flow-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    margin-bottom: 0;
}

.flow-toggle input {
    width: auto;
}

.scenario-list-head,
.scenario-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.scenario-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    justify-content: flex-end;
}

.scenario-active-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}

tr.is-active-scenario td {
    background: #f0fdf4;
}

.scenario-list-head h2 {
    margin-bottom: 4px;
}

.secondary-link {
    border: 1px solid #9aa4b2;
    background: #e5e9ef;
    color: var(--text);
}

.secondary-link:hover {
    background: #d8dee8;
    color: var(--text);
}

.scenario-editor {
    display: grid;
    gap: 12px;
}

.scenario-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.scenario-title {
    display: grid;
    grid-template-columns: auto 18px;
    gap: 2px 8px;
    align-items: center;
    margin-right: auto;
}

.scenario-title span,
.scenario-status {
    color: var(--muted);
    font-size: 13px;
}

.scenario-title span {
    grid-column: 1 / -1;
}

.scenario-save-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    opacity: .85;
}

.scenario-save-icon[hidden] {
    display: none;
}

.scenario-save-icon.is-saving {
    animation: scenario-save-pulse .8s ease-in-out infinite alternate;
}

@keyframes scenario-save-pulse {
    from {
        opacity: .45;
        transform: scale(.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scenario-status.is-error {
    color: var(--danger);
    font-weight: 700;
}

.scenario-shell {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) 310px;
    min-height: 680px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.scenario-palette,
.scenario-inspector {
    min-width: 0;
    padding: 14px;
    background: #f8fafc;
    overflow: auto;
}

.scenario-palette {
    border-right: 1px solid var(--line);
}

.scenario-inspector {
    border-left: 1px solid var(--line);
}

.scenario-block-add {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    border-color: #cbd5e1;
    background: #fff;
    color: var(--text);
    text-align: left;
}

.scenario-block-add:hover {
    background: #edf6f9;
    color: var(--text);
}

.scenario-canvas-wrap {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
}

.scenario-canvas-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.scenario-canvas {
    position: relative;
    min-width: 0;
    min-height: 620px;
    overflow: auto;
    background-color: #f8fbff;
    background-image:
        linear-gradient(#e3e9f2 1px, transparent 1px),
        linear-gradient(90deg, #e3e9f2 1px, transparent 1px);
    background-size: 28px 28px;
}

.scenario-world {
    position: relative;
    width: 2400px;
    height: 1600px;
    transform-origin: 0 0;
}

.scenario-edges,
.scenario-nodes {
    position: absolute;
    inset: 0;
}

.scenario-edges {
    width: 2400px;
    height: 1600px;
    overflow: visible;
    pointer-events: auto;
}

.scenario-edge {
    fill: none;
    stroke: #647084;
    stroke-width: 2.5;
    cursor: pointer;
}

.scenario-edge:hover,
.scenario-edge.is-selected {
    stroke: var(--brand);
    stroke-width: 4;
}

.scenario-edge-label {
    fill: #334155;
    font: 13px Arial, Helvetica, sans-serif;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 4px;
    cursor: pointer;
}

.scenario-node {
    position: absolute;
    display: grid;
    gap: 4px;
    width: 220px;
    min-height: 108px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-top: 5px solid var(--brand);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .08);
    cursor: grab;
    user-select: none;
}

.scenario-node.is-selected {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.scenario-node.has-error {
    outline: 3px solid #fecaca;
}

.scenario-node.has-warning {
    outline: 3px solid #fde68a;
}

.scenario-node-type {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.scenario-node strong {
    font-size: 16px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.scenario-node small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.scenario-node-ports {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.scenario-port {
    width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
    border-radius: 50%;
    border-color: #94a3b8;
    background: #fff;
}

.scenario-inspector label {
    margin-bottom: 12px;
}

.scenario-button-row {
    display: grid;
    gap: 8px;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.scenario-test-modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .42);
}

.scenario-test-modal[hidden] {
    display: none;
}

.scenario-test-dialog {
    width: min(680px, 100%);
    padding: 16px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
}

.scenario-test-log {
    height: 360px;
    margin-bottom: 12px;
    padding: 12px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.scenario-test-log div {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
}

.scenario-test-log .is-user {
    background: #e0f2fe;
}

.scenario-test-log .is-button {
    background: #fef3c7;
}

.scenario-canvas-wrap {
    position: relative;
}

.scenario-canvas-tools {
    position: absolute;
    z-index: 12;
    right: 16px;
    top: 16px;
    width: 54px;
    display: grid;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
}

.scenario-canvas-tools button {
    width: 54px;
    min-height: 42px;
    padding: 8px;
    border-color: #e2e8f0;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
    font-size: 13px;
    white-space: normal;
}

.scenario-canvas {
    min-height: 760px;
    background-color: #f3f6fb;
    background-image:
        radial-gradient(circle, #d9e1ec 1px, transparent 1px);
    background-size: 24px 24px;
}

.scenario-node {
    width: 280px;
    min-height: 118px;
    gap: 0;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-top: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, .08);
}

.scenario-node::before {
    content: "";
    height: 4px;
    border-radius: 8px 8px 0 0;
    background: currentColor;
}

.scenario-node-head {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    padding: 10px 12px 8px;
    border-bottom: 1px solid #eef2f7;
}

.scenario-node-icon {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.scenario-node-head strong {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.25;
}

.scenario-node-head small {
    color: #94a3b8;
    font-size: 10px;
    max-width: 64px;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scenario-node-type {
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    text-transform: none;
}

.scenario-node-media {
    height: 138px;
    margin: 0 10px 10px;
    border-radius: 7px;
    background-position: center;
    background-size: cover;
    border: 1px solid #e2e8f0;
}

.scenario-node-body {
    min-height: 54px;
    max-height: 140px;
    margin: 10px;
    padding: 10px;
    overflow: hidden;
    border-radius: 7px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
}

.scenario-node-buttons {
    display: grid;
    gap: 6px;
    padding: 0 10px 10px;
}

.scenario-node-button-row,
.scenario-node-add-answer {
    position: relative;
    min-height: 28px;
    padding: 7px 28px 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 11px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scenario-node-button-row::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    transform: translateY(-50%);
}

.scenario-node-add-answer {
    color: #94a3b8;
    text-align: center;
}

.scenario-node-footer {
    padding: 7px 10px 10px;
    color: #94a3b8;
    font-size: 11px;
    text-align: right;
}

.scenario-port {
    position: absolute;
    z-index: 3;
    width: 14px;
    height: 14px;
    min-height: 14px;
    padding: 0;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
}

.scenario-port:hover {
    border-color: #2563eb;
    background: #dbeafe;
}

.scenario-port-in {
    left: -7px;
    top: 86px;
}

.scenario-port-out {
    right: -7px;
    top: 86px;
}

.scenario-node-start,
.scenario-node-end,
.scenario-node-delay,
.scenario-node-tag_add,
.scenario-node-tag_remove,
.scenario-node-condition {
    min-height: 102px;
}

.scenario-node-start .scenario-node-body,
.scenario-node-end .scenario-node-body,
.scenario-node-delay .scenario-node-body,
.scenario-node-tag_add .scenario-node-body,
.scenario-node-tag_remove .scenario-node-body,
.scenario-node-condition .scenario-node-body {
    min-height: 32px;
    margin-bottom: 6px;
}

.scenario-edge {
    stroke: #c2cad8;
    stroke-width: 2;
}

.scenario-edge:hover,
.scenario-edge.is-selected {
    stroke: #2563eb;
    stroke-width: 3;
}

.scenario-edge-label {
    fill: #475569;
    font-size: 11px;
    font-weight: 700;
}

.scenario-editor {
    width: calc(100vw - 32px);
    margin-left: calc((100% - 100vw + 32px) / 2);
}

.page:has(.scenario-editor) > h1 {
    display: none;
}

.scenario-shell {
    position: relative;
    display: block;
    min-height: calc(100vh - 170px);
}

.scenario-canvas-wrap {
    height: calc(100vh - 170px);
    min-height: 720px;
}

.scenario-canvas {
    height: 100%;
    min-height: 720px;
    cursor: grab;
}

.scenario-canvas.is-panning {
    cursor: grabbing;
}

.scenario-canvas-tools {
    width: 132px;
}

.scenario-canvas-tools select {
    width: 132px;
    min-height: 42px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
    font-size: 13px;
}

.scenario-canvas-tools button {
    width: 132px;
}

.scenario-inspector {
    position: absolute;
    z-index: 18;
    top: 14px;
    right: 164px;
    width: min(360px, calc(100% - 220px));
    max-height: calc(100% - 28px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}

.scenario-inspector[hidden] {
    display: none;
}

.test-bot-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.test-bot-form label {
    flex: 1 1 240px;
    margin-bottom: 0;
}

.test-bot-form button {
    flex: 0 1 auto;
}

.field-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.compact-button {
    min-height: 39px;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .topbar,
    .stats,
    .health-grid,
    .grid,
    .settings-form {
        display: block;
    }

    .topbar nav,
    .stats div {
        margin-top: 12px;
    }

    table {
        display: block;
        overflow-x: auto;
    }

    .field-action-row {
        grid-template-columns: 1fr;
    }

    .compact-button {
        width: 100%;
    }

    .flow-card {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .flow-card-head,
    .flow-card-grid,
    .flow-add-form,
    .flow-button-editor {
        grid-template-columns: 1fr;
    }

    .test-bot-form {
        display: block;
    }

    .test-bot-form button {
        margin-top: 10px;
        width: 100%;
    }

    .scenario-shell {
        grid-template-columns: 1fr;
    }

    .scenario-palette,
    .scenario-inspector {
        border: 0;
        border-bottom: 1px solid var(--line);
    }
}
