/* SafeCore Design System — Fase 2. Alcance: Inicio, Accidentes y Observaciones. */
#dashboard.control-center-active,#accidents,#observations{color:var(--sc-text-primary)}
#dashboard .sso-cc{--cc-blue:var(--sc-info);--cc-red:var(--sc-danger);--cc-orange:var(--sc-warning);--cc-green:var(--sc-success);gap:var(--sc-space-5)}
#dashboard .cc-heading h2,#accidents>.section-title h2,#observations>.section-title h2{color:var(--sc-text-primary);font-size:25px;line-height:1.15;letter-spacing:-.02em}
#dashboard .cc-heading p,#accidents>.section-title span,#observations>.section-title span{color:var(--sc-text-secondary)}
#dashboard .cc-filter-card,#dashboard .cc-panel{border-color:var(--sc-border);border-radius:var(--sc-radius-lg);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}
#dashboard .cc-filter-card{padding:var(--sc-space-4)}
#dashboard .cc-filter-group>label{color:var(--sc-text-secondary);font-size:11px;letter-spacing:0;text-transform:none}
#dashboard .cc-filter-group select{min-height:39px;border-color:#cadbe2;border-radius:var(--sc-radius-sm);color:var(--sc-text-primary)}
#dashboard .cc-period-buttons{background:var(--sc-surface-secondary)}
#dashboard .cc-period-buttons button.active{color:var(--sc-primary)}
#dashboard .cc-period-nav button,#dashboard .cc-current{border-color:var(--sc-border);border-radius:var(--sc-radius-sm);background:var(--sc-surface);color:var(--sc-text-primary)}
#dashboard .cc-current{color:var(--sc-primary)}
#dashboard .cc-filter-chip{border-color:color-mix(in srgb,var(--sc-primary) 22%,var(--sc-border));background:var(--sc-success-soft);color:var(--sc-primary)}
#dashboard .cc-kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
#dashboard .cc-kpi{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-areas:"icon value" "icon label" ". note";align-items:center;gap:2px 14px;min-height:112px;padding:14px 16px;border-color:var(--sc-border);border-radius:var(--sc-radius-md);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm);transform:none}
#dashboard .cc-kpi:hover{border-color:#a8c2cc;transform:translateY(-1px)}
#dashboard .cc-kpi-icon{grid-area:icon;display:grid;width:48px;height:48px;place-items:center;border-radius:50%;background:var(--sc-info-soft);color:var(--sc-info)}
#dashboard .cc-kpi-icon svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#dashboard .cc-kpi.success .cc-kpi-icon{background:var(--sc-success-soft);color:var(--sc-success)}
#dashboard .cc-kpi.warning .cc-kpi-icon{background:var(--sc-warning-soft);color:var(--sc-warning)}
#dashboard .cc-kpi.danger .cc-kpi-icon{background:var(--sc-danger-soft);color:var(--sc-danger)}
#dashboard .cc-kpi-value{grid-area:value;margin:0;color:var(--sc-text-primary);font-size:25px}
#dashboard .cc-kpi.success .cc-kpi-value{color:var(--sc-success)}
#dashboard .cc-kpi.warning .cc-kpi-value{color:var(--sc-warning)}
#dashboard .cc-kpi.danger .cc-kpi-value{color:var(--sc-danger)}
#dashboard .cc-kpi-label{grid-area:label;margin:3px 0 0;color:var(--sc-text-secondary);font-size:12px;text-transform:none}
#dashboard .cc-kpi-note{grid-area:note;margin-top:7px;color:var(--sc-text-muted);font-size:11px}
#dashboard .cc-panel{padding:var(--sc-space-5)}
#dashboard .cc-panel-head h3{color:var(--sc-text-primary)}
#dashboard .cc-panel-head p{color:var(--sc-text-secondary)}
#dashboard .cc-risk-card{border:1px solid transparent;color:var(--sc-text-primary)}
#dashboard .cc-risk-card.grave{border-color:#ffcaca;background:var(--sc-danger-soft);color:#a91818}
#dashboard .cc-risk-card.moderado{border-color:#f5dba0;background:var(--sc-warning-soft);color:#925500}
#dashboard .cc-risk-card.leve{border-color:#b9e6d2;background:var(--sc-success-soft);color:#057448}
#dashboard .cc-risk-card.unclassified{border-color:var(--sc-border);background:var(--sc-neutral-soft);color:var(--sc-neutral)}
#dashboard .cc-risk-table{min-width:620px;table-layout:auto}
#dashboard .cc-risk-table th,#dashboard .cc-risk-table td{border-color:var(--sc-border);padding:9px 7px;font-size:10px;overflow-wrap:normal;word-break:normal}
#dashboard .cc-risk-table thead th{background:#f3f8f9;color:var(--sc-text-primary)}
#dashboard .cc-risk-table tbody th{min-width:90px;white-space:normal}
#dashboard .cc-risk-table .risk-moderado{background:var(--sc-warning);color:#fff}
#dashboard .cc-table th{background:#f3f8f9;color:var(--sc-text-primary);text-transform:none}
#dashboard .cc-table td,#dashboard .cc-table th{border-color:var(--sc-border)}
#dashboard .cc-empty{border-color:var(--sc-border);border-radius:var(--sc-radius-md);background:var(--sc-surface-secondary);color:var(--sc-text-muted)}

