:root {
  --navy: #202126;
  --navy-2: #303137;
  --blue: #bf2026;
  --orange: #bf2026;
  --green: #1a8f5d;
  --amber: #c58b16;
  --red: #bf2026;
  --red-dark: #9e1c21;
  --ink: #202228;
  --muted: #656872;
  --line: #e1e2e4;
  --soft: #f7f4ef;
  --white: #ffffff;
  --cream: #f7f0e5;
  --shadow: 0 8px 22px rgba(32, 34, 40, 0.07);
  --radius: 11px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #f3f4f5; color: var(--ink); font: 14px/1.42 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.site-header { background: var(--navy); color: var(--white); padding: 18px max(24px, calc((100vw - 1440px) / 2)) 14px; box-shadow: 0 5px 18px rgba(32, 34, 40, 0.2); }
.header-inner { display: grid; grid-template-columns: 150px 1fr auto; gap: 22px; align-items: center; }
.brand { width: 132px; height: 96px; padding: 6px; background: var(--cream); border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07); overflow: hidden; }
.brand img { display: block; width: 100%; height: 100%; object-fit: contain; }
.eyebrow, .section-kicker, .panel-kicker { margin: 0 0 3px; color: var(--red); font-size: .66rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.header-copy h1 { margin: 0; font-size: clamp(1.55rem, 2.5vw, 2.25rem); letter-spacing: -.035em; line-height: 1.08; }
.header-meta { margin: 6px 0 0; color: #c9cbd0; font-size: .8rem; }
.private-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: #e0e1e4; font-size: .75rem; }
.private-pill span { width: 8px; height: 8px; border-radius: 50%; background: #52d39a; box-shadow: 0 0 0 4px rgba(82,211,154,.12); }
.tabs { display: flex; gap: 6px; margin-top: 15px; overflow-x: auto; }
.tab { border: 0; background: transparent; color: #c1c2c7; padding: 8px 12px; border-radius: 7px; font-size: .82rem; font-weight: 750; white-space: nowrap; }
.tab:hover, .tab:focus-visible { color: var(--white); background: rgba(255,255,255,.08); }
.tab.is-active { background: var(--white); color: var(--navy); }

main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 18px 0 40px; }
.filter-panel { position: relative; margin: 0 0 24px; padding: 15px 17px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-heading, .section-heading, .panel-heading, .dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.filter-heading h2, .section-heading h2, .dialog-header h2 { margin: 0; letter-spacing: -.025em; }
.result-count { display: inline-flex; padding: 5px 9px; background: #f2e7e8; border-radius: 999px; color: var(--red-dark); font-size: .76rem; font-weight: 850; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(220px, 1.5fr) auto; gap: 10px; align-items: end; margin-top: 12px; }
.filters label { display: grid; gap: 5px; color: #555963; font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
select, input[type="search"] { width: 100%; height: 38px; border: 1px solid #d4d6da; border-radius: 7px; background: var(--white); color: var(--ink); padding: 0 32px 0 10px; font-size: .8rem; outline: none; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #647785 50%), linear-gradient(135deg, #647785 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
select:focus, input[type="search"]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(191,32,38,.11); }
.secondary-button { min-height: 38px; border: 1px solid #c8c9cd; background: var(--white); color: var(--navy-2); border-radius: 7px; padding: 0 12px; font-size: .8rem; font-weight: 800; }
.secondary-button:hover, .secondary-button:focus-visible { border-color: var(--navy-2); background: #f8fafb; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.section-heading { margin: 0 0 15px; align-items: end; }
.section-heading h2 { font-size: clamp(1.3rem, 2vw, 1.75rem); }
.section-note { max-width: 580px; margin: 0; color: var(--muted); font-size: .8rem; text-align: right; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi-card { min-height: 122px; padding: 15px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(32,34,40,.05); }
.kpi-feature { grid-column: span 2; min-height: 140px; }
.kpi-support { grid-column: span 3; min-height: 96px; }
.kpi-card p { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card strong { display: block; margin: 8px 0 5px; color: var(--navy); font-size: clamp(1.75rem, 2.7vw, 2.35rem); line-height: 1; letter-spacing: -.05em; }
.kpi-card span { color: var(--muted); font-size: .72rem; }
.kpi-card small { display: block; margin-top: 6px; color: #777a82; font-size: .68rem; }
.kpi-primary { background: var(--navy); border-color: var(--navy); }
.kpi-primary p, .kpi-primary span { color: #c5d3dd; }
.kpi-primary strong { color: var(--white); }
.kpi-primary small { color: #c9cbd0; }
.kpi-risk { border-top: 4px solid var(--red-dark); }
.kpi-replacement { border-top: 4px solid #c15c29; }
.status-label { display: inline-flex; padding: 3px 7px; border-radius: 999px; font-size: .72rem; font-weight: 800; }

.insight-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 15px; }
.insight { padding: 11px 13px; border: 1px solid #e1e2e4; border-left: 3px solid var(--red); background: rgba(255,255,255,.78); border-radius: 8px; color: #555963; font-size: .76rem; }
.insight strong { display: block; color: var(--navy); margin-bottom: 2px; font-size: .82rem; }
.conclusions-panel { margin: 13px 0; }
.conclusions-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px 14px; }
.conclusion-item { padding: 9px 11px; border-left: 3px solid var(--red); background: #fafafa; border-radius: 0 7px 7px 0; }
.conclusion-item strong { color: var(--navy); font-size: .78rem; }
.conclusion-item p { margin: 3px 0 0; color: #5a5d66; font-size: .73rem; line-height: 1.45; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 13px; margin-bottom: 13px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 6px 18px rgba(32,34,40,.045); }
.panel-wide { grid-row: span 2; }
.panel-heading { align-items: center; margin-bottom: 14px; }
.panel-heading h3 { margin: 0; color: var(--navy); font-size: .98rem; letter-spacing: -.015em; }
.panel-heading > span { color: var(--muted); font-size: .7rem; }

.area-bars { display: grid; gap: 9px; }
.area-row { display: grid; grid-template-columns: 130px 1fr 58px; align-items: center; gap: 12px; border: 0; background: transparent; padding: 3px 0; text-align: left; width: 100%; color: var(--ink); }
.area-row:hover .bar-track { outline: 3px solid rgba(40,104,143,.1); }
.area-name { font-size: .78rem; font-weight: 800; }
.bar-track { height: 13px; background: #ececed; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; min-width: 3px; border-radius: inherit; }
.area-value { text-align: right; font-size: .78rem; font-weight: 850; color: var(--navy); }
.donut-layout { display: grid; grid-template-columns: 155px 1fr; gap: 22px; align-items: center; }
.donut { width: 155px; height: 155px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.donut::after { content: ""; position: absolute; inset: 23px; background: var(--white); border-radius: 50%; }
.donut > div { position: relative; z-index: 1; text-align: center; }
.donut strong { display: block; color: var(--navy); font-size: 1.7rem; line-height: 1; }
.donut span { color: var(--muted); font-size: .76rem; }
.legend { display: grid; gap: 9px; }
.legend-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: .82rem; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-item strong { color: var(--navy); }

.risk-matrix { display: grid; grid-template-columns: 76px repeat(5, 1fr); gap: 5px; align-items: stretch; }
.matrix-label { display: grid; place-items: center; min-height: 34px; color: var(--muted); font-size: .7rem; font-weight: 750; text-align: center; }
.matrix-cell { border: 0; border-radius: 7px; min-height: 43px; color: var(--navy); font-weight: 850; background: #eef2f4; }
.matrix-cell:hover, .matrix-cell:focus-visible { outline: 3px solid rgba(11,31,51,.12); }
.risk-low { background: #dff3e9; color: #15643f; }
.risk-medium { background: #f7edca; color: #7b5b12; }
.risk-high { background: #f7d5c9; color: #9d3f23; }
.risk-critical { background: #edc8cb; color: #842b35; }

.table-panel { margin-top: 13px; padding-bottom: 7px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 960px; }
th { padding: 8px 10px; border-bottom: 2px solid var(--navy); color: #5d6068; font-size: .65rem; letter-spacing: .05em; text-transform: uppercase; text-align: left; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #e8e8ea; vertical-align: middle; font-size: .76rem; }
tbody tr:hover { background: #f8fafb; }
.equipment-name { max-width: 340px; color: var(--navy); font-weight: 780; }
.muted-cell { color: var(--muted); }
.priority-badge, .wear-badge, .status-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; padding: 3px 7px; border-radius: 999px; font-size: .68rem; font-weight: 850; }
.priority-P1 { background: #edd0d3; color: var(--red-dark); }
.priority-P2 { background: #f7d9cc; color: #a04423; }
.priority-P3 { background: #f5ebc9; color: #7a5a13; }
.priority-P4 { background: #dff1e7; color: #176441; }
.wear-1, .status-optimo { background: #dff1e7; color: #176441; }
.wear-2, .status-atencion { background: #f5ebc9; color: #7a5a13; }
.wear-3, .status-deficiente { background: #f7dccd; color: #994527; }
.wear-4, .wear-5, .status-critico { background: #edd0d3; color: var(--red-dark); }
.text-button, .detail-button { border: 0; color: var(--red); background: transparent; padding: 5px 2px; font-size: .76rem; font-weight: 800; }
.text-button:hover, .detail-button:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

.area-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.area-card { padding: 16px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(32,34,40,.045); }
.area-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.area-card h3 { margin: 0; color: var(--navy); }
.area-card strong { display: block; margin: 16px 0 7px; color: var(--navy); font-size: 2rem; letter-spacing: -.05em; line-height: 1; }
.area-meter { height: 7px; overflow: hidden; background: #e6ecef; border-radius: 999px; }
.area-meter span { display: block; height: 100%; border-radius: inherit; }
.area-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.area-card-stats span { color: var(--muted); font-size: .72rem; }
.area-card-stats b { display: block; color: var(--ink); font-size: 1rem; }

.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.method-card > span { color: var(--orange); font-weight: 900; font-size: .82rem; }
.method-card.kpi-method { border-top: 3px solid var(--red); }
.method-card h3 { margin: 10px 0 6px; color: var(--navy); font-size: .92rem; }
.method-card p { margin: 5px 0 0; color: var(--muted); font-size: .77rem; }
code { color: var(--navy); font: 750 .86rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.method-bottom { margin-top: 16px; }
.quality-list { display: grid; gap: 13px; }
.quality-item { display: grid; grid-template-columns: 170px 1fr 72px; align-items: center; gap: 12px; }
.quality-item span { color: var(--muted); font-size: .84rem; }
.quality-track { height: 9px; background: #e7edef; border-radius: 999px; overflow: hidden; }
.quality-track b { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.quality-item strong { text-align: right; color: var(--navy); }
.method-notes { margin: 0; padding-left: 20px; color: #4f606d; }
.method-notes li + li { margin-top: 11px; }

dialog { width: min(1040px, calc(100% - 30px)); max-height: calc(100vh - 40px); border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: 0 24px 80px rgba(11,31,51,.32); }
dialog::backdrop { background: rgba(8,21,34,.68); backdrop-filter: blur(4px); }
.dialog-header { position: sticky; top: 0; z-index: 2; padding: 22px 24px; background: var(--navy); color: var(--white); }
.dialog-header h2 { font-size: 1.45rem; }
.close-button { border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: transparent; color: var(--white); padding: 8px 12px; font-weight: 800; }
#dialog-content { padding: 22px 24px 30px; }
.detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.detail-stat { padding: 13px; background: var(--soft); border-radius: 10px; }
.detail-stat span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.detail-stat strong { display: block; margin-top: 4px; color: var(--navy); font-size: 1rem; }
.component-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.component-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.component-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--navy-2); color: var(--white); }
.component-head h3 { margin: 0; }
.component-body { padding: 16px; }
.spec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 16px; }
.spec { padding-bottom: 7px; border-bottom: 1px solid #e8edef; }
.spec span { display: block; color: var(--muted); font-size: .72rem; }
.spec strong { display: block; margin-top: 2px; color: var(--ink); font-size: .87rem; }
.observation-block { margin-top: 14px; padding: 14px 15px; background: #f4f7f8; border-left: 4px solid var(--orange); border-radius: 8px; white-space: pre-line; }
.observation-block h4 { margin: 0 0 6px; color: var(--navy); }
.observation-block p { margin: 0; color: #465865; }
.photo-empty { margin-top: 14px; padding: 13px 15px; border: 1px dashed #bccbd4; border-radius: 9px; color: var(--muted); text-align: center; font-size: .84rem; }
.band-photo { margin: 14px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #f7f7f8; overflow: hidden; }
.band-photo a { display: block; background: #202126; }
.band-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.band-photo figcaption { padding: 8px 10px; color: var(--muted); font-size: .68rem; line-height: 1.4; }

footer { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 16px 0 24px; display: flex; justify-content: space-between; gap: 20px; color: #767982; border-top: 1px solid #d8d9dc; font-size: .7rem; }
.empty-state { padding: 36px 16px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
  .search-label { grid-column: span 2; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-feature, .kpi-support { grid-column: span 1; }
  .insight-strip, .method-grid, .conclusions-list { grid-template-columns: repeat(2, 1fr); }
  .area-card-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .site-header { padding: 22px 18px 18px; }
  .header-inner { grid-template-columns: 1fr; gap: 16px; }
  .brand { width: 124px; height: 90px; }
  .private-pill { justify-self: start; }
  main, footer { width: min(100% - 24px, 1440px); }
  .filter-heading, .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-note { text-align: left; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-label { grid-column: span 2; }
  .kpi-grid, .dashboard-grid, .insight-strip, .method-grid, .area-card-grid, .conclusions-list { grid-template-columns: 1fr; }
  .kpi-feature, .kpi-support { grid-column: span 1; }
  .kpi-card { min-height: 130px; }
  .panel-wide { grid-row: auto; }
  .donut-layout { grid-template-columns: 135px 1fr; }
  .donut { width: 135px; height: 135px; }
  .component-grid { grid-template-columns: 1fr; }
  .quality-item { grid-template-columns: 130px 1fr 60px; }
  footer { flex-direction: column; }
}

@media (max-width: 480px) {
  .filters { grid-template-columns: 1fr; }
  .search-label { grid-column: auto; }
  .donut-layout { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .risk-matrix { grid-template-columns: 64px repeat(5, 1fr); }
  .area-row { grid-template-columns: 92px 1fr 50px; gap: 8px; }
  .detail-summary { grid-template-columns: 1fr 1fr; }
  .spec-grid { grid-template-columns: 1fr; }
  .quality-item { grid-template-columns: 1fr 58px; }
  .quality-track { grid-row: 2; grid-column: 1 / 3; }
}
