:root {
    /* Brand */
    --primary: #21203e;
    --primary-hover: #5950f6;
    --secondary: #83e4b0;
    --tertiary: #5950f6;

    --primary-rgb: 33, 32, 62;
    --secondary-rgb: 131, 228, 176;
    --tertiary-rgb: 89, 80, 246;

    /* Colors */
    --background: #f3f4f6;
    --surface: #ffffff;
    --text-main: #111827;
    --text-secondary: #6B7280;
    --border: #e5e7eb;
    --danger: #ef4444;
    --success: var(--secondary);

    /* Layout */
    --editor-top-nav-height: 64px;

    /* Tag Colors */
    --tag-welcome-bg: rgba(var(--tertiary-rgb), 0.12);
    --tag-welcome-text: var(--tertiary);
    --tag-name-bg: #e9f2ff;
    --tag-name-text: #2F80ED;
    --tag-phone-bg: #fdf2f8;
    --tag-phone-text: #db2777;
    --tag-short-bg: #f0f9ff;
    --tag-short-text: #0284c7;
    --tag-choice-bg: rgba(var(--secondary-rgb), 0.22);
    --tag-choice-text: var(--primary);
    --tag-thanks-bg: rgba(var(--tertiary-rgb), 0.12);
    --tag-thanks-text: var(--primary);
    --tag-default-bg: #f3f4f6;
    --tag-default-text: #4b5563;

    /* Typography */
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.dashboard-page {
    background-color: var(--background);
}

body.editor-page {
    background-color: var(--background);
    --primary-hover: #322ddd;
    --tertiary: #322ddd;
    --tertiary-rgb: 50, 45, 221;
}

body.editor-page .top-nav {
    background: #322ddd;
}

/* User Menu */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.user-menu-btn:hover {
    background: #e5e7eb;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #d1d5db;
    position: relative;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px #cbd5e1;
}

.user-avatar::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f3f4f6;
}

.user-avatar::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 10px;
    border-radius: 10px 10px 6px 6px;
    background: #f3f4f6;
}

.user-name {
    white-space: nowrap;
}

.user-caret {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 50;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s ease, color 0.15s ease;
}

.user-dropdown-item:hover {
    background: #f3f4f6;
}

.user-dropdown-item.danger {
    color: var(--danger);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* Editor Layout */
.editor-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top Nav */
.top-nav {
    height: var(--editor-top-nav-height);
    background: var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    flex-shrink: 0;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 14px;
}

.back-btn {
    color: inherit;
    text-decoration: none;
    font-size: 18px;
    margin-right: 8px;
}

.form-title {
    font-weight: 600;
    color: inherit;
}

.form-title-editable {
    cursor: text;
    padding: 2px 6px;
    border-radius: 6px;
}

.form-title-editable:focus {
    outline: none;
    background: rgba(var(--tertiary-rgb), 0.12);
    box-shadow: 0 0 0 2px rgba(var(--tertiary-rgb), 0.22);
}

.nav-center {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 18px 0;
    position: relative;
}

.nav-link.active {
    color: var(--text-main);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-main);
}

.nav-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-nav-outline {
    border: 1px solid var(--border);
    background: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
}

.btn-nav-outline svg {
    width: 14px;
    height: 14px;
    display: block;
}

.btn-nav-outline:hover {
    background: #f9fafb;
}

.btn-nav-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-nav-primary:hover {
    background: var(--primary-hover);
}

/* Top nav brand theme */
.top-nav,
.top-nav .back-btn,
.top-nav .form-title {
    color: #fff;
}

.top-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.top-nav .nav-link:hover,
.top-nav .nav-link.active {
    color: #fff;
}

.top-nav .nav-link.active::after {
    background: #fff;
}

.top-nav .nav-tab.active {
    color: var(--primary);
}

.top-nav .nav-tab.active svg {
    stroke: var(--primary);
}

.top-nav .form-title-editable:focus {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.top-nav .btn-nav-outline {
    background: #fff;
    border-color: rgba(255, 255, 255, 0.8);
    color: #0f172a;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
}

.top-nav .btn-nav-outline:hover {
    background: rgba(255, 255, 255, 0.92);
}

.top-nav .btn-nav-primary {
    background: #111827;
    color: #fff;
    border: 1px solid rgba(15, 23, 42, 0.2);
    padding: 8px 20px;
    border-radius: 10px;
    font-weight: 600;
}

.top-nav .btn-nav-primary:hover {
    background: #0f172a;
}

.top-nav .btn-nav-primary.btn-publish {
    background: #fff;
    color: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.82);
}

.top-nav .btn-nav-primary.btn-publish:hover {
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-hover);
}

.top-nav .btn-nav-primary.btn-publish:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.top-nav .nav-tools {
    padding: 6px;
}

.top-nav .nav-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.top-nav .nav-icon-btn svg {
    width: 18px;
    height: 18px;
}

.top-nav .nav-title {
    padding: 6px 10px;
    font-size: 15px;
}

.top-nav .nav-tab {
    padding: 8px 14px;
}

.nav-tools {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.nav-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
}

.nav-icon-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nav-icon-btn:disabled,
.nav-icon-btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-toggle-btn {
    display: none;
}

