/* Vista de cliente y maqueta A4 del informe mensual. */
.hse-toolbar p { font-size:.85rem; color:#64748b; }
#hse-preview { display: grid; grid-template-columns: minmax(0,1fr); gap: 1.4rem; justify-items: center; }
.hse-sheet {
  --hse-navy: #1d365b;
  --hse-green: #2bac49;
  --hse-ink: #1b2636;
  --hse-muted: #526176;
  display: flex; flex-direction: column; width: min(100%, 880px); min-height: 1040px; min-width: 0;
  background: #fff; color: var(--hse-ink); padding: 33px 43px 27px;
  border-radius: 12px; border: 1px solid #e1e7ef; box-shadow: 0 10px 25px #172b4510;
  line-height: 1.45; font-family: system-ui, sans-serif;
}
.hse-sheet h2 { color: var(--hse-navy); font-size: 1.6rem; font-weight: 800; line-height: 1.18; margin: 0 0 .75rem; scroll-margin-top: 92px; }
.hse-sheet h3 { color: var(--hse-navy); font-size: 1.14rem; font-weight: 700; margin: 1rem 0 .5rem; line-height: 1.25; }
.hse-page-body > h2:not(:first-child) { margin-top: 1.25rem; }
.hse-sheet p { margin: 0 0 .7rem; }
.hse-page-header, .hse-page-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--hse-muted); font-size: .74rem; }
.hse-page-header { border-bottom: 1px solid var(--hse-green); padding-bottom: .7rem; margin-bottom: 1.35rem; }
.hse-page-header strong { color: var(--hse-navy); font-weight: 750; }
.hse-page-header span { display: block; }
.hse-page-header > div:last-child { text-align: right; }
.hse-letterhead { display: flex; align-items: center; gap: .65rem; }
.hse-letterhead img { width: 34px; height: 34px; object-fit: contain; }
.hse-page-footer { margin-top: auto; border-top: 1px solid #cdd7e3; padding-top: .65rem; }
.hse-page-body { margin-bottom: 1.25rem; }
.hse-table-wrap { width: 100%; overflow-x: auto; margin: 0 0 .78rem; }
.hse-table { width: 100%; border-collapse: collapse; font-size: .84rem; text-align: left; }
.hse-table th { background: var(--hse-navy); color: #fff; font-weight: 650; }
.hse-table th, .hse-table td { padding: .48rem .58rem; border-bottom: 1px solid #d5deea; vertical-align: top; overflow-wrap: anywhere; }
.hse-table th { overflow-wrap: normal; }
.hse-table .hse-label-cell { white-space: nowrap; }
.hse-table tr:nth-child(even) td { background: #f1f5f9; }
.hse-table .hse-total td { border-top: 2px solid var(--hse-navy); font-weight: 750; background: #fff; }
.hse-badge { display: inline-block; padding: .09rem .42rem; border-radius: 6px; white-space: nowrap; font-size: .75rem; font-weight: 650; }
.hse-good { background: #e3f4e6; color: #17622a; }
.hse-attention { background: #fff0cc; color: #855200; }
.hse-danger { background: #fce5e5; color: #9c241e; }
.hse-note { font-size: .78rem; color: var(--hse-muted); }
.hse-callout { background: #e8f5e9; border-left: 3px solid var(--hse-green); padding: .65rem .75rem; border-radius: 0 6px 6px 0; }
.hse-list { margin: .4rem 0 .9rem; padding-left: 1.35rem; }
ul.hse-list { list-style: disc; }
ol.hse-list { list-style: decimal; }
.hse-list li { margin-bottom: .35rem; }
.hse-index { list-style: none; padding: 0; margin: 0 0 1rem; }
.hse-index button { width: 100%; display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dotted #c9d4e1; padding: .47rem 0; text-align: left; }
.hse-index button:hover { color: #205287; }
.hse-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .8rem; }
.hse-summary-stats { grid-template-columns: repeat(4,minmax(0,1fr)); margin: 1rem 0; }
.hse-stat { border-top: 3px solid var(--hse-green); border-radius: 5px; padding: .75rem; background: #edf2f8; }
.hse-stat strong, .hse-stat span, .hse-stat small { display: block; }
.hse-stat strong { font-size: 1.75rem; color: var(--hse-navy); line-height: 1.05; margin-bottom: .28rem; font-weight: 800; }
.hse-stat span { font-weight: 700; font-size: .83rem; }
.hse-stat small { font-size: .72rem; color: var(--hse-muted); }
.hse-chart { padding: .5rem 0; }
.hse-chart svg { display: block; width: 100%; color: var(--hse-ink); font-family: system-ui,sans-serif; font-size: 13px; fill: currentColor; }
.hse-chart-count { font-weight: 700; }
.hse-chart-caption { font-size: 11px; }
.hse-chart .hse-note { text-align: right; }
.hse-photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem 1rem; }
.hse-photo-grid img, .hse-missing { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eef2f7; border-radius: 5px; }
.hse-missing { display: grid; place-items: center; color: var(--hse-muted); font-size: .8rem; }
.hse-photo-grid figcaption { margin-top: .33rem; font-size: .77rem; color: var(--hse-muted); line-height: 1.35; }
.hse-approvals td { height: 3.2rem; }
.hse-cover { padding: 0; background: #1d365b; overflow: hidden; color: #fff; }
.hse-cover-top { position: relative; min-height: 490px; padding: 52px 54px 44px; isolation: isolate; background: #14283e; }
.hse-cover-top::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg,#10263bbd,#14283ef5); }
.hse-cover-photo { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hse-cover-brand { display: flex; justify-content: space-between; gap: 1rem; text-align: right; font-size: .8rem; font-weight: 700; }
.hse-cover-brand img { width: 134px; height: 134px; background: #fff; border-radius: 13px; object-fit: contain; padding: 10px; }
.hse-cover-brand small { display: block; font-weight: 450; color: #e2e8f0; margin-top: .2rem; }
.hse-cover h1 { color: #fff; font-weight: 850; font-size: clamp(2rem,4vw,3.2rem); line-height: 1.04; max-width: 620px; margin-top: 2rem; }
.hse-cover h1::before { content: ''; display: block; background: #46c963; width: 62px; height: 5px; margin-bottom: 1rem; }
.hse-cover-main { padding: 2rem 54px; flex: 1; }
.hse-cover h2, .hse-cover .hse-stat strong { color: #fff; }
.hse-cover p, .hse-cover .hse-stat small { color: #d7e2ef; }
.hse-cover .hse-stat { background: #27476a; }
.hse-period-line { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin: .65rem 0 1.5rem; }
.hse-period-line strong { color: #67d982; text-transform: uppercase; }
.hse-period-line span { color: #d7e2ef; }
.hse-cover-footer { background: #13263a; border-top: 3px solid var(--hse-green); padding: 1.75rem 54px; }
.hse-cover-footer dl { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; margin: 0 0 1.35rem; }
.hse-cover-footer dt { font-size: .72rem; color: #aebfd2; text-transform: uppercase; }
.hse-cover-footer dd { font-size: .84rem; margin: .15rem 0 0; }
.hse-cover-footer > div { display: flex; justify-content: space-between; gap: .7rem; color: #c3d0df; font-size: .73rem; }
@media screen and (max-width: 720px) {
  .hse-workspace { padding-inline: 1rem; }
  .hse-sheet { padding: 22px 15px; min-height: 0; border-radius: 8px; }
  .hse-cover { padding: 0; }
  .hse-sheet h2 { font-size: 1.32rem; }
  .hse-cover-top { min-height: 0; padding: 24px 18px 32px; }
  .hse-cover-brand img { width: 80px; height: 80px; padding: 6px; }
  .hse-cover-brand { font-size: .64rem; }
  .hse-cover-main, .hse-cover-footer { padding: 22px 18px; }
  .hse-cover-footer dl, .hse-summary-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hse-cover .hse-stats { grid-template-columns: 1fr; gap: .45rem; }
  .hse-page-header, .hse-page-footer { font-size: .65rem; }
  .hse-table-wide .hse-table { min-width: 540px; }
}
@media print {
  @page { size: A4 portrait; margin: 0; }
  html:has(#hse-preview), body:has(#hse-preview) { margin: 0 !important; padding: 0 !important; width: 210mm; background: #fff; }
  body:has(#hse-preview) #root > :not(.app-layout), body:has(#hse-preview) .app-layout > :not(.main-wrapper),
  body:has(#hse-preview) .main-wrapper > :not(#appPageContainer), .hse-toolbar { display: none !important; }
  body:has(#hse-preview) #root, body:has(#hse-preview) .app-layout, body:has(#hse-preview) .main-wrapper,
  body:has(#hse-preview) #appPageContainer, .hse-workspace, #hse-preview {
    display: block !important; min-height: 0 !important; height: auto !important; max-height: none !important;
    width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; overflow: visible !important;
  }
  #hse-preview { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .hse-sheet { width: 210mm; min-height: 296.5mm; padding: 12mm 15mm 9mm; border: 0; border-radius: 0; box-shadow: none; break-after: page; font-size: 10pt; }
  .hse-sheet:last-child { break-after: auto; }
  .hse-sheet h2 { font-size: 18pt; margin-bottom: 2.8mm; }
  .hse-sheet h3 { font-size: 13pt; margin: 4mm 0 2mm; }
  .hse-sheet p { margin-bottom: 2.6mm; }
  .hse-page-header { margin-bottom: 5mm; }
  .hse-table-wrap { overflow: visible; margin-bottom: 2.8mm; }
  .hse-table { font-size: 8.6pt; }
  .hse-table th, .hse-table td { padding: 1.65mm 1.8mm; }
  .hse-table tr, .hse-photo-grid figure { break-inside: avoid; }
  .hse-badge { font-size: 7.7pt; }
  .hse-note { font-size: 8pt; }
  .hse-index button { padding: 1.4mm 0; }
  .hse-photo-grid { gap: 2.2mm 4mm; }
  .hse-photo-grid img { height: 54mm; aspect-ratio: auto; }
  .hse-photo-grid figcaption { font-size: 8pt; }
  .hse-cover { padding: 0; }
  .hse-cover-top { min-height: 145mm; padding: 18mm 18mm 12mm; }
  .hse-cover h1 { font-size: 34pt; }
  .hse-cover-main, .hse-cover-footer { padding: 10mm 18mm; }
}

/* Catálogo y formulario de Informes HSE. */
.hse-module.content-container {
  --hse-heading:#092854;
  --hse-olive:#63723c;
  --hse-field:#f6f8fa;
  --hse-blue-soft:#eef3f9;
  --hse-olive-soft:#f1f4eb;
  --hse-olive-border:#c7d2b2;
  display:grid;
  gap:24px;
  width:100%;
  max-width:1600px;
  min-width:0;
  margin-inline:auto;
  padding:32px;
}
.hse-generation.content-container { padding-top:56px; }
.hse-module .hse-module-header,.hse-module .hse-generation-card { min-width:0; margin:0; padding:24px; }
.hse-module .hse-module-header { min-height:130px; gap:18px; }
.hse-generation .hse-module-header>div:first-child { flex:1 1 470px; min-width:0; }
.hse-module-header h1 { margin:7px 0 2px; font-size:24px; line-height:1.35; font-weight:800; letter-spacing:-.035em; }
.hse-module-header p { margin:0; color:var(--text-muted); font-size:14px; line-height:1.6; }
.hse-module-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.hse-module-actions :is(.btn-primary,.btn-secondary) { padding:8px 15px; min-height:42px; border-radius:12px; font-size:14px; }
.hse-module-actions svg,.hse-generation-back svg,.hse-library-search svg { width:15px; height:15px; flex:none; }
.hse-module-actions .btn-primary svg { color:#d8e2c7; }
.hse-module-actions .btn-secondary { border-color:var(--border-color); }

.hse-library .module-summary { grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin:0; }
.hse-library .module-summary>.card { grid-column:span 1; min-height:152px; padding:16px 20px 18px; }
.hse-library .module-summary>:is(.module-chart,.module-skeleton:last-child) { grid-column:span 2; }
.hse-library :is(.module-kpi,.module-chart) { justify-content:space-between; }
.hse-library [data-metric="hse-reports"] { --tone:var(--hse-heading); --tone-bg:var(--hse-blue-soft); }
.hse-library [data-metric="hse-projects"] { --tone:var(--hse-olive); --tone-bg:var(--hse-olive-soft); }
.hse-library [data-chart="hse-periods"],.hse-library .module-line.tone-navy { --tone:var(--hse-heading); }
.hse-library .module-kpi-head { align-items:flex-start; }
.hse-library .module-kpi-head h2,.hse-period-heading h2 { margin:0; color:var(--text-muted); font-size:11px; font-weight:800; line-height:1.5; letter-spacing:.03em; text-transform:uppercase; }
.hse-library .module-kpi-main,.hse-period-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.hse-library .module-kpi-value { color:var(--tone); font-size:30px; }
.hse-library .module-kpi-badge,.hse-period-heading>span { display:inline-flex; align-items:center; padding:2px 8px; border-radius:6px; background:var(--hse-olive-soft); color:var(--hse-olive); font-size:11px; font-weight:650; }
.hse-library [data-metric="hse-projects"] .module-kpi-badge { background:var(--hse-blue-soft); color:var(--hse-heading); }
.hse-period-heading>span { border:1px solid var(--hse-olive-border); }
.hse-library .module-kpi-detail,.hse-library .module-chart-note { font-size:11px; }
.hse-library .module-line svg { height:45px; }
.hse-library .module-line-path,.hse-library .module-line circle { vector-effect:non-scaling-stroke; }
.hse-library .module-line circle:last-of-type { fill:var(--hse-olive); }
.hse-period-axis { display:flex; justify-content:space-between; margin:3px 2.8% 0; color:var(--text-muted); font-size:9px; }

.hse-module .hse-library-filters { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; margin:0; padding:14px 20px; }
.hse-library-search { display:flex; align-items:center; gap:9px; width:min(384px,100%); padding-inline:13px; color:var(--text-muted); }
.hse-library-search,.hse-library-filters select,.hse-generation-card .form-control { background:var(--hse-field); border:1px solid var(--border-color); border-radius:12px; }
.hse-library-search,.hse-library-filters select { min-height:35px; font-size:12px; }
.hse-library-filters select { width:min(190px,100%); padding-block:5px; }
.hse-library-search:focus-within { outline:2px solid var(--hse-heading); outline-offset:2px; }
.hse-library-search input { background:transparent; color:var(--text-main); border:0; width:100%; min-width:0; font:inherit; }
.hse-module .hse-library-search input:focus { outline:0; box-shadow:none; }
.hse-library-search input::placeholder,.hse-generation-card input::placeholder { color:var(--text-muted); opacity:1; }
.hse-listing { display:grid; gap:12px; }
.hse-module .hse-report-card { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:14px; margin:0; padding:20px; min-width:0; }
.hse-report-icon { display:grid; place-items:center; width:44px; height:44px; border-radius:12px; background:var(--hse-blue-soft); color:var(--hse-heading); }
.hse-report-icon svg { width:19px; height:19px; }
.hse-report-tags,.hse-report-dates { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.hse-report-card h2 { margin:4px 0 2px; color:var(--text-main); font-size:16px; font-weight:800; line-height:1.35; overflow-wrap:anywhere; }
.hse-report-code,.hse-report-revision { padding:2px 8px; border:1px solid var(--border-color); border-radius:6px; background:var(--hse-blue-soft); color:var(--hse-heading); font-size:11px; font-weight:650; overflow-wrap:anywhere; }
.hse-report-code { font-family:ui-monospace,Consolas,monospace; }
.hse-report-revision { background:var(--hse-olive-soft); color:var(--hse-olive); border-color:var(--hse-olive-border); }
.hse-report-dates { color:var(--text-muted); font-size:12px; }
.hse-report-dates strong { color:var(--text-secondary); font-weight:650; }
.hse-report-dates small { font-size:inherit; border-inline-start:1px solid var(--border-color); padding-inline-start:8px; }
.hse-report-card .hse-module-actions :is(.btn-primary,.btn-secondary) { min-height:34px; font-size:12px; padding:5px 12px; }
.hse-report-card .hse-module-actions svg { width:14px; height:14px; }

.hse-generation-back { display:inline-flex; align-items:center; gap:6px; color:var(--text-muted); font-size:12px; font-weight:650; }
.hse-generation-back:hover { color:var(--hse-heading); }
.hse-generation-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.hse-generation-grid label { display:grid; align-content:start; gap:5px; min-width:0; font-size:12px; font-weight:650; }
.hse-generation-card .form-control { width:100%; min-height:42px; font-size:14px; }
.hse-generation-fields { border-top:1px solid var(--border-light); margin-top:24px; padding-top:16px; }
.hse-generation-fields h2 { margin:0; color:var(--hse-heading); font-size:16px; font-weight:750; }
.hse-generation-fields p { color:var(--text-muted); font-size:12px; line-height:1.6; }
.hse-generation-fields>.hse-generation-grid { margin-top:14px; }
.hse-generation-note { display:flex; align-items:flex-start; gap:11px; padding:15px 16px; border:1px solid var(--border-color); border-radius:14px; background:var(--hse-blue-soft); }
.hse-generation-note>span { flex:none; display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:#092854; color:#d8e2c7; }
.hse-generation-note svg { width:15px; height:15px; }
.hse-generation-note p { margin:0; color:var(--text-secondary); }
.hse-generation-note strong { color:var(--hse-heading); }
.hse-generation-card footer { margin-top:24px; padding-top:16px; border-top:1px solid var(--border-light); }
.hse-generation-card footer .hse-module-actions { justify-content:flex-end; }

.dark .hse-module { --hse-heading:#dce5f2; --hse-olive:#c5d3a4; --hse-field:#111; --hse-blue-soft:#181818; --hse-olive-soft:#171b12; --hse-olive-border:#3c492d; }
.dark .hse-generation-note>span { background:#262626; }

@media(max-width:1050px) {
  .hse-library .module-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hse-module .hse-report-card { grid-template-columns:auto minmax(0,1fr); }
  .hse-report-card>.hse-module-actions { grid-column:2; }
}
@media(max-width:650px) {
  .hse-module.content-container { padding:18px 14px; gap:18px; }
  .hse-module .hse-module-header,.hse-module .hse-generation-card,.hse-module .hse-library-filters,.hse-module .hse-report-card { padding:16px; }
  .hse-library .module-summary,.hse-generation-grid { grid-template-columns:1fr; }
  .hse-library .module-summary>.card { grid-column:auto; min-height:125px; }
  .hse-report-card>.hse-module-actions { grid-column:1/-1; }
  .hse-report-dates small { padding-inline-start:0; border:0; }
  .hse-library-filters select,.hse-library-search { width:100%; }
}
