/* ===== Bokder · AGF y Fondos ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0c0187;
  --font: #060a2e;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f2f4f8;
  --ok-bg: #e8f7ee;
  --ok-fg: #15803d;
  --warn-bg: #fff4e5;
  --warn-fg: #b45309;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 28px;
  background: linear-gradient(120deg, var(--secondary), var(--primary));
  color: #fff;
  box-shadow: 0 2px 10px rgba(12,1,135,.18);
}
.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.header-brand { display: flex; align-items: center; flex-shrink: 0; }
.logo-img { height: 40px; width: auto; object-fit: contain; }
.header-title h1 { font-size: 18px; font-weight: 650; letter-spacing: .2px; }
.header-title p { font-size: 12px; opacity: .78; margin-top: 2px; }
.version-badge {
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.3); white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-actions .volver-portal {
  color: rgba(255,255,255,.85); text-decoration: none;
  font-size: 12.5px; font-weight: 650; padding: 6px 12px; border-radius: 8px;
  white-space: nowrap; transition: .15s;
}
.header-actions .volver-portal:hover { color: #fff; background: rgba(255,255,255,.12); }

/* ===== Navegación ===== */
.nav { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.16);
       border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 3px; }
.nav a {
  color: rgba(255,255,255,.82); text-decoration: none; font-size: 12.5px; font-weight: 650;
  padding: 6px 12px; border-radius: 8px; white-space: nowrap; transition: .15s;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav a.active { color: var(--secondary); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }


/* ===== Layout ===== */
.container { max-width: 960px; margin: 24px auto; padding: 0 20px; }
.container-wide { max-width: 1320px; width: 100%; flex: 1; }

/* ===== Stats ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px; box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.stat b { display: block; font-size: 26px; font-weight: 800; color: var(--secondary); line-height: 1.1; }
.stat span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ===== Card ===== */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06); overflow: hidden;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.seg { display: inline-flex; background: #eef2f9; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 650; color: #475569; cursor: pointer; transition: .15s;
}
.seg-btn:hover { color: var(--secondary); }
.seg-btn.active { background: #fff; color: var(--secondary); box-shadow: 0 1px 3px rgba(15,23,42,.14); }

.search { position: relative; flex: 1; min-width: 240px; max-width: 420px; }
.search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; fill: none; stroke: #94a3b8; stroke-width: 2;
  stroke-linecap: round;
}
.search input {
  width: 100%; padding: 9px 12px 9px 38px; border: 1px solid #cbd5e1;
  border-radius: 9px; font-size: 14px; background: #fff; color: #1f2937;
}
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }

.count-pill {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--secondary);
  background: #eef2ff; border: 1px solid #dbe4ff; border-radius: 999px; padding: 5px 12px;
  white-space: nowrap;
}

/* ===== Split ===== */
.split { display: grid; grid-template-columns: 400px 1fr; min-height: 520px; }

/* ===== Lista ===== */
.lista { border-right: 1px solid var(--line); overflow-y: auto; max-height: 70vh; }
.lista::-webkit-scrollbar { width: 9px; }
.lista::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }

.item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #eef1f6;
  cursor: pointer; transition: background .12s; position: relative;
}
.item:hover { background: #f7f9fd; }
.item.active { background: #eef3ff; }
.item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary);
}
.item-main { min-width: 0; flex: 1; }
.item-name {
  font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: #0f172a;
}
.item-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

.badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 6px; border: 1px solid transparent;
}
.badge.agf { background: #eef2ff; color: #3730a3; border-color: #dbe4ff; }
.badge.afip { background: #ecfeff; color: #0e7490; border-color: #cffafe; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: #cdead8; }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: #fbe2bf; }

.fondos-chip {
  font-size: 11px; font-weight: 700; color: #334155; background: #f1f5f9;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.fondos-chip.zero { color: #94a3b8; }

/* ===== Detalle ===== */
.detalle { padding: 0; overflow-y: auto; max-height: 70vh; }
.detalle-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.detalle-head h2 { font-size: 17px; font-weight: 750; color: var(--secondary); line-height: 1.25; }
.detalle-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.detalle-meta b { color: #334155; font-weight: 650; }

.table-wrap { overflow: auto; max-height: calc(100vh - 320px); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; padding: 10px 14px; background: #f8fafc;
  font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: #475569; border-bottom: 1px solid var(--line); white-space: nowrap;
  box-shadow: 0 1px 0 var(--line);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
tbody tr:hover { background: #f9fbff; }
td.num, th.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fund-name { font-weight: 600; color: #0f172a; }
.fund-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.mono { font-family: 'Cascadia Mono', 'Consolas', monospace; font-size: 12.5px; }
.motivo {
  font-size: 11px; color: #b45309; margin-top: 4px;
  max-width: 260px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; cursor: help;
}

.cell-input {
  width: 100%; min-width: 110px; padding: 6px 8px; border: 1px solid #d7e0ec; border-radius: 6px;
  font-size: 12.5px; color: #0f172a; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.cell-input:focus { border-color: #6aa9ff; box-shadow: 0 0 0 3px rgba(106,169,255,.18); }
.cell-input.ok { border-color: #16a34a; background: #f0fdf4; }
.cell-input.err { border-color: #dc2626; background: #fef2f2; }
.cell-input:disabled { opacity: .65; }
.cell-input-sm { min-width: 72px; max-width: 110px; }

/* ===== Vacíos ===== */
.empty { padding: 70px 30px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 42px; color: #c7d2e5; margin-bottom: 8px; }
.empty h3 { font-size: 15px; color: #334155; margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 380px; margin: 0 auto; line-height: 1.5; }

.skeleton { padding: 16px; }
.skeleton .ln { height: 12px; border-radius: 6px; background: linear-gradient(90deg,#eef2f8,#e2e8f2,#eef2f8); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 10px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .split { grid-template-columns: 340px 1fr; }
}
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .lista { border-right: 0; border-bottom: 1px solid var(--line); max-height: 340px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 10px; letter-spacing: .3px; }
  .header-title p { display: none; }
  .nav { order: 3; }
  .header { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .toolbar { padding: 12px 14px; }
  .search { max-width: none; }
  .count-pill { margin-left: 0; }
  .nav a { padding: 6px 9px; font-size: 12px; }
  .header-actions .version-badge { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ===== Recepción de archivos ===== */
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 20px; font-weight: 800; color: var(--secondary); }
.page-head p { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

.card-pad { padding: 20px 22px; }
.card + .card { margin-top: 18px; }
.card-title {
  font-size: 13px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  color: #475569; margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.card-title .step {
  width: 22px; height: 22px; border-radius: 50%; background: var(--secondary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px;
}

.dropzone {
  border: 2px dashed #c3cfe2; border-radius: 12px; background: #f8fafd;
  padding: 34px 20px; text-align: center; cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: #f0f5ff; }
.dropzone .dz-icon { font-size: 34px; color: #9db0cc; line-height: 1; }
.dropzone h4 { font-size: 14.5px; font-weight: 700; color: #1f2a44; margin-top: 10px; }
.dropzone p { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.dropzone.has-file { border-style: solid; border-color: var(--primary); background: #eef4ff; }
.file-info {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.file-info .fi-name { font-weight: 650; font-size: 13px; color: #0f172a; word-break: break-all; }
.file-info .fi-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.file-info .fi-check { color: var(--ok-fg); font-size: 18px; margin-left: auto; }

.form-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 14px; }
.field label {
  display: block; font-size: 11.5px; font-weight: 750; letter-spacing: .3px;
  text-transform: uppercase; color: #64748b; margin-bottom: 6px;
}
.field select, .field input {
  width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 9px;
  font-size: 13.5px; background: #fff; color: #1f2937;
}
.field select:focus, .field input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 10px 20px; font-size: 13.5px;
  font-weight: 700; cursor: pointer; transition: .15s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--secondary); border-color: #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: #334155; }
.actions .note { font-size: 12px; color: var(--muted); }

.status { display: none; align-items: center; gap: 10px; margin-top: 16px; font-size: 13px; color: #334155; }
.status.show { display: flex; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid #dbe4f3;
  border-top-color: var(--primary); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  border-radius: 10px; padding: 14px 16px; font-size: 13px; line-height: 1.55;
  border: 1px solid transparent; white-space: pre-wrap; word-break: break-word;
}
.alert.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.result-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding: 20px 22px; border-bottom: 1px solid var(--line);
}
.result-head h3 { font-size: 16px; font-weight: 780; color: var(--secondary); }
.result-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.result-head .rh-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.pill { border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 800; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.err { background: #fef2f2; color: #b91c1c; }

.mini-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px; background: var(--line); border-bottom: 1px solid var(--line);
}
.mini-stat { background: #fff; padding: 14px 18px; }
.mini-stat b { display: block; font-size: 21px; font-weight: 800; color: var(--secondary); }
.mini-stat span { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.mini-stat.ok b { color: var(--ok-fg); }
.mini-stat.warn b { color: var(--warn-fg); }
.mini-stat.err b { color: #b91c1c; }

.section-pad { padding: 18px 22px; }
.section-pad + .section-pad { border-top: 1px solid var(--line); }
.section-label { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #64748b; margin-bottom: 10px; }

.findings { display: flex; flex-direction: column; gap: 8px; }
.finding {
  display: flex; gap: 12px; padding: 10px 12px; border-radius: 9px;
  background: #fff7ed; border: 1px solid #fed7aa; font-size: 12.5px; line-height: 1.45;
}
.finding .f-rule { font-family: 'Cascadia Mono', Consolas, monospace; font-weight: 700; color: #b45309; flex-shrink: 0; }
.finding .f-body { color: #78350f; }
.finding .f-meta { font-size: 11px; color: #9a3412; opacity: .8; margin-top: 2px; }

details.obs { border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
details.obs summary { cursor: pointer; padding: 10px 14px; font-size: 12.5px; font-weight: 700; color: #475569; }
details.obs .obs-body { padding: 0 14px 12px; font-size: 12.5px; color: #475569; line-height: 1.5; }
.obs-item { padding: 8px 0; border-top: 1px solid #e8edf5; }
.obs-item:first-child { border-top: 0; }
.obs-item b { color: #334155; }
.obs-item .obs-note { font-size: 11.5px; color: var(--muted); }

.pre {
  font-family: 'Cascadia Mono', Consolas, monospace; font-size: 11.5px; line-height: 1.55;
  background: #0f172a; color: #dbeafe; border-radius: 9px; padding: 14px 16px;
  overflow-x: auto; white-space: pre; max-height: 260px;
}

.history { border-right: 1px solid var(--line); overflow-y: auto; max-height: 72vh; }
.history .item-main { min-width: 0; }
.history .item-name { display: flex; gap: 6px; align-items: center; }
.history .item-sub { display: flex; gap: 8px; flex-wrap: wrap; }

