:root{
  --bg:#f3f6fb;--panel:#fff;--ink:#0f172a;--muted:#64748b;--line:#dbe3ef;
  --primary:#0f766e;--primary2:#115e59;--danger:#b91c1c;--warn:#b45309;--ok:#15803d;
  --shadow:0 14px 35px rgba(15,23,42,.10);--radius:18px;
}
*{box-sizing:border-box}html{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--ink)}body{margin:0;min-height:100vh;background:linear-gradient(180deg,#eef4f8 0,#f8fafc 280px)}a{color:inherit;text-decoration:none}button,input,select,textarea{font:inherit}.app-shell{min-height:100vh}.topbar{height:74px;background:#0f172a;color:white;display:flex;align-items:center;justify-content:space-between;padding:0 max(18px,env(safe-area-inset-left));position:sticky;top:0;z-index:30;box-shadow:0 6px 20px rgba(15,23,42,.16)}.brand{display:flex;gap:11px;align-items:center}.brand-mark{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:#14b8a6;font-weight:900}.brand strong{display:block;font-size:15px}.brand small{display:block;color:#cbd5e1;font-size:11px;margin-top:2px}.user-chip{display:flex;align-items:center;gap:14px;font-size:13px}.user-chip a{padding:8px 11px;border:1px solid #334155;border-radius:10px}.nav-toggle{display:none;background:transparent;border:0;color:white;font-size:25px}.main-nav{height:52px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:8px;padding:0 20px;position:sticky;top:74px;z-index:25}.main-nav a{padding:9px 14px;border-radius:11px;color:#475569;font-weight:750;font-size:14px}.main-nav a.active,.main-nav a:hover{background:#ecfdf5;color:#0f766e}.content{width:min(1180px,calc(100% - 28px));margin:28px auto 80px}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:22px}.page-head h1{margin:0 0 5px;font-size:clamp(24px,4vw,34px);letter-spacing:-.03em}.page-head p{margin:0;color:var(--muted);max-width:760px}.actions{display:flex;gap:9px;flex-wrap:wrap}.btn{border:0;border-radius:12px;padding:11px 15px;font-weight:800;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:43px;transition:.15s ease}.btn:active{transform:translateY(1px)}.btn-primary{background:var(--primary);color:#fff}.btn-primary:hover{background:var(--primary2)}.btn-secondary{background:#e2e8f0;color:#0f172a}.btn-danger{background:#fee2e2;color:#991b1b}.btn-outline{background:white;border:1px solid var(--line);color:#334155}.btn-sm{min-height:36px;padding:8px 11px;border-radius:10px;font-size:13px}.card{background:var(--panel);border:1px solid rgba(203,213,225,.8);border-radius:var(--radius);box-shadow:var(--shadow)}.card-pad{padding:20px}.grid{display:grid;gap:16px}.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}.stat{padding:18px}.stat .label{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:800}.stat .value{font-size:30px;font-weight:900;margin-top:5px}.stat .hint{font-size:12px;color:var(--muted);margin-top:4px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:26px 0 11px}.section-title h2{font-size:18px;margin:0}.table-wrap{overflow:auto;border-radius:var(--radius)}table{width:100%;border-collapse:separate;border-spacing:0;background:white}th,td{text-align:left;padding:13px 14px;border-bottom:1px solid #edf2f7;vertical-align:middle}th{font-size:11px;text-transform:uppercase;letter-spacing:.055em;color:#64748b;background:#f8fafc;position:sticky;top:0}tr:last-child td{border-bottom:0}.muted{color:var(--muted)}.badge{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:850}.badge-ok{background:#dcfce7;color:#166534}.badge-warn{background:#fef3c7;color:#92400e}.badge-info{background:#dbeafe;color:#1d4ed8}.badge-gray{background:#e2e8f0;color:#475569}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.field{display:flex;flex-direction:column;gap:6px}.field label{font-size:12px;font-weight:850;color:#475569}.input,.select,.textarea{width:100%;border:1px solid #cbd5e1;background:white;color:#0f172a;border-radius:12px;padding:11px 12px;outline:none;min-height:44px}.textarea{min-height:90px;resize:vertical}.input:focus,.select:focus,.textarea:focus{border-color:#14b8a6;box-shadow:0 0 0 3px rgba(20,184,166,.13)}.searchbar{display:flex;gap:10px;align-items:center}.searchbar .input{flex:1}.empty{padding:40px 22px;text-align:center;color:var(--muted)}.notice{border-radius:14px;padding:13px 15px;background:#eff6ff;color:#1e3a8a;border:1px solid #bfdbfe;font-size:13px}.notice.warn{background:#fff7ed;color:#9a3412;border-color:#fed7aa}.notice.ok{background:#f0fdf4;color:#166534;border-color:#bbf7d0}.modal{position:fixed;inset:0;background:rgba(15,23,42,.56);display:none;align-items:center;justify-content:center;padding:18px;z-index:100}.modal.open{display:flex}.modal-panel{width:min(720px,100%);max-height:min(90vh,820px);background:white;border-radius:20px;box-shadow:0 26px 70px rgba(15,23,42,.32);overflow:hidden;display:flex;flex-direction:column}.modal-panel.wide{width:min(1080px,100%)}.modal-head{padding:17px 20px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:14px;align-items:center}.modal-head h3{margin:0;font-size:18px}.modal-body{padding:20px;overflow:auto}.modal-foot{padding:14px 20px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:10px;background:#fafafa}.icon-btn{border:0;background:#f1f5f9;width:38px;height:38px;border-radius:11px;cursor:pointer;font-size:19px}.toast{position:fixed;right:18px;bottom:18px;transform:translateY(30px);opacity:0;pointer-events:none;background:#0f172a;color:white;padding:12px 15px;border-radius:12px;box-shadow:var(--shadow);transition:.2s;z-index:200;max-width:min(420px,calc(100% - 36px));font-weight:700;font-size:13px}.toast.show{opacity:1;transform:none}.toast.error{background:#991b1b}.toast.ok{background:#166534}.login-page{min-height:100vh;display:grid;place-items:center;padding:24px}.login-card{width:min(420px,100%);padding:28px}.login-title{display:flex;align-items:center;gap:12px;margin-bottom:23px}.login-title .brand-mark{color:white}.login-title h1{font-size:22px;margin:0}.login-title p{margin:3px 0 0;color:var(--muted);font-size:13px}.login-card .field{margin-bottom:13px}.login-error{background:#fef2f2;color:#991b1b;border:1px solid #fecaca;padding:10px 12px;border-radius:11px;margin-bottom:12px;font-size:13px}.book-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.book-card{padding:18px;display:flex;flex-direction:column;gap:13px}.book-card h3{margin:0;font-size:18px}.book-meta{display:flex;flex-wrap:wrap;gap:8px;font-size:12px;color:var(--muted)}.book-card .actions{margin-top:auto}.folio-big{font-size:26px;font-weight:950;letter-spacing:-.03em}.patient-result{display:flex;justify-content:space-between;gap:15px;align-items:center;padding:14px 0;border-bottom:1px solid #edf2f7}.patient-result:last-child{border-bottom:0}.patient-name{font-weight:850}.patient-meta{font-size:12px;color:var(--muted);margin-top:3px}.patient-folio{min-width:72px;text-align:center;border-radius:12px;background:#ecfdf5;color:#065f46;padding:9px 11px;font-weight:950}.patient-folio.pending{background:#f1f5f9;color:#64748b}.modal-open{overflow:hidden}
@media(max-width:900px){.grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}.book-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.topbar{height:66px}.brand small{display:none}.user-chip{display:none}.nav-toggle{display:block}.main-nav{position:fixed;top:66px;left:0;right:0;height:auto;padding:10px;display:none;grid-template-columns:repeat(2,1fr);box-shadow:var(--shadow)}body.nav-open .main-nav{display:grid}.content{width:min(100% - 20px,1180px);margin-top:18px}.page-head{flex-direction:column}.page-head .actions{width:100%}.page-head .actions .btn{flex:1}.grid-4,.book-cards,.form-grid{grid-template-columns:1fr}.card-pad{padding:16px}.searchbar{flex-direction:column;align-items:stretch}.modal{padding:0;align-items:stretch}.modal-panel,.modal-panel.wide{width:100%;max-height:100vh;height:100%;border-radius:0;padding-bottom:env(safe-area-inset-bottom)}.modal-head{padding-top:max(17px,env(safe-area-inset-top))}.modal-foot{position:sticky;bottom:0;display:grid;grid-template-columns:1fr 1fr}.modal-foot .btn{width:100%}th,td{padding:11px 10px}.hide-mobile{display:none!important}.toast{bottom:max(14px,env(safe-area-inset-bottom))}.btn{min-height:46px}}
.capture-hero{display:grid;grid-template-columns:1.2fr .8fr;gap:16px}.capture-panel{padding:22px}.capture-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:18px}.capture-actions .btn{min-height:58px;font-size:15px}.capture-actions .manual{grid-column:1/-1}.file-hidden{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.capture-status{margin-top:16px;padding:13px 14px;border-radius:14px;background:#f8fafc;border:1px solid var(--line)}.progress{height:8px;background:#e2e8f0;border-radius:999px;overflow:hidden;margin-top:9px}.progress>span{display:block;height:100%;background:#14b8a6;width:0;transition:width .15s}.privacy-note{display:flex;gap:10px;align-items:flex-start;font-size:12px;color:#475569}.privacy-dot{width:9px;height:9px;border-radius:50%;background:#22c55e;margin-top:4px;flex:0 0 auto}.review-layout{display:grid;grid-template-columns:minmax(260px,.8fr) minmax(420px,1.2fr);gap:18px}.preview-box{background:#0f172a;border-radius:15px;min-height:380px;display:flex;align-items:center;justify-content:center;overflow:hidden;position:sticky;top:0}.preview-box img{display:block;max-width:100%;max-height:68vh;object-fit:contain}.preview-empty{color:#94a3b8;padding:30px;text-align:center}.ocr-list{display:flex;flex-direction:column;gap:10px}.ocr-row{border:1px solid #dbe3ef;border-radius:14px;padding:12px;background:#fff}.ocr-row.review{border-color:#f59e0b;background:#fffbeb}.ocr-row.auto{border-color:#86efac;background:#f0fdf4}.ocr-row.new{border-color:#bfdbfe;background:#eff6ff}.ocr-row-top{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:9px}.ocr-row-grid{display:grid;grid-template-columns:1.15fr .85fr;gap:9px}.ocr-source{font-size:11px;color:#64748b;margin-top:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mini-label{font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.05em;color:#64748b;margin-bottom:4px}.review-toolbar{display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-bottom:12px}.review-toolbar .field{min-width:110px;max-width:150px}.queue-pill{display:inline-flex;align-items:center;gap:7px;background:#e2e8f0;border-radius:999px;padding:7px 10px;font-size:12px;font-weight:800}.recent-page{display:flex;justify-content:space-between;gap:15px;padding:11px 0;border-bottom:1px solid #edf2f7}.recent-page:last-child{border-bottom:0}
@media(max-width:800px){.capture-hero{grid-template-columns:1fr}.review-layout{grid-template-columns:1fr}.preview-box{position:relative;min-height:180px;max-height:38vh}.preview-box img{max-height:38vh}.ocr-row-grid{grid-template-columns:1fr}.capture-actions{grid-template-columns:1fr}.capture-actions .manual{grid-column:auto}.review-toolbar{align-items:stretch}.review-toolbar .field{max-width:none;min-width:0;flex:1}.review-toolbar .btn{width:100%}}
/* v2.0 - captura completa de libro clínico */
.record-grid{display:grid;gap:10px}.record-grid.compact-fields{grid-template-columns:repeat(6,minmax(0,1fr))}.record-grid.clinical-fields{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:10px}.record-grid .span-2{grid-column:span 2}.ocr-row{padding:14px}.ocr-row .field label{font-size:10px;text-transform:uppercase;letter-spacing:.045em}.ocr-row .textarea{min-height:74px}.field-low .input,.field-low .select,.field-low .textarea{border-color:#f59e0b;background:#fffdf5}.field-low label::after{content:" · revisar";color:#b45309;font-weight:900}.review-layout{grid-template-columns:minmax(280px,.72fr) minmax(620px,1.28fr)}#reviewModal .modal-panel.wide{width:min(1420px,calc(100vw - 24px));max-height:94dvh}.ocr-source{white-space:normal;line-height:1.35}.review-toolbar{position:sticky;top:-20px;background:#fff;z-index:5;padding:8px 0 12px;border-bottom:1px solid #eef2f7}.preview-box{min-height:420px}
@media(max-width:1100px){.record-grid.compact-fields{grid-template-columns:repeat(3,minmax(0,1fr))}.record-grid.clinical-fields{grid-template-columns:1fr}.review-layout{grid-template-columns:1fr}.preview-box{position:relative;min-height:220px;max-height:42vh}.preview-box img{max-height:42vh}}
@media(max-width:650px){.record-grid.compact-fields{grid-template-columns:1fr 1fr}.record-grid .span-2{grid-column:1/-1}.review-toolbar{position:static}.modal{padding:6px}.modal-panel{border-radius:14px;max-height:97dvh}.modal-body{padding:12px}.modal-head{padding:13px 14px}.modal-foot{padding:10px 12px}.ocr-row{padding:11px}.review-layout{gap:12px}}

/* v2.1.0 - módulo OCR de prueba, completamente no persistente */
.test-mode-pill{display:inline-flex;align-items:center;gap:8px;padding:7px 10px;border-radius:999px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font-size:11px;font-weight:900;letter-spacing:.05em;margin-bottom:9px}.test-grid{display:grid;grid-template-columns:minmax(300px,.82fr) minmax(0,1.6fr);gap:18px;align-items:start}.test-drop{border:1.5px dashed #94a3b8;border-radius:17px;padding:28px 20px;text-align:center;background:linear-gradient(180deg,#f8fafc,#fff)}.test-drop-icon{font-size:34px;margin-bottom:7px;color:#0f766e}.test-drop strong{display:block;font-size:17px}.test-drop span{display:block;color:#64748b;font-size:12px;margin-top:5px}.test-preview{margin-top:16px;min-height:280px;max-height:560px;overflow:auto}.test-preview img{width:100%;height:auto;display:block}.test-results-panel{min-height:570px}.test-footer{position:sticky;bottom:-20px;background:rgba(255,255,255,.96);backdrop-filter:blur(8px);border-top:1px solid var(--line);padding:14px 0 0;margin-top:16px;justify-content:space-between;gap:10px;flex-wrap:wrap}.fixed-folio-box{background:#f8fafc;border:1px solid #e2e8f0;border-radius:13px;padding:10px}.fixed-search-wrap{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;margin-top:7px}.fixed-selected{font-size:11px;font-weight:850;color:#0f766e;white-space:nowrap}.field-low .input,.field-low .select,.field-low .textarea{border-color:#f59e0b;background:#fffbeb}.privacy-note{display:flex;gap:9px;align-items:flex-start;font-size:12px;line-height:1.45;color:#475569;background:#f0fdf4;border:1px solid #bbf7d0;padding:12px 13px;border-radius:13px}.privacy-dot{width:9px;height:9px;border-radius:50%;background:#16a34a;margin-top:4px;flex:0 0 auto}
@media(max-width:900px){.test-grid{grid-template-columns:1fr}.test-results-panel{min-height:auto}.fixed-search-wrap{grid-template-columns:1fr}.fixed-selected{white-space:normal}.test-preview{max-height:440px}}

/* v2.2.0 - Prueba OCR compacta + IA visión opcional */
.content:has(.ocr-test-workspace){width:min(1600px,calc(100% - 28px))}
.ocr-test-workspace{display:grid;grid-template-columns:minmax(285px,360px) minmax(0,1fr);gap:16px;align-items:start}
.ocr-test-side{position:sticky;top:144px}
.ocr-test-results{min-width:0;overflow:hidden}
.ocr-results-head{padding:18px 20px 14px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:14px}
.ocr-results-head h2{margin:0 0 3px;font-size:18px}.ocr-summary{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.ocr-engine-box{margin-top:12px;padding:12px;border:1px solid #dbe3ef;border-radius:14px;background:#f8fafc;display:grid;gap:9px}.ocr-engine-title{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.06em;color:#64748b}.ocr-engine-main{width:100%}.ai-consent{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;border-radius:10px;background:#fff7ed;border:1px solid #fed7aa;color:#7c2d12;font-size:11px;line-height:1.4}.ai-consent input{margin-top:2px}.ocr-engine-hint{font-size:11px;line-height:1.45;color:#64748b}
.ocr-compact-wrap{overflow:auto;max-height:calc(100vh - 285px);min-height:360px;background:#fff}
.ocr-compact-table{min-width:1480px;border-collapse:separate;border-spacing:0;table-layout:fixed}
.ocr-compact-table th{top:0;z-index:4;height:36px;padding:8px 7px;background:#f8fafc;border-bottom:1px solid #dbe3ef;font-size:10px;white-space:nowrap}
.ocr-compact-table td{padding:4px;border-bottom:1px solid #edf2f7;border-right:1px solid #f1f5f9;height:42px;background:#fff;vertical-align:middle}
.ocr-compact-table tr:hover td{background:#f8fafc}.ocr-compact-table tr.ocr-tr-review td:first-child{box-shadow:inset 3px 0 0 #f59e0b}.ocr-compact-table tr.ocr-tr-ok td:first-child{box-shadow:inset 3px 0 0 #22c55e}
.ocr-compact-table .col-n{width:42px}.ocr-compact-table .col-date{width:94px}.ocr-compact-table .col-name{width:230px}.ocr-compact-table .col-exp{width:85px}.ocr-compact-table .col-age{width:58px}.ocr-compact-table .col-sex{width:62px}.ocr-compact-table .col-address{width:145px}.ocr-compact-table .col-dx{width:170px}.ocr-compact-table .col-tx{width:190px}.ocr-compact-table .col-obs{width:155px}.ocr-compact-table .col-folio{width:110px}.ocr-compact-table .col-state{width:78px}.ocr-compact-table .col-actions{width:42px}
.ocr-table-input,.ocr-table-select{width:100%;height:32px;border:1px solid transparent;border-radius:7px;padding:5px 7px;background:transparent;color:#0f172a;font-size:12px;outline:none}.ocr-table-select{padding-right:3px}.ocr-table-input:hover,.ocr-table-select:hover{border-color:#cbd5e1;background:#fff}.ocr-table-input:focus,.ocr-table-select:focus{border-color:#14b8a6;background:#fff;box-shadow:0 0 0 2px rgba(20,184,166,.12)}
.ocr-cell-review{background:#fffaf0!important}.ocr-cell-review .ocr-table-input,.ocr-cell-review .ocr-table-select{border-color:#fbbf24;background:#fffdf5}.ocr-row-number{display:grid;place-items:center;width:25px;height:25px;border-radius:7px;background:#f1f5f9;color:#475569;font-size:11px;font-weight:900;margin:auto}
.ocr-folio-btn{width:100%;min-height:30px;border:1px dashed #94a3b8;border-radius:8px;background:#fff;color:#475569;font-size:11px;font-weight:800;cursor:pointer}.ocr-folio-btn:hover{border-color:#0f766e;color:#0f766e}.ocr-folio-btn.has-folio{border-style:solid;border-color:#99f6e4;background:#ecfdf5;color:#0f766e}
.ocr-state{display:inline-flex;align-items:center;justify-content:center;width:100%;padding:5px 6px;border-radius:999px;font-size:10px;font-weight:900}.ocr-state.review{background:#fef3c7;color:#92400e}.ocr-state.ok{background:#dcfce7;color:#166534}.ocr-delete{width:30px;height:30px;border:0;border-radius:8px;background:transparent;color:#94a3b8;font-size:18px;cursor:pointer}.ocr-delete:hover{background:#fee2e2;color:#b91c1c}
.ocr-table-foot{padding:12px 16px;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:10px;background:#fff;position:sticky;bottom:0}.ocr-table-foot .actions{justify-content:flex-end}
.folio-result{width:100%;border:1px solid #e2e8f0;border-radius:12px;background:#fff;padding:11px 12px;margin-bottom:8px;display:flex;align-items:center;justify-content:space-between;gap:15px;text-align:left;cursor:pointer}.folio-result:hover{border-color:#5eead4;background:#f0fdfa}.folio-result span{min-width:0}.folio-result strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.folio-result small{display:block;color:#64748b;margin-top:3px}.folio-result b{flex:0 0 auto;color:#0f766e}
@media(max-width:1050px){.content:has(.ocr-test-workspace){width:min(100% - 18px,1600px)}.ocr-test-workspace{grid-template-columns:1fr}.ocr-test-side{position:relative;top:auto}.ocr-test-side .test-preview{max-height:380px}.ocr-compact-wrap{max-height:62vh}.ocr-results-head{padding:14px 15px}.ocr-table-foot{flex-direction:column;align-items:stretch}.ocr-table-foot>.btn,.ocr-table-foot .actions .btn{flex:1}.ocr-table-foot .actions{display:grid;grid-template-columns:1fr 1fr}}
@media(max-width:650px){.ocr-test-head p{font-size:13px}.ocr-test-workspace{gap:12px}.ocr-test-side{padding:13px}.ocr-results-head{align-items:flex-start;flex-direction:column}.ocr-summary{justify-content:flex-start}.ocr-compact-wrap{max-height:58vh}.ocr-compact-table{min-width:1400px}.ocr-table-foot .actions{grid-template-columns:1fr}.ocr-table-foot{padding:10px}.ocr-engine-box{padding:10px}}

/* v2.3 · Google Gemini OCR */
.gemini-status{display:flex;align-items:center;gap:9px;padding:10px;border:1px solid #dbe3ef;background:#fff;border-radius:12px}.gemini-status .status-dot{width:9px;height:9px;border-radius:50%;background:#94a3b8;box-shadow:0 0 0 4px #f1f5f9}.gemini-status.configured .status-dot{background:#22c55e;box-shadow:0 0 0 4px #dcfce7}.gemini-status.error .status-dot{background:#f59e0b;box-shadow:0 0 0 4px #fef3c7}.gemini-status>div{min-width:0;flex:1;display:flex;flex-direction:column;gap:1px}.gemini-status strong{font-size:12px}.gemini-status small{font-size:10px;color:#64748b;line-height:1.3}.gemini-private-note{margin-top:16px;padding:11px 12px;border:1px solid #dbe3ef;background:#f8fafc;border-radius:12px;color:#475569;font-size:12px;line-height:1.45}.gemini-private-note code{font-size:11px}.ocr-engine-box .btn[disabled]{opacity:.55;cursor:not-allowed}.ocr-model-note{font-size:11px;color:#475569;padding:8px 10px;border-radius:10px;background:#eef6ff;border:1px solid #dbeafe}.ocr-model-note strong{color:#1d4ed8}


/* v2.3.1 - Gemini configuration always visible */
.gemini-setup-card{margin-top:14px;padding:14px;border:1px solid #cbd5e1;border-radius:16px;background:linear-gradient(180deg,#fff,#f8fafc);box-shadow:0 8px 24px rgba(15,23,42,.05)}
.gemini-setup-card .ocr-engine-title{margin-bottom:9px}
.gemini-setup-card .gemini-status{margin:0}
.gemini-setup-card .ocr-engine-hint{margin-top:10px;font-size:12px;line-height:1.45;color:#64748b}
@media(max-width:760px){.page-head.ocr-test-head .actions{width:100%}.page-head.ocr-test-head .actions .btn{flex:1}.gemini-setup-card .gemini-status{align-items:flex-start;gap:10px;flex-wrap:wrap}.gemini-setup-card .gemini-status .btn{width:100%;justify-content:center}}

/* v2.3.2 · configuración Gemini discreta y persistente en barra superior */
.topbar-api-btn{appearance:none;border:1px solid #334155;background:#172033;color:#e2e8f0;border-radius:10px;padding:8px 11px;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}.topbar-api-btn:hover{background:#1e293b;border-color:#475569}.topbar-api-btn.configured{border-color:#0f766e;color:#ccfbf1;background:#11332f}.gemini-global-status{display:flex;gap:10px;align-items:center;padding:12px 13px;border:1px solid #fde68a;background:#fffbeb;border-radius:13px}.gemini-global-status.configured{border-color:#a7f3d0;background:#ecfdf5}.gemini-global-status .status-dot{width:10px;height:10px;border-radius:50%;background:#f59e0b;box-shadow:0 0 0 4px #fef3c7;flex:0 0 auto}.gemini-global-status.configured .status-dot{background:#10b981;box-shadow:0 0 0 4px #d1fae5}.gemini-global-status>div{display:flex;flex-direction:column;gap:2px}.gemini-global-status strong{font-size:13px}.gemini-global-status small{color:#64748b;font-size:11px}.gemini-technical{white-space:pre-wrap;margin-top:12px;padding:10px 12px;border-radius:10px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font:11px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace}.gemini-config-panel{width:min(650px,100%)}
@media(max-width:680px){.topbar-api-btn{font-size:0;padding:9px}.topbar-api-btn:before{content:'⚙';font-size:16px}.user-chip{display:flex;gap:7px}.user-chip>span{display:none}.user-chip a{padding:8px 9px}}

/* ===== v2.4 captura rápida con Gemini + tabla compacta ===== */
.capture-review-panel{width:min(1760px,calc(100vw - 18px));max-height:96dvh}
.review-head-actions{display:flex;align-items:center;gap:9px}.capture-review-layout{display:grid;grid-template-columns:260px minmax(0,1fr);gap:14px;min-height:0}.capture-review-photo{min-width:0}.compact-preview{min-height:210px;max-height:48vh;position:sticky;top:0}.compact-preview img{max-height:48vh}.capture-review-table{min-width:0}.production-table-wrap{max-height:66vh;border:1px solid #dbe3ef;border-radius:14px;overflow:auto;background:#fff}.production-ocr-table{min-width:1660px}.production-ocr-table .col-folio-prod{width:210px}.production-ocr-table th{position:sticky}.production-ocr-table td{height:44px}.capture-save-hint{font-size:12px;margin-left:auto;margin-right:8px}.review-more{position:relative}.review-more>summary{list-style:none;cursor:pointer}.review-more>summary::-webkit-details-marker{display:none}.review-more-menu{position:absolute;left:0;top:calc(100% + 6px);z-index:30;display:grid;gap:6px;min-width:210px;padding:8px;background:#fff;border:1px solid #dbe3ef;border-radius:12px;box-shadow:0 16px 40px rgba(15,23,42,.14)}.review-more:not([open]) .review-more-menu{display:none}
.modal-panel.small{width:min(520px,calc(100vw - 24px))}

/* Configuración Gemini */
.gemini-settings-grid{display:grid;grid-template-columns:1.35fr .65fr;gap:14px;align-items:stretch}.gemini-auto-setting{display:flex;gap:12px;align-items:flex-start;padding:14px;border:1px solid #cbd5e1;border-radius:14px;background:#f8fafc;cursor:pointer}.gemini-auto-setting input{width:19px;height:19px;margin-top:2px;accent-color:#0f766e}.gemini-auto-setting span{display:grid;gap:4px}.gemini-auto-setting small{font-weight:500;color:#64748b;line-height:1.35}

/* Costos IA */
.cost-kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.cost-kpi{padding:18px}.cost-kpi-label{font-size:11px;font-weight:900;letter-spacing:.055em;text-transform:uppercase;color:#64748b}.cost-kpi-value{font-size:30px;line-height:1.05;font-weight:900;color:#0f172a;margin-top:8px}.cost-kpi-meta{font-size:12px;color:#475569;margin-top:8px}.cost-kpi-avg{font-size:12px;color:#0f766e;font-weight:800;margin-top:5px}.cost-kpi-accent{background:linear-gradient(135deg,#ecfeff,#f0fdfa);border-color:#99f6e4}.cost-layout{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(280px,.75fr);gap:16px;margin-top:18px}.simple-table-wrap{overflow:auto}.simple-table{width:100%;border-collapse:collapse;min-width:700px}.simple-table th{font-size:10px;text-transform:uppercase;letter-spacing:.04em;text-align:left;color:#64748b;padding:9px 10px;border-bottom:1px solid #dbe3ef;white-space:nowrap}.simple-table td{padding:11px 10px;border-bottom:1px solid #edf2f7;vertical-align:top;font-size:13px}.simple-table td small{display:block;color:#94a3b8;margin-top:2px}.cost-info-list{display:grid;gap:12px}.cost-info-list>div{display:grid;gap:3px;padding-bottom:11px;border-bottom:1px solid #edf2f7}.cost-info-list>div:last-child{border-bottom:0}.cost-info-list span{font-size:12px;color:#64748b;line-height:1.4}

@media(max-width:1100px){.capture-review-layout{grid-template-columns:1fr}.capture-review-photo{display:grid;grid-template-columns:minmax(220px,360px) 1fr;gap:12px}.compact-preview{position:relative;max-height:30vh;min-height:170px}.compact-preview img{max-height:30vh}.production-table-wrap{max-height:58vh}.cost-kpi-grid{grid-template-columns:1fr 1fr}.cost-layout{grid-template-columns:1fr}.gemini-settings-grid{grid-template-columns:1fr}}
@media(max-width:650px){.capture-review-panel{width:calc(100vw - 8px);max-height:98dvh}.capture-review-photo{display:block}.compact-preview{max-height:24vh;min-height:140px}.compact-preview img{max-height:24vh}.production-table-wrap{max-height:58vh}.production-ocr-table{min-width:1580px}.capture-save-hint{display:none}.cost-kpi-grid{grid-template-columns:1fr}.review-head-actions .badge{display:none}}

/* ===== v2.5 simulación de libros + captura móvil ===== */
.simulation-kicker{display:inline-flex;align-items:center;padding:6px 9px;border-radius:999px;background:#e0f2fe;color:#075985;font-size:10px;font-weight:950;letter-spacing:.06em;margin-bottom:8px}.simulation-banner{margin:-4px 0 18px;padding:12px 14px;border:1px solid #a7f3d0;border-radius:14px;background:#ecfdf5;color:#166534;font-size:13px}.simulation-book-row{display:flex;align-items:flex-end;justify-content:space-between;gap:16px}.simulation-book-select{min-width:min(520px,70vw);font-weight:800}.sim-stat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.sim-stat-grid>div{padding:12px;border:1px solid #e2e8f0;border-radius:13px;background:#f8fafc}.sim-stat-grid strong{display:block;font-size:24px;line-height:1;font-weight:950}.sim-stat-grid span{display:block;margin-top:6px;color:#64748b;font-size:10px;line-height:1.2}.sim-engine{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px;padding:11px 12px;border-radius:12px;background:#0f172a;color:#fff}.sim-engine span{font-size:11px;color:#cbd5e1}.sim-engine strong{font-size:12px;text-align:right}.production-table-wrap,.ocr-compact-wrap{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-x pan-y}.production-ocr-table th:first-child,.production-ocr-table td:first-child{position:sticky;left:0;z-index:5}.production-ocr-table th:first-child{z-index:8;background:#f8fafc}.production-ocr-table td:first-child{background:#fff}.ocr-tr-review td:first-child{background:#fffaf0}.ocr-tr-ok td:first-child{background:#fff}

@media(max-width:900px){.simulation-book-row{align-items:stretch;flex-direction:column}.simulation-book-row>div:last-child{text-align:left!important}.simulation-book-select{min-width:0;width:100%}.simulation-capture-hero{grid-template-columns:1fr}.simulation-stats{order:-1}.sim-stat-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:650px){
  .simulation-banner{font-size:12px}.sim-stat-grid{grid-template-columns:1fr 1fr 1fr}.sim-stat-grid strong{font-size:20px}.sim-stat-grid span{font-size:9px}
  .production-table-wrap{border-radius:10px;max-height:61dvh}.production-ocr-table{min-width:1580px}
  .ocr-table-input,.ocr-table-select{font-size:16px!important;min-height:38px}
  .review-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:8px}.review-toolbar .field{grid-column:1/-1}.review-toolbar>div[style*="flex:1"]{display:none}.review-toolbar .badge{justify-self:start}
  .capture-actions{grid-template-columns:1fr}.capture-actions .manual{grid-column:auto}
  .capture-actions .btn{min-height:54px;font-size:16px}
  .modal-foot{padding-bottom:max(10px,env(safe-area-inset-bottom))}
}
\n\n/* ===== v2.5.2 · navegación horizontal siempre visible + usuarios editables ===== */\n.table-panbar{display:grid;grid-template-columns:auto minmax(120px,1fr) auto;align-items:center;gap:8px;margin:0 0 7px;padding:6px 7px;border:1px solid #dbe3ef;border-radius:11px;background:#f8fafc;position:relative;z-index:14;box-shadow:0 4px 12px rgba(15,23,42,.04)}\n.table-pan-btn{appearance:none;border:1px solid #cbd5e1;background:#fff;color:#334155;border-radius:9px;min-height:34px;padding:6px 10px;font-size:11px;font-weight:850;cursor:pointer;white-space:nowrap}.table-pan-btn:hover{border-color:#94a3b8;background:#f1f5f9}.table-pan-btn:active{transform:translateY(1px)}\n.table-pan-scroll{height:18px;overflow-x:scroll;overflow-y:hidden;border-radius:999px;scrollbar-color:#64748b #e2e8f0;scrollbar-width:auto}.table-pan-scroll-inner{height:1px;min-width:100%}.table-pan-scroll::-webkit-scrollbar{height:12px}.table-pan-scroll::-webkit-scrollbar-track{background:#e2e8f0;border-radius:999px}.table-pan-scroll::-webkit-scrollbar-thumb{background:#64748b;border-radius:999px;border:2px solid #e2e8f0}.table-panbar.no-overflow .table-pan-scroll{opacity:.35}.table-panbar.no-overflow .table-pan-btn{opacity:.45;pointer-events:none}\n.capture-review-table{min-width:0;position:relative}.production-table-wrap{scrollbar-color:#64748b #e2e8f0;scrollbar-width:auto}.production-table-wrap::-webkit-scrollbar{height:13px;width:13px}.production-table-wrap::-webkit-scrollbar-track{background:#e2e8f0}.production-table-wrap::-webkit-scrollbar-thumb{background:#64748b;border-radius:999px;border:2px solid #e2e8f0}\n.user-actions{display:flex;gap:7px;flex-wrap:wrap}.user-access-note{font-size:12px;line-height:1.45;color:#64748b;margin:0}.password-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end}.password-row .btn{min-width:96px}.users-access-table td:last-child{min-width:190px}.user-self-badge{margin-left:6px}\n@media(max-width:650px){.table-panbar{grid-template-columns:40px minmax(80px,1fr) 40px;gap:5px;padding:5px}.table-pan-btn{padding:6px;min-width:40px}.table-pan-btn span{display:none}.table-pan-scroll{height:20px}.users-access-table{min-width:780px}.password-row{grid-template-columns:1fr}.password-row .btn{width:100%}}\n
/* v2.6.0 · revisión de identidad con IA */
.identity-ai-box{margin-top:6px;padding:7px 8px;border-radius:10px;display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;line-height:1.25;min-width:230px}
.identity-ai-box>div{min-width:0}.identity-ai-box strong{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.identity-ai-box small{display:block;margin-top:2px;color:inherit;opacity:.82;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.identity-ai-box.same{background:#ecfdf5;border:1px solid #a7f3d0;color:#065f46}.identity-ai-box.new{background:#eff6ff;border:1px solid #bfdbfe;color:#1e40af}.identity-ai-box.uncertain{background:#fff7ed;border:1px solid #fed7aa;color:#9a3412}.identity-ai-confirm{border:0;border-radius:8px;padding:6px 9px;background:#0f766e;color:#fff;font-weight:800;cursor:pointer;white-space:nowrap}.identity-ai-confirm:hover{filter:brightness(.96)}
#identityAiBadge{white-space:nowrap}
@media(max-width:900px){.identity-ai-box{min-width:205px}.identity-ai-box strong,.identity-ai-box small{white-space:normal}}

.cost-book-name small{display:block;color:var(--muted,#64748b);font-size:11px;margin-top:2px}.cost-source-pill{display:inline-flex;padding:3px 7px;border-radius:999px;background:#f1f5f9;font-size:11px;font-weight:800}.cost-source-pill.identity{background:#ede9fe;color:#5b21b6}.cost-source-pill.ocr{background:#e0f2fe;color:#075985}
.identity-ai-actions{display:flex;gap:5px;align-items:center}.identity-ai-new{border:1px solid currentColor;border-radius:8px;padding:5px 7px;background:transparent;color:inherit;font-weight:800;cursor:pointer;white-space:nowrap}
