/* Shell Layout */

.editor-shell {
    display: flex;
    height: calc(100vh - 80px);   /* below fixed navbar */
    margin-top: 80px;
    overflow: hidden;
}

/* Left Sidebar */

.editor-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.editor-sidebar-header {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.editor-citizen-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.editor-citizen-icon {
    font-size: 1.1rem;
}

.editor-script-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.editor-sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
}

/* Script list items */
.editor-script-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.editor-script-item:hover {
    background: rgba(0, 212, 255, 0.06);
}

.editor-script-item.active {
    background: rgba(0, 212, 255, 0.1);
    border-left-color: var(--primary);
}

.editor-script-item.disabled {
    opacity: 0.45;
}

.editor-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}

.editor-status-dot.enabled {
    background: #22c55e;
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.5);
}

.editor-script-item-body {
    flex: 1;
    min-width: 0;
}

.editor-script-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.editor-script-item-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.editor-trigger-badge {
    font-size: 0.68rem;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0, 212, 255, 0.12);
    color: var(--primary);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
}

.editor-priority-badge {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ── Right Main Panel ─────────────────────────────────────────────────────── */

.editor-main {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem 6rem;    /* bottom padding for save bar */
    background: var(--bg-dark);
}

/* Empty / select prompt */
.editor-select-prompt {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.editor-select-prompt-inner {
    max-width: 340px;
}

.editor-select-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.editor-select-prompt h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.editor-select-prompt p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Meta bar */

.editor-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.editor-meta-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.editor-meta-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-meta-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    min-width: 0;
    width: 260px;
    transition: border-color 0.2s;
}

.editor-meta-input:focus {
    outline: none;
    border-color: var(--primary);
}

.editor-meta-input-sm {
    width: 80px;
}

.editor-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.editor-toggle-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
}

.editor-priority-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Zones */

.editor-zone {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.editor-zone-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.18);
}

.editor-zone-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.editor-zone-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.editor-zone-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--border);
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    vertical-align: middle;
}

.editor-zone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.editor-zone-dot-trigger   { background: var(--primary); }
.editor-zone-dot-condition { background: #f59e0b; }
.editor-zone-dot-action    { background: #22c55e; }

.editor-zone-trigger   { border-left: 3px solid var(--primary); }
.editor-zone-conditions { border-left: 3px solid #f59e0b; }
.editor-zone-actions   { border-left: 3px solid #22c55e; }
.editor-zone-json      { border-left: 3px solid var(--border); }

/* Trigger card */
.editor-trigger-card {
    padding: 0.9rem 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    min-height: 52px;
}

.editor-add-trigger-btn {
    width: fit-content;
    margin-left: 1.1rem;
    margin-bottom: 0.9rem;
}

.editor-trigger-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 0.45rem;
}

.editor-trigger-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.editor-trigger-type-badge {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
}

.editor-trigger-params {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Item List (conditions + actions) ────────────────────────────────────── */

.editor-item-list {
    padding: 0.4rem 0;
}

.editor-item-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 1.1rem;
    border-bottom: 1px solid rgba(42, 42, 58, 0.6);
    transition: background 0.12s;
    cursor: default;
}

.editor-item-row:last-child {
    border-bottom: none;
}

.editor-item-row:hover {
    background: rgba(255, 255, 255, 0.025);
}

.editor-drag-handle {
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: grab;
    padding-top: 2px;
    user-select: none;
    flex-shrink: 0;
}

.editor-item-index {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 18px;
    text-align: right;
    padding-top: 3px;
    flex-shrink: 0;
}

.editor-item-type-badge {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.18rem 0.5rem;
    border-radius: 5px;
    flex-shrink: 0;
    white-space: nowrap;
    font-weight: 700;
    line-height: 1.6;
}

.editor-item-type-badge.condition {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.editor-item-type-badge.action {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.editor-item-type-badge.flow {
    background: rgba(139, 92, 246, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.editor-item-type-badge.composite {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.editor-item-summary {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 3px;
}

.editor-item-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

/* Sub-block indented lists */
.editor-subblock {
    margin: 0.4rem 0 0.4rem 2rem;
    border-left: 2px dashed var(--border);
    padding-left: 0.75rem;
}

.editor-subblock-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.4rem 0.2rem 0.2rem;
    font-weight: 600;
}

.editor-branch-controls {
    display: flex;
    gap: 0.4rem;
    margin: 0.2rem 0 0.55rem;
}

.editor-flow-help,
.editor-action-guide {
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: rgba(0, 212, 255, 0.07);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    margin: 0.45rem 0 0.75rem;
    font-size: 0.8rem;
    line-height: 1.5;
}

.editor-action-guide {
    display: grid;
    gap: 0.45rem;
}

.editor-action-guide-title {
    color: var(--text);
    font-weight: 700;
    font-size: 0.84rem;
}

.editor-action-guide code {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.05rem 0.28rem;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}

.editor-scope-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.6rem;
}

.editor-random-branch {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem;
    margin: 0.65rem 0;
    background: rgba(255, 255, 255, 0.025);
}

.editor-random-branch-header {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
}

.editor-random-branch-title {
    color: var(--text);
    font-weight: 700;
    font-size: 0.88rem;
}

.editor-random-branch-chance {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
}

.editor-branch-weight-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.editor-branch-weight-input {
    width: 74px;
    padding: 0.38rem 0.45rem;
}

.editor-btn-danger {
    color: #ef4444;
}

/* JSON Preview */

.editor-json-preview {
    background: var(--bg-darker);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    max-height: 320px;
}

.editor-json-preview pre {
    margin: 0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #a0e0b0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Save Bar */

.editor-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    z-index: 200;
}

.editor-save-bar-inner {
    max-width: 100%;
    padding: 0.85rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.editor-dirty-indicator {
    font-size: 0.82rem;
    color: #f59e0b;
    font-weight: 600;
    flex: 1;
}

.editor-save-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    flex: 1;
}

/* Buttons */

.editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
    line-height: 1;
    padding: 0.6rem 1.2rem;
    font-size: 0.88rem;
}

.editor-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.editor-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #000;
}

.editor-btn-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.35);
}

.editor-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.editor-btn-ghost:not(:disabled):hover {
    color: var(--text);
    border-color: var(--primary);
}

.editor-btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.editor-btn-danger:not(:disabled):hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.editor-btn-icon {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    border-radius: 5px;
}

.editor-btn-icon:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border-color: var(--border);
}

.editor-btn-sm  { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.editor-btn-xs  { padding: 0.28rem 0.65rem; font-size: 0.78rem; border-radius: 6px; }

/* Modals */

.editor-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 300;
    backdrop-filter: blur(2px);
}

.editor-overlay.open { display: block; }

.editor-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    z-index: 400;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    max-height: 85vh;
    overflow: hidden;
    display: none;
    flex-direction: column;
    width: 560px;
    max-width: calc(100vw - 2rem);
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0;
}