.nav-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
}

.nav-title.form-title-editable:focus {
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.nav-pills {
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.nav-tab {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
}

.nav-tab svg {
    width: 14px;
    height: 14px;
    display: block;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.18);
}

.nav-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 6px 16px -12px rgba(15, 23, 42, 0.4);
}

.nav-tab.active svg {
    stroke: var(--primary);
}

.nav-tab.nav-link::after,
.nav-tab.nav-link.active::after {
    content: none;
}

.nav-tab:disabled,
.nav-tab.nav-tab-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Main Content */
.editor-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    /* Context for absolute popover if needed, but we might place popover in canvas card */
}

.drawer-backdrop {
    position: fixed;
    inset: var(--editor-top-nav-height) 0 0 0;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 1100;
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Properties Drawer */
.properties-drawer {
    width: 0;
    background: #fff;
    border-left: 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: width 0.25s ease, opacity 0.18s ease, border-color 0.25s ease;
}

.properties-drawer.active {
    width: 360px;
    border-left: 1px solid var(--border);
    opacity: 1;
    pointer-events: auto;
}

.properties-drawer .properties-header {
    flex: none;
}

.properties-drawer .properties-form {
    flex: 1;
    overflow-y: auto;
}

.properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.properties-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.close-prop-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-list {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.sidebar-item {
    display: flex;
    padding: 12px;
    margin-bottom: 4px;
    cursor: pointer;
    border-radius: 6px;
    background: transparent;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.sidebar-item:hover {
    background: #f9fafb;
    border-color: var(--border);
}

.sidebar-item.active {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.sidebar-item.dragging {
    opacity: 0.5;
}

.sidebar-item.drag-over {
    border-color: var(--primary);
    background: rgba(var(--tertiary-rgb), 0.1);
}

.border-indicator {
    width: 3px;
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    background: transparent;
    border-radius: 0 4px 4px 0;
}

.sidebar-item.active .border-indicator {
    background: var(--primary);
}

@media (max-width: 980px) {
    .sidebar-toggle-btn {
        display: inline-flex;
    }

    body.editor-page .nav-center {
        display: none;
    }

    body.editor-page .top-nav {
        padding: 0 12px;
        gap: 10px;
    }

    body.editor-page .nav-left {
        min-width: 0;
    }

    body.editor-page .nav-title {
        max-width: 46vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.editor-page .sidebar {
        position: fixed;
        top: var(--editor-top-nav-height);
        left: 0;
        bottom: 0;
        width: min(320px, 86vw);
        border-right: 1px solid var(--border);
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 1200;
        box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    }

    body.editor-page.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.editor-page .properties-drawer {
        position: fixed;
        top: var(--editor-top-nav-height);
        right: 0;
        bottom: 0;
        width: min(360px, 92vw);
        border-left: 1px solid var(--border);
        transform: translateX(105%);
        transition: transform 0.25s ease, opacity 0.18s ease;
        opacity: 0;
        pointer-events: none;
        z-index: 1200;
        box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    }

    body.editor-page .properties-drawer.active {
        width: min(360px, 92vw);
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    body.editor-page .canvas-body {
        padding: 32px 18px;
    }

    body.editor-page .floating-actions {
        right: 12px;
    }
}

@media (max-width: 480px) {
    body.editor-page .nav-title {
        max-width: 42vw;
    }

    body.editor-page .canvas-body {
        padding: 24px 14px;
    }
}

@media (max-width: 640px) {
    body.editor-page .nav-right {
        gap: 6px;
    }

    body.editor-page .top-nav .nav-icon-btn {
        width: 34px;
        height: 34px;
    }

    body.editor-page .top-nav .btn-nav-primary.btn-publish {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    body.editor-page .nav-title {
        max-width: 38vw;
    }

    body.editor-page .top-nav .btn-nav-primary.btn-publish {
        padding: 8px 10px;
        font-size: 11px;
    }
}

.item-number {
    width: 24px;
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 2px;
}

.item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.item-tag {
    align-self: flex-start;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: capitalize;
}

.item-logic {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    background: #f8fafc;
    line-height: 1;
    white-space: nowrap;
}

.item-logic svg {
    width: 12px;
    height: 12px;
    display: block;
}

.item-logic.is-active {
    border-color: rgba(var(--tertiary-rgb), 0.5);
    color: var(--tertiary);
    background: rgba(var(--tertiary-rgb), 0.14);
}

.item-logic.is-inactive {
    opacity: 0.75;
}

.item-actions {
    display: none;
    margin-left: auto;
    gap: 8px;
    color: var(--text-secondary);
}

.sidebar-item:hover .item-actions {
    display: flex;
}

.action-icon {
    cursor: pointer;
    border: none;
    background: transparent;
    color: #9ca3af;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
    position: relative;
}

.action-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.action-icon:hover {
    color: var(--primary-hover);
    background: rgba(var(--tertiary-rgb), 0.12);
}

.action-icon.action-danger:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.action-icon.is-disabled:hover,
.action-icon[aria-disabled="true"]:hover {
    color: #9ca3af;
    background: transparent;
}

.action-icon.is-disabled,
.action-icon[aria-disabled="true"] {
    cursor: help;
}

.action-icon.is-disabled svg,
.action-icon[aria-disabled="true"] svg {
    opacity: 0.35;
}

.action-icon.is-disabled::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 1;
    transform: translateY(0);
    pointer-events: none;
    transition: none;
    box-shadow: 0 8px 16px -10px rgba(15, 23, 42, 0.6);
    z-index: 10;
}

.action-icon.is-disabled::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    right: 10px;
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    opacity: 1;
    transform: translateY(0);
    transition: none;
    pointer-events: none;
    z-index: 10;
}

.action-icon.is-disabled:hover::after,
.action-icon.is-disabled:hover::before {
    opacity: 1;
    transform: translateY(0);
}

.action-icon:focus-visible {
    outline: 2px solid rgba(239, 68, 68, 0.35);
    outline-offset: 2px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    position: relative;
}

#fieldTypesMenu {
    max-height: 520px;
    max-height: min(62vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.add-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 14px;
}

.add-btn:hover {
    background: rgba(var(--tertiary-rgb), 0.12);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    background: var(--background);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    overflow: hidden;
    transition: width 0.3s;
}

body.editor-page .canvas-area {
    background: var(--background);
}

.canvas-card {
    background: #fff;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
}

.canvas-header {
    min-height: 56px;
    height: auto;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f7fb 100%);
    border-bottom: 1px solid #e5e9f0;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.badge-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 10px -8px rgba(15, 23, 42, 0.25);
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
}

.canvas-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 860px) {
    .canvas-header {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
        flex-wrap: nowrap;
    }

    .badge-wrapper {
        width: 100%;
        justify-content: flex-start;
    }

    .canvas-header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .canvas-header .btn-nav-outline {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .canvas-header-actions {
        grid-template-columns: 1fr;
    }
}

.required-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 12px;
    color: #475569;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
}

.required-toggle .checkbox-input {
    width: 14px;
    height: 14px;
}

.form-score-toggle {
    border-color: rgba(16, 185, 129, 0.25);
}

.form-score-toggle .checkbox-input {
    accent-color: #10b981;
}

.form-score-toggle.is-on {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: #047857;
}

.logic-pill {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.logic-pill.active {
    color: var(--primary);
    border-color: rgba(var(--tertiary-rgb), 0.4);
    background: rgba(var(--tertiary-rgb), 0.12);
}

.logic-pill:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.field-type-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(var(--tertiary-rgb), 0.12);
    border: 1px solid rgba(var(--tertiary-rgb), 0.35);
    border-radius: 999px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.canvas-header .btn-nav-outline {
    padding: 6px 12px;
    border-radius: 8px;
    background: #ffffff;
    border-color: #e2e8f0;
    color: #475569;
    box-shadow: 0 2px 8px -6px rgba(15, 23, 42, 0.2);
}

.canvas-header .btn-nav-outline:hover {
    background: #f8fafc;
    color: #0f172a;
}

.canvas-header .btn-nav-outline.options-btn {
    border-color: rgba(var(--tertiary-rgb), 0.45);
    background: rgba(var(--tertiary-rgb), 0.12);
    color: var(--primary);
    box-shadow: 0 8px 18px -12px rgba(var(--tertiary-rgb), 0.55);
    font-weight: 600;
}

.canvas-header .btn-nav-outline.options-btn:hover {
    background: rgba(var(--tertiary-rgb), 0.18);
    border-color: rgba(var(--tertiary-rgb), 0.7);
}

.canvas-header .btn-nav-outline.options-btn.is-active {
    background: rgba(var(--tertiary-rgb), 0.24);
    border-color: rgba(var(--tertiary-rgb), 0.85);
    box-shadow: 0 0 0 2px rgba(var(--tertiary-rgb), 0.18), 0 10px 22px -14px rgba(var(--tertiary-rgb), 0.7);
}

.canvas-body {
    flex: 1;
    padding: 60px 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.canvas-content {
    width: 100%;
    max-width: 640px;
}

.canvas-content.is-final,
.canvas-content.is-centered {
    text-align: center;
}

.canvas-content.is-final .canvas-input-preview,
.canvas-content.is-centered .canvas-input-preview {
    margin-left: auto;
    margin-right: auto;
}

.canvas-content.is-final .field-media,
.canvas-content.is-centered .field-media {
    justify-content: center;
    text-align: center;
}

.canvas-content.is-final .field-media img,
.canvas-content.is-final .field-media iframe,
.canvas-content.is-final .media-frame,
.canvas-content.is-centered .field-media img,
.canvas-content.is-centered .field-media iframe,
.canvas-content.is-centered .media-frame {
    margin-left: auto;
    margin-right: auto;
}

.final-check-icon {
    width: clamp(54px, 6.2vw, 62px);
    height: clamp(54px, 6.2vw, 62px);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.04);
    border: 2px solid #111111;
    color: #111111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 18px 0;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.canvas-content.is-final .final-check-icon {
    margin-left: auto;
    margin-right: auto;
}

.final-check-icon svg {
    width: clamp(24px, 3vw, 28px);
    height: clamp(24px, 3vw, 28px);
    display: block;
}

/* Global Resets affecting contenteditable */
[contenteditable]:focus {
    outline: none;
}

/* Editor: hint that contenteditable text is clickable */
body.editor-page [contenteditable="true"] {
    cursor: text;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

body.editor-page [contenteditable="true"]:hover {
    background-color: rgba(15, 23, 42, 0.04) !important;
}

.editable-title,
.editable-desc {
    background-color: transparent !important;
}

.editable-title *,
.editable-desc * {
    background-color: transparent !important;
}

/* Typography */
.editable-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 14px;
    line-height: 1.3;
    outline: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px;
    transition: all 0.2s;
    white-space: pre-wrap;
    /* Preserve line breaks */
}

.editable-title:hover {
    border-color: #e5e7eb;
}

.editable-title:focus {
    border-color: var(--primary);
    background: transparent !important;
}

.editable-desc {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.5;
    outline: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px;
    white-space: pre-wrap;
    /* Preserve line breaks */
    resize: none;
}

.editable-desc[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
}

.editable-desc:focus {
    background: rgba(0, 0, 0, 0.02);
}

.canvas-input-preview {
    margin-top: 40px;
    pointer-events: none;
    /* Non-interactive in editor */
    max-width: 520px;
}

.canvas-input-preview.is-interactive {
    pointer-events: auto;
}

.canvas-input-preview input,
.canvas-input-preview textarea {
    width: 100%;
}

.choice-builder {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
}

.choice-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.choice-letter {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.choice-text {
    flex: 1;
    font-size: 16px;
    color: var(--text-main);
    outline: none;
}

.choice-remove {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 6px;
}

.choice-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.choice-add {
    display: flex;
    gap: 12px;
    align-items: center;
}

.choice-add .form-input {
    flex: 1;
}

.choice-empty {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 2px;
}

.image-choice-builder {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-choice-item {
    display: grid;
    grid-template-columns: 72px 1fr 32px;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.image-choice-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: #f3f4f6;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border);
}

.image-choice-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.image-choice-label {
    font-weight: 600;
    font-size: 14px;
}

.image-choice-remove {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
}

.image-choice-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.image-choice-add {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

.rating-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rating-dot {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f9fafb;
}

.message-preview {
    padding: 12px 16px;
    border: 1px dashed #cbd5f5;
    border-radius: 10px;
    color: var(--text-secondary);
    background: #f8fafc;
}

.calendly-builder-card {
    width: min(100%, 640px);
    border: 1px solid #dbe3f1;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendly-builder-card.is-empty {
    background: #f8fafc;
}

.calendly-builder-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.calendly-builder-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(var(--secondary-rgb), 0.26);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.calendly-builder-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.calendly-builder-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.calendly-builder-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.calendly-builder-sub {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.calendly-builder-frame {
    border: 1px solid #dbe3f1;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.calendly-builder-frame iframe {
    width: 100%;
    height: 290px;
    border: 0;
    display: block;
    pointer-events: none;
}

.calendly-builder-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(var(--tertiary-rgb), 0.3);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: #fff;
    pointer-events: none;
}

.calendly-builder-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.calendly-builder-input {
    width: 100%;
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    color: #6b7280;
    background: #fff;
}

.calendly-builder-action {
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(var(--tertiary-rgb), 0.35);
    background: rgba(var(--secondary-rgb), 0.18);
    color: var(--primary);
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
}

.terms-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.terms-preview .terms-btn {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: default;
}

.terms-preview-label {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.calendly-option-group .form-input {
    margin-bottom: 2px;
}

.calendly-prop-hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.calendly-prop-preview {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    margin-top: 4px;
}

.calendly-prop-preview iframe {
    width: 100%;
    height: 360px;
    border: 0;
    display: block;
}

.calendly-prop-empty {
    margin-top: 4px;
    padding: 12px 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
}

@media (max-width: 760px) {
    .calendly-builder-row {
        grid-template-columns: 1fr;
    }

    .calendly-builder-frame iframe {
        height: 240px;
    }

    .calendly-prop-preview iframe {
        height: 300px;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #111827;
    color: #fff;
    padding: 12px 36px 14px 16px;
    border-radius: 10px;
    box-shadow: 0 12px 24px -16px rgba(15, 23, 42, 0.6);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 320px;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
}

.toast.info {
    background: #1f2937;
}

.toast.warning {
    background: #92400e;
}

.toast.success {
    background: #065f46;
}

.toast.error {
    background: #b91c1c;
}

.toast.hide {
    opacity: 0;
    transform: translateY(-6px);
}

.toast-message {
    display: block;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 2px;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.6);
    transform-origin: left;
    animation: toast-progress 3s linear forwards;
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Inline Text Toolbar */
.text-toolbar {
    position: fixed;
    z-index: 1500;
    display: flex;
    gap: 6px;
    background: #111827;
    color: #fff;
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.6);
}

.text-toolbar.hidden {
    display: none;
}

.toolbar-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.preview-btn-lg {
    background: #dc2626;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.2;
    max-width: 100%;
    text-align: center;
}

.preview-btn-edit {
    cursor: text;
    user-select: text;
}

.preview-btn-text {
    display: inline-block;
    white-space: pre-wrap;
    line-height: 1.2;
}

.preview-btn-text:focus {
    outline: none;
}

body.editor-page .preview-btn-text[data-editable-button-text],
body.editor-page .btn-editable-text[data-editable-button-text] {
    padding: 2px 10px;
    border-radius: 10px;
    transition: background-color 0.15s ease;
}

body.editor-page .canvas-input-preview .btn-nav-primary[role="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: text;
    user-select: text;
}

body.editor-page .preview-btn-text[data-editable-button-text]:hover,
body.editor-page .btn-editable-text[data-editable-button-text]:hover {
    background-color: rgba(255, 255, 255, 0.22) !important;
}

body.editor-page .preview-btn-edit:hover .preview-btn-text[data-editable-button-text],
body.editor-page .canvas-input-preview .btn-nav-primary[role="button"]:hover .btn-editable-text[data-editable-button-text] {
    background-color: rgba(255, 255, 255, 0.22) !important;
}

body.editor-page .preview-btn-text[data-editable-button-text]:focus,
body.editor-page .btn-editable-text[data-editable-button-text]:focus {
    background-color: rgba(255, 255, 255, 0.22) !important;
}

/* Floating Actions */
.floating-actions {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.float-btn {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-size: 18px;
    transition: all 0.2s;
}

.float-btn:hover {
    background: #f9fafb;
    color: var(--primary);
}

.float-btn.add-main {
    background: transparent;
    color: var(--primary);
    font-size: 24px;
    border: none;
}

.float-btn.add-main:hover {
    background: transparent;
    color: var(--primary-hover);
    transform: scale(1.1);
}

.help-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(var(--tertiary-rgb), 0.35);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.help-btn-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

/* Properties Panel */
.properties-panel {
    border-left: 1px solid var(--border);
    border-right: none;
    width: 300px;
    /* Fixed width like sidebar */
}

.properties-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.properties-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.close-prop-btn {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
}

.properties-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.logic-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
}

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

.logic-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.logic-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.logic-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.logic-summary-item {
    font-size: 12px;
    color: var(--text-secondary);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    line-height: 1.35;
}

.logic-summary-item strong {
    color: var(--text-main);
    font-weight: 600;
}

.logic-edit-btn {
    justify-content: center;
    width: 100%;
}

.logic-add-btn {
    justify-content: center;
    width: 100%;
}

.lead-score-config {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
}

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

.lead-score-config-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.lead-score-weight-badge {
    min-width: 34px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(var(--tertiary-rgb), 0.28);
    background: rgba(var(--tertiary-rgb), 0.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.lead-score-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lead-score-input-row input[type="range"] {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: var(--primary);
}

.form-input.lead-score-number {
    width: 92px;
    max-width: 92px;
    flex: 0 0 92px;
}

.lead-score-help {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.lead-score-impact {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.lead-score-option-group {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-score-option-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.lead-score-option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-score-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.lead-score-option-label {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 12px;
}

.lead-score-option-label > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-score-option-key {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.form-input.lead-score-option-input {
    width: 84px;
    max-width: 84px;
    flex: 0 0 84px;
}

.lead-score-option-empty {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: #f8fafc;
}

.final-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

.final-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.final-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.final-info {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    cursor: default;
    user-select: none;
}

.final-type-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.final-type-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 14px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.final-type-card:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.final-type-card.active {
    border-color: rgba(37, 99, 235, 0.55);
    background: rgba(37, 99, 235, 0.06);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.final-type-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.final-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
    padding: 24px;
}

.final-modal.hidden {
    display: none;
}

.final-modal-card {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--border);
}

.final-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.final-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.final-modal-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.final-close-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.final-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.final-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

/* Ensure fonts are applied to inputs */
input,
textarea,
select,
button {
    font-family: var(--font-family);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-main);
    transition: border-color 0.2s;
}

.form-input.rich-text-input {
    min-height: 92px;
    line-height: 1.45;
    cursor: text;
    overflow-y: auto;
    resize: vertical;
}

.form-input.rich-text-input:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
}

.form-input.font-select {
    min-height: 56px;
    padding: 12px 48px 12px 16px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.25;
    border-width: 1.5px;
    border-radius: 14px;
    border-color: #c5d2e6;
    background-color: #fbfcff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.form-input.font-select:hover {
    border-color: #afc0dc;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(28, 64, 130, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.form-input.font-select:focus {
    border-color: #7f9bcf;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(70, 110, 190, 0.14), 0 6px 16px rgba(28, 64, 130, 0.13);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--tertiary-rgb), 0.22);
}

/* File Upload (Viewer) */
.file-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 420px;
}

.file-upload-box {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.file-upload-box:hover {
    border-color: rgba(var(--tertiary-rgb), 0.6);
    background: #f3f4f6;
}

.file-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-upload-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(var(--secondary-rgb), 0.22);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-upload-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.file-upload-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.file-upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.file-upload-button {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.file-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.logic-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
    padding: 24px;
}

.logic-modal.hidden {
    display: none;
}

.logic-modal-card {
    width: 100%;
    max-width: 900px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 18px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: 1px solid var(--border);
}

.logic-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logic-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.logic-modal-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.logic-close-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.logic-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logic-rule-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(200px, 1fr) 36px;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
}

.logic-rule-row.has-error {
    border-color: #fecaca;
    background: #fef2f2;
}

.logic-rule-row .form-input.error {
    border-color: #f87171;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}

.logic-rule-row .form-input {
    height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    background: #fff;
    border-radius: 10px;
}

.logic-rule-actions {
    display: flex;
    justify-content: flex-end;
}

.logic-remove-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logic-remove-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

.logic-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.logic-modal-body .logic-hint {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

.logic-modal-body .logic-edit-btn {
    width: 100%;
    justify-content: center;
    background: #f8fafc;
    border: 1px dashed var(--border);
    color: var(--text-main);
}

@media (max-width: 720px) {
    .logic-modal-card {
        max-width: 95vw;
    }

    .logic-rule-row {
        grid-template-columns: 1fr;
    }

    .logic-rule-actions {
        justify-content: flex-end;
    }
}

.share-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
    padding: 24px;
}

.share-modal.hidden {
    display: none;
}

.share-modal-card {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.share-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.share-modal-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.share-close-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.share-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}

.share-input-row .form-input {
    flex: 1;
}

.share-modal-footnote {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.share-config-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    z-index: 2050;
    padding: 24px;
}

.share-config-modal.hidden {
    display: none;
}

.share-config-card {
    width: 100%;
    max-width: 620px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 44px rgba(15, 23, 42, 0.22);
    border: 1px solid #dbe3f1;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-config-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.share-config-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
}

.share-config-sub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.share-config-close-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.share-config-body {
    display: grid;
    gap: 14px;
}

.share-config-body .form-group {
    margin: 0;
}

.share-config-count {
    margin-top: 5px;
    font-size: 11px;
    color: #64748b;
    text-align: right;
}

.share-config-hint {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
    padding: 10px 12px;
}

.share-config-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.share-config-footer #shareConfigClearBtn {
    margin-right: auto;
}

@media (max-width: 640px) {
    .share-config-card {
        max-height: calc(100vh - 52px);
        overflow-y: auto;
        padding: 18px;
    }
}

/* Buttons */
.btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.05s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 18px -12px rgba(var(--tertiary-rgb), 0.45);
}

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

.btn-secondary {
    background: #fff;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f9fafb;
}

.btn-google {
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    box-shadow: none;
    font-weight: 500;
}

a.btn-google,
a.btn-google:visited,
a.btn-google:hover,
a.btn-google:active {
    color: #3c4043;
}

.btn-google:hover {
    background: #f8f9fa;
}

.btn-google:active {
    background: #f1f3f4;
}

.btn-google:focus-visible {
    outline: none;
    border-color: rgba(66, 133, 244, 0.65);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
}

.btn-google-icon {
    width: 18px;
    height: 18px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    white-space: nowrap;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled,
.btn-primary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-input {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Modal Helpers */
.hidden {
    display: none !important;
}

/* Dropdown Menus */
.type-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 50;
    min-width: 220px;
    padding: 6px;
    animation: fadeIn 0.1s ease-out;
    max-height: 60vh;
    overflow-y: scroll;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #cbd5f5 transparent;
}

.type-dropdown::-webkit-scrollbar {
    width: 8px;
}

.type-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.type-dropdown::-webkit-scrollbar-thumb {
    background: rgba(var(--tertiary-rgb), 0.28);
    border-radius: 999px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item.selected {
    background: rgba(var(--tertiary-rgb), 0.12);
    color: var(--primary);
}

.dd-label {
    flex: 1;
}

.dd-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex-shrink: 0;
}

.dd-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.dd-check {
    font-size: 12px;
    color: var(--primary);
}

/* Authentication Layout */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    font-family: var(--font-family);
    background: radial-gradient(1200px 600px at 15% -20%, rgba(var(--tertiary-rgb), 0.2) 0%, rgba(var(--tertiary-rgb), 0.06) 45%, #ffffff 100%);
    position: relative;
    overflow: hidden;
}

.auth-container::before,
.auth-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-container::before {
    width: 420px;
    height: 420px;
    top: -160px;
    right: -140px;
    background: radial-gradient(circle, rgba(var(--tertiary-rgb), 0.22) 0%, rgba(var(--tertiary-rgb), 0) 70%);
}

.auth-container::after {
    width: 320px;
    height: 320px;
    bottom: -120px;
    left: -80px;
    background: radial-gradient(circle, rgba(var(--secondary-rgb), 0.18) 0%, rgba(var(--secondary-rgb), 0) 70%);
}

.auth-box {
    background: var(--surface);
    padding: 44px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px -24px rgba(15, 23, 42, 0.35), 0 8px 20px -12px rgba(15, 23, 42, 0.2);
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(var(--tertiary-rgb), 0.18);
    position: relative;
    z-index: 1;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.auth-logo-img {
    height: auto;
    width: auto;
    max-height: 52px;
    max-width: 100%;
    display: block;
    object-fit: contain;
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.auth-box form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-box .form-input {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.auth-box .form-input:focus {
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--tertiary-rgb), 0.25);
}

.auth-box .form-input::placeholder {
    color: #9ca3af;
}

.auth-box input:-webkit-autofill,
.auth-box input:-webkit-autofill:hover,
.auth-box input:-webkit-autofill:focus,
.auth-box input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-main);
    box-shadow: 0 0 0 1000px #f9fafb inset;
    transition: background-color 5000s ease-in-out 0s;
}

.auth-box .btn,
.auth-box .btn-primary {
    width: 100%;
    min-height: 48px;
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 12px;
    display: flex;
    margin-top: 6px;
}

.auth-box .btn-primary {
    box-shadow: 0 10px 18px -12px rgba(var(--tertiary-rgb), 0.45);
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.confirm-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2100;
    padding: 24px;
}

.confirm-modal.hidden {
    display: none;
}

.confirm-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
    padding: 20px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--border);
    position: relative;
}

.confirm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.confirm-close-btn {
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.confirm-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.confirm-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.confirm-btn.danger {
    background: #ef4444;
}

.media-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 2000;
    padding: 24px;
}

.media-modal.hidden {
    display: none;
}

.media-modal-card {
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.media-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.media-modal-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.media-close-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.media-tabs {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.media-tab {
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.media-tab.active {
    color: var(--text-main);
    border-bottom-color: var(--text-main);
}

.media-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 4px;
}

.media-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.media-panel.hidden {
    display: none;
}

.media-drop {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.media-drop input[type="file"] {
    display: none;
}

.media-drop-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.media-preview {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #f9fafb;
    color: var(--text-secondary);
    min-height: 120px;
    max-height: 260px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.media-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.media-preview iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 10px;
}

.media-help {
    font-size: 12px;
    color: var(--text-secondary);
}

.media-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.media-remove-btn {
    margin-right: auto;
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.field-media {
    width: 100%;
    margin-bottom: 18px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
}

.field-media img,
.field-media iframe {
    width: 100%;
    max-width: 720px;
    margin-left: 0;
}

.field-media img {
    max-height: 320px;
    object-fit: contain;
    display: block;
    margin-right: auto;
}

.field-media iframe {
    max-height: 320px;
}

.media-frame {
    width: 100%;
    max-width: 720px;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid var(--border);
    align-self: flex-start;
    margin-right: auto;
}

.media-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
}

.media-link:hover {
    text-decoration: underline;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
}

.alert-danger {
    background-color: #fef2f2;
    color: var(--danger);
    border: 1px solid #fee2e2;
}

.alert-success {
    background-color: rgba(var(--secondary-rgb), 0.22);
    color: var(--primary);
    border: 1px solid rgba(var(--secondary-rgb), 0.38);
}

/* Plan Warnings (Editor) */
.plan-warning-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 20px 0;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(var(--tertiary-rgb), 0.16), rgba(var(--secondary-rgb), 0.2));
    border: 1px solid rgba(var(--tertiary-rgb), 0.2);
    box-shadow: 0 12px 24px -20px rgba(15, 23, 42, 0.35);
}

.plan-warning-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-warning-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.plan-warning-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.plan-warning-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
}

.plan-warning-limits {
    font-size: 12px;
    color: var(--text-secondary);
}

.plan-warning-actions .btn {
    padding: 10px 14px;
    font-size: 13px;
}

/* Plan Upgrade Screen */
body.plan-upgrade-page {
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(89, 80, 246, 0.18), transparent 55%),
        radial-gradient(circle at bottom right, rgba(131, 228, 176, 0.2), transparent 55%),
        #f4f5ff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.plan-upgrade-shell {
    width: min(960px, 100%);
}

.plan-upgrade-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 24px 48px -30px rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
}

.plan-upgrade-head {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.plan-upgrade-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #322ddd, #83e4b0);
    color: #fff;
    box-shadow: 0 14px 26px -18px rgba(15, 23, 42, 0.6);
}

.plan-upgrade-kicker {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.plan-upgrade-title {
    font-size: 24px;
    font-weight: 700;
    margin: 6px 0 8px;
    color: var(--text-main);
}

.plan-upgrade-sub {
    font-size: 14px;
    color: var(--text-secondary);
}

.plan-upgrade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.plan-upgrade-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.plan-upgrade-item h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.plan-upgrade-item p {
    font-size: 13px;
    color: var(--text-secondary);
}

.plan-upgrade-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.plan-upgrade-list li {
    position: relative;
    padding-left: 22px;
    font-size: 13px;
    color: var(--text-main);
}

.plan-upgrade-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--tertiary);
    font-weight: 700;
}

.plan-upgrade-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .plan-warning-banner {
        flex-direction: column;
        align-items: flex-start;
        margin: 10px 16px 0;
    }

    .plan-warning-actions {
        width: 100%;
    }

    .plan-warning-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .plan-upgrade-card {
        padding: 24px;
    }

    .plan-upgrade-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .auth-box {
        padding: 32px 24px;
    }

    .auth-title {
        font-size: 20px;
    }
}


/* Options View Layout */
.options-view {
    display: block;
    flex: 1;
    background: #f9fafb;
    overflow-y: auto;
}

.options-content {
    flex: 1;
    overflow: visible;
    padding: 40px 60px;
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.options-content.full-width {
    max-width: 920px;
}

@media (max-width: 900px) {
    .options-content {
        padding: 28px 20px;
    }
}

@media (max-width: 480px) {
    .options-content {
        padding: 20px 14px;
    }
}

.opt-section {
    margin-bottom: 40px;
}

.opt-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
}

.opt-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.opt-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

.opt-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.button-shape-control {
    margin-top: 20px;
    border: 1px solid #dbe3f1;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.button-shape-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.button-shape-desc {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.button-shape-value {
    min-width: 70px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(var(--tertiary-rgb), 0.26);
    background: rgba(var(--tertiary-rgb), 0.09);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.button-shape-slider {
    width: min(100%, 340px);
    align-self: center;
    appearance: none;
    -webkit-appearance: none;
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    outline: none;
}

.button-shape-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--primary);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
    cursor: pointer;
}

.button-shape-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--primary);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
    cursor: pointer;
}