#accidents.screen.active{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:18px;align-items:start}
#accidents>.section-title,#accidents>.accident-safety-kpis,#accidents>.accident-upload-actions,#accidents>.obs-list,#accidents>.accident-indicators{grid-column:1/-1}
#accidents>.chart-card{margin:0;border:1px solid var(--sc-border);border-radius:var(--sc-radius-lg);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}
#accidents>.chart-card:has(.pyramid){grid-column:span 5}
#accidents>.chart-card:has(#monthly-acc-chart){grid-column:span 7}
#accidents>.card:has(#last-accident-date){grid-column:1/-1}
#accidents .accident-safety-kpis{margin:0;gap:14px}
#accidents .accident-safety-kpi{min-height:118px;padding:16px;border-color:var(--sc-border);border-radius:var(--sc-radius-md);box-shadow:var(--sc-shadow-sm)}
#accidents .accident-safety-kpi .safety-achievement-icon{width:52px;height:52px;flex-basis:52px;border-radius:50%;background:var(--sc-success-soft);color:var(--sc-success)}
#accidents .accident-safety-kpi .safety-achievement-icon svg{width:31px;height:31px}
#accidents .accident-safety-value{color:var(--sc-text-primary);font-size:29px}
#accidents .accident-safety-label{color:var(--sc-text-secondary)}
#accidents .accident-upload-button{min-height:44px;border-radius:var(--sc-radius-sm);padding:10px 16px;font-size:14px}
#accidents .accident-upload-button--work{border-color:var(--sc-primary);background:var(--sc-primary)}
#accidents .accident-upload-button--danger{border-color:var(--sc-border);background:var(--sc-surface);color:var(--sc-text-primary)}
#accidents .metric-label,#accidents .ai-chart-title,#accidents .ai-head h2{color:var(--sc-text-primary)}
#accidents .monthly-key,#accidents .metric-note,#accidents .ai-head p{color:var(--sc-text-secondary)}
#accidents .ai-filters{border:1px solid var(--sc-border);border-radius:var(--sc-radius-lg);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}
#accidents .ai-filters select{min-height:39px;border-color:#cadbe2;border-radius:var(--sc-radius-sm)}
#accidents .ai-kpi,#accidents .ai-chart-card,#accidents .ai-table-card{border:1px solid var(--sc-border);border-radius:var(--sc-radius-lg);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}
#accidents .ai-kpi:before{background:var(--sc-success)}
#accidents .ai-kpi-frequency:before{background:var(--sc-info)}
#accidents .ai-kpi-severity:before{background:var(--sc-warning)}
#accidents .ai-table-wrap{border-top:1px solid var(--sc-border)}
#accidents .ai-table th{position:sticky;top:0;background:#f3f8f9;color:var(--sc-text-primary)}
#accidents .ai-table th,#accidents .ai-table td{border-color:var(--sc-border)}
#accidents .ai-auto-box{border-color:var(--sc-border);background:var(--sc-surface-secondary)}
#accidents .ai-analysis-copy{border-color:var(--sc-border);background:var(--sc-surface-secondary)}

