/* ==========================================================================
   KAVORA · Demo «Facturas y comprobantes: de la foto al Excel»
   Estilos propios de la página (usa las variables de ../styles.css).
   ========================================================================== */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.fx-app, .fx-hero {
  --fx-amber: #E0A84F;
  --fx-amber-text: #F2CC8A;
  --fx-red: #E0646A;
  --fx-red-text: #F4B9BC;
  --fx-blue: #8FB8E8;
  --fx-panel: #111D21;
  --fx-panel-2: #18262B;
  --fx-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* ---------- Hero ---------- */
.fx-demo-label {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 22px; padding: 7px 14px;
  border: 1px solid rgba(95, 197, 174, 0.55); border-radius: 999px;
  font-family: var(--font-head); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--marfil); background: rgba(95, 197, 174, 0.08);
}
.fx-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--jade); flex-shrink: 0; }
.fx-hero h1 { max-width: 20ch; }
.fx-hero .lead strong { color: var(--marfil); }
.fx-results {
  list-style: none; margin: 26px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  max-width: 900px;
}
.fx-results li {
  padding: 14px 16px;
  border: 1px solid var(--line-dark); border-top: 2px solid var(--jade);
  background: rgba(13, 22, 24, 0.45);
}
.fx-results strong { display: block; font-family: var(--font-head); font-size: 1rem; font-weight: 600; color: var(--marfil); margin-bottom: 4px; }
.fx-results span { display: block; font-size: 0.9375rem; color: rgba(246, 245, 240, 0.8); line-height: 1.45; }
.fx-principle {
  margin: 28px 0 36px; padding: 16px 0 16px 20px;
  border-left: 2px solid var(--jade-logo);
  max-width: 62ch; font-size: 1.125rem;
  color: rgba(246, 245, 240, 0.9) !important;
}
.fx-principle strong { color: var(--jade); font-weight: 600; }
.fx-sectors { margin: 26px 0 0; font-size: 0.9375rem; color: var(--acero-claro) !important; max-width: 70ch; }

/* ---------- Cómo funciona ---------- */
.fx-how {
  background: var(--grafito);
  border-top: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark);
  padding-block: clamp(36px, 5vw, 56px);
}
.fx-how-title { font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--jade); margin-bottom: 24px; }
.fx-how-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fx-how-steps li { padding: 4px 24px 4px 0; }
.fx-how-steps li + li { padding-left: 24px; border-left: 1px solid var(--line-dark); }
.fx-how-num { display: block; font-family: var(--font-head); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.1em; color: var(--jade); margin-bottom: 10px; }
.fx-how-steps h3 { font-size: 1.0625rem; margin-bottom: 6px; }
.fx-how-steps p { font-size: 0.9375rem; color: rgba(246, 245, 240, 0.76); margin: 0; }
@media (max-width: 900px) {
  .fx-how-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .fx-how-steps li:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) {
  .fx-how-steps { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .fx-how-steps li, .fx-how-steps li + li { padding: 18px 0; border-left: 0; }
  .fx-how-steps li + li { border-top: 1px solid var(--line-dark); }
  .fx-results { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) { .fx-results { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Sección demo ---------- */
.fx-demo-section { padding-top: clamp(56px, 8vw, 104px); }
.fx-demo-head { margin-bottom: clamp(28px, 4vw, 48px); }
.fx-demo-head .section-intro strong { color: var(--marfil); }

.fx-app {
  border: 1px solid var(--line-dark);
  background: var(--grafito);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.32);
  color: var(--marfil);
  font-size: 0.9875rem;
}
.fx-app p { color: inherit; }
.fx-app [hidden] { display: none !important; }
html.fx-bar-on .wa-float { opacity: 0; visibility: hidden; pointer-events: none; }
.wa-float { transition: opacity .2s ease, visibility .2s ease, background-color .2s ease, transform .2s ease; }

.fx-appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--fx-panel); border-bottom: 1px solid var(--line-dark);
}
.fx-appbar-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.fx-appbar-title img { width: 22px; height: auto; }
.fx-appbar-title > span:first-of-type { font-family: var(--font-head); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.02em; }
.fx-chip-demo {
  font-family: var(--font-head); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fx-amber-text); border: 1px solid rgba(224, 168, 79, 0.5); padding: 3px 8px; border-radius: 2px;
}
.fx-reviewer {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--marfil);
  padding: 3px 10px 3px 3px; border: 1px solid var(--line-dark); border-radius: 999px;
}
.fx-reviewer-av {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--jade-deep); font-family: var(--font-head); font-size: 0.75rem; font-weight: 700;
}
.fx-reviewer-k { color: var(--acero-claro); }

/* ---------- Botones ---------- */
.fx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 10px 20px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-family: var(--font-head); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.01em;
  cursor: pointer; text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.fx-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.fx-btn-primary { background: var(--jade-deep); color: var(--marfil); }