.button-shape-slider::-moz-range-track {
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
}

.button-shape-labels {
    display: flex;
    justify-content: space-between;
    width: min(100%, 340px);
    align-self: center;
    font-size: 12px;
    color: #64748b;
}

.button-shape-preview {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

.button-shape-preview-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    min-height: 52px;
    padding: 12px 38px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 24px -18px rgba(15, 23, 42, 0.6);
    pointer-events: none;
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-wrapper input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-text {
    width: 100px;
    font-family: monospace;
}

/* Range Slider */
.range-slider {
    width: 100%;
    accent-color: var(--primary);
}

/* Toggles / Switches */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 8px 0;
    margin-bottom: 28px;
}

.toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.25;
}

.toggle-desc {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 520px;
    margin-top: 6px;
    line-height: 1.45;
}

.opt-section > .form-group {
    margin-bottom: 30px;
}

.opt-section > .form-group:last-child {
    margin-bottom: 0;
}

.theme-assets-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.theme-asset-card {
    border: 1px solid #dbe3f1;
    border-radius: 14px;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-asset-head h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 17px;
    line-height: 1.2;
}

.theme-asset-head p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.theme-asset-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-asset-upload-btn {
    border: 1px solid rgba(var(--tertiary-rgb), 0.45);
    background: rgba(var(--secondary-rgb), 0.2);
    color: var(--primary);
    border-radius: 10px;
    min-height: 38px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.theme-asset-upload-btn:hover {
    background: rgba(var(--secondary-rgb), 0.28);
}

.theme-asset-upload-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.theme-asset-remove-btn {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    border-radius: 10px;
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.theme-asset-remove-btn:hover {
    background: #ffe4e6;
}

.theme-asset-status {
    font-size: 12px;
    color: var(--text-secondary);
    min-height: 18px;
}

.theme-asset-preview {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

.theme-asset-preview.has-image {
    border-style: solid;
    border-color: #dbe3f1;
    background: #fff;
}

.theme-asset-preview img {
    width: 100%;
    height: 100%;
    display: block;
}

.theme-asset-preview.is-bg {
    min-height: 134px;
}

.theme-asset-preview.is-bg img {
    object-fit: cover;
}

.theme-asset-preview.is-logo {
    min-height: 98px;
}

.theme-asset-preview.is-logo img {
    object-fit: contain;
    max-height: 84px;
}

@media (max-width: 860px) {
    .theme-assets-stack {
        grid-template-columns: 1fr;
    }

    .button-shape-preview-btn {
        width: 100%;
        max-width: 360px;
    }
}

.sharing-setup-row {
    border: 1px solid #dbe3f1;
    border-radius: 14px;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.sharing-setup-copy {
    flex: 1;
    min-width: 0;
}

.sharing-setup-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sharing-setup-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.sharing-setup-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}

.sharing-setup-badge.is-custom {
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
}

.sharing-setup-desc {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.45;
}

.sharing-setup-preview {
    margin-top: 12px;
    border: 1px solid #dbe3f1;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.sharing-preview-url {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.sharing-setup-preview-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.35;
}

.sharing-setup-preview-desc {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.sharing-inline-edit {
    border-radius: 8px;
    padding: 4px 6px;
    border: 1px solid transparent;
    cursor: text;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.sharing-inline-edit:hover {
    border-color: #d6ddea;
    background: rgba(255, 255, 255, 0.78);
}

.sharing-inline-edit:focus {
    outline: none;
    border-color: rgba(var(--tertiary-rgb), 0.5);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--tertiary-rgb), 0.12);
}

.sharing-inline-edit.is-auto {
    color: #64748b;
}

.sharing-setup-counts {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #64748b;
}

.sharing-setup-btn {
    border: 1px solid rgba(var(--tertiary-rgb), 0.45);
    background: #fff;
    color: var(--primary);
    border-radius: 11px;
    min-height: 42px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.sharing-setup-btn:hover {
    background: rgba(var(--secondary-rgb), 0.2);
}

@media (max-width: 860px) {
    .sharing-setup-row {
        flex-direction: column;
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.badge-pro {
    display: none !important;
    background: #dcfce7;
    color: #15803d;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 6px;
    text-transform: uppercase;
}

/* Save Bar */
.save-bar {
    position: fixed;
    bottom: 0;
    left: 240px;
    /* Sidebar width */
    right: 0;
    background: white;
    padding: 16px 40px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.btn-sm-outline {
    background: white;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

/* Utility to toggle Views */
.hidden {
    display: none !important;
}
