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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
    color: #1a202c;
}

.nav-link {
    color: #4299e1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #2b6cb0;
}

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #4a5568;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #edf2f7;
}

.tab-btn.active {
    background: #4299e1;
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header h2 {
    font-size: 24px;
    color: #1a202c;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

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

.btn-danger {
    background: #fc8181;
    color: white;
}

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

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

/* Data Table */
.contacts-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.data-table thead {
    background: #f7fafc;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

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

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.group-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.group-card h3 {
    font-size: 20px;
    color: #1a202c;
    margin-bottom: 8px;
}

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

.group-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 6px;
}

.stat {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.group-members {
    margin-top: 16px;
}

.group-members h4 {
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
}

.member-tag {
    display: inline-block;
    padding: 4px 10px;
    margin: 4px;
    background: #bee3f8;
    color: #2c5282;
    border-radius: 4px;
    font-size: 13px;
}

/* Workflows */
.workflows-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workflow-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.workflow-header h3 {
    font-size: 18px;
    color: #1a202c;
}

.workflow-info {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.workflow-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
    font-size: 14px;
}

.workflow-conditions {
    background: #f7fafc;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #4299e1;
}

.workflow-conditions h4 {
    font-size: 13px;
    color: #718096;
    margin-bottom: 8px;
}

.condition-item {
    font-size: 14px;
    color: #2d3748;
    padding: 4px 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    color: #1a202c;
}

.close {
    color: #a0aec0;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #2d3748;
}

.modal-body {
    padding: 24px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2d3748;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Reps Selection */
.reps-selection {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
}

.rep-checkbox {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.rep-checkbox:hover {
    background: #f7fafc;
}

.rep-checkbox input {
    margin-right: 10px;
    width: auto;
}

.rep-checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Group Details */
.group-details-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.group-members-section,
.group-stats-section {
    background: #f7fafc;
    padding: 16px;
    border-radius: 6px;
}

.group-members-section h4,
.group-stats-section h4 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 12px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

.member-item:hover {
    transform: translateX(4px);
}

.member-name {
    font-weight: 500;
    color: #2d3748;
}

.member-weight {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weight-input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    text-align: center;
}

.contact-item {
    padding: 10px;
    margin-bottom: 6px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
}

.contact-item-name {
    font-weight: 500;
    color: #2d3748;
}

.contact-item-email {
    color: #718096;
    font-size: 13px;
}

/* Condition Builder */
.condition {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 6px;
}

.condition select,
.condition input {
    flex: 1;
}

.condition button {
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

/* Filter Controls */
.filter-controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-box {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #4299e1;
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: #4299e1;
}

/* Contact Details Modal */
.contact-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 6px;
}

.detail-section h4 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.detail-item label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.detail-item span {
    color: #2d3748;
    font-size: 14px;
}

.workflow-section {
    grid-column: 1 / -1;
}

.workflow-history {
    max-height: 300px;
    overflow-y: auto;
}

.workflow-history-item {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #4299e1;
}

.workflow-history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.workflow-history-item-name {
    font-weight: 600;
    color: #2d3748;
}

.workflow-history-item-date {
    font-size: 12px;
    color: #718096;
}

.workflow-history-item-group {
    font-size: 13px;
    color: #4a5568;
}

.clickable-name {
    color: #4299e1;
    cursor: pointer;
    transition: color 0.2s;
}

.clickable-name:hover {
    color: #2b6cb0;
    text-decoration: underline;
}

/* Workflow Preview */
.workflow-preview {
    background: #f7fafc;
    padding: 16px;
    border-radius: 6px;
    margin-top: 16px;
    border-left: 4px solid #4299e1;
}

.workflow-preview h4 {
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 12px;
}

.workflow-preview-item {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 6px;
}

.workflow-preview-item strong {
    color: #2d3748;
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
    }

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

    .group-details-container {
        grid-template-columns: 1fr;
    }

    .contact-details-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }
}
