
/* ═══════════════════════════════════════════════════════════
   WIRBI CONTABLE · DESIGN SYSTEM
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }

:root {
  --bg-page:    #F4F3F7;
  --bg-surface: #FFFFFF;
  --bg-raised:  #FAFAF9;
  --bg-sunken:  #EEECF3;
  --bg-hover:   #F0EEF8;
  --bd-light: rgba(0,0,0,0.07);
  --bd-mid:   rgba(0,0,0,0.12);
  --bd-strong:rgba(0,0,0,0.18);
  --tx-1: #1A1625;
  --tx-2: #5A5475;
  --tx-3: #9B96B0;
  --tx-inv: #FFFFFF;
  --w-red:   #FF5032;
  --w-blue:  #6422FF;
  --w-grad:  linear-gradient(135deg, #FF5032 0%, #6422FF 100%);
  --w-grad-h:linear-gradient(135deg, #e03e22 0%, #5218e0 100%);
  --c-green:  #16a34a;
  --c-green-bg: #f0fdf4;
  --c-green-bd: #bbf7d0;
  --c-red:    #dc2626;
  --c-red-bg: #fef2f2;
  --c-red-bd: #fecaca;
  --c-amber:  #d97706;
  --c-amber-bg:#fffbeb;
  --c-amber-bd:#fde68a;
  --c-blue:   #2563eb;
  --c-blue-bg:#eff6ff;
  --c-blue-bd:#bfdbfe;
  --c-purple-bg: #f5f3ff;
  --c-purple-bd: #ddd6fe;
  --c-purple: #7c3aed;
  --sh-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --sh-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --sh-lg: 0 8px 24px rgba(0,0,0,0.1),  0 2px 8px rgba(0,0,0,0.06);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --sidebar-w: 224px;
  --topbar-h:  52px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--tx-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bd-mid); border-radius: 10px; }

/* ─── LAYOUT ─── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ─── TOPBAR ─── */
.topbar {
  grid-column: 1 / -1;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-light);
  display: flex;
  align-items: center;
  padding: 0 20px 0 0;
  box-shadow: var(--sh-sm);
  z-index: 100;
}
.topbar-logo {
  width: var(--sidebar-w);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--bd-light);
  height: 100%;
  flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 600; color: var(--tx-1); letter-spacing: -0.3px; }
.logo-text span {
  background: var(--w-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topbar-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  padding: 0 8px;
  gap: 2px;
  flex: 1;
}
.tnav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--tx-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.tnav-item:hover { color: var(--tx-2); background: var(--bg-hover); }
.tnav-item.active { color: var(--w-blue); border-bottom-color: var(--w-blue); font-weight: 500; }
.tnav-badge {
  background: var(--w-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  line-height: 1.4;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding-left: 16px;
  border-left: 1px solid var(--bd-light);
}
.company-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--c-purple-bg);
  border: 1px solid var(--c-purple-bd);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  font-size: 12px;
  color: var(--c-purple);
  font-weight: 500;
  cursor: pointer;
}
.company-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-purple); }
.company-switcher {
  padding: 5px 10px; font-size: 13px; font-weight: 500;
  font-family: var(--font); color: var(--tx-2);
  background: var(--bg-raised); border: 1px solid var(--bd-mid);
  border-radius: 20px; cursor: pointer; outline: none;
  max-width: 180px; transition: border-color 0.15s;
}
.company-switcher:hover { border-color: var(--w-blue); }
.company-switcher:focus { border-color: var(--w-blue); box-shadow: 0 0 0 2px rgba(100,34,255,0.1); }
.period-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--tx-2);
  cursor: pointer;
  font-family: var(--font);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--w-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── SIDEBAR ─── */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--bd-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--sh-sm);
  z-index: 50;
}
.sidebar-section {
  padding: 16px 16px 6px;
  font-size: 10px;
  color: var(--tx-3);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--tx-2);
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--tx-1); }
.nav-item.active { background: var(--c-purple-bg); color: var(--w-blue); font-weight: 500; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--w-blue);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--bg-sunken);
  color: var(--tx-3);
}
.nav-item.active .nav-icon { background: var(--c-purple-bg); color: var(--w-blue); }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--c-amber-bg);
  color: var(--c-amber);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}
