/* ============================================================
   DFX5 DAILY CLOSE CONSOLE · DESIGN SYSTEM v2
   Modern MLOps platform. Disciplined palette, clean typography.
   ============================================================ */

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

/* ----- Tokens ------------------------------------------------ */
:root {
  /* Brand */
  --brand:        #580A73;
  --brand-2:      #8E1BB5;
  --brand-soft:   #F4ECF8;
  --brand-line:   #E5D3EF;

  /* Neutrals */
  --bg:           #FAFAFB;
  --surface:      #FFFFFF;
  --surface-2:    #F7F7F8;
  --line:         #E6E7EB;
  --line-strong:  #D1D3D8;

  /* Ink */
  --ink:          #0F1115;
  --ink-2:        #383B43;
  --ink-3:        #5E6370;
  --muted:        #8B919C;
  --faint:        #ABB0BA;

  /* Status */
  --ok:           #0E9A6E;
  --ok-soft:      #E1F4EC;
  --warn:         #B45309;
  --warn-soft:    #FCEFDB;
  --bad:          #B91C1C;
  --bad-soft:     #FCE6E6;
  --info:         #1E4FD8;
  --info-soft:    #E1E9FD;

  /* File-type colors */
  --type-mayor:   var(--brand-2);
  --type-bi:      #2E6CD3;
  --type-hd:      #0E9A6E;
  --type-bank:    #B45309;

  /* Geometry */
  --r-sm: 6px;
  --r:    8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(15, 17, 21, 0.04), 0 0 0 1px var(--line);
  --sh-2: 0 4px 14px rgba(15, 17, 21, 0.06), 0 0 0 1px var(--line);
  --sh-3: 0 12px 36px rgba(15, 17, 21, 0.12), 0 0 0 1px var(--line-strong);

  /* Type */
  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --t-fast: 120ms cubic-bezier(0.2, 0, 0.2, 1);
  --t:      200ms cubic-bezier(0.2, 0, 0.2, 1);
  --t-slow: 360ms cubic-bezier(0.2, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand-soft); color: var(--brand); }

/* ----- Layout shell ----------------------------------------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.brand-logo { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub  { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.side-label {
  padding: 12px 8px 6px;
  font-size: 10px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.cuadre-item, .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer; user-select: none;
  transition: background var(--t-fast), color var(--t-fast);
  margin-bottom: 1px;
}
.cuadre-item:hover, .nav-item:hover { background: var(--surface-2); color: var(--ink); }
.cuadre-item.active, .nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.cuadre-item .planned { margin-left: auto; font-size: 9.5px; font-weight: 600; color: var(--faint); letter-spacing: 0.06em; }
.cuadre-item.planned-cuadre { color: var(--muted); cursor: not-allowed; }
.cuadre-item.planned-cuadre:hover { background: transparent; color: var(--muted); }
.nav-item .ico { width: 14px; height: 14px; flex: none; opacity: 0.7; }
.nav-item.active .ico { opacity: 1; }
.nav-section-label {
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 8px 8px 4px; margin-top: 2px; font-weight: 600;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.recents { max-height: 320px; overflow-y: auto; }
.recent-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast);
}
.recent-item:hover { background: var(--surface-2); color: var(--ink); }
.recent-item .date { font-family: var(--font-mono); font-size: 12px; }
.recent-item .meta { font-size: 10.5px; color: var(--muted); }

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); margin-top: 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.user-name { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--muted); margin-top: 1px; }
.version-pill {
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
  padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--r-pill);
  display: inline-block;
}

/* ----- Main ------------------------------------------------- */
.main { padding: 32px 40px 60px; max-width: 1200px; width: 100%; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 28px;
}
.page-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumb a { cursor: pointer; }
.crumb a:hover { color: var(--ink-2); }
.crumb .sep { color: var(--faint); }
.page-title { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; margin: 0; }
.page-sub { font-size: 13px; color: var(--ink-3); margin-top: 6px; max-width: 720px; }
.page-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-2); margin-bottom: 6px; }
.page-actions { display: flex; gap: 8px; }

/* ----- Buttons --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: background var(--t-fast), border var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not([disabled]) { background: #4A0962; }
.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.btn-secondary:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover:not([disabled]) { background: var(--bad-soft); }
.btn-icon {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ink-3); border: 1px solid transparent;
  border-radius: var(--r-sm);
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-lg { padding: 9px 18px; font-size: 14px; }
.kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--muted);
  padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); margin-left: 6px;
}

/* ----- Cards ----------------------------------------------- */
.card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--sh-1); }
.card + .card { margin-top: 16px; }
.card-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.005em; }
.card-sub   { font-size: 12px; color: var(--muted); }
.card-body  { padding: 20px; }
.card-body.tight { padding: 12px 20px; }
.card-body.flush { padding: 0; }

.section-title {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin: 28px 0 12px;
}

/* ----- Pills & dots --------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px; font-weight: 500;
  border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.pill .pdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok   { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad  { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.brand{ background: var(--brand-soft);color: var(--brand);border-color: transparent; }
.pill.running .pdot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ----- Metrics --------------------------------------------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.metric-label { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; margin-top: 4px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-value.mono { font-family: var(--font-mono); font-size: 22px; }
.metric-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.metric.accent .metric-value { color: var(--brand); }
.metric.ok .metric-value     { color: var(--ok); }
.metric.bad .metric-value    { color: var(--bad); }

/* ----- Workspace cards ------------------------------------- */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.ws-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  display: flex; flex-direction: column; gap: 12px;
}
.ws-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}
.ws-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ws-date { font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--ink); letter-spacing: -0.01em; }
.ws-dow { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.ws-meta { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
.ws-meta .sep { color: var(--faint); }
.ws-spark { margin-top: 6px; height: 32px; }
.ws-spark svg { width: 100%; height: 100%; display: block; }

.empty { text-align: center; padding: 64px 20px; color: var(--ink-3); }
.empty-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; max-width: 380px; margin-left: auto; margin-right: auto; }

/* ----- Dropzone & files ----------------------------------- */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 28px 20px;
  text-align: center;
  background: var(--surface-2);
  transition: background var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
.dropzone:hover { background: #F1F2F4; }
.dropzone.dragover { background: var(--brand-soft); border-color: var(--brand-2); }
.dropzone-icon { width: 32px; height: 32px; margin: 0 auto 10px; color: var(--brand); }
.dropzone-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.dropzone-title strong { color: var(--brand); }
.dropzone-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.dropzone code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface); color: var(--ink-2);
  padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line);
}

.file-list { display: flex; flex-direction: column; margin-top: 16px; }
.file-row {
  display: grid;
  grid-template-columns: 4px 24px 1fr auto auto 28px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-top: 6px;
  transition: border-color var(--t-fast);
}
.file-row:hover { border-color: var(--line-strong); }
.file-row .indicator { width: 4px; align-self: stretch; border-radius: 2px; }
.file-row[data-type=mayor_vs_auxiliar] .indicator { background: var(--type-mayor); }
.file-row[data-type=bi_publisher_005]  .indicator { background: var(--type-bi); }
.file-row[data-type=hd_plantilla_bank] .indicator { background: var(--type-hd); }
.file-row[data-type=hd_plantilla_ours] .indicator { background: var(--type-bank); }
.file-row[data-type=unknown]           .indicator { background: var(--faint); }