.fx-btn-primary:hover:not(:disabled) { background: var(--jade-text); }
.fx-btn-primary:disabled { background: transparent; border-color: var(--line-dark); color: rgba(246, 245, 240, 0.5); cursor: not-allowed; }
.fx-btn-ghost { border-color: rgba(246, 245, 240, 0.45); color: var(--marfil); background: transparent; }
.fx-btn-ghost:hover { border-color: var(--marfil); background: rgba(246, 245, 240, 0.06); }
.fx-btn-quiet { min-height: 40px; padding: 8px 14px; background: transparent; color: rgba(246, 245, 240, 0.86); border-color: var(--line-dark); font-weight: 500; }
.fx-btn-quiet:hover { border-color: rgba(95, 197, 174, 0.6); color: var(--marfil); }
.fx-btn-warn { background: transparent; border-color: rgba(224, 168, 79, 0.7); color: var(--fx-amber-text); }
.fx-btn-warn:hover { background: rgba(224, 168, 79, 0.12); }
.fx-btn-small { min-height: 36px; padding: 6px 12px; font-size: 0.8125rem; gap: 6px; }
.fx-btn-big { min-height: 52px; padding: 12px 26px; font-size: 0.9375rem; }
.fx-link-btn {
  background: none; border: 0; padding: 2px 0; margin-left: 4px; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--jade); text-decoration: underline; text-underline-offset: 3px;
  min-height: 24px;
}
.fx-link-btn:hover { color: var(--marfil); }

/* ---------- Pasos ---------- */
.fx-steps { border-bottom: 1px solid var(--line-dark); background: var(--grafito); position: sticky; top: var(--header-h); z-index: 5; }
.fx-steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fx-steps li + li { border-left: 1px solid var(--line-dark); }
.fx-steps a {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; min-height: 48px;
  text-decoration: none; font-family: var(--font-head); font-size: 0.8125rem; font-weight: 600;
  color: var(--acero-claro); border-bottom: 2px solid transparent;
}
.fx-step-n {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--line-dark); font-size: 0.75rem;
}
.fx-steps li.is-current a { color: var(--marfil); border-bottom-color: var(--jade); }
.fx-steps li.is-current .fx-step-n { border-color: var(--jade); color: var(--jade); }
.fx-steps li.is-done .fx-step-n { background: var(--jade-deep); border-color: var(--jade-deep); color: var(--marfil); font-size: 0; }
.fx-steps li.is-done .fx-step-n::before { content: "✓"; font-size: 0.75rem; }
.fx-steps a:hover { color: var(--marfil); }

/* ---------- Etapas ---------- */
.fx-stage { padding: clamp(18px, 3vw, 28px); scroll-margin-top: calc(var(--header-h) + 60px); }
.fx-stage + .fx-stage { border-top: 1px solid var(--line-dark); }
.fx-stage:focus { outline: none; }
.fx-stage-head { margin-bottom: 18px; }
.fx-stage-head h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.125rem; margin: 0 0 4px; }
.fx-stage-n {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  background: rgba(95, 197, 174, 0.14); color: var(--jade); font-size: 0.8125rem;
}
.fx-stage-sub { margin: 0; color: var(--acero-claro) !important; font-size: 0.9375rem; }
.fx-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--fx-panel-2); border: 1px solid var(--line-dark); font-size: 0.75rem; color: var(--marfil);
}