#observations.screen.active{display:block}
#observations>.section-title{margin-bottom:16px}
#observations .tramo-status-filters{grid-template-columns:repeat(auto-fit,minmax(min(100%,270px),1fr));gap:14px;margin-bottom:18px}
#observations .tramo-status-pill{min-height:94px;grid-template-columns:minmax(0,1fr);gap:8px;padding:13px 14px;overflow:visible;border-color:var(--sc-border);border-radius:var(--sc-radius-md);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}
#observations .tramo-status-pill.selected{border-color:color-mix(in srgb,var(--sc-primary) 35%,var(--sc-border));background:#f2faf7;box-shadow:inset 3px 0 0 var(--sc-primary),var(--sc-shadow-sm)}
#observations .tramo-status-pill button{min-height:auto;padding:0;color:var(--sc-text-primary);font-size:14px}
#observations .tramo-status-pill button:before{content:"";display:inline-block;width:10px;height:10px;margin-right:8px;border:2px solid var(--sc-info);border-radius:3px;vertical-align:-1px}
#observations .tramo-status-pill.selected button:before{border-color:var(--sc-primary);background:var(--sc-success-soft)}
#observations .tramo-status-pill button .work-area-count{margin:6px 0 0 22px;color:var(--sc-text-secondary)}
#observations .tramo-status-pill select{min-height:36px;margin:0;border-color:#cadbe2;border-radius:var(--sc-radius-sm);color:var(--sc-text-primary)}
#observations .obs-list{grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr));gap:14px}
#observations .observation{min-height:126px;padding:16px;border-color:var(--sc-border);border-radius:var(--sc-radius-md);box-shadow:var(--sc-shadow-sm)}
#observations .status-line{background:var(--sc-warning)}
#observations .observation.closed .status-line{background:var(--sc-success)}
#observations .obs-title{color:var(--sc-text-primary)}
#observations .obs-meta{color:var(--sc-text-secondary)}
#observations .status{border-radius:999px;background:var(--sc-warning-soft);color:#a65d00}
#observations .closed .status{background:var(--sc-success-soft);color:#057448}
#observations .record-actions .secondary{border-color:var(--sc-border);border-radius:8px;background:var(--sc-surface);color:var(--sc-text-secondary)}
#observations .record-actions .delete-button{border-color:#f2c2c2;background:var(--sc-danger-soft);color:var(--sc-danger)}
#observations .empty{border-color:var(--sc-border);border-radius:var(--sc-radius-lg);background:var(--sc-surface-secondary);color:var(--sc-text-muted)}