.file-icon { width: 22px; height: 22px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.file-name {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-type-pill {
  font-size: 10.5px; font-weight: 600;
  font-family: var(--font-mono);
  padding: 2px 7px; border-radius: 4px; letter-spacing: 0.02em;
}
.file-type-pill[data-type=mayor_vs_auxiliar] { background: rgba(142,27,181,0.10); color: var(--type-mayor); }
.file-type-pill[data-type=bi_publisher_005]  { background: rgba(46,108,211,0.10);  color: var(--type-bi); }
.file-type-pill[data-type=hd_plantilla_bank] { background: rgba(14,154,110,0.10);  color: var(--type-hd); }
.file-type-pill[data-type=hd_plantilla_ours] { background: rgba(180,83,9,0.10);    color: var(--type-bank); }
.file-type-pill[data-type=unknown]           { background: var(--surface-2);       color: var(--muted); }
.file-size { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.readiness-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: 13px;
  margin-top: 14px;
}
.readiness-banner.ready   { background: var(--ok-soft);   color: var(--ok); }
.readiness-banner.missing { background: var(--warn-soft); color: var(--warn); }
.readiness-banner .label  { font-weight: 600; }
.readiness-banner code    { font-family: var(--font-mono); font-size: 11.5px; background: rgba(255,255,255,0.6); padding: 1px 6px; border-radius: 4px; }

/* ----- Run experience ------------------------------------- */
.run-card { position: relative; overflow: hidden; }
.run-stage { padding: 28px; position: relative; }

.pipeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; position: relative; z-index: 2; }
.pipe-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  position: relative;
}
.pipe-step .num { font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.05em; }
.pipe-step .name { font-size: 12px; font-weight: 600; color: var(--ink); margin-top: 4px; line-height: 1.3; }
.pipe-step .status-row {
  display: block;
  margin-top: 8px;
  font-size: 11px; color: var(--muted);
  line-height: 1.4;
  min-height: 14px;
  word-break: break-word;
}
.pipe-step .status-row .sdot {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
.pipe-step .sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); transition: background var(--t-fast), box-shadow var(--t-fast); }

.pipe-step.active {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 1px var(--brand-2), 0 6px 20px rgba(142,27,181,0.18);
}
.pipe-step.active .sdot {
  background: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(142,27,181,0.20);
  animation: sdotPulse 1.4s ease-in-out infinite;
}
.pipe-step.done {
  border-color: var(--ok);
  background: linear-gradient(0deg, rgba(14,154,110,0.04) 0%, rgba(14,154,110,0) 60%);
}
.pipe-step.done .sdot { background: var(--ok); }
.pipe-step.failed { border-color: var(--bad); }
.pipe-step.failed .sdot { background: var(--bad); }
@keyframes sdotPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(142,27,181,0.20); }
  50%      { box-shadow: 0 0 0 6px rgba(142,27,181,0.08); }
}

.pipe-step::after {
  content: '';
  position: absolute; right: -8px; top: 50%;
  width: 8px; height: 1px;
  background: var(--line);
  transform: translateY(-50%);
  z-index: 1;
}
.pipe-step:last-child::after { display: none; }
.pipe-step.done::after { background: var(--ok); }

.agent-panel {
  margin-top: 24px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  overflow: hidden;
}
.agent-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.agent-panel-title {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.thinking-dots { display: inline-flex; gap: 3px; }
.thinking-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--brand-2);
  animation: tdot 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes tdot {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.agent-stream {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--ink-2);
  padding: 12px 16px;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.7;
}
.agent-stream-line {
  display: flex; gap: 8px;
  opacity: 0;
  animation: streamIn 240ms ease-out forwards;
}
.agent-stream-line .ts   { color: var(--faint); flex: none; width: 56px; }
.agent-stream-line .kind { color: var(--brand-2); flex: none; width: 130px; }
.agent-stream-line .body { color: var(--ink-2); flex: 1; }
.agent-stream-line.tier-1 .kind { color: var(--ok); }
.agent-stream-line.tier-2 .kind { color: var(--info); }
.agent-stream-line.tier-3 .kind { color: var(--warn); }
@keyframes streamIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Hero orb */
.run-hero {
  position: relative;
  height: 110px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}
.orb {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brand-2) 0%, var(--brand) 70%);
  box-shadow: 0 0 0 6px rgba(142,27,181,0.10),
              0 0 24px rgba(142,27,181,0.35),
              0 0 60px rgba(88,10,115,0.18);
  animation: orbBreathe 2.6s ease-in-out infinite;
  z-index: 2;
}
@keyframes orbBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.ring {
  position: absolute; top: 50%; left: 50%;
  width: 52px; height: 52px;
  border-radius: 50%; border: 1.5px solid var(--brand-2);
  opacity: 0;
  animation: ringOut 2.4s ease-out infinite;
  pointer-events: none;
}
.ring.r2 { animation-delay: 0.8s; }
.ring.r3 { animation-delay: 1.6s; }
@keyframes ringOut {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(3.6); opacity: 0; }
}
.hero-line {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--brand-line) 30%, var(--brand-line) 70%, transparent 100%);
  z-index: 1;
}

