.automation-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.automation-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: all 0.2s ease;
}

.automation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.automation-card.disabled {
    opacity: 0.6;
}

.automation-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

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

.automation-icon.email { background: var(--primary-light); color: var(--primary); }
.automation-icon.sms { background: var(--success-light); color: var(--success); }
.automation-icon.whatsapp { background: #dcfbf1; color: #14b8a6; }
.automation-icon.review { background: #fef3c7; color: #f59e0b; }

.automation-info {
    flex: 1;
}

.automation-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.automation-info p {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.automation-toggle {
    flex-shrink: 0;
}

.automation-body {
    padding: 1.25rem;
}

.automation-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.automation-setting:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.setting-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.toggle-switch {
    position: relative;
    width: 48px;
    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: var(--gray-400);
    border-radius: 9999px;
    transition: background 0.2s;
}

.toggle-slider::before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

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

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

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

.automation-actions {
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
}

/* Automation Stats */
.automation-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.automation-stats .stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.automation-stats .stat-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--gray-300);
}

.automation-stats .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.automation-stats .stat-info {
    flex: 1;
}

.automation-stats .stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

.automation-stats .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-period {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Sequence Builder */
.sequence-builder {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.trigger-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--gray-200);
}

.trigger-tab {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
}

.trigger-tab:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}

.trigger-tab.selected {
    border-bottom-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.trigger-tab i {
    font-size: 1.25rem;
}

.trigger-tab span {
    font-size: 0.85rem;
    font-weight: 500;
}

.sequence-steps {
    padding: 1.5rem;
}

.sequence-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.sequence-step:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.sequence-step.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}

.drag-handle {
    cursor: grab;
    color: var(--gray-400);
    padding: 0.25rem;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.step-number-badge {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.step-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.step-delay {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
}

.step-delay i {
    color: var(--primary);
}

.step-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.connector-line {
    width: 2px;
    height: 24px;
    background: repeating-linear-gradient(
        to bottom,
        var(--gray-300) 0,
        var(--gray-300) 4px,
        transparent 4px,
        transparent 8px
    );
    margin-left: 1.5rem;
    position: relative;
}

.connector-line::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--gray-300);
    border-radius: 50%;
}

.add-step-btn {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.2s;
}

.add-step-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Re-engagement Cards */
.reengagement-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.reengagement-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: all 0.2s;
}

.reengagement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.reengagement-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

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

.reengagement-icon.lost { background: var(--danger-light); color: var(--danger); }
.reengagement-icon.noshow { background: var(--warning-light); color: var(--warning); }
.reengagement-icon.cold { background: #dbeafe; color: #3b82f6; }

.reengagement-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.reengagement-info p {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.reengagement-body {
    padding: 1.25rem;
}

.reengagement-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.reengagement-setting:last-child {
    border-bottom: none;
}

.reengagement-setting select {
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.reengagement-actions {
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* Reminders Panel */
.reminders-panel {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-top: 1rem;
}

.reminder-item {
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.reminder-item:last-child {
    margin-bottom: 0;
}

.reminder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.reminder-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reminder-channels {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.channel-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.reminder-quiet-hours {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.reminder-quiet-hours h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reminder-quiet-hours p {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.quiet-hours-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quiet-hours-inputs input[type="time"] {
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.quiet-hours-inputs span {
    color: var(--gray-500);
}

/* Modal Enhancements */
.modal-lg {
    max-width: 700px;
}

.modal-sm {
    max-width: 400px;
}

.modal-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.modal-toggle-row span {
    font-weight: 500;
    color: var(--gray-700);
}

.section-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.delay-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.delay-option {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--gray-700);
}

.delay-option input[type="radio"] {
    width: auto;
}

.custom-delay-input {
    margin-top: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.variable-tag {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.variable-tag:hover {
    background: var(--primary);
    color: #fff;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--gray-700);
}

.radio-option input[type="radio"] {
    width: auto;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--gray-700);
}

.checkbox-option input[type="checkbox"] {
    width: auto;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.toggle-row label:first-child {
    margin-bottom: 0;
}

/* SMS/WhatsApp Steps */
.sms-step, .whatsapp-step {
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

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

.step-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.step-header .char-count {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.char-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: right;
    margin-top: 0.25rem;
}

.char-count.valid {
    color: var(--success);
}

.char-count.invalid {
    color: var(--danger);
}

.step-actions-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.whatsapp-format-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #dcfbf1;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #0d9488;
}

.whatsapp-format-hint code {
    background: rgba(0,0,0,0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: monospace;
}

/* Step Content Sections */
.step-content-section {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.content-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.timing-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timing-options input[type="number"] {
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.timing-options select {
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* Loading spinner */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

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

/* Section desc */
.section-desc {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .automation-cards {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .reengagement-cards {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .automation-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trigger-tabs {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .automation-cards {
        grid-template-columns: 1fr;
    }
    
    .reengagement-cards {
        grid-template-columns: 1fr;
    }
    
    .automation-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .trigger-tabs {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .delay-options {
        flex-direction: column;
    }
    
    .quiet-hours-inputs {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-lg {
        width: 100%;
        max-width: 100%;
    }
    
    .drag-handle {
        display: none;
    }
    
    .sequence-step {
        position: relative;
    }
    
    .mobile-reorder-btns {
        display: flex !important;
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .automation-stats {
        grid-template-columns: 1fr;
    }
    
    .trigger-tabs {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

.mobile-reorder-btns {
    display: none;
}