/* ---------- Zona de carga ---------- */
.fx-drop {
  border: 1.5px dashed rgba(95, 197, 174, 0.5); border-radius: 8px;
  background: rgba(95, 197, 174, 0.04);
  padding: clamp(20px, 4vw, 36px); text-align: center;
  transition: background-color .2s ease, border-color .2s ease;
}
.fx-drop.is-over { background: rgba(95, 197, 174, 0.12); border-color: var(--jade); }
.fx-drop-ico { width: 44px; height: 44px; color: var(--jade); margin: 0 auto 8px; display: block; }
.fx-drop-title { font-family: var(--font-head); font-weight: 600; font-size: 1.0625rem; margin: 0 0 4px; }
.fx-drop-sub { margin: 0 0 16px; color: var(--acero-claro) !important; font-size: 0.9375rem; }
.fx-drop-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fx-file-label { cursor: pointer; }
.fx-drop-actions:has(#fx-file:focus-visible) .fx-file-label { outline: 2px solid var(--jade); outline-offset: 3px; }
.fx-drop-note { margin: 14px auto 0; max-width: 60ch; font-size: 0.8125rem; color: var(--acero-claro) !important; }
.fx-drop-text .fx-drop-note { margin: -6px auto 18px; }
.fx-drop.is-compact { padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; text-align: left; }
.fx-drop.is-compact .fx-drop-ico { width: 32px; height: 32px; margin: 0; flex-shrink: 0; }
.fx-drop.is-compact .fx-drop-text { flex: 1 1 300px; min-width: 0; }
.fx-drop.is-compact .fx-drop-title { font-size: 0.9375rem; margin: 0; }
.fx-drop.is-compact .fx-drop-sub { display: none; }
.fx-drop.is-compact .fx-drop-note { margin: 2px 0 0; max-width: none; }
.fx-drop.is-compact .fx-drop-actions { flex: 0 1 auto; justify-content: flex-end; }

/* ---------- Bandeja de fotos ---------- */
.fx-tray {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px;
}
.fx-tray:empty { display: none; }
.fx-photo {
  background: var(--fx-panel); border: 1px solid var(--line-dark); border-radius: 6px; overflow: hidden;
  opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease, border-color .3s ease;
}
.fx-photo.is-uploading, .fx-photo.is-uploaded { opacity: 1; transform: none; }
.fx-photo-media { position: relative; aspect-ratio: 3 / 4; background: #3c3129; overflow: hidden; }
.fx-photo-media svg, .fx-photo-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.fx-photo-scan { position: absolute; left: 0; right: 0; height: 30%; top: -30%; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(95, 197, 174, 0) 0%, rgba(95, 197, 174, 0.35) 85%, rgba(95, 197, 174, 0.9) 100%); }
.fx-photo.is-processing .fx-photo-scan { opacity: 1; animation: fx-scan 1.1s linear infinite; }
@keyframes fx-scan { to { top: 100%; } }
.fx-photo-meta { padding: 8px 10px 10px; display: grid; gap: 6px; }
.fx-photo-name { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-tag-user { font-family: var(--font-head); font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fx-blue); border: 1px solid rgba(143, 184, 232, 0.5); padding: 1px 5px; border-radius: 2px; }
.fx-photo-up { height: 3px; background: var(--line-dark); border-radius: 2px; overflow: hidden; }
.fx-photo-upfill { display: block; height: 100%; width: 0; background: var(--jade); transition: width .5s ease; }
.fx-photo.is-uploaded .fx-photo-upfill { width: 100%; }
.fx-photo-stages { display: none; list-style: none; margin: 0; padding: 0; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.fx-photo-stages li { height: 3px; border-radius: 2px; background: var(--line-dark); transition: background-color .2s ease; }
.fx-photo-stages li.is-active { background: var(--fx-amber); }
.fx-photo-stages li.is-done { background: var(--jade); }
.fx-photo.is-processing .fx-photo-up, .fx-photo.is-ok .fx-photo-up, .fx-photo.is-flag .fx-photo-up { display: none; }
.fx-photo.is-processing .fx-photo-stages, .fx-photo.is-ok .fx-photo-stages, .fx-photo.is-flag .fx-photo-stages { display: grid; }
.fx-photo-state { font-size: 0.75rem; color: var(--acero-claro); }
.fx-photo.is-ok { border-color: rgba(95, 197, 174, 0.5); }
.fx-photo.is-ok .fx-photo-state { color: var(--jade); }
.fx-photo.is-flag { border-color: rgba(224, 168, 79, 0.6); }
.fx-photo.is-flag .fx-photo-state { color: var(--fx-amber-text); }
.fx-photo.is-flag .fx-photo-stages li.is-done:last-child { background: var(--fx-amber); }
.fx-photo.is-skipped { opacity: 0.6; }

/* ---------- Procesar ---------- */
.fx-process { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line-dark); scroll-margin-top: calc(var(--header-h) + 60px); }
.fx-process:focus { outline: none; }
.fx-process-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.fx-process-hint { margin: 0; font-size: 0.9375rem; color: var(--acero-claro) !important; flex: 1 1 260px; }
.fx-progress { margin-top: 18px; }
.fx-progress-bar { height: 6px; background: var(--fx-panel-2); border-radius: 3px; overflow: hidden; }
.fx-progress-fill { display: block; height: 100%; width: 0; background: var(--jade); transition: width .2s linear; }
.fx-pipe-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.75rem; color: var(--acero-claro); }
.fx-pipe-legend li { counter-increment: pipe; }
.fx-pipe-legend li::before { content: counter(pipe) " · "; color: var(--jade); font-weight: 600; }
.fx-log {
  list-style: none; margin: 12px 0 0; padding: 10px 12px; max-height: 210px; overflow: auto;
  background: var(--grafito-deep); border: 1px solid var(--line-dark); border-radius: 4px;
  font-family: var(--fx-mono); font-size: 0.78125rem; line-height: 1.6;
}
.fx-log-line { padding-left: 16px; position: relative; color: rgba(246, 245, 240, 0.86); animation: fx-in .25s ease; }
.fx-log-line::before { content: "•"; position: absolute; left: 2px; color: var(--acero); }
.fx-log-line.is-ok::before { content: "✓"; color: var(--jade); }
.fx-log-line.is-flag::before { content: "!"; color: var(--fx-amber); font-weight: 700; }
.fx-log-line.is-done { color: var(--jade); }
.fx-log-line.is-info { color: var(--fx-blue); }
.fx-log-line strong { color: var(--marfil); }
@keyframes fx-in { from { opacity: 0; transform: translateY(3px); } }