.nav-divider { height: 1px; background: var(--bd-light); margin: 8px 16px; }
.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--bd-light); }
.ai-status-card {
  background: var(--c-purple-bg);
  border: 1px solid var(--c-purple-bd);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.ai-status-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ai-pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--w-blue);
  animation: aipulse 2s infinite;
  flex-shrink: 0;
}
@keyframes aipulse {
  0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(100,34,255,0.3); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(100,34,255,0); }
}
.ai-status-label { font-size: 12px; font-weight: 500; color: var(--c-purple); }
.ai-status-sub { font-size: 11px; color: var(--tx-3); padding-left: 14px; }

/* ─── MAIN ─── */
.main-area {
  overflow-y: auto;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
}
.screen { display: none; flex-direction: column; flex: 1; min-height: 0; }
.screen.active { display: flex; }

/* ─── SETUP BANNER ─── */
.setup-banner {
  background: var(--c-amber-bg);
  border-bottom: 1px solid var(--c-amber-bd);
  padding: 10px 20px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.setup-banner-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1200px;
}
.setup-banner-left {
  display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0;
}
.setup-banner-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-amber); flex-shrink: 0; margin-top: 5px;
  box-shadow: 0 0 0 3px var(--c-amber-bd);
}
.setup-banner-body {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.setup-banner-title {
  font-size: 13px; font-weight: 600; color: var(--c-amber);
}
.setup-banner-items {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.setup-banner-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--c-amber-bd);
  border-radius: 20px; padding: 2px 10px;
  font-size: 11px; font-weight: 500; color: var(--tx-2);
}
.setup-banner-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.setup-banner-btn {
  display: inline-flex; align-items: center;
  background: var(--c-amber); color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 20px;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.setup-banner-btn:hover { opacity: 0.88; }
.setup-banner-close {
  background: none; border: none; cursor: pointer;
  color: var(--c-amber); font-size: 14px; padding: 4px 6px;
  border-radius: 6px; transition: background 0.1s;
  line-height: 1;
}
.setup-banner-close:hover { background: var(--c-amber-bd); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn-primary { background: var(--w-grad); color: #fff; box-shadow: 0 2px 8px rgba(100,34,255,0.25); }
.btn-primary:hover { background: var(--w-grad-h); box-shadow: 0 4px 12px rgba(100,34,255,0.3); }
.btn-secondary { background: var(--bg-surface); color: var(--tx-2); border: 1px solid var(--bd-mid); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--tx-1); }
.btn-ghost { background: transparent; color: var(--tx-3); font-size: 12px; }
.btn-ghost:hover { color: var(--tx-2); }
.btn-danger { background: var(--c-red-bg); color: var(--c-red); border: 1px solid var(--c-red-bd); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--r-sm); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ─── STATUS PILLS ─── */
.status-pill { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 20px; }
.sp-ok    { background: var(--c-green-bg); color: var(--c-green); }
.sp-ai    { background: var(--c-purple-bg); color: var(--c-purple); }
.sp-pend  { background: var(--c-amber-bg); color: var(--c-amber); }
.sp-err   { background: var(--c-red-bg); color: var(--c-red); }

/* ─── TOAST ─── */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--bd-mid);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--sh-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--tx-1);
  animation: toastIn 0.25s ease;
  max-width: 320px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 500; }
.toast-sub { font-size: 11px; color: var(--tx-3); margin-top: 2px; }
.toast-close { color: var(--tx-3); cursor: pointer; font-size: 16px; flex-shrink: 0; }
.toast.t-success { border-left: 3px solid var(--c-green); }
.toast.t-warn    { border-left: 3px solid var(--c-amber); }
.toast.t-error   { border-left: 3px solid var(--c-red); }
.toast.t-info    { border-left: 3px solid var(--w-blue); }

/* ─── UTILITY ─── */
.hidden { display: none !important; }
.ml-auto { margin-left: auto; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.fade-in { animation: fadeIn 0.3s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════════
   CONCILIACIÓN — PAGE HEADER con STEPPER
═══════════════════════════════════════════════════════════ */
.conc-page-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-light);
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: var(--sh-sm);
}

.conc-header-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--bd-light);
}

.page-header-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--w-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}
.page-title { font-size: 17px; font-weight: 600; color: var(--tx-1); }
.page-sub { font-size: 12px; color: var(--tx-3); margin-top: 1px; }

