/* =====================================================
   AutoFlow - Zapier-Inspired Light Theme
   ===================================================== */

/* CSS Variables - Zapier Color Palette */
:root {
    /* Primary Colors - Zapier Orange */
    --primary: #FF4A00;
    --primary-dark: #E54200;
    --primary-light: #FF6B2C;
    --primary-bg: rgba(255, 74, 0, 0.08);
    --primary-bg-hover: rgba(255, 74, 0, 0.12);

    /* Secondary */
    --secondary: #5D6775;
    --secondary-dark: #3D4553;
    --secondary-light: #8B95A5;

    /* Status Colors */
    --success: #00A67E;
    --success-bg: rgba(0, 166, 126, 0.1);

    --danger: #E54200;
    --danger-bg: rgba(229, 66, 0, 0.1);

    --warning: #FFAA00;
    --warning-bg: rgba(255, 170, 0, 0.1);

    --info: #0066FF;
    --info-bg: rgba(0, 102, 255, 0.1);

    /* Backgrounds - Light Theme */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F8FA;
    --bg-tertiary: #EEF0F4;
    --bg-card: #FFFFFF;
    --bg-hover: #F0F2F5;
    --bg-sidebar: #1A1C1E;

    /* Text Colors */
    --text-primary: #2D3036;
    --text-secondary: #5D6775;
    --text-muted: #8B95A5;
    --text-white: #FFFFFF;

    /* Borders */
    --border-color: #E4E7EB;
    --border-light: #F0F2F5;
    --border-focus: var(--primary);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.04);

    /* Sizing */
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --header-height: 64px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    line-height: 1.5;
    font-size: 14px;
}

/* Scrollbar - Minimalist */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-light);
}

/* =====================================================
   Sidebar - Dark Theme (Zapier Style)
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width var(--transition-normal);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    padding: 20px 0;
    gap: 16px;
    justify-content: center;
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.sidebar.collapsed .logo {
    justify-content: center;
    width: 100%;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar-toggle {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

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

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-weight: 500;
    font-size: 14px;
}

.nav-link i {
    width: 20px;
    font-size: 16px;
    text-align: center;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item.active .nav-link {
    background: var(--primary);
    color: white;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar-footer {
    padding: 16px;
    text-align: center;
}

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
    background: var(--bg-secondary);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

.main-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.page-content {
    padding: 32px 40px;
    max-width: 100%;
    margin: 0 auto;
}

/* =====================================================
   Buttons - Zapier Style
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 74, 0, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--secondary-light);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    filter: brightness(0.9);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn-link {
    background: none;
    color: var(--primary);
    padding: 8px 12px;
    font-weight: 500;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* Icon-only button (no background) */
.btn-icon-only {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
    transform: scale(1.1);
}

/* =====================================================
   Stats Cards - Zapier Dashboard Style
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: background var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.stat-primary:hover::after {
    background: var(--primary);
}

.stat-card.stat-success:hover::after {
    background: var(--success);
}

.stat-card.stat-danger:hover::after {
    background: var(--danger);
}

.stat-card.stat-info:hover::after {
    background: var(--info);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-primary .stat-icon {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-success .stat-icon {
    background: var(--success-bg);
    color: var(--success);
}

.stat-danger .stat-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-info .stat-icon {
    background: var(--info-bg);
    color: var(--info);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* =====================================================
   Dashboard Cards
   ===================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.dashboard-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-normal);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
    background: white;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-header h2 i {
    color: var(--primary);
    font-size: 16px;
}

.card-body {
    padding: 24px 32px;
    min-height: 200px;
}

/* Sales Distribution */
.sales-distribution-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.sales-distribution-item:hover {
    background-color: var(--bg-hover);
}

.sales-distribution-item:last-child {
    border-bottom: none;
}

.sales-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.sales-info {
    flex: 1;
}

.sales-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 14px;
}

.sales-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.sales-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.sales-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
}