/* ---------- KPIs ---------- */
.fx-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.fx-kpi { padding: 12px 14px; background: var(--fx-panel); border: 1px solid var(--line-dark); border-top: 2px solid var(--acero); }
.fx-kpi strong { display: block; font-family: var(--font-head); font-size: 1.375rem; line-height: 1.2; }
.fx-kpi span { display: block; font-size: 0.8125rem; color: var(--acero-claro); line-height: 1.4; margin-top: 2px; }
.fx-kpi.is-good { border-top-color: var(--jade); }
.fx-kpi.is-good strong { color: var(--jade); }
.fx-kpi.is-warn { border-top-color: var(--fx-amber); }
.fx-kpi.is-warn strong { color: var(--fx-amber-text); }
.fx-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fx-bulk:empty { display: none; }
.fx-bulk-note { font-size: 0.8125rem; color: var(--acero-claro); }

/* ---------- Tabla de revisión ---------- */
.fx-table-wrap { overflow-x: auto; border: 1px solid var(--line-dark); background: var(--fx-panel); scroll-margin-top: calc(var(--header-h) + 64px); }
.fx-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.fx-v { display: block; }
.fx-v.is-warn, .fx-v.is-err { margin: 1px -4px; padding: 1px 4px; border-radius: 2px; }
.fx-v.is-warn { background: rgba(224, 168, 79, 0.18); color: var(--fx-amber-text); box-shadow: inset 0 -2px 0 rgba(224, 168, 79, 0.7); }
.fx-v.is-err { background: rgba(224, 100, 106, 0.2); color: var(--fx-red-text); box-shadow: inset 0 -2px 0 rgba(224, 100, 106, 0.75); }
.fx-v.is-edited { color: var(--fx-blue); }
.fx-v-tipo, .fx-v-razon { font-weight: 600; white-space: nowrap; }
.fx-v-razon { white-space: normal; line-height: 1.3; }
.fx-td-comp .fx-mono, .fx-td-razon .fx-mono, .fx-td-cae .fx-mono { color: var(--acero-claro); font-size: 0.71875rem; }
.fx-td-comp .fx-mono.is-warn, .fx-td-razon .fx-mono.is-err { color: inherit; }
.fx-table th {
  text-align: left; font-family: var(--font-head); font-size: 0.65625rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--acero-claro); padding: 10px 5px; border-bottom: 1px solid var(--line-dark); white-space: nowrap; background: var(--fx-panel-2);
}
.fx-th-sub { text-transform: none; letter-spacing: 0; font-weight: 500; }
.fx-table td { padding: 7px 5px; border-bottom: 1px solid var(--line-dark); vertical-align: middle; }
.fx-table .is-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fx-mono { font-family: var(--fx-mono); font-size: 0.75rem; white-space: nowrap; }
.fx-td-razon { min-width: 150px; }
.fx-td-cae { white-space: nowrap; }
.fx-td-total { font-weight: 600; }
.fx-td-cae { line-height: 1.35; }
.fx-sub { color: var(--acero-claro); font-size: 0.75rem; font-family: var(--font-body); }
.fx-na { color: var(--acero); }
.fx-row { cursor: pointer; transition: background-color .15s ease; }
.fx-row:hover { background: rgba(246, 245, 240, 0.03); }
.fx-row.is-selected { background: rgba(95, 197, 174, 0.08); box-shadow: inset 3px 0 0 var(--jade); }
.fx-row.is-discarded td:not(.fx-td-act):not(:first-child):not(:nth-child(2)) { text-decoration: line-through; color: var(--acero); }
.fx-row.is-approved td:first-child { box-shadow: inset 3px 0 0 var(--jade-deep); }
.fx-table td.is-warn { background: rgba(224, 168, 79, 0.14); color: var(--fx-amber-text); box-shadow: inset 0 -2px 0 rgba(224, 168, 79, 0.6); }
.fx-table td.is-err { background: rgba(224, 100, 106, 0.16); color: var(--fx-red-text); box-shadow: inset 0 -2px 0 rgba(224, 100, 106, 0.7); }
.fx-table td.is-edited { color: var(--jade); }
.fx-row.is-flash td { animation: fx-flash 1.6s ease 2; }
@keyframes fx-flash { 0%, 100% { background-color: transparent; } 30% { background-color: rgba(224, 168, 79, 0.35); } }
.fx-row-open {
  display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 2px; cursor: pointer;
  color: var(--marfil); font: inherit; font-weight: 600; min-height: 44px;
}
.fx-mini { width: 28px; height: 37px; border-radius: 2px; overflow: hidden; border: 1px solid var(--line-dark); flex-shrink: 0; display: block; }
.fx-mini svg { width: 100%; height: 100%; display: block; }
.fx-td-act { text-align: right; white-space: nowrap; }
.fx-ok-mark { color: var(--jade); font-weight: 600; font-size: 0.8125rem; }