/* ----- Results & comparison ------------------------------- */
.match-display {
  display: flex; align-items: center; gap: 28px;
  padding: 4px 0;
}
.match-ring { position: relative; width: 96px; height: 96px; flex: none; }
.match-ring svg { transform: rotate(-90deg); }
.match-ring circle { fill: none; stroke-width: 8; }
.match-ring .bg { stroke: var(--line); }
.match-ring .fg {
  stroke: var(--ok);
  stroke-linecap: round;
  transition: stroke-dashoffset 800ms cubic-bezier(0.22, 1, 0.36, 1);
}
.match-ring.warn .fg { stroke: var(--warn); }
.match-ring.bad  .fg { stroke: var(--bad); }
.match-ring .center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.match-ring .pct { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.match-ring .pct-sub { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.match-summary { flex: 1; }
.match-headline { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; letter-spacing: -0.01em; }
.match-narrative { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.match-narrative.celebrate {
  background: linear-gradient(135deg, rgba(14,154,110,0.06) 0%, rgba(14,154,110,0) 80%);
  padding: 12px 16px; border-radius: var(--r); border-left: 3px solid var(--ok);
  color: var(--ink-2);
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.compare-col { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.compare-col-head { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.compare-col-head.ours { color: var(--brand); }
.compare-col-head.bank { color: var(--warn); }
.compare-col-body { padding: 10px 14px; }
.compare-stat { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12.5px; }
.compare-stat .lbl { color: var(--muted); }
.compare-stat .val { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }

/* Bank reference upload (compact) */
.bank-upload {
  margin-top: 14px;
  border: 1px dashed var(--warn);
  background: rgba(180,83,9,0.04);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.bank-upload:hover { background: rgba(180,83,9,0.08); }
.bank-upload .ico { width: 24px; height: 24px; color: var(--warn); flex: none; }
.bank-upload .title { font-size: 13px; font-weight: 600; color: var(--ink); }
.bank-upload .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ----- Tables --------------------------------------------- */
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.dt th {
  text-align: left;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
table.dt td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
table.dt tr:last-child td { border-bottom: none; }
table.dt tr:hover td { background: var(--surface-2); cursor: pointer; }
table.dt td.mono, table.dt td .mono { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
table.dt td.right { text-align: right; }
table.dt td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }

.trend-card { padding: 20px; }
.trend-chart { height: 100px; margin-top: 8px; }
.trend-chart svg { width: 100%; height: 100%; }

/* ----- Dialog --------------------------------------------- */
.dialog-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 17, 21, 0.36);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 160ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  width: 440px; max-width: calc(100vw - 40px);
  overflow: hidden;
  animation: dialogIn 220ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.dialog-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.dialog-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.dialog-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.dialog-body { padding: 20px 22px; }
.dialog-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(142,27,181,0.12);
}

/* ----- Toasts --------------------------------------------- */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--r);
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  animation: toastIn 220ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: auto;
  max-width: 360px;
}
.toast.ok  { background: var(--ok); }
.toast.bad { background: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ----- Dashboard --------------------------------------- */
.date-picker-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 6px 10px;
  transition: border-color var(--t-fast);
}
.date-picker-wrap:hover { border-color: var(--brand-2); }
.date-picker-label { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.date-picker { font-family: var(--font-mono); font-size: 13px; color: var(--ink); border: none; background: transparent; cursor: pointer; }
.date-picker:focus { outline: none; }

.dash-hero {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  padding: 32px;
  display: grid; grid-template-columns: 160px 1fr auto; gap: 28px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}
.dash-hero.perfect { background: linear-gradient(135deg, rgba(14,154,110,0.04) 0%, rgba(255,255,255,1) 60%); border-color: rgba(14,154,110,0.3); }
.dash-hero.warn    { background: linear-gradient(135deg, rgba(217,143,12,0.04) 0%, rgba(255,255,255,1) 60%); border-color: rgba(217,143,12,0.25); }
.dash-hero.bad     { background: linear-gradient(135deg, rgba(214,53,53,0.04) 0%, rgba(255,255,255,1) 60%); border-color: rgba(214,53,53,0.22); }
.dash-hero.empty   { background: var(--surface-2); }

.dash-hero .ring-wrap { position: relative; width: 140px; height: 140px; }
.dash-hero .ring-big circle { fill: none; stroke-width: 10; }
.dash-hero .ring-big .bg { stroke: var(--line); }
.dash-hero .ring-big .fg { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset 1000ms cubic-bezier(0.22, 1, 0.36, 1); }
.dash-hero.warn .ring-big .fg { stroke: var(--warn); }
.dash-hero.bad .ring-big .fg { stroke: var(--bad); }
.dash-hero .ring-wrap .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dash-hero .pct { font-size: 30px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dash-hero .pct-sub { font-size: 10.5px; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; }

.dash-hero .summary { min-width: 0; }
.dash-hero .summary .status-line { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.dash-hero .summary .headline { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; margin-bottom: 6px; }
.dash-hero .summary .narrative { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; max-width: 640px; }
.dash-hero .actions { display: flex; flex-direction: column; gap: 8px; }

.dash-empty { padding: 60px 20px; text-align: center; }
.dash-empty .ico { width: 56px; height: 56px; color: var(--faint); margin-bottom: 14px; }
.dash-empty .title { font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.dash-empty .sub { font-size: 13px; color: var(--ink-3); max-width: 480px; margin: 0 auto 18px; }

.dash-section { margin-top: 24px; }
.dash-section-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.dash-section-title .count-pill { background: var(--surface-2); color: var(--muted); padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: 1fr; } }

.suspenso-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.suspenso-row:last-child { border-bottom: none; }
.suspenso-row .cuenta { font-family: var(--font-mono); color: var(--ink); }
.suspenso-row .ag { font-family: var(--font-mono); color: var(--muted); font-size: 11px; }
.suspenso-row .monto { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.suspenso-row .days { color: var(--bad); font-size: 11px; font-weight: 600; }

.activity-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child { border-bottom: none; }
.activity-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); margin-top: 7px; flex: none; }
.activity-row .dot.ok { background: var(--ok); }
.activity-row .dot.warn { background: var(--warn); }
.activity-row .when { color: var(--muted); font-family: var(--font-mono); font-size: 11px; min-width: 50px; }
.activity-row .what { color: var(--ink-2); }

/* ----- Inline search/select for table filtering -------- */
.search-inline, .select-inline {
  padding: 6px 10px;
  font-family: inherit; font-size: 12.5px; color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-inline { width: 220px; }
.search-inline:focus, .select-inline:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(142,27,181,0.12);
}

table.adj-table td { font-size: 12.5px; }
table.adj-table td.tipo-d { color: var(--info); font-weight: 600; font-family: var(--font-mono); text-align: right; }
table.adj-table td.tipo-c { color: var(--warn); font-weight: 600; font-family: var(--font-mono); text-align: right; }
table.adj-table td.concepto { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Big match ring on comparison page */
.compare-hero {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  padding: 32px;
  display: flex; gap: 32px; align-items: center;
  margin-bottom: 18px;
}
.compare-hero .ring-big { width: 140px; height: 140px; flex: none; }
.compare-hero .ring-big circle { fill: none; stroke-width: 10; }
.compare-hero .ring-big .bg { stroke: var(--line); }
.compare-hero .ring-big .fg { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset 800ms cubic-bezier(0.22, 1, 0.36, 1); }
.compare-hero .ring-big.warn .fg { stroke: var(--warn); }
.compare-hero .ring-big.bad  .fg { stroke: var(--bad); }
.compare-hero .pct-big { font-size: 32px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.compare-hero .pct-big-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.compare-hero .ring-wrap { position: relative; }
.compare-hero .ring-wrap .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.compare-hero .summary { flex: 1; }
.compare-hero .summary .headline { font-size: 19px; font-weight: 600; color: var(--ink); margin-bottom: 8px; letter-spacing: -0.01em; }
.compare-hero .summary .narrative { font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.compare-hero .summary .narrative.celebrate {
  background: linear-gradient(135deg, rgba(14,154,110,0.06) 0%, rgba(14,154,110,0) 80%);
  padding: 14px 18px; border-radius: var(--r); border-left: 3px solid var(--ok);
}

/* ----- Versions view ------------------------------------- */
.version-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.version-row {
  display: grid;
  grid-template-columns: 220px 1fr 140px 110px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  font-size: 13px;
}
.version-row .comp-name { font-weight: 600; color: var(--ink); font-size: 13px; }
.version-row .comp-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.version-row .version { font-family: var(--font-mono); font-size: 12px; color: var(--brand); font-weight: 500; }
.version-row .sha { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.version-row .when { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-align: right; }

/* ----- Utility -------------------------------------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.text-right { text-align: right; }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px; }
  .pipeline { grid-template-columns: 1fr; }
  .pipe-step::after { display: none; }
  .compare-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   NEW CUADRE / UPLOAD EXPERIENCE
   ============================================================ */
.nc-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .nc-grid { grid-template-columns: 1fr; } }

.nc-expected {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 16px;
}
.nc-expected-title { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 12px; letter-spacing: -0.01em; }
.nc-expected-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.nc-expected-item:last-child { border-bottom: none; }
.nc-exp-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; flex: none; margin-top: 1px; }
.nc-exp-badge.req { background: var(--brand-soft); color: var(--brand); }
.nc-exp-badge.opt { background: var(--surface-2); color: var(--muted); }
.nc-exp-info { min-width: 0; }
.nc-exp-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.nc-exp-name code { font-family: var(--font-mono); font-size: 11px; color: var(--brand-2); background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; }
.nc-exp-desc { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.nc-dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); padding: 44px 24px; text-align: center;
  transition: all var(--t-fast); cursor: pointer;
}
.nc-dropzone:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.nc-drop-ico { width: 44px; height: 44px; color: var(--muted); margin-bottom: 12px; }
.nc-dropzone:hover .nc-drop-ico { color: var(--brand-2); }
.nc-drop-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.nc-drop-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.nc-browse { background: none; border: none; color: var(--brand-2); font-weight: 600; cursor: pointer; font-size: 12.5px; padding: 0; text-decoration: underline; }
.nc-drop-hint { font-size: 11px; color: var(--muted); margin-top: 10px; font-family: var(--font-mono); }

.nc-analysis { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.nc-analysis-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.nc-analysis-pct { font-family: var(--font-mono); font-weight: 600; color: var(--brand); }
.nc-progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.nc-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; transition: width 280ms cubic-bezier(0.22,1,0.36,1); }

.nc-checklist-card, .nc-agent-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 16px;
}
.nc-checklist-title, .nc-agent-title { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 12px; letter-spacing: -0.01em; }
.nc-check-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.nc-check-item:last-child { border-bottom: none; }
.nc-check-mark { width: 20px; height: 20px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; }
.nc-check-mark.ok { background: var(--ok-soft); color: var(--ok); }
.nc-check-mark.missing { background: var(--surface-2); color: var(--faint); }
.nc-check-mark.bad { background: var(--bad-soft); color: var(--bad); }
.nc-check-label { flex: 1; color: var(--ink-2); }
.nc-check-label .ct { font-weight: 600; color: var(--ink); }
.nc-check-file { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.nc-check-req { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.nc-start-row { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nc-start-msg { font-size: 11.5px; color: var(--ink-3); }
.nc-start-msg.ready { color: var(--ok); font-weight: 600; }

/* Blur overlay during drag */
.drag-blur-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(88, 10, 115, 0.10);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity 160ms ease;
}
.drag-blur-overlay.show { opacity: 1; }
.drag-blur-card {
  background: var(--surface); border: 2px dashed var(--brand-2);
  border-radius: var(--r-lg); padding: 40px 56px; text-align: center;
  box-shadow: var(--sh-3); transform: scale(0.96); transition: transform 160ms ease;
}
.drag-blur-overlay.show .drag-blur-card { transform: scale(1); }
.drag-blur-card svg { width: 48px; height: 48px; color: var(--brand-2); margin-bottom: 12px; }
.drag-blur-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.drag-blur-sub { font-size: 13px; color: var(--ink-3); margin-top: 6px; }

/* Agent visual (pipeline) */
.agent-flow { display: flex; flex-direction: column; gap: 0; }
.agent-stage { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.agent-stage-ico { width: 30px; height: 30px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); }
.agent-stage-body { min-width: 0; flex: 1; }
.agent-stage-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.agent-stage-desc { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.agent-connector { width: 30px; display: flex; justify-content: center; }
.agent-connector::before { content: ""; width: 2px; height: 12px; background: var(--brand-line); }

/* ============================================================
   CLAUDE CHAT DOCK
   ============================================================ */
.chat-dock { position: fixed; left: 268px; bottom: 20px; z-index: 1000; }

.chat-launcher {
  display: flex; align-items: center; gap: 9px;
  background: var(--brand); color: #fff; border: none;
  padding: 12px 18px; border-radius: 99px; cursor: pointer;
  font-size: 13px; font-weight: 600; box-shadow: var(--sh-3);
  transition: transform var(--t-fast), background var(--t-fast);
}
.chat-launcher:hover { transform: translateY(-1px); background: var(--brand-2); }
.chat-dock[data-state="open"] .chat-launcher,
.chat-dock[data-state="full"] .chat-launcher { display: none; }

.chat-panel {
  display: none; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--sh-3); overflow: hidden;
}
.chat-dock[data-state="open"] .chat-panel {
  display: flex; width: 400px; height: 560px;
}
.chat-dock[data-state="full"] .chat-panel {
  display: flex; position: fixed; inset: 24px; width: auto; height: auto;
  border-radius: var(--r-lg);
}

.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head-title { display: flex; align-items: center; gap: 10px; }
.chat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 3px var(--ok-soft); }
.chat-title-main { font-size: 13px; font-weight: 700; color: var(--ink); }
.chat-title-sub { font-size: 10.5px; color: var(--muted); }
.chat-head-actions { display: flex; gap: 4px; }
.chat-icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; display: flex; }
.chat-icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-insights { display: none; }
.chat-dock[data-state="full"] .chat-insights {
  display: block; width: 340px; flex: none; border-left: 1px solid var(--line);
  overflow-y: auto; padding: 18px; background: var(--surface-2);
}
.chat-dock[data-state="full"] .chat-thread { padding: 24px 32px; }

.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; }
.chat-bubble { padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.chat-msg.user .chat-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant .chat-bubble { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg-role { font-size: 9.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.chat-typing { display: flex; gap: 4px; padding: 12px 14px; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: chatBounce 1.2s infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.chat-chip { font-size: 11.5px; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 99px; padding: 5px 11px; cursor: pointer; transition: background var(--t-fast); }
.chat-chip:hover { background: var(--brand-line); }

.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input { flex: 1; resize: none; border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; font-size: 13px; font-family: inherit; color: var(--ink); max-height: 120px; line-height: 1.4; }
.chat-input:focus { outline: none; border-color: var(--brand-2); }
.chat-send { background: var(--brand); color: #fff; border: none; border-radius: 10px; width: 38px; height: 38px; flex: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--t-fast); }
.chat-send:hover { background: var(--brand-2); }
.chat-send:disabled { background: var(--line-strong); cursor: not-allowed; }

.chat-insight-block { margin-bottom: 18px; }
.chat-insight-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.chat-insight-stat { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.chat-insight-stat:last-child { border-bottom: none; }
.chat-insight-stat .k { color: var(--ink-3); }
.chat-insight-stat .v { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }

/* ============================================================
   DASHBOARD AGGREGATE ROLL-UP
   ============================================================ */
.dash-agg { margin-bottom: 8px; }
.dash-agg-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.dash-agg-title { font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.dash-agg-note { font-size: 11.5px; color: var(--muted); }

.dash-agg-strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px;
}
@media (max-width: 1100px) { .dash-agg-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .dash-agg-strip { grid-template-columns: repeat(2, 1fr); } }

.agg-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 15px; position: relative; overflow: hidden;
}
.agg-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-2); }
.agg-card.accent-ok::before { background: var(--ok); }
.agg-card.accent-warn::before { background: var(--warn); }
.agg-label { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.agg-value { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.agg-value.ok { color: var(--ok); }
.agg-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }

.dash-cuadres-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px;
}
.dash-cuadre-chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 14px; font-size: 12.5px;
}
.dash-cuadre-chip .cdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dash-cuadre-chip .cname { font-weight: 600; color: var(--ink); }
.dash-cuadre-chip .cmeta { color: var(--muted); font-size: 11px; }
.dash-cuadre-chip.planned { opacity: 0.62; }

.dash-detail-head { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.dash-section-heading { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; margin: 0; }
.dash-section-note { font-size: 11.5px; color: var(--muted); }

/* mini sparkline bars for aggregate match trend */
.agg-spark { display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: 8px; }
.agg-spark-bar { flex: 1; background: var(--brand-line); border-radius: 2px 2px 0 0; min-height: 3px; transition: height 400ms ease; }
.agg-spark-bar.best { background: var(--ok); }

/* ============================================================
   ROLE SWITCHER
   ============================================================ */
.user-card { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: var(--r-md); padding: 8px; cursor: pointer; text-align: left; transition: background var(--t-fast); }
.user-card:hover { background: var(--surface-2); border-color: var(--line); }
.user-card-info { flex: 1; min-width: 0; }
.role-chev { color: var(--muted); flex: none; }
.role-menu { margin-top: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--sh-2); overflow: hidden; }
.role-opt { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
.role-opt:last-child { border-bottom: none; }
.role-opt:hover { background: var(--brand-soft); }
.role-opt.active { background: var(--brand-soft); }
.role-opt-name { font-size: 12.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.role-opt-name .chk { color: var(--brand); }
.role-opt-desc { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }

.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ============================================================
   CUADRE STATUS BADGES (workspaces list)
   ============================================================ */
.cuadre-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.cuadre-status svg { width: 12px; height: 12px; }
.cuadre-status.verified { background: var(--ok-soft); color: var(--ok); }
.cuadre-status.issues { background: var(--bad-soft); color: var(--bad); }
.cuadre-status.pending-val { background: var(--warn-soft); color: var(--warn); }
.cuadre-status.ran { background: var(--brand-soft); color: var(--brand); }
.cuadre-status.notrun { background: var(--surface-2); color: var(--muted); }

/* ============================================================
   ISSUES
   ============================================================ */
.iss-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 800px) { .iss-summary { grid-template-columns: repeat(2, 1fr); } }
.iss-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.iss-stat-v { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.iss-stat-v.bad { color: var(--bad); }
.iss-stat-v.ok { color: var(--ok); }
.iss-stat-l { font-size: 11px; color: var(--muted); margin-top: 3px; }

.iss-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.iss-filter { font-size: 12px; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.iss-filter.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.iss-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 10px; display: flex; gap: 14px; align-items: flex-start; }
.iss-card.sev-high { border-left: 3px solid var(--bad); }
.iss-card.sev-medium { border-left: 3px solid var(--warn); }
.iss-card.sev-low { border-left: 3px solid var(--info); }
.iss-main { flex: 1; min-width: 0; }
.iss-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.iss-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; }
.iss-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.iss-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 5px; }
.iss-tag.cat { background: var(--brand-soft); color: var(--brand); }
.iss-tag.src-auto { background: var(--info-soft); color: var(--info); }
.iss-tag.src-manual { background: var(--surface-2); color: var(--ink-3); }
.iss-tag.date { background: var(--surface-2); color: var(--ink-3); font-family: var(--font-mono); text-transform: none; }
.iss-status-sel { font-size: 11.5px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.iss-status-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.iss-status-pill.open { background: var(--bad-soft); color: var(--bad); }
.iss-status-pill.investigating { background: var(--warn-soft); color: var(--warn); }
.iss-status-pill.resolved { background: var(--ok-soft); color: var(--ok); }
.iss-status-pill.wont_fix { background: var(--surface-2); color: var(--muted); }
.iss-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; flex: none; }

/* ============================================================
   RESULTS DASHBOARD (post-validation)
   ============================================================ */
.res-verdict { border-radius: var(--r-lg); padding: 28px 32px; margin-bottom: 20px; display: flex; align-items: center; gap: 24px; }
.res-verdict.ok { background: linear-gradient(135deg, var(--ok-soft), #fff); border: 1px solid var(--ok); }
.res-verdict.diff { background: linear-gradient(135deg, var(--warn-soft), #fff); border: 1px solid var(--warn); }
.res-verdict-ring { width: 110px; height: 110px; flex: none; }
.res-verdict-body { flex: 1; }
.res-verdict-status { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.res-verdict.ok .res-verdict-status { color: var(--ok); }
.res-verdict.diff .res-verdict-status { color: var(--warn); }
.res-verdict-title { font-size: 22px; font-weight: 700; color: var(--ink); margin: 6px 0; letter-spacing: -0.01em; }
.res-verdict-sub { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.res-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 800px) { .res-metrics { grid-template-columns: repeat(2, 1fr); } }
.res-metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.res-metric-v { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.res-metric-l { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Field + dialog-x additions for issue modal */
.field-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field-input { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; font-size: 13px; font-family: inherit; color: var(--ink); box-sizing: border-box; }
.field-input:focus { outline: none; border-color: var(--brand-2); }
.field { display: block; margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.dialog-x { background: none; border: none; font-size: 16px; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.dialog-x:hover { background: var(--surface-2); color: var(--ink); }

/* ============================================================
   VALIDATION SUMMARY CARD (post-upload, pre-cuadre)
   ============================================================ */
.nc-validation-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 16px;
}
.nc-val-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.nc-val-title { font-size: 12px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.nc-val-pill { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; }
.nc-val-pill.ok { background: var(--ok-soft); color: var(--ok); }
.nc-val-pill.warn { background: var(--warn-soft); color: var(--warn); }
.nc-val-pill.error { background: var(--bad-soft); color: var(--bad); }

.nc-val-file { padding: 10px 0; border-bottom: 1px solid var(--line); }
.nc-val-file:last-child { border-bottom: none; }
.nc-val-file-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.nc-val-file-name { font-weight: 600; color: var(--ink); }
.nc-val-file-type { font-family: var(--font-mono); font-size: 10px; color: var(--brand-2); background: var(--brand-soft); padding: 1px 6px; border-radius: 4px; }
.nc-val-status { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; }
.nc-val-status.ok { background: var(--ok-soft); color: var(--ok); }
.nc-val-status.warn { background: var(--warn-soft); color: var(--warn); }
.nc-val-status.error { background: var(--bad-soft); color: var(--bad); }

.nc-val-details { font-size: 11.5px; color: var(--ink-3); margin-left: 2px; }
.nc-val-details li { padding: 2px 0; list-style: none; position: relative; padding-left: 14px; line-height: 1.45; }
.nc-val-details li::before { content: "·"; position: absolute; left: 5px; color: var(--muted); font-weight: 700; }
.nc-val-details ul { padding: 0; margin: 0; }
.nc-val-note { font-size: 11.5px; padding: 6px 10px; border-radius: 6px; margin-top: 6px; }
.nc-val-note.warn { background: var(--warn-soft); color: var(--warn); }
.nc-val-note.error { background: var(--bad-soft); color: var(--bad); }

/* ============================================================
   WORKSPACE: compact files + pipeline preview
   ============================================================ */
.ws-files-compact .file-list { margin-top: 0; }
.ws-files-actions { margin-top: 10px; }
.btn-sm { font-size: 11.5px; padding: 5px 10px; }
.pipeline-preview { margin-top: 16px; }
.pipeline-preview .agent-flow { max-width: 640px; }
/* When a run begins we hide the static preview and show the live run card */
.pipeline-preview.dimmed { display: none; }

/* ============================================================
   BALANCES TABLE (post-validation, spreadsheet-like)
   ============================================================ */
.nc-balances-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px; margin-top: 16px;
}
.nc-bal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.nc-bal-title { font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.nc-bal-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.nc-bal-toggle { display: flex; gap: 0; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.nc-bal-tab { font-size: 11.5px; padding: 6px 12px; background: var(--surface); color: var(--ink-2); border: none; cursor: pointer; }
.nc-bal-tab.active { background: var(--brand); color: #fff; }

.nc-bal-scroll { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table.nc-bal-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.nc-bal-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--ink-2);
  font-weight: 600; font-size: 10.5px; letter-spacing: 0.03em; text-transform: uppercase;
  text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
table.nc-bal-table thead th.left { text-align: left; }
table.nc-bal-table tbody td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.nc-bal-table tbody td.left { text-align: left; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink); }
table.nc-bal-table tbody td.dim { color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; }
table.nc-bal-table tbody tr:hover { background: var(--brand-soft); }
table.nc-bal-table tbody td.num { color: var(--ink-2); }
table.nc-bal-table tbody td.diff-pos { color: var(--ok); font-weight: 600; }
table.nc-bal-table tbody td.diff-neg { color: var(--bad); font-weight: 600; }
table.nc-bal-table tbody td.diff-zero { color: var(--faint); }
table.nc-bal-table tfoot td {
  position: sticky; bottom: 0; background: var(--surface-2);
  padding: 9px 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--line-strong); font-size: 12px;
}
table.nc-bal-table tfoot td.left { text-align: left; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.03em; color: var(--ink-3); }
.nc-bal-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 12.5px; }
.nc-bal-trunc { font-size: 11px; color: var(--warn); margin-top: 8px; }

/* ============================================================
   New-cuadre layout: validation + balances surface high;
   agent pipeline becomes a compact horizontal strip at the bottom
   ============================================================ */
.nc-validation-card { margin-top: 16px; }
.nc-agent-bottom { margin-top: 16px; }
.nc-agent-bottom .agent-flow { flex-direction: row; flex-wrap: wrap; gap: 8px; max-width: none; }
.nc-agent-bottom .agent-connector { display: none; }
.nc-agent-bottom .agent-stage {
  flex: 1 1 150px; min-width: 150px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; gap: 9px;
}
.nc-agent-bottom .agent-stage-ico { width: 26px; height: 26px; }
.nc-agent-bottom .agent-stage-name { font-size: 12px; }
.nc-agent-bottom .agent-stage-desc { font-size: 10.5px; }

/* ============================================================
   NEW-CUADRE STEPPED WORKFLOW
   ============================================================ */
.nc-stepper { display: flex; align-items: center; gap: 0; margin: 4px 0 22px; }
.nc-step { display: flex; align-items: center; gap: 9px; }
.nc-step-num {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--surface-2);
  color: var(--muted); border: 1.5px solid var(--line-strong); transition: all var(--t-fast);
}
.nc-step-label { font-size: 13px; font-weight: 600; color: var(--muted); transition: color var(--t-fast); white-space: nowrap; }
.nc-step.active .nc-step-num { background: var(--brand); color: #fff; border-color: var(--brand); }
.nc-step.active .nc-step-label { color: var(--ink); }
.nc-step.done .nc-step-num { background: var(--ok); color: #fff; border-color: var(--ok); }
.nc-step.done .nc-step-label { color: var(--ink-2); }
.nc-step.done .nc-step-num::after { content: "✓"; }
.nc-step.done .nc-step-num span { display: none; }
.nc-step-line { flex: 1; height: 1.5px; background: var(--line-strong); margin: 0 14px; min-width: 30px; }

.nc-wizard-nav {
  display: flex; align-items: center; gap: 16px; margin-top: 22px;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.nc-wizard-msg { flex: 1; font-size: 12.5px; color: var(--ink-3); }
.nc-wizard-msg.ready { color: var(--ok); font-weight: 600; }
.nc-wizard-msg.bad { color: var(--bad); font-weight: 600; }
.nc-wizard-nav .btn-primary { display: inline-flex; align-items: center; }
#nc-back:not([hidden]) { display: inline-flex; align-items: center; }
#nc-back[hidden] { display: none; }

/* Validation warning banner carried onto the balances step */
.nc-val-banner { padding: 10px 14px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.nc-val-banner.warn { background: var(--warn-soft); color: var(--warn); }
.nc-val-banner .vb-strong { font-weight: 700; }

/* Account-name column in balances table */
table.nc-bal-table td.name { font-family: var(--font-sans); font-size: 11.5px; color: var(--ink-2); max-width: 280px; white-space: normal; line-height: 1.35; }
table.nc-bal-table td.name .name-detail { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }

/* ============================================================
   WIZARD STEPS 3-6 · run / results / adjustments / compare
   ============================================================ */
.nc-run-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
.nc-run-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.nc-pipe-stages { display: flex; flex-direction: column; gap: 2px; }
.nc-pipe-stage { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; }
.nc-pipe-stage.done { background: var(--ok-soft); }
.nc-pipe-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1.5px solid var(--line-strong); }
.nc-pipe-stage.done .nc-pipe-dot { background: var(--ok); color: #fff; border-color: var(--ok); }
.nc-pipe-stage.done .nc-pipe-dot::after { content: "✓"; }
.nc-pipe-stage.done .nc-pipe-dot span { display: none; }
.nc-pipe-body { flex: 1; }
.nc-pipe-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.nc-pipe-desc { font-size: 11px; color: var(--ink-3); }
.nc-pipe-out { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ok); font-weight: 600; text-align: right; }
.nc-agent-log-wrap { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.nc-agent-log-head { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.nc-agent-log { max-height: 260px; overflow: auto; padding: 8px 12px; font-family: var(--font-mono); font-size: 11px; }
.nc-log-line { padding: 2px 0; }
.nc-log-tag { font-weight: 700; }
.nc-log-line.res .nc-log-tag { color: var(--ok); }
.nc-log-line.def .nc-log-tag { color: var(--warn); }
.nc-log-line.esc .nc-log-tag { color: var(--bad); }
.nc-log-acct { color: var(--ink-2); }

.nc-results-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.nc-rm { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--r-md); padding: 14px 16px; }
.nc-rm-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.nc-rm-value { font-size: 26px; font-weight: 700; color: var(--ink); margin: 2px 0; letter-spacing: -0.02em; }
.nc-rm-sub { font-size: 11px; color: var(--muted); }
.nc-results-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nc-chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.nc-chart-title { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.nc-donut-wrap { display: flex; align-items: center; gap: 20px; }
.nc-donut-num { font-size: 22px; font-weight: 700; fill: var(--ink); }
.nc-donut-cap { font-size: 10px; fill: var(--muted); text-transform: uppercase; }
.nc-legend { display: flex; flex-direction: column; gap: 8px; }
.nc-leg { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.nc-leg-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.nc-bars { display: flex; flex-direction: column; gap: 12px; }
.nc-bar-row { display: flex; align-items: center; gap: 10px; }
.nc-bar-label { font-size: 11.5px; color: var(--ink-2); width: 120px; flex: none; }
.nc-bar-track { flex: 1; height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.nc-bar-fill { height: 100%; border-radius: 7px; }
.nc-bar-val { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; width: 70px; text-align: right; flex: none; }
table.nc-bal-table td.tipo-d { color: var(--brand-2); font-weight: 700; }
table.nc-bal-table td.tipo-c { color: var(--ok); font-weight: 700; }
.nc-compare-empty { text-align: center; padding: 40px 24px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.nc-ce-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.nc-ce-sub { font-size: 12.5px; color: var(--ink-3); max-width: 480px; margin: 0 auto; }
@media (max-width: 900px) { .nc-results-metrics { grid-template-columns: repeat(2,1fr); } .nc-results-charts { grid-template-columns: 1fr; } }

/* ============================================================
   Header action bar (nav buttons top-right) + readonly date
   ============================================================ */
.nc-head-actions { display: flex; align-items: center; gap: 18px; }
.nc-date-display { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.nc-date-display .date-picker-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.nc-date-value { font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.nc-date-value.detected { color: var(--brand); }
.nc-head-nav { display: flex; align-items: center; gap: 10px; }
.nc-head-nav .btn-primary { display: inline-flex; align-items: center; }
#nc-back:not([hidden]) { display: inline-flex; align-items: center; }
#nc-back[hidden] { display: none; }
.nc-wizard-msg-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); min-height: 20px; }
.nc-wizard-msg-row .nc-wizard-msg { font-size: 12.5px; color: var(--ink-3); }
.nc-wizard-msg-row .nc-wizard-msg.ready { color: var(--ok); font-weight: 600; }
.nc-wizard-msg-row .nc-wizard-msg.bad { color: var(--bad); font-weight: 600; }
/* Balances KPIs/charts spacing on step 2 */
#nc-bal-kpis:empty, #nc-bal-charts:empty { display: none; }
#nc-bal-charts { margin-bottom: 16px; }

/* ============================================================
   BULK INTAKE (Cuadre runs page)
   ============================================================ */
.intake-card { margin: 8px 0 24px; }
.intake-dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  padding: 28px 24px; text-align: center; cursor: pointer; transition: all var(--t-fast);
  background: var(--surface);
}
.intake-dropzone:hover, .intake-dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.intake-dropzone .nc-drop-ico { width: 34px; height: 34px; color: var(--brand); margin-bottom: 8px; }
.intake-queue { margin-top: 16px; }
.intake-queue-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 12px; }
.intake-queue-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.intake-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 8px; background: var(--surface);
}
.intake-row-date { font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; width: 110px; flex: none; }
.intake-row-files { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.intake-chip { font-size: 11px; padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.intake-chip.mayor { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.intake-chip.bank { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.intake-chip.bi { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.intake-row-status { font-size: 12px; font-weight: 600; width: 150px; flex: none; text-align: right; }
.intake-row-status.ready { color: var(--ok); }
.intake-row-status.needs { color: var(--warn); }
.intake-row-status.running { color: var(--brand); }
.intake-row-status.done { color: var(--ok); }
.intake-unmatched { margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.intake-unmatched .um-row { padding: 4px 0; }

/* ===== Ground-truth reconciliation (step 6) ===== */
.ct-banner { font-size: 12.5px; color: var(--ink-2); background: var(--brand-soft); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.nc-rm-value.ct-ok { color: var(--ok); }
.nc-rm-value.ct-warn { color: var(--warn); }
.nc-rm-value.ct-bad { color: var(--bad); }
.nc-rm-value .ct-vs { font-size: 13px; color: var(--muted); font-weight: 400; }
.ct-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 4px; }
.ct-card .nc-bal-scroll { max-height: 360px; }
.ct-tag { font-size: 9px; padding: 1px 6px; border-radius: 10px; vertical-align: middle; margin-left: 4px; }
.ct-tag.bad { background: var(--bad-soft, #fde8e8); color: var(--bad); }
.ct-tag.warn { background: var(--warn-soft, #fdf3e0); color: var(--warn); }
.ct-miss { background: var(--bad-soft, #fdeaea); }
.ct-delta { color: var(--bad); font-weight: 600; }
.ct-concepts-card { align-self: start; }
.ct-concepts { display: flex; flex-direction: column; gap: 6px; }
.ct-concept { font-size: 12px; color: var(--ink-2); }
.ct-concept-n { display: inline-block; min-width: 26px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--bad); }
.ct-missing { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 900px) { .ct-cols { grid-template-columns: 1fr; } }

/* Account-class filter (workspace header) */
.class-filter {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-soft, #6b6b78);
  background: var(--surface, #fff); border: 1px solid var(--line, #e6e1da);
  border-radius: 10px; padding: 6px 10px;
}
.class-filter > span { font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.class-filter select {
  border: none; background: transparent; font: inherit; color: var(--ink, #2a2a32);
  font-weight: 600; cursor: pointer; outline: none; padding: 2px 2px;
}
.file-type-pill[data-type="cfrep_diferencias"] {
  background: #fbeafc; color: #8e1bb5; border-color: #e9c6f0;
}

/* --- by-currency / FX / escalation breakdown panel --- */
#results-currency { margin-top: 18px; }
.currency-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.currency-head h4 { margin:0; font-size:13px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted,#6b6b78); }
.currency-pills { display:flex; gap:8px; flex-wrap:wrap; }
.currency-pills .pill { font-size:11px; font-weight:600; padding:4px 10px; border-radius:14px; background:#efe6f5; color:#580A73; border:1px solid #d9c7e6; }
.currency-pills .pill.warn { background:#fdf3e0; color:#b4790a; border-color:#e3c07e; }
.currency-pills .pill.bad { background:#fce8ec; color:#BE123C; border-color:#eecdd4; }
.currency-table { width:100%; border-collapse:collapse; font-size:13px; }
.currency-table th, .currency-table td { padding:7px 10px; border-bottom:1px solid var(--line,#e8e3dc); text-align:left; }
.currency-table th.num, .currency-table td.num { text-align:right; font-variant-numeric:tabular-nums; font-family:ui-monospace,monospace; }
.currency-table td.num.ok { color:#3f9e34; } .currency-table td.num.warn { color:#b4790a; }
.currency-table thead th { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted,#6b6b78); }
.currency-bridge { margin-top:8px; font-size:12.5px; color:#580A73; }
.currency-foot { margin-top:8px; font-size:11.5px; color:var(--muted,#6b6b78); font-style:italic; }
/* ---- Diferencias Workbench ---- */
.dif-summary .card-body { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.dif-recon { min-width: 280px; }
.dif-recon-row { display: flex; justify-content: space-between; gap: 20px; padding: 3px 0; font-size: 13px; color: var(--muted); }
.dif-recon-row b { color: var(--ink); }
.dif-recon-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-weight: 600; color: var(--ink); }
.dif-classchips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; align-content: flex-start; }
.dif-chip { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-pill); padding: 5px 11px; font-size: 12px; cursor: pointer; color: var(--muted); transition: var(--t-fast); }
.dif-chip:hover { border-color: var(--brand-line); color: var(--ink); }
.dif-chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.dif-chip b { color: var(--ink); margin-left: 3px; }

.dif-full { margin-top: 14px; }
.dif-ws-card { margin-top: 14px; }
.dif-table-wrap { overflow: visible; }
.dif-row { cursor: pointer; }
.dif-row:hover { background: var(--brand-soft); }
.dif-cls { font-size: 11px; color: var(--muted); }
.dif-st { font-size: 11px; padding: 2px 7px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.dif-st-pending { color: var(--muted); }
.dif-st-explained { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.dif-st-resolved { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.dif-st-wontfix { color: var(--muted); background: var(--faint); }

.dif-case-row > td { background: var(--faint); padding: 0; }
.dif-case { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.dif-case-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dif-case label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.dif-case textarea { resize: vertical; font-family: var(--font-ui); }
.dif-case-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dif-chk { flex-direction: row !important; align-items: center; gap: 6px; font-weight: 400 !important; }
.dif-case-attrs { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--ink); padding-bottom: 4px; border-bottom: 1px dashed var(--line); }
.dif-attr .k { color: var(--muted); font-weight: 600; font-size: 10px; letter-spacing: .04em; }
.dif-case-note { font-size: 12px; color: var(--muted); background: var(--info-soft); border-left: 3px solid var(--info); padding: 6px 10px; border-radius: 4px; }
.dif-trig { border: 1px solid var(--brand-line); background: var(--brand-soft); border-radius: var(--r-sm); padding: 10px 12px; }
.dif-trig-head { font-size: 12px; font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.dif-trig-grid { grid-template-columns: 1.4fr 1fr 1fr; }
@media (max-width: 720px) { .dif-case-grid, .dif-trig-grid { grid-template-columns: 1fr; } }

.dif-worksheet { width: 100%; height: 360px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.dif-recalc-banner { padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 10px; font-size: 13px; line-height: 1.5; }
.dif-recalc-banner.ok { background: var(--ok-soft); border: 1px solid var(--ok); color: var(--ink); }
.dif-recalc-banner.warn { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--ink); }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ---- Compare results: 4-bucket breakdown ---- */
.res-breakdown { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .res-breakdown { grid-template-columns: 1fr; } }
.res-breakdown-title { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.res-bucket { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 12px 14px; }
.res-bucket-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.res-bucket-head b { color: var(--ink); }
.res-bucket-n { margin-left: auto; font-weight: 700; font-family: var(--font-mono); color: var(--ink); }
.res-bucket-sub { font-size: 11px; color: var(--muted); margin: 3px 0 8px; }
.res-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.res-dot.bad { background: var(--bad); } .res-dot.warn { background: var(--warn); }
.res-dot.info { background: var(--info); } .res-dot.esc { background: #8E1BB5; }
.res-dot.add { background: var(--ok); } .res-dot.rem { background: var(--bad); } .res-dot.ok { background: var(--ok); }

/* +/−/✓ reconciliation icons (compare-by-account) */
.cmp-ic { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px; font-weight: 800; font-size: 13px; line-height: 1; }
.cmp-ic.add  { background: var(--ok-soft);   color: var(--ok); }
.cmp-ic.rem  { background: var(--bad-soft);  color: var(--bad); }
.cmp-ic.ok   { background: var(--ok-soft);   color: var(--ok); }
.cmp-ic.neq  { background: var(--warn-soft); color: var(--warn); }
.cmp-ic-cell { width: 26px; text-align: center; }
.cmp-acct-tbl td.num { font-variant-numeric: tabular-nums; }
.res-metric-v.cmp-add { color: var(--ok); } .res-metric-v.cmp-rem { color: var(--bad); } .res-metric-v.cmp-ok { color: var(--ok); }
.res-bucket-tbl { width: 100%; font-size: 12px; }
.res-bucket-tbl td { padding: 3px 6px; border-bottom: 1px solid var(--faint); }
.res-bucket-tbl tbody { display: table-row-group; }
.res-bucket-tbl tr { width: 100%; }
.res-bucket-more { font-size: 11px; color: var(--brand); margin-top: 6px; }
.res-bucket-empty { font-size: 12px; color: var(--muted); padding: 6px 0; }
.res-reason { font-size: 10px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--info-soft); color: var(--info); border: 1px solid var(--info); }

/* ---- Clear-data button (sidebar) ---- */
.reset-btn { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: center;
  font-size: 12px; padding: 7px 10px; margin-bottom: 8px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--muted); cursor: pointer; transition: var(--t-fast); }
.reset-btn:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.reset-btn .ico { flex: 0 0 auto; }

/* ---- Reglas del cuadre ---- */
.rules-table td { vertical-align: top; }
.rule-tier { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.rule-t1 { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.rule-t2 { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.rule-t3 { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

/* ---- Workbench breakdown cards + incident badge ---- */
.dif-break { flex: 1; min-width: 280px; }
.dif-break-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.dif-break-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dif-break-card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; font-size: 12px; color: var(--muted); transition: var(--t-fast); text-align: left; }
.dif-break-card.static { cursor: default; }
.dif-break-card:not(.static):hover { border-color: var(--brand-line); }
.dif-break-card.active { background: var(--brand-soft); border-color: var(--brand); }
.dif-break-card b { font-family: var(--font-mono); font-size: 15px; color: var(--ink); }
.dif-break-card span:last-child { line-height: 1.1; }
.dif-inc-row { margin: 2px 0; }
.dif-inc { font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.dif-inc.pend { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.dif-inc.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.dif-inc.filed { color: var(--info); border-color: var(--info); background: var(--info-soft); }

/* ---- Teaching loop: balance bar, propose form, learned cards ---- */
.dif-balance { font-size: 12px; font-family: var(--font-mono); color: var(--muted); padding: 3px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.dif-balance.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.dif-balance.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.dif-propose { border: 1px solid var(--brand-line); background: var(--brand-soft); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.lr-card { margin-bottom: 12px; }
.lr-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.lr-grid { display: grid; grid-template-columns: 1.4fr 1.4fr 1fr; gap: 12px; font-size: 12px; color: var(--ink); margin: 8px 0; }
.lr-grid .k { color: var(--muted); font-weight: 600; font-size: 10px; letter-spacing: .03em; display: block; }
.lr-st { font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.lr-draft { color: var(--muted); }
.lr-tested { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.lr-committed { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.lr-test { font-size: 12px; padding: 8px 10px; border-radius: var(--r-sm); margin: 6px 0; }
.lr-test.ok { background: var(--ok-soft); border: 1px solid var(--ok); }
.lr-test.bad { background: var(--bad-soft); border: 1px solid var(--bad); }

/* ---- Rule detail + playground ---- */
.rd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.rd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1000px) { .rd-grid, .rd-grid2 { grid-template-columns: 1fr; } }
.rd-kv { display: flex; flex-direction: column; gap: 1px; padding: 5px 0; border-bottom: 1px solid var(--faint); font-size: 13px; color: var(--ink); }
.rd-kv .k { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.rule-row:hover { background: var(--brand-soft); }
.pg-verdict { padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; }
.pg-verdict.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok); }
.pg-verdict.warn { background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn); }
.pg-verdict.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); }
.pg-log { margin-top: 8px; background: #131312; color: #9fe8b0; font-family: var(--font-mono); font-size: 11px; line-height: 1.6; padding: 10px 12px; border-radius: var(--r-sm); max-height: 220px; overflow: auto; }
.pg-log div { white-space: pre-wrap; word-break: break-word; }

/* ---- Workspace run-config (moved out of the header) ---- */
.ws-runcfg { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- Compare breakdown as tabs ---- */
.res-breakdown-tabs { display: block; }
.res-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin: 8px 0 0; }
.res-tab { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-bottom: none;
  background: transparent; padding: 8px 14px; font-size: 13px; color: var(--muted); cursor: pointer;
  border-radius: var(--r-sm) var(--r-sm) 0 0; margin-bottom: -1px; }
.res-tab:hover { color: var(--ink); }
.res-tab.active { color: var(--ink); background: var(--surface); border-color: var(--line); border-bottom: 1px solid var(--surface); font-weight: 600; }
.res-tab b { font-family: var(--font-mono); }
.res-tab-body { border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--r-sm) var(--r-sm); padding: 12px 14px; }
.res-totals { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; color: var(--muted); padding: 6px 0 10px; border-bottom: 1px solid var(--faint); margin-bottom: 8px; }
.res-totals b { color: var(--ink); font-family: var(--font-mono); }
.res-tab-body .res-bucket-tbl thead th { font-size: 10px; color: var(--muted); text-align: left; padding: 2px 6px; }

/* ============ Reusable right-side detail drawer ============ */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,18,20,.28); opacity: 0;
  pointer-events: none; transition: opacity .18s ease; z-index: 60; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.detail-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 400px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(15,18,20,.12);
  transform: translateX(100%); transition: transform .2s ease; z-index: 61; display: flex; flex-direction: column; }
.detail-drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-title { font-size: 15px; font-weight: 700; color: var(--ink); word-break: break-all; }
.drawer-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.drawer-x { border: none; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.drawer-x:hover { background: var(--surface-2); color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 18px 18px; }
.drawer-field { padding: 10px 0; border-bottom: 1px solid var(--faint); }
.drawer-field-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.drawer-field-value { font-size: 13px; color: var(--ink); line-height: 1.45; word-break: break-word; }
.drawer-field-value.mono { font-family: var(--font-mono); font-size: 12.5px; }
.drawer-field-value.pre { white-space: pre-wrap; }
.drawer-actions { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer-note { width: 100%; min-height: 64px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 12.5px; color: var(--ink); margin-top: 4px; }
.ev-item { font-size: 12px; color: var(--ink); padding: 4px 0; border-bottom: 1px dotted var(--faint); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.seg button { border: none; background: var(--surface); color: var(--muted); font-size: 12px; padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--brand-2); color: #fff; font-weight: 600; }

/* clickable grid rows */
tr.row-click { cursor: pointer; }
tr.row-click:hover { background: var(--surface-2); }

/* adjustments tabs / panes */
.adj-tabs { margin-bottom: 0; }
.adj-pane { margin-top: 14px; }

/* escalation status pill */
.esc-pill { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.esc-pill.pendiente { background: #fdecec; color: #c0392b; }
.esc-pill.en_revision { background: #eef2fb; color: #2d5bd0; }
.esc-pill.resuelta { background: #e9f7ee; color: #1d8a4e; }

/* Account-name column — truncate gracefully, full text on hover (title) */
.acct-name { color: var(--muted); font-size: 12px; max-width: 240px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

/* Adjustments tabs row with account-number filter on the right */
.adj-tabs-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 18px; }
.adj-tabs-bar .res-tabs { margin: 0; flex: 1; }
.adj-tabs-bar .search-inline { margin-bottom: 6px; min-width: 240px; }

/* Settings — account catalog */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
.sort-ind { font-size: 9px; color: var(--brand-2); margin-left: 2px; }
.src-pill { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.src-pill.base { background: var(--surface-2); color: var(--muted); }
.src-pill.editado { background: #eef2fb; color: #2d5bd0; }
.src-pill.nuevo { background: #e9f7ee; color: #1d8a4e; }

/* Grid chrome: row numbers, checkboxes, selection highlight */
.rownum-h, .rownum { width: 34px; text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chk-h, .chk { width: 28px; text-align: center; }
.chk input, .chk-h input { cursor: pointer; }
tr.sel { background: #eef4ff !important; }
tr.sel:hover { background: #e4eeff !important; }
tr.sel td { box-shadow: inset 2px 0 0 var(--brand-2); }

/* Adjustments tabs-bar tools */
.adj-tabs-tools { display: flex; align-items: flex-end; gap: 8px; }
#adj-sel-only.active { background: var(--brand-2); color: #fff; }

/* Bottom footer bar — shows clicked-row values + selection count */
.grid-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  background: var(--surface); border-top: 1px solid var(--line-strong);
  box-shadow: 0 -6px 20px rgba(15,18,20,.08); padding: 9px 18px;
  display: flex; align-items: center; gap: 18px; transform: translateY(110%);
  transition: transform .18s ease; }
.grid-footer.open { transform: none; }
.gf-fields { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; overflow: hidden; }
.gf-field { display: inline-flex; flex-direction: column; line-height: 1.2; }
.gf-label { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.gf-value { font-size: 12.5px; color: var(--ink); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-value.mono { font-family: var(--font-mono); font-size: 12px; }
.gf-spacer { flex: 1; }
.gf-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.gf-meta b { color: var(--brand-2); }
.gf-x { border: none; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.gf-x:hover { background: var(--surface-2); color: var(--ink); }

/* Moneda (M) template badge + Settings roles */
.m-badge { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 600; background: #fff3e0; color: #b06a00; }
#set-m-only.active { background: var(--brand-2); color: #fff; }
.role-range { padding: 12px 0; border-bottom: 1px solid var(--faint); display: flex; flex-direction: column; gap: 6px; max-width: 720px; }
.role-range:last-child { border-bottom: none; }
.role-range-head { font-size: 13px; }
.role-range-head .mono { font-size: 11px; margin-left: 6px; }
.role-range .role-range-save { align-self: flex-start; }

/* Group ownership */
.grp-owners { display: flex; flex-wrap: wrap; gap: 12px; }
.own-chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink); cursor: pointer; }
.own-chk input { cursor: pointer; }

/* ---- Cognito login overlay ---- */
.login-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1530, #0f1216); }
.login-card { width: 340px; max-width: 92vw; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.login-brand { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.login-brand b { color: var(--brand-2); }
.login-title { font-size: 19px; font-weight: 700; color: var(--ink); margin: 4px 0 16px; }
.login-card label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 0 3px; }
.login-card input { border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; font-size: 14px; color: var(--ink); background: var(--surface); }
.login-card input:focus { outline: none; border-color: var(--brand-2); }
.login-err { margin-top: 10px; font-size: 12px; color: #c0392b; background: #fdecec; padding: 7px 10px; border-radius: 6px; }

/* Upload file-type hint in the workspace files card */
.ws-files-hint { font-size: 11px; color: var(--muted); margin-left: 10px; }
.ws-files-hint b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }

/* Editable cierre-date in the new-cuadre wizard */
.nc-date-input { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 5px 9px; color: var(--ink); background: var(--surface); }
.nc-date-input:focus { outline: none; border-color: var(--brand-2); }
.nc-date-hint { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