/* Selects de cuenta y período */
.conc-selects {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.conc-select {
  font-size: 12px;
  color: var(--tx-2);
  background: var(--bg-raised);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}
.conc-select:focus { border-color: var(--c-purple-bd); }

/* ─── STEPPER ─── */
.conc-stepper {
  display: flex;
  align-items: center;
  padding: 12px 0;
  gap: 0;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 14px 6px 0;
  position: relative;
  flex-shrink: 0;
  user-select: none;
}
.step-item:first-child { padding-left: 0; }

.step-bubble {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 2px solid var(--bd-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--tx-3);
  flex-shrink: 0;
  transition: all 0.2s;
}
.step-label-wrap {}
.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tx-3);
  transition: color 0.2s;
  white-space: nowrap;
}
.step-sublabel {
  font-size: 10px;
  color: var(--tx-3);
  margin-top: 1px;
  white-space: nowrap;
}

/* States */
.step-item.active .step-bubble {
  background: var(--w-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(100,34,255,0.3);
}
.step-item.active .step-label { color: var(--w-blue); }
.step-item.active .step-sublabel { color: var(--c-purple); }

.step-item.done .step-bubble {
  background: var(--c-green-bg);
  border-color: var(--c-green-bd);
  color: var(--c-green);
}
.step-item.done .step-label { color: var(--c-green); }
.step-item.done .step-sublabel { color: var(--c-green); opacity: 0.7; }

.step-item.locked { cursor: not-allowed; opacity: 0.45; }

/* Connector line */
.step-connector {
  flex: 1;
  height: 2px;
  background: var(--bg-sunken);
  border-radius: 1px;
  max-width: 60px;
  min-width: 20px;
  position: relative;
  overflow: hidden;
}
.step-connector-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--w-blue), var(--c-green));
  border-radius: 1px;
  transition: width 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════
   STEP CONTENT PANELS
═══════════════════════════════════════════════════════════ */
.step-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
.step-panel.active { display: flex; }

/* ═══════════════════════════════════════════════════════════
   STEP 1 — IMPORTAR ESTADO DE CUENTA
═══════════════════════════════════════════════════════════ */
.import-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* Sub-step: upload zone */
.import-config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.import-config-card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--sh-sm);
}
.ic-label {
  font-size: 11px;
  color: var(--tx-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.ic-select {
  width: 100%;
  font-size: 13px;
  color: var(--tx-1);
  background: var(--bg-raised);
  border: 1px solid var(--bd-mid);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}
.ic-select:focus { border-color: var(--c-purple-bd); }

/* Upload drop zone */
.upload-zone {
  background: var(--bg-surface);
  border: 2px dashed var(--bd-mid);
  border-radius: var(--r-xl);
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--w-blue);
  background: var(--c-purple-bg);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-icon {
  width: 64px; height: 64px;
  border-radius: var(--r-lg);
  background: var(--c-purple-bg);
  border: 1px solid var(--c-purple-bd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.upload-title { font-size: 16px; font-weight: 600; color: var(--tx-1); }
.upload-sub { font-size: 13px; color: var(--tx-3); }
.upload-formats {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.upload-fmt-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-sunken);
  color: var(--tx-3);
}

/* AI tip inside upload zone */
.upload-ai-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--c-purple-bg), #fff5f3);
  border: 1px solid var(--c-purple-bd);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--c-purple);
  width: 100%;
  margin-top: 4px;
}
.upload-ai-tip strong { font-weight: 600; }

/* Sub-step: processing */
.processing-card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-xl);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: var(--sh-md);
}
.processing-icon {
  width: 72px; height: 72px;
  border-radius: var(--r-lg);
  background: var(--w-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  animation: spin 2s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.processing-title { font-size: 18px; font-weight: 600; color: var(--tx-1); text-align: center; }
.processing-sub { font-size: 13px; color: var(--tx-3); text-align: center; }
.processing-bar-wrap { width: 100%; max-width: 400px; }
.processing-bar-bg {
  height: 6px;
  background: var(--bg-sunken);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.processing-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--w-grad);
  width: 0%;
  transition: width 0.3s ease;
}
.processing-bar-label { font-size: 12px; color: var(--tx-3); text-align: center; }
.processing-steps { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 400px; }
.pstep {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--tx-3);
  transition: color 0.3s;
}
.pstep.done { color: var(--c-green); }
.pstep.active { color: var(--w-blue); }
.pstep-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 2px solid var(--bd-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  flex-shrink: 0;
  transition: all 0.3s;
}
.pstep.done .pstep-dot { background: var(--c-green-bg); border-color: var(--c-green); color: var(--c-green); }
.pstep.active .pstep-dot { background: var(--c-purple-bg); border-color: var(--w-blue); }

