:root{--bg:#f7f8fa;--ink:#20252d;--muted:#69717d;--line:#dfe3e8;--shadow:none;--sidebar-width:232px}
body{font-size:14px;letter-spacing:0}
.nav-icon{display:inline-block;flex:none;width:19px;height:19px;background:currentColor;mask:var(--nav-icon) center/contain no-repeat;-webkit-mask:var(--nav-icon) center/contain no-repeat}
.icon-company{--nav-icon:url('/icons/building-2.svg')}.icon-clients{--nav-icon:url('/icons/users.svg')}.icon-receipt{--nav-icon:url('/icons/receipt.svg')}.icon-files{--nav-icon:url('/icons/files.svg')}.icon-contract{--nav-icon:url('/icons/file-text.svg')}.icon-attachment{--nav-icon:url('/icons/paperclip.svg')}.icon-assistant{--nav-icon:url('/icons/bot.svg')}.icon-search{--nav-icon:url('/icons/search.svg')}.icon-globe{--nav-icon:url('/icons/globe.svg')}.icon-package{--nav-icon:url('/icons/package-check.svg')}.icon-chart{--nav-icon:url('/icons/chart-column.svg')}.icon-shield{--nav-icon:url('/icons/shield-check.svg')}.icon-settings{--nav-icon:url('/icons/settings-2.svg')}.icon-menu{--nav-icon:url('/icons/menu.svg')}.icon-close{--nav-icon:url('/icons/x.svg')}.icon-plus{--nav-icon:url('/icons/plus.svg')}.icon-chevron{--nav-icon:url('/icons/chevron-down.svg')}.icon-info{--nav-icon:url('/icons/info.svg')}
.icon-send{--nav-icon:url('/icons/chevron-down.svg');transform:rotate(180deg)}
button{letter-spacing:0}
.app-shell{max-width:1500px;padding:16px 24px 40px}
.topbar,body:has(.module[data-panel="asistente"].is-active) .topbar{position:sticky;top:0;z-index:35;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:20px;background:var(--bg);margin:0 0 10px;padding:8px 0 12px;border-bottom:1px solid var(--line)}
.workspace-brandline{display:flex;align-items:center;gap:10px;min-width:0}
.workspace-header-start{display:flex;align-items:center;gap:10px;min-width:0}
.app-back-button{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:none;min-width:42px;min-height:42px;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:#fff;color:var(--ink);font-size:13px;font-weight:650}
.app-back-button .nav-icon{width:18px;height:18px;transform:rotate(90deg)}
.app-back-button:disabled{color:#969da6;cursor:default;opacity:.65}
.brand,body:has(.module[data-panel="asistente"].is-active) .brand{gap:9px;min-width:0}
.brand-logo{display:block;flex:none;width:32px;height:32px;border-radius:7px}
.brand strong,body:has(.module[data-panel="asistente"].is-active) .brand strong{font-size:18px;line-height:1.2;letter-spacing:0}
.active-company-pill,body:has(.module[data-panel="asistente"].is-active) .active-company-pill{border-radius:6px;min-height:40px;max-width:440px;padding:9px 12px;white-space:normal;overflow-wrap:anywhere;font-size:12px;font-weight:650;text-align:left;align-self:auto;line-height:1.4}
.active-company-pill:hover{border-color:#a8afb9;background:#fff}
.main-menu-trigger{position:static;inset:auto;z-index:auto;width:42px;height:42px;min-height:42px;padding:0;border:1px solid var(--line);border-radius:6px;background:#fff;color:var(--ink);box-shadow:none;display:grid;place-items:center;flex:none}
.main-menu-trigger .nav-icon{width:21px;height:21px}
.sidebar-brand{display:flex;align-items:center;gap:10px;min-width:0;font-size:16px}
.sidebar-brand img{width:32px;height:32px;border-radius:6px;flex:none}
.main-menu{width:min(310px,calc(100vw - 32px));box-shadow:8px 0 30px rgba(20,25,30,.14)}
.main-menu-header{min-height:76px;padding:14px 16px;border-color:var(--line)}
.main-menu-close{display:grid;place-items:center;width:40px;height:40px;min-height:40px;border:1px solid var(--line);border-radius:6px;background:#fff}
.main-menu-list{display:flex;flex-direction:column;gap:3px;padding:6px 12px 12px}
.nav-group-label{margin:16px 10px 5px;color:#79818d;font-size:10px;line-height:1.4;font-weight:750;text-transform:uppercase;letter-spacing:0}
.main-menu-list button,.main-menu-tools button{display:flex;align-items:center;gap:10px;min-height:42px;padding:10px 11px;border:1px solid transparent;border-radius:6px;background:transparent;color:#4a535f;font-size:13px;font-weight:600;line-height:1.35}
.main-menu-list button:hover,.main-menu-tools button:hover{background:#f1f3f6}
.main-menu-list .external-module-link{display:flex;align-items:center;gap:10px;min-height:44px;padding:10px 11px;border:1px solid transparent;border-radius:6px;background:transparent;color:#4a535f;font-size:13px;font-weight:600;line-height:1.35;text-decoration:none}
.main-menu-list .external-module-link:hover{background:#f1f3f6}
.main-menu-list .external-module-link:focus-visible{outline:3px solid #168251;outline-offset:2px}
.main-menu-list button.is-active{color:#a91e26;border-color:#f0d8da;background:#fbebed;font-weight:750}
.main-menu-list button.is-active .nav-icon{color:#ae2029}
.main-menu-tools{padding:10px 12px;border-color:var(--line)}
.legal-banner,body:has(.module[data-panel="asistente"].is-active) .legal-banner{padding:0;margin:0 0 22px;border:0;border-radius:0;background:none;color:#66717c;font-size:12px;line-height:1.5}
.legal-banner summary{display:flex;align-items:center;gap:7px;cursor:pointer;list-style:none;min-height:40px;width:fit-content;max-width:100%;flex-wrap:wrap;overflow-wrap:anywhere}
.legal-banner summary::-webkit-details-marker{display:none}
.legal-banner summary strong{color:#267052;font-size:11px;font-weight:750;background:#eaf4ee;padding:2px 7px;border-radius:4px}
.legal-banner summary>.icon-info{width:15px;height:15px;color:#718077}
.legal-banner summary>.icon-chevron{width:14px;height:14px}
.legal-banner[open] summary>.icon-chevron{transform:rotate(180deg)}
.legal-banner p{margin:6px 0 0;max-width:780px;padding:10px 12px;border-left:2px solid #b7c6bc;background:#f0f3f1;color:#526158}
.tabs,body:has(.module[data-panel="asistente"].is-active) .tabs{display:none!important}
.module-heading{align-items:center;margin-bottom:18px;gap:14px}
.module-heading h1{font-size:25px;line-height:1.2;font-weight:750;letter-spacing:0;margin-bottom:5px}
.module-heading p:not(.eyebrow){font-size:13px;line-height:1.5}
.eyebrow{letter-spacing:0;font-size:10px;color:#707984;font-weight:750}
.primary,.secondary,.ghost{border-radius:6px;min-height:40px;font-size:13px;font-weight:650}
#new_company_btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:none}
#new_company_btn .nav-icon{width:17px;height:17px}
.company-limit{margin:0 0 10px;color:var(--muted);font-size:12px}
.company-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,270px),1fr));gap:14px;margin:0 0 20px}
.company-card{border:1px solid var(--line);border-radius:8px;padding:17px;min-height:206px;gap:12px;box-shadow:none}
.company-card.selected{border-color:#cc8c91;box-shadow:inset 3px 0 0 #bc2026}
.company-card .company-head{gap:11px;align-items:center}
.company-card h3{font-size:15px;line-height:1.35;overflow-wrap:anywhere}
.company-card p{line-height:1.5;overflow-wrap:anywhere}
.company-card>p:last-of-type{font-size:11px;color:#66717c}
.company-card.selected>p:last-of-type{color:#267052;font-weight:650}
.company-logo{border-radius:6px;width:38px;height:38px}
.company-card .card-actions{padding-top:12px;border-top:1px solid #eceef1;gap:8px}
.company-card .card-actions button{min-height:40px;border-radius:5px;font-size:12px;font-weight:650}
.company-card .card-actions .secondary{background:#f5f6f8;color:#34404f;border:1px solid var(--line)}
.company-card.selected .card-actions .secondary{background:#fcf2f3;border-color:#ead0d3;color:#a31b23}
.card,.editor-card,.client-card{border-radius:8px;box-shadow:none}
.invoice-workspace,.invoice-workspace>*{min-width:0;max-width:100%}
.invoice-paper,.paper-table-wrap{min-width:0;max-width:100%}
.notice,.result-box,.invoice-item,.audit-item,.document-item{border-radius:6px;box-shadow:none}
.editor-header h2,.card h2{font-size:17px;letter-spacing:0}
.lookup-layout{align-items:start}
.module[data-panel="cif"] .lookup-layout>.card,#client_editor{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
.lookup-details{margin-top:8px;min-width:0;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.lookup-details summary,.company-web-evidence summary{min-height:40px;padding:9px 0;cursor:pointer;font-size:13px;font-weight:650;line-height:1.5;overflow-wrap:anywhere}
.lookup-details p{margin:8px 0}
.lookup-criteria{margin:8px 0 0;line-height:1.5}
.lookup-criteria dt{margin-top:10px;font-weight:650}
.lookup-criteria dd{margin:3px 0 0;color:var(--muted)}
.source-card .source-link{min-width:0;padding:9px 0;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;flex-wrap:wrap;overflow-wrap:anywhere}
.source-card .source-link a{min-height:40px;display:inline-flex;align-items:center;min-width:0;overflow-wrap:anywhere}
#lookup_cif_web_btn,#lookup_client_web_btn,#lookup_client_cif_btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:0;min-height:40px;white-space:normal;overflow-wrap:anywhere}
#lookup_cif_web_btn .nav-icon,#lookup_client_web_btn .nav-icon,#lookup_client_cif_btn .nav-icon{width:17px;height:17px}
#client_web_result{min-width:0;overflow-wrap:anywhere}
.result-box.company-web-review{padding:0;border:0;border-radius:0;background:transparent;color:var(--ink);box-shadow:none}
.company-web-review{display:grid;gap:12px;min-width:0;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.company-web-candidate{min-width:0;margin:0;padding:12px 0;border:0;border-top:1px solid var(--line);border-radius:0;background:transparent;box-shadow:none;overflow-wrap:anywhere}
.company-web-candidate :is(h2,h3,h4){margin:0 0 6px;font-size:15px;line-height:1.4}
.company-web-candidate p{margin:6px 0}
.company-web-fields{display:grid;grid-template-columns:minmax(90px,116px) minmax(0,1fr);gap:5px 12px;min-width:0;margin:10px 0;font-size:13px}
.company-web-fields>div{display:contents}
.company-web-fields dt{min-width:0;color:var(--muted);font-weight:600}
.company-web-fields dd{min-width:0;margin:0;color:var(--ink);overflow-wrap:anywhere}
.company-web-source{min-width:0;margin:8px 0 0;padding:0;border:0;border-radius:0;background:transparent;font-size:12px;color:var(--muted);overflow-wrap:anywhere}
.company-web-review a{color:#225eae;text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}
.company-web-actions,.company-web-options{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;margin-top:10px}
.company-web-review button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:0;max-width:100%;min-height:40px;padding:9px 12px;border-radius:6px;font:inherit;font-weight:650;white-space:normal;overflow-wrap:anywhere}
.company-web-review button:disabled{cursor:not-allowed;opacity:.6}
.company-web-options label{display:inline-flex;align-items:center;gap:8px;min-height:40px;min-width:0;max-width:100%;font-weight:500;overflow-wrap:anywhere}
.company-web-options input:is([type="checkbox"],[type="radio"]){flex:none;inline-size:18px;block-size:18px;min-height:18px;margin:0;accent-color:var(--brand)}
.company-web-options select{max-width:100%;min-width:0;min-height:40px;border:1px solid var(--line);border-radius:6px;padding:8px;background:#fff;color:var(--ink)}
.company-web-status{min-width:0;margin:6px 0;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.company-web-status:empty{display:none}
.company-web-status[role="alert"]{color:var(--danger);font-weight:650}
.company-web-evidence{min-width:0;margin-top:8px;padding:0;border:0;border-top:1px solid var(--line);border-radius:0;background:transparent;overflow-wrap:anywhere}
.company-web-evidence :is(ul,ol){margin:6px 0;padding-left:18px}
.company-web-summary{min-width:0;margin:0;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.company-web-summary p{margin:0 0 6px}
:is(button,a,input,textarea,select,summary):focus-visible{outline:3px solid #2c6bd1;outline-offset:3px}
@media(min-width:1100px){
 .app-shell{max-width:none;margin-left:var(--sidebar-width);padding:16px 32px 48px}
 .main-menu{width:var(--sidebar-width);visibility:visible;pointer-events:auto;transform:none;border-right:1px solid var(--line);box-shadow:none;z-index:40}
 .main-menu-header{min-height:78px}
 .main-menu-close,.main-menu-trigger,.workspace-brandline{display:none}
 .main-menu-list{padding-top:0}
 .main-menu-tools{padding-bottom:18px}
 .topbar{justify-content:space-between!important;min-height:60px}
 main{max-width:1320px;margin:0 auto}
 .legal-banner{max-width:1320px;margin-left:auto;margin-right:auto}
}
@media(max-width:1099px){
 .app-shell{padding:10px 16px 32px}
 .topbar,body:has(.module[data-panel="asistente"].is-active) .topbar{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding-top:4px;margin-bottom:6px}
 .active-company-pill,body:has(.module[data-panel="asistente"].is-active) .active-company-pill{width:100%;max-width:100%;min-height:40px;font-size:12px;padding:8px 10px}
 .legal-banner,body:has(.module[data-panel="asistente"].is-active) .legal-banner{margin-bottom:18px;font-size:11px}
 .module-heading{flex-direction:row;align-items:center;gap:10px;margin-bottom:16px}
 .module-heading h1{font-size:24px}
 input,select,textarea,.as-form textarea,.form-grid input,.form-grid select,.form-grid textarea{font-size:16px!important}
 .main-menu-list button,.main-menu-tools button{min-height:44px}
}
@media(max-width:900px){.invoice-workspace{grid-template-columns:minmax(0,1fr)}.paper-header>*{min-width:0;overflow-wrap:anywhere}}
@media(max-width:420px){
 .app-back-button{width:42px;padding:8px}.app-back-button>span:last-child{display:none}
 .app-shell{padding-left:12px;padding-right:12px}
 .module-heading:has(.toolbar),.module-heading:has(h1:not(:only-child)):not(:has(#new_company_btn)){align-items:flex-start;flex-wrap:wrap}
 #new_company_btn{font-size:12px;padding:10px 11px;min-height:40px}
 .module-heading h1{font-size:23px}
 .module-heading>div{min-width:0}
 .company-card{min-height:198px}
 #client_editor .editor-actions>*{flex:1 1 100%;max-width:100%}
 .company-web-candidate{padding:10px 0}
 .company-web-fields{grid-template-columns:minmax(0,1fr);gap:3px}
 .company-web-fields dt:not(:first-child){margin-top:5px}
 .company-web-actions>*{flex:1 1 100%;max-width:100%}
 .company-web-options{align-items:stretch}
 .company-web-options label,.company-web-options select{width:100%}
}
/* Solo el asistente ocupa el viewport; el resto conserva el scroll del documento. */
body:has(.module[data-panel="asistente"].is-active){height:min(100dvh,var(--as-viewport-height,100dvh));min-height:0;overflow:hidden;overscroll-behavior:none;background:#fff}
body:has(.module[data-panel="asistente"].is-active) .app-shell{display:flex;flex-direction:column;height:100%;min-height:0;min-width:0;max-width:none;padding:0;overflow:hidden}
body:has(.module[data-panel="asistente"].is-active) .app-shell>main{display:flex;flex-direction:column;flex:1;width:100%;height:auto;min-width:0;min-height:0;max-width:none;margin:0;overflow:hidden}
body:has(.module[data-panel="asistente"].is-active) .topbar{position:relative;top:auto;display:flex;flex:none;flex-direction:row;align-items:center;gap:8px;min-height:56px;margin:0;padding:max(6px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 6px max(16px,env(safe-area-inset-left));background:#f7f8fa}
body:has(.module[data-panel="asistente"].is-active) .workspace-header-start{flex:none;gap:8px}
body:has(.module[data-panel="asistente"].is-active) .active-company-pill{flex:0 1 auto;width:auto;min-width:0;max-width:52%;min-height:36px;padding:7px 9px;font-size:12px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body:has(.module[data-panel="asistente"].is-active) .legal-banner{display:none}
@media(max-width:620px){
 body:has(.module[data-panel="asistente"].is-active) .topbar{padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))}
 body:has(.module[data-panel="asistente"].is-active) .workspace-brandline{gap:8px}
 body:has(.module[data-panel="asistente"].is-active) .brand strong{display:none}
 body:has(.module[data-panel="asistente"].is-active) .brand-logo{width:28px;height:28px}
 body:has(.module[data-panel="asistente"].is-active) .active-company-pill{max-width:calc(100% - 140px);font-size:11px}
}
@media(max-width:360px){
 body:has(.module[data-panel="asistente"].is-active) .topbar{gap:6px;padding-inline:8px}
 body:has(.module[data-panel="asistente"].is-active) .workspace-header-start,body:has(.module[data-panel="asistente"].is-active) .workspace-brandline{gap:6px}
 body:has(.module[data-panel="asistente"].is-active) .active-company-pill{flex:1;max-width:none;padding-inline:7px}
}
.document-entry{min-width:0}
.docmaster-link{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;text-decoration:none;font-size:13px;line-height:20px;border-radius:6px}
.docmaster-link:focus-visible{outline:3px solid #168251;outline-offset:3px}
.document-dropzone{width:100%;min-height:158px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:7px;margin:16px 0 12px;padding:18px 12px;border:2px dashed #a2acb9;border-radius:8px;background:#fafcfa;color:#263e32;text-align:center;line-height:1.4;overflow-wrap:anywhere;transition:background .15s,border-color .15s}
.document-dropzone .nav-icon{width:26px;height:26px;color:#357454}
.document-dropzone strong{font-size:16px}.document-dropzone>span:not(.nav-icon){font-size:14px;font-weight:500}.document-dropzone small{color:#667085;font-size:12px}
.document-dropzone:hover,.document-dropzone.is-dragging{background:#e8f4ec;border-color:#357454}
.document-dropzone:focus-visible,.document-entry button:focus-visible{outline:3px solid #168251;outline-offset:3px}
.document-entry .upload-actions{grid-template-columns:repeat(3,minmax(0,1fr))}
.document-entry .upload-button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;border-radius:6px;white-space:normal;overflow-wrap:anywhere}
.document-entry .upload-button .nav-icon{width:16px;height:16px}
.document-review-actions{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.document-review-actions button{min-height:44px}
.document-text-review{margin-top:14px}.document-text-review summary{font-size:13px;cursor:pointer;padding:8px 0}
.document-text-review textarea{display:block;width:100%;margin-top:8px;padding:10px;border:1px solid #cfd7e4;border-radius:6px;resize:vertical;font:inherit;font-size:13px}
.document-entry button:disabled{opacity:.55;cursor:default}
#document_file_status{overflow-wrap:anywhere}
.document-item{overflow-wrap:anywhere}.document-item .document-saved-excel{float:none;background:#eef2f7;color:#344054;margin-top:8px;padding:8px 12px}
@media(max-width:620px){.document-entry .upload-actions{grid-template-columns:repeat(2,minmax(0,1fr))}.document-totals-form input{font-size:16px}.document-dropzone{min-height:148px}}
@media print{.main-menu,.main-menu-trigger,.main-menu-backdrop,.topbar,.legal-banner{display:none!important}.app-shell{margin:0!important;max-width:none!important;padding:0!important}}
