/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fafafa;
  color: #374151;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 20px;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 18px;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  color: #111827;
  letter-spacing: -0.3px;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 200ms ease, color 200ms ease;
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link:hover {
  background: #f9fafb;
  color: #111827;
}

.nav-item.active .nav-link {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.nav-item.active .nav-link svg {
  opacity: 1;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.4px;
}

h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.subtitle {
  color: #6b7280;
  margin: 0;
  font-size: 13px;
}

/* ===== BADGES / STATUS PILLS ===== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #6b7280;
  border: none;
  vertical-align: middle;
  transition: background 200ms ease, color 200ms ease;
}

.badge-safe {
  background: #dcfce7;
  color: #15803d;
}

.badge[data-status="idle"]    { background: #f3f4f6; color: #9ca3af; }
.badge[data-status="blocked"] { background: #fef3c7; color: #92400e; }
.badge[data-status="ready"]   { background: #dbeafe; color: #1d4ed8; }
.badge[data-status="running"] { background: #ede9fe; color: #7c3aed; }
.badge[data-status="done"]    { background: #dcfce7; color: #15803d; }
.badge[data-status="error"]   { background: #fee2e2; color: #991b1b; }

/* ===== STEPPER ===== */
.stepper {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stepper li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: #9ca3af;
  border-right: 1px solid #e5e7eb;
  background: #ffffff;
  transition: background 200ms ease, color 200ms ease;
}

.stepper li:last-child {
  border-right: none;
}

.stepper li.active {
  background: #eff6ff;
  color: #1d4ed8;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 200ms ease, color 200ms ease;
}

.stepper li.active .step-num {
  background: #2563eb;
  color: #ffffff;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.step-title {
  font-weight: 500;
  font-size: 13px;
}

/* ===== CARDS ===== */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 200ms ease;
  margin: 0;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  background: #fafafa;
}

.card-header.collapsible {
  cursor: pointer;
  user-select: none;
}

.card-header.collapsible:hover {
  background: #f3f4f6;
}

.collapse-icon {
  font-size: 13px;
  color: #9ca3af;
  transition: transform 200ms ease;
}

.card-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.card-body {
  padding: 16px;
}

.card-body.collapsed {
  display: none;
}

.sticky-controls {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border-radius: 12px;
}

.sticky-controls .actions,
.sticky-controls .hint,
.sticky-controls .guardrails {
  padding-left: 16px;
  padding-right: 16px;
}

.sticky-controls .actions { padding-top: 14px; }
.sticky-controls .guardrails { padding-bottom: 14px; }

/* ===== ACTIONS / BUTTONS ===== */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

button {
  background: #f9fafb;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

button:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

button.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

button.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

button.danger {
  background: #fff5f5;
  color: #dc2626;
  border-color: #fecaca;
}

button.danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:disabled:hover {
  background: #f9fafb;
  border-color: #e5e7eb;
  box-shadow: none;
}

button.primary:disabled:hover {
  background: #2563eb;
  border-color: #2563eb;
}

/* ===== HINT / GUARDRAILS ===== */
.hint {
  margin: 0 0 10px;
  color: #3b82f6;
  font-size: 13px;
}

.guardrails {
  color: #92400e;
  font-size: 12px;
  margin: 0;
  padding: 7px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}

/* ===== GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 16px;
}

.card.full {
  grid-column: 1 / -1;
}

/* ===== PRE / CODE OUTPUT ===== */
pre {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  min-height: 180px;
  overflow: auto;
  font-size: 12px;
  color: #374151;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  margin: 0;
}

#invoice-detail {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  min-height: 220px;
  overflow: auto;
  font-size: 13px;
}

/* ===== PERIOD BAR ===== */
.period-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.period-bar label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
}