.editor-modal.open {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.editor-modal-wide   { width: 780px; }
.editor-modal-medium { width: 620px; }
.editor-modal-small  { width: 440px; }

.editor-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.editor-modal-header h3 {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
}

.editor-modal-close,
.editor-modal-back {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0.4rem;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}

.editor-modal-close:hover,
.editor-modal-back:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}

.editor-modal-body {
    overflow-y: auto;
    padding: 1.25rem;
    flex: 1;
}

.editor-modal-params {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.editor-modal-params h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.editor-modal-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    justify-content: flex-end;
}

/* ── Type Picker Grid ─────────────────────────────────────────────────────── */

.editor-type-grid-container {
    padding: 0.5rem 1.25rem 1.25rem;
}

.editor-type-category-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 1rem 0 0.5rem;
}

.editor-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.editor-type-btn {
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text);
}

.editor-type-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.06);
}

.editor-type-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.editor-type-btn-name {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text);
    display: block;
    margin-bottom: 0.2rem;
}

.editor-type-btn-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.editor-recipe-label {
    color: var(--primary);
}

.editor-recipe-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.1rem;
}

.editor-recipe-card {
    border: 1px solid rgba(0, 212, 255, 0.18);
    background: rgba(0, 212, 255, 0.055);
    color: var(--text);
    border-radius: 8px;
    padding: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s, background-color 0.18s, transform 0.18s;
}

.editor-recipe-card:hover {
    border-color: rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-1px);
}

.editor-recipe-title {
    display: block;
    font-weight: 800;
    font-size: 0.86rem;
    margin-bottom: 0.25rem;
}

.editor-recipe-desc {
    display: block;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

/* Form Fields */

.editor-field-group {
    margin-bottom: 1rem;
}

.editor-field-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.editor-field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    opacity: 0.8;
}

.editor-input,
.editor-select,
.editor-textarea {
    width: 100%;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.55rem 0.8rem;
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.editor-input:focus,
.editor-select:focus,
.editor-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.editor-select {
    cursor: pointer;
}

.editor-textarea {
    resize: vertical;
    min-height: 80px;
}

.editor-textarea-tall {
    min-height: 220px;
}

.editor-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.editor-checkbox-row input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
}

.editor-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.editor-boolean-value-editor {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.editor-bool-choice {
    border: 1px solid var(--border);
    background: var(--bg-darker);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.55rem 0.8rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.editor-bool-choice:hover {
    border-color: var(--primary);
    color: var(--text);
}

.editor-bool-choice.active {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.14);
    color: var(--text);
}

.editor-list-value-editor {
    display: none;
}

.editor-list-value-rows {
    display: grid;
    gap: 0.45rem;
}

.editor-list-value-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem;
}

