/* ============================================================
   TABUSH — Industrial Command Center Theme
   MSP Invoice Sync Dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
    /* Surfaces */
    --bg-void: #060a11;
    --bg-base: #0a0e17;
    --bg-surface: #111827;
    --bg-card: #1a2332;
    --bg-elevated: #1f2b3d;
    --bg-hover: #243044;

    /* Borders */
    --border-subtle: #1e2d3d;
    --border-default: #253347;
    --border-strong: #334766;

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #8494a7;
    --text-muted: #506070;
    --text-inverse: #0a0e17;

    /* Accent — Electric Cyan */
    --cyan: #06b6d4;
    --cyan-bright: #22d3ee;
    --cyan-dim: #0891b2;
    --cyan-glow: rgba(6, 182, 212, 0.15);
    --cyan-glow-strong: rgba(6, 182, 212, 0.3);

    /* Status */
    --status-success: #10b981;
    --status-success-bg: rgba(16, 185, 129, 0.1);
    --status-warning: #f59e0b;
    --status-warning-bg: rgba(245, 158, 11, 0.1);
    --status-error: #ef4444;
    --status-error-bg: rgba(239, 68, 68, 0.1);
    --status-pending: #8b5cf6;
    --status-pending-bg: rgba(139, 92, 246, 0.1);
    --status-synced: #10b981;
    --status-synced-bg: rgba(16, 185, 129, 0.1);

    /* Typography */
    --font-display: 'IBM Plex Mono', 'Courier New', monospace;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-data: 'JetBrains Mono', 'IBM Plex Mono', monospace;

    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 0px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-elevated: 0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 20px var(--cyan-glow), 0 0 40px rgba(6, 182, 212, 0.05);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-void);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scan-line overlay on body */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

a { color: var(--cyan); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--cyan-bright); }

/* --- Layout Shell --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--cyan), var(--cyan-dim));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--text-inverse);
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-family: var(--font-data);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-section-label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 12px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}

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

.sidebar-link.active {
    background: var(--cyan-glow);
    color: var(--cyan-bright);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--cyan);
    border-radius: 0 2px 2px 0;
}

.sidebar-sublink {
    padding-left: 46px;
    font-size: 13px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-link.active .sidebar-icon {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    font-family: var(--font-data);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--status-error-bg);
    color: var(--status-error);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
    background: var(--bg-base);
    position: relative;
}

/* Subtle grid pattern on main content */
.main-content::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.15;
}

.main-content > * {
    position: relative;
    z-index: 1;
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-timestamp {
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-timestamp .pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--status-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-card);
    transform: translateY(-1px);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.stat-card.total::after { background: var(--cyan); }
.stat-card.pending::after { background: var(--status-pending); }
.stat-card.synced::after { background: var(--status-success); }
.stat-card.errors::after { background: var(--status-error); }

.stat-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-data);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-card.total .stat-value { color: var(--cyan-bright); }
.stat-card.pending .stat-value { color: var(--status-pending); }
.stat-card.synced .stat-value { color: var(--status-success); }
.stat-card.errors .stat-value { color: var(--status-error); }

.stat-change {
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Sync Control Panel --- */
.sync-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 28px;
}

.sync-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sync-panel-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.sync-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled, .btn.htmx-request {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* Primary — Electric Cyan */
.btn-primary {
    background: linear-gradient(135deg, var(--cyan), var(--cyan-dim));
    color: var(--text-inverse);
    border-color: var(--cyan);
    box-shadow: 0 0 12px var(--cyan-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--cyan-bright), var(--cyan));
    box-shadow: 0 0 20px var(--cyan-glow-strong);
    color: var(--text-inverse);
    transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}

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

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--cyan);
    border-color: var(--cyan-dim);
}

.btn-outline:hover {
    background: var(--cyan-glow);
    color: var(--cyan-bright);
}

/* Danger */
.btn-danger {
    background: var(--status-error-bg);
    color: var(--status-error);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Small */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* --- Loading indicator for HTMX --- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Sync Results --- */
.sync-results {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-data);
    font-size: 13px;
    animation: fadeSlideIn 0.3s ease;
}

.sync-results.success { border-color: rgba(16, 185, 129, 0.3); }
.sync-results.error { border-color: rgba(239, 68, 68, 0.3); }

.sync-results-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-results-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.sync-results-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.sync-results-stat strong {
    color: var(--text-primary);
}

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

/* --- Tables --- */
.data-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    gap: 16px;
    flex-wrap: wrap;
}

.data-table-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.data-table-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

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

thead th {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 16px;
    text-align: left;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: var(--bg-elevated);
}

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

/* Monospace for IDs and amounts */
.data-id {
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--text-secondary);
}

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

