/* ChinaElderly · Percentile Explorer · compact responsive layout */

:root{--blue:#2563eb;--blue2:#1d4ed8;--ink:#1f2937;--muted:#64748b;--line:#e5e7eb;--bg:#f5f7fb;--card:#fff;--male:#2563eb;--female:#e11d48}
*{box-sizing:border-box}
html{overflow-x:hidden}
body{margin:0;background:var(--bg);color:var(--ink);font-family:Arial,"Microsoft YaHei","Noto Sans CJK SC",sans-serif;font-size:15px;line-height:1.45;overflow-x:hidden}
button,select{font:inherit}

.top{background:#fff;border-bottom:1px solid var(--line);padding:12px 24px;position:sticky;top:0;z-index:20}
.brand{max-width:1320px;margin:auto;display:flex;align-items:center;gap:12px;min-width:0}
.logo{width:38px;height:38px;flex:0 0 38px;border-radius:10px;background:var(--blue);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:18px;overflow:hidden}
.logo-img{max-width:24px;max-height:30px;object-fit:contain}
.title{font-size:19px;font-weight:750;line-height:1.2}.sub{font-size:13px;color:var(--muted);margin-top:2px}
.nav{margin-left:auto;display:flex;gap:20px;font-size:14px;color:var(--muted);white-space:nowrap}
.nav a{color:inherit;text-decoration:none}.nav .active{color:var(--blue);font-weight:700}

.container{max-width:1320px;margin:auto;padding:18px 24px 28px}
.hero{background:linear-gradient(135deg,#0f4c81,#2563eb);border-radius:16px;padding:19px 24px;color:#fff}
.hero h1{margin:0;font-size:27px;line-height:1.25}.hero p{margin:6px 0 0;color:#dbeafe;font-size:15px}

.layout{display:grid;grid-template-columns:245px minmax(0,1fr);gap:15px;margin-top:15px;align-items:start}
.panel,.card{background:var(--card);border:1px solid var(--line);border-radius:13px}
.panel{height:max-content;position:sticky;top:72px;overflow:hidden}
.filter-title{padding:14px 16px;font-weight:750;font-size:17px;border-bottom:1px solid #eef2f7}
.group{padding:12px 15px;border-bottom:1px solid #f1f5f9}.group:last-of-type{border-bottom:0}
label{display:block;font-size:14px;font-weight:700;color:#475569;margin-bottom:6px}
select{width:100%;padding:8px 9px;min-height:38px;border:1px solid #d1d5db;border-radius:9px;background:#fff;font-size:15px;color:var(--ink)}
.agegrid{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.age{min-height:39px;padding:7px 5px;text-align:center;border:1px solid #d1d5db;border-radius:8px;font-size:14px;background:#fff;cursor:pointer}
.age.active{background:#dbeafe;border-color:var(--blue);color:var(--blue2);font-weight:700}
.help{font-size:12.5px;color:#94a3b8;margin-top:7px;line-height:1.55}
.apply{margin:12px 15px;width:calc(100% - 30px);min-height:38px;border:0;background:var(--blue);color:#fff;border-radius:9px;padding:9px;font-weight:700;font-size:14px;cursor:pointer}

.main{display:flex;flex-direction:column;gap:13px;min-width:0}
.breadcrumb{font-size:13px;color:var(--muted);padding:0 2px}
.card{padding:15px 16px}
.metric-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.metric-name{font-size:23px;font-weight:800;line-height:1.2}.metric-en{font-size:13px;color:var(--muted);margin-top:3px}
.badges{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}
.badge{font-size:12px;background:#eff6ff;color:#1d4ed8;border-radius:13px;padding:5px 8px;font-weight:700;white-space:nowrap}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:12px}
.stat{background:#f8fafc;border-radius:9px;padding:9px 10px;min-width:0}.stat .v{font-size:21px;font-weight:800;line-height:1.15}.stat .k{font-size:12px;color:var(--muted);margin-top:3px}

.section-title{font-size:19px;font-weight:800;margin-bottom:9px;line-height:1.25}
.note{font-size:13px;color:var(--muted);line-height:1.6;background:#f8fafc;border-radius:8px;padding:8px 10px;margin-bottom:9px}

.chartbox{border:1px solid #eef2f7;border-radius:10px;padding:5px 7px 4px;background:#fff;overflow:hidden}
.wide-chartbox{width:100%;max-width:1040px;margin:0 auto}
.chartsvg{width:100%;height:300px;display:block}
#ageMeanSdChart{height:315px}
.legend{display:flex;justify-content:center;gap:20px;flex-wrap:wrap;font-size:13px;color:#64748b;padding:3px 0 1px}
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px}.male-dot{background:var(--male)}.female-dot{background:var(--female)}

.table-wrap{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;margin-top:10px;border-radius:8px}
.table{width:100%;border-collapse:collapse;font-size:14px;min-width:620px}
.table th{background:#f8fafc;color:#475569;font-weight:700}.table th,.table td{padding:8px;text-align:center;border-bottom:1px solid #eef2f7;white-space:nowrap}
.percentile-table .p50{background:#dbeafe;color:#1d4ed8;font-weight:800}.percentile-table tbody th{background:#fff;color:#1f2937}.mean-sd-table{min-width:660px}

.meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.meta div{background:#f8fafc;border-radius:8px;padding:8px 9px;min-width:0}.meta span{display:block;color:var(--muted);font-size:12px}.meta b{display:block;margin-top:3px;font-size:13px;overflow-wrap:anywhere}
.download{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}.btn{padding:8px 11px;min-height:36px;border-radius:8px;border:1px solid #d1d5db;background:#fff;font-size:13px;cursor:pointer}.btn.primary{background:var(--blue);color:#fff;border-color:var(--blue)}
.foot{color:#94a3b8;font-size:12px;line-height:1.7;margin-top:10px}.low-n{color:#b45309;font-weight:700}

@media(max-width:1200px){
 .container{padding-left:18px;padding-right:18px}.layout{grid-template-columns:225px minmax(0,1fr)}
 .chartsvg{height:280px}#ageMeanSdChart{height:295px}
}
@media(max-width:900px){
 .top{padding:10px 16px;position:static}.nav{display:none}
 .container{padding:14px 14px 22px}.hero{padding:16px 18px;border-radius:13px}.hero h1{font-size:23px}.hero p{font-size:14px}
 .layout{grid-template-columns:1fr;gap:11px;margin-top:11px}.panel{position:static}
 .filter-title{padding:12px 14px}.group{padding:10px 14px}.apply{margin:10px 14px;width:calc(100% - 28px)}
 .card{padding:13px 14px}.metric-head{flex-direction:column;gap:8px}.badges{justify-content:flex-start}
 .grid3{gap:7px;margin-top:10px}.chartsvg{height:260px}#ageMeanSdChart{height:275px}
 .wide-chartbox{max-width:none}.meta{grid-template-columns:1fr 1fr}
}
@media(max-width:680px){
 body{font-size:14px}.logo{width:34px;height:34px;flex-basis:34px}.title{font-size:17px}.sub{font-size:11px}
 .container{padding:10px 10px 18px}.hero{padding:14px 15px}.hero h1{font-size:21px}.hero p{font-size:13px}
 .main{gap:9px}.breadcrumb{font-size:12px}.card{padding:11px;border-radius:11px}.metric-name{font-size:21px}
 .section-title{font-size:17px;margin-bottom:7px}.note{font-size:12px;line-height:1.55;padding:7px 8px;margin-bottom:7px}
 .grid3{gap:5px}.stat{padding:8px 7px}.stat .v{font-size:18px}.stat .k{font-size:11px}
 .badge{font-size:11px;padding:4px 7px}.chartbox{padding:3px}.chartsvg{height:230px}#ageMeanSdChart{height:245px}
 .legend{font-size:12px;gap:13px}.table-wrap{margin-top:7px}.table{font-size:13px;min-width:590px}.table th,.table td{padding:7px 6px}
 .meta{gap:6px}.meta div{padding:7px 8px}.meta span{font-size:11px}.meta b{font-size:12px}
}
@media(max-width:480px){
 .container{padding-left:8px;padding-right:8px}.top{padding:8px 10px}.brand{gap:8px}.title{font-size:16px}
 .hero h1{font-size:19px}.hero p{font-size:12px}.stat .v{font-size:17px}.stat .k{font-size:10.5px}
 .chartsvg{height:205px}#ageMeanSdChart{height:220px}.age{min-height:38px;font-size:13px}.help{font-size:11.5px}
 .download{flex-direction:column}.btn{width:100%}
}
@media print{
 .top,.panel,.download{display:none!important}.container{padding:0;max-width:none}.hero{border-radius:0}.layout{display:block}
 .card{break-inside:avoid;margin-bottom:10px}.chartsvg{height:auto}
}