.editor-list-vars-btn {
    position: static;
    border: 1px solid var(--border);
    background: var(--bg-darker);
    min-width: 34px;
    min-height: 34px;
}

.editor-list-value-controls {
    margin-top: 0.5rem;
}

/* ── Save command box ─────────────────────────────────────────────────────── */

.editor-command-box {
    display: flex;
    align-items: center;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.editor-command-box code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    color: var(--primary);
    word-break: break-all;
}

.editor-expiry-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* Misc */

.editor-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
}

.editor-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.editor-empty-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.editor-info-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

.editor-mt-xs { margin-top: 0.5rem; }
.editor-ml-auto { margin-left: auto; }
.editor-p-sm { padding: 0.75rem 1.1rem; }

.editor-var-scope {
    margin-bottom: 1.25rem;
}

.editor-var-scope-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.editor-var-entry {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto auto minmax(150px, 1.2fr);
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.42rem 0;
    border-bottom: 1px solid rgba(42,42,58,0.5);
}

.editor-var-name {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
}

.editor-var-type,
.editor-var-source {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    white-space: nowrap;
}

.editor-var-type {
    color: var(--primary);
    background: rgba(0, 212, 255, 0.06);
}

.editor-var-value {
    color: var(--text-muted);
    word-break: break-all;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
}

.editor-validation-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.editor-validation-group.error {
    border-color: rgba(239, 68, 68, 0.45);
}

.editor-validation-group.warning {
    border-color: rgba(245, 158, 11, 0.45);
}

.editor-validation-heading {
    padding: 0.55rem 0.75rem;
    font-weight: 800;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.editor-validation-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.5fr);
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.055);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.editor-validation-row strong {
    color: var(--text);
    font-weight: 700;
}

.editor-validation-more {
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Responsive */

@media (max-width: 900px) {
    .editor-shell {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .editor-sidebar {
        width: 100%;
        height: auto;
        max-height: 260px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .editor-main {
        padding: 1rem 1rem 5rem;
    }

    .editor-meta-input {
        width: 200px;
    }
}

@media (max-width: 600px) {
    .editor-main {
        padding: 0.75rem 0.75rem 5rem;
    }

    .editor-modal {
        width: calc(100vw - 1rem);
        max-height: 92vh;
    }

    .editor-type-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .editor-field-row {
        grid-template-columns: 1fr;
    }
}

/* ── Premium UI Polish additions ── */

.editor-session-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    margin-top: 0.4rem;
    backdrop-filter: blur(4px);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.editor-session-timer-icon {
    font-size: 0.82rem;
    opacity: 0.85;
}

.editor-session-timer-text {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.editor-session-timer-time {
    color: var(--primary);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.3s ease;
}

/* Pulsing red warning for countdown when session is expiring (< 5 mins) */
@keyframes pulse-warning {
    0% { color: #ef4444; text-shadow: 0 0 4px rgba(239, 68, 68, 0.2); opacity: 1; }
    50% { color: #f87171; text-shadow: 0 0 10px rgba(239, 68, 68, 0.6); opacity: 0.75; }
    100% { color: #ef4444; text-shadow: 0 0 4px rgba(239, 68, 68, 0.2); opacity: 1; }
}

.session-timer-warning {
    animation: pulse-warning 1.8s infinite ease-in-out;
}

/* Enhancing nested condition boundaries visually */
.editor-subblock {
    position: relative;
    margin: 0.5rem 0 0.5rem 2.2rem;
    border-left: 2px solid rgba(0, 212, 255, 0.15);
    background: rgba(0, 212, 255, 0.015);
    padding: 0.4rem 0 0.4rem 0.85rem;
    border-radius: 0 8px 8px 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.editor-subblock:hover {
    border-left-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.03);
}

/* Smooth drag over style for dragging rows */
.editor-item-row.drag-over {
    border-top: 2px solid var(--primary);
    background: rgba(0, 212, 255, 0.05);
}

/* Variable selector styles */
.editor-input-with-button {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.editor-input-with-button .editor-input {
    flex: 1;
    padding-right: 2.5rem !important;
}
.editor-btn-vars {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 6px;
    border-radius: 4px;
    font-family: inherit;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
    z-index: 10;
}
.editor-btn-vars:hover {
    color: #fff;
    background-color: rgba(0, 212, 255, 0.2);
}
.editor-vars-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    max-height: 250px;
    overflow-y: auto;
    width: 250px;
    display: none;
    margin-top: 4px;
}

.editor-vars-dropdown-floating {
    position: absolute;
    width: 280px;
}
.editor-vars-dropdown-section {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.editor-vars-dropdown-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.editor-vars-dropdown-item:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--primary);
}
