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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Auth Screens */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a4d7a 0%, #2c7a3f 100%);
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    color: #1a4d7a;
    margin-bottom: 30px;
    font-size: 2rem;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: 2px solid #e1e8ed;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.2s;
}

.auth-tab.active {
    background: #1a4d7a;
    color: white;
    border-color: #1a4d7a;
}

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

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 25px 20px;
    background: #1a4d7a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    border: none;
    padding: 0;
    margin: 0;
}

.nav-menu {
    flex: 1;
    list-style: none;
    padding: 20px 0;
}

.nav-menu li {
    margin: 5px 0;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #2c7a3f;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: #2c7a3f;
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.btn-admin {
    background: #2c7a3f;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    margin-bottom: 12px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-admin:hover {
    background: #1f5a2a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
.main-content {
    margin-left: 250px;
    padding: 30px;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #1a4d7a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    color: #1a4d7a;
    font-size: 2rem;
    font-weight: 600;
}

.version-label {
    font-size: 0.75rem;
    color: #888;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 12px;
    font-family: monospace;
}

.page-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.page-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Dense Form Layouts for Profile Pages */
.dense-section {
    padding: 15px !important;
    margin-bottom: 15px;
}

.dense-section h2 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e8ed;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group-dense {
    margin-bottom: 0;
}

.form-group-dense label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Subtle indicator for SIR-synced fields */
.form-group-dense.sir-field input,
.form-group-dense.sir-field select,
.form-group-dense.sir-field textarea,
.form-group.sir-field input,
.form-group.sir-field select,
.form-group.sir-field textarea {
    border-left: 3px solid #a8d4f0;
}

/* Clickable table rows */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-row:hover {
    background-color: #f0f7ff;
}

/* Row action menu */
.row-menu {
    position: relative;
    display: inline-block;
}

.row-menu-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.15s ease;
}

.row-menu-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.row-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 100px;
}

.row-menu-dropdown.show {
    display: block;
}

.row-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: #dc3545;
    font-size: 0.85rem;
}

.row-menu-dropdown button:hover {
    background: #fee;
}

.actions-cell {
    width: 50px;
    text-align: center;
}

.form-group-dense input,
.form-group-dense select,
.form-group-dense textarea {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-group-dense input:focus,
.form-group-dense select:focus,
.form-group-dense textarea:focus {
    outline: none;
    border-color: #1a4d7a;
    box-shadow: 0 0 0 2px rgba(26, 77, 122, 0.1);
}

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

.contacts-list-dense {
    max-height: 200px;
    overflow-y: auto;
}

.contacts-list-dense .contact-item {
    padding: 8px;
    font-size: 0.85rem;
}

.contacts-list-dense .contact-item strong {
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .form-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .main-content {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .page-content-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
    text-align: center;
}

.stat-card h3 {
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a4d7a;
}

.dashboard-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.dashboard-section h2 {
    color: #1a4d7a;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 2px solid #1a4d7a;
    padding-bottom: 10px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 12px;
    background: #f8fafb;
    border-radius: 4px;
    border-left: 3px solid #1a4d7a;
    font-size: 0.9rem;
    color: #4a5568;
}

/* Forms and Sections */

.form-section,
.leads-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e1e8ed;
}

h2 {
    color: #1a4d7a;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 2px solid #1a4d7a;
    padding-bottom: 10px;
}

h3 {
    color: #555;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d9e0;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #fafbfc;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a4d7a;
    background: white;
}

/* Contacts Section */
.contacts-section {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#contactsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    position: relative;
}

.contact-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

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

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-cancel,
.btn-remove,
.btn-edit,
.btn-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: #1a4d7a;
    color: white;
}

.btn-primary:hover {
    background: #153d61;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,77,122,0.25);
}

.btn-secondary {
    background: #2c7a3f;
    color: white;
}

.btn-secondary:hover {
    background: #245d32;
}

.btn-cancel {
    background: #6c757d;
    color: white;
    margin-left: 10px;
}

.btn-cancel:hover {
    background: #5a6268;
}

.btn-remove {
    background: #dc3545;
    color: white;
    font-size: 0.85rem;
    padding: 6px 12px;
}

.btn-remove:hover {
    background: #c82333;
}

.btn-edit {
    background: #3182ce;
    color: white;
    font-size: 0.85rem;
    padding: 8px 16px;
}

.btn-edit:hover {
    background: #2c5aa0;
}

.btn-delete {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-role-toggle {
    background: #2c7a3f;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-role-toggle:hover {
    background: #1f5a2a;
    transform: translateY(-1px);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
}

/* Leads List */
.leads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
}

.lead-card {
    background: #fafbfc;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
    border-left: 4px solid #1a4d7a;
    transition: all 0.3s;
}

.lead-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left-color: #2c7a3f;
    transform: translateX(5px);
}