/* Sub-step: review table */
.review-header {
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--sh-sm);
}
.review-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--c-green-bg);
  border: 1px solid var(--c-green-bd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.review-stats { display: flex; gap: 20px; margin-left: auto; }
.rstat { text-align: right; }
.rstat-value { font-size: 15px; font-weight: 600; font-family: var(--mono); color: var(--tx-1); }
.rstat-label { font-size: 10px; color: var(--tx-3); text-transform: uppercase; letter-spacing: 0.05em; }

.review-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  flex: 1;
}
.review-table-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--bd-light);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-raised);
}
.review-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  flex: 1;
  max-width: 260px;
}
.review-search input {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 12px;
  color: var(--tx-1);
  outline: none;
  flex: 1;
}
.review-search input::placeholder { color: var(--tx-3); }

.rtbl { width: 100%; border-collapse: collapse; }
.rtbl th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  color: var(--tx-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bd-mid);
  position: sticky;
  top: 0;
  z-index: 2;
}
.rtbl td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
  color: var(--tx-2);
  vertical-align: middle;
}
.rtbl tr:last-child td { border-bottom: none; }
.rtbl tr:hover td { background: var(--bg-hover); }
.rtbl td.mono { font-family: var(--mono); }
.rtbl td.pos { color: var(--c-green); font-family: var(--mono); font-weight: 500; }
.rtbl td.neg { color: var(--c-red); font-family: var(--mono); font-weight: 500; }

/* Inline edit cell */
.cell-edit {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cell-input {
  font-family: var(--font);
  font-size: 13px;
  color: var(--tx-1);
  background: var(--bg-raised);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  outline: none;
  width: 100%;
  min-width: 0;
}
.cell-input:focus { border-color: var(--w-blue); }
.row-state-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* Row with warning */
.rtbl tr.row-warn td { background: var(--c-amber-bg); }
.rtbl tr.row-warn:hover td { background: #fef3c7; }

/* Review footer */
.review-footer {
  padding: 14px 18px;
  background: var(--bg-raised);
  border-top: 1px solid var(--bd-mid);
  display: flex;
  align-items: center;
  gap: 12px;
}
.review-total-label { font-size: 12px; color: var(--tx-3); font-weight: 600; }
.review-total-value { font-size: 15px; font-weight: 600; font-family: var(--mono); color: var(--tx-1); }

/* ═══════════════════════════════════════════════════════════
   STEP 2 — MOVIMIENTOS EN BANCO (REGISTRO)
═══════════════════════════════════════════════════════════ */
.bank-reg-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bank-reg-toolbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-light);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.bank-reg-search {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  max-width: 280px;
  background: var(--bg-raised);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-sm);
  padding: 6px 10px;
}
.bank-reg-search input {
  border: none; background: transparent;
  font-family: var(--font); font-size: 12px; color: var(--tx-1);
  outline: none; flex: 1;
}
.bank-reg-search input::placeholder { color: var(--tx-3); }
.filter-chip {
  font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 14px;
  border: 1px solid var(--bd-light);
  color: var(--tx-3); cursor: pointer;
  background: var(--bg-raised); font-family: var(--font);
  transition: all 0.12s; white-space: nowrap;
}
.filter-chip.on { background: var(--c-purple-bg); border-color: var(--c-purple-bd); color: var(--c-purple); }
.filter-chip:hover:not(.on) { background: var(--bg-hover); color: var(--tx-2); }

.bank-reg-summary {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-light);
  padding: 10px 24px;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.breg-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-md);
  padding: 8px 14px;
  flex: 1;
}
.breg-stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.breg-stat-body {}
.breg-stat-value { font-size: 14px; font-weight: 600; font-family: var(--mono); color: var(--tx-1); }
.breg-stat-label { font-size: 10px; color: var(--tx-3); text-transform: uppercase; letter-spacing: 0.05em; }

.bank-reg-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.bank-reg-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.breg-tbl { width: 100%; border-collapse: collapse; }
.breg-tbl th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  color: var(--tx-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bd-mid);
}
.breg-tbl th:last-child { text-align: right; }
.breg-tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
  color: var(--tx-2);
  vertical-align: middle;
}
.breg-tbl tr:last-child td { border-bottom: none; }
.breg-tbl tr:hover td { background: var(--bg-hover); }

.breg-mov-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.breg-mov-icon.credit { background: var(--c-green-bg); color: var(--c-green); }
.breg-mov-icon.debit  { background: var(--c-red-bg);   color: var(--c-red); }

