:root {
    color-scheme: light;
    --bg: #edf4fb;
    --panel: #ffffff;
    --text: #102033;
    --muted: #607386;
    --line: #cbd8e3;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --danger: #bd1f1f;
    --shadow: 0 12px 30px rgba(15, 32, 51, 0.10);
}

.visual-designer-panel {
    background: #f7fbfb;
}

.visual-designer-shell {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(420px, 1fr) minmax(220px, 280px);
    gap: 12px;
    min-height: calc(100vh - 190px);
}

.visual-palette,
.visual-properties,
.visual-canvas-column {
    min-width: 0;
}

.visual-palette,
.visual-properties {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.visual-palette {
    position: relative;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.visual-palette.drag-over {
    border-color: #c81919;
    box-shadow: inset 0 0 0 2px rgba(200, 25, 25, 0.14), 0 0 0 3px rgba(200, 25, 25, 0.08);
}

.visual-palette[data-drop-label]::after {
    background: #a31919;
    border-radius: 999px;
    color: #ffffff;
    content: attr(data-drop-label);
    font-size: 12px;
    font-weight: 850;
    left: 12px;
    max-width: calc(100% - 24px);
    overflow: hidden;
    padding: 5px 9px;
    position: absolute;
    right: 12px;
    text-align: center;
    text-overflow: ellipsis;
    top: 12px;
    white-space: nowrap;
    z-index: 6;
}

.visual-panel-head {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
    padding: 12px;
}

.visual-panel-head span {
    color: var(--muted);
    font-size: 12px;
}

.visual-palette-list,
.visual-properties-body {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.visual-palette-group {
    align-items: center;
    color: #0b6f73;
    display: flex;
    font-size: 11px;
    font-weight: 850;
    gap: 8px;
    letter-spacing: 0;
    margin-top: 4px;
    text-transform: uppercase;
}

.visual-palette-group:first-child {
    margin-top: 0;
}

.visual-palette-group::after {
    background: #d8e8ef;
    content: "";
    flex: 1;
    height: 1px;
}

.visual-palette-item {
    align-items: center;
    background: #f7fbfb;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    cursor: grab;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
    text-align: left;
}

.visual-palette-item:active {
    cursor: grabbing;
}

.visual-palette-code,
.visual-field-lp,
.visual-field-validation {
    align-items: center;
    background: #d8f5f3;
    border-radius: 999px;
    color: #0b6f73;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    justify-content: center;
    min-height: 24px;
    min-width: 28px;
    padding: 2px 8px;
}

.visual-palette-name {
    color: var(--text);
    font-weight: 750;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-canvas-column {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
}

.visual-toolbar {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 12px;
}

.visual-toolbar > div:first-child {
    display: grid;
    gap: 3px;
    min-width: 220px;
}

.visual-toolbar span {
    color: var(--muted);
    font-size: 12px;
}

.visual-toolbar .visual-draft-details {
    max-width: 560px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#visualDraftStatus.dirty {
    color: #9a5b00;
    font-weight: 750;
}

#visualDraftStatus.saving {
    color: #0b6f73;
    font-weight: 750;
}

.visual-toolbar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.visual-device-toggle {
    background: #eef7f7;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    padding: 3px;
}

.visual-device-toggle button {
    background: transparent;
    border: 0;
    color: var(--muted);
    min-height: 30px;
    padding: 6px 10px;
}

.visual-device-toggle button.active {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(17, 55, 60, 0.12);
    color: var(--accent);
}

.visual-canvas {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    overflow: auto;
    padding: 12px;
}

.visual-canvas.mobile {
    grid-template-columns: minmax(0, 1fr);
    justify-self: center;
    max-width: 420px;
    width: 100%;
}

.visual-canvas.mobile .visual-field-shell {
    grid-column: 1 / -1;
}

.visual-canvas.mobile .visual-field-group {
    grid-column: 1 / -1;
}

.visual-viewport-notice {
    align-items: center;
    background: #eef7f7;
    border: 1px solid #bde4e2;
    border-radius: 7px;
    color: var(--muted);
    display: flex;
    gap: 8px;
    grid-column: 1 / -1;
    min-height: 34px;
    padding: 6px 10px;
}

.visual-viewport-notice strong {
    color: #0b6f73;
    font-size: 12px;
    text-transform: uppercase;
}

.visual-viewport-notice span {
    font-size: 12px;
    font-weight: 750;
}

.visual-drop-zone {
    align-items: center;
    border: 1px dashed transparent;
    border-radius: 7px;
    color: transparent;
    display: flex;
    font-size: 12px;
    font-weight: 750;
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 12px;
    transition: min-height 0.12s ease, border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.visual-drag-active .visual-drop-zone {
    border-color: rgba(40, 169, 174, 0.28);
    color: #0b6f73;
    min-height: 24px;
}

.visual-drag-active {
    user-select: none;
}

.visual-pointer-ghost {
    background: #0b6f73;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(17, 55, 60, 0.18);
    color: #ffffff;
    font-size: 12px;
    font-weight: 850;
    max-width: 260px;
    overflow: hidden;
    padding: 7px 10px;
    pointer-events: none;
    position: fixed;
    text-overflow: ellipsis;
    top: 0;
    white-space: nowrap;
    z-index: 2000;
}

.visual-drop-before,
.visual-drop-after {
    background: linear-gradient(90deg, transparent, rgba(40, 169, 174, 0.05), transparent);
}

.visual-drop-zone.drag-over {
    background: #e6f7f6;
    border-color: #28a9ae;
    color: #0b6f73;
    min-height: 36px;
}

.visual-drop-zone[data-drop-label] {
    color: transparent;
    position: relative;
}

.visual-drop-zone[data-drop-label]::after {
    color: #0b6f73;
    content: attr(data-drop-label);
    left: 8px;
    overflow: hidden;
    position: absolute;
    right: 8px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-start-drop {
    align-items: center;
    background: #f7fbfb;
    border: 1px dashed #8ccfd0;
    border-radius: 8px;
    color: var(--muted);
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
    justify-items: center;
    min-height: 240px;
    padding: 28px 18px;
    position: relative;
    text-align: center;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.visual-start-drop strong {
    color: #0b6f73;
    font-size: 16px;
}

.visual-start-drop span {
    max-width: 520px;
}

.visual-start-drop.drag-over {
    background: #e6f7f6;
    border-color: #28a9ae;
    box-shadow: inset 0 0 0 2px rgba(40, 169, 174, 0.12);
}

.visual-start-drop[data-drop-label]::after {
    background: #0b6f73;
    border-radius: 999px;
    color: #ffffff;
    content: attr(data-drop-label);
    font-size: 12px;
    font-weight: 800;
    left: 50%;
    max-width: calc(100% - 32px);
    overflow: hidden;
    padding: 6px 10px;
    position: absolute;
    text-overflow: ellipsis;
    top: 16px;
    transform: translateX(-50%);
    white-space: nowrap;
}

.visual-field-shell {
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: grab;
    display: grid;
    gap: 6px;
    margin-top: 12px;
    min-width: 0;
    padding: 5px;
    position: relative;
    touch-action: none;
}

.visual-field-group {
    align-content: start;
    display: grid;
    gap: 6px;
    margin-top: 12px;
    min-width: 0;
}

.visual-field-group.stacked {
    background: #f7fbfb;
    border: 1px solid #bde4e2;
    border-radius: 8px;
    padding: 5px;
}

.visual-field-group.stacked > .visual-field-shell {
    margin-top: 0;
}

.visual-field-group.stacked > .visual-field-shell + .visual-field-shell {
    border-top-color: var(--line);
    border-radius: 0 0 8px 8px;
    padding-top: 10px;
}

.visual-field-shell.active {
    border-color: #28a9ae;
    box-shadow: 0 0 0 3px rgba(40, 169, 174, 0.13);
}

.visual-field-shell.dragging {
    opacity: 0.55;
}

.visual-field-shell.drag-over-before,
.visual-field-shell.drag-over-after,
.visual-field-shell.drag-over-inline-after {
    background: #f2fbfb;
    border-color: #28a9ae;
}

.visual-field-shell.drag-over-before::before,
.visual-field-shell.drag-over-after::before {
    background: #28a9ae;
    border-radius: 999px;
    content: "";
    height: 3px;
    left: 8px;
    position: absolute;
    right: 8px;
    z-index: 2;
}

.visual-field-shell.drag-over-before::before {
    top: -5px;
}

.visual-field-shell.drag-over-after::before {
    bottom: -5px;
}

.visual-field-shell.drag-over-inline-after {
    box-shadow: inset -8px 0 0 #28a9ae, 0 0 0 3px rgba(40, 169, 174, 0.13);
}

.visual-field-shell.drag-over-inline-after::before {
    background: rgba(40, 169, 174, 0.15);
    border-left: 1px dashed #28a9ae;
    border-radius: 0 8px 8px 0;
    bottom: 5px;
    content: "";
    pointer-events: none;
    position: absolute;
    right: 5px;
    top: 5px;
    width: 46%;
    z-index: 1;
}

.visual-field-shell[data-drop-label]::after {
    background: #0b6f73;
    border-radius: 999px;
    color: #ffffff;
    content: attr(data-drop-label);
    font-size: 11px;
    font-weight: 800;
    max-width: min(360px, calc(100% - 16px));
    overflow: hidden;
    padding: 4px 8px;
    pointer-events: none;
    position: absolute;
    right: 8px;
    text-overflow: ellipsis;
    top: 8px;
    white-space: nowrap;
    z-index: 3;
}

.visual-field-tools {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(156, 207, 208, 0.72);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(17, 55, 60, 0.08);
    display: flex;
    gap: 4px;
    left: 10px;
    max-width: calc(100% - 20px);
    min-width: 0;
    padding: 3px;
    pointer-events: none;
    position: absolute;
    top: -12px;
    z-index: 5;
}

.visual-drag-handle {
    align-items: center;
    background: #ffffff;
    border: 1px solid #bde4e2;
    border-radius: 999px;
    color: #0b6f73;
    cursor: grab;
    display: inline-flex;
    font-size: 13px;
    font-weight: 950;
    height: 24px;
    justify-content: center;
    pointer-events: auto;
    width: 24px;
}

.visual-field-lp,
.visual-field-validation {
    font-size: 11px;
    min-height: 22px;
    min-width: 24px;
    padding: 2px 7px;
}

.visual-field-validation {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-runtime-component {
    background: #f8fbfd;
    border: 1px solid #b8d5ee;
    border-radius: 7px;
    display: grid;
    gap: 6px;
    min-height: 74px;
    padding: 10px;
    position: relative;
    z-index: 0;
}

.visual-runtime-component label {
    color: var(--text);
    font-weight: 750;
}

.visual-runtime-component input,
.visual-runtime-component select,
.visual-runtime-component textarea {
    background: #eef6ff;
    border: 1px solid #acd2f7;
    border-radius: 6px;
    min-height: 36px;
    padding: 7px 9px;
}

.visual-runtime-component textarea {
    min-height: 72px;
    resize: none;
}

.visual-runtime-component .req {
    color: #c81919;
}

.visual-runtime-component.readonly input,
.visual-runtime-component.readonly select,
.visual-runtime-component.readonly textarea {
    background: #f7fafc;
    color: var(--muted);
}

.visual-runtime-note {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.visual-runtime-button {
    background: #0b6f73;
    border: 1px solid #0b6f73;
    border-radius: 7px;
    color: #ffffff;
    font-weight: 850;
    min-height: 36px;
    padding: 8px 10px;
    text-align: center;
}

.visual-runtime-table {
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 0;
    overflow: hidden;
}

.visual-runtime-table span {
    border-bottom: 1px solid var(--line);
    padding: 8px;
}

.visual-runtime-helper {
    align-items: center;
    background: #eef7f7;
    border: 1px solid #bde4e2;
    border-radius: 7px;
    color: #0b6f73;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-height: 38px;
    padding: 8px 10px;
}

.visual-runtime-helper span {
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-runtime-helper em {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    white-space: nowrap;
}

.visual-helper-camera,
.visual-helper-canvas,
.visual-helper-gallery,
.visual-helper-ai-vision {
    background: #ecfbfd;
    border-color: #8ccfd0;
}

.visual-inline-drop {
    align-items: center;
    background: rgba(216, 245, 243, 0.92);
    border: 1px dashed #8ccfd0;
    border-radius: 0 7px 7px 0;
    bottom: 5px;
    color: #0b6f73;
    display: flex;
    font-size: 12px;
    font-weight: 750;
    justify-content: center;
    min-height: 28px;
    opacity: 0;
    padding: 0 8px;
    pointer-events: none;
    position: absolute;
    right: 5px;
    text-align: center;
    top: 5px;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    width: 46%;
    z-index: 4;
}

.visual-drag-active .visual-inline-drop {
    opacity: 1;
    pointer-events: auto;
}

.visual-inline-drop.drag-over {
    background: #d8f5f3;
    border-color: #28a9ae;
    box-shadow: inset 0 0 0 2px rgba(40, 169, 174, 0.18);
}

.visual-inline-drop[data-drop-label] {
    color: transparent;
    overflow: hidden;
    position: relative;
}

.visual-inline-drop[data-drop-label]::after {
    color: #0b6f73;
    content: attr(data-drop-label);
    font-size: 12px;
    font-weight: 850;
    left: 8px;
    line-height: 1.25;
    overflow: hidden;
    position: absolute;
    right: 8px;
    text-overflow: ellipsis;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
}

.visual-canvas.mobile .visual-inline-drop {
    display: none;
}

.visual-hidden-shelf {
    background: #f7fbfb;
    border: 1px dashed #9bcfd0;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
    padding: 10px;
}

.visual-hidden-shelf.drag-over {
    background: #e6f7f6;
    border-color: #28a9ae;
    box-shadow: 0 0 0 3px rgba(40, 169, 174, 0.12);
}

.visual-hidden-shelf[data-drop-label] {
    position: relative;
}

.visual-hidden-shelf[data-drop-label]::after {
    background: #0b6f73;
    border-radius: 999px;
    color: #ffffff;
    content: attr(data-drop-label);
    font-size: 12px;
    font-weight: 850;
    max-width: calc(100% - 24px);
    overflow: hidden;
    padding: 5px 9px;
    position: absolute;
    right: 10px;
    text-overflow: ellipsis;
    top: 10px;
    white-space: nowrap;
}

.visual-hidden-title {
    color: #0b6f73;
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.visual-hidden-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.visual-hidden-empty {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    padding: 3px 0;
}

.visual-hidden-chip {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    cursor: grab;
    display: inline-flex;
    gap: 7px;
    max-width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    touch-action: none;
}

.visual-hidden-chip.active {
    border-color: #28a9ae;
    box-shadow: 0 0 0 3px rgba(40, 169, 174, 0.13);
}

.visual-hidden-chip span,
.visual-hidden-chip em {
    background: #d8f5f3;
    border-radius: 999px;
    color: #0b6f73;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    padding: 3px 7px;
    white-space: nowrap;
}

.visual-hidden-chip strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-palette-item {
    color: var(--text);
    touch-action: none;
}

.visual-property-group,
.visual-property-section {
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 8px;
    padding: 10px;
}

.visual-property-section {
    background: #ffffff;
}

.visual-property-section h4 {
    color: #0b6f73;
    font-size: 12px;
    font-weight: 850;
    margin: 0;
    text-transform: uppercase;
}

.visual-property-controls {
    display: grid;
    gap: 8px;
}

.visual-property-group label,
.visual-property-section label {
    color: var(--muted);
    font-size: 12px;
}

.visual-property-group input,
.visual-property-group select,
.visual-property-section input,
.visual-property-section select,
.visual-property-section textarea {
    width: 100%;
}

.visual-property-section textarea {
    font-family: Consolas, "Liberation Mono", monospace;
    min-height: 120px;
    resize: vertical;
}

.visual-property-section .checkbox-line {
    color: var(--text);
    font-weight: 700;
}

.visual-property-section .checkbox-line input {
    width: 18px;
}

.visual-property-action {
    background: #eefafa;
    border: 1px solid #9bcfd0;
    border-radius: 7px;
    color: #0b6f73;
    font-weight: 800;
    min-height: 34px;
    padding: 7px 10px;
    text-align: left;
}

.visual-property-action:hover:not(:disabled) {
    background: #dff6f4;
    border-color: #28a9ae;
}

.visual-property-action.danger {
    background: #fff4f4;
    border-color: #efb4b4;
    color: #a31919;
}

.visual-property-action.danger:hover:not(:disabled) {
    background: #ffe8e8;
    border-color: #c81919;
}

.visual-property-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.visual-property-help {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.visual-empty {
    align-items: center;
    color: var(--muted);
    display: flex;
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 260px;
    text-align: center;
}

.visual-span-1 { grid-column-end: span 1; }
.visual-span-2 { grid-column-end: span 2; }
.visual-span-3 { grid-column-end: span 3; }
.visual-span-4 { grid-column-end: span 4; }
.visual-span-5 { grid-column-end: span 5; }
.visual-span-6 { grid-column-end: span 6; }
.visual-span-7 { grid-column-end: span 7; }
.visual-span-8 { grid-column-end: span 8; }
.visual-span-9 { grid-column-end: span 9; }
.visual-span-10 { grid-column-end: span 10; }
.visual-span-11 { grid-column-end: span 11; }
.visual-span-12 { grid-column-end: span 12; }
.visual-start-1 { grid-column-start: 1; }
.visual-start-2 { grid-column-start: 2; }
.visual-start-3 { grid-column-start: 3; }
.visual-start-4 { grid-column-start: 4; }
.visual-start-5 { grid-column-start: 5; }
.visual-start-6 { grid-column-start: 6; }
.visual-start-7 { grid-column-start: 7; }
.visual-start-8 { grid-column-start: 8; }
.visual-start-9 { grid-column-start: 9; }
.visual-start-10 { grid-column-start: 10; }
.visual-start-11 { grid-column-start: 11; }
.visual-start-12 { grid-column-start: 12; }

.visual-canvas.mobile .visual-field-shell {
    grid-column: 1 / -1;
}

@media (max-width: 1180px) {
    .visual-designer-shell {
        grid-template-columns: 1fr;
    }

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

    .visual-toolbar .visual-draft-details {
        max-width: 100%;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #e7f0fb, #f7fafc);
    color: var(--text);
    font: 14px/1.4 system-ui, Segoe UI, Roboto, Arial, sans-serif;
}

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

button,
.button-link {
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    padding: 9px 14px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

button.icon-button {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    padding: 0;
    font-weight: 700;
}

button.secondary,
.button-link.secondary {
    background: #ffffff;
    color: var(--accent);
}

button.danger {
    border-color: var(--danger);
    background: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #bfd2ee;
    border-radius: 6px;
    padding: 9px 10px;
    background: #eef6ff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

pre,
code {
    font-family: Consolas, "Courier New", monospace;
}

code {
    border-radius: 4px;
    background: #eef6f7;
    padding: 1px 4px;
}

pre {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fbfc;
    padding: 10px;
}

label,
fieldset {
    display: grid;
    gap: 6px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
}

legend {
    padding: 0 6px;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.engine-shell {
    width: min(1680px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 22px 0 28px;
}

.engine-top,
.panel-title,
.host-box,
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.engine-top {
    justify-content: space-between;
    margin-bottom: 18px;
}

.engine-flash {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: min(520px, 34vw);
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 6px 12px 6px 7px;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.engine-flash.visible {
    opacity: 0.9;
    transform: translateY(0);
}

.engine-flash.ok {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(220, 252, 231, 0.82);
    color: #14532d;
}

.engine-flash.error {
    border-color: rgba(220, 38, 38, 0.32);
    background: rgba(254, 226, 226, 0.86);
    color: #7f1d1d;
}

.engine-flash.info {
    border-color: rgba(37, 99, 235, 0.24);
    background: rgba(219, 234, 254, 0.86);
    color: #1d4ed8;
}

.engine-flash-badge {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
}

#engineFlashText {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.engine-top h1,
.panel-title h2 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-weight: 800;
}

.host-box {
    align-items: end;
}

.host-box label,
.host-context {
    width: min(360px, 45vw);
}

.host-context {
    display: grid;
    gap: 6px;
    min-width: min(360px, 45vw);
}

.host-context span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.host-context strong {
    min-height: 38px;
    border: 1px solid #bfd2ee;
    border-radius: 6px;
    background: #eef6ff;
    color: var(--text);
    display: flex;
    align-items: center;
    padding: 9px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.designer-login-card {
    width: min(520px, calc(100vw - 32px));
    margin: 72px auto 0;
}

.designer-login-head {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}

.designer-login-head h2 {
    margin: 0;
    font-size: 22px;
}

.designer-login-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.designer-login-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    color: #ffffff;
    font-weight: 800;
}

.designer-login-form {
    display: grid;
    gap: 12px;
}

.designer-login-form p {
    margin: 0;
    color: var(--muted);
}

.designer-enrollment-info,
.designer-recovery-codes {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8fbfc;
    padding: 12px;
}

.designer-enrollment-info span,
.designer-recovery-codes span {
    color: var(--muted);
}

.designer-enrollment-info code,
.designer-recovery-codes code {
    white-space: pre-wrap;
    word-break: break-word;
}

.designer-login-form.enrollment-complete .designer-enrollment-info,
.designer-login-form.enrollment-complete label,
.designer-login-form.enrollment-complete > button {
    display: none;
}

.mfa-qr {
    width: 180px;
    max-width: 100%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    padding: 8px;
}

.mfa-qr svg {
    width: 100%;
    height: auto;
    display: block;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(260px, 340px) minmax(520px, 1fr);
    align-items: start;
    gap: 12px;
}

.event-list-panel,
.field-list-panel {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 38px);
    overflow-y: auto;
    overflow-x: hidden;
}

.panel-title,
.panel-actions {
    justify-content: space-between;
    margin-bottom: 14px;
}

.panel-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
}

.event-list,
.field-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.event-list button,
.field-list button {
    min-width: 0;
    width: 100%;
    text-align: left;
    background: #ffffff;
    color: var(--text);
    border-color: var(--line);
}

.event-list button.active,
.field-list button.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.event-list button {
    display: grid;
    gap: 6px;
}

.event-list-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.event-badge.main {
    background: #dbeafe;
    color: #1d4ed8;
}

.event-badge.next {
    background: #edf1f5;
    color: #394957;
}

.editor-stack {
    display: grid;
    gap: 18px;
}

.event-editor-shell .panel-title {
    margin-bottom: 0;
}

.event-editor-summary {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.event-editor {
    margin-top: 14px;
    min-width: 0;
}

.event-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 16px;
    align-items: start;
}

.form-grid.event-grid {
    grid-template-columns: 84px minmax(180px, 1fr) 78px 78px 64px;
}

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

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

.event-name-field {
    grid-column: span 2;
    min-width: 0;
}

.event-id-field input,
.event-next-field input,
.event-action-field input,
.event-sort-field input,
.event-save-label-field input {
    min-width: 0;
}

.event-save-label-field {
    grid-column: span 2;
}

.event-color-field {
    grid-column: span 2;
}

.color-input-row {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 46px;
}

.color-input-row input[type="color"] {
    min-width: 0;
    padding: 3px;
}

.event-icon-field {
    grid-column: span 2;
}

.icon-input-row {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 34px;
}

.mask-input-row {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 34px;
}

.icon-preview {
    align-items: center;
    align-self: end;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--accent);
    display: inline-flex;
    height: 37px;
    justify-content: center;
    width: 34px;
}

.icon-preview.empty {
    color: var(--muted);
}

.icon-preview.empty::after {
    content: "-";
    font-weight: 700;
}

.icon-preview svg {
    display: block;
    height: 22px;
    width: 22px;
}

.lp-field {
    grid-column: span 1;
}

.lp-field input {
    max-width: 110px;
}

.alias-field {
    grid-column: span 3;
}

.checkbox-line,
.radio-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-line input,
.radio-line input {
    width: auto;
}

.checkbox-line input[type="checkbox"] {
    appearance: none;
    background: #ffffff;
    border: 2px solid #8fb2d6;
    border-radius: 4px;
    cursor: pointer;
    display: inline-grid;
    height: 18px;
    margin: 0;
    min-width: 18px;
    place-content: center;
    width: 18px;
}

.checkbox-line input[type="checkbox"]::before {
    border-bottom: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    content: "";
    height: 5px;
    opacity: 0;
    transform: rotate(-45deg) translateY(-1px);
    width: 9px;
}

.checkbox-line input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-line input[type="checkbox"]:checked::before {
    opacity: 1;
}

.checkbox-line input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
    outline: none;
}

.fields-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.field-list-wrap {
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
    background: #ffffff;
}

.field-list {
    gap: 0;
}

.field-list-head,
.field-row {
    display: grid;
    grid-template-columns: 48px minmax(100px, 1fr) 62px minmax(80px, 0.7fr);
    align-items: center;
    gap: 8px;
}

.field-list-head {
    padding: 9px 12px;
    background: #f4f8fa;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.field-row {
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    padding: 10px 12px;
    min-height: 54px;
}

.field-row.active {
    border-color: var(--line);
    background: var(--accent-soft);
    box-shadow: inset 4px 0 0 var(--accent);
}

.field-lp,
.field-validation {
    font-weight: 700;
}

.field-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.field-tag {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    border-radius: 999px;
    background: #e8eef3;
    color: #394957;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
}

.field-tag.muted {
    color: var(--muted);
    background: transparent;
    padding-left: 0;
}

.field-list-empty {
    padding: 14px;
    color: var(--muted);
}

.field-editor-title {
    margin-bottom: 12px;
}

.field-editor-title h3 {
    margin: 0 0 4px;
}

.field-editor-title p {
    margin: 0;
    color: var(--muted);
}

.permission-panel {
    margin-top: 14px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8fbfc;
    padding: 12px;
}

.permission-title h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.permission-title p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.permission-add {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto;
    gap: 8px;
}

.permission-add input,
.permission-add select {
    min-width: 0;
}

.permission-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.permission-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    padding: 9px;
}

.permission-main {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
}

.permission-meta {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.permission-empty {
    color: var(--muted);
    font-size: 13px;
}

.validation-box {
    margin: 14px 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    background: #f8fbfc;
}

.validation-box input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.validation-choice {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 10px;
    background: #ffffff;
    cursor: pointer;
}

.validation-choice:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.validation-choice:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.validation-code {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 30px;
    border-radius: 6px;
    background: #e8eef3;
    color: var(--text);
    font-weight: 700;
}

.validation-choice:has(input:checked) .validation-code {
    background: var(--accent);
    color: #ffffff;
}

.validation-name {
    min-width: 0;
    color: var(--text);
    line-height: 1.2;
}

.textarea-block {
    display: grid;
    gap: 6px;
}

.textarea-head,
.snippet-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.textarea-head {
    justify-content: space-between;
}

.textarea-head > label {
    display: block;
}

.snippet-tools {
    flex-wrap: wrap;
    justify-content: end;
}

.snippet-tools select {
    width: min(260px, 42vw);
    padding: 7px 9px;
}

.snippet-tools button.secondary {
    padding: 7px 10px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 28, 41, 0.38);
}

.modal-card {
    width: min(760px, calc(100vw - 36px));
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 20px 55px rgba(18, 35, 50, 0.25);
    padding: 18px;
}

.help-body {
    color: var(--text);
    line-height: 1.45;
}

.help-body ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.help-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.help-tab {
    padding: 9px 11px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

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

.help-tab.active {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.help-tab-panel {
    display: grid;
    gap: 12px;
}

.help-tab-panel[hidden] { display: none; }

.help-tab-panel p,
.help-tab-panel pre { margin: 0; }

.help-tab-panel pre {
    padding: 12px;
    overflow: auto;
    border-radius: 7px;
    background: #142231;
    color: #e7f0f7;
}

.help-tab-panel code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent);
}

.help-reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.help-reference-table th,
.help-reference-table td {
    padding: 8px 9px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.help-reference-table th { background: var(--accent-soft); }

.message {
    min-height: 24px;
    color: var(--muted);
    height: 0;
    margin: 0;
    overflow: hidden;
}

.designer-workspace {
    grid-template-columns: minmax(230px, 280px) minmax(260px, 340px) minmax(520px, 1fr);
    gap: 12px;
}

.designer-main {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.designer-card,
.explorer-panel,
.object-panel {
    box-shadow: 0 8px 24px rgba(38, 55, 70, 0.1);
}

.compact-title {
    align-items: flex-start;
}

.panel-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.designer-card {
    padding: 0;
    overflow: hidden;
}

.designer-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
    padding: 16px 18px 0;
}

.designer-card-head h2 {
    margin: 0;
}

.designer-tabs {
    display: flex;
    align-items: end;
    gap: 4px;
    overflow-x: auto;
}

.designer-tab-button {
    border-color: transparent;
    border-radius: 7px 7px 0 0;
    background: transparent;
    color: var(--muted);
    padding: 9px 12px;
}

.designer-tab-button.active {
    border-color: var(--line);
    border-bottom-color: #ffffff;
    background: #ffffff;
    color: var(--accent);
    font-weight: 700;
}

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

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

.event-panel-title {
    margin-bottom: 12px;
}

.event-panel-title h3,
.field-editor-title h3,
.field-sql-panel label {
    margin: 0;
}

.event-editor {
    margin-top: 0;
}

.form-grid.event-grid {
    grid-template-columns: 96px minmax(260px, 1.35fr) 90px 90px 78px minmax(120px, 0.7fr);
}

.event-name-field {
    grid-column: span 2;
}

.event-save-label-field {
    grid-column: span 2;
}

.event-color-field,
.event-icon-field {
    grid-column: span 1;
}

.field-grid {
    grid-template-columns: 100px minmax(360px, 1fr) minmax(145px, 0.42fr) minmax(170px, 0.5fr) minmax(170px, 0.5fr);
    align-items: end;
}

.field-grid .lp-field {
    grid-column: 1;
}

.field-grid .lp-field input {
    max-width: 86px;
}

.field-grid .alias-field {
    grid-column: 2;
}

.field-required-field {
    grid-column: 3;
}

.field-edit-field {
    grid-column: 4;
}

.field-visibility-field {
    grid-column: 1;
    align-self: start;
    min-width: 0;
}

.field-refresh-field {
    grid-column: 2;
    align-self: center;
    min-height: 44px;
}

.field-mask-field {
    grid-column: 3;
}

.field-inline-field {
    grid-column: 4 / span 2;
    align-self: center;
    min-height: 44px;
}

.field-stacked-field {
    grid-column: 4 / span 2;
    align-self: center;
    min-height: 44px;
}

.field-grid fieldset {
    padding: 9px 10px;
}

.validation-box {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-sql-panel {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.event-list-panel,
.field-list-panel {
    scrollbar-gutter: stable;
}

.event-list-panel .event-list {
    max-height: calc(100vh - 142px);
    overflow-y: auto;
    padding-right: 2px;
}

.event-list button {
    border-radius: 7px;
    padding: 10px 12px;
}

.event-list button.active {
    box-shadow: inset 4px 0 0 var(--accent);
}

.event-list-label {
    white-space: nowrap;
}

.field-list-wrap {
    max-height: calc(100vh - 188px);
    overflow-y: auto;
    overflow-x: hidden;
}

.field-list-head,
.field-row {
    grid-template-columns: 46px minmax(120px, 1fr) 54px minmax(70px, 0.65fr);
}

.permission-panel {
    margin-top: 0;
    border: 0;
    background: transparent;
    padding: 18px;
}

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

.permission-add {
    max-width: 620px;
}

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

.users-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 360px) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
    max-width: 720px;
}

.runtime-user-list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    max-width: 900px;
    padding: 0;
}

.runtime-user-row {
    align-items: stretch;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr);
    padding: 10px 12px;
}

.runtime-user-main {
    font-weight: 750;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.runtime-user-meta {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 6px;
    min-width: 0;
}

.runtime-user-badge {
    background: #eaf1ff;
    border-radius: 999px;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
}

.runtime-user-badge.security {
    background: #ecfdf5;
    color: #047857;
}

.runtime-user-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    justify-content: stretch;
}

.runtime-user-actions button {
    min-width: 0;
    padding: 6px 7px;
    width: 100%;
}

.user-manager {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
}

.user-browser,
.runtime-user-form {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
}

.user-browser {
    overflow: hidden;
}

.user-browser .panel-title {
    border-bottom: 1px solid var(--line);
    margin-bottom: 0;
    padding: 12px;
}

.user-browser h3 {
    margin: 0;
}

.user-filter {
    display: grid;
    gap: 5px;
    font-weight: 650;
    padding: 10px 12px 0;
}

.runtime-user-form {
    padding: 14px;
}

.runtime-user-grid {
    align-items: start;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.runtime-user-grid > label,
.runtime-user-grid > fieldset {
    align-self: start;
}

.runtime-user-email-field,
.runtime-user-password-field {
    grid-column: span 5;
}

.runtime-user-name-field {
    grid-column: span 5;
}

.runtime-user-lp-field {
    grid-column: span 2;
}

.runtime-user-role-field,
.runtime-user-mfa-field {
    align-items: center;
    display: flex;
    gap: 14px;
    grid-column: span 5;
    min-height: 66px;
}

.runtime-user-role-field .checkbox-line,
.runtime-user-mfa-field .checkbox-line {
    border-radius: 6px;
    cursor: pointer;
    font-weight: 750;
    padding: 6px 4px;
}

.runtime-user-role-field legend,
.runtime-user-mfa-field legend {
    font-size: 12px;
    font-weight: 800;
}

.runtime-user-row.active {
    background: var(--accent-soft);
    border-color: var(--accent);
}

@media (max-width: 980px) {
    .engine-top,
    .workspace,
    .designer-workspace,
    .designer-main,
    .designer-card-head,
    .host-box,
    .user-manager,
    .form-grid,
    .runtime-user-grid,
    .field-grid,
    .event-grid,
    .event-editor-layout,
    .permission-add,
    .users-toolbar,
    .runtime-user-email-field,
    .runtime-user-name-field,
    .runtime-user-password-field,
    .runtime-user-lp-field,
    .runtime-user-role-field,
    .runtime-user-mfa-field,
    .runtime-user-row,
    .validation-box {
        display: grid;
        grid-template-columns: 1fr;
    }

    .engine-flash {
        max-width: 100%;
        justify-self: stretch;
    }

    .event-list-panel,
    .field-list-panel {
        position: static;
        max-height: none;
    }

    .field-list-wrap {
        max-height: none;
    }

    .designer-tabs {
        align-items: stretch;
    }

    .designer-tab-button {
        border-radius: 7px;
    }

    .host-box label,
    .host-context {
        width: 100%;
    }

    .textarea-head,
    .snippet-tools {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .snippet-tools select {
        width: 100%;
    }

    .field-list-head {
        display: none;
    }

    .field-row {
        grid-template-columns: 54px minmax(0, 1fr);
    }

    .runtime-user-email-field,
    .runtime-user-name-field,
    .runtime-user-password-field,
    .runtime-user-lp-field,
    .runtime-user-role-field,
    .runtime-user-mfa-field {
        grid-column: 1 / -1;
    }

    .field-validation,
    .field-tags {
        grid-column: 2;
    }
}

/* Cloud Designer visual parity with Local Designer, keeping the cloud accent. */
:root {
    --bg: #f1f7f9;
    --line: #c9d9df;
    --accent: #0f8b94;
    --accent-soft: #def4f5;
    --shadow: 0 12px 30px rgba(18, 42, 50, 0.10);
}

body {
    background: linear-gradient(180deg, #eaf4f7, #f8fafc);
    font: 14px/1.4 system-ui, Segoe UI, Roboto, Arial, sans-serif;
}

.engine-shell {
    width: auto;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding: 16px 18px;
}

.engine-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.engine-top h1 {
    font-size: 30px;
    line-height: 1.05;
}

.eyebrow {
    letter-spacing: 0.02em;
}

.host-box {
    align-items: end;
    gap: 8px;
}

.host-box label,
.host-context {
    width: min(360px, 45vw);
}

button,
.button-link {
    border-radius: 7px;
    font-weight: 650;
    padding: 9px 13px;
}

button.secondary,
.button-link.secondary {
    background: #f8fbfd;
    border-color: var(--line);
    color: var(--accent);
}

.card {
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.workspace,
.designer-workspace {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(260px, 340px) minmax(520px, 1fr);
    align-items: stretch;
    gap: 12px;
    min-height: calc(100vh - 96px);
}

.event-list-panel,
.field-list-panel {
    position: static;
    max-height: none;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.panel-title {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 14px 16px;
}

.panel-title h2 {
    font-size: 20px;
}

.panel-actions {
    gap: 8px;
}

.panel-subtitle {
    margin: 3px 0 0;
}

.event-list,
.field-list {
    display: block;
    list-style: none;
    margin: 0;
    max-height: calc(100vh - 185px);
    overflow: auto;
    padding: 10px;
}

.event-list li,
.field-list li {
    margin: 0;
}

.event-list button,
.field-row {
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
    min-height: auto;
    padding: 9px 10px;
    width: 100%;
}

.event-list button {
    background: #ffffff;
}

.event-list button.active,
.field-row.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: inset 4px 0 0 var(--accent);
}

.event-list-label,
.field-label {
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
}

.event-badge.main,
.runtime-user-badge {
    background: #d8f5f3;
    color: #0b6f73;
}

.event-badge.next,
.field-tag {
    background: #e7eef4;
    color: #244056;
}

.field-list-wrap {
    border: 0;
    border-radius: 0;
    max-height: none;
    overflow: visible;
}

.field-list-head,
.field-row {
    grid-template-columns: 52px 1fr 48px;
}

.field-list-head {
    background: #f4f8fb;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    display: grid;
    font-size: 11px;
    font-weight: 800;
    gap: 8px;
    padding: 8px 16px;
    text-transform: uppercase;
}

.field-list-head span:nth-child(4),
.field-tags {
    display: none;
}

.field-row {
    align-items: center;
    background: #ffffff;
    border-top: 1px solid var(--line);
}

.designer-main {
    display: block;
    min-width: 0;
}

.designer-card {
    min-height: 100%;
    overflow: hidden;
    padding: 0;
}

.designer-card-head {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    padding: 10px 14px 0;
}

.designer-card-head > div:first-child {
    display: none;
}

.designer-tabs {
    align-items: end;
    display: flex;
    gap: 0;
    justify-content: flex-end;
}

.designer-tab-button {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: var(--muted);
    padding: 10px 14px;
}

.designer-tab-button.active {
    background: transparent;
    border: 0;
    border-bottom: 3px solid var(--accent);
    color: var(--accent);
    font-weight: 700;
}

.designer-tab-panel {
    padding: 16px;
}

.event-panel-title,
.field-editor-title {
    display: none;
}

.editor-form,
.event-editor {
    display: grid;
    gap: 14px;
    margin-top: 0;
}

.form-grid,
.form-grid.event-grid,
.field-grid,
.runtime-user-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.event-id-field {
    grid-column: span 2;
}

.event-name-field {
    grid-column: span 10;
}

.event-next-field,
.event-action-field,
.event-sort-field {
    grid-column: span 2;
}

.event-save-label-field {
    grid-column: span 6;
}

.event-color-field {
    grid-column: span 3;
}

.event-icon-field {
    grid-column: span 4;
}

.lp-field,
.field-grid .lp-field {
    grid-column: span 2;
}

.alias-field,
.field-grid .alias-field {
    grid-column: span 10;
}

.field-mask-field,
.field-inline-field,
.field-stacked-field {
    grid-column: span 4;
}

.field-required-field,
.field-edit-field,
.field-visibility-field,
.field-refresh-field {
    grid-column: span 2;
}

.field-grid .lp-field input {
    max-width: none;
}

.wide,
.textarea-block,
.validation-box,
.field-sql-panel {
    grid-column: 1 / -1;
}

.field-sql-panel {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}

label,
fieldset {
    color: var(--text);
    font-weight: 650;
    gap: 5px;
    min-width: 0;
}

input,
select,
textarea {
    background: #f0f7fa;
    border-color: #bdd3db;
    min-width: 0;
    padding: 9px 10px;
}

input,
select {
    min-height: 38px;
}

textarea {
    font-family: Consolas, ui-monospace, SFMono-Regular, Menlo, monospace;
}

.icon-button {
    background: #e8f6f8;
    border: 1px solid #bdd3db;
    color: var(--accent);
    height: 26px;
    width: 26px;
}

.color-input-row,
.icon-input-row,
.mask-input-row {
    display: grid;
    gap: 7px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.color-input-row input[type="color"] {
    height: 38px;
    padding: 3px;
    width: 46px;
}

.textarea-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.snippet-tools {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: flex-end;
}

.snippet-tools select {
    min-width: 170px;
    width: auto;
}

.validation-box {
    border-radius: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 2px 0;
}

.permission-panel {
    padding: 16px;
}

.user-manager {
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
}

.runtime-user-list {
    max-width: none;
}

@media (max-width: 1100px) {
    .engine-top,
    .workspace,
    .designer-workspace,
    .user-manager,
    .users-toolbar {
        grid-template-columns: 1fr;
    }

    .host-box {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .host-box label,
    .host-context {
        width: 100%;
    }

    .event-id-field,
    .event-name-field,
    .event-next-field,
    .event-action-field,
    .event-sort-field,
    .event-save-label-field,
    .event-color-field,
    .event-icon-field,
    .lp-field,
    .field-grid .lp-field,
    .alias-field,
    .field-grid .alias-field,
    .field-mask-field,
    .field-required-field,
    .field-edit-field,
    .field-visibility-field,
    .field-refresh-field,
    .field-inline-field,
    .field-stacked-field,
    .runtime-user-email-field,
    .runtime-user-name-field,
    .runtime-user-password-field,
    .runtime-user-lp-field,
    .runtime-user-role-field,
    .runtime-user-mfa-field {
        grid-column: 1 / -1;
    }
}