/* Recent Activity */
.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.activity-item:hover {
    background-color: var(--bg-hover);
}

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

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.activity-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.activity-icon.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    font-size: 14px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* =====================================================
   Forms - Clean Zapier Style
   ===================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.required {
    color: var(--danger);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group select,
.field-mapping-row select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
    padding-left: 16px;
    appearance: none;
    font-size: 14px;
    line-height: 24px;
    color: var(--text-primary);
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    height: 48px;
    /* Fixed height for consistency */
}

.form-group select:hover,
.field-mapping-row select:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.form-group select:focus,
.field-mapping-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg);
    outline: none;
}

/* Option styling (Best effort for native selects) */
option {
    padding: 12px;
    background: white;
    color: var(--text-primary);
}

option:checked,
option:hover {
    background-color: var(--primary) !important;
    color: white !important;
    box-shadow: 0 0 10px 100px var(--primary) inset;
}

.form-group select option {
    padding: 12px;
    font-size: 14px;
    color: var(--text-primary);
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    position: relative;
    cursor: pointer;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    min-height: 48px;
    min-width: 220px;
}

.custom-select-trigger:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.custom-select-trigger .arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.custom-select.open .arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}

.custom-select.open .custom-select-options {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-option {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.custom-select-option.selected {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.custom-select-option.selected:hover {
    background: var(--primary-dark);
    color: white;
}

/* Custom Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.sales-checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked,
.sales-checkbox-item input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 14px;
    background-repeat: no-repeat;
    background-position: center;
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.input-with-button {
    display: flex;
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

.input-with-button input,
.input-with-button select {
    flex: 1;
    min-width: 0;
}

.input-with-button .btn {
    flex-shrink: 0;
    white-space: nowrap;
    height: auto;
    display: flex;
    align-items: center;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}



/* Range Slider */
.sales-settings-group {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-md);
    margin-top: 24px;
    border: 1px solid var(--border-color);
}

.weight-control-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 12px;
}

.weight-slider-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    appearance: none;
    outline: none;
    position: relative;
    z-index: 2;
}

.slider-track-fill {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: var(--primary);
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 22px;
    height: 22px;
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
    position: relative;
    z-index: 3;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.weight-display-badge {
    background: var(--primary);
    color: white;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* Toggle Switch */
.status-group {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
    margin-bottom: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

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

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

/* =====================================================
   Workflows Page - Zapier Zap Cards
   ===================================================== */
.workflows-container {
    max-width: 100%;
}

.workflows-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.workflow-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    margin-bottom: 0;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.workflow-body {
    margin-top: auto;
    margin-bottom: 24px;
}

.workflow-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.workflow-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--bg-tertiary);
    transition: background var(--transition-normal);
}

.workflow-card:hover::before {
    background: var(--primary);
}

.workflow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-left: 12px;
}

.workflow-title {
    display: flex;
    align-items: center;
    gap: 20px;
}

.workflow-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
}

.workflow-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.workflow-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.inactive {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.workflow-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: none;
    margin-left: 12px;
    overflow-x: auto;
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.workflow-step:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.workflow-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.workflow-step-icon img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.workflow-step-icon i {
    font-size: 14px;
}

.workflow-step-icon.jotform {
    background: #FF6B35;
}

.workflow-step-icon.sales {
    background: var(--info);
}

.workflow-step-icon.lark {
    background: #3370FF;
}

.workflow-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
}

.workflow-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.workflow-stats {
    display: flex;
    gap: 32px;
}

.workflow-stat {
    text-align: center;
}

.workflow-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.workflow-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.workflow-actions {
    display: flex;
    gap: 8px;
}

.recent-activity {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition-fast);
}

