:root{font-family:Inter,Segoe UI,Arial,sans-serif;color:#1e293b;background:#eef2f6}*{box-sizing:border-box}body{margin:0}.hidden{display:none!important}button,input,select,textarea{font:inherit}.login-wrap{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#14213d,#264b73)}.login-card{width:min(410px,92vw);background:white;padding:34px;border-radius:18px;box-shadow:0 24px 70px #0005}.brand{font-weight:900;letter-spacing:.16em;color:#184b78}.login-card h1{margin:5px 0 4px}.login-card p{margin:0 0 24px;color:#64748b}label{display:grid;gap:6px;font-size:13px;font-weight:600;margin-bottom:14px}input,select,textarea{border:1px solid #cbd5e1;border-radius:8px;padding:10px 11px;background:#fff;min-width:0}textarea{min-height:88px;resize:vertical}button{border:0;border-radius:8px;padding:9px 13px;cursor:pointer;background:#e2e8f0;color:#1e293b}.primary{background:#1d5f91;color:white;font-weight:700}.danger{background:#991b1b;color:#fff}.error{color:#b91c1c;margin-top:10px;font-size:13px}.app{display:grid;grid-template-columns:230px 1fr;min-height:100vh}aside{background:#13283d;color:white;padding:18px 14px;display:flex;flex-direction:column}.side-brand{padding:6px 10px 24px}.side-brand b{font-size:19px;letter-spacing:.12em;display:block}.side-brand span{font-size:12px;color:#b7c7d8}nav{display:grid;gap:5px}nav button{background:transparent;color:#c8d4df;text-align:left;padding:10px 12px}nav button.active,nav button:hover{background:#23425f;color:white}.side-footer{margin-top:auto;border-top:1px solid #ffffff24;padding:14px 8px 0;display:grid;gap:9px;font-size:12px}.side-footer button{background:#ffffff14;color:#fff}main{min-width:0}header{height:84px;background:white;border-bottom:1px solid #dbe3ea;padding:16px 24px;display:flex;align-items:center;justify-content:space-between;gap:16px}header h2{margin:0 0 3px;font-size:23px}#viewSubtitle{font-size:13px;color:#64748b}#content{padding:22px}.cards{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:14px}.card,.panel{background:white;border:1px solid #dce4eb;border-radius:12px;box-shadow:0 2px 8px #0f172a0a}.card{padding:18px}.metric{font-size:31px;font-weight:800;margin-top:8px}.muted{color:#64748b;font-size:13px}.panel{margin-top:18px;overflow:hidden}.panel-head{padding:14px 16px;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center}.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.toolbar select,.toolbar input{padding:8px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;background:#fff;font-size:13px}th{text-align:left;background:#f7f9fb;color:#475569;padding:10px;border-bottom:1px solid #dce4eb;white-space:nowrap}td{padding:9px 10px;border-bottom:1px solid #edf1f5;vertical-align:top}tr:hover td{background:#fafcff}.badge{display:inline-block;padding:3px 7px;border-radius:999px;background:#e2e8f0;font-size:11px;font-weight:700}.badge.URGENT{background:#fee2e2;color:#991b1b}.badge.HIGH{background:#ffedd5;color:#9a3412}.badge.NEW{background:#dbeafe;color:#1e40af}.empty{padding:30px;text-align:center;color:#64748b}.modal{position:fixed;inset:0;background:#0f172a99;display:grid;place-items:center;padding:20px;z-index:100}.modal-card{background:white;border-radius:14px;width:min(760px,96vw);max-height:92vh;overflow:auto;box-shadow:0 24px 80px #0006}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid #e2e8f0}.modal-head h3{margin:0}.icon{font-size:25px;background:transparent;padding:0 7px}.form{padding:18px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px 14px}.form-grid .span2{grid-column:1/-1}.form-actions{display:flex;justify-content:flex-end;gap:8px;padding-top:8px}.checkbox{display:flex;align-items:center;gap:8px}.checkbox input{width:auto}.toast{position:fixed;right:20px;bottom:20px;background:#183b56;color:white;padding:12px 16px;border-radius:9px;box-shadow:0 10px 30px #0003;z-index:200}@media(max-width:850px){.app{grid-template-columns:1fr}aside{position:static}.side-brand{padding-bottom:10px}nav{display:flex;overflow:auto}.side-footer{display:none}.cards{grid-template-columns:1fr 1fr}header{height:auto}.form-grid{grid-template-columns:1fr}.form-grid .span2{grid-column:auto}}@media(max-width:520px){.cards{grid-template-columns:1fr}#content{padding:12px}header{padding:12px}}
.header-right{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:flex-end}.active-company{display:grid;gap:3px;min-width:260px}.active-company span{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:#64748b}.active-company select{padding:8px 10px;border-color:#93b5cf;background:#f8fbfd;font-weight:700}.context-banner{background:#eaf4fb;border:1px solid #bdd7e8;border-radius:12px;padding:13px 16px;margin-bottom:16px;display:flex;gap:12px;align-items:baseline;flex-wrap:wrap}.context-banner span,.active-company-note span,.location-preview span{font-size:12px;color:#64748b}.active-company-note{border:1px solid #bdd7e8;background:#f2f8fc;border-radius:9px;padding:11px 12px}.location-preview{border:1px dashed #cbd5e1;background:#f8fafc;border-radius:8px;padding:10px 12px;font-size:13px}.section-title{border-top:1px solid #e2e8f0;padding-top:10px;font-weight:700}.field-label{font-size:13px;font-weight:600;margin-bottom:6px}.employee-picker{display:flex;gap:8px 18px;flex-wrap:wrap;border:1px solid #cbd5e1;border-radius:8px;padding:10px 11px;min-height:42px}.employee-check{display:flex;grid-template-columns:auto 1fr;align-items:center;gap:6px;margin:0;font-weight:500}.employee-check input{width:auto;margin:0}@media(max-width:850px){.header-right{width:100%;justify-content:stretch}.active-company{min-width:0;flex:1}header{align-items:flex-start;flex-wrap:wrap}}
/* RC2 FIX2 - compactación y acciones */
#content{padding:18px 20px}.panel{margin-top:12px}.table-wrap{max-height:calc(100vh - 155px)}table{font-size:12.5px}th{position:sticky;top:0;z-index:2;padding:8px 9px}td{padding:7px 9px;vertical-align:middle}.row-actions{display:flex;gap:5px;justify-content:flex-end;white-space:nowrap}.small{padding:5px 8px;font-size:11px;border-radius:6px}.danger-outline{background:#fff;border:1px solid #fecaca;color:#991b1b}.danger-outline:hover{background:#fef2f2}.inactive-row{opacity:.58}.tiny{font-size:11px;color:#64748b;margin-top:2px}.incident-title{max-width:320px}.badge.ok{background:#dcfce7;color:#166534}.badge.danger{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}.badge.off{background:#e5e7eb;color:#4b5563}.badge.LOW{background:#f1f5f9;color:#475569}.badge.NORMAL{background:#dbeafe;color:#1e40af}.badge.HIGH{background:#ffedd5;color:#9a3412}.badge.URGENT{background:#fee2e2;color:#991b1b}.badge.PLANNED{background:#ede9fe;color:#5b21b6}.badge.IN_PROGRESS{background:#cffafe;color:#155e75}.badge.PENDING{background:#fef3c7;color:#92400e}.badge.CLOSED{background:#dcfce7;color:#166534}.badge.INVOICED{background:#e5e7eb;color:#374151}.modal-card{width:min(820px,96vw)}.form{padding:15px 18px}.form-grid{gap:9px 12px}label{margin-bottom:8px}input,select,textarea{padding:8px 9px}.form-actions{position:sticky;bottom:0;background:#fff;border-top:1px solid #e2e8f0;margin:8px -18px -15px;padding:11px 18px}.modal-toolbar{padding:12px 16px;border-bottom:1px solid #e2e8f0}.contact-list{padding:10px 16px 16px}.contact-card{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 4px;border-bottom:1px solid #edf1f5}.context-banner{justify-content:space-between}.context-banner>div{display:grid;gap:2px}.context-banner>div>span{font-size:10px;font-weight:800;letter-spacing:.08em}.context-banner>div>b{font-size:16px}
/* RC2 FIX3 - cabecera alineada y selector de empresa simplificado */
.header-right{align-items:center}
.active-company{display:flex;align-items:center;min-width:260px}
.active-company select{width:100%;height:36px;padding:7px 10px}
#headerActions{display:flex;align-items:center;gap:8px}
#headerActions button{height:36px;display:inline-flex;align-items:center}
/* RC2 FIX5 - selección de filas, barra de acciones y FACe */
.selection-toolbar{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.selection-toolbar button{height:36px;display:inline-flex;align-items:center;justify-content:center}
.selection-toolbar button:disabled{opacity:.42;cursor:not-allowed}
.selectable-row{cursor:pointer;user-select:none}
.selectable-row.selected-row td{background:#e7f2fa!important;box-shadow:inset 0 1px 0 #b8d5e8,inset 0 -1px 0 #b8d5e8}
.selectable-row.selected-row td:first-child{box-shadow:inset 3px 0 0 #1d5f91,inset 0 1px 0 #b8d5e8,inset 0 -1px 0 #b8d5e8}
.selectable-contact{cursor:pointer;border-radius:7px;padding-left:8px;padding-right:8px}
.selectable-contact.selected-row{background:#e7f2fa;box-shadow:inset 3px 0 0 #1d5f91}
.face-unit{border:1px solid #d7e0e8;border-radius:9px;padding:12px 12px 4px;margin:0;min-width:0}
.face-unit legend{padding:0 7px;font-size:13px;font-weight:800;color:#334155}
.face-grid{display:grid;grid-template-columns:minmax(140px,.8fr) minmax(180px,1.1fr);gap:8px 12px}
.face-grid .span-face{grid-column:1/-1}
.face-grid label{margin-bottom:5px}
@media(min-width:900px){.modal-card{width:min(940px,96vw)}}
@media(max-width:650px){.face-grid{grid-template-columns:1fr}.face-grid .span-face{grid-column:auto}.selection-toolbar{width:100%}.selection-toolbar button{flex:1 1 auto}}

/* RC2 FIX6 - acciones de cliente, modal secundario y ubicación efectiva */
.sub-modal{z-index:140;background:#0f172ab8}
.sub-modal .modal-card{width:min(980px,96vw)}
.customer-related{border-top:1px solid #e2e8f0;margin-top:2px;padding-top:12px;display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.customer-related-actions{display:flex;gap:8px;flex-wrap:wrap}
.customer-related-actions button:disabled{opacity:.42;cursor:not-allowed}
.location-preview{min-height:38px;display:flex;align-items:center}
@media(max-width:650px){.customer-related{align-items:stretch}.customer-related-actions{width:100%}.customer-related-actions button{flex:1 1 auto}}

.incident-doc-actions{display:flex;justify-content:flex-end}.incident-doc-actions button{border:1px solid #b8cfdf;background:#f7fbfe}
/* RC3 - Planificación / Agenda */
.agenda-controls{padding:12px 14px;display:grid;gap:10px;overflow:visible}
.agenda-period,.agenda-filters{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.agenda-period input{width:150px}.agenda-period select{width:120px}
.agenda-filters input{min-width:250px;flex:1 1 280px}.agenda-filters select{min-width:145px}
.agenda-range{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 4px 0;color:#475569}.agenda-range b{font-size:14px}.agenda-range span{font-size:12px;color:#64748b}
.planning-summary{display:grid;gap:4px;border:1px solid #cbd5e1;background:#f8fafc;border-radius:9px;padding:11px 12px}.planning-summary b{font-size:15px}.planning-summary span{font-size:12px;color:#64748b}
.badge.mode-ONSITE{background:#dcfce7;color:#166534}.badge.mode-REMOTE{background:#dbeafe;color:#1e40af}.badge.mode-TO_CONFIRM{background:#f1f5f9;color:#475569}
@media(max-width:720px){.agenda-period>*{flex:1 1 auto}.agenda-filters>*{width:100%;flex:1 1 100%}.agenda-range{align-items:flex-start;flex-direction:column}}
/* RC3 FIX1 - vista mensual de Agenda */
.month-calendar{overflow:hidden;margin-top:10px}.month-weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));background:#eef2f6;border-bottom:1px solid #cbd5e1}.month-weekdays>div{padding:9px 8px;text-align:center;font-size:12px;font-weight:800;color:#475569;border-right:1px solid #dbe3ea}.month-weekdays>div:last-child{border-right:0}.month-weekdays .weekend-head{color:#1d4ed8}.month-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-auto-rows:minmax(132px,1fr);background:#cbd5e1;gap:1px}.month-day{position:relative;background:#fff;padding:25px 5px 5px;min-width:0;cursor:pointer}.month-day:hover{background:#f8fbfd}.month-day.outside-month{background:#f8fafc}.month-day.outside-month .month-day-number{color:#b0bac6}.month-day.weekend:not(.outside-month){background:#fcfdff}.month-day.today{box-shadow:inset 0 0 0 2px #1d5f91}.month-day-number{position:absolute;right:7px;top:5px;font-size:12px;font-weight:800;color:#334155}.month-events{display:grid;gap:4px}.month-event{width:100%;padding:4px 6px;border-radius:5px;border:1px solid #cbd5e1;background:#f8fafc;text-align:left;display:grid;gap:1px;font-size:10.5px;line-height:1.2;overflow:hidden}.month-event span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.month-event-line{font-size:11px}.month-event.priority-URGENT{border-left:4px solid #b91c1c;background:#fef2f2}.month-event.priority-HIGH{border-left:4px solid #c2410c;background:#fff7ed}.month-event.priority-NORMAL{border-left:4px solid #2563eb;background:#eff6ff}.month-event.priority-LOW{border-left:4px solid #64748b;background:#f8fafc}.month-event.selected-event{outline:2px solid #1d5f91;outline-offset:1px}.month-more{padding:3px 6px;background:#e2e8f0;color:#334155;font-size:10.5px;font-weight:700;text-align:left}.month-more:hover{background:#cbd5e1}@media(max-width:1050px){.month-grid{grid-auto-rows:minmax(112px,1fr)}.month-event{font-size:9.5px}.month-event-line{font-size:10px}}@media(max-width:760px){.month-calendar{overflow-x:auto}.month-weekdays,.month-grid{min-width:900px}.month-grid{grid-auto-rows:minmax(120px,1fr)}}

/* RC4 · Intervenciones / Partes de trabajo */
.workorder-filters{display:flex;gap:10px;align-items:center;margin-bottom:12px;padding:12px}.workorder-filters input{min-width:320px;flex:1}.workorder-detail{display:flex;flex-direction:column;gap:14px}.workorder-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;padding:12px 14px;background:#f7f9fb;border:1px solid #e4e8ed;border-radius:8px}.workorder-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.workorder-meta>div{border:1px solid #e4e8ed;border-radius:7px;padding:9px 11px;background:#fff}.workorder-meta span{display:block;font-size:11px;color:#6c7783;text-transform:uppercase;margin-bottom:3px}.workorder-actions{display:flex;gap:7px;flex-wrap:wrap;padding-bottom:4px}.workorder-section{border-top:1px solid #e3e7eb;padding-top:10px}.workorder-section h4{margin:0 0 8px}.workorder-chips{display:flex;gap:6px;flex-wrap:wrap}.workorder-chips span{padding:6px 9px;border:1px solid #dde3e8;border-radius:16px;background:#f8fafb;font-size:12px}.workorder-list{display:flex;flex-direction:column;gap:7px}.workorder-list>div{border:1px solid #e2e7eb;border-radius:7px;padding:8px 10px;background:#fff}.workorder-list b,.workorder-list span{display:block}.workorder-list span{font-size:11px;color:#69747f;margin-top:2px}.workorder-list p{margin:6px 0 0;white-space:pre-wrap}.compact-list>div{padding:6px 9px}.no-materials-ok{padding:8px 10px;border:1px solid #cfded2;border-radius:7px;background:#f4faf5}.warning-box{padding:11px 12px;border:1px solid #e3cf9b;border-radius:7px;background:#fffaf0}.empty.compact{padding:10px}.badge.WO-OPEN{background:#eaf4ff;color:#185a8d}.badge.WO-CLOSED{background:#eef1f3;color:#53606c}.badge.WO-PENDING_CONFORMITY{background:#fff4d8;color:#855e00}.badge.mode-ONSITE{background:#eaf4ff;color:#185a8d}.badge.mode-REMOTE{background:#eee9ff;color:#5a3ca0}.badge.mode-INTERNAL{background:#f0f1f2;color:#56616b}@media(max-width:900px){.workorder-meta{grid-template-columns:repeat(2,minmax(0,1fr))}.workorder-filters{flex-wrap:wrap}.workorder-filters input{min-width:220px}}


/* RC4 FIX1 · intervención integrada y pantalla completa */
.workpage{display:flex;flex-direction:column;gap:12px;max-width:1500px;margin:0 auto;padding-bottom:24px}.workpage-incident{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;padding:15px 17px;border:1px solid #d8e1e8;border-radius:10px;background:#f8fafc}.workpage-incident span{display:block;font-size:10px;font-weight:800;letter-spacing:.08em;color:#64748b;margin-bottom:4px}.workpage-incident b{font-size:18px}.workpage-incident p{margin:4px 0;color:#334155}.workpage-incident small{color:#64748b}.workpage-form{padding:18px}.workpage-footer{display:flex;justify-content:flex-end;gap:8px;border-top:1px solid #e2e8f0;margin-top:14px;padding-top:14px}.workpage-meta{margin:0}.workpage-body{padding:15px 17px}.workpage-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px}.workpage-grid .workorder-section{min-width:0}.workpage-grid .span-wide{grid-column:1/-1}.incident-interventions-box{border-top:1px solid #e2e8f0;margin-top:4px;padding-top:12px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.incident-interventions-box .customer-related-actions{margin-left:auto}.workpage .workorder-list>div{overflow-wrap:anywhere}@media(max-width:850px){.workpage-grid{grid-template-columns:1fr}.workpage-grid .span-wide{grid-column:auto}.workpage-incident{flex-direction:column}.workpage-meta{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* RC4 FIX2 · registro diario simplificado */
.daily-cards{display:grid;gap:12px}
.daily-card{display:block;width:100%;text-align:left;border:1px solid var(--border,#d9dee7);background:#fff;border-radius:10px;padding:14px 16px;color:inherit;cursor:pointer}
.daily-card:hover{border-color:#aeb8c7;background:#fafbfd}
.daily-card-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:8px}
.daily-card-head b{font-size:15px}.daily-card-head span{font-size:13px;color:#657083}
.daily-card-work{font-weight:600;margin-bottom:8px;white-space:pre-wrap}
.daily-card-meta{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;color:#657083}
.daily-card-notes{margin-top:8px;padding-top:8px;border-top:1px solid #edf0f4;font-size:13px;color:#4f5968}
.section-heading{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.section-heading h4{margin-bottom:2px}
.daily-entry-form{display:grid;gap:18px;min-width:0}
.daily-entry-top{display:grid;grid-template-columns:minmax(220px,1fr) 180px;gap:16px;align-items:end}
.daily-entry-form section{border-top:1px solid #e5e9ef;padding-top:16px;display:grid;gap:10px}
.daily-entry-form section:first-of-type{border-top:0;padding-top:0}
.daily-section-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;flex-wrap:wrap}.daily-section-head h4{margin:0}.daily-section-head p{margin:3px 0 0;color:#687386;font-size:12px}
.daily-total-preview{border:1px solid #e0e5ec;border-radius:8px;padding:8px 12px;background:#f8fafc}.daily-total-preview span{display:block;font-size:11px;color:#687386}.daily-total-preview b{font-size:18px}
.daily-segment-labels,.daily-segment-row{display:grid;grid-template-columns:minmax(145px,1.1fr) minmax(125px,.9fr) 105px 105px minmax(150px,1fr) 40px;gap:8px;align-items:center;min-width:0}
.daily-segment-labels,.daily-material-labels{font-size:11px;font-weight:700;color:#687386;padding:0 2px}
.daily-segment-row input,.daily-segment-row select,.daily-material-row input{min-width:0;width:100%}
.daily-quick-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:4px}.daily-quick-actions button{padding:7px 10px}
.remove-segment,.remove-material{padding:5px;min-width:34px;font-size:18px;line-height:1}
.daily-material-labels,.daily-material-row{display:grid;grid-template-columns:minmax(220px,1fr) 110px 90px 40px;gap:8px;align-items:center;min-width:0}
.daily-entry-form textarea{min-height:90px}
.daily-entry-footer{display:flex;justify-content:flex-end;gap:8px;padding-top:4px}
@media(max-width:900px){
 .daily-entry-top{grid-template-columns:1fr}
 .daily-segment-labels,.daily-material-labels{display:none}
 .daily-segment-row{grid-template-columns:1fr 1fr}.daily-segment-row .seg-notes{grid-column:1/-1}.daily-segment-row .remove-segment{grid-column:2;justify-self:end}
 .daily-material-row{grid-template-columns:1fr 100px}.daily-material-row .mat-description{grid-column:1/-1}.daily-material-row .remove-material{grid-column:2;justify-self:end}
}
@media(max-width:560px){
 .daily-segment-row{grid-template-columns:1fr}.daily-segment-row .seg-notes,.daily-segment-row .remove-segment{grid-column:auto}.daily-segment-row .remove-segment{justify-self:end}
 .daily-material-row{grid-template-columns:1fr}.daily-material-row .mat-description,.daily-material-row .remove-material{grid-column:auto}.daily-material-row .remove-material{justify-self:end}
 .daily-card-head{align-items:flex-start;flex-direction:column;gap:3px}
}

/* RC4 FIX3 · ergonomía del registro diario */
#subModal:has(.daily-entry-form) .modal-card{width:min(980px,94vw);max-height:90vh}
#subModal:has(.daily-entry-form) .modal-head{padding:12px 18px}
#subModal:has(.daily-entry-form) #subModalBody{padding:0}
.daily-entry-form{display:grid;gap:0;padding:14px 18px 0;min-width:0}
.daily-entry-summary{display:grid;grid-template-columns:minmax(190px,1fr) 155px 155px;gap:10px;align-items:end;padding-bottom:12px}
.daily-date-field{margin:0;max-width:340px}
.daily-summary-metric{border-left:1px solid #dbe2e8;padding:4px 12px;min-height:48px;display:flex;flex-direction:column;justify-content:center}
.daily-summary-metric span{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:#6b7785;font-weight:700}
.daily-summary-metric b{font-size:17px;margin-top:2px;color:#1f3347}
.daily-entry-form section{border-top:1px solid #e5e9ef;padding:12px 0;display:grid;gap:8px}
.daily-section-head{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}
.daily-section-head h4{margin:0;font-size:14px}.daily-section-head p{margin:2px 0 0;color:#687386;font-size:11px}
.daily-section-head.compact{align-items:center}.daily-section-head.compact h4{margin:0}
.daily-quick-actions{display:flex;gap:5px;flex-wrap:wrap;margin:0}.daily-quick-actions button{padding:5px 8px;font-size:12px;border:1px solid #d6dee7;background:#f6f8fa}
.daily-segment-labels,.daily-segment-row{display:grid;grid-template-columns:minmax(165px,1.35fr) minmax(120px,.9fr) 92px 18px 92px 78px 32px;gap:6px;align-items:center;min-width:0}
.daily-segment-labels{font-size:10px;font-weight:700;color:#687386;padding:0 3px}.daily-segment-labels span:nth-child(4){visibility:hidden}
.daily-segment-row{padding:3px 0}.daily-segment-row input,.daily-segment-row select{width:100%;padding:7px 8px;height:36px}
.daily-time-arrow{text-align:center;color:#8a96a3}.seg-duration{font-size:12px;font-weight:700;color:#445365;text-align:center;white-space:nowrap}
.remove-segment,.remove-material{padding:3px;min-width:30px;height:30px;font-size:17px;line-height:1;background:#eef2f6;color:#52606e}
.daily-main-grid{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);gap:16px;border-top:1px solid #e5e9ef}
.daily-main-grid section{border-top:0;padding:12px 0}.daily-work-section{padding-right:8px!important}.daily-materials-section{padding-left:8px!important;border-left:1px solid #edf0f3!important}
.daily-entry-form label{margin-bottom:0}.daily-entry-form textarea{min-height:104px;resize:vertical;padding:9px 10px}
.daily-material-labels,.daily-material-row{display:grid;grid-template-columns:minmax(150px,1fr) 68px 60px 30px;gap:6px;align-items:center;min-width:0}
.daily-material-labels{font-size:10px;font-weight:700;color:#687386;padding:0 2px}.daily-material-row{padding:2px 0}.daily-material-row input{width:100%;padding:7px 8px;height:36px}
.daily-add-material{width:100%;padding:7px 10px;margin-top:4px;font-size:12px;border:1px dashed #bcc7d2;background:#fafbfd}
.daily-none-check{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;margin:0}.daily-none-check input{width:auto;height:auto}
.daily-observations-section textarea{min-height:64px}
.daily-entry-footer{position:sticky;bottom:0;display:flex;justify-content:flex-end;gap:8px;padding:10px 0 12px;background:#fff;border-top:1px solid #e2e8f0;z-index:2}.daily-entry-footer button{padding:8px 13px}
@media(max-width:900px){
 #subModal:has(.daily-entry-form) .modal-card{width:min(760px,96vw)}
 .daily-entry-summary{grid-template-columns:1fr 1fr}.daily-date-field{grid-column:1/-1;max-width:none}.daily-summary-metric{border-left:0;border:1px solid #e0e5ec;border-radius:7px}
 .daily-segment-labels{display:none}.daily-segment-row{grid-template-columns:1fr 1fr 88px 16px 88px 70px 30px}
 .daily-main-grid{grid-template-columns:1fr}.daily-materials-section{border-left:0!important;border-top:1px solid #e5e9ef!important;padding-left:0!important}.daily-work-section{padding-right:0!important}
}
@media(max-width:640px){
 .daily-entry-form{padding:12px 12px 0}.daily-entry-summary{grid-template-columns:1fr}.daily-date-field{grid-column:auto}.daily-summary-metric{min-height:auto}
 .daily-segment-row{grid-template-columns:1fr 1fr}.daily-time-arrow{display:none}.seg-duration{text-align:left}.daily-segment-row .remove-segment{justify-self:end}
 .daily-material-labels{display:none}.daily-material-row{grid-template-columns:1fr 72px 60px 30px}.daily-material-row .mat-description{grid-column:1/-1}
}

/* RC4 FIX4A · modal de intervenciones más amplio */
#subModal:has(.incident-interventions-list) .modal-card{width:min(1120px,94vw);min-height:360px}
#subModal:has(.incident-interventions-list) .table-wrap{max-height:58vh}
#subModal:has(.incident-interventions-list) table{min-width:780px}
#subModal:has(.incident-interventions-list) .modal-toolbar{padding:14px 18px}
@media(max-width:850px){#subModal:has(.incident-interventions-list) .modal-card{width:96vw;min-height:0}}

/* RC5 · adjuntos, conformidad y parte definitivo */
.attachment-list{display:grid;gap:7px;margin-top:10px}.attachment-item{display:grid;grid-template-columns:46px minmax(0,1fr) auto;gap:10px;align-items:center;border:1px solid #e0e6ec;border-radius:8px;padding:8px 10px;background:#fbfcfd}.attachment-kind{font-size:12px;font-weight:800;text-align:center;color:#506176}.attachment-info{min-width:0;display:grid;gap:2px}.attachment-info b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.attachment-info span{font-size:11px;color:#6a7685}.attachment-actions{display:flex;gap:5px}.attachment-actions button{padding:5px 8px;font-size:12px}.conformity-summary{display:grid;gap:3px;margin-top:8px}.conformity-summary span{font-size:12px;color:#617080}.final-hash{margin-top:10px;padding:9px 10px;border:1px solid #dce4eb;border-radius:7px;background:#f8fafc;display:grid;gap:4px}.final-hash span{font-size:11px;font-weight:700;color:#617080}.final-hash code{font-size:10px;word-break:break-all}.conformity-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}.conformity-tabs button{padding:7px 10px}.conformity-tabs button.active{background:#17669b;color:#fff;border-color:#17669b}.conf-pane{display:grid;gap:10px}.signature-wrap{display:grid;gap:6px}.signature-wrap canvas{width:100%;height:180px;border:1px solid #bcc7d2;border-radius:7px;background:#fff;touch-action:none}.signature-wrap button{justify-self:start;padding:6px 9px}.token-result{display:grid;gap:12px}.token-result input{width:100%;font-family:monospace}.conformity-choice .form-actions{margin-top:14px}
@media(max-width:650px){.attachment-item{grid-template-columns:36px 1fr}.attachment-actions{grid-column:1/-1;justify-content:flex-end}.signature-wrap canvas{height:150px}}


/* RC5 FIX1 · sistema común de modales, adjuntos compactos y conformidad */
.modal-card{display:flex;flex-direction:column;overflow:hidden;max-width:96vw}
.modal-card.modal-small{width:min(520px,94vw)}
.modal-card.modal-normal{width:min(760px,94vw)}
.modal-card.modal-large{width:min(940px,94vw)}
.modal-card.modal-wide{width:min(1120px,94vw)}
#modalBody,#subModalBody{min-width:0;overflow-x:hidden;overflow-y:auto}
#modalBody>* ,#subModalBody>*{max-width:100%}
.modal-head{flex:0 0 auto}
input[type=file]{width:100%;max-width:100%;overflow:hidden}
.attachment-form{padding:14px 18px}
.attachment-form .form-actions{margin:8px -18px -14px}
.attachment-list{gap:4px;margin-top:8px}
.attachment-item{grid-template-columns:42px minmax(0,1fr) auto;gap:8px;padding:5px 8px;min-height:38px}
.attachment-info{display:block}
.attachment-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px}
.attachment-name b{font-weight:700}.attachment-name span{font-weight:400;color:#64748b}
.attachment-kind{font-size:11px}.attachment-actions button{padding:4px 7px;font-size:11px}
.conformity-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px;padding-top:10px;border-top:1px solid #edf1f5}
.conformity-hint{margin-top:8px}
.conformity-choice{padding:14px 18px 0}
.conformity-form .form-actions{margin:14px -18px 0}
.conformity-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media(max-width:650px){.modal{padding:10px}.modal-card.modal-small,.modal-card.modal-normal,.modal-card.modal-large,.modal-card.modal-wide{width:96vw}.attachment-item{grid-template-columns:34px minmax(0,1fr) auto}.attachment-actions{grid-column:auto}.conformity-fields{grid-template-columns:1fr}}
.badge.WO-IN_PROGRESS{background:#cffafe;color:#155e75}.badge.WO-PENDING{background:#fef3c7;color:#92400e}.badge.WO-FINALIZED{background:#dcfce7;color:#166534}.badge.WAITING_CONFORMITY{background:#fff4d8;color:#855e00}.workorder-status-control{display:grid;grid-template-columns:auto minmax(180px,240px);align-items:center;gap:5px 8px;margin-right:8px;padding:5px 8px;border:1px solid #dbe3ea;border-radius:7px;background:#f8fafc}.workorder-status-control>span{font-size:11px;font-weight:700;color:#64748b}.workorder-status-control select{padding:6px 8px}.workorder-status-control small{grid-column:1/-1;color:#7c5d13;max-width:420px}.workorder-actions{align-items:center}

/* RC5 FIX3 · historial visible y cierre técnico */
.status-history{display:grid;gap:6px;margin-top:8px}
.status-history-row{display:grid;grid-template-columns:minmax(180px,1fr) auto;gap:2px 14px;padding:7px 9px;border:1px solid var(--border,#d8e0e8);border-radius:7px;background:#fff;font-size:12px}
.status-history-row>div:first-child{display:flex;gap:8px;align-items:baseline;min-width:0}
.status-history-row>div:first-child span{color:#64748b;font-size:11px}
.status-history-meta{color:#64748b;white-space:nowrap;text-align:right}
.status-history-reason{grid-column:1/-1;color:#425466;font-size:11px}
.incident-status-history-box{margin-top:4px;padding-top:8px;border-top:1px solid #dce4eb}
@media(max-width:700px){.status-history-row{grid-template-columns:1fr}.status-history-meta{text-align:left}.status-history-reason{grid-column:1}}

/* RC5 FIX4B · historial de estados plegable */
.status-history-collapsible{padding-top:8px;padding-bottom:8px}
.history-toggle{font-size:12px;padding:6px 10px}
.status-history-collapsible #woHistoryPanel{margin-top:10px}

/* RC5 FIX4F · resumen acumulado de incidencia */
.status-history-collapsible #incidentHistoryPanel{margin-top:10px}
.incident-summary-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 16px 8px}
.incident-summary-cards>div{border:1px solid #dbe3ea;border-radius:8px;background:#f8fafc;padding:9px 11px;display:grid;gap:3px}
.incident-summary-cards span{font-size:10px;color:#64748b;text-transform:uppercase;font-weight:700;letter-spacing:.04em}
.incident-summary-cards b{font-size:16px;color:#172333}
.incident-summary-times{display:flex;gap:7px;flex-wrap:wrap;margin:8px 16px 12px}
.incident-summary-times span{border:1px solid #e0e6ec;border-radius:999px;padding:5px 9px;background:#fff;font-size:11px;color:#475569}
.incident-summary-materials{margin:12px 16px}.incident-summary-materials>b{display:block;margin-bottom:7px}
.incident-work-summary{padding:2px 0 14px}.incident-work-summary .empty{margin:10px 16px}.incident-work-summary>.tiny{padding:0 16px 8px}
.summary-print-toolbar{border-top:1px solid #e2e8f0;border-bottom:0;margin-top:12px}
#subModal:has(.incident-work-summary) .modal-card{width:min(980px,94vw)}
@media(max-width:760px){.incident-summary-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* RC5 FIX4G */
.daily-material-row,.daily-material-labels{grid-template-columns:minmax(110px,.7fr) minmax(220px,2fr) 90px 80px 36px!important}.incident-summary-parts{margin-top:12px}.incident-summary-parts>b{display:block;margin-bottom:6px}

/* RC5 FIX4G1 · jornada de trabajo en pantalla completa */
.daily-page{margin-top:0;overflow:visible}
.daily-page .daily-entry-form{padding:18px 20px 0;gap:0}
.daily-page .daily-entry-summary{grid-template-columns:minmax(260px,1fr) 180px 180px;max-width:none}
.daily-page .daily-entry-form section{padding:16px 0}
.daily-page .daily-work-section{padding-right:0!important}
.daily-page .daily-work-description{min-height:180px;overflow:hidden;resize:none;line-height:1.45}
.daily-page .daily-observations-section textarea{min-height:90px;overflow:hidden;resize:none;line-height:1.45}
.daily-page .daily-materials-section{padding-left:0!important;border-left:0!important;border-top:1px solid #e5e9ef!important}
.daily-page .daily-material-labels,.daily-page .daily-material-row{grid-template-columns:minmax(140px,.75fr) minmax(300px,2.4fr) 100px 100px 36px!important;gap:8px}
.daily-page .daily-material-row input{height:38px}
.daily-page .daily-entry-footer{margin:0 -20px;padding:12px 20px;bottom:0}
@media(max-width:900px){
 .daily-page .daily-entry-summary{grid-template-columns:1fr 1fr}.daily-page .daily-date-field{grid-column:1/-1;max-width:none}
 .daily-page .daily-segment-labels{display:none}.daily-page .daily-segment-row{grid-template-columns:1fr 1fr 88px 16px 88px 70px 30px}
 .daily-page .daily-material-labels{display:none}.daily-page .daily-material-row{grid-template-columns:minmax(120px,.8fr) minmax(220px,2fr) 90px 80px 36px!important}
}
@media(max-width:640px){
 .daily-page .daily-entry-form{padding:12px 12px 0}.daily-page .daily-entry-summary{grid-template-columns:1fr}.daily-page .daily-date-field{grid-column:auto}
 .daily-page .daily-segment-row{grid-template-columns:1fr 1fr}.daily-page .daily-time-arrow{display:none}.daily-page .seg-duration{text-align:left}.daily-page .daily-segment-row .remove-segment{justify-self:end}
 .daily-page .daily-material-row{grid-template-columns:1fr 72px 70px 34px!important}.daily-page .daily-material-row .mat-code,.daily-page .daily-material-row .mat-description{grid-column:1/-1}
 .daily-page .daily-entry-footer{margin:0 -12px;padding:10px 12px}
}

/* RC5 FIX4H · incidencia por pestañas y planificación múltiple */
.incident-tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid #d9e1ea;padding:0 0 8px;margin-bottom:4px}
.incident-tab{border:1px solid #d7e0e8;background:#f7f9fc;padding:8px 13px;border-radius:7px 7px 0 0;font-weight:700;color:#475569}
.incident-tab.active{background:#fff;color:#174f7c;border-bottom-color:#fff;box-shadow:inset 0 -2px 0 #1d5f91}
.incident-tab-panel{min-width:0;padding-top:6px}.nested-grid{grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
.incident-planning-highlight{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:12px 14px;border:1px solid #cbdbea;background:#f4f9fd;border-radius:8px;margin-bottom:12px}.incident-planning-highlight b{font-size:15px}.incident-planning-highlight span{color:#475569}
.incident-planning-list,.planning-manager #planningEntriesList{display:flex;flex-direction:column;gap:7px}
.planning-entry-card{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #dbe3eb;border-radius:8px;padding:9px 11px;background:#fff}.planning-entry-actions{display:flex;gap:6px;flex:0 0 auto}
.incident-tab-actions,.planning-manager-toolbar{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:12px}.planning-manager-toolbar{justify-content:space-between;margin:14px 0 9px}
.planning-manager{min-width:min(820px,90vw)}.planning-availability{border:1px solid #d8e2ea;border-radius:8px;padding:10px;background:#fafcfe}.planning-availability-title{display:flex;justify-content:space-between;gap:12px;margin-bottom:8px}.availability-ok{padding:9px;border-radius:6px;background:#eef8f0}.availability-warning{padding:10px;border-radius:6px;background:#fff7e8}.availability-conflict{display:flex;justify-content:space-between;gap:10px;padding:7px 0;border-top:1px solid #eadfc8;margin-top:6px}.availability-conflict span{color:#5f6875}.panel-light{border:1px solid #dbe3eb;border-radius:8px;padding:14px;background:#fafcfe}.planning-PLANNED{background:#eef6ff}.planning-DONE{background:#edf8ef}.planning-CANCELLED{background:#f4f4f5}
@media(max-width:800px){.nested-grid{grid-template-columns:1fr}.nested-grid .span2{grid-column:1}.incident-planning-highlight,.availability-conflict{align-items:flex-start;flex-direction:column}}
.incident-tab.has-planning{color:#174f7c;background:#eef6fd}


/* RC5 FIX4H1 · ficha de incidencia estable, más ancha y reorganizada */
#modal:has(.incident-tabs) .modal-card{width:min(1180px,96vw);height:min(820px,92vh);max-height:92vh}
#modal:has(.incident-tabs) #modalBody{flex:1 1 auto;min-height:0;overflow-y:auto}
#modal:has(.incident-tabs) #entityForm{min-height:100%;display:flex;flex-direction:column}
#modal:has(.incident-tabs) #entityForm>.form-grid{flex:1 1 auto;align-content:start}
#modal:has(.incident-tabs) .form-actions{flex:0 0 auto}
.incident-general-sections{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);gap:14px;align-items:start}
.incident-section-card{border:1px solid #dbe3eb;border-radius:10px;background:#fbfcfe;padding:14px;min-width:0}
.incident-section-title{display:grid;gap:2px;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5eaf0}
.incident-section-title b{font-size:14px;color:#243447}.incident-section-title span{font-size:11px;color:#64748b}
.incident-description-long{min-height:190px}
.incident-technicians{margin-bottom:12px}.planning-first-save{border:1px dashed #b9cddd;border-radius:9px;padding:18px;text-align:center;background:#f7fbfe}.planning-first-save p{margin:0 0 12px;color:#526273}
#modal:has(.incident-tabs) .planning-entry-actions{align-items:center;flex-wrap:wrap;justify-content:flex-end}
@media(max-width:900px){#modal:has(.incident-tabs) .modal-card{width:96vw;height:92vh}.incident-general-sections{grid-template-columns:1fr}}


/* RC5 FIX4H2 · pestañas operativas de incidencia */
.incident-tab-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:8px 0 12px;border-bottom:1px solid #e2e8f0;margin-bottom:10px;flex-wrap:wrap}
.incident-tab-heading>.customer-related-actions{margin-left:auto}
.incident-tab-list{min-height:180px}
.incident-tab-table{max-height:430px;border:1px solid #e1e7ed;border-radius:8px}
.incident-tab-table table{width:100%;min-width:760px}
.incident-tab-table tbody tr{cursor:pointer}
.incident-history-list{min-height:220px}
.incident-history-pagination{display:flex;justify-content:center;gap:6px;padding:12px 0 4px}
.incident-history-pagination button{min-width:36px;padding:6px 9px}
.incident-history-pagination button.active{background:#1f5d8f;color:#fff;border-color:#1f5d8f}
@media(max-width:900px){.incident-tab-heading{align-items:stretch;flex-direction:column}.incident-tab-heading>.customer-related-actions{margin-left:0}}

/* RC5 FIX4H3 */
.conformity-rejected{padding:8px 10px;border:1px solid #e7b8b8;border-radius:7px;background:#fff4f4;color:#8b1f1f}

/* RC5 FIX4H3A · autofiltros de incidencias */
.incident-list-table thead tr:first-child th{top:0}
.incident-list-table .incident-autofilter-row th{top:32px;padding:5px 6px;background:#eef3f7;z-index:3}
.incident-autofilter{width:100%;min-width:76px;padding:5px 6px;border-radius:6px;font-size:11px;font-weight:400;background:#fff}
.incident-autofilter-row th:nth-child(1){min-width:118px}
.incident-autofilter-row th:nth-child(2){min-width:185px}
.incident-autofilter-row th:nth-child(3){min-width:180px}
.incident-autofilter-row th:nth-child(4){min-width:150px}
.incident-list-table tr.filtered-out{display:none}

/* RC5 FIX4H3B · filtros contextuales de incidencias */
.incident-filter-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:7px 10px;border-bottom:1px solid #e2e8f0;background:#f8fafc;color:#64748b;font-size:11px}
.incident-filter-head{position:relative;display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:22px}
.incident-filter-button{width:24px;height:24px;min-width:24px;padding:0;border:1px solid transparent;border-radius:5px;background:transparent;color:#64748b;font-size:12px;line-height:22px}
.incident-filter-button:hover,.incident-filter-button.active-filter{background:#e8f1f8;border-color:#b9cfdf;color:#155d8f}
.incident-filter-button.active-filter{font-weight:800;box-shadow:inset 0 -2px 0 #155d8f}
.incident-filter-menu{position:absolute;z-index:40;top:29px;right:0;width:245px;padding:10px;background:#fff;border:1px solid #cfd9e3;border-radius:8px;box-shadow:0 10px 26px rgba(15,23,42,.18);font-weight:400;color:#1f2937}
.incident-filter-menu input[type="text"],.incident-filter-menu .filter-text,.incident-filter-menu select,.incident-filter-menu input[type="date"]{width:100%;margin:4px 0 7px;padding:7px 8px;font-size:12px}
.incident-filter-menu label{margin:0;font-size:12px;text-transform:none;letter-spacing:0;color:#334155;font-weight:500}
.incident-filter-menu .filter-check{display:flex;align-items:center;gap:8px;padding:5px 2px}
.incident-filter-menu .filter-check input{width:auto;margin:0}
.filter-menu-title{font-size:11px;font-weight:800;color:#64748b;text-transform:uppercase;letter-spacing:.04em;margin-bottom:6px}
.incident-filter-date{width:260px}.incident-filter-date label{display:block;margin-top:4px}
.incident-list-table tr.filtered-out{display:none}
.badge.WO-REJECTED{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}

/* RC5 FIX4H3C · filtros de incidencias flotantes, sin recorte por la tabla */
.incident-filter-menu{position:fixed;z-index:10000;top:auto;right:auto;left:0;width:270px;max-height:calc(100vh - 24px);overflow:auto;overscroll-behavior:contain}
.incident-filter-date{width:280px}
.incident-filter-menu .filter-check-list{max-height:250px;overflow:auto;margin:2px -2px 7px;padding:0 2px}
.incident-filter-menu .filter-option-search{width:100%;margin:4px 0 7px;padding:7px 8px;font-size:12px}
.incident-filter-menu .filter-clear-one{position:sticky;bottom:0;margin-top:4px;background:#e2e8f0}

/* RC5 FIX4H3D - compactación de dashboard, agenda y correo */
.agenda-controls-single{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;padding:12px 14px;overflow:visible}
.agenda-controls-single .agenda-period{flex:0 0 auto;flex-wrap:nowrap}
.agenda-controls-single .agenda-filters{flex:1 1 auto;min-width:0;flex-wrap:nowrap}
.agenda-controls-single .agenda-filters input{min-width:180px;flex:1 1 260px}
.agenda-controls-single .agenda-filters select{min-width:120px;max-width:190px}
.agenda-controls-single #agendaTech{min-width:155px}
.agenda-controls-single #agendaApply{flex:0 0 auto}
.email-history-panel{width:100%}
.email-history-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 16px}
.email-history-head h3{margin:0}
.email-history-head button{margin-left:auto;white-space:nowrap}
.email-history-body{width:100%;border-top:1px solid #e2e8f0}
.email-history-body .table-wrap{width:100%;max-height:none}
@media(max-width:1300px){.agenda-controls-single{flex-wrap:wrap}.agenda-controls-single .agenda-filters{width:100%}}


/* RC5 FIX4H3E · ficha de clientes por pestañas y gestión documental */
.customer-master-form{min-height:620px}.customer-tabs{display:flex;gap:4px;border-bottom:1px solid #d8e1ea;margin:-4px 0 12px}.customer-tab{border:0;background:transparent;border-radius:7px 7px 0 0;padding:10px 16px;font-weight:700;color:#64748b}.customer-tab.active{background:#eaf2f8;color:#155d8f;box-shadow:inset 0 -2px 0 #155d8f}.customer-tab-panel{min-height:455px}.customer-tab-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:4px 0 12px}.customer-tab-heading .selection-toolbar{flex-wrap:wrap;justify-content:flex-end}#customerDocumentsList .table-wrap{max-height:390px}.customer-tab-panel .empty.compact{margin-top:18px}

/* RC5 FIX4H3F · ficha de cliente estable, FACe compacto y contactos por centro */
#modal:has(.customer-master-form) .modal-card{width:min(1120px,94vw);height:min(780px,92vh);max-height:92vh}
#modal:has(.customer-master-form) #modalBody{flex:1 1 auto;min-height:0;overflow:hidden}
.customer-master-form{height:100%;min-height:0;display:flex;flex-direction:column;padding:14px 18px 0}
.customer-master-form>.form-grid{flex:1 1 auto;min-height:0;grid-template-rows:auto minmax(0,1fr);align-content:stretch}
.customer-master-form>.form-grid>.customer-tabs{align-self:start;margin-bottom:0}
.customer-master-form .customer-tab-panel{height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;padding:10px 5px 8px 0}
.customer-master-form>.form-actions{position:static;flex:0 0 auto;margin:0 -18px;padding:11px 18px;border-top:1px solid #e2e8f0}
.customer-face-panel{padding-top:7px!important}.face-enabled{margin:0 0 7px!important;padding:4px 2px}
.face-units-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px}
.customer-face-panel .face-unit{padding:7px 9px 2px;border-radius:8px}.customer-face-panel .face-unit legend{font-size:12px;padding:0 5px}
.customer-face-panel .face-grid{grid-template-columns:minmax(105px,.75fr) minmax(150px,1.25fr);gap:4px 7px}
.customer-face-panel .face-grid label{gap:3px;margin-bottom:3px;font-size:11px}.customer-face-panel input{height:31px;padding:5px 7px;font-size:12px}
.customer-face-panel .face-bank{margin-top:8px}.customer-face-panel .face-bank-grid{grid-template-columns:minmax(100px,.65fr) minmax(160px,1fr) minmax(230px,1.45fr)}
#customerDocumentsList .table-wrap{max-height:360px}
#subModal:has(.contacts-manager) .modal-card{width:min(900px,94vw);height:min(620px,86vh);max-height:86vh}
#subModal:has(.contacts-manager) #subModalBody{flex:1 1 auto;min-height:0;overflow:hidden}
.contacts-manager{height:100%;min-height:0;display:flex;flex-direction:column}.contacts-manager .modal-toolbar{flex:0 0 auto}.contacts-manager .contact-list{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:8px 16px 14px}.contacts-manager .contact-card{min-height:45px}
.contact-site-field{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end}.contact-site-field label{margin:0}.contact-site-field button{height:36px;white-space:nowrap}.site-badge{background:#e0f2fe;color:#075985}
@media(max-width:850px){#modal:has(.customer-master-form) .modal-card{width:96vw;height:92vh}.face-units-grid{grid-template-columns:1fr}.customer-face-panel .face-bank-grid{grid-template-columns:1fr}.contact-site-field{grid-template-columns:1fr}.contact-site-field button{width:100%}}

/* FIX4H3G · contactos asignados a centros */
.contact-sites-picker{margin-top:6px;border:1px solid #d8e1ea;border-radius:8px;padding:7px 9px;max-height:150px;overflow-y:auto;overflow-x:hidden;background:#fff;display:grid;gap:4px}
.contact-sites-picker .employee-check{margin:0;padding:5px 6px;border-radius:6px;align-items:flex-start}
.contact-sites-picker .employee-check:hover{background:#f8fafc}
.site-contact-assignment{margin:2px 0 4px}
.contact-sites-multi{align-items:start}.contact-sites-multi>button{margin-top:22px}
@media(max-width:850px){.contact-sites-multi>button{margin-top:0}}


/* RC5 FIX4H3G1 · estabilidad de filtros de Incidencias y gestión limpia de contactos en Centros */
.incident-list-panel{width:100%;min-width:0;overflow:hidden}
.incident-filter-toolbar{box-sizing:border-box;width:100%;min-height:39px;height:39px;flex:0 0 39px;padding:7px 10px;white-space:nowrap}
.incident-filter-toolbar #clearIncidentFilters{width:86px;min-width:86px;transition:none}
.incident-filter-toolbar #clearIncidentFilters.incident-clear-inactive{visibility:hidden;pointer-events:none}
.incident-list-wrap{box-sizing:border-box;width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;scrollbar-gutter:stable}
.incident-list-table{width:100%;min-width:1120px;table-layout:fixed;border-collapse:collapse}
.incident-list-table th,.incident-list-table td{box-sizing:border-box;overflow:hidden}
.incident-list-table th{white-space:nowrap}
.incident-list-table td{overflow-wrap:anywhere}
.incident-list-table th:nth-child(1),.incident-list-table td:nth-child(1),
.incident-list-table th:nth-child(5),.incident-list-table td:nth-child(5),
.incident-list-table th:nth-child(6),.incident-list-table td:nth-child(6),
.incident-list-table th:nth-child(7),.incident-list-table td:nth-child(7),
.incident-list-table th:nth-child(8),.incident-list-table td:nth-child(8){white-space:nowrap}
.incident-filter-head{width:100%;min-width:0}
.incident-filter-head>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.incident-filter-button{flex:0 0 24px}

.site-contact-assignment{border:1px solid #d8e1ea;border-radius:9px;background:#fbfdff;padding:10px 12px}
.site-contact-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:9px}
.site-contact-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap}
.site-contact-actions button{white-space:nowrap}
.site-assigned-contacts{height:170px;min-height:170px;max-height:170px;overflow:hidden;background:#fff;border:1px solid #e2e8f0;border-radius:8px}
.site-contact-table-wrap{height:100%;max-height:100%;overflow:auto;scrollbar-gutter:stable}
.site-contact-table{width:100%;table-layout:fixed}
.site-contact-table th:nth-child(1){width:24%}.site-contact-table th:nth-child(2){width:20%}.site-contact-table th:nth-child(3){width:14%}.site-contact-table th:nth-child(4){width:14%}.site-contact-table th:nth-child(5){width:28%}
.site-contact-table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.site-existing-contact-list{margin-top:8px;border:1px solid #d8e1ea;border-radius:8px;padding:7px;max-height:330px;overflow-y:auto;display:grid;gap:4px}
.site-existing-contact-list .employee-check{margin:0;padding:7px 8px;border-radius:6px}
.site-existing-contact-list .employee-check:hover{background:#f8fafc}
@media(max-width:900px){.site-contact-head{align-items:stretch;flex-direction:column}.site-contact-actions{justify-content:flex-start}.site-assigned-contacts{height:190px;min-height:190px;max-height:190px}}

/* RC5 FIX4H3G2 · ajuste visual y operativo contactos/centros */
.contact-sites-section{min-width:0}
.contact-sites-title{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:7px}
.contact-sites-title .compact-action{flex:0 0 auto;height:34px;padding:0 12px;white-space:nowrap}
.contact-site-context{border:1px solid #d8e1ea;border-radius:8px;background:#f8fafc;padding:10px 12px;min-height:54px}
.site-contact-head{display:grid;grid-template-columns:minmax(180px,1fr) auto;align-items:end;gap:12px}
.site-contact-actions{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-end;gap:6px}
.site-contact-actions button{height:36px;padding:0 11px;white-space:nowrap}
.site-existing-picker{display:flex;flex-direction:column;min-height:240px;max-height:65vh}
.site-existing-picker .site-existing-contact-list{flex:1 1 auto;min-height:120px}
@media(max-width:820px){.site-contact-head{grid-template-columns:1fr;align-items:stretch}.site-contact-actions{justify-content:flex-start;flex-wrap:wrap}.contact-sites-title{align-items:stretch;flex-direction:column}.contact-sites-title .compact-action{align-self:flex-start}}

/* RC5 FIX4H3H7 · cartera de incidencias por estado */
.incident-status-visibility{display:flex;align-items:center;gap:18px;padding:10px 12px;margin-bottom:10px;min-height:58px}
.incident-status-visibility>div:first-child{min-width:155px}
.incident-status-options{display:flex;align-items:center;gap:6px;flex:1;flex-wrap:wrap}
.incident-status-option{display:flex;align-items:center;gap:5px;margin:0;padding:6px 9px;border:1px solid #d7e0e8;border-radius:16px;background:#fff;color:#334155;font-size:12px;text-transform:none;letter-spacing:0;white-space:nowrap;cursor:pointer}
.incident-status-option input{width:auto;margin:0}
.incident-status-actions{display:flex;align-items:center;gap:6px;white-space:nowrap}
@media(max-width:1050px){.incident-status-visibility{align-items:flex-start;flex-wrap:wrap}.incident-status-options{order:3;flex-basis:100%}}

/* RC5 FIX4H3H8B · información de incidencia y conformidad integrada en el parte */
#subModal:has(.incident-info-readonly) .modal-card{width:min(760px,94vw);max-height:min(720px,88vh)}
#subModal:has(.incident-info-readonly) #subModalBody{padding:0;overflow-y:auto}
.incident-info-readonly{padding:18px 20px 20px;display:grid;gap:14px}
.incident-info-readonly section{border:1px solid #e2e8f0;border-radius:8px;padding:12px 14px;background:#fff;min-width:0}
.incident-info-readonly section h4{margin:0 0 7px;color:#1e293b}
.incident-info-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45;color:#334155;min-height:20px}
.incident-info-internal{background:#f8fafc!important}
.incident-info-note{padding:10px 12px;border-radius:7px;background:#f1f5f9;color:#64748b;font-size:12px;line-height:1.4}
.conformity-work-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,.8fr);gap:18px;align-items:start}
.conformity-visual{min-height:150px;border:1px solid #d9e2ea;border-radius:9px;padding:14px;background:#f8fafc;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:7px}
.conformity-visual-title{font-weight:800;color:#1e293b}
.signature-visible img{display:block;max-width:100%;width:auto;max-height:145px;object-fit:contain;background:#fff;border-bottom:1px solid #64748b;padding:6px;margin:2px auto 4px}
.conformity-method-visible b{font-size:16px}.conformity-method-visible span{display:block}
@media(max-width:850px){.conformity-work-grid{grid-template-columns:1fr}.conformity-visual{min-height:120px}}

/* RC6 FIX1 · Datos generales equilibrados y bloque operativo a ancho completo */
.incident-general-sections{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
.incident-general-sections>.incident-equal-card{height:100%}
.incident-general-sections>.span-all{grid-column:1/-1}
.incident-operational-card{margin-top:0}
.incident-operational-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px 14px;align-items:end}
.incident-operational-grid label{min-width:0}
.incident-operational-grid .incident-billable{align-self:center;margin-top:20px}
.incident-wide-field{grid-column:span 2}
.incident-admin-fields{grid-column:span 2;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}
.incident-admin-documents-panel{margin-top:16px;border-color:#cad5e1;background:#f8fafc}
@media(max-width:900px){.incident-operational-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.incident-wide-field,.incident-admin-fields{grid-column:1/-1}}
@media(max-width:600px){.incident-operational-grid,.incident-admin-fields{grid-template-columns:1fr}.incident-wide-field,.incident-admin-fields{grid-column:1}}

/* RC6 FIX2 · Datos generales compactos sin scroll: clasificación junto a descripción */
#modal:has(.incident-tabs) .modal-card{width:min(1420px,98vw);height:min(900px,96vh);max-height:96vh}
.incident-general-compact{grid-template-columns:minmax(420px,.9fr) minmax(560px,1.1fr);gap:10px;align-items:stretch}
.incident-left-column{display:grid;grid-template-rows:auto auto;gap:12px;min-width:0}
.incident-general-compact .incident-section-card{padding:10px 12px}
.incident-general-compact .incident-section-title{margin-bottom:6px;padding-bottom:4px}
.incident-general-compact .nested-grid{gap:7px 12px}
.incident-description-card{display:flex;flex-direction:column;min-height:0}
.incident-description-status-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px 12px;align-items:end;margin-bottom:10px}
.incident-pending-reason{grid-column:1/-1}
.incident-description-fields{display:grid;grid-template-columns:1fr;gap:9px;min-height:0;flex:1 1 auto}
.incident-description-fields label:last-child{display:flex;flex-direction:column;min-height:0}
.incident-description-fit{min-height:145px;height:100%;max-height:none;resize:none;flex:1 1 auto}
.incident-administrative-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px 12px;align-items:end}
.incident-admin-billable{align-self:center;min-height:38px;margin-top:18px}
#modal:has(.incident-tabs) .incident-tab-panel[data-panel="general"]{padding-top:4px}
#modal:has(.incident-tabs) .incident-tab-panel[data-panel="general"] .location-preview{min-height:36px;padding:8px 10px}
#modal:has(.incident-tabs) .incident-tab-panel[data-panel="general"] input,
#modal:has(.incident-tabs) .incident-tab-panel[data-panel="general"] select{min-height:38px}
@media(min-width:901px){
 #modal:has(.incident-tabs) .incident-tab-panel[data-panel="general"]{overflow:visible}
}
@media(max-width:1100px){
 .incident-general-compact{grid-template-columns:minmax(380px,.95fr) minmax(480px,1.05fr)}
 .incident-description-status-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:900px){
 #modal:has(.incident-tabs) .modal-card{width:98vw;height:96vh}
 .incident-general-compact{grid-template-columns:1fr;align-items:start}
 .incident-description-status-grid{grid-template-columns:1fr 1fr}
 .incident-description-status-grid label:nth-child(3){grid-column:1/-1}
 .incident-description-fit{min-height:180px;resize:vertical}
}
@media(max-width:600px){
 .incident-administrative-grid,.incident-description-status-grid{grid-template-columns:1fr}
 .incident-description-status-grid label:nth-child(3){grid-column:auto}
}

/* RC6 FIX2B · descripción breve compacta y referencias administrativas bloqueadas hasta Cerrada */
.incident-description-fields>label:first-child input{height:38px;min-height:38px}
.incident-description-fields>label:last-child{flex:1 1 auto}
.incident-description-fit{min-height:220px}
.incident-administrative-grid input:disabled{background:#f1f5f9;color:#64748b;cursor:not-allowed}
@media(min-width:901px){
  .incident-description-card{height:100%}
  .incident-description-fields{grid-template-rows:auto minmax(250px,1fr)}
  .incident-description-fit{height:100%;min-height:250px}
}

/* RC7 FIX4 · campos obligatorios y validación visible */
.required-marker{color:#b42318;font-weight:800;margin-left:2px}
.field-invalid{outline:2px solid #b42318!important;outline-offset:1px;border-color:#b42318!important}

/* RC7 FIX5 · obligatorios junto a etiqueta y cierre técnico de partes bloqueados */
.required-caption{display:inline!important;white-space:normal}.required-caption .required-marker{display:inline!important;margin-left:2px}.locked-technical-close{margin-top:10px;padding:10px 12px;border:1px solid #d9e2ea;border-radius:8px;background:#f8fafc}.locked-technical-close p{margin:0 0 8px}

/* RC7 FIX6: navegación fija y scroll exclusivo del área de trabajo */
@media(min-width:851px){
 html,body{height:100%;overflow:hidden}
 .app{height:100vh;min-height:0;overflow:hidden}
 aside{height:100vh;min-height:0;overflow-y:auto;position:relative}
 main{height:100vh;min-height:0;overflow:hidden;display:flex;flex-direction:column}
 main>header{flex:0 0 auto}
 #content{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}
}
/* Firma presencial debajo del estado de conformidad */
.conformity-work-grid.signature-below{grid-template-columns:1fr}
.conformity-work-grid.signature-below .signature-visible{margin-top:10px;max-width:520px}

/* RC7 FIX7: conformidad compacta y unificada */
.conformity-work-grid{grid-template-columns:1fr!important}
.conformity-work-grid .signature-visible{margin-top:10px;max-width:520px}
.conformity-work-grid .signature-visible img{display:block;max-width:100%;height:auto}

/* RC7 FIX8 · carga documental por arrastre */
.customer-doc-dropzone{border:2px dashed #b8c5d1;border-radius:10px;padding:22px;display:flex;align-items:center;justify-content:center;gap:9px;flex-wrap:wrap;text-align:center;background:#f8fafc;color:#475569;transition:border-color .15s,background .15s}
.customer-doc-dropzone.drag-over{border-color:#1d5f91;background:#eef6fb}
.customer-doc-file-button{display:inline-flex!important;margin:0!important;gap:0!important;background:#1d5f91;color:#fff;border-radius:8px;padding:9px 13px;cursor:pointer;font-weight:700}
.customer-doc-file-input{position:absolute!important;opacity:0!important;width:1px!important;height:1px!important;padding:0!important;border:0!important;pointer-events:none}
.customer-doc-dropzone .tiny{flex-basis:100%;margin-top:4px;overflow-wrap:anywhere}

/* RC7 FIX8 · agenda semanal gráfica */
.week-calendar{margin-top:10px;overflow:hidden}.week-head{display:grid;grid-template-columns:58px repeat(7,minmax(120px,1fr));border-bottom:1px solid #cbd5e1;background:#f8fafc}.week-head>div{border-right:1px solid #dbe3ea}.week-day-head{border-radius:0;background:transparent;border-right:1px solid #dbe3ea;padding:8px 5px;display:grid;gap:2px;text-align:center}.week-day-head b{font-size:13px}.week-day-head span{font-size:11px;color:#64748b}.week-day-head.today{background:#eef6fb;color:#1d5f91;box-shadow:inset 0 -3px 0 #1d5f91}.week-scroll{display:grid;grid-template-columns:58px minmax(840px,1fr);max-height:calc(100vh - 245px);overflow:auto;background:#fff}.week-time-axis{background:#f8fafc;border-right:1px solid #cbd5e1}.week-time-axis>div{position:relative;border-bottom:1px solid #e2e8f0}.week-time-axis span{position:absolute;right:7px;top:-7px;font-size:10.5px;color:#64748b;background:#f8fafc;padding:0 2px}.week-days{display:grid;grid-template-columns:repeat(7,minmax(120px,1fr));position:relative;background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 63px,#e2e8f0 63px,#e2e8f0 64px)}.week-day-column{position:relative;border-right:1px solid #dbe3ea;min-width:0}.week-day-column.today{background:rgba(29,95,145,.035)}.week-event{position:absolute;display:flex;flex-direction:column;align-items:flex-start;gap:1px;overflow:hidden;text-align:left;padding:5px 6px;border:1px solid #cbd5e1;border-left-width:4px;border-radius:5px;background:#f8fafc;z-index:1;font-size:10.5px;line-height:1.2}.week-event span,.week-event small{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.week-event small{font-size:9.5px;color:#64748b}.week-event.priority-URGENT{border-left-color:#b91c1c;background:#fef2f2}.week-event.priority-HIGH{border-left-color:#c2410c;background:#fff7ed}.week-event.priority-NORMAL{border-left-color:#2563eb;background:#eff6ff}.week-event.priority-LOW{border-left-color:#64748b;background:#f8fafc}.week-event.selected-event{outline:2px solid #1d5f91;outline-offset:1px;z-index:3}@media(max-width:900px){.week-scroll{grid-template-columns:52px minmax(840px,1fr)}.week-head{grid-template-columns:52px repeat(7,minmax(120px,1fr));overflow:hidden}}
.security-columns{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(320px,.85fr);gap:16px;align-items:start}.section-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.section-title h3{margin:0}.profile-list{display:flex;flex-direction:column;gap:7px}.profile-row{width:100%;display:flex;align-items:center;justify-content:space-between;text-align:left;padding:10px 12px;background:var(--panel,#fff);border:1px solid #dfe5eb;border-radius:8px}.profile-row:hover{background:#f6f8fa}.profile-row span:first-child{display:flex;flex-direction:column;gap:2px}.profile-row small,.permission-check small{display:block;color:#6b7280;font-size:11px}.permission-grid,.permissions-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;max-height:390px;overflow:auto;border:1px solid #e1e6eb;border-radius:8px;padding:9px;background:#fafbfc}.permission-check{display:flex;align-items:flex-start;gap:8px;border:1px solid #e6eaee;border-radius:7px;padding:8px;background:#fff}.permission-check input{margin-top:3px}.security-secret{padding:12px;border:1px solid #d9e1e8;border-radius:8px;background:#f7f9fb;margin:10px 0;word-break:break-all}.recovery-codes{font-size:16px;line-height:1.8;letter-spacing:1px}.compact-panel{padding:12px}.form-actions.left{justify-content:flex-start}@media(max-width:1100px){.security-columns{grid-template-columns:1fr}.permission-grid,.permissions-list{grid-template-columns:1fr}}

/* RC9 FIX1: Mi cuenta y empleados */
.account-view{padding:14px 18px 16px}.account-summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px;border:1px solid #dce4eb;border-radius:10px;background:#fff}.account-summary>div{display:flex;flex-direction:column;gap:4px}.account-summary>div>b{font-size:15px}.account-summary>div>span{font-size:12px;color:#64748b}.account-2fa-status{font-size:12px;font-weight:700;background:#f1f5f9;border-radius:999px;padding:5px 9px;white-space:nowrap}.account-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.account-help{font-size:11px;color:#64748b;margin-top:9px}.employee-user-link{padding:9px 11px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc}.employee-user-link .tiny{margin-top:3px}
.totp-qr-wrap{display:flex;justify-content:center;align-items:center;margin:10px 0}.totp-qr{width:220px;height:220px;max-width:100%;background:#fff;padding:8px;border:1px solid #d8dee8;border-radius:10px}.employee-tab-panel{width:100%}.inline-security-actions{justify-content:flex-start;margin-top:4px}.totp-setup{text-align:center}.totp-setup .security-secret{text-align:left;margin-top:8px}

/* RC9 FIX3 · ficha de empleado estable entre pestañas */
#modal:has(.employee-master-form) .modal-card{width:min(940px,94vw);height:min(690px,90vh)}
#modal:has(.employee-master-form) #modalBody{flex:1 1 auto;min-height:0}
#modal:has(.employee-master-form) .employee-master-form{min-height:100%;display:flex;flex-direction:column}
#modal:has(.employee-master-form) .employee-master-form>.form-grid{flex:1 1 auto;align-content:start}
#modal:has(.employee-master-form) .employee-master-form>.form-actions{margin-top:auto}
.employee-general-grid .employee-active-check{align-self:end;min-height:42px;padding-bottom:9px}
@media(max-width:650px){#modal:has(.employee-master-form) .modal-card{height:min(760px,94vh)}}

/* RC9 FIX4 · catálogo de permisos y ámbitos por perfil */
.permission-sections{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start}
.permission-section{border:1px solid #dfe5eb;border-radius:10px;background:#f8fafc;padding:10px;min-width:0}
.permission-section h4{margin:0 0 8px;font-size:13px;color:#334155}
.permission-section .permissions-list{grid-template-columns:1fr;max-height:none;overflow:visible;border:0;padding:0;background:transparent}
.profile-scope-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:10px;border:1px solid #dfe5eb;border-radius:10px;background:#f8fafc}
@media(max-width:820px){.permission-sections,.profile-scope-grid{grid-template-columns:1fr}}

/* RC9 FIX5 · perfiles compactos por pestañas, tamaño fijo y switches */
#modal:has(.role-profile-form) .modal-card{width:min(1060px,94vw);height:min(720px,92vh)}
#modal:has(.role-profile-form) #modalBody{flex:1 1 auto;min-height:0;overflow:hidden}
.role-profile-form{height:100%;min-height:0;display:flex;flex-direction:column;padding:14px 18px 0}
.role-profile-general{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1.4fr) minmax(190px,.8fr);gap:8px 10px;align-items:end;flex:0 0 auto}
.role-profile-general label{gap:4px}.role-profile-general input,.role-profile-general select{padding:7px 9px}
.role-profile-general .role-active-check{align-self:end;min-height:37px;display:flex;align-items:center;padding:0 4px 6px}
.profile-permissions-area{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;margin-top:10px}
.profile-permission-tabs{display:flex;flex-wrap:wrap;gap:4px;padding:6px;border:1px solid #dfe5eb;border-radius:9px 9px 0 0;background:#f8fafc;flex:0 0 auto}
.profile-permission-tab{padding:5px 8px;border-radius:6px;font-size:11.5px;line-height:1.15;white-space:nowrap;background:#fff;border:1px solid #dfe5eb;color:#334155}
.profile-permission-tab.active{background:#1f6797;color:#fff;border-color:#1f6797;font-weight:700}
.profile-permission-panels{flex:1 1 auto;min-height:0;border:1px solid #dfe5eb;border-top:0;border-radius:0 0 9px 9px;background:#f8fafc;padding:10px;overflow:hidden}
.profile-permission-panel{display:none;height:100%;overflow:hidden}.profile-permission-panel.active{display:block}
.permission-switch-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px;align-content:start}
.permission-switch-row{min-height:38px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 9px;border:1px solid #e1e7ed;border-radius:7px;background:#fff;font-size:12.5px;font-weight:650;color:#243244}
.switch-control{position:relative;display:inline-flex;flex:0 0 auto;width:38px;height:21px}.switch-control input{position:absolute;opacity:0;width:1px;height:1px}.switch-slider{position:absolute;inset:0;border-radius:999px;background:#cbd5e1;transition:.15s;box-shadow:inset 0 0 0 1px rgba(15,23,42,.08)}.switch-slider:before{content:"";position:absolute;width:17px;height:17px;left:2px;top:2px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(15,23,42,.25);transition:.15s}.switch-control input:checked + .switch-slider{background:#1f6797}.switch-control input:checked + .switch-slider:before{transform:translateX(17px)}.switch-control input:focus-visible + .switch-slider{outline:2px solid #60a5fa;outline-offset:2px}.switch-control input:disabled + .switch-slider{opacity:.6;cursor:not-allowed}
.role-profile-form>.form-actions{flex:0 0 auto;margin:10px -18px 0;padding:10px 18px;border-top:1px solid #e2e8f0;background:#fff}
@media(max-width:760px){#modal:has(.role-profile-form) .modal-card{width:96vw;height:94vh}.role-profile-general{grid-template-columns:1fr 1fr}.permission-switch-grid{grid-template-columns:1fr}.profile-permission-tab{font-size:10.5px;padding:4px 6px}}

/* RC10 FIX1 · copias de seguridad con espaciado homogéneo */
.backup-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:stretch}.backup-card{display:flex;flex-direction:column;gap:11px;min-height:0;padding:17px 20px}.backup-card h3,.backup-list-panel h3{margin:0}.backup-card p{margin:0;line-height:1.45}.backup-card>button{align-self:flex-start;margin-top:2px}.backup-card input[type=file]{max-width:100%;padding:9px 10px;border:1px solid #d9e2ea;border-radius:8px;background:#fff}.backup-manual,.backup-security{min-height:150px}.backup-security .form{padding:0;margin:0;gap:9px}.backup-password-status{display:flex;align-items:center;gap:8px}.backup-password-status .status-dot{width:9px;height:9px;border-radius:50%;background:#2f9e44}.backup-restore,.backup-schedule{min-height:230px}.backup-schedule{grid-column:auto;padding:17px 20px}.backup-schedule .form{padding:0;margin-top:2px}.backup-schedule .form-grid{gap:11px 14px}.backup-schedule .form-grid label{margin-bottom:0}.backup-schedule-status{display:flex;gap:16px;flex-wrap:wrap;padding:9px 11px;margin-top:2px;border:1px solid #e1e7ed;border-radius:8px;background:#f8fafc;font-size:12px}.backup-schedule .form-actions{padding-top:8px}.backup-password-label{display:flex;flex-direction:column;gap:6px;font-weight:600;max-width:520px}.backup-password-label>input{width:100%}.backup-list-panel{grid-column:1/-1;padding:18px 22px}.backup-list-panel .section-title{margin-bottom:14px}.backup-actions{display:flex;gap:7px;justify-content:flex-end;white-space:nowrap}.backup-emergency{margin-top:16px;border-top:1px solid #e2e8f0;padding-top:12px}.backup-emergency summary{cursor:pointer;font-weight:700;margin-bottom:8px}@media(max-width:800px){.backup-grid{grid-template-columns:1fr}.backup-list-panel{grid-column:auto}.backup-actions{flex-wrap:wrap}}

/* RC10 FIX1 · Configuración agrupada y desplegable según permisos */
.nav-group{display:grid;gap:4px;margin-top:2px}.nav-group-toggle{display:flex;align-items:center;justify-content:space-between;width:100%;background:transparent;color:#c8d4df;text-align:left;padding:10px 12px}.nav-group-toggle.active,.nav-group-toggle:hover{background:#23425f;color:white}.nav-chevron{font-size:12px;transition:transform .15s}.nav-group-toggle[aria-expanded="true"] .nav-chevron{transform:rotate(180deg)}.nav-submenu{display:grid;gap:3px;padding:2px 0 4px 12px}.nav-submenu button{padding:8px 10px;font-size:12.5px;border-left:2px solid #365670;border-radius:6px}.nav-submenu button.active{border-left-color:#8fc3e8;background:#23425f;color:#fff}
@media(max-width:850px){.nav-group{display:flex;align-items:stretch;flex:0 0 auto}.nav-group-toggle{white-space:nowrap}.nav-submenu{display:flex;padding:0 0 0 4px}.nav-submenu.hidden{display:none!important}.nav-submenu button{white-space:nowrap;border-left:0;border-bottom:2px solid #365670}}

/* RC11 · Artículos y familias FACTUSOL */
.article-module{display:grid;gap:10px}.article-tabs{margin:0}.article-tab-panel>.panel{padding:16px 18px}.article-toolbar{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:12px}.article-toolbar input{min-width:320px;max-width:620px;flex:1}.article-toolbar .muted{margin-left:auto;white-space:nowrap}.article-family-toolbar input{min-width:250px}.article-sync-note{padding:9px 11px;margin:-2px 0 12px;border:1px solid #dbe3ea;border-radius:8px;background:#f8fafc}.article-table-wrap{max-height:calc(100vh - 235px);overflow-y:auto;overflow-x:hidden}.article-table{width:100%;min-width:0;table-layout:fixed}.article-table tbody tr{cursor:pointer}.article-table tbody tr:hover{background:#f7fafc}.article-table th{position:sticky;top:0;z-index:2;background:#f8fafc}.article-family-switch{margin:auto}.article-tabs .tiny{margin-left:4px;opacity:.8}.daily-material-row .mat-code,.daily-material-row .mat-description{background-color:#fff}
@media(max-width:800px){.article-toolbar input{min-width:100%;width:100%}.article-toolbar .muted{margin-left:0}.article-table-wrap{max-height:none}}
/* RC11 FIX2 · selector de familias y catálogo de materiales */
.article-toolbar select{min-width:260px;max-width:420px}.daily-material-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.daily-material-head select{min-width:260px;max-width:440px}
@media(max-width:800px){.article-toolbar select,.daily-material-head select{min-width:100%;max-width:none;width:100%}.daily-material-head{align-items:stretch;flex-direction:column}}
/* RC12 - selector de materiales en partes */
.daily-material-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.rc12-material-labels,.rc12-material-row{grid-template-columns:110px minmax(260px,2fr) minmax(180px,1fr) 95px 38px!important}
.rc12-material-row{align-items:center}
.mat-code-view,.mat-description-view,.mat-family-view{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mat-code-view{font-weight:600}.mat-family-view{font-size:12px;color:var(--muted)}
.article-picker-filters{display:grid;grid-template-columns:minmax(240px,1fr) minmax(300px,2fr);gap:12px;margin-bottom:12px}
.article-picker-table{max-height:430px;overflow:auto}.article-picker-table tr[data-article-id]{cursor:pointer}
.article-picker-table tr[data-article-id]:hover{background:rgba(0,0,0,.035)}
@media(max-width:900px){.rc12-material-labels{display:none!important}.rc12-material-row{grid-template-columns:1fr 90px 38px!important}.mat-code-view,.mat-family-view{display:none}.article-picker-filters{grid-template-columns:1fr}}


/* RC12 FIX1 - materiales y selector de artículos más compactos */
.daily-page .rc12-material-labels,
.daily-page .rc12-material-row{grid-template-columns:105px minmax(300px,1fr) 88px 34px!important;gap:7px;font-size:11.5px}
.daily-page .rc12-material-labels{font-size:10px}
.daily-page .rc12-material-row{padding:1px 0}
.daily-page .rc12-material-row .mat-code-view,
.daily-page .rc12-material-row .mat-description-view{font-size:11.5px;line-height:1.25}
.daily-page .rc12-material-row .mat-quantity{height:32px;padding:5px 7px;font-size:11.5px}
.daily-page .daily-material-actions button{padding:6px 9px;font-size:11.5px}
#subModal:has(.article-picker) .modal-card{width:min(920px,92vw);max-height:82vh}
#subModal:has(.article-picker) .modal-head{padding:10px 14px}
#subModal:has(.article-picker) .modal-head h3{font-size:17px}
.article-picker{font-size:11.5px;padding-bottom:2px}
.article-picker-filters{grid-template-columns:minmax(220px,.8fr) minmax(300px,1.6fr);gap:10px;margin-bottom:8px}
.article-picker-filters label{font-size:11px;margin-bottom:4px;gap:4px}
.article-picker-filters input,.article-picker-filters select{height:34px;padding:6px 8px;font-size:11.5px}
.article-picker-table{max-height:350px;overflow:auto}
.article-picker-table table{font-size:11.5px}
.article-picker-table th{padding:7px 8px;font-size:10.5px}
.article-picker-table td{padding:5px 8px;line-height:1.2}
.article-picker-table .article-pick-add{padding:5px 9px;font-size:10.5px;border-radius:6px}
.article-picker>.tiny{font-size:10px;margin-top:5px}
@media(max-width:900px){
 .daily-page .rc12-material-row{grid-template-columns:1fr 80px 34px!important}
 .daily-page .rc12-material-row .mat-code-view{display:none}
 #subModal:has(.article-picker) .modal-card{width:96vw;max-height:90vh}
}

/* RC12 FIX2 - tipografía homogénea y selector de artículos con más aire */
.daily-page .daily-work-description{font-size:12px;line-height:1.4}
.daily-page .rc12-material-labels,
.daily-page .rc12-material-row{font-size:12px}
.daily-page .rc12-material-row .mat-code-view,
.daily-page .rc12-material-row .mat-description-view{font-size:12px;line-height:1.3}
.daily-page .rc12-material-row .mat-quantity{font-size:12px}
.daily-page .daily-material-actions button{font-size:12px}

#subModal:has(.article-picker) .modal-card{width:min(1080px,94vw);max-height:88vh}
#subModal:has(.article-picker) .modal-head{padding:13px 20px}
#subModal:has(.article-picker) .modal-head h3{font-size:18px}
.article-picker{font-size:12px;padding:14px 20px 12px}
.article-picker-filters{grid-template-columns:minmax(260px,.9fr) minmax(380px,1.8fr);gap:16px;margin-bottom:14px}
.article-picker-filters label{font-size:12px;margin-bottom:0;gap:6px}
.article-picker-filters input,.article-picker-filters select{height:36px;padding:7px 9px;font-size:12px}
.article-picker-table{max-height:430px;overflow:auto;border:1px solid #e5e9ef;border-radius:8px}
.article-picker-table table{font-size:12px}
.article-picker-table th{padding:8px 10px;font-size:11px}
.article-picker-table td{padding:7px 10px;line-height:1.25}
.article-picker-table .article-pick-add{padding:6px 10px;font-size:11px;border-radius:6px}
.article-picker>.tiny{font-size:10.5px;margin-top:8px}

.manual-material-modal .form{font-size:12px}
.manual-material-modal .form label{font-size:12px}
.manual-material-modal .form input,
.manual-material-modal .form select,
.manual-material-modal .form textarea{font-size:12px}

@media(max-width:900px){
 #subModal:has(.article-picker) .modal-card{width:96vw;max-height:92vh}
 .article-picker{padding:12px 14px 10px}
 .article-picker-filters{grid-template-columns:1fr;gap:10px}
}


/* RC12 FIX3 - tipografía de materiales y recuperación de gestión de centros */
/* Trabajo realizado vuelve a heredar la tipografía original del parte. */
.daily-page .daily-work-description{font-size:inherit;line-height:inherit}
/* Materiales utilizados con la misma escala tipográfica de los formularios de Clientes. */
.daily-page .rc12-material-labels{font-size:11px}
.daily-page .rc12-material-row,
.daily-page .rc12-material-row .mat-code-view,
.daily-page .rc12-material-row .mat-description-view,
.daily-page .rc12-material-row .mat-quantity{font-size:13px}
.daily-page .rc12-material-row .mat-code-view,
.daily-page .rc12-material-row .mat-description-view{line-height:1.35}
.daily-page .daily-material-actions button{font-size:13px}
/* Material manual: misma tipografía y espaciado base que la ficha de Clientes. */
#subModal:has(.manual-material-modal) .modal-card{width:min(760px,94vw)}
.manual-material-modal .form{font-size:13px;padding:15px 18px}
.manual-material-modal .form label{font-size:13px;gap:6px;margin-bottom:8px}
.manual-material-modal .form input,
.manual-material-modal .form select,
.manual-material-modal .form textarea{font-size:13px;padding:8px 9px}
/* Centro / instalación */
#modal:has(.site-master-form) .modal-card{width:min(900px,94vw);max-height:90vh}
.site-master-form{font-size:13px}
.site-contacts-picker{max-height:170px;overflow:auto;align-items:flex-start}
.site-contacts-picker .employee-check span{display:grid;gap:1px}
.site-contacts-picker .employee-check small{font-size:11px;color:#64748b;font-weight:400}

/* RC13 — Auditoría de accesos */
.audit-filter-panel{padding:14px 16px;overflow:visible}
.audit-filters{display:grid;grid-template-columns:150px 150px minmax(220px,1fr) 210px auto auto;gap:10px;align-items:end}
.audit-filters label{margin:0;font-size:12px;color:#475569;font-weight:600}
.audit-filters input,.audit-filters select{margin-top:4px;width:100%;font-size:12.5px}
.audit-list-panel{margin-top:12px}
.audit-table-wrap{max-height:calc(100vh - 255px)}
.audit-table{min-width:780px}
.audit-table th:nth-child(1){width:175px}.audit-table th:nth-child(2){width:250px}.audit-table th:nth-child(3){width:220px}.audit-table th:nth-child(4){width:165px}.audit-table th:nth-child(5){width:90px}
.audit-ip{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}
.audit-pagination{display:flex;align-items:center;justify-content:center;gap:14px;padding:10px 14px;border-top:1px solid #e2e8f0;background:#fafcff;color:#64748b;font-size:12px}
.audit-pagination button{padding:6px 10px}
@media(max-width:1000px){.audit-filters{grid-template-columns:1fr 1fr}.audit-filters button{width:100%}}


/* RC13 FIX1 — auditoría compacta sin scroll interno y normalización visual */
.audit-list-panel{overflow:visible}
.audit-table-wrap{max-height:none;overflow:visible}
.audit-table{min-width:0;table-layout:fixed}
.audit-table th,.audit-table td{padding:6px 9px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.audit-table th:nth-child(1){width:165px}
.audit-table th:nth-child(2){width:230px}
.audit-table th:nth-child(3){width:230px}
.audit-table th:nth-child(4){width:150px}
.audit-table th:nth-child(5){width:80px}
.audit-pagination{padding:8px 12px}

/* RC15 · Administración de aplicación móvil */
.mobile-admin-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:14px}.mobile-admin-head h2{margin:4px 0 4px}.mobile-admin-head p{margin:0;color:var(--muted)}.mobile-admin-actions{display:flex;gap:10px;flex-wrap:wrap}.mobile-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:14px}.mobile-kpis .panel{padding:20px}.mobile-kpis b{display:block;font-size:25px;margin-bottom:6px}.mobile-kpis span{font-size:12px;color:var(--muted)}.mobile-tabs{display:flex;gap:6px;border-bottom:1px solid var(--border);margin-bottom:14px}.mobile-tabs button{border:0;background:transparent;border-radius:0;padding:12px 16px;border-bottom:3px solid transparent}.mobile-tabs button.active{color:var(--primary);border-bottom-color:var(--primary);font-weight:800}.mobile-device-panel{padding:0;overflow:hidden}.mobile-device-panel .section-title{padding:18px 20px}.mobile-device-actions{display:flex;gap:8px;white-space:nowrap}.mobile-device-panel code{font-size:11px;background:var(--bg);padding:5px 8px;border-radius:8px}.mobile-qr-grid,.mobile-test-grid{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:14px}.mobile-qr-box{display:flex;justify-content:center;align-items:center;background:#fff;border:1px solid var(--border);border-radius:14px;padding:16px;margin:14px 0}.mobile-qr-box img{width:min(100%,420px);height:auto}.mobile-connection>div{display:grid;grid-template-columns:150px 1fr;gap:14px;padding:13px 0;border-bottom:1px solid var(--border)}.mobile-connection span{color:var(--muted);font-size:12px}.mobile-connection b{overflow-wrap:anywhere}.mobile-checks{margin:0;padding-left:24px}.mobile-checks li{padding:13px 0;border-bottom:1px solid var(--border);color:var(--muted)}.tiny.strong{font-weight:800;color:var(--primary)}@media(max-width:1000px){.mobile-kpis{grid-template-columns:repeat(2,1fr)}.mobile-qr-grid,.mobile-test-grid{grid-template-columns:1fr}}@media(max-width:650px){.mobile-admin-head{display:block}.mobile-admin-actions{margin-top:12px}.mobile-kpis{grid-template-columns:1fr}.mobile-tabs{overflow-x:auto}}

/* RC15 FIX1 · QR/configuración más compactos */
.mobile-qr-grid{grid-template-columns:minmax(360px,.72fr) minmax(0,1.28fr);gap:12px}
.mobile-qr-grid>.panel{padding:16px 18px}
.mobile-qr-grid h3{margin:0 0 4px}
.mobile-qr-grid p{margin:0 0 8px}
.mobile-qr-box{padding:8px;margin:8px auto;max-width:310px}
.mobile-qr-box img{width:260px;max-width:100%;height:auto}
.mobile-connection>div{grid-template-columns:120px 1fr;padding:9px 0}
.mobile-connection span{font-size:11px}
.mobile-connection b{font-size:13px}
@media(max-width:900px){
  .mobile-qr-grid{grid-template-columns:1fr}
}

/* RC15 FIX2 · alta rápida de cliente en incidencias */
.incident-customer-picker{display:flex;gap:6px;align-items:stretch}.incident-customer-picker select{flex:1;min-width:0}.incident-customer-add{width:38px;min-width:38px;padding:0;font-size:22px;font-weight:600;line-height:1;border-radius:8px}.incident-customer-add:hover{transform:none}

.mobile-last-connection{margin:4px 2px 10px;text-align:right}


/* RC15 FIX9 · Agenda de todos los técnicos dentro de planificación */
.planning-team-agenda-panel{border:1px solid var(--border);border-radius:12px;padding:12px;background:var(--surface,#fff);min-width:0}
.planning-team-agenda-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:10px}
.planning-team-agenda-head>b,.planning-team-agenda-head b{font-size:14px}
.planning-team-legend{display:flex;flex-wrap:wrap;gap:10px;font-size:11px;color:var(--muted)}
.planning-team-legend span{display:flex;align-items:center;gap:5px;white-space:nowrap}
.planning-team-legend i{width:10px;height:10px;border-radius:3px;display:inline-block;border:1px solid var(--border)}
.legend-free{background:var(--surface,#fff)}
.legend-busy{background:#d9e2ff}
.legend-assigned{background:#eef2ff;border-color:#667eea!important}
.planning-team-agenda-loading{padding:14px;text-align:center;color:var(--muted)}
.planning-team-hours{display:grid;grid-template-columns:180px minmax(620px,1fr);gap:8px;min-width:820px;margin-bottom:2px}
.planning-team-hours>div:last-child{position:relative;height:20px}
.planning-team-hours span{position:absolute;transform:translateX(-50%);font-size:10px;color:var(--muted);top:1px;white-space:nowrap}
.planning-team-rows{min-width:820px}
#peTeamAgenda{overflow-x:auto;padding-bottom:2px}
.planning-team-row{display:grid;grid-template-columns:180px minmax(620px,1fr);gap:8px;align-items:stretch;border-top:1px solid var(--border);min-height:48px}
.planning-team-row:first-child{border-top:0}
.planning-team-row.incident-assigned .planning-team-name{background:#f6f7ff}
.planning-team-row.selected-tech .planning-team-name{box-shadow:inset 3px 0 0 #667eea}
.planning-team-name{padding:7px 8px;border-radius:7px;display:grid;grid-template-columns:1fr auto;column-gap:6px;align-content:center}
.planning-team-name b{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.planning-team-name span{font-size:10px;color:var(--muted)}
.planning-team-name small{grid-column:1/-1;font-size:9px;color:var(--muted);margin-top:2px}
.planning-team-track{position:relative;min-height:44px;background:linear-gradient(to bottom,#fafbfc,#fff);overflow:hidden}
.planning-team-gridline{position:absolute;top:0;bottom:0;width:1px;background:var(--border);opacity:.7}
.planning-team-free{position:absolute;left:8px;top:14px;font-size:10px;color:var(--muted)}
.planning-team-event{position:absolute;top:6px;height:32px;min-width:34px;border:1px solid #aebce8;border-radius:6px;background:#e9eeff;padding:3px 5px;overflow:hidden;display:flex;flex-direction:column;justify-content:center;line-height:1.05}
.planning-team-event b{font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.planning-team-event span{font-size:8px;white-space:nowrap}
.planning-team-event.priority-URGENT{border-width:2px}
@media(max-width:900px){
 .planning-team-agenda-head{flex-direction:column}
 .planning-team-hours,.planning-team-row{grid-template-columns:150px minmax(560px,1fr);min-width:720px}
 .planning-team-rows{min-width:720px}
}


/* RC15 FIX10 · Agenda semanal dentro de planificación */
.planning-week-caption{display:flex;justify-content:space-between;gap:12px;align-items:center;margin:4px 0 8px;font-size:11px;color:var(--muted)}
.planning-week-caption b{color:var(--text)}
.planning-week-header,.planning-week-row{display:grid;grid-template-columns:170px repeat(7,minmax(120px,1fr));min-width:1010px}
.planning-week-header{position:sticky;top:0;z-index:2;background:var(--surface,#fff);border-bottom:1px solid var(--border)}
.planning-week-tech-col,.planning-week-day-head{padding:7px 8px;font-size:11px}
.planning-week-tech-col{font-weight:700}
.planning-week-day-head{text-align:center;border-left:1px solid var(--border)}
.planning-week-day-head b{display:block;font-size:11px}
.planning-week-day-head span{font-size:10px;color:var(--muted)}
.planning-week-day-head.selected-day{background:#eef2ff}
.planning-week-body{min-width:1010px}
.planning-week-row{border-bottom:1px solid var(--border);min-height:62px}
.planning-week-row.incident-assigned .planning-week-tech{background:#f6f7ff}
.planning-week-row.selected-tech .planning-week-tech{box-shadow:inset 3px 0 0 #667eea}
.planning-week-tech{padding:8px;border-right:1px solid var(--border);display:flex;flex-direction:column;justify-content:center;min-width:0}
.planning-week-tech b{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.planning-week-tech span,.planning-week-tech small{font-size:9px;color:var(--muted);margin-top:2px}
.planning-week-day-cell{padding:4px;border-left:1px solid var(--border);min-height:62px;background:#fff}
.planning-week-day-cell.selected-day{background:#fafbff}
.planning-week-free{display:block;text-align:center;margin-top:17px;font-size:9px;color:var(--muted)}
.planning-week-event{border:1px solid #aebce8;background:#e9eeff;border-radius:6px;padding:4px 5px;margin-bottom:3px;overflow:hidden}
.planning-week-event b{display:block;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.planning-week-event span{display:block;font-size:8px}
.planning-week-event small{display:block;font-size:8px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.planning-week-event.priority-URGENT{border-width:2px}
@media(max-width:900px){
 .planning-week-header,.planning-week-row{grid-template-columns:145px repeat(7,minmax(112px,1fr));min-width:930px}
 .planning-week-body{min-width:930px}
}


/* RC15 FIX11 · Agenda semanal más ancha y sin scroll horizontal en escritorio */
.planning-week-modal-wide{
  width:min(96vw,1500px)!important;
  max-width:1500px!important;
}
.planning-week-modal-wide .form,
.planning-week-modal-wide .form-grid{
  width:100%;
  max-width:none;
}
.planning-week-modal-wide .planning-team-agenda-panel{
  width:100%;
  box-sizing:border-box;
}
.planning-week-modal-wide #peTeamAgenda{
  overflow-x:visible;
}
.planning-week-modal-wide .planning-week-header,
.planning-week-modal-wide .planning-week-row{
  grid-template-columns:minmax(145px,1.2fr) repeat(7,minmax(96px,1fr));
  min-width:0;
}
.planning-week-modal-wide .planning-week-body{
  min-width:0;
}
.planning-week-modal-wide .planning-week-day-head{
  padding-left:4px;
  padding-right:4px;
}
.planning-week-modal-wide .planning-week-tech{
  padding-left:6px;
  padding-right:6px;
}
.planning-week-modal-wide .planning-week-day-cell{
  padding:3px;
}
.planning-week-modal-wide .planning-week-event{
  padding:3px 4px;
}
.planning-week-modal-wide .planning-team-agenda-head{
  margin-bottom:6px;
}
.planning-week-modal-wide .planning-team-agenda-head .tiny:empty{
  display:none;
}

/* En pantallas más estrechas mantenemos scroll como respaldo */
@media(max-width:1180px){
  .planning-week-modal-wide{
    width:96vw!important;
    max-width:96vw!important;
  }
  .planning-week-modal-wide #peTeamAgenda{
    overflow-x:auto;
  }
  .planning-week-modal-wide .planning-week-header,
  .planning-week-modal-wide .planning-week-row{
    grid-template-columns:145px repeat(7,minmax(108px,1fr));
    min-width:920px;
  }
  .planning-week-modal-wide .planning-week-body{
    min-width:920px;
  }
}


/* RC15 FIX12 · Planificación compacta, fecha automática y refresco sin salto */
.planning-week-modal-wide{
  height:auto!important;
  max-height:94vh!important;
}
.planning-week-modal-wide .form,
.planning-week-modal-wide .form-grid{
  row-gap:8px!important;
}
.planning-week-modal-wide textarea[name="notes"]{
  min-height:54px!important;
  height:54px!important;
}
.planning-week-modal-wide .planning-team-agenda-panel{
  padding:8px 10px!important;
}
.planning-week-modal-wide .planning-team-agenda-head{
  margin-bottom:4px!important;
}
.planning-week-modal-wide .planning-week-caption{
  margin:2px 0 5px!important;
}
.planning-week-modal-wide .planning-week-header,
.planning-week-modal-wide .planning-week-row{
  min-height:0!important;
}
.planning-week-modal-wide .planning-week-row{
  min-height:48px!important;
}
.planning-week-modal-wide .planning-week-tech{
  padding-top:5px!important;
  padding-bottom:5px!important;
}
.planning-week-modal-wide .planning-week-day-cell{
  min-height:48px!important;
  padding:2px!important;
}
.planning-week-modal-wide .planning-week-event{
  margin-bottom:2px!important;
  padding:2px 4px!important;
}
.planning-week-modal-wide .planning-week-free{
  margin-top:12px!important;
}
.planning-week-modal-wide .planning-availability{
  padding:8px 10px!important;
}
.planning-week-modal-wide #peTeamAgenda{
  transition:opacity .12s ease;
}
.planning-week-modal-wide #peTeamAgenda.is-refreshing{
  opacity:.72;
  pointer-events:none;
}

/* El submodal usa el alto de viewport; solo su contenido interno podrá desplazarse
   como último recurso cuando haya muchos técnicos. */
.planning-week-modal-wide{
  overflow-y:visible!important;
}
.planning-week-modal-wide .modal-body,
.planning-week-modal-wide .submodal-body{
  overflow-y:visible!important;
  max-height:none!important;
}

/* Si el equipo es muy grande, el scroll queda dentro de la agenda, no en todo el modal. */
.planning-week-modal-wide #peTeamAgenda{
  max-height:46vh;
  overflow-y:auto;
}


/* RC15 FIX13 · Columna de técnicos fija durante desplazamiento horizontal */
.planning-week-modal-wide #peTeamAgenda{
  position:relative;
}

/* Cabecera "Técnico" fija */
.planning-week-modal-wide .planning-week-tech-col{
  position:sticky;
  left:0;
  z-index:6;
  background:var(--surface,#fff);
  border-right:1px solid var(--border);
  box-shadow:4px 0 6px -6px rgba(0,0,0,.35);
}

/* Nombre del técnico fijo en cada fila */
.planning-week-modal-wide .planning-week-tech{
  position:sticky;
  left:0;
  z-index:5;
  background:var(--surface,#fff);
  border-right:1px solid var(--border);
  box-shadow:4px 0 6px -6px rgba(0,0,0,.35);
}

/* Mantener el resaltado de asignación también en la columna fija */
.planning-week-modal-wide .planning-week-row.incident-assigned .planning-week-tech{
  background:#f6f7ff;
}

/* La cabecera semanal permanece por encima de las filas al desplazar verticalmente */
.planning-week-modal-wide .planning-week-header{
  z-index:7;
}

/* Evita transparencias al pasar celdas por detrás de la columna fija */
.planning-week-modal-wide .planning-week-day-cell{
  position:relative;
  z-index:1;
}

/* En pantallas estrechas el scroll horizontal se aplica al bloque,
   pero la primera columna sigue anclada. */
@media(max-width:1180px){
  .planning-week-modal-wide .planning-week-tech-col,
  .planning-week-modal-wide .planning-week-tech{
    min-width:145px;
  }
}


/* RC15 FIX14 · Estructura separada: técnicos fijos + días desplazables */
.planning-week-modal-wide #peTeamAgenda{
  overflow:visible!important;
  max-height:none!important;
}

.planning-week-split{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  width:100%;
  min-width:0;
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
  background:var(--surface,#fff);
}

.planning-week-fixed-column{
  min-width:180px;
  max-width:180px;
  background:var(--surface,#fff);
  border-right:1px solid var(--border);
  z-index:3;
}

.planning-week-fixed-head{
  height:38px;
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:700;
  border-bottom:1px solid var(--border);
  background:var(--surface,#fff);
}

.planning-week-fixed-body{
  background:var(--surface,#fff);
}

.planning-week-fixed-tech{
  height:62px;
  box-sizing:border-box;
  padding:6px 8px;
  border-bottom:1px solid var(--border);
  display:flex;
  flex-direction:column;
  justify-content:center;
  overflow:hidden;
  background:var(--surface,#fff);
}

.planning-week-fixed-tech:last-child{
  border-bottom:0;
}

.planning-week-fixed-tech b{
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.planning-week-fixed-tech span,
.planning-week-fixed-tech small{
  font-size:9px;
  color:var(--muted);
  margin-top:2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.planning-week-fixed-tech.incident-assigned{
  background:#f6f7ff;
}

.planning-week-fixed-tech.selected-tech{
  box-shadow:inset 3px 0 0 #667eea;
}

.planning-week-days-scroll{
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-gutter:stable;
  background:#fff;
}

.planning-week-days-inner{
  min-width:910px;
}

.planning-week-days-header{
  height:38px;
  box-sizing:border-box;
  display:grid;
  grid-template-columns:repeat(7,minmax(130px,1fr));
  border-bottom:1px solid var(--border);
}

.planning-week-days-header .planning-week-day-head{
  height:38px;
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  border-left:1px solid var(--border);
  padding:2px 4px;
}

.planning-week-days-header .planning-week-day-head:first-child{
  border-left:0;
}

.planning-week-days-body{
  min-width:910px;
}

.planning-week-days-row{
  height:62px;
  box-sizing:border-box;
  display:grid;
  grid-template-columns:repeat(7,minmax(130px,1fr));
  border-bottom:1px solid var(--border);
}

.planning-week-days-row:last-child{
  border-bottom:0;
}

.planning-week-days-row .planning-week-day-cell{
  height:62px!important;
  min-height:62px!important;
  box-sizing:border-box;
  border-left:1px solid var(--border);
  padding:3px!important;
  overflow:hidden;
}

.planning-week-days-row .planning-week-day-cell:first-child{
  border-left:0;
}

.planning-week-days-row .planning-week-day-cell.selected-day,
.planning-week-days-header .planning-week-day-head.selected-day{
  background:#fafbff;
}

/* Neutraliza la antigua estructura sticky/grid */
.planning-week-header,
.planning-week-row,
.planning-week-tech-col,
.planning-week-tech,
.planning-week-body{
  position:static!important;
}

@media(max-width:1180px){
  .planning-week-split{
    grid-template-columns:160px minmax(0,1fr);
  }
  .planning-week-fixed-column{
    min-width:160px;
    max-width:160px;
  }
  .planning-week-days-inner,
  .planning-week-days-body{
    min-width:840px;
  }
  .planning-week-days-header,
  .planning-week-days-row{
    grid-template-columns:repeat(7,minmax(120px,1fr));
  }
}


/* RC15 FIX16 · Planificación lateral corregida sobre FIX14 */
#subModal:has(.planning-desktop-layout) .modal-card{
  width:min(1720px,98vw)!important;
  max-width:98vw!important;
  height:min(900px,96vh)!important;
  max-height:96vh!important;
}

#subModal:has(.planning-desktop-layout) #subModalBody{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden!important;
}

#subModal:has(.planning-desktop-layout) #subEntityForm{
  height:100%;
  display:flex;
  flex-direction:column;
  padding:12px 14px!important;
}

#subModal:has(.planning-desktop-layout) #subEntityForm>.form-grid{
  flex:1 1 auto;
  min-height:0;
  display:block!important;
}

#subModal:has(.planning-desktop-layout) #subEntityForm>.form-actions{
  flex:0 0 auto;
  position:static!important;
  margin:10px -14px -12px!important;
  padding:10px 14px!important;
}

.planning-desktop-layout{
  display:grid!important;
  grid-template-columns:300px minmax(0,1fr)!important;
  gap:14px;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
}

.planning-left-panel{
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow-y:auto;
  padding-right:2px;
  background:transparent!important;
  color:#1e293b!important;
}

.planning-left-card{
  flex:0 0 auto;
  background:#fff!important;
  color:#1e293b!important;
  border:1px solid #dce4eb;
  border-radius:10px;
  padding:10px;
}

.planning-left-card label{
  display:grid!important;
  gap:5px;
  margin-bottom:8px!important;
  color:#1e293b!important;
}

.planning-left-card input,
.planning-left-card select,
.planning-left-card textarea{
  width:100%;
}

.planning-card-title{
  font-size:12px;
  font-weight:800;
  margin-bottom:8px;
}

.planning-time-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.planning-tech-card .employee-picker{
  max-height:170px;
  overflow-y:auto;
  display:grid;
  gap:4px;
}

.planning-tech-card .employee-check{
  margin:0!important;
  padding:5px 6px;
}

.planning-availability-card #peAvailability{
  margin-top:7px;
  padding:7px 8px;
  min-height:34px;
  font-size:11px;
}

.planning-notes-card textarea[name="notes"]{
  min-height:70px!important;
  height:70px!important;
}

.planning-right-panel{
  min-width:0;
  min-height:0;
  overflow:hidden;
  display:flex;
}

.planning-right-panel .planning-team-agenda-panel{
  flex:1 1 auto;
  min-width:0;
  min-height:0;
  margin:0!important;
  padding:10px!important;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.planning-right-panel .planning-team-agenda-head{
  flex:0 0 auto;
  margin-bottom:6px!important;
}

.planning-right-panel #peTeamAgenda{
  flex:1 1 auto;
  min-height:0;
  width:100%;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
}

.planning-right-panel .planning-week-split{
  grid-template-columns:190px minmax(0,1fr);
  width:100%;
}

.planning-right-panel .planning-week-fixed-column{
  min-width:190px;
  max-width:190px;
}

.planning-right-panel .planning-week-days-scroll{
  min-width:0;
  overflow-x:auto!important;
  overflow-y:hidden!important;
}

.planning-right-panel .planning-week-days-inner,
.planning-right-panel .planning-week-days-body{
  min-width:980px;
}

.planning-right-panel .planning-week-days-header,
.planning-right-panel .planning-week-days-row{
  grid-template-columns:repeat(7,minmax(140px,1fr));
}

.planning-right-panel .planning-week-fixed-tech,
.planning-right-panel .planning-week-days-row,
.planning-right-panel .planning-week-days-row .planning-week-day-cell{
  height:66px!important;
  min-height:66px!important;
}

@media(max-width:1100px){
  #subModal:has(.planning-desktop-layout) .modal-card{
    width:98vw!important;
    height:96vh!important;
  }
  .planning-desktop-layout{
    grid-template-columns:270px minmax(0,1fr)!important;
  }
}

@media(max-width:780px){
  #subModal:has(.planning-desktop-layout) #subModalBody{
    overflow-y:auto!important;
  }
  #subModal:has(.planning-desktop-layout) #subEntityForm{
    height:auto;
  }
  .planning-desktop-layout{
    grid-template-columns:1fr!important;
    height:auto;
  }
  .planning-left-panel{
    overflow:visible;
  }
  .planning-right-panel{
    min-height:520px;
  }
}

/* RC16 - KPI interactivos y paginación */
.dashboard-kpis .dashboard-kpi{appearance:none;text-align:left;cursor:pointer;font:inherit}.dashboard-kpi.active{box-shadow:0 0 0 2px #17669b inset}.dashboard-detail{margin-top:14px}.dashboard-row{cursor:pointer}.dashboard-row:hover{background:#f3f7fa}.list-pager{display:flex;align-items:center;justify-content:center;gap:14px;padding:12px 8px}.list-pager.single{justify-content:flex-end;color:#64748b;font-size:12px}.list-pager button{min-width:100px}.incident-list-wrap,.workorder-list-wrap{overflow-x:auto;overflow-y:visible;max-height:none}


/* RC16 FIX1 - Resumen compacto + 12 registros por página */
.dashboard-kpis{grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.dashboard-kpis .dashboard-kpi{padding:13px 14px;min-height:92px}
.dashboard-kpis .dashboard-kpi .muted{font-size:12px;line-height:1.25}
.dashboard-kpis .dashboard-kpi .metric{font-size:27px;margin-top:6px}
.dashboard-detail{margin:18px 2px 0}
.dashboard-detail>.panel{margin-top:0}
.dashboard-detail .section-title{padding:14px 16px 10px}
@media(max-width:1200px){.dashboard-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:780px){.dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.dashboard-kpis{grid-template-columns:1fr}}


/* RC16 FIX2 - paginación estable a 14 registros */
html{scrollbar-gutter:stable}
.incident-list-panel{min-height:634px}
.workorder-page-table>.panel{min-height:606px}
.incident-list-wrap{overflow-x:auto;overflow-y:visible;max-height:none}
.workorder-page-table .table-wrap{overflow-x:auto;overflow-y:visible;max-height:none}
@media(max-width:1100px){
  .incident-list-panel,.workorder-page-table>.panel{min-height:0}
}


/* RC16 FIX3 - paginación sin saltos verticales ni laterales */
/* Mantiene siempre reservado el ancho de la barra vertical del navegador. */
html{overflow-y:scroll;scrollbar-gutter:stable both-edges}
body{width:100%;overflow-x:hidden}

/* El bloque de lista conserva exactamente la misma altura entre páginas. */
.incident-list-panel,
.workorder-page-table>.panel{
  height:592px;
  min-height:592px;
  max-height:592px;
  display:flex;
  flex-direction:column;
}
.incident-list-wrap,
.workorder-page-table .table-wrap{
  flex:1 1 auto;
  width:100%;
  overflow-x:hidden!important;
  overflow-y:hidden!important;
}

/* Las columnas no se recalculan según el contenido de cada página. */
.incident-list-table,
.workorder-page-table table{table-layout:fixed;width:100%}
.workorder-page-table table col{width:auto}
.workorder-page-table th:nth-child(1),.workorder-page-table td:nth-child(1){width:14%}
.workorder-page-table th:nth-child(2),.workorder-page-table td:nth-child(2){width:30%}
.workorder-page-table th:nth-child(3),.workorder-page-table td:nth-child(3){width:10%}
.workorder-page-table th:nth-child(4),.workorder-page-table td:nth-child(4){width:23%}
.workorder-page-table th:nth-child(5),.workorder-page-table td:nth-child(5){width:7%}
.workorder-page-table th:nth-child(6),.workorder-page-table td:nth-child(6){width:12%}

/* 14 registros manteniendo la lista dentro del alto reservado. */
.incident-list-table th,.incident-list-table td,
.workorder-page-table th,.workorder-page-table td{padding-top:7px;padding-bottom:7px}
.incident-list-table td,.workorder-page-table td{height:37px}

/* Evita que textos largos ensanchen la tabla en una página concreta. */
.incident-list-table th,.incident-list-table td,
.workorder-page-table th,.workorder-page-table td{overflow:hidden;text-overflow:ellipsis}

/* El paginador ocupa siempre la misma franja. */
.list-pager{height:54px;min-height:54px;margin:0}

@media(max-width:1100px){
  html{scrollbar-gutter:stable}
  .incident-list-panel,.workorder-page-table>.panel{
    height:auto;min-height:0;max-height:none;display:block;
  }
  .incident-list-wrap,.workorder-page-table .table-wrap{overflow-x:auto!important;overflow-y:visible!important}
}

/* RC16 FIX4 - altura estable sin recortar contenido */
/* FIX3 fijaba una altura máxima y podía ocultar filas en la página completa.
   Ahora la página completa determina la altura y las páginas cortas reservan
   el mismo espacio mediante min-height, sin recortar ninguna fila. */
.incident-list-panel,
.workorder-page-table>.panel{
  height:auto!important;
  max-height:none!important;
  min-height:634px!important;
  display:flex;
  flex-direction:column;
}
.incident-list-wrap,
.workorder-page-table .table-wrap{
  flex:1 1 auto;
  width:100%;
  max-height:none!important;
  overflow-x:hidden!important;
  overflow-y:visible!important;
}
/* Mantener geometría horizontal estable entre páginas. */
html{overflow-y:scroll;scrollbar-gutter:stable}
body{width:100%;max-width:100%;overflow-x:hidden}
.incident-list-table,
.workorder-page-table table{table-layout:fixed;width:100%;max-width:100%}

@media(max-width:1100px){
  .incident-list-panel,.workorder-page-table>.panel{min-height:0!important}
  .incident-list-wrap,.workorder-page-table .table-wrap{overflow-x:auto!important;overflow-y:visible!important}
}


/* RC16 FIX5 - paginacion estable sin recortes ni desplazamiento lateral */
#content{overflow-y:scroll!important;overflow-x:hidden!important;scrollbar-gutter:stable}
.incident-list-panel,.workorder-page-table>.panel{height:auto!important;min-height:0!important;max-height:none!important;display:block!important}
.incident-list-wrap,.workorder-page-table .table-wrap{height:auto!important;min-height:0!important;max-height:none!important;overflow:hidden!important}
.incident-list-table,.workorder-page-table table{table-layout:fixed!important;width:100%!important;max-width:100%!important}
.incident-list-table tbody tr,.workorder-page-table tbody tr{height:43px}
.page-placeholder{height:43px!important}
.page-placeholder td{height:37px!important;padding:7px 10px!important;line-height:normal!important;border-bottom:1px solid #edf1f5!important;visibility:hidden;box-sizing:content-box!important}
.list-pager{height:54px!important;min-height:54px!important;margin:0!important}
@media(max-width:1100px){.incident-list-wrap,.workorder-page-table .table-wrap{overflow-x:auto!important;overflow-y:visible!important}}


/* RC16 FIX7 - las filas vacías de relleno replican exactamente la geometría vertical de una fila real. */
.incident-list-table tbody tr.page-placeholder,.workorder-page-table tbody tr.page-placeholder{height:43px!important}
.incident-list-table tbody tr.page-placeholder td,.workorder-page-table tbody tr.page-placeholder td{height:37px!important;padding-top:7px!important;padding-bottom:7px!important;line-height:normal!important;border-bottom:1px solid #edf1f5!important;box-sizing:border-box!important}

/* RC16 FIX8 - reserva de altura fuera de la tabla y un único scroll estable */
.page-reserve-space{display:block;width:100%;min-height:0;pointer-events:none;background:#fff}
.page-placeholder{display:none!important}
@media(min-width:851px){
  html,body{height:100%!important;overflow:hidden!important;scrollbar-gutter:auto!important}
  .app,main{width:100%;max-width:100%;overflow:hidden!important}
  #content{width:100%;max-width:100%;overflow-y:scroll!important;overflow-x:hidden!important;scrollbar-gutter:stable!important}
  .incident-list-panel,.workorder-page-table>.panel{height:auto!important;min-height:0!important;max-height:none!important;display:block!important}
  .incident-list-wrap,.workorder-page-table .table-wrap{height:auto!important;min-height:0!important;max-height:none!important;overflow:hidden!important}
}



/* RC21 FIX6 · empresa compacta, logotipo lateral autenticado e interruptores */
#modal:has(.company-master-layout) .modal-card{width:min(1120px,94vw)}
.company-master-layout{display:grid;grid-template-columns:minmax(0,1fr) 250px;gap:22px;align-items:start}
.company-left-column{min-width:0;display:grid;align-content:start}
.company-data-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px 12px;min-width:0}
.company-data-grid .span2{grid-column:1/-1}
/* Debe anular por completo el aside global de la navegación lateral. */
aside.company-logo-side{height:auto;min-height:0;overflow:visible;position:static;background:transparent;color:inherit;padding:0 0 0 20px;border-left:1px solid #e2e8f0;display:block;min-width:0}
.company-logo-side-title{font-size:13px;font-weight:800;margin:1px 0 8px;color:#334155}
.company-logo-preview{height:132px;border:1px solid #cfd8e2;border-radius:8px;background:#fff;display:flex;align-items:center;justify-content:center;padding:10px;overflow:hidden}
.company-logo-preview img{display:block;max-width:100%;max-height:100%;object-fit:contain}
.company-logo-preview.empty-logo{border-style:dashed;color:#7b8794;font-size:12px;background:#f8fafc}
.company-logo-controls{display:flex;gap:7px;align-items:center;margin-top:8px}
.company-logo-file-button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #b8c5d1;border-radius:6px;background:#fff;color:#1e293b;font-weight:700;cursor:pointer;margin:0;padding:5px 8px;font-size:11px}
.company-logo-file-button input{display:none}
.company-left-column>.section-title{margin-top:12px}
.switch-field{display:flex;align-items:center;justify-content:flex-start;gap:10px;min-height:32px;margin:0;font-size:13px;font-weight:600}
.switch-control{position:relative;display:inline-block;width:38px;height:22px;flex:0 0 auto}
.switch-control input{position:absolute;opacity:0;width:0;height:0}
.switch-slider{position:absolute;inset:0;border-radius:999px;background:#cbd5e1;border:1px solid #b6c2cf;transition:.15s;cursor:pointer}
.switch-slider:before{content:"";position:absolute;width:16px;height:16px;left:2px;top:2px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transition:.15s}
.switch-control input:checked + .switch-slider{background:#1d5f91;border-color:#1d5f91}
.switch-control input:checked + .switch-slider:before{transform:translateX(16px)}
.switch-control input:disabled + .switch-slider{opacity:.55;cursor:not-allowed}
@media(max-width:760px){.company-master-layout{grid-template-columns:1fr}.company-logo-side{grid-row:1;border-left:0!important;border-top:0;padding:0 0 14px!important}.company-logo-preview{height:125px}.company-data-grid{grid-template-columns:1fr}.company-data-grid .span2{grid-column:auto}}

/* RC22 FIX1 · importación FACTUSOL: márgenes, un solo scroll y columnas completas */
#subModal:has(.factusol-customer-import) .modal-card{overflow:hidden;display:flex;flex-direction:column;max-height:92vh}
#subModal:has(.factusol-customer-import) #subModalBody{min-height:0;overflow:hidden;display:flex;flex-direction:column}
.factusol-customer-import{padding:14px 18px 10px;display:flex;flex-direction:column;gap:10px;min-height:0;max-height:calc(92vh - 55px);overflow:hidden}
.factusol-import-toolbar{display:flex;align-items:center;justify-content:space-between;gap:18px;flex:0 0 auto;padding:0 0 2px}
.factusol-import-toolbar>div{min-width:0}
.factusol-import-toolbar .primary{flex:0 0 auto}
.factusol-customer-table-wrap{flex:1 1 auto;min-height:0;max-height:none!important;overflow:auto;border:1px solid #e2e8f0;border-radius:8px;scrollbar-gutter:stable}
.factusol-customer-table{min-width:1020px}
.factusol-customer-table th{top:0}
.factusol-import-footer{display:flex;justify-content:flex-end;flex:0 0 auto;padding:2px 0 0;border-top:1px solid #e2e8f0}
@media(max-width:760px){.factusol-customer-import{padding:12px}.factusol-import-toolbar{align-items:flex-start;flex-direction:column}.factusol-import-toolbar .primary{align-self:flex-end}}

/* RC22 FIX5 · búsqueda global de clientes */
.customer-search-panel{margin-top:0;margin-bottom:10px;overflow:visible}.customer-search-toolbar{display:flex;align-items:center;gap:12px;padding:10px 12px}.customer-search-toolbar input{flex:1 1 520px;min-width:260px}.customer-search-toolbar .tiny{margin:0;white-space:nowrap}@media(max-width:650px){.customer-search-toolbar{align-items:stretch;flex-direction:column}.customer-search-toolbar input{min-width:0;width:100%}}

/* RC22 FIX6 · Clientes: un único scroll y buscador integrado */
body:has(#customerGlobalSearch) #content{overflow:hidden!important;display:flex;flex-direction:column;min-height:0}
body:has(#customerGlobalSearch) .customer-search-panel{flex:0 0 auto}
body:has(#customerGlobalSearch) #customerResults{flex:1 1 auto;min-height:0;overflow:hidden}
body:has(#customerGlobalSearch) #customerResults>.panel{height:100%;margin-top:0;display:flex;flex-direction:column;min-height:0}
body:has(#customerGlobalSearch) #customerResults .table-wrap{flex:1 1 auto;min-height:0;max-height:none;overflow:auto}


/* RC22 FIX9 · Agenda: mismo color por incidencia + tooltip informativo */
.month-event.agenda-incident-color-0,.week-event.agenda-incident-color-0{background:#e8f1fb;border-left-color:#2f6f9f}
.month-event.agenda-incident-color-1,.week-event.agenda-incident-color-1{background:#eaf6ef;border-left-color:#3d7d57}
.month-event.agenda-incident-color-2,.week-event.agenda-incident-color-2{background:#fff1e5;border-left-color:#a8612a}
.month-event.agenda-incident-color-3,.week-event.agenda-incident-color-3{background:#f3ecfb;border-left-color:#7452a3}
.month-event.agenda-incident-color-4,.week-event.agenda-incident-color-4{background:#e7f6f7;border-left-color:#2d7d82}
.month-event.agenda-incident-color-5,.week-event.agenda-incident-color-5{background:#fbecef;border-left-color:#9a5262}
.month-event.agenda-incident-color-6,.week-event.agenda-incident-color-6{background:#f4f1df;border-left-color:#7a6e2e}
.month-event.agenda-incident-color-7,.week-event.agenda-incident-color-7{background:#edf0f4;border-left-color:#526170}
.agenda-event-tooltip{position:fixed;z-index:10050;width:min(360px,calc(100vw - 28px));padding:10px 12px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;box-shadow:0 10px 28px rgba(15,23,42,.20);pointer-events:none;font-size:12px;line-height:1.35;color:#1e293b}
.agenda-event-tooltip.hidden{display:none}
.agenda-tooltip-title{font-size:13px;font-weight:800;margin-bottom:7px;padding-bottom:6px;border-bottom:1px solid #e2e8f0;color:#0f172a}
.agenda-tooltip-row{display:grid;grid-template-columns:105px minmax(0,1fr);gap:8px;padding:2px 0;align-items:start}
.agenda-tooltip-row b{color:#475569}.agenda-tooltip-row span{white-space:normal;overflow-wrap:anywhere}.agenda-tooltip-description{padding-top:5px;margin-top:3px;border-top:1px solid #f1f5f9}

/* RC22 FIX10 · Agenda: mayor contraste + identificación inequívoca de incidencias con varias jornadas */
.month-event,.week-event{position:relative}
.month-event.agenda-incident-color-0,.week-event.agenda-incident-color-0{background:#dbeafe;border-left-color:#1d4ed8}
.month-event.agenda-incident-color-1,.week-event.agenda-incident-color-1{background:#dcfce7;border-left-color:#15803d}
.month-event.agenda-incident-color-2,.week-event.agenda-incident-color-2{background:#ffedd5;border-left-color:#c2410c}
.month-event.agenda-incident-color-3,.week-event.agenda-incident-color-3{background:#f3e8ff;border-left-color:#7e22ce}
.month-event.agenda-incident-color-4,.week-event.agenda-incident-color-4{background:#cffafe;border-left-color:#0e7490}
.month-event.agenda-incident-color-5,.week-event.agenda-incident-color-5{background:#ffe4e6;border-left-color:#be123c}
.month-event.agenda-incident-color-6,.week-event.agenda-incident-color-6{background:#fef3c7;border-left-color:#a16207}
.month-event.agenda-incident-color-7,.week-event.agenda-incident-color-7{background:#e2e8f0;border-left-color:#475569}
.month-event.agenda-incident-color-8,.week-event.agenda-incident-color-8{background:#ccfbf1;border-left-color:#0f766e}
.month-event.agenda-incident-color-9,.week-event.agenda-incident-color-9{background:#fae8ff;border-left-color:#a21caf}
.month-event.agenda-incident-color-10,.week-event.agenda-incident-color-10{background:#ecfccb;border-left-color:#4d7c0f}
.month-event.agenda-incident-color-11,.week-event.agenda-incident-color-11{background:#fce7f3;border-left-color:#be185d}

/* RC22 FIX14 · gestor de contactos más amplio y navegación coherente */
#subModal:has(.customer-contact-manager) .modal-card{width:min(1080px,95vw);height:min(700px,88vh);max-height:88vh}
#subModal:has(.customer-contact-manager) #subModalBody{flex:1 1 auto;min-height:0;overflow:hidden;padding:0}
.customer-contact-manager{height:100%;min-height:0;display:flex;flex-direction:column;padding:20px 24px 18px}
.customer-contact-manager .customer-tab-heading{flex:0 0 auto;margin:0 0 16px}
.customer-contact-manager #contactManagerList{flex:1 1 auto;min-height:0;overflow:hidden;border:1px solid #e2e8f0;border-radius:9px}
.customer-contact-manager #contactManagerList>.table-wrap{height:100%;max-height:none;overflow:auto}
.customer-contact-manager>.form-actions{position:static;flex:0 0 auto;margin:14px -24px -18px;padding:12px 24px 0;border-top:1px solid #e2e8f0}
@media(max-width:850px){#subModal:has(.customer-contact-manager) .modal-card{width:96vw;height:90vh}.customer-contact-manager{padding:14px}.customer-contact-manager>.form-actions{margin:12px -14px -14px;padding:11px 14px 0}}


/* RC22 FIX15 · ficha de cliente más limpia y sin scroll en Datos generales */
#modal:has(.customer-master-form) .modal-card{width:min(1200px,96vw);height:min(880px,96vh);max-height:96vh}
.customer-master-form .customer-general-panel{overflow:hidden;padding-top:14px}
.customer-general-panel>.form-grid{align-content:start;gap:10px 14px}
.customer-general-panel .customer-notes-field{margin-top:2px}
.customer-general-panel .customer-notes-field textarea{min-height:92px;max-height:92px;resize:vertical}
.customer-general-panel .customer-active-field{margin-top:0}
@media(max-height:820px){.customer-master-form .customer-general-panel{overflow-y:auto}.customer-general-panel .customer-notes-field textarea{min-height:72px;max-height:72px}}

/* RC23 · Mantenimientos programados y avisos internos */
.notification-center{position:relative}.notification-bell{position:relative;min-width:42px;height:38px;padding:0 9px;font-size:18px}.notification-bell b{position:absolute;right:-5px;top:-7px;min-width:19px;height:19px;padding:1px 5px;border-radius:10px;background:#b91c1c;color:#fff;font-size:11px;line-height:17px;text-align:center}.notification-panel{position:absolute;right:0;top:46px;z-index:10020;width:min(430px,92vw);max-height:520px;overflow:auto;background:#fff;border:1px solid #cbd5e1;border-radius:10px;box-shadow:0 16px 36px rgba(15,23,42,.2);padding:10px}.notification-panel-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 4px 9px;border-bottom:1px solid #e2e8f0}.notification-item{padding:10px 8px;border-bottom:1px solid #eef2f7;cursor:pointer}.notification-item:last-child{border-bottom:0}.notification-item:hover{background:#f8fafc}.notification-item-title{display:flex;justify-content:space-between;gap:12px}.notification-item-title b{font-size:13px}.notification-item p{margin:4px 0 2px;font-size:12px;color:#475569}.notification-item small{color:#64748b}.notification-popup{position:fixed;right:22px;top:22px;z-index:10030;width:min(390px,calc(100vw - 30px));padding:14px 16px;background:#fff;border:1px solid #94a3b8;border-left:5px solid #1d5f91;border-radius:10px;box-shadow:0 14px 36px rgba(15,23,42,.22);cursor:pointer}.notification-popup b{display:block;margin-bottom:5px}.notification-popup span{font-size:13px;color:#475569}.maintenance-status-ACTIVE{color:#166534}.maintenance-status-PAUSED{color:#92400e}.maintenance-status-FINISHED{color:#64748b}.maintenance-form .maintenance-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.maintenance-form .maintenance-section{border:1px solid #dbe3ec;border-radius:9px;padding:14px}.maintenance-form .maintenance-section h4{margin:0 0 12px}.maintenance-form .employee-picker{max-height:190px;overflow:auto}.maintenance-occurrences{margin-top:14px}.maintenance-occurrences .table-wrap{max-height:280px;overflow:auto}@media(max-width:850px){.maintenance-form .maintenance-grid{grid-template-columns:1fr}}

/* RC23 FIX1 · mantenimientos programados */
.maintenance-tabs{display:flex;gap:6px;border-bottom:1px solid #dbe3ec;padding:0 2px 8px;margin-bottom:2px}
.maintenance-tab{border:0;background:transparent;border-radius:7px;padding:8px 12px;font-weight:600;color:#526476;cursor:pointer}
.maintenance-tab:hover{background:#f3f6f9}.maintenance-tab.active{background:#e8f1f8;color:#174f78}
.maintenance-tab-panel{min-width:0}.maintenance-inline-pair{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.maintenance-inline-pair label{min-width:0}.maintenance-billable{align-self:end;min-height:38px;justify-content:flex-start;gap:12px}
.maintenance-occurrences{margin-top:0}.maintenance-occurrences .table-wrap{max-height:430px;overflow:auto}
@media(max-width:700px){.maintenance-inline-pair{grid-template-columns:1fr}}

/* RC23 FIX3 · mantenimiento: modal estable entre pestañas */
#modal .modal-card.maintenance-modal-fixed{height:min(790px,92vh);max-height:92vh}
#modal .modal-card.maintenance-modal-fixed #modalBody{flex:1 1 auto;min-height:0}
@media(max-width:850px){#modal .modal-card.maintenance-modal-fixed{height:min(790px,94vh);max-height:94vh}}


/* RC23 FIX4 · mantenimiento compacto y aislamiento de tamaño modal */
.maintenance-recurrence-row{display:grid;grid-template-columns:1.05fr .72fr 1.05fr;gap:10px;align-items:end}
.maintenance-recurrence-row label{min-width:0}
.maintenance-form .maintenance-section{padding:11px 13px}
.maintenance-form .maintenance-section h4{margin-bottom:9px}
.maintenance-form .maintenance-section .form-grid{gap:10px 12px}
.maintenance-form textarea{min-height:72px;max-height:72px}
.maintenance-form .employee-picker{max-height:120px}
#modal .modal-card.maintenance-modal-fixed #modalBody{overflow-y:hidden}
@media(max-width:850px){.maintenance-recurrence-row{grid-template-columns:1fr 1fr}.maintenance-form textarea{min-height:68px;max-height:68px}#modal .modal-card.maintenance-modal-fixed #modalBody{overflow-y:auto}}


/* RC23 FIX5 · ajustes de mantenimientos, incidencias y selector de artículos */
/* Mantenimiento: un poco más de alto para mostrar Facturable sin quedar bajo el pie. */
#modal .modal-card.maintenance-modal-fixed{height:min(835px,96vh);max-height:96vh}
@media(max-width:850px){#modal .modal-card.maintenance-modal-fixed{height:min(835px,96vh);max-height:96vh}}

/* Incidencias: el selector de cliente no puede desbordar el panel y reserva sitio al alta rápida. */
.incident-client-card,.incident-client-card .nested-grid,.incident-client-card .nested-grid>label{min-width:0}
.incident-customer-picker{display:flex;width:100%;max-width:100%;min-width:0;gap:6px;align-items:stretch;overflow:visible}
.incident-customer-picker select{width:0!important;max-width:100%;min-width:0;flex:1 1 0}
.incident-customer-add{display:inline-flex;align-items:center;justify-content:center;flex:0 0 38px;width:38px;min-width:38px;height:38px}

/* Parte de trabajo: el selector de artículos mantiene tamaño estable aunque cambien los resultados. */
#subModal:has(.article-picker) .modal-card{width:min(1080px,94vw);height:min(650px,88vh);max-height:88vh}
#subModal:has(.article-picker) #subModalBody{flex:1 1 auto;min-height:0;overflow:hidden}
#subModal:has(.article-picker) .article-picker{height:100%;min-height:0;display:flex;flex-direction:column}
#subModal:has(.article-picker) .article-picker-filters{flex:0 0 auto}
#subModal:has(.article-picker) .article-picker-table{flex:1 1 auto;min-height:0;max-height:none;overflow:auto}
#subModal:has(.article-picker) .article-picker>.tiny{flex:0 0 auto}
@media(max-width:900px){#subModal:has(.article-picker) .modal-card{width:96vw;height:min(650px,92vh);max-height:92vh}}


/* RC23 FIX13: búsqueda por cliente en Mant. Programados */
.maintenance-search-panel{margin-top:0;margin-bottom:10px;overflow:visible}
.maintenance-search-toolbar{display:flex;align-items:center;gap:12px;padding:10px 12px}
.maintenance-search-toolbar input{flex:1 1 520px;min-width:260px}
.maintenance-search-toolbar .tiny{margin:0;white-space:nowrap}
@media(max-width:650px){.maintenance-search-toolbar{align-items:stretch;flex-direction:column}.maintenance-search-toolbar input{min-width:0;width:100%}}

/* RC24 · referencia del parte */
.daily-entry-summary{grid-template-columns:minmax(140px,180px) minmax(260px,1fr) auto auto}
.daily-reference-field{min-width:0}
.daily-reference-field input{width:100%}
@media(max-width:900px){.daily-entry-summary{grid-template-columns:1fr 1fr}.daily-reference-field{grid-column:1/-1}}
\n\n/* RC24 FIX1 · referencia compacta y cabecera del parte */
.daily-page .daily-entry-summary{
  grid-template-columns:minmax(160px,180px) minmax(320px,1fr) 180px!important;
  grid-template-rows:auto auto;
  align-items:end;
}
.daily-page .daily-date-field{grid-column:1;grid-row:1;max-width:none}
.daily-page .daily-total-metric{grid-column:3;grid-row:1 / span 2;align-self:stretch}
.daily-page .daily-reference-field{grid-column:1 / 3;grid-row:2;min-width:0;max-width:none}
.daily-page .daily-reference-field input{width:100%}
.workorder-page-table th:nth-child(1),.workorder-page-table td:nth-child(1){width:14%!important}
.workorder-page-table th:nth-child(2),.workorder-page-table td:nth-child(2){width:12%!important}
.workorder-page-table th:nth-child(3),.workorder-page-table td:nth-child(3){width:30%!important}
.workorder-page-table th:nth-child(4),.workorder-page-table td:nth-child(4){width:13%!important}
.workorder-page-table th:nth-child(5),.workorder-page-table td:nth-child(5){width:13%!important}
.workorder-page-table th:nth-child(6),.workorder-page-table td:nth-child(6){width:7%!important}
.workorder-page-table th:nth-child(7),.workorder-page-table td:nth-child(7){width:11%!important}
.workorder-reference{
  font-size:12px;
  line-height:14px;
  font-weight:500;
  color:#5f6b7a;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  overflow-wrap:anywhere;
  max-height:28px;
}
@media(max-width:900px){
  .daily-page .daily-entry-summary{grid-template-columns:1fr 1fr!important;grid-template-rows:auto auto}
  .daily-page .daily-date-field{grid-column:1;grid-row:1}
  .daily-page .daily-total-metric{grid-column:2;grid-row:1;align-self:end}
  .daily-page .daily-reference-field{grid-column:1 / -1;grid-row:2}
}
@media(max-width:640px){
  .daily-page .daily-entry-summary{grid-template-columns:1fr!important}
  .daily-page .daily-date-field,.daily-page .daily-total-metric,.daily-page .daily-reference-field{grid-column:1;grid-row:auto}
}


/* RC24 FIX2 · Fecha + Referencia + Trabajo efectivo + Tiempo total */
.daily-page .daily-entry-summary{grid-template-columns:minmax(160px,180px) minmax(360px,1fr) 155px 155px!important;grid-template-rows:auto!important;align-items:end}
.daily-page .daily-date-field{grid-column:1;grid-row:1}
.daily-page .daily-reference-field{grid-column:2;grid-row:1;min-width:0}
.daily-page .daily-effective-metric{grid-column:3;grid-row:1;align-self:stretch}
.daily-page .daily-total-metric{grid-column:4;grid-row:1;align-self:stretch}
@media(max-width:900px){.daily-page .daily-entry-summary{grid-template-columns:1fr 1fr!important;grid-template-rows:auto auto!important}.daily-page .daily-date-field{grid-column:1;grid-row:1}.daily-page .daily-reference-field{grid-column:1/-1;grid-row:2}.daily-page .daily-effective-metric{grid-column:2;grid-row:1}.daily-page .daily-total-metric{grid-column:2;grid-row:2}}
@media(max-width:640px){.daily-page .daily-entry-summary{grid-template-columns:1fr!important}.daily-page .daily-date-field,.daily-page .daily-reference-field,.daily-page .daily-effective-metric,.daily-page .daily-total-metric{grid-column:1;grid-row:auto}}


/* RC24 FIX3 · Referencia visualmente más compacta sin mover métricas */
@media(min-width:901px){
  .daily-page .daily-entry-summary{grid-template-columns:minmax(160px,180px) minmax(420px,650px) minmax(0,1fr) 155px 155px!important}
  .daily-page .daily-date-field{grid-column:1;grid-row:1}
  .daily-page .daily-reference-field{grid-column:2;grid-row:1;min-width:0}
  .daily-page .daily-effective-metric{grid-column:4;grid-row:1;align-self:stretch}
  .daily-page .daily-total-metric{grid-column:5;grid-row:1;align-self:stretch}
}

/* RC24 FIX4 · factura administrativa */
.incident-invoice-dropzone{border:1px dashed #9fb4c7;border-radius:8px;padding:10px 12px;background:#f8fbfd;display:flex;align-items:center;gap:10px;cursor:pointer;min-height:58px}
.incident-invoice-dropzone>b{white-space:nowrap}.incident-invoice-dropzone>span{color:#64748b;flex:1}.incident-invoice-dropzone.drag-over{outline:2px solid #1f5d8f;background:#eef6fb}
.incident-summary-invoice{margin-top:10px;border:1px solid #d7e0e8;border-radius:7px;padding:9px 10px;display:flex;align-items:center;gap:10px}.incident-summary-invoice>b{min-width:62px}.incident-summary-invoice>span{flex:1;color:#475569}.incident-summary-invoice button{white-space:nowrap}

/* RC24 FIX5 · Factura compacta en Datos generales */
.incident-invoice-row{display:flex;align-items:stretch;gap:7px;min-width:0}
.incident-invoice-row .incident-invoice-dropzone{flex:1;min-width:0;min-height:43px;padding:6px 9px;gap:7px}
.incident-invoice-row .incident-invoice-dropzone>b{font-size:12px}
.incident-invoice-row .incident-invoice-dropzone>span{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.incident-invoice-row .incident-invoice-dropzone .tiny{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.incident-factusol-icon{width:43px;min-width:43px;padding:0;font-size:22px;line-height:1;border-radius:8px;display:flex;align-items:center;justify-content:center}
@media(max-width:760px){.incident-invoice-row{grid-column:auto}.incident-invoice-row .incident-invoice-dropzone>span{white-space:normal}.incident-invoice-row .incident-invoice-dropzone .tiny{max-width:100%}}
/* RC24 FIX7 · Datos generales/Factura compactos */
.incident-administrative-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:9px 12px;align-items:end}
.incident-administrative-grid .incident-invoice-row{grid-column:1/-1;width:100%}
.incident-admin-billable{min-width:112px}
.incident-invoice-row .incident-invoice-dropzone{min-height:48px;padding:7px 12px}
.incident-invoice-row .incident-invoice-dropzone .tiny{max-width:none;min-width:180px;font-weight:600;color:#334155}
@media(max-width:760px){.incident-administrative-grid{grid-template-columns:1fr}.incident-administrative-grid .incident-invoice-row{grid-column:auto}.incident-admin-billable{min-width:0}}


/* RC24 FIX8 · Factura PDF más amplia y descripción compensada */
@media(min-width:1000px){
  .incident-invoice-row .incident-invoice-dropzone{min-height:94px;padding:12px 14px;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;align-content:center;column-gap:12px;row-gap:5px}
  .incident-invoice-row .incident-invoice-dropzone>b{grid-column:1;grid-row:1/-1;align-self:center;font-size:13px}
  .incident-invoice-row .incident-invoice-dropzone>span{grid-column:2;grid-row:1;font-size:12px;white-space:normal;overflow:visible;text-overflow:clip}
  .incident-invoice-row .incident-invoice-dropzone .tiny{grid-column:2;grid-row:2;max-width:none;min-width:0;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .incident-factusol-icon{min-height:94px;height:auto}
  .incident-description-fit{min-height:300px}
}


/* RC24 FIX9 · respiración visual exclusiva de Resumen de trabajos y SMTP */
#subModal:has(.incident-work-summary) .incident-work-summary{padding:16px 18px 18px}
#subModal:has(.incident-work-summary) .incident-summary-cards{margin:0 0 10px}
#subModal:has(.incident-work-summary) .incident-summary-times{margin:0 0 14px}
#subModal:has(.incident-work-summary) .incident-summary-parts{margin:14px 0 0}
#subModal:has(.incident-work-summary) .incident-summary-materials{margin:16px 0 0}
#subModal:has(.incident-work-summary) .incident-work-summary .empty{margin:16px 0}
#subModal:has(.incident-work-summary) .incident-summary-invoice{margin:14px 0 0}
#subModal:has(.incident-work-summary) .summary-print-toolbar{margin:16px -18px -18px;padding:14px 18px 16px}

.email-settings-panel>h3{margin:20px 18px 8px}
.email-settings-panel>p.tiny{margin:0 18px 12px;line-height:1.45}
.email-settings-panel #smtpForm{padding:18px 18px 20px}
.email-settings-panel #smtpForm .form-grid{gap:12px 14px}
.email-settings-panel #smtpForm label{margin-bottom:10px}
.email-settings-panel #smtpForm .form-actions{margin:12px -18px -20px;padding:13px 18px}
.email-history-panel .email-history-head{padding:14px 18px}

@media(max-width:760px){
 #subModal:has(.incident-work-summary) .incident-work-summary{padding:12px}
 #subModal:has(.incident-work-summary) .summary-print-toolbar{margin:14px -12px -12px;padding:12px}
 .email-settings-panel>h3{margin-left:14px;margin-right:14px}
 .email-settings-panel>p.tiny{margin-left:14px;margin-right:14px}
 .email-settings-panel #smtpForm{padding-left:14px;padding-right:14px}
 .email-history-panel .email-history-head{padding-left:14px;padding-right:14px}
}

/* RC24 FIX16 · Desplazamiento como fila de Actividad, alineado con los tramos horarios */
.daily-travel-lines{margin-top:0;display:block}
.daily-travel-row{display:grid;grid-template-columns:minmax(165px,1.35fr) minmax(120px,.9fr) 92px 18px 92px 78px 32px;gap:6px;align-items:end;min-width:0;padding:3px 0;border:0}
.daily-travel-row .travel-label{grid-column:1;height:36px;box-sizing:border-box;display:flex;align-items:center;width:100%;min-width:0;padding:7px 10px;border:1px solid var(--border);border-radius:8px;background:#fff;font:inherit;font-size:13px;font-weight:400;color:var(--text);line-height:20px}
.daily-travel-row .travel-unit-field{grid-column:6;display:flex;flex-direction:column;gap:3px;align-items:stretch;margin:0;font-size:11px;font-weight:700;color:#687386}
.daily-travel-row .travel-unit-field>span{line-height:13px}
.daily-travel-row .travel-units{min-width:0;width:100%;height:36px;box-sizing:border-box;padding:7px 8px;font-size:13px}
.daily-travel-row .remove-travel{grid-column:7;height:32px;width:32px;align-self:end;justify-self:end}
@media(max-width:900px){.daily-travel-row{grid-template-columns:1fr 1fr 88px 16px 88px 70px 30px}.daily-travel-row .travel-label{grid-column:1}.daily-travel-row .travel-unit-field{grid-column:6}.daily-travel-row .remove-travel{grid-column:7}}
@media(max-width:700px){.daily-travel-row{grid-template-columns:minmax(0,1fr) 90px 32px;align-items:end}.daily-travel-row .travel-label{grid-column:1}.daily-travel-row .travel-unit-field{grid-column:2}.daily-travel-row .remove-travel{grid-column:3;justify-self:end}}

/* RC24 FIX17 · Desplazamiento usa un control igual al campo Técnico */
.daily-travel-row input.travel-label{
  grid-column:1;
  width:100%;
  min-width:0;
  height:36px;
  box-sizing:border-box;
  padding:7px 10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  font:inherit;
  font-size:13px;
  font-weight:400;
  line-height:20px;
  opacity:1;
  -webkit-text-fill-color:var(--text);
  cursor:default;
}

/* RC24 FIX17 · La regla de color de agenda no debe convertir week-event en relativo.
   Los eventos simultáneos se posicionan de forma absoluta dentro del mismo día y
   comparten el ancho por carriles, manteniendo exactamente la misma altura/hora. */
.week-event{position:absolute}
.month-event{position:relative}


/* RC24 FIX18 · Desplazamiento integrado en la rejilla de Actividad.
   Mismo aspecto que Técnico, solo lectura, sin etiqueta Unidad. */
.daily-travel-row{
  align-items:center;
  padding:3px 0;
}
.daily-travel-row input.travel-label{
  grid-column:1;
  width:100%;
  min-width:0;
  height:36px;
  box-sizing:border-box;
  padding:7px 10px;
  border:1px solid #cbd5e1;
  border-radius:8px;
  background:#fff;
  color:#1e293b;
  font:inherit;
  font-size:13px;
  font-weight:400;
  line-height:20px;
  opacity:1;
  -webkit-text-fill-color:#1e293b;
  cursor:default;
  user-select:none;
}
.daily-travel-row .travel-units{
  grid-column:6;
  width:78px;
  min-width:78px;
  max-width:78px;
  height:36px;
  justify-self:stretch;
  box-sizing:border-box;
  padding:7px 8px;
  font-size:13px;
}
.daily-travel-row .remove-travel{
  grid-column:7;
  width:32px;
  height:32px;
  align-self:center;
  justify-self:end;
}
@media(max-width:900px){
  .daily-travel-row .travel-label{grid-column:1}
  .daily-travel-row .travel-units{grid-column:6;width:70px;min-width:70px;max-width:70px}
  .daily-travel-row .remove-travel{grid-column:7}
}
@media(max-width:700px){
  .daily-travel-row{grid-template-columns:minmax(0,1fr) 72px 32px}
  .daily-travel-row .travel-label{grid-column:1}
  .daily-travel-row .travel-units{grid-column:2;width:72px;min-width:72px;max-width:72px}
  .daily-travel-row .remove-travel{grid-column:3}
}

/* RC24 FIX25 · flags de parte en incidencia */
.incident-tab-table th.center,.incident-tab-table td.center{text-align:center;white-space:nowrap}
.incident-part-flag{width:18px;height:18px;vertical-align:middle;cursor:pointer}
.incident-part-flag:disabled{cursor:not-allowed;opacity:.55}
.incident-part-flags-help{margin-top:7px;color:var(--muted,#64748b)}

/* RC24 FIX35 · Teléfono visible junto a Centro y Contacto en Incidencias */
.incident-contact-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px 12px;min-width:0}
.incident-contact-row>label{min-width:0}
#iContactPhone[readonly]{background:#f8fafc;color:#1e293b;cursor:default}
@media(max-width:700px){.incident-contact-row{grid-template-columns:1fr}}


/* RC24 FIX36 · Alineación uniforme del bloque de aviso en Incidencias */
.incident-notice-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px 12px;min-width:0}
.incident-notice-row>label{min-width:0}
@media(max-width:700px){.incident-notice-row{grid-template-columns:1fr}}


/* RC25 FIX1 · densidad estable en listas globales multiempresa */
.incident-list-panel{min-height:0!important;height:auto!important;max-height:none!important;display:block!important}
.incident-list-wrap{min-height:0!important;height:auto!important;overflow:hidden!important}
.incident-list-table{height:auto!important;min-height:0!important}
.incident-list-table tbody{height:auto!important}
.incident-list-table tbody tr{height:43px!important;min-height:43px!important}
.incident-list-table tbody td{height:43px!important;padding-top:7px!important;padding-bottom:7px!important;vertical-align:middle!important}
.page-reserve-space[data-page-reserve="incidents"]{display:block!important;flex:none!important}

/* RC25 FIX3 · Partes globales: recuperar Conformidad y redistribuir columnas */
.workorder-page-table table{table-layout:fixed!important;width:100%!important;max-width:100%!important}
.workorder-page-table th:nth-child(1),.workorder-page-table td:nth-child(1){width:8%!important}   /* Parte */
.workorder-page-table th:nth-child(2),.workorder-page-table td:nth-child(2){width:10%!important}  /* Empresa */
.workorder-page-table th:nth-child(3),.workorder-page-table td:nth-child(3){width:10%!important}  /* Referencia */
.workorder-page-table th:nth-child(4),.workorder-page-table td:nth-child(4){width:25%!important}  /* Incidencia / cliente */
.workorder-page-table th:nth-child(5),.workorder-page-table td:nth-child(5){width:10%!important}  /* Última modificación */
.workorder-page-table th:nth-child(6),.workorder-page-table td:nth-child(6){width:18%!important}  /* Técnicos */
.workorder-page-table th:nth-child(7),.workorder-page-table td:nth-child(7){width:7%!important}   /* Tiempo */
.workorder-page-table th:nth-child(8),.workorder-page-table td:nth-child(8){width:12%!important}  /* Conformidad */

/* RC25 FIX5 · selector de empresa local en Clientes */
.customer-search-toolbar #customerCompanyFilter{flex:0 0 230px;max-width:300px;min-width:180px}
@media(max-width:650px){.customer-search-toolbar #customerCompanyFilter{width:100%;max-width:none;min-width:0}}
/* RC25 FIX17 · Contact manager footer breathing room */
.customer-contact-manager>.form-actions{margin:14px -24px -8px;padding:12px 24px 10px}
@media(max-width:850px){.customer-contact-manager>.form-actions{margin:12px -14px -6px;padding:11px 14px 9px}}


/* RC25 FIX21 · reajuste visual de listas Incidencias / Partes */
/* Partes: más espacio para número e Incidencia/cliente; menos para Empresa, Técnicos y Tiempo. */
.workorder-page-table th:nth-child(1),.workorder-page-table td:nth-child(1){width:11%!important} /* Parte */
.workorder-page-table th:nth-child(2),.workorder-page-table td:nth-child(2){width:8%!important}  /* Empresa */
.workorder-page-table th:nth-child(3),.workorder-page-table td:nth-child(3){width:10%!important} /* Referencia */
.workorder-page-table th:nth-child(4),.workorder-page-table td:nth-child(4){width:28%!important} /* Incidencia / cliente */
.workorder-page-table th:nth-child(5),.workorder-page-table td:nth-child(5){width:10%!important} /* Última modificación */
.workorder-page-table th:nth-child(6),.workorder-page-table td:nth-child(6){width:16%!important} /* Técnicos */
.workorder-page-table th:nth-child(7),.workorder-page-table td:nth-child(7){width:5%!important}  /* Tiempo */
.workorder-page-table th:nth-child(8),.workorder-page-table td:nth-child(8){width:12%!important} /* Conformidad */

.project-tabs{display:flex;gap:8px;margin-bottom:16px;border-bottom:1px solid #dfe5eb;padding-bottom:8px}.project-tabs button.active{font-weight:700}.project-timeline{display:flex;flex-direction:column;gap:10px}.project-activity{display:grid;grid-template-columns:110px 1fr auto;gap:16px;align-items:center;padding:14px;border:1px solid #e2e7ec;border-radius:10px;background:#fff}.project-date{font-weight:700}.project-people{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;border:1px solid #dfe5eb;border-radius:8px;padding:10px;max-height:150px;overflow:auto}.project-doc-upload{display:grid;grid-template-columns:1fr 1fr auto;gap:10px;margin-bottom:14px}.project-summary-grid{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:14px}.project-total{font-size:32px;font-weight:800;margin-top:18px}.project-summary-row{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:1px solid #edf0f3}@media(max-width:1000px){.project-summary-grid{grid-template-columns:1fr}.project-people{grid-template-columns:1fr 1fr}}

/* RC26 FIX1 · Proyectos: modal estable entre pestañas y espaciado uniforme */
#modal:has(.project-tabs) .modal-card{
  width:min(1120px,96vw);
  height:min(720px,92vh);
  max-height:92vh;
}
#modal:has(.project-tabs) #modalBody{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
#modal:has(.project-tabs) .project-tabs{
  flex:0 0 auto;
  margin:0;
  padding:8px 12px;
  gap:8px;
  border-bottom:1px solid #dfe5eb;
}
#modal:has(.project-tabs) [data-project-panel]{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:18px;
}
#modal:has(.project-tabs) [data-project-panel="general"]{
  padding:0;
}
#modal:has(.project-tabs) [data-project-panel="general"] .form{
  min-height:100%;
  padding:18px;
  display:flex;
  flex-direction:column;
}
#modal:has(.project-tabs) [data-project-panel="general"] .form-grid{
  flex:1 0 auto;
  align-content:start;
}
#modal:has(.project-tabs) [data-project-panel="general"] .form-actions{
  flex:0 0 auto;
}
#modal:has(.project-tabs) .project-doc-upload{
  margin:0 0 14px;
}
#modal:has(.project-tabs) .project-summary-grid{
  margin:0;
}
#modal:has(.project-tabs) .project-timeline{
  margin:0;
}
@media(max-width:850px){
  #modal:has(.project-tabs) .modal-card{width:96vw;height:92vh}
  #modal:has(.project-tabs) [data-project-panel]{padding:14px}
  #modal:has(.project-tabs) [data-project-panel="general"]{padding:0}
}

/* RC26 FIX2 · Proyectos: selección/edición, cronograma compacto y resumen legible */
.project-people{gap:4px 12px;padding:9px 12px}
.project-person-option{display:flex!important;align-items:center!important;gap:8px!important;min-height:28px;margin:0!important;padding:2px 0!important;line-height:1.2}
.project-person-option input[type="checkbox"]{flex:0 0 auto;margin:0!important}
.project-person-option span{display:block;line-height:1.2}
.project-activity-toolbar{display:flex;justify-content:flex-end;gap:8px;margin:0 0 10px}
.project-timeline{gap:6px}
.project-activity{grid-template-columns:110px 1fr;gap:14px;padding:8px 12px;min-height:54px;border-radius:8px;cursor:pointer;transition:border-color .12s,box-shadow .12s,background .12s}
.project-activity:hover{background:#f8fafc}
.project-activity.selected{border-color:#276c9e;box-shadow:0 0 0 1px #276c9e;background:#f5f9fc}
.project-activity-main{min-width:0;line-height:1.25}
.project-activity-description{margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.project-activity .tiny{margin-top:2px}
.project-summary-grid>.panel{padding:18px!important;min-width:0;overflow:hidden}
.project-summary-grid>.panel h3{margin:0 0 14px}
.project-summary-grid>.panel p{margin:0 0 12px;line-height:1.35}
.project-summary-grid>.panel:nth-child(2),.project-summary-grid>.panel:nth-child(3){display:flex;flex-direction:column;max-height:360px}
.project-summary-grid>.panel:nth-child(2) .project-summary-row,.project-summary-grid>.panel:nth-child(3) .project-summary-row{flex:0 0 auto}
.project-summary-row{padding:8px 4px;align-items:center}
.project-summary-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-right:10px}
.project-summary-row b{flex:0 0 auto}
.project-total{margin-top:22px}


/* RC26 FIX3 · Actividad como submodal y cronograma realmente compacto */
.project-timeline{gap:4px!important}
.project-activity{display:grid!important;grid-template-columns:112px 120px minmax(180px,1.6fr) minmax(160px,1.25fr) 72px 92px!important;gap:10px!important;align-items:center!important;padding:5px 10px!important;min-height:36px!important;border-radius:7px!important;font-size:13px!important;line-height:1.15!important}
.project-activity>div{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.project-date{font-size:13px!important}
.project-phase b{font-size:13px!important}
.project-activity-title,.project-activity-people{font-size:12.5px!important}
.project-activity-duration,.project-activity-time{text-align:right;font-size:12px!important;color:#52657a}
#subModal:has(#projectActivityForm) .modal-card{width:min(760px,94vw);max-height:90vh}
#subModal:has(#projectActivityForm) #subModalBody{overflow:auto}
@media(max-width:900px){.project-activity{grid-template-columns:100px 105px minmax(150px,1fr) 70px 84px!important}.project-activity-people{display:none}}
/* RC26 FIX4 · Project activity tracking */
.project-timeline-section{margin-bottom:14px}.project-timeline-heading{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:800;margin:6px 0}.project-timeline-heading span{font-size:11px;font-weight:700;padding:2px 7px;border-radius:10px;background:#edf2f6}.project-activity{grid-template-columns:92px 82px 105px minmax(160px,1.5fr) minmax(140px,1.15fr) 68px 88px!important}.project-activity-status{font-size:11px!important;font-weight:700}.project-activity.status-pending .project-activity-status{opacity:.75}.project-activity.status-in_progress .project-activity-status{font-weight:800}.project-summary-actions{display:flex;justify-content:flex-end;margin:0 0 10px}.project-kpis{display:flex;flex-wrap:wrap;gap:7px;margin:12px 0}.project-kpis span{padding:5px 8px;border:1px solid #e1e7ec;border-radius:7px;font-size:11px}.project-kpis b{font-size:13px}.project-actual-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.project-field-muted{opacity:.55}
@media(max-width:900px){.project-activity{grid-template-columns:88px 76px 95px minmax(140px,1fr) 65px!important}.project-activity-people,.project-activity-time{display:none}.project-actual-fields{grid-template-columns:1fr}}

/* RC26 FIX10 · Proyecto/cliente redistribuido + actividad sin saltos */
#modal:has(.project-tabs) .modal-card{width:min(1240px,97vw);height:min(790px,94vh)}
#modal:has(.project-tabs) [data-project-panel="general"] .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.project-customer-panel{padding:18px!important}
.project-customer-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-content:start}
.project-customer-grid>.span2,.project-customer-grid>#projectContactsSection{grid-column:1/-1}
#projectManualCustomer .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#projectContactsSection{margin-top:4px}
#submodal:has(#projectActivityForm) .modal-card,#submodal:has(#projectActivityForm) .submodal-card{width:min(820px,94vw);height:min(720px,90vh);max-height:90vh}
#submodal:has(#projectActivityForm) .modal-body,#submodal:has(#projectActivityForm) .submodal-body{overflow-y:auto;min-height:0}
#projectActivityForm #projectActivitySubphase:disabled{opacity:.6;cursor:not-allowed}
@media(max-width:850px){#modal:has(.project-tabs) .modal-card{width:97vw;height:94vh}.project-customer-grid,#projectManualCustomer .form-grid{grid-template-columns:1fr}.project-customer-grid>*{grid-column:1!important}}
/* RC26 FIX11 - Project customer workflow */
.project-erp-selection-grid{display:grid;grid-template-columns:1.1fr 1.1fr .75fr 1.25fr;gap:10px;align-items:end}
.project-erp-selection-grid .span4{grid-column:1/-1}
.project-erp-address{margin-top:2px}.project-erp-address>span{display:block;font-size:12px;font-weight:600;margin-bottom:4px}.project-erp-address>div{min-height:34px;padding:8px 10px;border:1px dashed var(--line,#cbd5e1);border-radius:8px;background:#f8fafc}
#projectManualCustomer .form-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:8px 10px}
#projectManualCustomer label{margin:0}#projectManualCustomer label.span2{grid-column:span 6}
#projectManualCustomer label:has([name="customer_tax_id"]){grid-column:span 2}#projectManualCustomer label:has([name="customer_phone"]){grid-column:span 2}#projectManualCustomer label:has([name="customer_email"]){grid-column:span 2}
#projectManualCustomer label:has([name="customer_address"]){grid-column:span 6}#projectManualCustomer label:has([name="customer_postal_code"]){grid-column:span 1}#projectManualCustomer label:has([name="customer_city"]){grid-column:span 3}#projectManualCustomer label:has([name="customer_province"]){grid-column:span 2}
#projectManualCustomer input{min-height:34px;padding-top:6px;padding-bottom:6px}
@media(max-width:900px){.project-erp-selection-grid{grid-template-columns:1fr 1fr}.project-erp-selection-grid .span4{grid-column:1/-1}#projectManualCustomer .form-grid{grid-template-columns:1fr 1fr}#projectManualCustomer .form-grid>label{grid-column:auto!important}#projectManualCustomer .form-grid>label.span2{grid-column:1/-1!important}}

/* RC26 FIX14 - Daily planning reminder modal: stable space for four interventions */
#modal:has(.today-planning-reminder) .modal-card{
  width:min(1120px,94vw);
  height:min(600px,82vh);
  max-height:82vh;
}
#modal:has(.today-planning-reminder) #modalBody{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}
.today-planning-reminder{
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  padding:18px 24px 0;
}
.today-planning-list{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  border:1px solid #dce4eb;
  border-radius:12px;
  background:#fff;
  padding:8px 14px;
}
.today-planning-item{
  min-height:92px;
  display:grid;
  grid-template-columns:86px 150px minmax(220px,1fr) minmax(180px,1fr);
  align-items:center;
  gap:10px 16px;
  padding:12px 10px;
  border-bottom:1px solid #e5eaf0;
  cursor:pointer;
}
.today-planning-item:last-child{border-bottom:0}
.today-planning-item:hover{background:#f8fafc}
.today-planning-time,.today-planning-number{font-weight:800}
.today-planning-customer{font-weight:650}
.today-planning-center{color:#475569}
.today-planning-actions{
  flex:0 0 auto;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin:14px -24px 0;
  padding:12px 24px 14px;
  border-top:1px solid #e2e8f0;
  background:#fff;
}
@media(max-width:760px){
  #modal:has(.today-planning-reminder) .modal-card{width:96vw;height:min(680px,92vh);max-height:92vh}
  .today-planning-reminder{padding:14px 14px 0}
  .today-planning-item{grid-template-columns:72px 1fr;min-height:110px;gap:5px 10px}
  .today-planning-customer,.today-planning-center{grid-column:1/-1}
  .today-planning-actions{margin:12px -14px 0;padding:11px 14px 13px}
}

/* RC26 FIX24 · Proyecto/Fase compacto sin alterar el alto del modal */
.incident-project-row{display:grid;grid-template-columns:1.1fr .9fr;gap:9px 12px;align-items:end;margin:0 0 9px}
.incident-description-card .incident-description-fields{grid-template-rows:auto minmax(0,1fr);gap:9px;flex:1 1 0;overflow:hidden}
.incident-description-card .incident-description-fields>label:first-child{margin:0}
.incident-description-card .incident-description-fields>label:first-child input{height:38px;min-height:38px}
.incident-description-card .incident-description-fields>label:last-child{margin:0;min-height:0}
.incident-description-card .incident-description-fit{height:100%;min-height:0!important;max-height:none;resize:none}
@media(min-width:901px){#modal:has(.incident-tabs) .incident-tab-panel[data-panel="general"]{overflow:hidden}.incident-description-card{overflow:hidden}}
@media(max-width:900px){.incident-project-row{grid-template-columns:1fr 1fr}}

/* RC26 FIX28 · tema automático claro/oscuro según el sistema operativo */
:root{color-scheme:light dark}
@media (prefers-color-scheme: dark){
  :root{color:#e5edf5;background:#0f1720;color-scheme:dark}
  html,body{background:#0f1720;color:#e5edf5}
  body,.app,main,#content{background:#0f1720;color:#e5edf5}
  aside{background:#0b1b2a;color:#f1f5f9}
  nav button{color:#c8d4df}nav button.active,nav button:hover{background:#1d3b55;color:#fff}
  header,.card,.panel,.modal-card,.login-card,table,.form-actions,.planning-entry-card,.status-history-row,.incident-summary-times span{background:#18222d;color:#e5edf5}
  header,.card,.panel,.modal-card,.modal-head,.panel-head,.form-actions,.modal-toolbar,.customer-related,.conformity-actions,.incident-status-history-box,.summary-print-toolbar,.daily-page .daily-materials-section,.incident-tabs{border-color:#334252}
  h1,h2,h3,h4,b,strong,.metric,.incident-summary-cards b{color:#f1f5f9}
  .muted,.tiny,#viewSubtitle,.side-brand span,.active-company span,.context-banner span,.active-company-note span,.location-preview span,.attachment-name span,.workorder-status-control>span,.status-history-row>div:first-child span,.status-history-meta,.incident-summary-cards span,.planning-entry-card span{color:#9fb0c1}
  input,select,textarea{background:#111a24;color:#e7eef6;border-color:#405162;color-scheme:dark}
  input::placeholder,textarea::placeholder{color:#7f91a3}
  input:disabled,select:disabled,textarea:disabled{background:#202b36;color:#8fa0b1;opacity:1}
  button{background:#2b3947;color:#edf3f8}button:hover{background:#354657}.primary{background:#236fa5;color:#fff}.danger{background:#991b1b;color:#fff}.danger-outline{background:#18222d;border-color:#7f3030;color:#fca5a5}.danger-outline:hover{background:#3a1e22}
  th{background:#202c38;color:#b9c7d5;border-color:#3b4a59}td{border-color:#2c3946}tr:hover td{background:#202c38}
  .selectable-row.selected-row td,.selectable-contact.selected-row{background:#173a52!important;color:#f1f5f9}.selectable-row.selected-row td{box-shadow:inset 0 1px 0 #315d78,inset 0 -1px 0 #315d78}.selectable-row.selected-row td:first-child{box-shadow:inset 3px 0 0 #55a8df,inset 0 1px 0 #315d78,inset 0 -1px 0 #315d78}
  .context-banner,.active-company-note,.incident-planning-highlight{background:#172c3c;border-color:#315066}.active-company select{background:#111a24;border-color:#45657c;color:#e7eef6}
  .location-preview,.panel-light,.planning-availability,.workorder-status-control,.incident-summary-cards>div{background:#151f29;border-color:#334252}
  .employee-picker,.face-unit{border-color:#405162}.face-unit legend{color:#c7d3df}
  .modal{background:#02070dbd}.sub-modal{background:#02070dd9}.toast{background:#1d4f70;color:#fff}
  .badge{background:#344353;color:#e7eef6}.badge.danger{background:#5b2025;color:#fecaca;border:1px solid #7f3030}.badge.off,.badge.INVOICED{background:#303a45;color:#cbd5df}.badge.LOW{background:#273442;color:#cbd5e1}.badge.NEW,.badge.NORMAL{background:#183b63;color:#bfdbfe}.badge.HIGH{background:#5a321d;color:#fed7aa}.badge.URGENT{background:#5b2025;color:#fecaca}.badge.PLANNED{background:#3c2b62;color:#ddd6fe}.badge.IN_PROGRESS,.badge.WO-IN_PROGRESS{background:#164653;color:#a5f3fc}.badge.PENDING,.badge.WO-PENDING,.badge.WAITING_CONFORMITY{background:#55431a;color:#fde68a}.badge.CLOSED,.badge.WO-FINALIZED,.badge.ok{background:#183f2b;color:#bbf7d0}
  .incident-tab{background:#202c38;border-color:#3b4a59;color:#b9c7d5}.incident-tab.active{background:#18222d;color:#8dccf4;border-bottom-color:#18222d;box-shadow:inset 0 -2px 0 #55a8df}.incident-tab.has-planning{background:#173248;color:#8dccf4}
  .planning-PLANNED{background:#172d43}.planning-DONE{background:#173727}.planning-CANCELLED{background:#2a3037}.availability-ok{background:#173727}.availability-warning{background:#453716}.availability-conflict{border-color:#5a4b2b}.availability-conflict span{color:#b7c2cc}
  .section-title,.attachment-item,.contact-card{border-color:#2c3946}
  a{color:#7cc4f2}
  ::-webkit-scrollbar{width:11px;height:11px}::-webkit-scrollbar-track{background:#111a24}::-webkit-scrollbar-thumb{background:#405162;border-radius:8px;border:2px solid #111a24}::-webkit-scrollbar-thumb:hover{background:#53677a}
}

/* RC26 FIX29 — segunda pasada modo oscuro: componentes heredados con fondos claros */
@media (prefers-color-scheme: dark){
  :root{--bg:#0f1720;--surface:#18222d;--surface-2:#202c38;--border:#3b4a59;--line:#3b4a59;--text:#e5edf5;--muted:#9fb0c1;--primary:#2b83bd}

  /* Contenedores y paneles internos */
  .panel-light,.planning-summary,.planning-team-agenda-panel,.planning-week-header,
  .planning-week-tech-col,.planning-week-tech,.planning-week-fixed-column,.planning-week-fixed-head,
  .planning-week-fixed-body,.planning-week-fixed-tech,.planning-week-days-scroll,.planning-week-days-header,
  .planning-week-day-cell,.planning-week-days-row .planning-week-day-cell,
  .permission-grid,.permissions-list,.permission-check,.security-secret,.profile-scope-grid,
  .profile-permission-tabs,.profile-permission-panels,.profile-permission-tab,
  .account-summary,.employee-user-link,.backup-schedule-status,.article-sync-note,
  .project-activity,.project-erp-address>div,.incident-invoice-dropzone,
  .notification-panel,.notification-popup,.agenda-event-tooltip,
  .customer-contact-manager #contactManagerList,.factusol-customer-table-wrap{
    background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important;
  }
  .planning-week-row.incident-assigned .planning-week-tech,.planning-week-fixed-tech.incident-assigned,
  .planning-week-row.selected-tech .planning-week-tech{background:#1b2d3d!important}
  .planning-week-day-cell.selected-day,.planning-week-days-row .planning-week-day-cell.selected-day,
  .planning-week-days-header .planning-week-day-head.selected-day{background:#173248!important}

  /* Agenda mensual/semanal */
  .month-weekdays{background:#202c38!important;border-color:#3b4a59!important}
  .month-weekdays>div{color:#c7d3df!important;border-color:#3b4a59!important}
  .month-grid{background:#3b4a59!important}
  .month-day,.month-day.weekend:not(.outside-month){background:#18222d!important}
  .month-day:hover{background:#202c38!important}.month-day.outside-month{background:#111a24!important}
  .month-day-number{color:#dce7f1!important}.month-day.outside-month .month-day-number{color:#6f8193!important}
  .week-calendar,.week-grid,.week-day,.week-hour,.week-time,.week-body{background:#18222d;color:#e5edf5;border-color:#3b4a59}
  .planning-week-days-scroll{background:#18222d!important}
  .planning-week-days-row,.planning-week-row,.planning-week-day-head,.planning-week-fixed-tech{border-color:#3b4a59!important}

  /* Mantener colores de incidencia, pero con texto legible en oscuro */
  .month-event,.week-event{color:#0f172a!important}
  .month-event b,.week-event b,.month-event span,.week-event span{color:#0f172a!important}
  .agenda-event-tooltip{color:#e5edf5!important}.agenda-tooltip-title{color:#f1f5f9!important;border-color:#3b4a59!important}
  .agenda-tooltip-row b{color:#b9c7d5!important}.agenda-tooltip-description{border-color:#2c3946!important}

  /* Documentos, planificación y formularios que conservaban cajas blancas */
  .incident-tab-panel,.incident-documents-panel,.incident-doc-section,.incident-planning-panel,
  .incident-planning-assignment,.incident-planning-team,.customer-tab-panel,.maintenance-section,
  .project-tab-panel,.project-section,.daily-section{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  .incident-documents-panel table,.incident-doc-section table{background:#18222d!important}
  .incident-doc-actions button{background:#202c38!important;color:#e5edf5!important;border-color:#405162!important}
  .employee-picker{background:#111a24!important;color:#e5edf5!important;border-color:#405162!important}
  .employee-check{color:#dbe6f0!important}

  /* Proyectos */
  .project-activity:hover{background:#202c38!important}
  .project-tabs,.project-summary-row{border-color:#3b4a59!important}
  .project-people{background:#111a24!important;border-color:#405162!important}
  .project-erp-address>span{color:#c7d3df!important}

  /* Perfiles, cuenta y avisos */
  .profile-permission-tab{background:#202c38!important;color:#c7d3df!important}
  .profile-permission-tab.active{background:#236fa5!important;color:#fff!important;border-color:#236fa5!important}
  .role-profile-form>.form-actions{background:#18222d!important;border-color:#3b4a59!important}
  .account-summary>div>span,.account-help{color:#9fb0c1!important}.account-2fa-status{background:#202c38!important;color:#b9c7d5!important}
  .notification-panel-head,.notification-item{border-color:#334252!important}.notification-item:hover{background:#202c38!important}
  .notification-item p,.notification-popup span,.notification-item small{color:#aebdcb!important}

  /* Copias, auditoría y ficheros */
  .backup-card input[type=file],input[type=file]{background:#111a24!important;color:#dce7f1!important;border-color:#405162!important}
  input[type=file]::file-selector-button{background:#2b3947;color:#edf3f8;border:0;border-radius:6px;padding:6px 9px;margin-right:10px}
  .audit-pagination{background:#18222d!important;color:#9fb0c1!important;border-color:#3b4a59!important}
  .audit-filters label{color:#b9c7d5!important}

  /* Artículos / partes */
  .article-table th{background:#202c38!important}.article-table tbody tr:hover{background:#202c38!important}
  .daily-material-row .mat-code,.daily-material-row .mat-description,.daily-travel-row .travel-label{background:#111a24!important;color:#e5edf5!important;border-color:#405162!important}
  #iContactPhone[readonly]{background:#202b36!important;color:#cbd7e2!important}

  /* Elementos claros residuales y textos */
  .page-reserve-space{background:#0f1720!important}
  .company-logo-preview,.company-logo-file-button{background:#18222d!important;color:#e5edf5!important;border-color:#405162!important}
  .company-logo-preview.empty-logo{background:#111a24!important;color:#9fb0c1!important}
  .maintenance-form .maintenance-section{border-color:#3b4a59!important}
  .empty{color:#8fa2b5!important}
  hr{border-color:#334252}
}

/* RC26 FIX30 — modo oscuro: incidencias, agenda, partes, tabs y perfiles */
@media (prefers-color-scheme: dark){
  /* Incidencias: tarjetas internas de Datos generales / Planificación / Documentos */
  #modal:has(.incident-tabs) .incident-tab-panel .panel,
  #modal:has(.incident-tabs) .incident-customer-card,
  #modal:has(.incident-tabs) .incident-description-card,
  #modal:has(.incident-tabs) .incident-administrative-card,
  #modal:has(.incident-tabs) .incident-admin-documents-panel,
  #modal:has(.incident-tabs) .incident-planning-panel,
  #modal:has(.incident-tabs) .incident-planning-assignment,
  #modal:has(.incident-tabs) .incident-planning-team,
  #modal:has(.incident-tabs) .incident-documents-panel,
  #modal:has(.incident-tabs) .incident-doc-section{
    background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important;
  }
  #modal:has(.incident-tabs) .panel-head,
  #modal:has(.incident-tabs) .section-title{border-color:#334252!important}

  /* Incidencias: estados visibles y filtros de columna */
  .incident-status-option{background:#202c38!important;color:#e5edf5!important;border-color:#405162!important}
  .incident-status-option:hover{background:#293847!important}
  .incident-status-option input[type="checkbox"]{accent-color:#55a8df}
  .incident-filter-menu{background:#18222d!important;color:#e5edf5!important;border-color:#405162!important;box-shadow:0 10px 26px rgba(0,0,0,.42)!important}
  .incident-filter-menu label,.incident-filter-menu .filter-menu-title,.incident-filter-menu .filter-check{color:#dbe6f0!important}
  .incident-filter-menu .filter-check:hover{background:#202c38!important}
  .incident-filter-menu .filter-clear-one{background:#2b3947!important;color:#edf3f8!important;border-color:#405162!important}

  /* Agenda semanal clásica: eliminar toda la superficie blanca de la rejilla */
  .week-calendar,.week-head,.week-scroll,.week-time-axis,.week-days,.week-day-column{
    background-color:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important;
  }
  .week-head>div,.week-day-head,.week-day-column,.week-time-axis>div{border-color:#334252!important}
  .week-day-head span,.week-time-axis span{color:#9fb0c1!important}
  .week-time-axis span{background:#18222d!important}
  .week-days{background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 63px,#334252 63px,#334252 64px)!important}
  .week-day-column.today,.week-day-head.today{background:#173248!important;color:#8dccf4!important}

  /* Partes de trabajo: pie fijo y visualización de firma */
  .daily-page .daily-entry-footer,.daily-entry-footer{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  .signature-visible{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  .signature-visible img{background:#202c38!important;border-color:#405162!important}

  /* Tabs activos que aún heredaban el fondo claro */
  .customer-tab.active,
  .article-tabs .customer-tab.active,
  .article-tab.active,
  .employee-tab.active{
    background:#202c38!important;color:#8dccf4!important;border-color:#3b4a59!important;
    box-shadow:inset 0 -2px 0 #55a8df!important;
  }
  .customer-tab,.article-tab,.employee-tab{color:#aebdcb!important}

  /* Perfiles y permisos */
  .profile-row{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  .profile-row:hover{background:#202c38!important}
  .profile-row small,.permission-check small{color:#9fb0c1!important}
  .permission-grid,.permissions-list{background:#18222d!important;border-color:#3b4a59!important}
  .permission-check{background:#202c38!important;color:#e5edf5!important;border-color:#405162!important}
}

/* RC26 FIX31 — corrección real de superficies claras residuales en modo oscuro.
   Se duplica el disparador mediante data-theme para no depender únicamente del media query. */
:root[data-theme="dark"] .incident-section-card,
:root[data-theme="dark"] #modal .incident-section-card,
:root[data-theme="dark"] #subModal .incident-section-card,
:root[data-theme="dark"] .incident-tab-list,
:root[data-theme="dark"] .incident-admin-documents-panel,
:root[data-theme="dark"] .incident-planning-highlight,
:root[data-theme="dark"] .planning-left-card,
:root[data-theme="dark"] .planning-team-agenda-panel,
:root[data-theme="dark"] .profile-permission-tabs,
:root[data-theme="dark"] .profile-permission-panels,
:root[data-theme="dark"] .permission-switch-row,
:root[data-theme="dark"] .daily-entry-footer,
:root[data-theme="dark"] .signature-visible,
:root[data-theme="dark"] .signature-visible img {
  background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important;
}
:root[data-theme="dark"] .planning-left-card label,
:root[data-theme="dark"] .planning-left-card .field-label,
:root[data-theme="dark"] .planning-left-card .planning-card-title,
:root[data-theme="dark"] .permission-switch-row {color:#dce7f1!important}
:root[data-theme="dark"] .planning-left-card .tiny,
:root[data-theme="dark"] .planning-team-agenda-panel .tiny {color:#9fb0c1!important}
:root[data-theme="dark"] .planning-left-card input,
:root[data-theme="dark"] .planning-left-card select,
:root[data-theme="dark"] .planning-left-card textarea,
:root[data-theme="dark"] .planning-left-card .employee-picker {background:#111a24!important;color:#e7eef6!important;border-color:#405162!important}
:root[data-theme="dark"] .planning-week-day-cell,
:root[data-theme="dark"] .planning-week-days-row .planning-week-day-cell,
:root[data-theme="dark"] .planning-week-fixed-tech,
:root[data-theme="dark"] .planning-week-fixed-head,
:root[data-theme="dark"] .planning-week-days-header {background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
:root[data-theme="dark"] .planning-week-day-cell.selected-day,
:root[data-theme="dark"] .planning-week-days-row .planning-week-day-cell.selected-day,
:root[data-theme="dark"] .planning-week-days-header .planning-week-day-head.selected-day {background:#173248!important}
:root[data-theme="dark"] .planning-week-entry,
:root[data-theme="dark"] .planning-week-slot {color:#dce7f1!important}
:root[data-theme="dark"] .week-head,
:root[data-theme="dark"] .week-scroll,
:root[data-theme="dark"] .week-time-axis,
:root[data-theme="dark"] .week-days,
:root[data-theme="dark"] .week-day-column {background-color:#18222d!important;color:#e5edf5!important;border-color:#334252!important}
:root[data-theme="dark"] .week-time-axis span {background:#18222d!important;color:#9fb0c1!important}
:root[data-theme="dark"] .week-days {background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 63px,#334252 63px,#334252 64px)!important}
:root[data-theme="dark"] .maintenance-tab.active {background:#202c38!important;color:#8dccf4!important;border:1px solid #3b4a59!important;box-shadow:inset 0 -2px 0 #55a8df!important}
:root[data-theme="dark"] .maintenance-tab:not(.active) {color:#aebdcb!important}
:root[data-theme="dark"] .profile-permission-tab {background:#202c38!important;color:#c7d3df!important;border-color:#405162!important}
:root[data-theme="dark"] .profile-permission-tab.active {background:#236fa5!important;color:#fff!important;border-color:#236fa5!important}
:root[data-theme="dark"] .permission-switch-row {background:#202c38!important}
:root[data-theme="dark"] .incident-status-option {background:#202c38!important;color:#e5edf5!important;border-color:#405162!important}
:root[data-theme="dark"] .incident-filter-menu {background:#18222d!important;color:#e5edf5!important;border-color:#405162!important}
:root[data-theme="dark"] .incident-filter-menu label,
:root[data-theme="dark"] .incident-filter-menu .filter-menu-title,
:root[data-theme="dark"] .incident-filter-menu .filter-check {color:#dbe6f0!important}
:root[data-theme="dark"] .customer-tab.active,
:root[data-theme="dark"] .article-tab.active,
:root[data-theme="dark"] .employee-tab.active {background:#202c38!important;color:#8dccf4!important;border-color:#3b4a59!important;box-shadow:inset 0 -2px 0 #55a8df!important}

@media (prefers-color-scheme: dark){
  .planning-left-card{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  .planning-left-card label,.planning-left-card .field-label,.planning-left-card .planning-card-title{color:#dce7f1!important}
  .permission-switch-row{background:#202c38!important;color:#e5edf5!important;border-color:#405162!important}
  .maintenance-tab.active{background:#202c38!important;color:#8dccf4!important;border:1px solid #3b4a59!important;box-shadow:inset 0 -2px 0 #55a8df!important}
}

/* RC26 FIX32 — remate de modo oscuro localizado */
@media (prefers-color-scheme: dark){
  .incident-info-readonly section,.incident-info-note{background:#18222d!important;border-color:#3b4a59!important;color:#e5edf5!important}
  .incident-info-readonly section h4{color:#e5edf5!important}.incident-info-text{color:#cbd7e2!important}.incident-info-note{color:#9fb0c1!important}
  .customer-doc-dropzone{background:#18222d!important;color:#dce7f1!important;border-color:#607487!important}.customer-doc-dropzone.drag-over{background:#173248!important;border-color:#55a8df!important}
  .customer-doc-dropzone .tiny{color:#9fb0c1!important}
  .planning-week-event{background:#243447!important;color:#eaf2f8!important;border-color:#6684a0!important}
  .planning-week-event b,.planning-week-event span{color:#eaf2f8!important}.planning-week-event small{color:#b7c8d8!important}
  .planning-week-day-cell{background:#18222d!important}.planning-week-day-cell.selected-day{background:#173248!important}
}
:root[data-theme="dark"] .incident-info-readonly section,
:root[data-theme="dark"] .incident-info-note{background:#18222d!important;border-color:#3b4a59!important;color:#e5edf5!important}
:root[data-theme="dark"] .incident-info-readonly section h4{color:#e5edf5!important}
:root[data-theme="dark"] .incident-info-text{color:#cbd7e2!important}
:root[data-theme="dark"] .incident-info-note{color:#9fb0c1!important}
:root[data-theme="dark"] .customer-doc-dropzone{background:#18222d!important;color:#dce7f1!important;border-color:#607487!important}
:root[data-theme="dark"] .customer-doc-dropzone.drag-over{background:#173248!important;border-color:#55a8df!important}
:root[data-theme="dark"] .customer-doc-dropzone .tiny{color:#9fb0c1!important}
:root[data-theme="dark"] .planning-week-event{background:#243447!important;color:#eaf2f8!important;border-color:#6684a0!important}
:root[data-theme="dark"] .planning-week-event b,
:root[data-theme="dark"] .planning-week-event span{color:#eaf2f8!important}
:root[data-theme="dark"] .planning-week-event small{color:#b7c8d8!important}


/* RC26 FIX33 — mantenimiento: pestañas activas oscuras sin depender de estilos heredados */
html[data-theme="dark"] .maintenance-tabs .maintenance-tab.active,
html[data-theme="dark"] .maintenance-tabs button.maintenance-tab.active {background:#202c38!important;color:#8dccf4!important;border:1px solid #3b4a59!important;box-shadow:inset 0 -2px 0 #55a8df!important}
html[data-theme="dark"] .maintenance-tabs .maintenance-tab:hover {background:#202c38!important;color:#dce7f1!important}

/* RC26 FIX35 · Partes: controles residuales y conformidad en modo oscuro */
:root[data-theme="dark"] .daily-quick-actions button,
:root[data-theme="dark"] .daily-material-actions button,
:root[data-theme="dark"] .daily-page .remove-segment,
:root[data-theme="dark"] .daily-page .remove-material,
:root[data-theme="dark"] .daily-page .remove-travel,
:root[data-theme="dark"] .signature-wrap button {
  background:#2b3947!important;
  color:#edf3f8!important;
  border-color:#405162!important;
}
:root[data-theme="dark"] .daily-quick-actions button:hover,
:root[data-theme="dark"] .daily-material-actions button:hover,
:root[data-theme="dark"] .daily-page .remove-segment:hover,
:root[data-theme="dark"] .daily-page .remove-material:hover,
:root[data-theme="dark"] .daily-page .remove-travel:hover,
:root[data-theme="dark"] .signature-wrap button:hover {background:#354657!important}

/* El canvas conserva internamente la firma negra para documentos/PDF,
   pero se invierte visualmente en modo oscuro para que sea legible. */
:root[data-theme="dark"] .signature-wrap canvas {
  background:#fff!important;
  border-color:#405162!important;
  filter:invert(1);
}

/* Conformidad: tamaño estable entre Firma presencial / Remota / No requerida. */
#subModal:has(.conformity-choice) .modal-card {
  width:min(940px,94vw);
  height:min(690px,90vh);
  max-height:90vh;
}
#subModal:has(.conformity-choice) #subModalBody {
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
}
#subModal:has(.conformity-choice) .conformity-choice {
  min-height:100%;
  display:flex;
  flex-direction:column;
}
#subModal:has(.conformity-choice) .conformity-form {
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  min-height:0;
}
#subModal:has(.conformity-choice) .conf-pane {flex:1 1 auto;align-content:start}
#subModal:has(.conformity-choice) .form-actions {margin-top:auto}
@media(max-width:650px){
  #subModal:has(.conformity-choice) .modal-card{width:96vw;height:90vh;max-height:90vh}
}

/* RC26 FIX36 · Alta rápida de contacto desde Incidencias */
.incident-contact-picker{display:flex;gap:6px;align-items:stretch;width:100%;min-width:0}.incident-contact-picker select{flex:1 1 0;min-width:0}.incident-contact-add{width:38px;min-width:38px;padding:0;font-size:22px;font-weight:600;line-height:1;border-radius:8px}.incident-contact-add:hover{transform:none}


/* RC26 FIX37 · Incidencias: Contacto compacto, teléfono reducido y + integrado */
.incident-contact-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 140px;align-items:end}
.incident-contact-picker{position:relative;display:block;width:100%;min-width:0}
.incident-contact-picker select{width:100%;min-width:0;padding-right:40px}
.incident-contact-add{position:absolute;right:1px;top:1px;bottom:1px;width:36px;min-width:36px;height:auto;padding:0;border:0;border-left:1px solid #cbd5e1;border-radius:0 7px 7px 0;background:#e2e8f0;color:#0f172a;font-size:21px;font-weight:600;line-height:1;z-index:2}
.incident-contact-add:hover{transform:none;background:#dbe4ef}
#iContactPhone{width:100%;min-width:0}
@media(max-width:700px){.incident-contact-row{grid-template-columns:1fr}.incident-contact-add{right:1px}}
@media(prefers-color-scheme:dark){.incident-contact-add{background:#334155;color:#e5edf7;border-left-color:#52657a}.incident-contact-add:hover{background:#3f5268}}
:root[data-theme=dark] .incident-contact-add{background:#334155;color:#e5edf7;border-left-color:#52657a}
:root[data-theme=dark] .incident-contact-add:hover{background:#3f5268}

/* RC26 FIX38 · Incidencias: recuperar proporciones y + integrado en Cliente */
.incident-contact-row{grid-template-columns:repeat(3,minmax(0,1fr));align-items:end}
.incident-contact-row>label:last-child input{width:140px;max-width:100%}
.incident-customer-picker{position:relative;display:block;width:100%;min-width:0;overflow:visible}
.incident-customer-picker select{width:100%!important;max-width:100%;min-width:0;padding-right:40px}
.incident-customer-add{position:absolute;right:1px;top:1px;bottom:1px;display:flex;align-items:center;justify-content:center;width:36px;min-width:36px;height:auto;padding:0;border:0;border-left:1px solid #cbd5e1;border-radius:0 7px 7px 0;background:#e2e8f0;color:#0f172a;font-size:21px;font-weight:600;line-height:1;z-index:2}
.incident-customer-add:hover{transform:none;background:#dbe4ef}
@media(max-width:700px){.incident-contact-row{grid-template-columns:1fr}.incident-contact-row>label:last-child input{width:100%}}
@media(prefers-color-scheme:dark){.incident-customer-add{background:#334155;color:#e5edf7;border-left-color:#52657a}.incident-customer-add:hover{background:#3f5268}}
:root[data-theme=dark] .incident-customer-add{background:#334155;color:#e5edf7;border-left-color:#52657a}
:root[data-theme=dark] .incident-customer-add:hover{background:#3f5268}


/* RC26 FIX39 · Incidencias: alta rápida de Centro sin alterar proporciones */
.incident-site-picker{position:relative;display:block;width:100%;min-width:0}
.incident-site-picker select{width:100%;min-width:0;padding-right:40px}
.incident-site-add{position:absolute;right:1px;top:1px;bottom:1px;display:flex;align-items:center;justify-content:center;width:36px;min-width:36px;height:auto;padding:0;border:0;border-left:1px solid #cbd5e1;border-radius:0 7px 7px 0;background:#e2e8f0;color:#0f172a;font-size:21px;font-weight:600;line-height:1;z-index:2}
.incident-site-add:hover{transform:none;background:#dbe4ef}
@media(prefers-color-scheme:dark){.incident-site-add{background:#334155;color:#e5edf7;border-left-color:#52657a}.incident-site-add:hover{background:#3f5268}}
:root[data-theme=dark] .incident-site-add{background:#334155;color:#e5edf7;border-left-color:#52657a}
:root[data-theme=dark] .incident-site-add:hover{background:#3f5268}

/* RC27 FIX1 - project document drop zones */
.project-doc-dropzone{border:1px dashed #9fb4cc;border-radius:10px;background:#f8fafc;min-height:76px;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;padding:12px;cursor:pointer;margin:10px 0 8px}.project-doc-dropzone.drag-over{outline:2px solid currentColor}.project-doc-upload-row{display:grid;grid-template-columns:1fr auto;gap:8px;margin-bottom:12px}.project-doc-upload-row input{min-width:0}
@media (prefers-color-scheme:dark){.project-doc-dropzone{background:#172131;border-color:#52647a;color:#e7edf5}.project-doc-dropzone .tiny{color:#aebbd0}}
:root[data-theme="dark"] .project-doc-dropzone{background:#172131;border-color:#52647a;color:#e7edf5}:root[data-theme="dark"] .project-doc-dropzone .tiny{color:#aebbd0}

/* RC28 · Informes esenciales */
.report-filters{margin-bottom:12px}.report-filter-grid{display:grid;grid-template-columns:repeat(5,minmax(130px,1fr));gap:10px}.report-filter-grid label{display:flex;flex-direction:column;gap:5px}.report-actions{display:flex;gap:8px;margin-top:12px;justify-content:flex-end}.report-kpis{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:12px}.report-kpis .panel{display:flex;flex-direction:column;gap:5px}.report-kpis span{font-size:12px;color:var(--muted,#667085)}.report-kpis b{font-size:22px}.report-chart{display:flex;flex-direction:column;gap:8px;margin-top:12px}.report-bar-row{display:grid;grid-template-columns:minmax(120px,220px) 1fr 80px;gap:10px;align-items:center}.report-bar-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.report-bar-track{height:18px;border-radius:5px;background:rgba(127,127,127,.15);overflow:hidden}.report-bar{height:100%;background:#2f78b7;border-radius:5px}.report-table{margin-top:12px}@media(max-width:1050px){.report-filter-grid{grid-template-columns:repeat(2,1fr)}.report-kpis{grid-template-columns:repeat(3,1fr)}}@media print{aside,.topbar,#headerActions,.report-filters{display:none!important}.main{margin:0!important}.report-kpis{grid-template-columns:repeat(5,1fr)}.report-bar{print-color-adjust:exact;-webkit-print-color-adjust:exact}}

/* RC28 FIX1 · espaciado uniforme en Informes */
.report-filters{padding:14px 16px}.report-kpis .panel{padding:12px 14px}.report-kpis span,.report-kpis b{margin:0}.report-result-panel,#reportResult>.panel:not(.report-table){padding:16px 18px}#reportResult>.panel>h3{margin:4px 0 14px}.report-table{padding:8px 10px 10px}.report-table th,.report-table td{padding-left:10px;padding-right:10px}

/* RC28 FIX2 · catálogo de informes */
.report-catalog{display:grid;grid-template-columns:repeat(3,minmax(220px,1fr));gap:10px;margin-bottom:12px}.report-choice{appearance:none;text-align:left;cursor:pointer;display:flex;flex-direction:column;gap:6px;min-height:88px}.report-choice b{font-size:14px}.report-choice span{font-size:12px;color:var(--muted,#667085);line-height:1.35}.report-choice.active{outline:2px solid #2f78b7;outline-offset:-2px}.report-current{margin:4px 2px 12px}.report-current h2{margin:0 0 4px}.report-current p{margin:0;color:var(--muted,#667085)}@media(max-width:1050px){.report-catalog{grid-template-columns:repeat(2,1fr)}}

/* RC28 FIX3 · filtros compactos en una sola fila */
@media(min-width:1200px){.report-filter-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.report-filter-grid label{min-width:0}.report-filter-grid select,.report-filter-grid input{width:100%;min-width:0}}

/* RC28 FIX7 · prioridad urgente visible sin columna de prioridad */
.incident-site-cell{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html[data-theme="dark"] 

.incident-alert-urgent{display:inline-flex;align-items:center;white-space:nowrap;font-weight:700}

/* RC28 FIX10 · Historial de incidencias por centro/cliente */
.incident-related-history{min-height:180px}.incident-related-history-table{table-layout:fixed;width:100%}.incident-related-history-table th:nth-child(1){width:14%}.incident-related-history-table th:nth-child(2){width:12%}.incident-related-history-table th:nth-child(3){width:30%}.incident-related-history-table th:nth-child(4){width:28%}.incident-related-history-table th:nth-child(5){width:16%}.incident-related-history-table tbody tr,.history-parts-table tbody tr{cursor:pointer}.incident-related-history-table td,.history-parts-table td{vertical-align:middle}.incident-history-detail{display:flex;flex-direction:column;gap:14px}.history-detail-grid,.history-part-grid{display:grid;grid-template-columns:1fr 2fr;gap:12px}.history-detail-grid>div,.history-part-grid>div{display:flex;flex-direction:column;gap:4px}.incident-history-detail section,.history-part-day{border:1px solid var(--border,#d8dee8);border-radius:8px;padding:12px}.incident-history-detail h4,.history-part-day h4{margin:0 0 9px}.historical-part-readonly{display:flex;flex-direction:column;gap:12px}.history-readonly-section{margin-top:12px}.history-readonly-section>b{display:block;margin-bottom:7px}.history-part-day .incident-info-text{white-space:pre-wrap}.incident-history-pagination{display:flex;justify-content:center;gap:6px;margin-top:12px}.incident-history-pagination button.active{font-weight:700}

/* RC28 FIX11 · Historial: modal más amplio, márgenes uniformes y apertura del parte completo */
#subModal:has(.incident-history-detail) .modal-card{width:min(1240px,97vw);height:auto;max-height:94vh}
#subModal:has(.incident-history-detail) #subModalBody{padding:18px 22px 14px;overflow-y:auto}
.incident-history-detail{gap:12px}
.incident-history-detail .history-detail-grid{grid-template-columns:minmax(180px,.75fr) minmax(360px,2fr);align-items:start}
.incident-history-detail .history-detail-grid>div{display:grid;grid-template-columns:max-content minmax(0,1fr);align-items:baseline;gap:10px}
.incident-history-detail section{padding:11px 13px}
.incident-history-detail .form-actions{margin:0 -22px -14px;padding:11px 22px}
@media(max-width:800px){#subModal:has(.incident-history-detail) .modal-card{width:97vw;max-height:94vh}#subModal:has(.incident-history-detail) #subModalBody{padding:14px}.incident-history-detail .history-detail-grid{grid-template-columns:1fr}.incident-history-detail .form-actions{margin:0 -14px -14px;padding:11px 14px}}

/* RC28 FIX12 · Retorno visual directo desde parte completo al Historial, sin render intermedio visible */
#historyReturnCover{position:fixed;inset:0;z-index:130;overflow:hidden;background:var(--page-bg,#eef2f6);pointer-events:none}
#historyReturnCover header,#historyReturnCover #content{pointer-events:none}

/* RC28 FIX18 · Unificación visual de pestañas con el patrón de Clientes.
   Cambio exclusivamente visual: no modifica botones de acción ni lógica. */
.incident-tabs,
.maintenance-tabs,
.project-tabs{
  display:flex;
  gap:4px;
  flex-wrap:wrap;
  border-bottom:1px solid #d8e1ea;
  padding:0;
}
.incident-tabs{margin:0 0 12px}
.maintenance-tabs{margin:0 0 12px}
.project-tabs{margin:0 0 12px}
.incident-tab,
.maintenance-tab,
.project-tabs>button{
  border:0;
  background:transparent;
  border-radius:7px 7px 0 0;
  padding:10px 16px;
  font-weight:700;
  color:#64748b;
  box-shadow:none;
  cursor:pointer;
}
.incident-tab:hover,
.maintenance-tab:hover,
.project-tabs>button:hover{background:#f3f6f9}
.incident-tab.active,
.maintenance-tab.active,
.project-tabs>button.active{
  background:#eaf2f8;
  color:#155d8f;
  box-shadow:inset 0 -2px 0 #155d8f;
  border:0;
}
.incident-tab.has-planning:not(.active){background:transparent;color:#64748b}
#modal:has(.project-tabs) .project-tabs{padding:0;margin:0 0 12px;gap:4px;border-bottom:1px solid #d8e1ea}

:root[data-theme="dark"] .incident-tabs,
:root[data-theme="dark"] .maintenance-tabs,
:root[data-theme="dark"] .project-tabs{border-color:#3b4a59!important}
:root[data-theme="dark"] .incident-tab,
:root[data-theme="dark"] .maintenance-tab,
:root[data-theme="dark"] .project-tabs>button{background:transparent!important;color:#aebdcb!important;border:0!important;box-shadow:none!important}
:root[data-theme="dark"] .incident-tab:hover,
:root[data-theme="dark"] .maintenance-tab:hover,
:root[data-theme="dark"] .project-tabs>button:hover{background:#202c38!important}
:root[data-theme="dark"] .incident-tab.active,
:root[data-theme="dark"] .maintenance-tab.active,
:root[data-theme="dark"] .project-tabs>button.active{background:#202c38!important;color:#8dccf4!important;border:0!important;box-shadow:inset 0 -2px 0 #55a8df!important}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .incident-tabs,
  :root:not([data-theme="light"]) .maintenance-tabs,
  :root:not([data-theme="light"]) .project-tabs{border-color:#3b4a59!important}
  :root:not([data-theme="light"]) .incident-tab,
  :root:not([data-theme="light"]) .maintenance-tab,
  :root:not([data-theme="light"]) .project-tabs>button{background:transparent!important;color:#aebdcb!important;border:0!important;box-shadow:none!important}
  :root:not([data-theme="light"]) .incident-tab.active,
  :root:not([data-theme="light"]) .maintenance-tab.active,
  :root:not([data-theme="light"]) .project-tabs>button.active{background:#202c38!important;color:#8dccf4!important;border:0!important;box-shadow:inset 0 -2px 0 #55a8df!important}
}

/* RC28 FIX19 · Edición de perfiles: pestañas unificadas con el patrón de Clientes. */
.profile-permission-tabs{
  display:flex;
  gap:4px;
  flex-wrap:wrap;
  border:0;
  border-bottom:1px solid #d8e1ea;
  border-radius:0;
  padding:0;
  margin:0;
  background:transparent;
}
.profile-permission-tab{
  border:0;
  background:transparent;
  border-radius:7px 7px 0 0;
  padding:10px 16px;
  font-weight:700;
  color:#64748b;
  box-shadow:none;
  cursor:pointer;
}
.profile-permission-tab:hover{background:#f3f6f9}
.profile-permission-tab.active{
  background:#eaf2f8;
  color:#155d8f;
  border:0;
  box-shadow:inset 0 -2px 0 #155d8f;
}
:root[data-theme="dark"] .profile-permission-tabs{background:transparent!important;border-color:#3b4a59!important}
:root[data-theme="dark"] .profile-permission-tab{background:transparent!important;color:#aebdcb!important;border:0!important;box-shadow:none!important}
:root[data-theme="dark"] .profile-permission-tab:hover{background:#202c38!important}
:root[data-theme="dark"] .profile-permission-tab.active{background:#202c38!important;color:#8dccf4!important;border:0!important;box-shadow:inset 0 -2px 0 #55a8df!important}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .profile-permission-tabs{background:transparent!important;border-color:#3b4a59!important}
  :root:not([data-theme="light"]) .profile-permission-tab{background:transparent!important;color:#aebdcb!important;border:0!important;box-shadow:none!important}
  :root:not([data-theme="light"]) .profile-permission-tab:hover{background:#202c38!important}
  :root:not([data-theme="light"]) .profile-permission-tab.active{background:#202c38!important;color:#8dccf4!important;border:0!important;box-shadow:inset 0 -2px 0 #55a8df!important}
}

/* ATEBSA Service ERP v1.0 · versión visible */
.login-title-row{display:flex;align-items:baseline;justify-content:space-between;gap:14px}
.login-title-row h1{margin:5px 0 4px}
.login-title-row .app-version{font-size:12px;font-weight:700;color:#94a3b8;white-space:nowrap}
.side-version{margin-top:2px;padding-top:5px;text-align:center;font-size:10px;color:#8fa5b8;letter-spacing:.01em}
html[data-theme="dark"] .login-title-row .app-version{color:#9fb0c1}

/* v1.0 FIX1 — version label placement */
.login-title-row{justify-content:flex-start;gap:8px}
.login-title-row .app-version{position:relative;top:-1px}
.side-product-row{display:flex;align-items:baseline;gap:5px;margin-top:2px}
.side-product-row>span:first-child{font-size:12px;color:#b7c7d8}
.side-product-row .app-version{font-size:9px;font-weight:700;color:#8fa5b8;white-space:nowrap}
html[data-theme="dark"] .side-product-row .app-version{color:#9fb0c1}
/* v1.1 · Gestión comercial basada en la operativa de Presupuestos de Tallwin */
#modal:has(.commercial-form) .modal-card{width:min(1380px,98vw);height:min(860px,95vh);max-height:95vh}.commercial-form{display:flex;flex-direction:column;gap:12px;min-height:0}.commercial-head-grid{display:grid;grid-template-columns:minmax(360px,2fr) 170px 150px 170px;gap:10px 12px}.commercial-customer{grid-column:auto}.commercial-subject{grid-column:1/-1}.commercial-lines{border:1px solid #dce4eb;border-radius:10px;overflow:auto;min-height:250px;max-height:360px}.commercial-lines table{table-layout:fixed}.commercial-lines th:nth-child(1){width:44px}.commercial-lines th:nth-child(3){width:110px}.commercial-lines th:nth-child(4){width:95px}.commercial-lines th:nth-child(5),.commercial-lines th:nth-child(6),.commercial-lines th:nth-child(7){width:125px}.commercial-lines td{padding:5px 6px}.commercial-lines input,.commercial-lines select{width:100%;padding:7px 8px;border-radius:6px}.commercial-lines tr.selected td{background:#eef6fc}.commercial-lines .line-total{text-align:right;font-weight:700;white-space:nowrap}.commercial-line-actions{display:flex;gap:8px}.commercial-totals{display:grid;grid-template-columns:repeat(6,minmax(110px,1fr));gap:10px}.commercial-totals label{margin:0}.commercial-totals input{text-align:right}.commercial-total{background:#eaf4fb;border:1px solid #bdd8ec;border-radius:9px;padding:8px}.commercial-total input{font-weight:800;color:#155d8f;background:transparent;border:0;padding:4px}.commercial-form textarea{min-height:90px}
html[data-theme="dark"] .commercial-lines{border-color:#38506a}html[data-theme="dark"] .commercial-lines tr.selected td{background:#1d3b55}html[data-theme="dark"] .commercial-total{background:#18364d;border-color:#315b79}html[data-theme="dark"] .commercial-total input{color:#b9dcf5}
@media(max-width:900px){.commercial-head-grid{grid-template-columns:1fr 1fr}.commercial-subject{grid-column:1/-1}.commercial-totals{grid-template-columns:repeat(3,1fr)}}

/* v1.1 FIX2 · Presupuestos/Albaranes a pantalla completa */
.commercial-page{height:calc(100vh - 132px);min-height:650px;padding:18px 22px;overflow:auto}.commercial-page .commercial-form{height:100%;min-height:610px}.commercial-page .commercial-head-grid{grid-template-columns:minmax(420px,1fr) 180px 160px 170px}.commercial-page .commercial-line-actions{margin-top:8px}.commercial-page .commercial-lines{min-height:260px;max-height:none;flex:1}.commercial-page .commercial-totals{grid-template-columns:110px 110px 110px 120px;justify-content:end;align-items:end}.commercial-page .commercial-form>label:has(textarea){margin-top:4px}.commercial-page .commercial-form textarea{min-height:86px}.commercial-page .form-actions{margin-top:auto}
@media(max-width:900px){.commercial-page{height:auto;min-height:0}.commercial-page .commercial-head-grid{grid-template-columns:1fr 1fr}.commercial-page .commercial-totals{grid-template-columns:repeat(2,minmax(110px,1fr));justify-content:stretch}}
/* v1.1 FIX3 — líneas comerciales compactas, artículos, tabs y orden drag & drop */
.commercial-tabs{display:flex;gap:2px;border-bottom:1px solid var(--border,#d8e1ea);margin-top:2px}.commercial-tab{border:0;border-radius:7px 7px 0 0;padding:8px 18px;background:transparent;font-weight:700}.commercial-tab.active{background:#eaf3fb;color:#155d8f;border-bottom:2px solid #2477b3}.commercial-tab-panel{min-height:0}.commercial-lines-panel{display:flex;flex-direction:column;flex:1;min-height:0}.commercial-lines-panel.hidden,.commercial-notes-panel.hidden{display:none}.commercial-notes-panel{flex:1;padding-top:12px}.commercial-notes-panel textarea{height:calc(100vh - 350px);min-height:360px;resize:vertical}.commercial-page .commercial-lines{min-height:260px;flex:1;max-height:none}.commercial-lines th:nth-child(1){width:38px}.commercial-lines th:nth-child(2){width:42px}.commercial-lines th:nth-child(3){width:44px}.commercial-lines th:nth-child(4){width:145px}.commercial-lines th:nth-child(6){width:105px}.commercial-lines th:nth-child(7){width:115px}.commercial-lines th:nth-child(8){width:100px}.commercial-lines th:nth-child(9){width:120px}.commercial-lines th:nth-child(10){width:48px}.commercial-drag,.commercial-search,.commercial-delete,.commercial-num{text-align:center}.drag-handle,.article-search-btn,.line-delete-btn{min-width:30px;width:30px;height:30px;padding:0;border-radius:6px;display:inline-grid;place-items:center}.drag-handle{cursor:grab;font-size:20px;line-height:1}.drag-handle:active{cursor:grabbing}.article-search-btn{font-size:20px;font-weight:800}.line-delete-btn{font-size:21px;color:#a52d2d}.commercial-lines tr.dragging{opacity:.48}.commercial-lines tr.drag-over td{box-shadow:inset 0 2px 0 #2477b3}.commercial-add-wrap{padding:8px 0 2px}.commercial-page .commercial-totals{margin-top:4px}.article-code{background:var(--input-disabled-bg,#f5f7f9)}.commercial-article-picker{display:flex;flex-direction:column;gap:12px}.commercial-article-results{border:1px solid #dce4eb;border-radius:9px;overflow:auto;max-height:55vh}.commercial-article-results tr[data-article-id]{cursor:pointer}.commercial-article-results tr[data-article-id]:hover td{background:#eef6fc}html[data-theme="dark"] .commercial-tab.active{background:#18364d;color:#b9dcf5}html[data-theme="dark"] .commercial-lines tr.drag-over td{box-shadow:inset 0 2px 0 #79b8e8}html[data-theme="dark"] .commercial-article-results tr[data-article-id]:hover td{background:#1d3b55}

/* v1.1 FIX4 - commercial compact lines and article selector */
.commercial-lines th:nth-child(1){width:34px}.commercial-lines th:nth-child(2){width:38px}.commercial-lines th:nth-child(3){width:105px}.commercial-lines th:nth-child(4){width:auto}.commercial-lines th:nth-child(5){width:82px}.commercial-lines th:nth-child(6){width:88px}.commercial-lines th:nth-child(7){width:76px}.commercial-lines th:nth-child(8){width:98px}.commercial-lines th:nth-child(9){width:38px}
.commercial-article-picker{height:min(650px,76vh);min-height:480px}.commercial-article-filters{display:grid;grid-template-columns:minmax(320px,1fr) minmax(240px,360px);gap:12px;align-items:end}.commercial-article-results{flex:1;min-height:0;max-height:none;overflow:auto}.commercial-article-results table{table-layout:fixed}.commercial-article-results th:nth-child(1){width:125px}.commercial-article-results th:nth-child(2){width:auto}.commercial-article-results th:nth-child(3){width:230px}.commercial-article-results th:nth-child(4){width:105px;text-align:right}.commercial-article-results .article-price{text-align:right;white-space:nowrap}.commercial-article-results tr.selected td{background:#e5f1fa}.commercial-article-picker>.form-actions{margin-top:auto}
html[data-theme="dark"] .commercial-article-results tr.selected td{background:#214663}
@media(max-width:900px){.commercial-article-filters{grid-template-columns:1fr}.commercial-article-results th:nth-child(3){width:160px}}


/* v1.1 FIX5 — commercial layout stability */
.commercial-page{overflow:hidden}
.commercial-lines-panel{overflow:hidden}
.commercial-page .commercial-lines{
  --commercial-scrollbar-space:18px;
  overflow-x:hidden;
  overflow-y:auto;
  scrollbar-gutter:stable;
  width:calc(100% + var(--commercial-scrollbar-space));
  margin-right:calc(-1 * var(--commercial-scrollbar-space));
  padding-right:var(--commercial-scrollbar-space);
  box-sizing:border-box;
}
.commercial-page .commercial-lines table{width:100%;min-width:100%;table-layout:fixed}
.commercial-lines-footer{display:flex;align-items:end;justify-content:space-between;gap:12px;padding-top:7px;flex:0 0 auto}
.commercial-add-wrap{padding:0;flex:0 0 auto}
.commercial-add-btn{min-height:32px;padding:5px 10px;font-size:13px;line-height:1.2}
.commercial-page .commercial-totals{display:grid;grid-template-columns:repeat(4,104px);gap:8px;margin:0;justify-content:end;align-items:end;flex:0 0 auto}
.commercial-page .commercial-totals label,.commercial-page .commercial-total{margin:0;padding:0;background:transparent;border:0;border-radius:0}
.commercial-page .commercial-totals input,.commercial-page .commercial-total input{width:100%;min-height:36px;padding:7px 8px;text-align:right;font-weight:600;color:inherit;background:var(--input-bg,#fff);border:1px solid var(--border,#cfd9e3);border-radius:7px}
.commercial-page .commercial-total input{font-weight:700}
.commercial-notes-panel{overflow:hidden;padding-top:10px;min-height:0}
.commercial-notes-panel>label{height:100%;min-height:0;display:flex;flex-direction:column;margin:0;overflow:hidden}
.commercial-notes-panel textarea,.commercial-page .commercial-notes-panel textarea{height:auto;min-height:0;flex:1;resize:none;overflow:auto}
@media(max-width:900px){
 .commercial-page{overflow:auto}
 .commercial-lines-footer{align-items:stretch;flex-direction:column}
 .commercial-page .commercial-totals{grid-template-columns:repeat(4,minmax(90px,1fr));justify-content:stretch}
}

/* v1.1 FIX6 — scroll visible + impresión comercial */
.commercial-page .commercial-lines{scrollbar-width:auto;scrollbar-color:#8ea0b2 #e5ebf0}
.commercial-page .commercial-lines::-webkit-scrollbar{width:12px}
.commercial-page .commercial-lines::-webkit-scrollbar-track{background:#e5ebf0;border-radius:8px}
.commercial-page .commercial-lines::-webkit-scrollbar-thumb{background:#8ea0b2;border:2px solid #e5ebf0;border-radius:8px;min-height:34px}
html[data-theme="dark"] .commercial-page .commercial-lines{scrollbar-color:#6f879c #263746}
html[data-theme="dark"] .commercial-page .commercial-lines::-webkit-scrollbar-track{background:#263746}
html[data-theme="dark"] .commercial-page .commercial-lines::-webkit-scrollbar-thumb{background:#6f879c;border-color:#263746}

/* v1.1 FIX7 — selector de empresa + scroll comercial siempre reconocible */
.commercial-page .commercial-head-grid{grid-template-columns:minmax(210px,.8fr) minmax(330px,1.35fr) 160px 150px 170px}
.commercial-page .commercial-subject{grid-column:1/-1}
.commercial-page .commercial-lines{position:relative}
/* Indicador fijo: conserva el gutter actual y hace visible la zona de scroll incluso
   cuando Windows/Chromium usa barras superpuestas u ocultas por configuración. */
.commercial-page .commercial-lines::after{content:"";position:sticky;display:block;pointer-events:none;float:right;right:3px;bottom:3px;width:8px;height:44px;margin-top:-47px;margin-right:-14px;border-radius:8px;background:rgba(112,132,151,.72);box-shadow:0 0 0 2px rgba(229,235,240,.92)}
html[data-theme="dark"] .commercial-page .commercial-lines::after{background:rgba(132,158,181,.82);box-shadow:0 0 0 2px rgba(38,55,70,.95)}
@media(max-width:1100px){.commercial-page .commercial-head-grid{grid-template-columns:1fr 1.4fr 150px 140px}.commercial-page .commercial-head-grid>label:nth-child(5){grid-column:auto}}
@media(max-width:900px){.commercial-page .commercial-head-grid{grid-template-columns:1fr 1fr}}


/* v1.1 FIX9 — scroll automático sin solape + filtros comerciales */
.commercial-page .commercial-lines{
  width:100%;margin-right:0;padding-right:0;box-sizing:border-box;
  overflow-x:hidden;overflow-y:auto;scrollbar-gutter:stable;
}
.commercial-page .commercial-lines::after{content:none!important;display:none!important}
.commercial-page .commercial-lines table{width:100%;max-width:100%;table-layout:fixed}
.commercial-filter-bar{display:grid;grid-template-columns:minmax(180px,.8fr) minmax(230px,1.2fr) 170px 145px 145px minmax(220px,1fr) auto;gap:8px;align-items:end;margin-bottom:10px;padding:9px 10px}
.commercial-filter-bar label{margin:0;min-width:0}.commercial-filter-bar select,.commercial-filter-bar input{width:100%;min-width:0;padding:7px 8px}.commercial-filter-bar button{height:36px;white-space:nowrap}
@media(max-width:1250px){.commercial-filter-bar{grid-template-columns:repeat(4,minmax(150px,1fr))}.commercial-filter-search{grid-column:span 2}}
@media(max-width:760px){.commercial-filter-bar{grid-template-columns:1fr 1fr}.commercial-filter-search{grid-column:1/-1}}

/* v1.1 FIX10 — estado multiselección persistente */
.commercial-status-filter{position:relative;min-width:0}.commercial-filter-label{display:block;font-size:12px;font-weight:600;margin-bottom:4px}.commercial-status-button{width:100%;height:36px;padding:7px 9px;display:flex;align-items:center;justify-content:space-between;gap:8px;white-space:nowrap}.commercial-status-menu{position:absolute;z-index:40;top:calc(100% + 4px);left:0;min-width:220px;padding:8px;background:var(--panel,#fff);border:1px solid var(--border,#cfd9e3);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.16)}.commercial-status-option{display:flex!important;align-items:center;gap:8px;margin:0!important;padding:6px 4px;white-space:nowrap}.commercial-status-option input{width:auto!important;margin:0}.commercial-status-actions{display:flex;justify-content:flex-end;border-top:1px solid var(--border,#cfd9e3);margin-top:5px;padding-top:7px}


/* v1.1 FIX12 — desplegable Estado visible fuera de la barra de filtros */
.commercial-filter-bar{overflow:visible!important;position:relative;z-index:20}
.commercial-status-filter{position:relative;z-index:21}
.commercial-status-menu{z-index:120}


/* v1.1 FIX14 — estados de presupuesto y UX del filtro */
.commercial-status-dot{display:inline-block;flex:0 0 auto;width:10px;height:10px;border-radius:50%;border:1px solid rgba(0,0,0,.18)}
.commercial-status-dot.pending{background:#f2c94c}.commercial-status-dot.rejected{background:#d64545}.commercial-status-dot.accepted{background:#3f7edb}.commercial-status-dot.closed{background:#36a269}.commercial-status-dot.neutral{background:#9aa7b2}
.commercial-status-cell{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.commercial-status-option .commercial-status-dot{margin-left:1px}

/* v1.1 FIX15 — envío de presupuestos por email */
.modal-card.modal-quote-email-large{width:min(1500px,96vw);height:min(860px,92vh);max-width:none;display:flex;flex-direction:column}
#modal:has(.modal-card.modal-quote-email-large) .modal-body{min-height:0;flex:1;overflow:hidden;padding:0}
.quote-email-modal{display:grid;grid-template-columns:minmax(420px,38%) 1fr;height:100%;min-height:0}
.quote-email-compose{padding:20px;display:flex;flex-direction:column;gap:10px;min-height:0;border-right:1px solid var(--border,#d8e1ea)}
.quote-email-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.quote-email-top button{min-width:92px}
.mail-address-row{display:flex;align-items:center;gap:7px}.mail-address-row>span{width:38px;flex:0 0 38px;font-size:13px;color:var(--muted,#667)}
.mail-chip-box{min-height:38px;border:1px solid var(--border,#cfd9e3);border-radius:7px;padding:4px 6px;display:flex;align-items:center;gap:5px;flex-wrap:wrap;flex:1;background:var(--input-bg,#fff)}
.mail-chip-box input{border:0!important;outline:0;box-shadow:none!important;min-width:150px;flex:1;padding:4px;background:transparent}
.mail-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 7px;border-radius:14px;background:#e7f1f9;white-space:nowrap;font-size:13px}.mail-chip button{border:0;background:transparent;padding:0 2px;min-width:0;font-size:17px;line-height:1}
.mail-link{border:0;background:transparent;padding:4px 2px;min-width:0;font-weight:700}
.quote-email-compose>label{margin:0}.quote-email-body-label{display:flex;flex-direction:column;flex:1;min-height:180px}.quote-email-body-label textarea{flex:1;min-height:180px;resize:none}
.quote-email-attachment{display:flex;gap:12px;align-items:center;padding-top:4px}.quote-email-attachment span{padding:7px 10px;border:1px solid var(--border,#d8e1ea);border-radius:7px}
.quote-email-preview{min-width:0;min-height:0;display:flex;flex-direction:column;background:#e9edf1}.quote-email-preview-title{padding:10px 14px;font-weight:700;background:var(--panel-bg,#fff);border-bottom:1px solid var(--border,#d8e1ea)}.quote-email-preview iframe{border:0;flex:1;width:100%;background:white}
html[data-theme="dark"] .mail-chip{background:#214663}html[data-theme="dark"] .quote-email-preview{background:#1b2732}
@media(max-width:900px){.quote-email-modal{grid-template-columns:1fr}.quote-email-preview{display:none}.quote-email-compose{border-right:0}}

/* v1.1 FIX17 — modal email: altura útil completa y scroll interno */
#modal:has(.modal-card.modal-quote-email-large){padding:16px}
.modal-card.modal-quote-email-large{height:calc(100vh - 32px);max-height:calc(100vh - 32px);overflow:hidden}
#modal:has(.modal-card.modal-quote-email-large) #modalBody{display:flex;flex:1 1 auto;min-height:0;overflow:hidden;padding:0}
#modal:has(.modal-card.modal-quote-email-large) .quote-email-modal{flex:1 1 auto;width:100%;height:auto;min-height:0;overflow:hidden}
#modal:has(.modal-card.modal-quote-email-large) .quote-email-compose{overflow-y:auto;overflow-x:hidden}
#modal:has(.modal-card.modal-quote-email-large) .quote-email-preview{height:100%;overflow:hidden}
#modal:has(.modal-card.modal-quote-email-large) .quote-email-preview iframe{display:block;min-height:0;height:100%}
@media(max-height:700px){#modal:has(.modal-card.modal-quote-email-large){padding:8px}.modal-card.modal-quote-email-large{height:calc(100vh - 16px);max-height:calc(100vh - 16px)}}


/* v1.1 FIX18 — adjuntos adicionales en email de presupuestos */
.quote-email-attachment{flex-wrap:wrap}.quote-email-attachment button{white-space:nowrap}.quote-fixed-attachment{white-space:nowrap}.quote-extra-attachments{border:1px dashed var(--border,#cfd9e3);border-radius:8px;padding:8px;min-height:42px;display:flex;flex-direction:column;gap:6px}.quote-extra-attachments.drag-over{outline:2px solid currentColor}.quote-extra-file{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:center;padding:5px 8px;border:1px solid var(--border,#d8e1ea);border-radius:7px}.quote-extra-file span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.quote-extra-file small{white-space:nowrap}.quote-extra-file button{border:0;background:transparent;font-size:20px;line-height:1;padding:0 3px}

/* v1.1 FIX22 — selector comercial de artículos: márgenes y un único scroll */
#modal:has(.commercial-article-picker) .modal-card{overflow:hidden}
#modal:has(.commercial-article-picker) #modalBody{flex:1 1 auto;min-height:0;overflow:hidden;padding:0}
#modal:has(.commercial-article-picker) .commercial-article-picker{height:min(650px,76vh);min-height:480px;padding:16px 20px 14px;gap:14px;overflow:hidden}
#modal:has(.commercial-article-picker) .commercial-article-filters{flex:0 0 auto;margin:0}
#modal:has(.commercial-article-picker) .commercial-article-results{flex:1 1 auto;min-height:0;max-height:none;overflow-y:auto;overflow-x:hidden;margin:0;border-radius:8px}
#modal:has(.commercial-article-picker) .commercial-article-results table{width:100%;table-layout:fixed}
#modal:has(.commercial-article-picker) .commercial-article-picker>.form-actions{flex:0 0 auto;position:static;margin:0;padding:10px 0 0;border-top:0;background:transparent}
@media(max-width:900px){#modal:has(.commercial-article-picker) .commercial-article-picker{height:min(650px,82vh);min-height:0;padding:12px 14px 10px}}

/* v1.1 FIX24 · Artículos: un único scroll vertical, reservado al listado */
#content:has(.article-module){overflow:hidden!important;display:flex;flex-direction:column;min-height:0}
.article-module{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:10px}
.article-tab-panel{flex:1 1 auto;min-height:0}
.article-tab-panel:not(.hidden){display:flex;flex-direction:column}
.article-tab-panel>.panel{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.article-table-wrap{flex:1 1 auto;min-height:0;max-height:none!important;overflow-y:auto!important;overflow-x:hidden!important;scrollbar-gutter:stable}

/* v1.1 FIX30 — multiline quote descriptions; Tab/Shift+Tab use native field navigation. */
.commercial-line-description{display:block;width:100%;min-height:34px;height:34px;box-sizing:border-box;resize:none;overflow:hidden;white-space:pre-wrap;line-height:1.3;font:inherit;padding:7px 8px}
.commercial-lines td:has(.commercial-line-description){vertical-align:top}

/* v1.1 FIX31 - compact multiline quote description + top aligned controls */
.commercial-page .commercial-form .commercial-line-description{min-height:34px;height:34px;max-height:none;resize:none;overflow:hidden;line-height:1.3;padding:7px 8px}
.commercial-lines tbody td{vertical-align:top}
.commercial-lines tbody .line-total{padding-top:13px}
.commercial-lines tbody .commercial-drag,.commercial-lines tbody .commercial-search,.commercial-lines tbody .commercial-delete{padding-top:6px}

/* v1.1 FIX40 — comercial: modo oscuro consistente en referencias/totales + selector email albarán */
html[data-theme="dark"] .commercial-page .article-code,
html[data-theme="dark"] .commercial-page .commercial-totals input,
html[data-theme="dark"] .commercial-page input[readonly],
html[data-theme="dark"] .commercial-page input:disabled{
  background:#0f1c28!important;color:#eef6ff!important;border-color:#3c5569!important;opacity:1!important;-webkit-text-fill-color:#eef6ff!important;
}
html[data-theme="dark"] .commercial-page .commercial-totals input{font-weight:700}
.delivery-email-valued{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:8px 10px;border:1px solid var(--border,#d8e1ea);border-radius:8px}
.delivery-email-valued label{display:inline-flex;align-items:center;gap:6px;margin:0}.delivery-email-valued input{width:auto;margin:0}

/* FIX48: chapter rows follow the normal commercial grid; action stays in its column. */
.commercial-add-wrap{display:flex;align-items:center;gap:12px}
.commercial-chapter-row td{background:transparent}
.commercial-chapter-cell{padding:4px 6px}
.commercial-chapter-description{width:100%;box-sizing:border-box}

/* v1.1 FIX55 - menu Acciones en Presupuestos/Albaranes */
.commercial-actions-wrap{position:relative;display:inline-flex}.commercial-actions-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:120;min-width:220px;padding:6px;background:var(--panel,#fff);border:1px solid var(--border,#d8e1ea);border-radius:8px;box-shadow:0 10px 28px rgba(15,23,42,.18)}.commercial-actions-menu.hidden{display:none}.commercial-actions-menu button{width:100%;height:auto!important;min-height:34px;justify-content:flex-start!important;border:0;background:transparent;text-align:left;padding:7px 10px}.commercial-actions-menu button:hover{background:rgba(100,116,139,.12)}.commercial-actions-separator{height:1px;background:var(--border,#d8e1ea);margin:5px 4px}

/* v1.1 FIX57 - flujo administrativo guiado de incidencias */
.incident-admin-state{min-height:38px;padding:6px 9px;border:1px solid var(--border,#d7e0e8);border-radius:7px;background:var(--surface-soft,#f8fafc);display:flex;flex-direction:column;justify-content:center;gap:2px}.incident-admin-state span{font-size:11px;color:var(--muted,#64748b)}.incident-admin-state b{font-size:13px}.incident-admin-action{min-height:38px;align-self:end;white-space:nowrap}.incident-admin-closed{grid-column:1/-1;padding:8px 10px;border-radius:7px;background:#dcfce7;color:#166534;font-weight:700}.incident-administrative-grid>.incident-admin-billable{order:3}@media(max-width:760px){.incident-admin-closed{grid-column:auto}}


/* v1.1 FIX60 · Registro de factura: destinatarios visibles */
.invoice-recipient-box{border:1px solid #cbd5e1;border-radius:9px;padding:12px 14px;background:#f8fafc;display:grid;gap:8px}
.invoice-recipient-warning{border-color:#d9b35d;background:#fffaf0}
.invoice-recipient-table{border:1px solid #d7e0e8;border-radius:7px;overflow:hidden;background:#fff}
.invoice-recipient-head,.invoice-recipient-row{display:grid;grid-template-columns:150px minmax(180px,.8fr) minmax(280px,1.2fr);gap:12px;align-items:center;padding:8px 10px}
.invoice-recipient-head{font-size:11px;font-weight:700;color:#64748b;background:#f1f5f9}
.invoice-recipient-row{font-size:13px;border-top:1px solid #e2e8f0}
.invoice-recipient-row:first-of-type{border-top:0}.invoice-recipient-row span:last-child{overflow-wrap:anywhere}
.invoice-primary-option{margin-top:2px}
@media(max-width:760px){.invoice-recipient-head{display:none}.invoice-recipient-row{grid-template-columns:1fr;gap:3px}.invoice-recipient-row span:first-child{font-size:11px;color:#64748b}}
[data-theme="dark"] .invoice-recipient-box{background:#101b28;border-color:#34475a}[data-theme="dark"] .invoice-recipient-warning{background:#261f12;border-color:#80652f}[data-theme="dark"] .invoice-recipient-table{background:#0d1722;border-color:#34475a}[data-theme="dark"] .invoice-recipient-head{background:#172433;color:#aebdca}[data-theme="dark"] .invoice-recipient-row{border-color:#2d4052}

/* v1.1 FIX62 — modo oscuro: Gestión Administrativa + menús Acciones comerciales */
html[data-theme="dark"] .incident-admin-state{
  background:#0f1c28!important;
  border-color:#3c5569!important;
  color:#eef6ff!important;
}
html[data-theme="dark"] .incident-admin-state span{color:#9fb0c1!important}
html[data-theme="dark"] .incident-admin-state b{color:#eef6ff!important}
html[data-theme="dark"] .commercial-actions-menu{
  background:#172433!important;
  border-color:#3b4a59!important;
  color:#e7eef6!important;
  box-shadow:0 10px 28px rgba(0,0,0,.42)!important;
}
html[data-theme="dark"] .commercial-actions-menu button{
  background:transparent!important;
  color:#e7eef6!important;
  -webkit-text-fill-color:#e7eef6!important;
  opacity:1!important;
}
html[data-theme="dark"] .commercial-actions-menu button:hover:not(:disabled){background:#243447!important}
html[data-theme="dark"] .commercial-actions-menu button:disabled{
  color:#718294!important;
  -webkit-text-fill-color:#718294!important;
  opacity:1!important;
}
html[data-theme="dark"] .commercial-actions-separator{background:#3b4a59!important}
@media (prefers-color-scheme: dark){
  html:not([data-theme="light"]) .incident-admin-state{background:#0f1c28!important;border-color:#3c5569!important;color:#eef6ff!important}
  html:not([data-theme="light"]) .incident-admin-state span{color:#9fb0c1!important}
  html:not([data-theme="light"]) .incident-admin-state b{color:#eef6ff!important}
  html:not([data-theme="light"]) .commercial-actions-menu{background:#172433!important;border-color:#3b4a59!important;color:#e7eef6!important;box-shadow:0 10px 28px rgba(0,0,0,.42)!important}
  html:not([data-theme="light"]) .commercial-actions-menu button{background:transparent!important;color:#e7eef6!important;-webkit-text-fill-color:#e7eef6!important;opacity:1!important}
  html:not([data-theme="light"]) .commercial-actions-menu button:hover:not(:disabled){background:#243447!important}
  html:not([data-theme="light"]) .commercial-actions-menu button:disabled{color:#718294!important;-webkit-text-fill-color:#718294!important;opacity:1!important}
  html:not([data-theme="light"]) .commercial-actions-separator{background:#3b4a59!important}
}

/* v1.1 FIX63 — modo oscuro: modal de email comercial y vista previa */
html[data-theme="dark"] .quote-email-preview-title{
  background:#172433!important;
  border-color:#3b4a59!important;
  color:#e7eef6!important;
}
html[data-theme="dark"] .mail-chip-box{
  background:#0f1c28!important;
  border-color:#3c5569!important;
  color:#eef6ff!important;
}
html[data-theme="dark"] .mail-chip-box input{
  background:transparent!important;
  color:#eef6ff!important;
  -webkit-text-fill-color:#eef6ff!important;
}
html[data-theme="dark"] .mail-chip-box input::placeholder{color:#8fa2b5!important;opacity:1}
html[data-theme="dark"] .mail-link{color:#dce8f3!important;-webkit-text-fill-color:#dce8f3!important}
html[data-theme="dark"] .delivery-email-valued{border-color:#3c5569!important;background:#0f1c28!important}
@media (prefers-color-scheme: dark){
  html:not([data-theme="light"]) .quote-email-preview-title{background:#172433!important;border-color:#3b4a59!important;color:#e7eef6!important}
  html:not([data-theme="light"]) .mail-chip-box{background:#0f1c28!important;border-color:#3c5569!important;color:#eef6ff!important}
  html:not([data-theme="light"]) .mail-chip-box input{background:transparent!important;color:#eef6ff!important;-webkit-text-fill-color:#eef6ff!important}
  html:not([data-theme="light"]) .mail-chip-box input::placeholder{color:#8fa2b5!important;opacity:1}
  html:not([data-theme="light"]) .mail-link{color:#dce8f3!important;-webkit-text-fill-color:#dce8f3!important}
  html:not([data-theme="light"]) .delivery-email-valued{border-color:#3c5569!important;background:#0f1c28!important}
}

/* v1.1 FIX64 — modo oscuro: títulos de sección de Incidencias */
html[data-theme="dark"] .incident-section-title{
  border-bottom-color:#3b4a59!important;
}
html[data-theme="dark"] .incident-section-title b{
  color:#dce8f3!important;
  -webkit-text-fill-color:#dce8f3!important;
}
html[data-theme="dark"] .incident-section-title span{
  color:#9fb0c1!important;
  -webkit-text-fill-color:#9fb0c1!important;
}
@media (prefers-color-scheme: dark){
  html:not([data-theme="light"]) .incident-section-title{border-bottom-color:#3b4a59!important}
  html:not([data-theme="light"]) .incident-section-title b{color:#dce8f3!important;-webkit-text-fill-color:#dce8f3!important}
  html:not([data-theme="light"]) .incident-section-title span{color:#9fb0c1!important;-webkit-text-fill-color:#9fb0c1!important}
}

/* FIX65: homogeneidad de cabeceras/separadores de Incidencias y tabla de auditoría ampliada */
#modal:has(.incident-tabs) .incident-section-title,
#modal:has(.incident-tabs) .section-title{
  border-color:#e5eaf0!important;
}
.audit-table th:nth-child(1){width:150px}.audit-table th:nth-child(2){width:180px}.audit-table th:nth-child(3){width:165px}.audit-table th:nth-child(4){width:155px}.audit-table th:nth-child(5){width:260px}.audit-table th:nth-child(6){width:260px}
.audit-table{min-width:1170px!important}
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-section-title,
html[data-theme="dark"] #modal:has(.incident-tabs) .section-title{border-color:#3b4a59!important}
@media (prefers-color-scheme:dark){html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-section-title,html:not([data-theme="light"]) #modal:has(.incident-tabs) .section-title{border-color:#3b4a59!important}}


/* FIX67 — Incidencias: unificar separadores de cabeceras de todas las pestañas */
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-heading{border-bottom-color:#3b4a59!important}
@media (prefers-color-scheme:dark){html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-heading{border-bottom-color:#3b4a59!important}}

/* FIX68 — Incidencias: homogeneizar completamente las pestañas secundarias en modo oscuro */
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="parts"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="documents"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="technical-documents"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="traceability"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="history"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="planning"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-panel[data-panel="notes"],
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-list,
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-history-list,
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-documents-panel,
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-doc-section,
html[data-theme="dark"] #modal:has(.incident-tabs) .table-wrap{
  background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important;
}
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-heading,
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-tab-table,
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-history-item,
html[data-theme="dark"] #modal:has(.incident-tabs) .incident-history-pagination{
  border-color:#3b4a59!important;
}
html[data-theme="dark"] #modal:has(.incident-tabs) table,
html[data-theme="dark"] #modal:has(.incident-tabs) thead,
html[data-theme="dark"] #modal:has(.incident-tabs) tbody,
html[data-theme="dark"] #modal:has(.incident-tabs) tr,
html[data-theme="dark"] #modal:has(.incident-tabs) td{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
html[data-theme="dark"] #modal:has(.incident-tabs) th{background:#202c38!important;color:#dce7f1!important;border-color:#3b4a59!important}
html[data-theme="dark"] #modal:has(.incident-tabs) tbody tr:hover td{background:#202c38!important}
@media (prefers-color-scheme:dark){
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="parts"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="documents"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="technical-documents"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="traceability"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="history"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="planning"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-panel[data-panel="notes"],
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-list,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-history-list,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-documents-panel,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-doc-section,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .table-wrap{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-heading,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-tab-table,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-history-item,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) .incident-history-pagination{border-color:#3b4a59!important}
  html:not([data-theme="light"]) #modal:has(.incident-tabs) table,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) thead,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) tbody,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) tr,
  html:not([data-theme="light"]) #modal:has(.incident-tabs) td{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
  html:not([data-theme="light"]) #modal:has(.incident-tabs) th{background:#202c38!important;color:#dce7f1!important;border-color:#3b4a59!important}
  html:not([data-theme="light"]) #modal:has(.incident-tabs) tbody tr:hover td{background:#202c38!important}
}

/* FIX69 · Proyectos: contadores legibles en modo oscuro (Cronograma + Incidencias y partes) */
html[data-theme="dark"] #modal:has(.project-tabs) .project-timeline-heading span{
  background:#263545!important;
  color:#e7f0f8!important;
  border:1px solid #496075!important;
}
html[data-theme="dark"] #modal:has(.project-tabs) .project-activity-toolbar .muted{
  color:#aebdcb!important;
}
@media (prefers-color-scheme:dark){
  html:not([data-theme="light"]) #modal:has(.project-tabs) .project-timeline-heading span{
    background:#263545!important;
    color:#e7f0f8!important;
    border:1px solid #496075!important;
  }
  html:not([data-theme="light"]) #modal:has(.project-tabs) .project-activity-toolbar .muted{
    color:#aebdcb!important;
  }
}

/* v1.1 FIX70 · Proyectos > Documentos: filas compactas y carga múltiple */
.project-doc-section{margin-bottom:14px}
.project-doc-table th,.project-doc-table td{padding-top:4px!important;padding-bottom:4px!important;line-height:1.15;vertical-align:middle}
.project-doc-table td button{padding:4px 9px;min-height:28px}
.project-doc-table .empty.compact{padding:6px 8px}
.project-doc-dropzone{min-height:68px;align-content:center;flex-direction:column;gap:5px;padding:9px 12px}
.project-doc-drop-prompt{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}
.project-doc-selected{display:flex;align-items:center;justify-content:center;gap:5px;flex-wrap:wrap;max-width:100%}
.project-doc-file-chip{display:inline-flex;align-items:center;gap:5px;max-width:260px;padding:3px 5px 3px 8px;border:1px solid #cbd5e1;border-radius:999px;background:#fff;font-size:11px;line-height:1.2}
.project-doc-file-chip>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.project-doc-file-chip button{border:0;background:transparent;padding:0 2px;min-width:18px;min-height:18px;font-size:16px;line-height:16px;cursor:pointer}
@media(prefers-color-scheme:dark){.project-doc-file-chip{background:#101a28;border-color:#52647a;color:#e7edf5}.project-doc-file-chip button{color:#d7e1ee}}
:root[data-theme="dark"] .project-doc-file-chip{background:#101a28;border-color:#52647a;color:#e7edf5}
:root[data-theme="dark"] .project-doc-file-chip button{color:#d7e1ee}

/* FIX73 - Acciones compactas para documentos de incidencias (claro/oscuro reutiliza commercial-actions-menu) */
.incident-document-actions-wrap{position:relative}
.incident-document-actions-menu{min-width:245px;z-index:260}
.incident-document-actions-menu .danger-outline{color:#b42318!important}
html[data-theme="dark"] .incident-document-actions-menu .danger-outline{color:#ff9b93!important;-webkit-text-fill-color:#ff9b93!important}
@media (prefers-color-scheme:dark){html:not([data-theme="light"]) .incident-document-actions-menu .danger-outline{color:#ff9b93!important;-webkit-text-fill-color:#ff9b93!important}}

/* v1.1 FIX86 · IA Parte de trabajo: modal de revisión con espaciado uniforme */
#subModal:has(.ai-review) .modal-card{width:min(760px,94vw);max-height:90vh}
#subModal:has(.ai-review) #subModalBody{padding:0;overflow-y:auto}
.ai-review{padding:20px 22px 0;display:grid;gap:16px;min-width:0}
.ai-review label{display:grid;gap:7px;margin:0;font-weight:600}
.ai-review textarea{width:100%;margin:0;min-height:0;line-height:1.45}
.ai-review .tiny{margin:0 0 4px;line-height:1.45}
.ai-review .form-actions{margin:0 -22px 0;padding:12px 22px 12px;position:sticky;bottom:0;background:var(--panel,#fff);border-top:1px solid #e2e8f0;z-index:2}
@media(max-width:650px){.ai-review{padding:16px 16px 0;gap:14px}.ai-review .form-actions{margin-left:-16px;margin-right:-16px;padding-left:16px;padding-right:16px}}

/* FIX89 · Incident AI review: clearer original/proposal blocks + independent selection */
.ai-incident-review{gap:18px}
.ai-incident-review .ai-proposal-block{display:grid;gap:11px;padding:14px 16px 16px;border:1px solid var(--border,#d8e0e8);border-radius:10px;background:var(--panel,#fff)}
.ai-incident-review .ai-proposal-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;padding-bottom:9px;border-bottom:1px solid var(--border,#e2e8f0)}
.ai-incident-review .ai-proposal-heading>strong{font-size:15px}
.ai-incident-review .ai-proposal-select{display:flex;grid-template-columns:none;align-items:center;gap:7px;font-weight:500;white-space:nowrap}
.ai-incident-review .ai-proposal-select input{width:auto;margin:0}
.ai-incident-review .ai-original-field,.ai-incident-review .ai-proposed-field{gap:6px}
.ai-incident-review .ai-original-field>span,.ai-incident-review .ai-proposed-field>span{font-size:12px;font-weight:700}
.ai-incident-review .ai-original-field input,.ai-incident-review .ai-original-field textarea{background:var(--bg-soft,#f5f7fa);opacity:.9}
.ai-incident-review .ai-proposed-field{padding-top:3px}
.ai-incident-review .ai-proposed-field input,.ai-incident-review .ai-proposed-field textarea{border-width:2px}
@media(max-width:650px){.ai-incident-review .ai-proposal-heading{align-items:flex-start;flex-direction:column}.ai-incident-review .ai-proposal-select{white-space:normal}}


/* FIX90 · IA: modo oscuro unificado + botón de redacción sin restar altura a Descripción completa */
.incident-description-complete{display:flex!important;flex-direction:column;min-height:0}
.incident-description-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:34px}
.incident-ai-description-button{flex:0 0 auto;padding:6px 11px;min-height:32px;font-weight:500}
.incident-description-complete .incident-description-fit{flex:1 1 auto;height:100%;min-height:0!important}

/* La acción IA vive dentro de la etiqueta: el textarea conserva toda la fila flexible disponible. */
.incident-description-card .incident-description-fields{grid-template-rows:auto minmax(0,1fr)!important}

html[data-theme="dark"] #subModal:has(.ai-review) .modal-card,
html[data-theme="dark"] #subModal:has(.ai-review) .modal-head,
html[data-theme="dark"] #subModal:has(.ai-review) #subModalBody,
html[data-theme="dark"] #subModal:has(.ai-review) .ai-review{
  background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important;
}
html[data-theme="dark"] .ai-review .form-actions{background:#18222d!important;border-color:#3b4a59!important}
html[data-theme="dark"] .ai-review label,
html[data-theme="dark"] .ai-review strong,
html[data-theme="dark"] .ai-review .ai-proposal-heading>strong,
html[data-theme="dark"] .ai-review .ai-proposal-select{color:#e5edf5!important}
html[data-theme="dark"] .ai-review .tiny{color:#9fb0c1!important}
html[data-theme="dark"] .ai-incident-review .ai-proposal-block{background:#202c38!important;border-color:#405162!important;color:#e5edf5!important}
html[data-theme="dark"] .ai-incident-review .ai-proposal-heading{border-color:#405162!important}
html[data-theme="dark"] .ai-incident-review .ai-original-field>span{color:#aebdcb!important}
html[data-theme="dark"] .ai-incident-review .ai-proposed-field>span{color:#8dccf4!important}
html[data-theme="dark"] .ai-incident-review .ai-original-field input,
html[data-theme="dark"] .ai-incident-review .ai-original-field textarea{background:#151f29!important;color:#b8c6d3!important;border-color:#405162!important;opacity:1!important;-webkit-text-fill-color:#b8c6d3!important}
html[data-theme="dark"] .ai-incident-review .ai-proposed-field input,
html[data-theme="dark"] .ai-incident-review .ai-proposed-field textarea,
html[data-theme="dark"] .ai-review textarea{background:#111a24!important;color:#edf3f8!important;border-color:#52677a!important;-webkit-text-fill-color:#edf3f8!important}
html[data-theme="dark"] .ai-incident-review .ai-proposal-select input{accent-color:#55a8df}

@media (prefers-color-scheme:dark){
 html:not([data-theme="light"]) #subModal:has(.ai-review) .modal-card,
 html:not([data-theme="light"]) #subModal:has(.ai-review) .modal-head,
 html:not([data-theme="light"]) #subModal:has(.ai-review) #subModalBody,
 html:not([data-theme="light"]) #subModal:has(.ai-review) .ai-review{background:#18222d!important;color:#e5edf5!important;border-color:#3b4a59!important}
 html:not([data-theme="light"]) .ai-review .form-actions{background:#18222d!important;border-color:#3b4a59!important}
 html:not([data-theme="light"]) .ai-review label,
 html:not([data-theme="light"]) .ai-review strong,
 html:not([data-theme="light"]) .ai-review .ai-proposal-heading>strong,
 html:not([data-theme="light"]) .ai-review .ai-proposal-select{color:#e5edf5!important}
 html:not([data-theme="light"]) .ai-review .tiny{color:#9fb0c1!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-proposal-block{background:#202c38!important;border-color:#405162!important;color:#e5edf5!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-proposal-heading{border-color:#405162!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-original-field>span{color:#aebdcb!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-proposed-field>span{color:#8dccf4!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-original-field input,
 html:not([data-theme="light"]) .ai-incident-review .ai-original-field textarea{background:#151f29!important;color:#b8c6d3!important;border-color:#405162!important;opacity:1!important;-webkit-text-fill-color:#b8c6d3!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-proposed-field input,
 html:not([data-theme="light"]) .ai-incident-review .ai-proposed-field textarea,
 html:not([data-theme="light"]) .ai-review textarea{background:#111a24!important;color:#edf3f8!important;border-color:#52677a!important;-webkit-text-fill-color:#edf3f8!important}
 html:not([data-theme="light"]) .ai-incident-review .ai-proposal-select input{accent-color:#55a8df}
}


/* FIX92 - Proyecto: modal de actividad más ancho y prioridad a textos */
#subModal:has(#projectActivityForm) .modal-card{
  width:min(1180px,96vw);
  max-height:94vh;
}
#subModal:has(#projectActivityForm) .modal-head{padding:12px 18px}
#subModal:has(#projectActivityForm) #subModalBody{min-height:0}
#projectActivityForm{padding:14px 18px}
#projectActivityForm .form-grid{gap:7px 12px}
#projectActivityForm label{margin-bottom:5px}
#projectActivityForm input,#projectActivityForm select{padding:7px 9px}
#projectActivityForm .project-people{
  max-height:104px;
  padding:7px 10px;
  gap:2px 14px;
}
#projectActivityForm .project-person-option{min-height:23px!important;padding:1px 0!important}
#projectActivityForm textarea[name="description"]{min-height:180px;height:180px;resize:vertical}
#projectActivityForm textarea[name="result_notes"]{min-height:125px;height:125px;resize:vertical}
#projectActivityForm .form-actions{margin-top:2px}
@media(max-width:850px){
  #subModal:has(#projectActivityForm) .modal-card{width:96vw;max-height:94vh}
  #projectActivityForm textarea[name="description"]{min-height:150px;height:150px}
  #projectActivityForm textarea[name="result_notes"]{min-height:110px;height:110px}
}

/* FIX93 - Proyecto: cabecera de actividad compacta en dos filas */
#projectActivityForm .project-activity-primary-row{
  display:grid;
  grid-template-columns:minmax(150px,1.25fr) minmax(150px,1.25fr) minmax(125px,.9fr) 150px 150px;
  gap:8px 10px;
  align-items:end;
}
#projectActivityForm .project-activity-secondary-row{
  display:grid;
  grid-template-columns:440px minmax(0,1fr);
  gap:10px 14px;
  align-items:end;
}
#projectActivityForm .project-actual-fields{
  grid-template-columns:130px 130px 160px;
  gap:10px;
  align-items:end;
}
#projectActivityForm .project-activity-primary-row label,
#projectActivityForm .project-activity-secondary-row label{margin-bottom:0}
#projectActivityForm .project-people-field{min-width:0}
#projectActivityForm .project-people{
  grid-template-columns:repeat(3,minmax(0,1fr));
  max-height:72px;
  min-height:38px;
  padding:5px 9px;
  gap:1px 12px;
}
#projectActivityForm .project-person-option{min-height:20px!important}
#projectActivityForm textarea[name="description"]{min-height:205px;height:205px}
#projectActivityForm textarea[name="result_notes"]{min-height:145px;height:145px}
@media(max-width:1050px){
  #projectActivityForm .project-activity-primary-row{grid-template-columns:repeat(3,minmax(0,1fr))}
  #projectActivityForm .project-activity-secondary-row{grid-template-columns:1fr}
  #projectActivityForm .project-actual-fields{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:700px){
  #projectActivityForm .project-activity-primary-row{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-actual-fields{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-people{grid-template-columns:1fr 1fr}
}

/* FIX94 - Proyecto: actividad en tres bloques y Personas a todo el ancho */
#projectActivityForm .project-activity-primary-row{
  grid-template-columns:repeat(3,minmax(0,1fr));
}
#projectActivityForm .project-activity-datetime-row{
  display:grid;
  grid-template-columns:180px 180px minmax(0,1fr);
  gap:8px 10px;
  align-items:end;
}
#projectActivityForm .project-activity-datetime-row>label{margin-bottom:0}
#projectActivityForm .project-actual-fields{
  display:grid;
  grid-template-columns:135px 135px 175px;
  gap:10px;
  align-items:end;
}
#projectActivityForm .project-people-field{
  display:block;
  width:100%;
  margin-bottom:0;
}
#projectActivityForm .project-people{
  width:100%;
  grid-template-columns:repeat(4,minmax(0,1fr));
  max-height:128px;
  min-height:38px;
  padding:6px 10px;
  gap:2px 14px;
}
#projectActivityForm textarea[name="description"]{min-height:205px;height:205px}
#projectActivityForm textarea[name="result_notes"]{min-height:62px;height:62px}
@media(max-width:1050px){
  #projectActivityForm .project-activity-datetime-row{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-activity-datetime-row .project-actual-fields{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr))}
  #projectActivityForm .project-people{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:700px){
  #projectActivityForm .project-activity-primary-row{grid-template-columns:1fr}
  #projectActivityForm .project-activity-datetime-row{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-activity-datetime-row .project-actual-fields{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-people{grid-template-columns:1fr 1fr}
}

/* FIX95 - Proyecto: retícula coherente y alineación exacta de cabecera */
#projectActivityForm .project-activity-primary-row{
  grid-template-columns:repeat(3,minmax(0,1fr));
  width:100%;
  gap:10px;
  align-items:end;
}
#projectActivityForm .project-activity-datetime-row{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  width:100%;
  gap:10px;
  align-items:end;
}
#projectActivityForm .project-activity-datetime-row>label,
#projectActivityForm .project-activity-datetime-row .project-actual-fields>label{
  margin:0;
  min-width:0;
  align-self:end;
}
#projectActivityForm .project-activity-datetime-row .project-actual-fields{
  display:contents;
}
#projectActivityForm .project-activity-primary-row select,
#projectActivityForm .project-activity-datetime-row input{
  width:100%;
  height:36px;
  min-height:36px;
  box-sizing:border-box;
}
@media(max-width:1050px){
  #projectActivityForm .project-activity-datetime-row{grid-template-columns:repeat(5,minmax(0,1fr))}
  #projectActivityForm .project-activity-datetime-row .project-actual-fields{display:contents}
}
@media(max-width:850px){
  #projectActivityForm .project-activity-primary-row{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-activity-datetime-row{grid-template-columns:1fr 1fr}
  #projectActivityForm .project-activity-datetime-row .project-actual-fields{display:contents}
}
@media(max-width:560px){
  #projectActivityForm .project-activity-primary-row,
  #projectActivityForm .project-activity-datetime-row{grid-template-columns:1fr}
}


/* FIX96 - Proyecto: mejora de redacción IA en descripción de actividad */
#projectActivityForm .project-activity-description-field{display:block}
#projectActivityForm .project-activity-description-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:5px}
#projectActivityForm .project-activity-ai-button{flex:0 0 auto;padding:5px 10px;font-size:12px;line-height:1.2}
#projectActivityForm .project-activity-description-field textarea{display:block;width:100%}
@media(max-width:560px){#projectActivityForm .project-activity-description-label-row{align-items:flex-start;flex-direction:column;gap:5px}}

/* FIX97: modal IA secundario sobre la edición de actividad sin destruir el formulario padre. */
.nested-modal{z-index:180;background:#0f172acc}
@media (prefers-color-scheme: dark){.nested-modal{background:#02070de6}}

/* FIX9: gestor compacto de varias facturas */
#subModal:has(.multi-invoice-manager) .modal-card{width:min(1140px,96vw);height:min(740px,94vh);max-height:94vh;display:flex;flex-direction:column}
#subModal:has(.multi-invoice-manager) #subModalBody{flex:1;min-height:0;overflow:auto;padding:10px 18px 14px}
.multi-invoice-manager{min-height:100%;display:flex;flex-direction:column;gap:14px}
.multi-invoice-table{flex:1;min-height:115px;overflow:auto}
.multi-invoice-table table th,.multi-invoice-table table td{padding:6px 10px;font-size:12px}
.multi-invoice-table .invoice-actions{white-space:nowrap}
.multi-invoice-table .invoice-actions a{display:inline-block;margin-right:13px;color:#1c669b;text-decoration:underline;font-weight:600}
.multi-invoice-table .invoice-actions a.invoice-unlink{color:#a52222}
.multi-invoice-form{display:grid;grid-template-columns:1.25fr 1fr;gap:10px 16px;align-items:end}
.multi-invoice-dropzone{grid-row:span 2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:116px;padding:12px;border:2px dashed #9bb8cf;border-radius:9px;background:#f5f9fc;cursor:pointer;text-align:center}
.multi-invoice-dropzone.drag-over{background:#dcecf9;border-color:#22699d}
.multi-invoice-dropzone span,.multi-invoice-dropzone small{color:#64748b}
.multi-invoice-form label{display:flex;flex-direction:column;gap:5px;font-weight:600;font-size:12px}
.multi-invoice-form label input{width:100%}
.multi-invoice-manager .form-actions{margin-top:auto}
.incident-administrative-grid #incidentMultiInvoices.incident-manage-invoices{width:auto;min-height:32px;padding:6px 10px;justify-self:start;align-self:center;font-size:12px;white-space:nowrap}
.incident-invoice-summary b{overflow-wrap:anywhere;line-height:1.4}
@media(max-width:720px){.multi-invoice-form{grid-template-columns:1fr}.multi-invoice-dropzone{grid-row:auto}#subModal:has(.multi-invoice-manager) .modal-card{height:94vh}}

/* FIX9: gestor unificado de facturas */
#subModal:has(.multi-invoice-manager) .modal-card{width:min(1150px,96vw);max-height:95vh;height:min(820px,95vh)}
.multi-invoice-manager{gap:12px}.multi-invoice-table{flex:1;min-height:90px}.multi-invoice-table table td{padding:5px 9px}
.multi-invoice-pending{max-height:175px;overflow:auto}.multi-invoice-pending-row{display:grid;grid-template-columns:minmax(120px,1fr) 180px 55px;align-items:center;gap:12px;padding:4px 8px;border-bottom:1px solid #e2e8f0;font-size:12px}.multi-invoice-pending-row input{min-width:0;padding:5px 7px}.multi-invoice-mail{font-size:12px}.multi-invoice-mail .invoice-recipient-box{margin-top:6px;padding:9px}.multi-invoice-dropzone{min-height:78px}.multi-invoice-manager .form-actions{flex-wrap:wrap}
@media(max-width:640px){.multi-invoice-pending-row{grid-template-columns:minmax(80px,1fr) 120px 45px}}

/* FIX9 gestor único de facturas */
.multi-invoice-queued{display:grid;grid-template-columns:140px minmax(0,1fr) auto;gap:10px;align-items:center;padding:5px 0;border-bottom:1px solid var(--border,#ddd)}
.multi-invoice-queued input{width:100%;min-width:0}.multi-invoice-queued span{overflow-wrap:anywhere}.multi-invoice-queued a{font-size:12px}
.multi-invoice-manager .invoice-recipient-box{padding:10px 12px;margin:0}
@media(max-width:650px){.multi-invoice-queued{grid-template-columns:110px minmax(0,1fr) auto}}

/* v1.2 FIX10: facturas en tabla única y administración compacta */
#subModal:has(.multi-invoice-manager) .modal-card{height:min(780px,94vh);max-height:94vh}
#subModal:has(.multi-invoice-manager) #subModalBody{overflow:hidden;display:flex;flex-direction:column}
.multi-invoice-manager{min-height:0;height:100%;gap:10px}
.multi-invoice-table{flex:0 1 auto;height:clamp(100px,24vh,215px);min-height:90px;max-height:215px;overflow-y:auto}
.multi-invoice-form{display:block}
.multi-invoice-dropzone{min-height:110px;padding:16px 12px}
.multi-invoice-hint{padding-top:6px}
.multi-invoice-new-row{background:#eef7fd}
.multi-invoice-new-row input{max-width:165px;width:100%;padding:5px 7px}
.multi-invoice-new-tag{font-size:11px;color:#146d40;font-weight:700}
.multi-invoice-manager .invoice-recipient-box{flex-shrink:0}
.multi-invoice-manager .form-actions{margin-top:auto;flex-shrink:0}
.incident-administrative-grid.incident-admin-invoice-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);align-items:start;gap:12px}
.incident-admin-invoice-layout .incident-admin-col{min-width:0;display:flex;flex-direction:column;gap:8px}
.incident-admin-invoice-layout .incident-admin-buttons{height:34px;display:flex;align-items:stretch}
.incident-admin-invoice-layout .incident-admin-buttons button{width:110px;min-height:34px!important;padding:6px 10px!important;font-size:12px!important;justify-self:unset!important;align-self:unset!important}
.incident-admin-invoice-layout .incident-admin-heading{font-size:12px;font-weight:700;padding:8px 0}
.incident-admin-invoice-layout .incident-admin-state{width:100%;min-height:38px}
.incident-admin-invoice-layout .incident-admin-invoice-details{display:flex;align-items:center;gap:12px;min-height:38px;min-width:0}
.incident-admin-invoice-layout .incident-admin-billable{order:0!important;display:flex;align-items:center;gap:8px;white-space:nowrap;flex-shrink:0}
.incident-admin-invoice-layout .incident-invoice-summary{font-size:12px;min-width:0;overflow-wrap:anywhere}
.incident-admin-invoice-layout .incident-admin-exception,.incident-admin-invoice-layout .incident-admin-closed{grid-column:1/-1}
@media(max-width:700px){.incident-administrative-grid.incident-admin-invoice-layout{grid-template-columns:1fr}.multi-invoice-table{height:150px}}

/* FIX11: distribución administrativa y controles de envío */
.multi-invoice-table{height:clamp(120px,29vh,258px)!important;max-height:258px!important}
.multi-invoice-toggle{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between;gap:16px;min-height:32px;cursor:pointer}
.multi-invoice-toggle .switch-control{flex-shrink:0}
.incident-admin-invoice-layout .incident-admin-buttons button{width:124px!important;min-height:38px!important}
.incident-admin-invoice-layout .incident-admin-buttons{height:38px}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state{width:124px!important;max-width:124px;min-height:38px;overflow-wrap:anywhere;border:1px solid #cbd5e1;border-radius:6px;padding:7px 6px;font-size:11px}
.incident-admin-invoice-layout .incident-admin-col:nth-child(2){display:grid;grid-template-columns:124px minmax(0,1fr);grid-template-rows:38px auto;gap:7px 12px}
.incident-admin-invoice-layout .incident-admin-col:nth-child(2) .incident-admin-buttons{grid-column:1;grid-row:1}
.incident-admin-invoice-layout .incident-admin-col:nth-child(2) .incident-admin-invoice-details{display:contents}
.incident-admin-invoice-layout .incident-admin-billable{grid-column:1;grid-row:2}
.incident-admin-invoice-layout .incident-invoice-summary{grid-column:2;grid-row:1 / span 2;border:1px solid #cbd5e1;border-radius:6px;padding:8px 10px;min-height:38px;align-self:start}
@media(max-width:700px){.incident-admin-invoice-layout .incident-admin-col:nth-child(2){grid-template-columns:124px minmax(0,1fr)}}

/* FIX12: disposición administrativa y lista vertical de facturas */
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-buttons{height:38px}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state{margin-top:0}
.incident-admin-invoice-layout .incident-admin-buttons button:disabled{opacity:.55;cursor:not-allowed}
.incident-admin-invoice-layout .incident-invoice-summary{display:flex;flex-direction:column;align-items:flex-start;gap:3px;max-height:100px;overflow-y:auto}
.incident-admin-invoice-layout .incident-invoice-summary b{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:12px;row-gap:3px;width:100%;font-weight:600}
.incident-admin-invoice-layout .incident-invoice-number{display:block;white-space:nowrap;font-size:11px}
@media(max-width:850px){.incident-admin-invoice-layout .incident-invoice-summary b{grid-template-columns:1fr}}

/* FIX13: albarán mantiene botón, número más estrecho y tipografía igual a facturas */
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state{width:112px!important;max-width:112px!important;margin-top:7px!important;font-size:11px!important;font-weight:500!important;padding:7px 5px!important}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state b{font-size:11px!important;font-weight:600!important}

/* FIX14: alinear botón y número de albarán en la misma fila, sin alterar el tamaño del botón. */
.incident-admin-invoice-layout .incident-admin-col:first-child{display:grid;grid-template-columns:124px 112px;grid-template-rows:38px;column-gap:12px;align-items:center;justify-content:start}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-buttons{grid-column:1;grid-row:1;height:38px;align-self:center}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state{grid-column:2;grid-row:1;margin:0!important;min-height:38px;height:38px;display:flex;align-items:center;box-sizing:border-box}
@media(max-width:700px){.incident-admin-invoice-layout .incident-admin-col:first-child{grid-template-columns:124px 112px}}

/* FIX15: igualar botones y ocupar el espacio disponible con el número de albarán. */
.incident-administrative-grid.incident-admin-invoice-layout{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:12px!important}
.incident-admin-invoice-layout .incident-admin-col:first-child{display:grid!important;grid-template-columns:124px minmax(0,1fr)!important;grid-template-rows:38px!important;column-gap:12px!important;min-width:0!important;align-items:center!important}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-buttons{width:124px!important;min-width:124px!important;grid-column:1!important;grid-row:1!important}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-buttons button{width:124px!important;min-width:124px!important;max-width:124px!important;height:38px!important;box-sizing:border-box!important}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state{grid-column:2!important;grid-row:1!important;width:100%!important;max-width:none!important;min-width:0!important;height:38px!important;min-height:38px!important;margin:0!important;padding:7px 9px!important;box-sizing:border-box!important;overflow-wrap:normal!important;word-break:normal!important;white-space:nowrap!important;overflow:hidden!important;display:flex!important;align-items:center!important}
.incident-admin-invoice-layout .incident-admin-col:first-child .incident-admin-state b{white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:11px!important}
@media(max-width:700px){.incident-administrative-grid.incident-admin-invoice-layout{grid-template-columns:1fr!important}}

/* FIX: interruptor Sin Materiales alineado con los botones */
.daily-page .daily-material-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.daily-page .daily-material-actions .daily-no-materials-toggle{display:inline-flex;flex-direction:row;align-items:center;gap:8px;white-space:nowrap;margin:0 5px 0 0;padding:0;cursor:pointer;font-size:12px;line-height:1.25;font-weight:500;vertical-align:middle}
.daily-page .daily-material-actions .daily-no-materials-toggle input[type="checkbox"]{appearance:none;-webkit-appearance:none;display:inline-block;position:relative;flex:none;width:36px;height:20px;min-width:36px;margin:0;padding:0;border:1px solid #a7b4c5;border-radius:999px;background:#cbd5e1;cursor:pointer;vertical-align:middle;transition:background .15s,border-color .15s}
.daily-page .daily-material-actions .daily-no-materials-toggle input[type="checkbox"]::before{content:"";position:absolute;left:2px;top:2px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transition:transform .15s}
.daily-page .daily-material-actions .daily-no-materials-toggle input[type="checkbox"]:checked{background:#17649a;border-color:#17649a}
.daily-page .daily-material-actions .daily-no-materials-toggle input[type="checkbox"]:checked::before{transform:translateX(16px)}
.daily-page .daily-material-actions .daily-no-materials-toggle input[type="checkbox"]:focus-visible{outline:2px solid #17649a;outline-offset:3px}
.daily-page .daily-material-actions .daily-no-materials-toggle input[type="checkbox"]:disabled{opacity:.5;cursor:not-allowed}
.daily-page .daily-material-actions .daily-no-materials-toggle:has(input:disabled){cursor:not-allowed}
