#documents-view { min-width:0; padding:24px; }
#documents-view h2 { font:600 24px/1.3 Inter,Arial,sans-serif; margin:0 0 12px; }
.documents-heading { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:20px; margin-bottom:28px; }
.documents-heading .eyebrow { margin-bottom:10px; }
.document-buttons { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.document-buttons button,.document-card button,.document-filters button { min-height:44px; font-size:13px; }
.document-filters { display:grid; grid-template-columns:minmax(0,1fr) 150px auto; gap:16px; align-items:end; margin-bottom:24px; }
#documents-view label { display:flex; flex-direction:column; gap:8px; font-size:13px; color:#c8d1e2; }
#documents-view input,#documents-view select,#documents-view textarea { width:100%; min-width:0; color:#eef2fc; background:#0b1019; border:1px solid #34435b; border-radius:9px; padding:12px; min-height:44px; font:14px/1.5 Inter,Arial,sans-serif; }
#documents-view textarea { resize:vertical; }
#documents-view :is(input,select,textarea,button):focus-visible { outline:2px solid #7ca9ff; outline-offset:3px; }
.documents-list { display:grid; gap:16px; }
.document-results { margin:0; color:#aebfd6; font-size:12px; line-height:1.6; }
.documents-empty button { margin-top:20px; min-height:44px; }
#documents-view button[aria-busy=true]::before { content:''; display:inline-block; flex:none; width:13px; height:13px; margin-right:7px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; vertical-align:middle; animation:document-working .8s linear infinite; }
@keyframes document-working { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { #documents-view button[aria-busy=true]::before { animation:none; } }
.document-card { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px; padding:22px; border:1px solid #2a3447; border-radius:14px; background:#101722; }
.document-kind { color:#9dbfff; font-size:12px; }
.document-card h3 { font-size:17px; margin:8px 0; overflow-wrap:anywhere; }
.document-card p { font-size:13px; color:#b9c4d9; line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }
.document-card small { display:block; margin-top:16px; color:#9faec7; }
.document-card-actions { display:flex; flex-direction:column; gap:10px; align-items:stretch; }
.document-card-actions strong { font-size:20px; text-align:right; margin-bottom:4px; }
.documents-empty { padding:40px 22px; border:1px dashed #354560; border-radius:14px; text-align:center; }
.documents-empty h3 { margin-bottom:12px; font-size:18px; }
.documents-empty p,.document-issue-help { font-size:14px; line-height:1.8; color:#b4c0d5; }
.document-back { display:block; margin-bottom:24px; background:none; border:0; padding:8px 0; }
#document-form { display:grid; gap:24px; margin-top:26px; }
#document-form fieldset { border:1px solid #2c374c; border-radius:14px; padding:22px; min-width:0; display:grid; gap:18px; }
#document-form legend { padding:0 10px; font-weight:600; font-size:15px; }
.document-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.document-wide { grid-column:1/-1; }
.document-totals { display:flex; flex-wrap:wrap; gap:14px; margin-top:10px; padding:16px; border-radius:10px; background:#1a2b4a; color:#d9e7ff; font-size:14px; line-height:1.7; }
.document-optional { border:1px solid #2c374c; border-radius:12px; padding:20px; }
.document-optional summary { cursor:pointer; font-size:14px; }
.document-optional[open] summary { margin-bottom:22px; }
.document-optional button { margin-top:20px; }
.document-form-actions { padding:8px 0 16px; }
.document-total-large { font-size:26px; color:#93baff; }
.document-review { padding:26px; margin:24px 0; }
.document-review h3 { font-size:14px; color:#9fbfff; margin-bottom:10px; }
.document-review p { white-space:pre-wrap; overflow-wrap:anywhere; font-size:14px; line-height:1.8; margin-bottom:24px; }
.document-issue-help { margin:20px 0; }
@media(max-width:1100px) { .document-filters { grid-template-columns:1fr 150px; }.document-filters button { grid-column:1/-1; justify-self:start; } }
@media(max-width:600px) { #documents-view{padding:18px 12px}.document-grid,.document-card,.document-filters{grid-template-columns:1fr}.document-card-actions strong{text-align:left}.document-card{padding:18px}.document-review,#document-form fieldset{padding:18px}.document-buttons{align-items:stretch}.document-buttons button{flex:1 1 180px} }

/* Editor como la plantilla local: controles claros y hoja A4 a tamaño legible. */
#document-editor-dialog { position:fixed; inset:0; width:100vw; max-width:none; height:100dvh; max-height:none; margin:0; padding:0; border:0; border-radius:0; background:#1d1f24; color:#222; overflow:hidden; box-shadow:none; font-family:Arial,Helvetica,sans-serif; }
#document-editor-dialog[open] { display:flex; flex-direction:column; }
#document-editor-dialog::backdrop { background:#03050be6; }
.document-editor-header { position:absolute; top:0; left:0; width:360px; height:92px; display:flex; justify-content:space-between; align-items:flex-start; gap:8px; padding:20px; background:#fff; color:#111; z-index:1; }
#documents-view .document-editor-header h2 { font:700 17px/1.2 Arial,Helvetica,sans-serif; margin:0 0 4px; color:#111; }
.document-editor-header p { font:400 12px/1.4 Arial,Helvetica,sans-serif; color:#666; }
.editor-close { display:grid; place-items:center; flex:none; width:30px; height:30px; min-height:30px; padding:4px; margin:-5px -7px 0 0; border:1px solid #ddd; border-radius:7px; color:#333; background:#fff; }
.document-editor-body { display:grid; grid-template-columns:360px minmax(0,1fr); flex:1; min-height:0; }
.document-editor-controls { background:#fff; border-right:1px solid #ddd; min-width:0; min-height:0; padding-top:92px; overflow:auto; display:flex; flex-direction:column; }
#documents-view #document-form { display:flex; flex-direction:column; margin:0; gap:0; height:100%; min-height:0; }
.document-editor-fields { flex:1; min-height:0; overflow:auto; padding:0 20px 12px; }
#documents-view .document-editor-controls label { display:flex; flex-direction:column; gap:4px; margin-bottom:13px; font:700 11px/1.4 Arial,Helvetica,sans-serif; letter-spacing:.5px; text-transform:uppercase; color:#555; }
#documents-view .document-editor-controls :is(input,select,textarea) { color:#111; background:#fff; border:1px solid #ccc; border-radius:7px; padding:8px 9px; min-height:38px; font:400 13px/1.4 Arial,Helvetica,sans-serif; letter-spacing:normal; text-transform:none; }
#documents-view .document-editor-controls textarea { min-height:70px; }
#documents-view .document-editor-controls input::placeholder,#documents-view .document-editor-controls textarea::placeholder { color:#848c9c; }
#documents-view .document-editor-controls :is(input,select,textarea):focus-visible { outline:2px solid #111; outline-offset:2px; }
.editor-row { display:grid; grid-template-columns:minmax(0,1fr) 88px; gap:12px; }
.editor-details { border:1px solid #eee; border-radius:8px; padding:0 10px; background:#fafafa; margin:6px 0 14px; }
.editor-details summary { display:list-item; cursor:pointer; padding:9px 0; font-size:12px; font-weight:700; color:#444; }
.editor-details[open] summary { margin-bottom:10px; }
#documents-view .document-editor-controls .document-totals { display:block; margin:0 0 15px; padding:12px; background:#f4f4f4; color:#555; font-size:11px; line-height:1.8; }
.document-editor-actions { flex:none; display:grid; gap:8px; padding:16px 20px; background:#fff; border-top:1px solid #eee; }
.document-editor-actions button { width:100%; min-height:43px; font:700 13px/1.3 Arial,Helvetica,sans-serif; letter-spacing:.3px; justify-content:center; border-radius:9px; box-shadow:none; }
#document-editor-dialog .document-editor-actions .primary-button { background:#000; border:1.5px solid #000; color:#fff; }
#document-editor-dialog .document-editor-actions .secondary-button,#document-editor-dialog .editor-details .secondary-button { color:#000; background:#fff; border:1.5px solid #000; }
.editor-details .secondary-button { margin-bottom:14px; font-size:11px; }
.document-editor-actions p { color:#6a7484; font-size:10px; line-height:1.5; margin:3px 0 0; }
.document-editor-preview { display:flex; flex-direction:column; min-height:0; min-width:0; background:#1d1f24; }
.document-preview-heading { flex:none; display:flex; align-items:center; justify-content:space-between; gap:16px; height:26px; padding:5px 26px; font-size:9px; color:#a7a7a7; letter-spacing:.04em; }
.document-preview-pages { min-height:0; overflow:auto; padding:0 26px 26px; }
.document-preview-page { max-width:794px; width:100%; margin:0 auto 24px; }
.document-preview-page canvas { width:100%; height:auto; display:block; box-shadow:0 8px 35px #0007; background:#fff; }
.document-preview-page figcaption { padding:12px 0; text-align:center; color:#b6c0d2; font-size:11px; }
.document-review-controls { flex:1; overflow:auto; padding:24px 22px; }
.editor-state { font-size:10px; color:#3160b8; letter-spacing:.1em; font-weight:600; }
.document-review-controls h3 { font-size:20px; line-height:1.4; margin:15px 0 12px; overflow-wrap:anywhere; }
.document-review-controls p { color:#5c687b; font-size:13px; line-height:1.8; white-space:pre-wrap; overflow-wrap:anywhere; }
.editor-review-total { display:block; margin:24px 0; font-size:30px; color:#1b2434; }
.document-review-controls dl { display:grid; gap:5px; margin-bottom:24px; font-size:13px; }
.document-review-controls dt { color:#6a7484; font-size:11px; margin-top:12px; }
.document-editor-controls .documents-feedback { background:#edf6ee; color:#23562c; border:1px solid #c9e3cc; border-radius:8px; padding:12px; font-size:12px; line-height:1.6; margin:0 0 18px; }
.document-editor-controls .documents-feedback.error { color:#9e2727; border-color:#ecc1c1; background:#fff0f0; }
.document-editor-controls .documents-feedback.working { color:#244b80; border-color:#c4d7f0; background:#edf3fc; }
.document-discard { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:min(420px,calc(100% - 32px)); background:#fff; padding:24px; border:1px solid #9aa8bc; border-radius:14px; box-shadow:0 0 0 100vmax #0008; z-index:5; }
.document-discard p { font-size:15px; line-height:1.7; color:#263047; margin-bottom:20px; }
.document-discard button { display:block; margin-top:12px; width:100%; background:#eff3fa; color:#182b4e; border-color:#bbc7db; }
.document-editor-tabs { display:none; }
@media(max-width:760px){
 .document-editor-header{position:static;width:auto;height:auto;flex:none;padding:16px}.document-editor-header p{max-width:260px;font-size:11px}
 .document-editor-controls{padding-top:0}
 #documents-view .document-editor-header h2{font-size:16px}
 .document-editor-tabs{display:flex;flex:none;background:#fff;border-bottom:1px solid #d5dce8;padding:8px 16px;gap:8px}
 .document-editor-tabs button{flex:1;padding:10px;border:1px solid #c4cddc;border-radius:8px;color:#2b3a53;background:#fff;font-size:13px}
 .document-editor-tabs button[aria-pressed=true]{background:#000;border-color:#000;color:#fff}
 .document-editor-body{display:flex;flex-direction:column}.document-editor-controls,.document-editor-preview{flex:1}
 .document-editor-body[data-mode=fields] .document-editor-preview,.document-editor-body[data-mode=preview] .document-editor-controls{display:none}
 .document-preview-pages{padding:6px 12px 20px}.document-preview-heading{padding:14px}
 .document-editor-fields{padding:18px 18px 8px}.document-editor-actions{padding:12px 18px}
 #documents-view .document-editor-controls :is(input,select,textarea){font-size:16px}
}