.mov-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.mp-matched  { background: var(--c-green-bg); color: var(--c-green); }
.mp-pending  { background: var(--c-amber-bg); color: var(--c-amber); }
.mp-ai       { background: var(--c-purple-bg); color: var(--c-purple); }
.mp-conflict { background: var(--c-red-bg);   color: var(--c-red); }

.breg-action-btn {
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--bd-light);
  color: var(--tx-3);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.12s;
}
.breg-action-btn:hover { background: var(--bg-hover); color: var(--tx-1); border-color: var(--bd-mid); }

/* Add movement inline form */
.add-mov-row {
  background: var(--c-purple-bg);
  border-top: 1px solid var(--c-purple-bd);
}
.add-mov-row td { padding: 8px 14px; }
.add-input {
  font-family: var(--font);
  font-size: 12px;
  color: var(--tx-1);
  background: var(--bg-surface);
  border: 1px solid var(--c-purple-bd);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  outline: none;
  width: 100%;
}
.add-input:focus { border-color: var(--w-blue); }
.add-input-select {
  font-family: var(--font);
  font-size: 12px;
  color: var(--tx-1);
  background: var(--bg-surface);
  border: 1px solid var(--c-purple-bd);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
  width: 100%;
}

.bank-reg-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--bd-light);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   STEP 3 — CONCILIACIÓN BANCARIA (two-column matcher)
═══════════════════════════════════════════════════════════ */
.conc-summary {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-light);
  padding: 14px 24px;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.conc-kpi {
  flex: 1;
  border-radius: var(--r-md);
  padding: 12px 16px;
  border: 1px solid var(--bd-light);
  background: var(--bg-raised);
  transition: box-shadow 0.15s;
}
.conc-kpi:hover { box-shadow: var(--sh-md); }
.ck-label {
  font-size: 10px; color: var(--tx-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 6px;
}
.ck-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ck-value { font-size: 22px; font-weight: 600; font-family: var(--mono); color: var(--tx-1); margin: 4px 0 3px; }
.ck-sub { font-size: 11px; color: var(--tx-3); }
.ck-progress { height: 3px; background: var(--bg-sunken); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.ck-progress-fill { height: 100%; border-radius: 2px; }

.conc-ai-bar {
  margin: 14px 24px 0;
  background: linear-gradient(135deg, var(--c-purple-bg), #fff9f8);
  border: 1px solid var(--c-purple-bd);
  border-radius: var(--r-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.conc-ai-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--w-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; flex-shrink: 0;
}
.conc-ai-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.ai-chip-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--c-purple-bd);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--c-purple);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-chip-btn:hover { background: var(--c-purple-bg); box-shadow: var(--sh-sm); }
.ai-chip-btn .chip-count {
  background: var(--c-purple); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 10px;
}

.conc-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 14px 24px 0;
  gap: 16px;
}
.conc-bank, .conc-libro {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.conc-col-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--bd-light);
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-raised);
  flex-shrink: 0;
}
.conc-col-title { font-size: 13px; font-weight: 600; color: var(--tx-1); flex: 1; }
.conc-col-sub { font-size: 11px; color: var(--tx-3); }
.conc-filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--bd-light);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.conc-search {
  display: flex; align-items: center; gap: 7px;
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--bd-light);
  border-radius: var(--r-sm);
  padding: 6px 10px;
}
.conc-search input {
  border: none; background: transparent;
  font-family: var(--font); font-size: 12px; color: var(--tx-1);
  outline: none; flex: 1; min-width: 0;
}
.conc-search input::placeholder { color: var(--tx-3); }
.search-ic { font-size: 13px; color: var(--tx-3); flex-shrink: 0; }

.conc-rows { flex: 1; overflow-y: auto; }