.activity-item:hover {
    background-color: var(--bg-hover);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-icon.success {
    background: #e6f7ef;
    color: #1a8754;
}

.activity-icon.failed {
    background: #fee7e7;
    color: #dc3545;
}

.activity-icon.pending {
    background: #fff4e6;
    color: #fd7e14;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Dashboard Performance Table */
.simple-table {
    width: 100%;
    border-collapse: collapse;
}

.simple-table th {
    text-align: left;
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.simple-table td {
    padding: 16px 24px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.simple-table tr:hover td {
    background-color: var(--bg-hover);
}

.simple-table tr:last-child td {
    border-bottom: none;
}

/* Quick Actions */
.quick-actions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
}

.action-item:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.action-item span {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

/* System Status */
.system-status {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.status-dot.success {
    background: #1a8754;
    box-shadow: 0 0 0 4px rgba(26, 135, 84, 0.15);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(26, 135, 84, 0.4);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(26, 135, 84, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(26, 135, 84, 0);
    }
}

.status-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

/* =====================================================
   Sales Page
   ===================================================== */
.sales-header {
    margin-bottom: 24px;
}

.sales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.sales-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.sales-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--bg-tertiary);
    transition: background var(--transition-normal);
}

.sales-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.sales-card:hover::before {
    background: var(--primary);
}

.sales-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.sales-card-avatar {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.sales-card-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sales-card-info p {
    color: var(--text-muted);
    font-size: 12px;
}

.sales-card-body {
    padding: 16px 0;
    border-top: 1px solid var(--border-light);
}

.sales-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.sales-detail i {
    width: 18px;
    color: var(--text-muted);
    font-size: 12px;
}

.sales-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.sales-card-stats {
    display: flex;
    gap: 20px;
}

.sales-card-stat {
    text-align: center;
}

.sales-card-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.sales-card-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* =====================================================
   History Page
   ===================================================== */
.history-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.select-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.select-with-icon i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 10;
}

.select-with-icon .filter-select,
.select-with-icon .custom-select-trigger {
    padding-left: 44px;
}

.filter-select {
    padding: 12px 52px 12px 48px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 220px;
    height: 48px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 16px;
    transition: all var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.history-table-container {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

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

.history-table th,
.history-table td {
    padding: 16px 20px;
    text-align: left;
}

.history-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.history-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition-fast);
}

.history-table tbody tr:last-child {
    border-bottom: none;
}

.history-table tbody tr:hover {
    background: var(--bg-hover);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Table Checkbox */
.history-table th input[type="checkbox"],
.history-table td input[type="checkbox"],
.history-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.history-table th input[type="checkbox"]:checked,
.history-table td input[type="checkbox"]:checked,
.history-checkbox:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
}

.history-table th input[type="checkbox"]:hover,
.history-table td input[type="checkbox"]:hover,
.history-checkbox:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.status-badge i {
    font-size: 14px;
}

.status-badge.success {
    background: #e6f7ef;
}

.status-badge.success,
.status-badge.success i {
    color: #1a8754;
}

.status-badge.failed {
    background: #fee7e7;
}

.status-badge.failed,
.status-badge.failed i {
    color: #dc3545;
}

.status-badge.pending {
    background: #fff4e6;
}

.status-badge.pending,
.status-badge.pending i {
    color: #fd7e14;
}

.table-cell-icon-text {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-cell-icon-text i {
    width: 16px;
    text-align: center;
}

.font-600 {
    font-weight: 600;
}

.btn-icon-only.danger {
    color: var(--danger);
}

.btn-icon-only.danger:hover {
    background: #fee7e7;
    color: #c82333;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
}

.pagination button {
    padding: 10px 16px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-bg);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 74, 0, 0.3);
}

/* =====================================================
   Settings Page
   ===================================================== */
.settings-container {
    max-width: 600px;
}

.settings-section {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
}

.settings-section:hover {
    box-shadow: var(--shadow-lg);
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.settings-section h2 i {
    color: var(--primary);
}

.settings-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

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

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

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

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

input:checked+.slider:before {
    transform: translateX(20px);
}

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

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

input:disabled+.slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =====================================================
   Modal - Clean White Style
   ===================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-large {
    max-width: 800px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    background: var(--bg-secondary);
}

.modal-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* Workflow Steps */
.workflow-step[data-step] {
    display: none;
}

.workflow-step[data-step].active {
    display: block;
}

.step-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: white;
    font-weight: 600;
}

.step-indicators {
    display: flex;
    gap: 12px;
}

.step-dot {
    width: 32px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.step-dot.active {
    background: var(--primary);
    width: 48px;
}

.step-dot.completed {
    background: var(--success);
}

/* Trigger Cards */
.trigger-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.trigger-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.trigger-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.trigger-card.selected {
    border-color: var(--primary);
    background: var(--primary-bg);
    box-shadow: var(--shadow-md);
}

.trigger-icon img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.trigger-info {
    flex: 1;
}

.trigger-info h4 {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.trigger-info p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Sales Selection - Multi Select */
.sales-selection {
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
}

/* Multi-Select Component */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    align-items: center;
}

.multi-select-selected:hover {
    border-color: var(--primary-light);
}

.multi-select-container.open .multi-select-selected {
    border-color: var(--primary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.multi-select-placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.tag-remove {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.multi-select-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
    transition: transform var(--transition-fast);
}

.multi-select-container.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.multi-select-container.open .multi-select-dropdown {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

.multi-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.multi-select-option:last-child {
    border-bottom: none;
}

.multi-select-option:hover {
    background: var(--primary-bg);
}

.multi-select-option.selected {
    background: var(--primary);
    color: white;
}

.multi-select-option.selected:hover {
    background: var(--primary-dark);
}

.multi-select-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

.multi-select-option .option-name {
    font-size: 14px;
    font-weight: 500;
}

.multi-select-option .option-weight {
    font-size: 12px;
    opacity: 0.8;
}

/* Webhook URL */
.webhook-url-display {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.copy-input {
    display: flex;
    gap: 10px;
}

.copy-input input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
}

/* Field Mapping */
.field-mapping-section {
    margin-top: 24px;
    padding: 20px;
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.field-mapping-section h4 {
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.field-mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.field-mapping-row:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.field-mapping-row input {
    /* Select handled by generic rule above */
    flex: 1;
    height: 48px;
    padding: 0 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}



/* Fix for mapping layout */
.field-mapping-row .mapping-source,
.field-mapping-row .mapping-value {
    flex: 1;
    min-width: 0;
}

.field-mapping-row .lark-field {
    flex: 1;
    min-width: 0;
}

.field-mapping-row .mapping-source select,
.field-mapping-row .mapping-value input,
.field-mapping-row .mapping-value select {
    width: 100%;
    display: block;
}

.field-mapping-row .btn-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    margin-left: 8px;
    /* Ensure spacing */
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
    min-width: 300px;
    max-width: 420px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: var(--success-bg);
    color: var(--success);
}

.toast.error .toast-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.toast.warning .toast-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.toast.info .toast-icon {
    background: var(--info-bg);
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    font-size: 14px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

/* =====================================================
   Empty States
   ===================================================== */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 14px;
}

.empty-state-large {
    text-align: center;
    padding: 80px 60px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.empty-state-large i {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 24px;
    display: block;
}

.empty-state-large h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-state-large p {
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 15px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* =====================================================
   Pages
   ===================================================== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* History Detail Steps */
.step-detail-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    background: white;
    transition: all var(--transition-fast);
}

.step-detail-card:hover {
    box-shadow: var(--shadow-md);
}

.step-detail-card.success {
    background: linear-gradient(to right, #f6fff9, white);
}

.step-detail-card.failed {
    background: linear-gradient(to right, #fff5f5, white);
}

.step-detail-card.pending {
    background: linear-gradient(to right, #fffdf0, white);
}

.step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.step-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-status-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.success .step-status-icon {
    background: #e6f7ef;
    color: #1a8754;
}

.failed .step-status-icon {
    background: #fee7e7;
    color: #dc3545;
}

.pending .step-status-icon {
    background: #fff4e6;
    color: #fd7e14;
}

.step-code-block {
    font-size: 13px;
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 400px;
    line-height: 1.5;
    margin-top: 12px;
    border: 1px solid #334155;
}

.step-error-msg {
    color: #dc3545;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    padding: 10px 14px;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #dc3545;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar .logo-text,
    .sidebar .nav-link span {
        display: none;
    }

    .sidebar .nav-link {
        justify-content: center;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .modal-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .history-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .page-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- 2FA Enhanced Styles --- */
.twofa-setup-box {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    margin-top: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.qr-code-wrapper {
    background: white;
    padding: 12px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.qr-code-wrapper img {
    width: 200px;
    height: 200px;
    display: block;
}

.secret-display {
    background: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
    position: relative;
}

.secret-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.verify-input-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    max-width: 320px;
    margin: 20px auto 0;
}

.verify-input-group .form-control {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 4px;
    height: 50px;
}

/* Modal for 2FA Verification */
.twofa-modal-content {
    text-align: center;
    padding: 20px 0;
}

.twofa-modal-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

.twofa-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.twofa-modal-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* --- Logout Sidebar Footer --- */
.logout-footer {
    margin-bottom: 12px;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #ef4444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
}

.sidebar.collapsed .logout-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .logout-link span {
    display: none;
}

/* --- Per-Workflow Sales Selection (Clean Design) --- */

.sales-select-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sales-add-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.sales-add-row .form-select {
    flex: 1;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    color: #374151;
}

.sales-add-row .form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.sales-add-row .btn {
    height: 40px;
    padding: 0 16px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.selected-sales-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding: 2px;
}

.selected-sales-list .empty-hint {
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    padding: 20px 16px;
    margin: 0;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #e5e7eb;
}

.selected-sales-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.selected-sales-item:hover {
    background: #fafafa;
    border-color: #d1d5db;
}

.sales-item-info {
    min-width: 0;
}

.sales-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sales-item-weight {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
}

.sales-item-weight label {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    font-weight: 500;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 34px;
}

.weight-input {
    width: 56px;
    height: 34px;
    padding: 0 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #1f2937;
    margin: 0;
}

.weight-input:focus {
    border-color: var(--primary);
    outline: none;
    background: white;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.12);
}

.weight-input::-webkit-inner-spin-button,
.weight-input::-webkit-outer-spin-button {
    opacity: 1;
}

.btn-remove-sales {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-remove-sales:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* --- Empty State Styling --- */
.empty-state-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    margin: 60px auto;
}

.empty-state-large i {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 24px;
    opacity: 0.6;
}

.empty-state-large h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.empty-state-large p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 32px 0;
    line-height: 1.6;
}

.empty-state-large .btn {
    margin: 0;
}


/* --- Empty State (Professional Design) --- */
.empty-state-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    min-height: 60vh;
}

.empty-state-large i {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 24px;
}

.empty-state-large h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.empty-state-large p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 28px 0;
    max-width: 400px;
}

.empty-state-large .btn {
    min-width: 160px;
    height: 42px;
    padding: 0 24px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.empty-state-large .btn i {
    font-size: 14px;
    margin: 0;
    color: inherit;
}
/* Fix workflows list centering to match sales list */
.workflows-list {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height) - 64px);
}

.sales-list {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height) - 64px);
}

/* Force override to remove white background as requested */
.empty-state-large {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    min-height: 60vh;
}

/* --- Improved Sales Modal Status Toggle --- */
.sales-settings-group {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.status-group {
    margin-bottom: 0 !important;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

.toggle-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

/* Reset any previous box/card styling */
.sales-settings-group .form-group {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Custom Toggle Switch Design */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}