@media(max-width:1100px){#dashboard .cc-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}#accidents>.chart-card:has(.pyramid),#accidents>.chart-card:has(#monthly-acc-chart){grid-column:1/-1}}
@media(max-width:760px){#dashboard .cc-kpi-grid{grid-template-columns:1fr}#dashboard .cc-kpi{min-height:104px}#dashboard .cc-layout-main,#dashboard .cc-layout-half{grid-template-columns:1fr}#dashboard .cc-filter-top{grid-template-columns:1fr}#dashboard .cc-period-nav{grid-template-columns:38px minmax(0,1fr) 38px}#dashboard .cc-current{grid-column:1/-1}#dashboard .cc-risk-table{min-width:610px}#accidents.screen.active{grid-template-columns:1fr}#accidents>*{grid-column:1!important}#accidents .accident-safety-kpis{grid-template-columns:1fr}#observations .record-actions{max-width:none;grid-column:2;justify-content:flex-start}}
@media(prefers-reduced-motion:reduce){#dashboard .cc-kpi,#accidents .accident-upload-button{transition:none}}

/* Corrección estructural: composición maestra de Plan Anual. */
#dashboard .cc-heading,#accidents>.section-title:first-child,#observations>.section-title{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin:0 0 18px}
#dashboard .cc-heading h2,#accidents>.section-title:first-child h2,#observations>.section-title h2{margin:0 0 5px;font-size:30px}
#accidents>.section-title p,#observations>.section-title p{margin:0;color:var(--sc-text-secondary);font-size:14px}
#dashboard .cc-filter-card{display:grid;gap:12px;padding:16px 18px}
#dashboard .cc-filter-top{grid-template-columns:minmax(320px,1.5fr) minmax(180px,.55fr) minmax(180px,.55fr)}
@media(min-width:1350px){#dashboard .cc-kpi-grid{grid-template-columns:repeat(6,minmax(0,1fr))}}
#dashboard .cc-panel-wide{min-height:340px}
#dashboard .cc-layout-main{grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr)}

.phase2-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-column:1/-1;gap:14px;margin:0 0 2px}
.phase2-kpi{display:grid;grid-template-columns:52px minmax(0,1fr);align-items:center;gap:14px;min-height:112px;padding:16px;border:1px solid var(--sc-border);border-radius:var(--sc-radius-md);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}
.phase2-kpi-icon{display:grid;width:52px;height:52px;place-items:center;border-radius:50%;background:var(--sc-info-soft);color:var(--sc-info)}
.phase2-kpi-icon svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.phase2-kpi>div{display:grid;gap:2px}.phase2-kpi span{color:var(--sc-text-secondary);font-size:12px}.phase2-kpi strong{color:var(--sc-text-primary);font-size:27px;line-height:1.1}.phase2-kpi small{color:var(--sc-text-muted);font-size:11px}
.phase2-kpi.success .phase2-kpi-icon{background:var(--sc-success-soft);color:var(--sc-success)}.phase2-kpi.success strong{color:var(--sc-success)}
.phase2-kpi.warning .phase2-kpi-icon{background:var(--sc-warning-soft);color:var(--sc-warning)}.phase2-kpi.warning strong{color:var(--sc-warning)}
.phase2-kpi.danger .phase2-kpi-icon{background:var(--sc-danger-soft);color:var(--sc-danger)}.phase2-kpi.danger strong{color:var(--sc-danger)}

#accidents .accident-overview-kpis{margin-bottom:0}
#accidents .accident-safety-kpis{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important}
#accidents>.chart-card{padding:20px}
#accidents>.chart-card .metric-label{font-size:15px;font-weight:750}
#accidents>.section-title:not(:first-child){grid-column:1/-1;margin:8px 0 -4px;padding-top:8px;border-top:1px solid var(--sc-border)}
#accidents>.card:has(#last-accident-date){display:grid;grid-template-columns:minmax(180px,.45fr) minmax(0,1fr);align-items:center;min-height:88px;padding:18px 20px}
#accidents>.obs-list{display:grid;grid-template-columns:1fr;gap:10px}
#accidents .observation{display:grid;grid-template-columns:6px minmax(0,1fr) auto;align-items:center;min-height:92px;padding:14px 16px;border:1px solid var(--sc-border);border-radius:var(--sc-radius-md);background:var(--sc-surface);box-shadow:var(--sc-shadow-sm)}

#observations .observation-kpis{margin-bottom:18px}
#observations .tramo-status-filters{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:16px}
#observations .tramo-status-pill{display:flex;flex-direction:column;min-height:214px;padding:18px;gap:14px}
#observations .tramo-status-pill button{display:grid;grid-template-columns:46px minmax(0,1fr);grid-template-areas:"icon copy" "icon total";align-items:center;gap:2px 12px;text-align:left}
#observations .tramo-status-pill button:before{display:none}
#observations .work-area-icon{grid-area:icon;display:grid;width:46px;height:46px;place-items:center;border-radius:14px;background:var(--sc-info-soft);color:var(--sc-info)}
#observations .selected .work-area-icon{background:var(--sc-success-soft);color:var(--sc-primary)}
#observations .work-area-icon svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#observations .work-area-copy{grid-area:copy;display:grid}.work-area-copy strong{font-size:15px}.work-area-copy small{margin-top:2px;color:var(--sc-text-muted);font-size:11px}
#observations .work-area-total{grid-area:total;margin:6px 0 0!important;color:var(--sc-text-secondary)!important;font-size:12px}.work-area-total b{color:var(--sc-text-primary);font-size:21px}
#observations .work-area-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding-top:12px;border-top:1px solid var(--sc-border)}
#observations .work-area-stats span{display:grid;color:var(--sc-text-muted);font-size:11px}.work-area-stats b{color:var(--sc-text-primary);font-size:16px}
#observations .work-area-progress{height:7px;overflow:hidden;border-radius:999px;background:#e7eff1}.work-area-progress span{display:block;height:100%;border-radius:inherit;background:var(--sc-success)}
#observations .work-area-footer{display:flex;align-items:center;justify-content:space-between;gap:10px}.work-area-footer small{color:var(--sc-success);font-weight:700}
#observations .tramo-status-pill select{width:auto;min-width:128px}
#observations .obs-list{grid-template-columns:1fr}
#observations .observation{display:grid;grid-template-columns:6px minmax(0,1fr) auto;align-items:center;min-height:94px}

@media(max-width:1050px){.phase2-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}#dashboard .cc-filter-top{grid-template-columns:1fr 1fr}.cc-filter-group.period{grid-column:1/-1}}
@media(max-width:650px){.phase2-kpis{grid-template-columns:1fr}#dashboard .cc-filter-top{grid-template-columns:1fr}#dashboard .cc-filter-group.period{grid-column:auto}#accidents>.card:has(#last-accident-date){grid-template-columns:1fr}#observations .observation,#accidents .observation{grid-template-columns:6px minmax(0,1fr)}#observations .record-actions,#accidents .record-actions{grid-column:2}}

/* Inicio: only the unsafe-act chart and its risk matrix. */
#dashboard .cc-layout-half:has(#cc-unsafe){grid-template-columns:minmax(0,35fr) minmax(0,65fr)}
#dashboard #cc-unsafe .cc-unsafe-layout{grid-template-columns:minmax(0,1fr)}
#dashboard #cc-unsafe .cc-half-donut{max-width:340px}
#dashboard #cc-risk-matrix .cc-risk-table{min-width:0;table-layout:fixed}
#dashboard #cc-risk-matrix .cc-kind-unclassified{display:none}
#dashboard #cc-risk-matrix .cc-risk-table th,#dashboard #cc-risk-matrix .cc-risk-table td{font-size:11px;padding:9px 5px}
#dashboard #cc-risk-matrix .cc-risk-table tbody th{min-width:0}
@media(max-width:1199px){#dashboard .cc-layout-half:has(#cc-unsafe){grid-template-columns:minmax(0,1fr)}}
@media(max-width:599px){#dashboard #cc-risk-matrix .cc-risk-table{min-width:460px}}