.mov-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.mov-row:last-child { border-bottom: none; }
.mov-row:hover { background: var(--bg-hover); }
.mov-row.selected { background: var(--c-purple-bg); border-left: 3px solid var(--w-blue); }
.mov-row.matched { background: var(--c-green-bg); border-left: 3px solid var(--c-green); }
.mov-row.matched:hover { background: #dcfce7; }
.mov-row.conflict { background: var(--c-amber-bg); border-left: 3px solid var(--c-amber); }
.mov-row.ai-suggested { background: var(--c-purple-bg); border-left: 3px solid var(--w-blue); }

.mov-icon {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.mov-icon.credit { background: var(--c-green-bg); color: var(--c-green); }
.mov-icon.debit  { background: var(--c-red-bg);   color: var(--c-red); }
.mov-icon.neutral{ background: var(--bg-sunken);  color: var(--tx-3); }

.mov-body { min-width: 0; }
.mov-desc { font-size: 12px; font-weight: 500; color: var(--tx-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-meta { font-size: 11px; color: var(--tx-3); margin-top: 1px; }
.mov-amount { font-size: 13px; font-weight: 600; font-family: var(--mono); white-space: nowrap; text-align: right; }
.mov-amount.pos { color: var(--c-green); }
.mov-amount.neg { color: var(--c-red); }
.mov-status { text-align: right; }

.conc-col-footer {
  background: var(--bg-raised);
  border-top: 1px solid var(--bd-mid);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.cf-label { font-size: 11px; color: var(--tx-3); font-weight: 600; flex: 1; }
.cf-value { font-size: 13px; font-weight: 600; font-family: var(--mono); }
.cf-diff {
  font-size: 11px; font-family: var(--mono);
  padding: 3px 8px; border-radius: var(--r-sm);
}
.cf-diff.ok   { background: var(--c-green-bg); color: var(--c-green); }
.cf-diff.err  { background: var(--c-red-bg);   color: var(--c-red); }
.cf-diff.warn { background: var(--c-amber-bg); color: var(--c-amber); }

.conc-center {
  width: 56px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding-top: 60px;
}
.match-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--w-grad); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  box-shadow: 0 2px 8px rgba(100,34,255,0.25);
  transition: all 0.15s;
}
.match-btn:hover { transform: scale(1.1); box-shadow: 0 4px 14px rgba(100,34,255,0.35); }
.match-line {
  width: 2px; flex: 1; max-height: 40px;
  background: linear-gradient(to bottom, var(--c-purple-bd), transparent);
  border-radius: 2px;
}

/* Detail drawer */
.conc-drawer {
  background: var(--bg-surface);
  border-top: 1px solid var(--bd-mid);
  flex-shrink: 0; overflow: hidden;
  max-height: 0; transition: max-height 0.3s ease;
}
.conc-drawer.open { max-height: 220px; }
.drawer-inner {
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
  align-items: start;
}
.drawer-section-title {
  font-size: 10px; color: var(--tx-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px;
}
.drawer-field { margin-bottom: 6px; }
.df-label { font-size: 11px; color: var(--tx-3); }
.df-value { font-size: 13px; color: var(--tx-1); font-weight: 500; }
.df-value.mono { font-family: var(--mono); }
.drawer-actions { display: flex; flex-direction: column; gap: 6px; padding-top: 18px; }
.drawer-note {
  background: var(--c-amber-bg); border: 1px solid var(--c-amber-bd);
  border-radius: var(--r-md); padding: 10px 14px;
  font-size: 12px; color: var(--c-amber); line-height: 1.5;
}
.drawer-note.ai {
  background: var(--c-purple-bg); border-color: var(--c-purple-bd);
  color: var(--c-purple);
}

/* Bottom action bar */
.conc-actions {
  background: var(--bg-surface);
  border-top: 1px solid var(--bd-light);
  padding: 12px 24px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.conc-progress-wrap { display: flex; align-items: center; gap: 10px; flex: 1; }
.conc-progress-bar { flex: 1; max-width: 200px; height: 6px; background: var(--bg-sunken); border-radius: 3px; overflow: hidden; }
.conc-progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--w-blue), var(--c-green)); }
.conc-progress-label { font-size: 12px; color: var(--tx-3); }
.conc-progress-label strong { color: var(--tx-1); }

/* ─── Modal de agregar movimiento ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,22,37,0.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  width: 480px;
  max-width: 95vw;
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--bd-light);
  display: flex; align-items: center; gap: 12px;
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--tx-1); flex: 1; }
.modal-close { color: var(--tx-3); cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: var(--r-sm); }
.modal-close:hover { background: var(--bg-hover); color: var(--tx-1); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 11px; color: var(--tx-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.form-input {
  font-family: var(--font);
  font-size: 13px;
  color: var(--tx-1);
  background: var(--bg-raised);
  border: 1px solid var(--bd-mid);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--w-blue); }
.form-select {
  font-family: var(--font);
  font-size: 13px;
  color: var(--tx-1);
  background: var(--bg-raised);
  border: 1px solid var(--bd-mid);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
}
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--bd-light);
  display: flex; gap: 8px; justify-content: flex-end;
}