.data-date {
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* --- Status Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-synced {
    background: var(--status-synced-bg);
    color: var(--status-synced);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-error {
    background: var(--status-error-bg);
    color: var(--status-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-skipped {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.badge-running {
    background: var(--cyan-glow);
    color: var(--cyan-bright);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-boxtop {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-running .badge-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

/* --- Forms / Inputs --- */
.form-input, .form-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px var(--cyan-glow);
}

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

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

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

/* --- Detail Page --- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
}

.detail-card-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
}

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

.detail-value {
    font-family: var(--font-data);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.detail-value-large {
    font-family: var(--font-data);
    font-size: 22px;
    font-weight: 700;
    color: var(--cyan-bright);
}

/* --- Breadcrumb --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-family: var(--font-data);
    font-size: 13px;
}

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

.breadcrumb a:hover {
    color: var(--cyan);
}

.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 11px;
}

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

/* --- Pagination --- */
.pagination-wrapper {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-subtle);
}

.pagination-info {
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--text-muted);
}

.pagination-links {
    display: flex;
    gap: 4px;
}

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    transition: all 0.15s;
}

.pagination-links a:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.pagination-links .active {
    background: var(--cyan-glow);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan-bright);
}

/* Override Laravel's default pagination */
.pagination-links nav { display: contents; }
.pagination-links nav > div:first-child { display: none; }
.pagination-links nav > div:last-child { display: contents; }
.pagination-links nav span[aria-current] {
    background: var(--cyan-glow) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
    color: var(--cyan-bright) !important;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 14px;
    box-shadow: var(--shadow-elevated);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
}

.toast.success { border-color: rgba(16, 185, 129, 0.3); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Flash Messages --- */
.flash-message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeSlideIn 0.3s ease;
}

.flash-success {
    background: var(--status-success-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--status-success);
}

.flash-error {
    background: var(--status-error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--status-error);
}

.flash-warning {
    background: var(--status-warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--status-warning);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

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

.empty-state-text {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state-sub {
    font-size: 13px;
}

/* --- Field Mapping Page --- */
.mapping-grid {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 12px;
    align-items: center;
}

.mapping-arrow {
    text-align: center;
    color: var(--cyan);
    font-size: 20px;
}

.mapping-row {
    display: contents;
}

.mapping-field {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: var(--font-data);
    font-size: 13px;
}

.mapping-field.mapped {
    border-color: rgba(16, 185, 129, 0.3);
}

.mapping-field.unmapped {
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--text-muted);
    font-style: italic;
}

/* --- Checkbox Toggle --- */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 14px;
    height: 14px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: var(--cyan-glow);
    border-color: var(--cyan-dim);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--cyan);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar-brand-text,
    .sidebar-link span,
    .sidebar-section-label,
    .sidebar-badge { display: none; }
    .sidebar-link { justify-content: center; padding: 12px; }
    .main-content { margin-left: var(--sidebar-collapsed); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .sync-buttons { flex-direction: column; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* --- Stagger animation for dashboard load --- */
.stagger-in {
    animation: fadeSlideIn 0.4s ease both;
}

.stagger-in:nth-child(1) { animation-delay: 0.05s; }
.stagger-in:nth-child(2) { animation-delay: 0.1s; }
.stagger-in:nth-child(3) { animation-delay: 0.15s; }
.stagger-in:nth-child(4) { animation-delay: 0.2s; }
.stagger-in:nth-child(5) { animation-delay: 0.25s; }
.stagger-in:nth-child(6) { animation-delay: 0.3s; }

/* --- Clickable table rows --- */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: var(--bg-hover) !important;
}

/* --- Manual Sync Form --- */
.manual-sync-form {
    margin-bottom: 4px;
}

.manual-sync-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* --- Sync Confirmation Modal --- */
.sync-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.sync-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 28px;
    min-width: 380px;
    max-width: 480px;
    box-shadow: var(--shadow-elevated), 0 0 40px rgba(0,0,0,0.5);
    animation: fadeSlideIn 0.2s ease;
}

.sync-modal-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.sync-modal-body {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.sync-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

/* --- Real-time Progress Panel --- */
.progress-panel {
    margin-top: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: fadeSlideIn 0.3s ease;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.progress-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-header-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cyan);
    animation: pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.progress-header-label {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.progress-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-phase {
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--cyan);
    letter-spacing: 0.3px;
}

.progress-timer {
    font-family: var(--font-data);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    letter-spacing: 1px;
}

/* Progress Bar */
.progress-bar-container {
    position: relative;
    height: 32px;
    background: var(--bg-elevated);
    margin: 16px 20px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.1) 50%,
        transparent 100%
    );
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-data);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    letter-spacing: 0.5px;
}

/* Counter Badges */
.progress-counters {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    flex-wrap: wrap;
}

.counter-badge {
    font-family: var(--font-data);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.counter-badge strong {
    color: var(--text-primary);
    font-weight: 700;
}

.counter-new strong { color: var(--cyan-bright); }
.counter-skipped strong { color: var(--text-secondary); }
.counter-pushed strong { color: var(--status-success); }
.counter-errors strong { color: var(--status-error); }

/* Scrolling Log */
.progress-log {
    background: var(--bg-void);
    margin: 0 20px 20px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    max-height: 320px;
    overflow-y: auto;
    font-family: var(--font-data);
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.progress-log::-webkit-scrollbar {
    width: 6px;
}

.progress-log::-webkit-scrollbar-track {
    background: transparent;
}

.progress-log::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 3px;
}

.log-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-time {
    color: var(--text-muted);
}

.log-new {
    color: var(--cyan-bright);
    font-weight: 600;
}

.log-skipped {
    color: var(--text-muted);
}

.log-pushed {
    color: var(--status-success);
    font-weight: 600;
}

.log-error {
    color: var(--status-error);
    font-weight: 600;
}

.log-done {
    color: var(--status-success);
    font-weight: 700;
}

/* --- Utility --- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-cyan { color: var(--cyan); }
.text-success { color: var(--status-success); }
.text-error { color: var(--status-error); }
.text-warning { color: var(--status-warning); }
.font-mono { font-family: var(--font-data); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
