/* Data Sync - Dashboard Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --warning-color: #ca8a04;
    --error-color: #dc2626;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Top Panel */
.top-panel {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
}

.top-panel-left {
    display: flex;
    align-items: center;
}

.logo-link {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 400;
    font-size: 1rem;
    transition: color 0.2s;
}

.logo-link:hover {
    color: var(--primary-hover);
}

.top-panel-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Mobile navigation (hidden on desktop) */
.mobile-nav {
    display: none;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.mobile-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Layout Container & Sidebar */
.layout-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 50;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 20px;
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
}

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

.sidebar-item.active {
    background: var(--bg-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.sidebar-item.expandable {
    cursor: pointer;
}

.sidebar-item-content {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Sidebar icons removed */

.sidebar-label {
    flex: 1;
}

.chevron {
    font-size: 1rem;
    transition: transform 0.2s;
    margin-left: auto;
}

.sidebar-item.expanded .chevron {
    transform: rotate(90deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.sidebar-submenu.expanded {
    max-height: 200px;
}

.sidebar-subitem {
    display: block;
    padding: 0.625rem 20px 10px 40px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
}

.sidebar-subitem:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.sidebar-subitem.active {
    background: var(--bg-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    margin-left: 240px;
    overflow-x: auto;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.breadcrumb-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
}

.breadcrumb-actions form {
    margin: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--primary-color);
}

.breadcrumb-separator {
    color: var(--border-color);
    user-select: none;
}

.breadcrumb-current {
    color: var(--text-color);
}

.container {
    width: 100%;
}

strong {
    font-weight: 400;
}

h1 {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

h2 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

h3 {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

h4, h5, h6 {
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

section {
    margin-bottom: 1.5rem;
}

/* Section Header with Button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.sync-all-form {
    margin: 0;
}

.summary-section {
    margin-bottom: 1.5rem;
}

.tables-section,
.logs-section {
    margin-bottom: 1.5rem;
}

/* Entity Cards */
.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.entity-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
    min-width: 0;
}

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

.entity-card.clickable-card {
    cursor: pointer;
}

.entity-card.clickable-card:hover {
    border-color: var(--primary-color);
}

.entity-card.inactive {
    opacity: 0.7;
    background: #f3f4f6;
}

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

.entity-header h3 {
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.entity-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entity-full-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.entity-details-compact {
    margin: 0;
    min-width: 0;
}

.entity-details-compact p {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-details-compact p:last-child {
    margin-bottom: 0;
}

.entity-details-compact strong {
    font-weight: 500;
}

.entity-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: 0;
}

/* Generic Card Component */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
}

.card-body {
    padding: 0.75rem 1rem;
}

.back-link-top {
    margin-top: 0;
    margin-bottom: 1rem;
}

.page-header-title h1 {
    margin-bottom: 0.25rem;
}

.entity-details {
    margin-bottom: 1rem;
}

.entity-details p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.entity-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

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

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 400;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
}

/* Tab Component */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

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

/* Filter Bar Component */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.filter-group {
    flex: 1;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 400;
    font-size: 0.875rem;
}

/* Accordion Component */
.accordion-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    cursor: pointer;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: var(--bg-color);
}

.accordion-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.accordion-section.collapsed .accordion-toggle {
    transform: rotate(-90deg);
}

.accordion-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-section.collapsed .accordion-content {
    max-height: 0;
}

/* Toggle Switch Component */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
}

.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(--border-color);
    transition: 0.4s;
    border-radius: 1.5rem;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.125rem;
    width: 1.125rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background-color: var(--card-bg);
    transition: 0.4s;
    border-radius: 50%;
}

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

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

.sync-form {
    display: inline;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 400;
    border-radius: 4px;
    text-transform: capitalize;
}

.status-badge.active,
.status-badge.success {
    background-color: #dcfce7;
    color: var(--success-color);
}

.status-badge.inactive,
.status-badge.unknown {
    background-color: #f3f4f6;
    color: var(--text-muted);
}

.status-badge.running {
    background-color: #dbeafe;
    color: var(--primary-color);
}

.status-badge.failed {
    background-color: #fee2e2;
    color: var(--error-color);
}

/* Badge Component */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 400;
    border-radius: 4px;
}

.badge-primary {
    background-color: #dbeafe;
    color: var(--primary-color);
}

.badge-success {
    background-color: #dcfce7;
    color: var(--success-color);
}

.badge-warning {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-danger,
.badge-error {
    background-color: #fee2e2;
    color: var(--error-color);
}

.badge-info {
    background-color: #dbeafe;
    color: var(--primary-color);
}

.badge-secondary {
    background-color: #f3f4f6;
    color: var(--text-muted);
}

/* Alert Component */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background-color: #dcfce7;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

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

.alert-warning {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-info {
    background-color: #dbeafe;
    color: var(--primary-color);
    border: 1px solid #bfdbfe;
}

/* Tables */
/* Wrapper for tables with border and background */
.table-container {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.sync-table {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.sync-table th,
.sync-table td {
    padding: 0.375rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    vertical-align: middle;
    line-height: 1.2;
}

.sync-table th {
    background-color: #f9fafb;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    user-select: none;
}

.sync-table th.sortable:hover {
    background-color: #f3f4f6;
}

.sync-table .sort-indicator {
    color: var(--primary-color);
    font-size: 0.6875rem;
    margin-left: 0.25rem;
}

.sync-table tbody tr:hover {
    background-color: #f9fafb;
}

.sync-table-clickable tbody tr.clickable-row {
    cursor: pointer;
    background-color: var(--card-bg);
}

.sync-table-clickable tbody tr.clickable-row:hover {
    background-color: #e5e7eb;
}

.table-list-cell {
    font-size: 0.75rem;
    max-width: 300px;
}

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

.sync-table tr.status-failed {
    background-color: #fef2f2;
}

.sync-table tr.status-warning {
    background-color: #fefce8;
}

.error-message {
    font-size: 0.75rem;
    color: var(--error-color);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-card.success {
    border-color: var(--success-color);
    border-width: 2px;
}

.stat-card.error {
    border-color: var(--error-color);
    border-width: 2px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Inline Stats */
.stats-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
}

.stat-item {
    color: var(--text-muted);
}

.stat-item strong {
    color: var(--text-color);
    font-weight: 500;
}

.stat-divider {
    color: var(--border-color);
}

.stat-success strong {
    color: var(--success-color);
}

.stat-error strong {
    color: var(--error-color);
}

/* Warning Section */
.warning-section {
    background-color: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 8px;
    padding: 1rem;
}

.warning-section h2 {
    color: var(--warning-color);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header-actions,
.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.back-link {
    margin-bottom: 0.5rem;
}

.back-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* No Data */
.no-data {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
    text-align: center;
    background: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 2rem;
}

.error-box {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    color: var(--error-color);
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Add Entity Card */
.add-entity-card {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    background: transparent;
    text-decoration: none;
    min-height: 120px;
}

.add-entity-card:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.add-entity-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.add-entity-card:hover .add-entity-content {
    color: var(--primary-color);
}

.add-icon {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1;
}

.add-text {
    font-size: 0.875rem;
    font-weight: 400;
}

/* Entity Form */
.entity-form {
    max-width: 1400px;
}

.add-entity-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
    align-items: start;
}

.add-entity-left,
.add-entity-right {
    min-width: 0;
}

@media (max-width: 900px) {
    .add-entity-layout {
        grid-template-columns: 1fr;
    }
}

.form-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.form-section h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-color);
}

.form-group input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[readonly] {
    background-color: var(--bg-color);
    color: var(--text-muted);
}

.form-group small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control[readonly] {
    background-color: var(--bg-color);
    color: var(--text-muted);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg-color);
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background: #e5e7eb;
}

.checkbox-label input[type="checkbox"] {
    width: 0.875rem;
    height: 0.875rem;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label span {
    font-weight: 400;
    font-size: 0.8rem;
}

.checkbox-label small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
}

/* Form Field Row (2-column: label+hint | input) */
.form-field {
    display: grid;
    grid-template-columns: 38% 62%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color);
}

.form-field:last-child {
    border-bottom: none;
}

.form-field-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding-right: 0.5rem;
}

.form-field-label label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
}

.form-field-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.8125rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--card-bg);
    color: var(--text-color);
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-field select {
    cursor: pointer;
}

.form-field-readonly {
    background-color: var(--bg-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

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

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

/* Mapping Link */
.mapping-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.mapping-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Check Status Indicator */
.check-status {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    cursor: help;
}

.check-status:empty {
    display: none;
}

.check-status.checking {
    color: var(--text-muted);
    animation: pulse 1s infinite;
}

.check-status.match {
    color: var(--success-color);
    font-weight: 500;
}

.check-status.mismatch {
    color: var(--error-color);
    font-weight: 500;
}

.check-status.error {
    color: var(--warning-color);
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-content-large {
    max-width: 900px;
    height: 80vh;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
}

.modal-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 1.5rem;
    overflow: auto;
    flex: 1;
}

/* Mapping Tabs */
.mapping-tabs {
    display: flex;
    background: var(--bg-color);
    border-radius: 6px;
    padding: 0.25rem;
}

.mapping-tab {
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 400;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.mapping-tab:hover {
    color: var(--text-color);
}

.mapping-tab.active {
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mapping-view {
    height: 100%;
}

.modal-body pre {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 4px;
    overflow: auto;
    font-size: 0.6875rem;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Visual Mapping Section */
.mapping-loading,
.mapping-error {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.mapping-error {
    color: var(--error-color);
}

/* Mapping Header */
.mapping-info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mapping-header-divider {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.mapping-endpoint {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.6875rem;
    color: var(--text-muted);
    word-break: break-all;
}

.mapping-collection {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-color);
}

.mapping-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 70px;
}

.mapping-option-badge {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--primary-color);
    background: #dbeafe;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Root Collection Container */
.mapping-root-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mapping-root-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mapping-collection-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

/* Mapping Groups */
.mapping-group {
    margin-bottom: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    background: var(--card-bg);
}

.mapping-group:last-child {
    margin-bottom: 0;
}

.mapping-group-header {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

/* Mapping List - Modern Cards */
.mapping-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-left: 0.75rem;
}

.mapping-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
}

.mapping-source {
    flex: 1;
    text-align: left;
}

.mapping-source-text {
    display: inline-block;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.75rem;
    color: #0550ae;
    font-weight: 400;
    background: #ddf4ff;
    border: 1px solid #0550ae;
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
}

.mapping-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.mapping-arrow svg {
    opacity: 0.5;
}

.mapping-sink {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mapping-sink-text {
    display: inline-block;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.75rem;
    color: #cf222e;
    font-weight: 400;
    background: #ffebe9;
    border: 1px solid #cf222e;
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
}

.mapping-type {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mapping-path-parent {
    color: #6b7280;
    font-weight: 400;
}

.mapping-path-sep {
    color: #9ca3af;
    padding: 0 0.125rem;
}

/* Mapping JSON List (for JSON tab) */
.mapping-json-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mapping-json-item {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.6875rem;
    line-height: 1.6;
    background: var(--bg-color);
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    white-space: pre;
}

.json-brace {
    color: var(--text-muted);
}

.json-key {
    color: #0550ae;
}

.json-string {
    color: #0a3069;
}

.json-source-badge {
    display: inline;
    background-color: #ddf4ff;
    color: #0550ae;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 400;
}

.json-sink-badge {
    display: inline;
    background-color: #ffebe9;
    color: #cf222e;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 400;
}



/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 250px);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.login-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--error-color);
    font-size: 0.875rem;
}

.login-btn {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

/* Nav User Menu */
.nav-user-menu {
    position: relative;
    margin-left: 1.5rem;
}

.nav-user-toggle {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
    font-size: 0.875rem;
}

.nav-user-toggle:hover {
    color: var(--primary-color);
}

.nav-user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    z-index: 200;
}

.nav-user-dropdown.open {
    display: block;
}

.nav-user-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.875rem;
    margin-left: 0;
}

.nav-user-dropdown a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Clients Page Styles */
.search-section {
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Clients page uses global .table-container and .sync-table styles */

.entity-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.entity-name {
    font-weight: 400;
    color: var(--text-color);
    font-size: 0.75rem;
}

.entity-code {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.system-badge {
    display: inline-block;
    padding: 0.25rem 12px;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 400;
    text-transform: uppercase;
}

.system-badge.abra {
    background: #dbeafe;
    color: #1e40af;
}

.system-badge.sfa {
    background: #fef3c7;
    color: #92400e;
}

.table-count {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 400;
}

.actions-column {
    width: 380px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: nowrap;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

.empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 0.6875rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

/* Edit Modal */
.edit-placeholder {
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 8px;
    margin-top: 16px;
}

.edit-placeholder p {
    margin: 8px 0;
    font-size: 0.875rem;
}

/* Placeholder Pages */
.placeholder-page {
    max-width: 700px;
    margin: 48px auto;
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 24px;
}

.placeholder-page h2 {
    margin-bottom: 12px;
    color: var(--text-color);
}

.placeholder-page .text-muted {
    font-size: 1rem;
    margin-bottom: 32px;
}

.placeholder-features {
    text-align: left;
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 24px;
}

.placeholder-features h3 {
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-color);
}

.placeholder-features ul {
    list-style: none;
    padding: 0;
}

.placeholder-features li {
    padding: 0.5rem 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-muted);
}

.placeholder-features li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Sync Progress Container */
.sync-progress-container {
    position: fixed;
    top: 140px;
    right: 20px;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 20px;
    min-width: 320px;
    max-width: 400px;
    display: none;
    animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sync-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.sync-progress-text {
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-progress-percent {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

.sync-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--input-background);
    border-radius: 4px;
    overflow: hidden;
}

.sync-progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

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

    .sidebar {
        display: none;
    }

    .top-panel {
        height: 60px;
        padding: 0 1rem;
    }

    .top-panel-left {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 1rem;
        overflow: hidden;
    }

    .logo-link {
        flex-shrink: 0;
    }

    .logo-text {
        display: inline;
    }

    .top-panel-right {
        flex-shrink: 0;
    }

    .mobile-nav {
        display: flex;
        gap: 0.25rem;
        flex: 1;
        min-width: 0;
    }

    .mobile-nav .sidebar-item {
        flex-shrink: 0;
        padding: 0.5rem 0.75rem;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .mobile-nav .sidebar-item.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
        background: transparent;
        color: var(--primary-color);
    }

    .mobile-nav .sidebar-label {
        font-size: 0.75rem;
    }

    .chevron {
        display: none;
    }

    .sidebar-submenu {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sync-table {
        display: block;
        overflow-x: auto;
    }
}

/* Running Syncs Terminal Overlay */
#sync-terminal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25vh;
    z-index: 1000;
    background: #0d1117;
    border-top: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.6875rem;
}

#sync-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.75rem;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

#sync-terminal-title {
    color: #8b949e;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#sync-terminal-toggle {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.6875rem;
    padding: 0 0.25rem;
    line-height: 1;
}

#sync-terminal-toggle:hover {
    color: #e6edf3;
}

#sync-terminal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0.25rem 0;
}

.sync-terminal-row {
    display: flex;
    align-items: baseline;
    gap: 1ch;
    padding: 0.2rem 0.75rem;
    color: #e6edf3;
    white-space: nowrap;
}

.sync-terminal-row.cancelling {
    opacity: 0.6;
}

.sync-terminal-pct {
    color: #3fb950;
    min-width: 4ch;
    text-align: right;
}

.sync-terminal-row.cancelling .sync-terminal-pct {
    color: #d29922;
}

.sync-terminal-entity {
    color: #79c0ff;
    min-width: 18ch;
}

.sync-terminal-table {
    color: #e6edf3;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sync-terminal-stats {
    color: #8b949e;
    white-space: nowrap;
}

.sync-terminal-cancel {
    background: none;
    border: 1px solid #6e7681;
    color: #8b949e;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    padding: 0 0.4rem;
    border-radius: 3px;
    line-height: 1.4;
    flex-shrink: 0;
}

.sync-terminal-cancel:hover {
    border-color: #f85149;
    color: #f85149;
}

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

.btn-danger:hover {
    background-color: #b91c1c;
}