.lead-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.lead-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.lead-customer-number {
    background: #1a4d7a;
    color: white;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lead-details {
    background: white;
    padding: 14px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    border: 1px solid #e1e8ed;
}

.lead-details strong {
    color: #2c3e50;
    margin-right: 8px;
    font-weight: 600;
}

.lead-contacts {
    margin-top: 15px;
}

.contact-info {
    background: white;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    border: 1px solid #e1e8ed;
}

.contact-info strong {
    color: #2c3e50;
    font-weight: 600;
}

.contact-info div {
    color: #4a5568;
    margin: 4px 0;
}

/* Scrollbar */
.leads-list::-webkit-scrollbar {
    width: 8px;
}

.leads-list::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.leads-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.leads-list::-webkit-scrollbar-thumb:hover {
    background: #153d61;
}

/* Utility */
.hidden {
    display: none;
}

/* Form Errors */
.form-group input.error,
.form-group textarea.error {
    border-color: #dc3545;
    background: #fff5f5;
}

.error-message {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .form-section,
    .leads-section {
        padding: 20px;
    }

    header h1 {
        font-size: 1.5rem;
    }
}

/* Modal Styles */
.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.3s ease;
}

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

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

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

.modal-header h2 {
    color: #1a4d7a;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #1a4d7a;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

/* Table Styles */
.leads-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    padding: 10px 15px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    min-width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: #1a4d7a;
    box-shadow: 0 0 0 3px rgba(26, 77, 122, 0.1);
}

.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

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

.leads-table thead {
    background-color: #f5f7fa;
    border-bottom: 2px solid #e1e8ed;
}

.leads-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #1a4d7a;
    font-size: 14px;
    text-transform: uppercase;
}

.leads-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e1e8ed;
    color: #333;
    font-size: 14px;
}

.leads-table tbody tr:hover {
    background-color: #f9f9f9;
}

.leads-table .actions-cell {
    display: flex;
    gap: 8px;
}

.leads-table .btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.leads-table .btn-view {
    background-color: #1a4d7a;
    color: white;
}

.leads-table .btn-view:hover {
    background-color: #0d2d4a;
}

.leads-table .btn-delete {
    background-color: #dc3545;
    color: white;
}

.leads-table .btn-delete:hover {
    background-color: #c82333;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

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

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

.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.contact-item-profile {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #1a4d7a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-item-profile-info {
    flex: 1;
}

.contact-item-profile-info strong {
    display: block;
    color: #1a4d7a;
}

/* Admin Dashboard */
.admin-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.admin-tile {
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-tile:hover {
    border-color: #1a4d7a;
    box-shadow: 0 4px 16px rgba(26, 77, 122, 0.15);
    transform: translateY(-2px);
}

.admin-tile-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.admin-tile-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a4d7a;
    margin-bottom: 8px;
}

.admin-tile-desc {
    font-size: 0.85rem;
    color: #666;
}

.admin-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.btn-back {
    background: #f0f0f0;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #ddd;
}

.contact-item-profile-info small {
    color: #666;
    font-size: 12px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: #1a4d7a;
    box-shadow: 0 0 0 3px rgba(26, 77, 122, 0.1);
}

/* Searchable Dropdown */
.searchable-dropdown {
    position: relative;
    margin-bottom: 10px;
}

.dropdown-search {
    width: 100%;
    padding: 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.dropdown-search:focus {
    outline: none;
    border-color: #1a4d7a;
    box-shadow: 0 0 0 3px rgba(26, 77, 122, 0.1);
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e1e8ed;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.dropdown-list.show {
    display: block;
}

.dropdown-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s;
}

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

.dropdown-item:hover {
    background: #f5f7fa;
    padding-left: 20px;
}

.dropdown-item-name {
    font-weight: 600;
    color: #1a4d7a;
    margin-bottom: 3px;
}

.dropdown-item-meta {
    font-size: 0.85rem;
    color: #666;
}

.dropdown-item-selected {
    background: #e8f4f8;
    border-left: 3px solid #1a4d7a;
    padding-left: 12px;
}

.dropdown-item.dropdown-action {
    background: #f0f8f4;
    border-top: 1px solid #d0e8e0;
    font-weight: 600;
}

.dropdown-item.dropdown-action:hover {
    background: #e0f0e8;
}

.dropdown-empty {
    padding: 20px;
    text-align: center;
    color: #999;
}

/* Linked Entity Styles */
.linked-entity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.linked-entity-btn {
    background: none;
    border: none;
    color: #1a4d7a;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s;
    white-space: nowrap;
    opacity: 0;
}

.linked-entity-btn:hover {
    background: #e8f4f8;
    opacity: 1;
}

.linked-entity-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
}

.linked-entity-hover-btn {
    opacity: 0;
    flex-shrink: 0;
}

.linked-entity-container:hover .linked-entity-hover-btn {
    opacity: 1;
}

/* Data Sync Page Styles */
.sync-container {
    max-width: 900px;
}

.import-area {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1a4d7a, #2c7a3f);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

#importPreviewTable table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#importPreviewTable th,
#importPreviewTable td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    text-align: left;
}

#importPreviewTable th {
    background: #1a4d7a;
    color: white;
    position: sticky;
    top: 0;
}

