
  /* Modernización visual: no altera el motor de análisis ni la exportación */
  :root {
    --ux-bg: #edf2f7;
    --ux-surface: #ffffff;
    --ux-surface-soft: #f7f9fc;
    --ux-border: #d9e2ef;
    --ux-border-strong: #c8d4e5;
    --ux-text: #102039;
    --ux-muted: #65748b;
    --ux-primary: #2854d7;
    --ux-primary-strong: #1f43b8;
    --ux-primary-soft: #edf2ff;
    --ux-success: #0f8a5f;
    --ux-warning: #b7791f;
    --ux-danger: #c53d50;
    --ux-navy: #13213a;
    --ux-shadow-sm: 0 2px 8px rgba(15, 32, 57, .05);
    --ux-shadow-md: 0 10px 30px rgba(15, 32, 57, .08);
    --ux-radius-sm: 10px;
    --ux-radius: 15px;
    --ux-radius-lg: 20px;
  }

  body.ux-modern {
    background: var(--ux-bg);
    color: var(--ux-text);
  }

  body.ux-modern .app {
    width: 100%;
    height: 100vh;
    min-height: 680px;
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.ux-modern .hero {
    flex: 0 0 auto;
    min-height: 72px;
    margin: 0 -14px 14px;
    padding: 11px 18px;
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--ux-border);
    box-shadow: 0 1px 0 rgba(15, 32, 57, .03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 50;
  }

  body.ux-modern .hero .brand { gap: 11px; min-width: 0; }
  body.ux-modern .hero .logo {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--ux-primary), #5d7bea);
    box-shadow: 0 8px 20px rgba(40, 84, 215, .22);
  }
  body.ux-modern .hero .logo svg { width: 24px; height: 24px; }
  body.ux-modern .hero h1 {
    margin-bottom: 2px;
    font-size: clamp(1.18rem, 1.8vw, 1.55rem);
    letter-spacing: -.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.ux-modern .hero .subtitle {
    font-size: .8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.ux-modern .offline-badge {
    padding: 7px 10px;
    font-size: .74rem;
    border-color: #cde8dd;
    background: #effaf5;
  }

  .ux-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .ux-icon-btn, .ux-text-btn {
    min-height: 38px;
    border: 1px solid var(--ux-border);
    border-radius: 10px;
    background: #fff;
    color: #34425a;
    cursor: pointer;
    font-weight: 800;
    transition: .16s ease;
  }
  .ux-icon-btn {
    width: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
  }
  .ux-icon-btn svg { width: 19px; height: 19px; }
  .ux-text-btn { padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; }
  .ux-icon-btn:hover, .ux-text-btn:hover {
    border-color: #aebddb;
    background: var(--ux-primary-soft);
    color: var(--ux-primary);
    transform: translateY(-1px);
  }
  .ux-mobile-menu { display: none; }

  body.ux-modern .layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 342px minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
    transition: grid-template-columns .2s ease;
  }

  body.ux-modern .panel {
    border: 1px solid var(--ux-border);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-sm);
    background: var(--ux-surface);
  }

  body.ux-modern .sidebar {
    position: relative;
    top: auto;
    height: 100%;
    max-height: none;
    padding: 12px;
    overflow: auto;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
  }
  body.ux-modern .sidebar::-webkit-scrollbar,
  body.ux-modern .main-panel::-webkit-scrollbar,
  body.ux-modern .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
  body.ux-modern .sidebar::-webkit-scrollbar-thumb,
  body.ux-modern .main-panel::-webkit-scrollbar-thumb,
  body.ux-modern .table-wrap::-webkit-scrollbar-thumb {
    background: #c8d3e1;
    border: 3px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
  }

  .ux-sidebar-head {
    position: sticky;
    top: -12px;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: -12px -12px 10px;
    padding: 13px 12px 10px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid #edf1f6;
    backdrop-filter: blur(12px);
  }
  .ux-sidebar-copy { min-width: 0; }
  .ux-sidebar-copy small {
    display: block;
    color: var(--ux-muted);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .ux-sidebar-copy strong {
    display: block;
    margin-top: 2px;
    color: var(--ux-text);
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.ux-modern .side-menu {
    position: relative;
    margin: 0 0 12px;
    padding: 5px;
    gap: 4px;
    border: 1px solid var(--ux-border);
    border-radius: 13px;
    background: #f7f9fc;
  }
  body.ux-modern .side-menu::before {
    content: "MÓDULOS";
    display: block;
    padding: 5px 7px 4px;
    color: #8290a5;
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .09em;
  }
  body.ux-modern .menu-btn {
    min-height: 43px;
    padding: 0 9px;
    border-radius: 10px;
    font-size: .79rem;
    color: #41506a;
  }
  body.ux-modern .menu-btn:hover { background: #edf2fb; color: var(--ux-primary); }
  body.ux-modern .menu-btn.active {
    background: var(--ux-primary);
    color: #fff;
    box-shadow: 0 7px 16px rgba(40, 84, 215, .2);
  }
  body.ux-modern .menu-btn span:first-child {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #e6ecfb;
    font-size: .72rem;
  }
  body.ux-modern .menu-btn.active span:first-child { background: rgba(255,255,255,.18); }

  .workflow-config,
  body.ux-modern .line-box,
  body.ux-modern .audit-box,
  .floor-sidebar-card {
    border: 1px solid var(--ux-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
  }
  .workflow-config { padding: 13px; }
  body.ux-modern .line-box,
  body.ux-modern .audit-box { margin-top: 0; padding: 13px; }
  .floor-sidebar-card { display: none; padding: 15px; }
  .floor-sidebar-card h3 { margin: 0 0 7px; font-size: .95rem; }
  .floor-sidebar-card p { margin: 0 0 12px; color: var(--ux-muted); font-size: .78rem; line-height: 1.5; }
  .floor-sidebar-card .btn { width: 100%; }

  body.ux-modern[data-workspace="results"] #lineConfig,
  body.ux-modern[data-workspace="results"] #auditConfig,
  body.ux-modern[data-workspace="lineReportPanel"] #auditConfig,
  body.ux-modern[data-workspace="auditResultsPanel"] #lineConfig,
  body.ux-modern[data-workspace="floorPanel"] #lineConfig,
  body.ux-modern[data-workspace="floorPanel"] #auditConfig,
  body.ux-modern[data-workspace="floorPanel"] .workflow-config { display: none !important; }
  body.ux-modern[data-workspace="lineReportPanel"] #lineConfig,
  body.ux-modern[data-workspace="auditResultsPanel"] #auditConfig,
  body.ux-modern[data-workspace="floorPanel"] .floor-sidebar-card { display: block; }
  body.ux-modern[data-workspace="lineReportPanel"] .workflow-config > .actions,
  body.ux-modern[data-workspace="auditResultsPanel"] .workflow-config > .actions { display: none; }

  body.ux-modern .section-title {
    margin: 0 0 10px;
    font-size: .9rem;
    letter-spacing: -.01em;
  }
  body.ux-modern .step {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--ux-primary-soft);
    color: var(--ux-primary);
  }
  body.ux-modern .divider { margin: 15px 0; }

  body.ux-modern .dropzone {
    padding: 16px 12px;
    border-width: 1.5px;
    border-color: #bfcbe0;
    border-radius: 12px;
    background: #f8faff;
  }
  body.ux-modern .dropzone:hover,
  body.ux-modern .dropzone.dragover,
  body.ux-modern .dropzone:focus-visible {
    border-color: var(--ux-primary);
    background: #f0f4ff;
    transform: none;
  }
  body.ux-modern .drop-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 7px;
    border-radius: 11px;
  }
  body.ux-modern .dropzone strong { font-size: .84rem; }
  body.ux-modern .dropzone small { font-size: .72rem; }
  body.ux-modern .file-card { padding: 9px 10px; border-radius: 10px; }

  body.ux-modern textarea,
  body.ux-modern input[type="text"],
  body.ux-modern input[type="number"],
  body.ux-modern select {
    border-color: #cbd6e5;
    border-radius: 10px;
    background: #fff;
  }
  body.ux-modern textarea { min-height: 128px; padding: 10px 11px; }
  body.ux-modern .compact-textarea { min-height: 62px; }
  body.ux-modern input[type="text"],
  body.ux-modern input[type="number"],
  body.ux-modern select { height: 40px; }
  body.ux-modern textarea:focus,
  body.ux-modern input:focus,
  body.ux-modern select:focus {
    border-color: var(--ux-primary);
    box-shadow: 0 0 0 3px rgba(40,84,215,.11);
  }
  body.ux-modern label.field-label { font-size: .79rem; margin-bottom: 6px; }
  body.ux-modern .help { font-size: .71rem; line-height: 1.42; }

  .ux-details {
    margin-top: 12px;
    border: 1px solid var(--ux-border);
    border-radius: 11px;
    background: #f9fbfe;
    overflow: hidden;
  }
  .ux-details > summary {
    list-style: none;
    cursor: pointer;
    min-height: 42px;
    padding: 0 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #41506a;
    font-size: .77rem;
    font-weight: 850;
  }
  .ux-details > summary::-webkit-details-marker { display: none; }
  .ux-details > summary::after {
    content: "+";
    width: 23px;
    height: 23px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: #eaf0fb;
    color: var(--ux-primary);
    font-size: 1rem;
    line-height: 1;
  }
  .ux-details[open] > summary::after { content: "−"; }
  .ux-details[open] > summary { border-bottom: 1px solid var(--ux-border); background: #fff; }
  .ux-details-content { padding: 11px; }
  .ux-details-content > :first-child { margin-top: 0 !important; }

  body.ux-modern .actions { gap: 8px; margin-top: 13px; }
  body.ux-modern .btn {
    min-height: 40px;
    border-radius: 10px;
    font-size: .78rem;
    box-shadow: none;
  }
  body.ux-modern .btn-primary { background: var(--ux-primary); }
  body.ux-modern .btn-primary:not(:disabled):hover { background: var(--ux-primary-strong); }
  body.ux-modern .btn-excel { background: var(--ux-success); box-shadow: none; }
  body.ux-modern .btn-secondary { background: #eef2f7; color: #35435b; }
  body.ux-modern .export-actions { gap: 6px; }
  body.ux-modern .export-actions .btn { min-height: 35px; font-size: .73rem; }
  body.ux-modern .status { margin-top: 10px; }

  body.ux-modern .main-panel {
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: auto;
    background: #f7f9fc;
    border-radius: var(--ux-radius-lg);
    box-shadow: none;
    overscroll-behavior: contain;
  }

  .workspace-bar {
    position: sticky;
    top: 0;
    z-index: 35;
    min-height: 67px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--ux-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .workspace-icon {
    width: 39px;
    height: 39px;
    flex: 0 0 auto;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--ux-primary-soft);
    color: var(--ux-primary);
    font-size: .86rem;
    font-weight: 950;
  }
  .workspace-copy { min-width: 0; flex: 1; }
  .workspace-copy small {
    display: block;
    color: #7b889c;
    font-size: .64rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .workspace-copy strong {
    display: block;
    margin-top: 1px;
    color: var(--ux-text);
    font-size: .98rem;
  }
  .workspace-copy span {
    display: block;
    margin-top: 1px;
    color: var(--ux-muted);
    font-size: .73rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .workspace-actions { display: flex; align-items: center; gap: 8px; }
  .workspace-file-pill {
    max-width: 260px;
    padding: 7px 10px;
    border: 1px solid var(--ux-border);
    border-radius: 999px;
    background: #f8fafc;
    color: #526079;
    font-size: .7rem;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .workspace-file-pill.loaded {
    color: #126d4c;
    border-color: #c9e7da;
    background: #eff9f5;
  }
  .workspace-primary {
    min-height: 39px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--ux-primary);
    color: #fff;
    cursor: pointer;
    font-size: .76rem;
    font-weight: 850;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .workspace-primary:hover:not(:disabled) { background: var(--ux-primary-strong); }
  .workspace-primary:disabled { opacity: .45; cursor: not-allowed; }
  .workspace-primary kbd {
    padding: 2px 5px;
    border-radius: 5px;
    background: rgba(255,255,255,.16);
    font: inherit;
    font-size: .62rem;
  }

  body.ux-modern .empty-state {
    min-height: calc(100% - 68px);
    padding: 42px 24px;
  }
  body.ux-modern .empty-art { width: 88px; height: 88px; border-radius: 24px; }

  body.ux-modern .results,
  body.ux-modern .line-report-panel,
  body.ux-modern .floor-panel,
  body.ux-modern .audit-results-panel { background: transparent; }
  body.ux-modern .results-head {
    margin: 12px;
    padding: 17px;
    border: 1px solid var(--ux-border);
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--ux-shadow-sm);
  }
  body.ux-modern .results-topline { margin-bottom: 13px; }
  body.ux-modern .results-topline h2 { font-size: 1.02rem; }
  body.ux-modern .results-topline p { font-size: .76rem; }
  body.ux-modern .kpis { gap: 8px; }
  body.ux-modern .kpi {
    min-height: 76px;
    padding: 11px 12px;
    border-color: var(--ux-border);
    border-radius: 12px;
    background: #f9fbfd;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  body.ux-modern .kpi .value { font-size: 1.25rem; }
  body.ux-modern .kpi .label { font-size: .68rem; }

  body.ux-modern .toolbar {
    position: sticky;
    top: 67px;
    z-index: 18;
    margin: 0 12px;
    padding: 10px;
    border: 1px solid var(--ux-border);
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    box-shadow: var(--ux-shadow-sm);
    backdrop-filter: blur(10px);
  }
  body.ux-modern .toolbar-search input { background: #f8fafc; }
  body.ux-modern .toolbar select { background: #f8fafc; }

  body.ux-modern .table-wrap {
    margin: 12px;
    width: auto;
    max-height: calc(100vh - 260px);
    border: 1px solid var(--ux-border);
    border-radius: 13px;
    background: #fff;
  }
  body.ux-modern table { min-width: min(1140px, 100%); }
  body.ux-modern th {
    padding: 11px 12px;
    background: #f3f6fa;
    color: #526079;
    border-bottom-color: var(--ux-border-strong);
    font-size: .68rem;
  }
  body.ux-modern td {
    padding: 11px 12px;
    border-bottom-color: #e8edf4;
    font-size: .8rem;
  }
  body.ux-modern tbody tr:nth-child(even) { background: #fbfcfe; }
  body.ux-modern tbody tr:hover { background: #f3f7ff; }

  body.ux-modern .sheet-overview,
  body.ux-modern .audit-note,
  body.ux-modern .report-section-title,
  body.ux-modern .floor-import-card,
  body.ux-modern .floor-empty-message,
  body.ux-modern .line-visual-summary {
    margin-left: 12px;
    margin-right: 12px;
    border-radius: 13px;
  }
  body.ux-modern .sheet-overview { margin-bottom: 12px; border: 1px solid var(--ux-border); }
  body.ux-modern .report-section-title {
    margin-top: 13px;
    padding: 11px 13px;
    border: 1px solid var(--ux-border);
    background: #fff;
  }
  body.ux-modern .line-visual-summary {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--ux-border);
    border-radius: 15px;
  }
  body.ux-modern .line-score-card,
  body.ux-modern .line-chart-box,
  body.ux-modern .line-visual-card { box-shadow: none; border-color: var(--ux-border); }
  body.ux-modern .line-bar-fill { background: linear-gradient(90deg, #d5a22f, #5b78e8, #149467); }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(15, 28, 50, .42);
    backdrop-filter: blur(2px);
  }

  body.sidebar-collapsed .layout { grid-template-columns: 82px minmax(0, 1fr); }
  body.sidebar-collapsed .sidebar { padding: 8px; overflow: hidden; }
  body.sidebar-collapsed .ux-sidebar-head { margin: -8px -8px 8px; justify-content: center; padding: 11px 8px; }
  body.sidebar-collapsed .ux-sidebar-copy,
  body.sidebar-collapsed .side-menu::before,
  body.sidebar-collapsed .menu-btn span:last-child,
  body.sidebar-collapsed .workflow-config,
  body.sidebar-collapsed #lineConfig,
  body.sidebar-collapsed #auditConfig,
  body.sidebar-collapsed .floor-sidebar-card { display: none !important; }
  body.sidebar-collapsed .side-menu { padding: 5px; }
  body.sidebar-collapsed .menu-btn { justify-content: center; padding: 0; }
  body.sidebar-collapsed .menu-btn span:first-child { width: 31px; height: 31px; }

  body.compact-ui .results-head { padding: 13px; }
  body.compact-ui .kpi { min-height: 65px; padding: 8px 10px; }
  body.compact-ui .kpi .value { font-size: 1.08rem; }
  body.compact-ui td { padding: 8px 10px; font-size: .75rem; }
  body.compact-ui th { padding: 9px 10px; }
  body.compact-ui .table-wrap { max-height: calc(100vh - 230px); }

  @media (max-width: 1180px) {
    body.ux-modern .layout { grid-template-columns: 310px minmax(0, 1fr); }
    .workspace-file-pill { display: none; }
    body.ux-modern .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  }

  @media (max-width: 940px) {
    body.ux-modern { overflow: auto; }
    body.ux-modern .app { height: auto; min-height: 100vh; overflow: visible; padding: 0 10px 10px; }
    body.ux-modern .hero { position: sticky; top: 0; margin: 0 -10px 10px; padding: 9px 11px; }
    body.ux-modern .hero .subtitle { display: none; }
    body.ux-modern .hero h1 { max-width: 58vw; font-size: 1rem; }
    body.ux-modern .offline-badge { display: none; }
    .ux-mobile-menu { display: inline-grid; }
    .ux-text-btn { display: none; }
    body.ux-modern .layout { display: block; min-height: auto; }
    body.ux-modern .sidebar {
      position: fixed;
      inset: 0 auto 0 0;
      z-index: 100;
      width: min(390px, 92vw);
      height: 100vh;
      max-height: none;
      border-radius: 0 18px 18px 0;
      transform: translateX(-104%);
      transition: transform .22s ease;
      box-shadow: 20px 0 50px rgba(15,32,57,.18);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    body.sidebar-collapsed .sidebar { padding: 12px; overflow: auto; }
    body.sidebar-collapsed .ux-sidebar-copy,
    body.sidebar-collapsed .side-menu::before,
    body.sidebar-collapsed .menu-btn span:last-child,
    body.sidebar-collapsed .workflow-config,
    body.sidebar-collapsed #lineConfig,
    body.sidebar-collapsed #auditConfig,
    body.sidebar-collapsed .floor-sidebar-card { display: initial; }
    body.sidebar-collapsed .workflow-config,
    body.sidebar-collapsed #lineConfig,
    body.sidebar-collapsed #auditConfig,
    body.sidebar-collapsed .floor-sidebar-card { display: block; }
    body.sidebar-collapsed .menu-btn { justify-content: flex-start; padding: 0 9px; }
    body.ux-modern .main-panel { height: auto; min-height: calc(100vh - 84px); overflow: visible; }
    .workspace-bar { top: 61px; padding: 9px 10px; }
    .workspace-primary kbd { display: none; }
    body.ux-modern .toolbar { top: 121px; }
    body.ux-modern .table-wrap { max-height: 580px; }
  }

  @media (max-width: 620px) {
    body.ux-modern .hero .logo { width: 38px; height: 38px; }
    body.ux-modern .hero h1 { max-width: 48vw; }
    .workspace-bar { align-items: flex-start; flex-wrap: wrap; }
    .workspace-icon { width: 34px; height: 34px; }
    .workspace-actions { width: 100%; justify-content: space-between; }
    .workspace-primary { flex: 1; justify-content: center; }
    body.ux-modern .results-head { margin: 9px; padding: 12px; }
    body.ux-modern .toolbar { margin: 0 9px; }
    body.ux-modern .table-wrap { margin: 9px; }
    body.ux-modern .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
    body.ux-modern .results-topline { align-items: stretch; }
    body.ux-modern .export-actions { width: 100%; }
    body.ux-modern .export-actions .btn { flex: 1 1 calc(50% - 6px); }
  }

  @media print {
    .workspace-bar, .ux-header-actions, .sidebar-backdrop { display: none !important; }
  }