.period-bar input {
  width: 100px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.period-bar input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

#to-date { width: 160px; }

/* ===== PERIOD / SCAN INFO ===== */
.period-summary {
  margin-bottom: 8px;
  color: #1d4ed8;
  font-size: 13px;
  padding: 6px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
}

.scan-consistency {
  margin-bottom: 8px;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.scan-consistency.ok {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.scan-consistency.warn {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.limit-warning {
  margin-bottom: 10px;
  color: #92400e;
  font-size: 13px;
  padding: 6px 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

/* ===== LOADING ===== */
.loading {
  margin: 10px 0;
  color: #3b82f6;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid #dbeafe;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  flex-shrink: 0;
}

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

/* ===== INVOICE BROWSER ===== */
.invoice-browser {
  display: block;
  margin-bottom: 12px;
}

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

.invoice-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}

.invoice-list li {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #374151;
  transition: background 200ms ease;
}

.invoice-list li:last-child { border-bottom: none; }

.invoice-list li:hover,
.invoice-list li:focus {
  background: #f9fafb;
  outline: none;
}

.invoice-list li.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

/* ===== DETAIL TABLE ===== */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.detail-table th,
.detail-table td {
  border-bottom: 1px solid #f3f4f6;
  padding: 6px 10px;
  vertical-align: top;
}

.detail-table th {
  width: 36%;
  text-align: left;
  color: #6b7280;
  font-weight: 600;
  background: #f9fafb;
}

.detail-table td {
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== COMPARE VISUAL ===== */
.compare-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.status-ok            { border-left: 3px solid #22c55e; padding-left: 9px !important; }
.status-missing-right { border-left: 3px solid #f59e0b; padding-left: 9px !important; }
.status-missing-left  { border-left: 3px solid #ef4444; padding-left: 9px !important; }

/* ===== SUMMARY ===== */
.summary {
  color: #374151;
  margin-bottom: 12px;
  font-size: 13px;
  padding: 8px 12px;
  background: #f0f9ff;
  border-radius: 8px;
  border: 1px solid #e0f2fe;
}

/* ===== KPIs ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  background: #ffffff;
  transition: box-shadow 200ms ease;
}

.kpi:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.kpi-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-weight: 700;
  font-size: 22px;
  color: #111827;
  line-height: 1.1;
}

.kpi-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.kpi-ok .kpi-value { color: #15803d; }

.kpi-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.kpi-warn .kpi-value { color: #d97706; }

/* ===== DENSITY TOGGLE ===== */
.density-toggle {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: #ffffff;
}

.toggle {
  border-radius: 0;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
}

.toggle.active {
  background: #2563eb;
  color: #ffffff;
}

.toggle:hover:not(.active) {
  background: #f3f4f6;
  color: #374151;
}

/* ===== COMPACT DENSITY ===== */
#app-root[data-density='compact'] .card-body { padding: 10px; }
#app-root[data-density='compact'] .invoice-list li { padding: 5px 10px; font-size: 11px; }
#app-root[data-density='compact'] pre { min-height: 140px; }
#app-root[data-density='compact'] .kpi { padding: 10px 12px; }
#app-root[data-density='compact'] .kpi-value { font-size: 18px; }
#app-root[data-density='compact'] .stepper li { padding: 10px 16px; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}

.filter-btn {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  transition: all 150ms ease;
}

.filter-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.filter-btn:hover:not(.active) {
  background: #f3f4f6;
}

/* ===== DETAIL SPLIT ===== */
.detail-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-content {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  min-height: 200px;
  overflow: auto;
  font-size: 13px;
}

.empty-detail {
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  padding: 40px 0;
}

/* ===== ROW STATUS COLORS ===== */
/* 🟢 Vert = synchronisées */
.row-matched {
  border-left: 3px solid #22c55e;
  background: #f0fdf4;
}

/* 🔵 Bleu = dans EBP mais pas dans PL */
.row-missing-pl {
  border-left: 3px solid #3b82f6;
  background: #eff6ff;
}

/* 🔴 Rouge = dans PL mais pas dans EBP */
.row-missing-ebp {
  border-left: 3px solid #ef4444;
  background: #fef2f2;
}

.badge-synced {
  background: #dcfce7;
  color: #15803d;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-pending {
  background: #f3f4f6;
  color: #9ca3af;
}

/* ===== INVOICE TABLE ===== */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.invoice-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
  position: sticky;
  top: 0;
}

.invoice-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: #6b7280;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.invoice-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.invoice-table tbody tr {
  cursor: pointer;
  transition: background 150ms ease;
}

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

.invoice-table tbody tr.active {
  background: #eff6ff;
}

.col-check { width: 40px; text-align: center; }
.col-num { width: 130px; font-weight: 500; }
.col-date { width: 100px; }
.col-client { min-width: 140px; }
.col-amount { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.col-sep { width: 30px; text-align: center; color: #d1d5db; font-size: 12px; }
.col-pl { width: 130px; color: #6b7280; }
.col-pl-amount { width: 110px; text-align: right; font-variant-numeric: tabular-nums; color: #6b7280; }
.col-status { width: 100px; text-align: center; }

.invoice-table td.col-amount,
.invoice-table td.col-pl-amount { text-align: right; }
.invoice-table th.col-amount,
.invoice-table th.col-pl-amount { text-align: right; }
.invoice-table td.col-check,
.invoice-table th.col-check { text-align: center; }
.invoice-table td.col-status { text-align: center; }
.invoice-table th.col-status { text-align: center; }
.invoice-table td.col-sep,
.invoice-table th.col-sep { text-align: center; }

.badge-pending {
  background: #f3f4f6;
  color: #9ca3af;
}

.badge-synced {
  background: #dcfce7;
  color: #15803d;
}

/* ===== INVOICE ACTIONS ===== */
.invoice-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.sync-main-btn {
  background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
  color: #ffffff !important;
  border: none !important;
  padding: 10px 22px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  letter-spacing: 0.2px;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.35);
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease !important;
}

.sync-main-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 20px rgba(37, 99, 235, 0.45) !important;
}

.sync-main-btn:disabled {
  opacity: 0.35 !important;
  box-shadow: none !important;
  transform: none !important;
}

.check-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
}

.empty-msg {
  padding: 24px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  opacity: 0;
  transition: opacity 200ms ease;
}

.modal-overlay.visible {
  opacity: 1;
}

.modal {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 200ms ease;
}

.modal-overlay.visible .modal {
  transform: scale(1);
}

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

.modal-header[data-tone="success"] {
  background: #f0fdf4;
  border-bottom-color: #bbf7d0;
}

.modal-header[data-tone="warning"] {
  background: #fffbeb;
  border-bottom-color: #fde68a;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: #374151;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body h3 {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-transform: none;
  letter-spacing: 0;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn-ok {
  min-width: 80px;
}

/* Sync result styles */
.sync-result-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.sync-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.sync-stat-num {
  font-size: 20px;
  font-weight: 700;
}

.sync-stat-ok {
  background: #dcfce7;
  color: #15803d;
}

.sync-stat-fail {
  background: #fee2e2;
  color: #991b1b;
}

.sync-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sync-result-list li {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}

.sync-ok-list li {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
}

.sync-fail-list li {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
}

/* ===== PROGRESS OVERLAY ===== */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  transition: opacity 200ms ease;
}

.progress-overlay.visible {
  opacity: 1;
}

.progress-panel {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 200ms ease;
}

.progress-panel-table {
  width: 700px;
}

.progress-overlay.visible .progress-panel {
  transform: scale(1);
}

.progress-header-bar {
  padding: 18px 24px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.progress-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  border-radius: 999px;
  transition: width 300ms ease;
}

.progress-bar-fill.has-errors {
  background: linear-gradient(90deg, #3b82f6, #f59e0b);
}

.progress-table-wrap {
  overflow-y: auto;
  flex: 1;
}

.sync-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sync-table thead {
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sync-table th {
  text-align: left;
  padding: 8px 14px;
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid #e5e7eb;
}

.sync-table td {
  padding: 7px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.sync-table th:nth-child(4),
.sync-table th:nth-child(5),
.sync-table td.sr-dl,
.sync-table td.sr-ul {
  text-align: center;
  width: 80px;
}

.sr-num { font-weight: 500; font-family: ui-monospace, monospace; font-size: 12px; }
.sr-client { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-amount { text-align: right; font-variant-numeric: tabular-nums; }

/* Row states */
.sync-row-active {
  background: #eff6ff !important;
}

.sync-row-pending {
  color: #9ca3af;
}

/* Cell status icons */
.sr-tick {
  color: #22c55e;
  font-weight: 700;
  font-size: 15px;
}

.sr-cross {
  color: #ef4444;
  font-weight: 700;
  font-size: 15px;
}

.sr-skip {
  color: #d1d5db;
  font-size: 13px;
}

.sr-wait {
  color: #e5e7eb;
  font-size: 13px;
}

.sr-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #dbeafe;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.progress-footer {
  padding: 10px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.count-ok { color: #15803d; font-weight: 600; }
.count-fail { color: #dc2626; font-weight: 600; }

/* ===== CUSTOMER MAPPING MODAL ===== */
.modal-wide {
  width: 620px;
}

.modal-header[data-tone="info"] {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}

.mapping-context {
  margin-bottom: 16px;
}

.mapping-context p {
  margin: 0 0 8px;
  font-size: 13px;
  color: #6b7280;
}

.ebp-client-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f0f9ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 15px;
}

.ebp-client-id {
  font-size: 12px;
  color: #6b7280;
  font-family: ui-monospace, monospace;
}

.mapping-search-wrap {
  margin-bottom: 10px;
}

.mapping-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.mapping-search:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.mapping-list-wrap {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.mapping-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mapping-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 150ms ease;
}

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

.mapping-item:hover {
  background: #eff6ff;
}

.mi-name {
  font-weight: 500;
  font-size: 13px;
  color: #111827;
}

.mi-ref {
  font-size: 12px;
  color: #9ca3af;
  font-family: ui-monospace, monospace;
}

.mapping-more, .mapping-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
  text-align: center;
}

.mapping-create {
  margin-bottom: 8px;
}

.mapping-create-btn {
  width: 100%;
  background: #f0fdf4;
  color: #15803d;
  border: 1px dashed #86efac;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease;
}

.mapping-create-btn:hover:not(:disabled) {
  background: #dcfce7;
}

.mapping-create-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.mapping-create-hint {
  font-size: 12px;
  color: #dc2626;
  margin: 8px 0 0;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

.mapping-skip-btn,
.mapping-skip-all-btn {
  font-size: 13px;
}

.mapping-skip-all-btn {
  background: #fff5f5;
  color: #dc2626;
  border-color: #fecaca;
}

.mapping-skip-all-btn:hover {
  background: #fee2e2;
}

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== DETAIL BLOCK ===== */
.detail-block { margin-top: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .grid { grid-template-columns: 1fr; }
  .lists-row, .compare-visual { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 900px) {
  .main-content { padding: 16px 20px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 14px 16px; }
  h1 { font-size: 18px; }
  .stepper { flex-direction: column; border-radius: 10px; }
  .stepper li { border-right: none; border-bottom: 1px solid #e5e7eb; }
  .stepper li:last-child { border-bottom: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .top { flex-direction: column; gap: 12px; }
}