.fx-chip {
  display: inline-block; white-space: nowrap; font-family: var(--font-head); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-dark); color: var(--acero-claro);
}
.fx-chip.is-ok { color: var(--jade); border-color: rgba(95, 197, 174, 0.5); }
.fx-chip.is-review, .fx-chip.is-dup { color: var(--fx-amber-text); border-color: rgba(224, 168, 79, 0.6); background: rgba(224, 168, 79, 0.1); }
.fx-chip.is-approved { color: var(--marfil); background: var(--jade-deep); border-color: var(--jade-deep); }
.fx-chip.is-discarded { color: var(--acero-claro); }

/* ---------- Detalle: foto + campos ---------- */
.fx-detail {
  margin-top: 18px; border: 1px solid rgba(95, 197, 174, 0.4); background: var(--fx-panel);
  scroll-margin-top: calc(var(--header-h) + 60px);
}
.fx-detail:focus { outline: none; }
.fx-detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-dark); background: var(--fx-panel-2); }
.fx-detail-head h4 { margin: 0; font-size: 1rem; flex: 1 1 auto; min-width: 0; }
.fx-detail-close { margin-left: auto; }
.fx-detail-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0; }
.fx-viewer { padding: 16px; border-right: 1px solid var(--line-dark); }
.fx-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-family: var(--font-head); font-size: 0.8125rem; font-weight: 600; }
.fx-seg { display: inline-flex; border: 1px solid var(--line-dark); border-radius: 4px; overflow: hidden; }
.fx-seg button { background: transparent; color: var(--acero-claro); border: 0; padding: 6px 12px; min-height: 36px; font: inherit; font-weight: 600; font-size: 0.75rem; cursor: pointer; }
.fx-seg button + button { border-left: 1px solid var(--line-dark); }
.fx-seg button[aria-pressed="true"] { background: rgba(95, 197, 174, 0.16); color: var(--marfil); }
.fx-viewer-img { border-radius: 4px; overflow: hidden; background: #3c3129; position: sticky; top: calc(var(--header-h) + 64px); }
.fx-viewer-img svg { display: block; width: 100%; height: auto; }
.fx-hl rect { fill: rgba(95, 197, 174, 0.14); stroke: #13A38B; stroke-width: 1.6; transition: opacity .15s ease, stroke-width .15s ease; }
.fx-hl.is-warn rect { fill: rgba(224, 168, 79, 0.22); stroke: #D08A1E; stroke-width: 2.2; }
.fx-hl.is-err rect { fill: rgba(224, 100, 106, 0.22); stroke: #C4323A; stroke-width: 2.2; }
.fx-hl.is-fixed rect { fill: rgba(70, 120, 200, 0.14); stroke: #3F6FB6; }
.fx-hl { cursor: pointer; }
.fx-hl-label { font-family: "Source Sans 3", Arial, sans-serif; font-size: 10px; font-weight: 700; fill: #0D1618; paint-order: stroke; stroke: #fff; stroke-width: 3px; opacity: 0; }
.fx-hl.is-warn .fx-hl-label, .fx-hl.is-err .fx-hl-label { opacity: 1; }
.fx-viewer-img.has-focus .fx-hl:not(.is-focus) rect { opacity: 0.25; }
.fx-viewer-img.has-focus .fx-hl:not(.is-focus) .fx-hl-label { opacity: 0; }
.fx-hl.is-focus rect { stroke-width: 3; opacity: 1; }
.fx-hl.is-focus .fx-hl-label { opacity: 1; }
.fx-viewer-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 10px 0 4px; font-size: 0.75rem; color: var(--acero-claro) !important; }
.fx-lg { display: inline-block; width: 12px; height: 10px; border: 2px solid; border-radius: 2px; vertical-align: -1px; margin-right: -6px; }
.fx-lg.is-ok { border-color: #13A38B; }
.fx-lg.is-warn { border-color: #D08A1E; background: rgba(224, 168, 79, 0.3); }
.fx-lg.is-err { border-color: #C4323A; background: rgba(224, 100, 106, 0.3); }
.fx-lg.is-fixed { border-color: #6F9BDB; }
.fx-viewer-help { margin: 0; font-size: 0.8125rem; color: var(--acero-claro) !important; }

.fx-fields { padding: 16px; min-width: 0; }
.fx-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fx-field { padding: 8px 10px; border: 1px solid var(--line-dark); border-radius: 4px; background: rgba(13, 22, 24, 0.5); transition: border-color .15s ease, background-color .15s ease; }
.fx-field.is-focus { border-color: rgba(95, 197, 174, 0.6); }
.fx-field.is-warn { border-color: rgba(224, 168, 79, 0.7); background: rgba(224, 168, 79, 0.07); }
.fx-field.is-err { border-color: rgba(224, 100, 106, 0.75); background: rgba(224, 100, 106, 0.07); }
.fx-field.is-warn, .fx-field.is-err { grid-column: 1 / -1; }
.fx-f-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fx-f-top label { flex: 1 1 auto; min-width: 0; }
.fx-f-top label { font-size: 0.75rem; font-weight: 600; color: var(--acero-claro); letter-spacing: 0.02em; }
.fx-f-state { font-size: 0.6875rem; font-family: var(--font-head); font-weight: 600; white-space: nowrap; color: var(--acero-claro); }
.fx-f-state.is-ok { color: var(--jade); }
.fx-f-state.is-warn { color: var(--fx-amber-text); }
.fx-f-state.is-err { color: var(--fx-red-text); }
.fx-f-state.is-fixed { color: var(--fx-blue); }
.fx-f-row { display: flex; align-items: center; gap: 10px; }
.fx-in {
  flex: 1 1 auto; min-width: 0; width: 100%; min-height: 36px; padding: 5px 10px;
  background: var(--grafito-deep); color: var(--marfil); border: 1px solid var(--line-dark); border-radius: 3px;
  font-family: var(--fx-mono); font-size: 0.875rem;
}
.fx-in.is-num { text-align: right; }
.fx-in.is-text { font-family: var(--font-body); font-size: 0.9375rem; }
.fx-in:focus { border-color: var(--jade); outline: 2px solid rgba(95, 197, 174, 0.35); outline-offset: 1px; }
.fx-in[readonly] { color: rgba(246, 245, 240, 0.75); background: transparent; }
.fx-conf { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 0.6875rem; color: var(--acero-claro); }
.fx-conf-bar { width: 28px; height: 4px; border-radius: 2px; background: var(--line-dark); overflow: hidden; }
.fx-conf-bar span { display: block; height: 100%; background: var(--jade); }
.fx-conf.is-mid .fx-conf-bar span { background: #9BBF6A; }
.fx-conf.is-lo .fx-conf-bar span { background: var(--fx-amber); }
.fx-conf.is-lo { color: var(--fx-amber-text); }
.fx-conf-n { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.fx-f-msg { margin: 8px 0 0; font-size: 0.84375rem; line-height: 1.45; }
.fx-f-msg.is-warn { color: var(--fx-amber-text) !important; }
.fx-f-msg.is-err { color: var(--fx-red-text) !important; }
.fx-f-hint { margin: 6px 0 0; font-size: 0.75rem; color: var(--acero) !important; }
.fx-field .fx-btn-small { margin-top: 8px; }
.fx-note { margin: 0 0 12px; padding: 10px 12px; border-left: 2px solid var(--fx-blue); background: rgba(143, 184, 232, 0.07); font-size: 0.875rem; }
.fx-dup { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; margin-bottom: 14px; padding: 12px; border: 1px solid rgba(224, 168, 79, 0.7); background: rgba(224, 168, 79, 0.07); border-radius: 4px; }
.fx-dup p { margin: 0 0 10px; font-size: 0.875rem; }
.fx-dup strong { color: var(--fx-amber-text); }
.fx-dup-thumbs { display: flex; gap: 8px; }
.fx-dup-thumbs figure { margin: 0; width: 64px; }
.fx-dup-thumbs svg { width: 64px; height: auto; display: block; border-radius: 2px; }
.fx-dup-thumbs figcaption { font-size: 0.6875rem; color: var(--acero-claro); text-align: center; margin-top: 3px; line-height: 1.2; }
.fx-dup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fx-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-dark); }

/* ---------- Exportación ---------- */
.fx-exp-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(16px, 3vw, 28px); }
.fx-exp-col { min-width: 0; display: grid; gap: 16px; align-content: start; }
.fx-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.fx-fs legend, .fx-fs-label { display: block; padding: 0; margin: 0 0 8px; font-family: var(--font-head); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--acero-claro) !important; }
.fx-fmts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fx-fmt { position: relative; cursor: pointer; }
.fx-fmt input { position: absolute; opacity: 0; inset: 0; }
.fx-fmt span { display: block; height: 100%; padding: 10px 12px; border: 1px solid var(--line-dark); border-radius: 4px; background: var(--fx-panel); }
.fx-fmt strong { display: block; font-family: var(--font-head); font-size: 0.9375rem; }
.fx-fmt small { display: block; font-size: 0.75rem; color: var(--acero-claro); line-height: 1.35; margin-top: 2px; }
.fx-fmt input:checked + span { border-color: var(--jade); background: rgba(95, 197, 174, 0.1); box-shadow: inset 0 0 0 1px var(--jade); }
.fx-fmt input:focus-visible + span { outline: 2px solid var(--jade); outline-offset: 2px; }
.fx-select {
  width: 100%; min-height: 44px; padding: 8px 12px; background: var(--grafito-deep); color: var(--marfil);
  border: 1px solid var(--line-dark); border-radius: 4px; font: inherit; font-size: 0.9375rem;
}
.fx-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.875rem; cursor: pointer; min-height: 32px; }
.fx-check input, .fx-col input { width: 18px; height: 18px; accent-color: var(--jade-deep); flex-shrink: 0; }
.fx-cols { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-dark); border-radius: 4px; max-height: 330px; overflow: auto; background: var(--fx-panel); }
.fx-col { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 6px 3px 10px; font-size: 0.875rem; }
.fx-col + .fx-col { border-top: 1px solid var(--line-dark); }
.fx-col:not(.is-on) { color: var(--acero-claro); }
.fx-col label { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 36px; flex: 1 1 auto; }
.fx-col-pos { display: inline-grid; place-items: center; min-width: 22px; height: 20px; border-radius: 3px; background: rgba(95, 197, 174, 0.16); color: var(--jade); font-size: 0.6875rem; font-weight: 700; }
.fx-col-pos.is-off { background: transparent; color: var(--acero); }
.fx-col-move { display: inline-flex; gap: 2px; }
.fx-col-move button { width: 32px; height: 32px; background: transparent; border: 1px solid var(--line-dark); border-radius: 3px; color: var(--marfil); cursor: pointer; font-size: 0.875rem; }
.fx-col-move button:hover:not(:disabled) { border-color: var(--jade); }
.fx-col-move button:disabled { opacity: 0.3; cursor: default; }
.fx-sum { padding: 14px 16px; border: 1px solid var(--line-dark); border-top: 2px solid var(--jade); background: var(--fx-panel); }
.fx-sum dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 16px; }
.fx-sum dt { font-size: 0.75rem; color: var(--acero-claro); }
.fx-sum dd { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1rem; font-variant-numeric: tabular-nums; }
.fx-sum .is-total dd { color: var(--jade); font-size: 1.125rem; }
.fx-sum-note { margin: 10px 0 0; font-size: 0.8125rem; color: var(--acero-claro) !important; }
.fx-prev-wrap { overflow: auto; border: 1px solid #c9c6bd; background: #fff; max-height: 260px; }
.fx-prev { border-collapse: collapse; font-family: "Segoe UI", Calibri, Arial, sans-serif; font-size: 0.75rem; color: #1d2428; min-width: 100%; }
.fx-prev th { background: var(--jade-deep); color: #fff; font-weight: 600; text-align: left; padding: 5px 8px; white-space: nowrap; border-right: 1px solid rgba(255, 255, 255, 0.25); position: sticky; top: 0; }
.fx-prev td { padding: 4px 8px; border: 1px solid #e0ddd5; white-space: nowrap; }
.fx-prev td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.fx-prev tr.is-pending td { color: #8a6514; background: #fff7e6; }
.fx-exp-note { margin: 16px 0 0; font-size: 0.8125rem; color: var(--acero-claro) !important; max-width: 80ch; }

/* ---------- Barra final ---------- */
.fx-finalbar {
  position: sticky; bottom: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px clamp(16px, 3vw, 28px);
  background: rgba(17, 29, 33, 0.97); border-top: 1px solid var(--line-dark);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.3);
}
.fx-finalbar-text { margin: 0; font-size: 0.9375rem; }
.fx-finalbar-text strong { color: var(--fx-amber-text); }
.fx-finalbar.is-ready .fx-finalbar-text strong { color: var(--jade); }
.fx-finalbar:not(.is-ready) #fx-export-btn { background: rgba(14, 124, 107, 0.55); }
.fx-finalbar.is-ready #fx-export-btn { box-shadow: 0 0 0 3px rgba(95, 197, 174, 0.25); }

/* ---------- Notas bajo la app ---------- */
.fx-status { margin: 14px 0 0; min-height: 1.5em; font-size: 0.9375rem; color: var(--jade) !important; }
.fx-honesty { margin-top: 6px; max-width: 80ch; }

/* ---------- Qué incluye ---------- */
.fx-includes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 0 clamp(20px, 3vw, 36px); }
.fx-includes li { padding: 22px 0; border-top: 1px solid var(--line-light); }
.fx-inc-num { display: block; font-family: var(--font-head); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.1em; color: var(--jade-text); margin-bottom: 12px; }
.fx-includes h3 { font-size: 1.0625rem; color: var(--ink); margin-bottom: 8px; }
.fx-includes p { font-size: 0.9375rem; margin: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .fx-detail-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fx-fields-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .fx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-exp-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Tabla → tarjetas en pantallas angostas */
@media (max-width: 820px) {
  .fx-detail-body { grid-template-columns: minmax(0, 1fr); }
  .fx-viewer { border-right: 0; border-bottom: 1px solid var(--line-dark); }
  .fx-viewer-img { position: relative; top: 0; max-width: 460px; margin-inline: auto; }
  .fx-fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .fx-table-wrap { overflow: visible; border: 0; background: transparent; }
  .fx-table, .fx-table tbody { display: block; }
  .fx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .fx-table tr.fx-row {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px;
    padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line-dark); background: var(--fx-panel); border-radius: 4px;
  }
  .fx-table td { border: 0; padding: 4px 0; display: flex; flex-direction: column; min-width: 0; }
  .fx-table td::before { content: attr(data-label); font-size: 0.6875rem; color: var(--acero-claro); font-family: var(--font-head); font-weight: 600; letter-spacing: 0.04em; }
  .fx-table td.is-num { text-align: left; }
  .fx-table td.is-warn, .fx-table td.is-err { padding: 4px 6px; border-radius: 3px; }
  .fx-table td:first-child { grid-column: 1; flex-direction: row; align-items: center; }
  .fx-table td:first-child::before, .fx-table td:nth-child(2)::before, .fx-td-act::before { content: none; }
  .fx-table td:nth-child(2) { justify-content: center; align-items: flex-end; }
  .fx-td-razon { grid-column: 1 / -1; order: -1; font-weight: 600; font-size: 0.9375rem; }
  .fx-table td.fx-td-razon::before { content: none; }
  .fx-td-act { grid-column: 1 / -1; align-items: stretch; padding-top: 8px !important; }
  .fx-td-act .fx-btn { width: 100%; }
  .fx-td-act .fx-ok-mark, .fx-td-act .fx-na { text-align: center; }
  .fx-row.is-selected { box-shadow: inset 3px 0 0 var(--jade); }
  .fx-row.is-discarded td { text-decoration: none !important; }
  .fx-row.is-discarded { opacity: 0.6; }
  .fx-mono { white-space: normal; word-break: break-all; }
}

@media (max-width: 640px) {
  .fx-steps a { flex-direction: column; gap: 4px; padding: 8px 4px; font-size: 0.6875rem; text-align: center; line-height: 1.2; }
  .fx-drop.is-compact .fx-drop-text { flex-basis: calc(100% - 50px); }
  .fx-drop.is-compact .fx-drop-actions { flex: 1 1 100%; }
  .fx-drop-actions .fx-btn { flex: 1 1 100%; }
  .fx-tray { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .fx-photo-meta { padding: 6px; }
  .fx-photo-name { font-size: 0.75rem; }
  .fx-photo-state { font-size: 0.6875rem; line-height: 1.25; }
  .fx-process-row .fx-btn { width: 100%; }
  .fx-kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fx-kpi strong { font-size: 1.125rem; }
  .fx-fields-grid { grid-template-columns: minmax(0, 1fr); }
  .fx-dup { grid-template-columns: minmax(0, 1fr); }
  .fx-fmts { grid-template-columns: minmax(0, 1fr); }
  .fx-detail-actions .fx-btn { width: 100%; }
  .fx-finalbar { padding: 8px 12px; flex-wrap: nowrap; gap: 10px; }
  .fx-finalbar .fx-btn-big { min-height: 46px; padding: 8px 14px; font-size: 0.875rem; flex-shrink: 0; }
  .fx-finalbar-text { font-size: 0.8125rem; line-height: 1.3; }
  .fx-fb-long { display: none; }
  .fx-steps { position: static; }
  .fx-appbar-title > span:first-of-type { flex-basis: calc(100% - 32px); }
  .fx-stage { padding: 16px 14px; }
  .fx-viewer, .fx-fields { padding: 12px; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-photo, .fx-photo-upfill, .fx-progress-fill, .fx-hl rect { transition: none; }
  .fx-photo.is-processing .fx-photo-scan { animation: none; opacity: 0; }
  .fx-log-line { animation: none; }
  .fx-row.is-flash td { animation: none; outline: 2px solid var(--fx-amber); }
}

@media print {
  .fx-app { box-shadow: none; }
  .fx-finalbar, .fx-steps { position: static; }
}

/* Que la barra final fija no tape «Aprobar comprobante» */
.fx-detail-actions { margin-bottom: 104px; scroll-margin-bottom: 120px; }
.fx-detail-actions .fx-btn { scroll-margin-bottom: 120px; }
@media (max-width: 600px) { .fx-detail-actions { margin-bottom: 150px; scroll-margin-bottom: 170px; } .fx-detail-actions .fx-btn { scroll-margin-bottom: 170px; } }
