:root{
    --red:#ef2f2f;
    --red-dark:#d92727;
    --text:#2e3138;
    --muted:#6b7280;
    --bg:#f7f7fb;
    --card:#ffffff;
    --border:#e7e7ef;
    --shadow:0 16px 40px rgba(31,41,55,.10);
}
*{box-sizing:border-box}
body{
    margin:0;
    font-family:Inter,Arial,Helvetica,sans-serif;
    color:var(--text);
    background:var(--bg);
}
.topbar{
    height:72px;
    background:#fff;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 42px;
    border-bottom:1px solid var(--border);
}
.brand{
    text-decoration:none;
    color:#111827;
    font-size:30px;
    font-weight:900;
    letter-spacing:-1px;
    display:flex;
    gap:3px;
    align-items:center;
}
.brand b{color:var(--red);font-size:32px;line-height:1}
.brand small{
    font-size:12px;
    background:#111827;
    color:#fff;
    padding:3px 6px;
    border-radius:10px;
    margin-left:4px;
    letter-spacing:0;
}
nav{display:flex;gap:32px}
nav a{
    color:#111827;
    text-decoration:none;
    font-size:14px;
    font-weight:800;
    text-transform:uppercase;
}
.hero{
    min-height:520px;
    display:grid;
    grid-template-columns:1fr 500px;
    align-items:center;
    gap:40px;
    padding:70px max(6vw,40px);
}
.hero-copy{max-width:660px}
.eyebrow{
    color:var(--red);
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.12em;
    font-size:13px;
}
h1{
    font-size:46px;
    line-height:1.05;
    margin:12px 0 14px;
    letter-spacing:-1.3px;
}
.hero-copy p:not(.eyebrow){
    font-size:20px;
    line-height:1.45;
    color:#4b5563;
}
.upload-card{
    background:transparent;
    text-align:center;
    padding:25px;
    border-radius:26px;
    position:relative;
}
.upload-card.dragover{
    background:#fff;
    box-shadow:var(--shadow);
    outline:2px dashed var(--red);
}
input[type=file]{display:none}
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:0;
    border-radius:12px;
    padding:18px 34px;
    font-size:18px;
    font-weight:800;
    text-decoration:none;
    cursor:pointer;
    transition:.2s ease;
}
.btn.primary{
    color:#fff;
    background:var(--red);
    box-shadow:0 10px 18px rgba(239,47,47,.22);
}
.btn.primary:hover{background:var(--red-dark);transform:translateY(-1px)}
.btn.secondary{
    background:#fff;
    color:#111827;
    border:1px solid var(--border);
}
.btn.convert{
    display:none;
    margin:20px auto 0;
    background:#111827;
    color:#fff;
    font-size:16px;
    padding:14px 28px;
}
.btn.convert.active{display:inline-flex}
.btn:disabled{opacity:.5;cursor:not-allowed}
.drop-text{color:var(--muted);font-size:14px;margin:12px 0 8px}
.file-name{color:#111827;font-weight:700;margin:0}
.loader{display:none;margin-top:24px;color:var(--muted);font-weight:700}
.loader.show{display:block}
.loader span{
    display:inline-block;
    width:10px;height:10px;border-radius:50%;
    background:var(--red);
    margin:0 4px;
    animation:bounce .8s infinite alternate;
}
.loader span:nth-child(2){animation-delay:.15s}
.loader span:nth-child(3){animation-delay:.3s}
@keyframes bounce{to{transform:translateY(-8px);opacity:.55}}
.info{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:24px;
    padding:0 max(6vw,40px) 60px;
}
.info-card,.card{
    background:var(--card);
    border:1px solid var(--border);
    border-radius:22px;
    padding:28px;
    box-shadow:var(--shadow);
}
.info-card h2,.result-card h2{margin-top:0}
pre{
    white-space:pre-wrap;
    word-break:break-word;
    background:#111827;
    color:#f9fafb;
    padding:18px;
    border-radius:14px;
    overflow:auto;
}
code{font-family:Consolas,Monaco,monospace}
.page{padding:60px max(6vw,40px)}
.center{display:flex;justify-content:center}
.result-card{max-width:980px;width:100%}
.badge{
    display:inline-flex;
    padding:6px 12px;
    border-radius:999px;
    font-weight:800;
    font-size:13px;
}
.badge.ok{background:#dcfce7;color:#166534}
.badge.error{background:#fee2e2;color:#991b1b}
.actions{display:flex;gap:14px;flex-wrap:wrap;margin:22px 0 28px}
.preview{max-height:480px}
@media(max-width:900px){
    .topbar{padding:0 20px}.brand{font-size:25px}nav{display:none}
    .hero{grid-template-columns:1fr;min-height:auto;padding:45px 20px;text-align:center}
    h1{font-size:36px}.hero-copy p:not(.eyebrow){font-size:17px}
    .info{grid-template-columns:1fr;padding:0 20px 45px}
}
.hero-actions{margin-top:24px;display:flex;gap:14px;flex-wrap:wrap}
.btn.small{font-size:15px;padding:13px 20px;border-radius:11px}
.result-card h1{font-size:38px}

/* Versión visible: no depende de JavaScript para mostrar archivo y botón */
.upload-box{
    width:min(520px,100%);
    margin:0 auto;
    background:#fff;
    border:1px solid var(--border);
    border-radius:22px;
    padding:24px;
    box-shadow:var(--shadow);
    text-align:left;
}
.upload-label{
    display:block;
    font-size:18px;
    font-weight:900;
    margin-bottom:12px;
    color:#111827;
}
input[type=file].native-file{
    display:block;
    width:100%;
    background:#f9fafb;
    border:1px dashed #cfd4dc;
    border-radius:14px;
    padding:14px;
    font-size:15px;
    color:#111827;
    cursor:pointer;
}
input[type=file].native-file::file-selector-button{
    border:0;
    border-radius:10px;
    background:var(--red);
    color:#fff;
    font-weight:800;
    padding:12px 16px;
    margin-right:14px;
    cursor:pointer;
}
.btn.convert-visible{
    display:flex;
    width:100%;
    margin-top:18px;
    font-size:17px;
    padding:16px 24px;
}
.upload-box .drop-text{
    margin-top:14px;
}
.upload-box .file-name{
    margin-top:8px;
    padding:10px 12px;
    border-radius:12px;
    background:#f3f4f6;
}

/* Opciones OCR y diagnóstico */
.ocr-options{
    margin-top:14px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:#fafafa;
}
.ocr-options label{
    display:block;
    font-size:14px;
    font-weight:800;
    margin-bottom:8px;
}
.ocr-options input[type=number]{
    width:120px;
    border:1px solid #d1d5db;
    border-radius:10px;
    padding:10px 12px;
    font-size:15px;
    margin-bottom:10px;
}
.ocr-options .checkline{
    display:flex;
    gap:8px;
    align-items:flex-start;
    font-weight:700;
    line-height:1.35;
}
.ocr-options .checkline input{margin-top:3px}
.ocr-options p,.hint{
    color:var(--muted);
    font-size:14px;
    line-height:1.45;
}
.table-wrap{overflow:auto;margin:20px 0}
.check-table{
    width:100%;
    border-collapse:collapse;
    font-size:15px;
}
.check-table th,.check-table td{
    border-bottom:1px solid var(--border);
    padding:14px 12px;
    text-align:left;
    vertical-align:top;
}
.check-table th{background:#f9fafb;color:#111827}

/* OCR completo por tandas */
.progress-card p{font-size:17px;line-height:1.45;color:#4b5563}
.progress-wrap{
    width:100%;
    height:26px;
    background:#eef2f7;
    border:1px solid var(--border);
    border-radius:999px;
    overflow:hidden;
    margin:24px 0 10px;
}
.progress-bar{
    height:100%;
    min-width:0;
    background:var(--red);
    border-radius:999px;
    transition:width .25s ease;
}
.progress-meta{
    display:flex;
    justify-content:space-between;
    gap:16px;
    color:#111827;
    font-size:18px;
    margin-bottom:20px;
}
.log-box{
    background:#111827;
    color:#f9fafb;
    border-radius:14px;
    padding:16px;
    max-height:250px;
    overflow:auto;
    font-family:Consolas,Monaco,monospace;
    font-size:14px;
}
.log-box p{margin:0 0 8px;color:#f9fafb;font-size:14px}
@media(max-width:900px){.progress-meta{flex-direction:column;font-size:16px}.hero-copy strong{display:inline}}