#importPreviewTable tr:nth-child(even) {
    background: #f9f9f9;
}

#syncHistory .sync-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#syncHistory .sync-item:last-child {
    border-bottom: none;
}

.sync-item-type {
    font-weight: 600;
    color: #1a4d7a;
}

.sync-item-date {
    font-size: 0.85rem;
    color: #666;
}

.sync-item-stats {
    font-size: 0.85rem;
    color: #2c7a3f;
}

/* ==================== MERGE STYLES ==================== */

/* Modal size variants */
.modal-large .modal-content,
.modal-content.modal-large {
    max-width: 700px;
    width: 95%;
}

.modal-xlarge .modal-content,
.modal-content.modal-xlarge {
    max-width: 900px;
    width: 95%;
}

/* Merge Selection Modal */
.merge-selection-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.merge-primary-section h3,
.merge-duplicates-section h3 {
    font-size: 1rem;
    color: #1a4d7a;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e1e8ed;
}

.merge-primary-section h3 {
    border-bottom-color: #1a4d7a;
}

/* Record Cards */
.merge-record-card {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 15px;
}

.merge-record-card.primary {
    background: #e8f4f8;
    border-color: #1a4d7a;
    border-width: 2px;
}

.merge-record-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.merge-record-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #555;
}

.merge-record-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.merge-record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.8rem;
    color: #777;
    padding-top: 8px;
    border-top: 1px solid #e1e8ed;
}

/* Duplicate Candidates */
.merge-candidate {
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.merge-candidate:hover {
    border-color: #1a4d7a;
    box-shadow: 0 2px 8px rgba(26, 77, 122, 0.15);
}

.merge-candidate:last-child {
    margin-bottom: 0;
}

.merge-candidate-score {
    position: absolute;
    top: -10px;
    right: 15px;
}

.score-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.score-badge.high {
    background: #dc3545;
}

.score-badge.medium {
    background: #f0ad4e;
}

.score-badge.low {
    background: #6c757d;
}

.merge-candidate-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.reason-tag {
    background: #fff3cd;
    color: #856404;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

.merge-no-duplicates {
    text-align: center;
    padding: 30px;
    background: #d4edda;
    border-radius: 8px;
    color: #155724;
}

.merge-no-duplicates p:first-child {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Merge Comparison Modal */
.merge-comparison-body {
    max-height: 60vh;
    overflow-y: auto;
}

.merge-instructions {
    background: #fff3cd;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #856404;
    font-size: 0.9rem;
}

.merge-comparison-header {
    display: grid;
    grid-template-columns: 150px 1fr 1fr;
    gap: 15px;
    padding: 10px 15px;
    background: #1a4d7a;
    color: white;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.merge-field-row {
    display: grid;
    grid-template-columns: 150px 1fr 1fr;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid #e1e8ed;
    align-items: center;
}

.merge-field-row:nth-child(even) {
    background: #f8f9fa;
}

.merge-field-row.has-conflict {
    background: #fff3cd;
}

.merge-field-label {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.merge-field-value {
    font-size: 0.9rem;
}

.merge-radio-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.merge-radio-label:hover {
    background: rgba(26, 77, 122, 0.1);
}

.merge-radio-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.merge-radio-label input[type="radio"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.merge-value-text {
    word-break: break-word;
}

.empty-value {
    color: #999;
    font-style: italic;
}

/* Manual Search Modal */
.merge-search-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.merge-search-results {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 10px;
}

.merge-search-result {
    cursor: pointer;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.merge-search-result:hover {
    transform: translateX(5px);
}

.merge-search-result:hover .merge-record-card {
    border-color: #1a4d7a;
    box-shadow: 0 2px 8px rgba(26, 77, 122, 0.15);
}

.merge-search-result:last-child {
    margin-bottom: 0;
}

/* Danger button variant */
.btn-danger {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.btn-danger:hover {
    background: #c82333 !important;
    border-color: #c82333 !important;
}

/* Responsive adjustments for merge modals */
@media (max-width: 768px) {
    .merge-comparison-header,
    .merge-field-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .merge-comparison-header {
        display: none;
    }
    
    .merge-field-row {
        padding: 15px;
        border: 1px solid #e1e8ed;
        border-radius: 6px;
        margin-bottom: 10px;
    }
    
    .merge-field-label {
        font-weight: 600;
        color: #1a4d7a;
        margin-bottom: 5px;
    }
    
    .merge-field-value {
        padding-left: 20px;
    }
}
