/* ===== 旅居政策工具箱 - 共享样式 ===== */
body{line-height:1.6}
.container{background:#fff;min-height:100vh;display:flex;flex-direction:column}

.page-header{background:var(--brand-gradient);color:#fff;padding:18px 28px;display:flex;justify-content:space-between;align-items:center;gap:20px;flex-wrap:wrap;}
.page-header .ph-left{flex-shrink:0;}
.page-header .ph-title{font-size:20px;font-weight:700;margin-bottom:3px;}
.page-header .ph-sub{opacity:0.82;font-size:12px;}
.page-header .ph-stats{display:flex;gap:22px;}
.page-header .ph-stat{text-align:center;}
.page-header .ph-stat .num{font-size:1.3em;font-weight:800;display:block;}
.page-header .ph-stat .lbl{font-size:0.72em;opacity:0.8;}

/* Tab导航 */
.tab-nav{display:flex;border-bottom:2px solid #e5e7eb;background:#f8f9fa;padding:0 25px;}
.tab-btn{padding:11px 20px;border:none;background:none;cursor:pointer;font-size:0.86em;color:#666;white-space:nowrap;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all 0.2s}
.tab-btn:hover{color:#059669;background:#f0fdf4}
.tab-btn.active{color:#059669;border-bottom-color:#059669;font-weight:600}

/* 主体 */
.main{flex:1;display:flex;overflow:hidden}
.left-panel{width:310px;min-width:260px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;flex-shrink:0}
.panel-header{padding:11px 16px;font-weight:600;font-size:0.86em;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}
.panel-body{flex:1;overflow-y:auto;padding:6px 0}
.search-box{padding:8px 12px;border-bottom:1px solid #e5e7eb;flex-shrink:0}
.search-input{width:100%;padding:7px 11px;border:1px solid #d1d5db;border-radius:7px;font-size:0.84em;outline:none;transition:border-color 0.2s}
.search-input:focus{border-color:#059669}

/* 分类树 */
.cat-group{margin-bottom:2px}
.cat-group-header{cursor:pointer;padding:7px 14px;font-size:0.82em;font-weight:600;color:#444;display:flex;justify-content:space-between;align-items:center;transition:background 0.15s}
.cat-group-header:hover{background:#f0fdf4}
.cat-group-header .arrow{font-size:0.7em;transition:transform 0.2s}
.cat-group-header .arrow.open{transform:rotate(90deg)}
.cat-group.open .cat-children{display:block}
.cat-children{display:none}
.cat-item{cursor:pointer;padding:6px 14px 6px 24px;font-size:0.81em;display:flex;justify-content:space-between;align-items:center;border-left:3px solid transparent;transition:all 0.15s;color:#555}
.cat-item:hover{background:#f0fdf4;border-left-color:#a7f3d0}
.cat-item.active{background:#bbf7d0;border-left-color:#059669;color:#059669;font-weight:600}
.cat-item .cat-label{display:flex;align-items:center;gap:7px}
.cat-item .cat-dot{width:9px;height:9px;border-radius:2px;flex-shrink:0}
.cat-item .count{background:#f3f4f6;color:#888;font-size:0.72em;padding:1px 6px;border-radius:8px}

/* 右侧面板 */
.right-panel{flex:1;display:flex;flex-direction:column;overflow:hidden}
.toolbar{padding:9px 14px;display:flex;gap:9px;align-items:center;border-bottom:1px solid #e5e7eb;flex-shrink:0;flex-wrap:wrap}
.filter-select{padding:5px 9px;border:1px solid #d1d5db;border-radius:6px;font-size:0.8em;background:#fff;outline:none}
.btn{padding:5px 12px;border:none;border-radius:6px;font-size:0.8em;cursor:pointer;transition:all 0.2s}
.btn-primary{background:#059669;color:#fff}.btn-primary:hover{background:#065f46}
.btn-ghost{background:none;border:1px solid #d1d5db;color:#555}.btn-ghost:hover{background:#f9fafb}
.result-count{font-size:0.78em;color:#888;margin-left:auto;white-space:nowrap}

/* 实例卡片 */
.instance-list{flex:1;overflow-y:auto;padding:10px 14px}
.instance-card{background:#fff;border:1px solid #e5e7eb;border-radius:9px;padding:12px 14px;margin-bottom:8px;cursor:pointer;transition:all 0.15s;border-left:4px solid #e5e7eb}
.instance-card:hover{box-shadow:0 2px 8px rgba(0,0,0,0.08);border-left-color:#10b981}
.instance-card.expanded{background:#f0fdf4;border-color:#bbf7d0}
.ic-header{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:6px}
.ic-title{font-weight:600;font-size:0.86em;color:#111;flex:1;line-height:1.5}
.ic-badges{display:flex;gap:4px;flex-shrink:0;flex-wrap:wrap}
.badge{font-size:0.7em;padding:2px 7px;border-radius:9px;font-weight:500}
.bg-tool{background:#f0fdf4;color:#059669}.bg-city{background:#dbeafe;color:#1e40af}.bg-level{background:#fef3c7;color:#92400e}.bg-power{background:#fce7f3;color:#9d174d}
.ic-meta{display:flex;gap:12px;font-size:0.75em;color:#888;flex-wrap:wrap;margin-bottom:5px}
.ic-content{font-size:0.81em;color:#555;line-height:1.65}
.ic-detail{margin-top:9px;padding-top:9px;border-top:1px solid #e5e7eb;display:none}
.instance-card.expanded .ic-detail{display:block}
.detail-row{display:flex;margin-bottom:5px;font-size:0.8em}
.detail-label{width:85px;color:#888;flex-shrink:0;font-weight:500}
.detail-value{flex:1;color:#333}
.detail-tags{margin-top:6px}
.detail-tags .tag{display:inline-block;background:#f3f4f6;color:#555;padding:2px 7px;border-radius:4px;font-size:0.75em;margin:2px 3px 2px 0}

/* 分析面板 */
.analysis-panel{padding:18px;overflow-y:auto;flex:1}
.analysis-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:18px}
.analysis-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:14px}
.analysis-card h3{font-size:0.9em;color:#059669;margin-bottom:10px;font-weight:600}
.bar-row{display:flex;align-items:center;margin-bottom:8px}
.bar-row.mini-bar{margin-bottom:3px}
.prov-select{border-left:3px solid transparent;padding-left:4px;transition:all 0.15s}
.prov-select.selected{border-left-color:#059669;background:#f0fdf4}
.mini-bar .bar-label{width:70px;font-size:0.72em}
.mini-bar .bar-track{height:10px;margin:0 6px}
.mini-bar .bar-pct{width:36px;font-size:0.7em}
.bar-label{width:100px;font-size:0.78em;color:#555;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bar-track{flex:1;height:20px;background:#e5e7eb;border-radius:4px;overflow:hidden;margin:0 8px}
.bar-fill{height:100%;border-radius:4px;transition:width 0.4s;min-width:2px}
.bar-pct{width:42px;text-align:right;font-size:0.76em;color:#333;font-weight:600;flex-shrink:0}

.rank-table{width:100%;font-size:0.8em;border-collapse:collapse}
.rank-table th{background:#f0fdf4;color:#059669;padding:7px 10px;text-align:left;font-weight:600;border-bottom:2px solid #a7f3d0}
.rank-table td{padding:6px 10px;border-bottom:1px solid #f0f0f0}
.rank-table tr:hover td{background:#f9fafb}
.rank-1{background:linear-gradient(135deg,#FFD700,#FFA500);color:#333;font-weight:700}
.rank-2{background:linear-gradient(135deg,#C0C0C0,#A9A9A9);color:#333;font-weight:700}
.rank-3{background:linear-gradient(135deg,#CD7F32,#B87333);color:#fff;font-weight:700}

.filter-info{padding:8px 14px;font-size:0.78em;color:#059669;background:#f0fdf4;border-bottom:1px solid #a7f3d0;line-height:1.5}

/* 工具标签栏 */
.tool-tag-bar{padding:10px 14px;border-bottom:1px solid #e5e7eb;display:flex;flex-wrap:wrap;gap:8px;flex-shrink:0;max-height:120px;overflow-y:auto;background:#fafafa}
.tool-tag{display:inline-flex;align-items:center;gap:4px;padding:5px 12px;border-radius:16px;font-size:0.8em;cursor:pointer;transition:all 0.2s;border:1px solid #d1d5db;background:#fff;color:#555;white-space:nowrap}
.tool-tag:hover{background:#f0fdf4;border-color:#059669;color:#059669}
.tool-tag.active{background:#059669;color:#fff;border-color:#059669}
.tool-tag .tag-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
.tool-tag .tag-count{font-size:0.75em;opacity:0.8}

/* 滚动条 */
::-webkit-scrollbar{width:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#86efac;border-radius:3px}

/* ===== 城市旅居政策 ===== */
.city-policy-container { padding: 20px 28px; overflow-y: auto; flex: 1; }
.city-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 1024px) {
    .city-entry-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .city-entry-grid { grid-template-columns: 1fr; }
    .city-policy-container { padding: 16px; }
}
.city-entry-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.city-entry-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #059669;
}
.city-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.city-entry-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a365d;
}
.city-entry-stats {
    text-align: right;
}
.city-entry-count {
    font-size: 24px;
    font-weight: 800;
    color: #059669;
    line-height: 1;
}
.city-entry-label {
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
}
.city-entry-radar {
    width: 100%;
    height: 220px;
    margin: 8px 0;
}
.city-entry-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #f0f4f8;
}
.city-entry-completeness {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
}
.city-entry-completeness span {
    color: #059669;
    font-weight: 700;
}
.city-entry-btn {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 城市全景视图 */
.city-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}
.city-detail-back {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.2s;
}
.city-detail-back:hover {
    background: #f0fdf4;
    border-color: #059669;
    color: #059669;
}
.city-detail-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
}
.city-detail-meta {
    display: flex;
    gap: 16px;
    margin-left: auto;
}
.city-detail-meta-item {
    text-align: center;
}
.city-detail-meta-value {
    font-size: 20px;
    font-weight: 800;
    color: #059669;
}
.city-detail-meta-label {
    font-size: 11px;
    color: #718096;
}
.cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 1024px) {
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .cat-grid { grid-template-columns: 1fr; }
}
.cat-section {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.cat-section-header {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f0f4f8;
}
.cat-section-body {
    padding: 12px 14px;
}
.cat-section-empty {
    text-align: center;
    padding: 24px 14px;
    color: #a0aec0;
    font-size: 13px;
}
.policy-mini-card {
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid #cbd5e0;
    transition: all 0.15s;
}
.policy-mini-card:hover {
    background: #f0fdf4;
    border-left-color: #059669;
}
.policy-mini-card:last-child { margin-bottom: 0; }
.policy-mini-name {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.4;
    margin-bottom: 6px;
}
.policy-mini-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #718096;
    flex-wrap: wrap;
}
.policy-mini-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.policy-mini-link {
    font-size: 11px;
    color: #3b82f6;
    text-decoration: none;
    margin-top: 6px;
    display: inline-block;
}
.policy-mini-link:hover { text-decoration: underline; }

/* 分类颜色 */
.cat-a .cat-section-header { background: #ecfdf5; color: #065f46; }
.cat-b .cat-section-header { background: #fffbeb; color: #92400e; }
.cat-c .cat-section-header { background: #f5f3ff; color: #5b21b6; }
.cat-d .cat-section-header { background: #fdf2f8; color: #9d174d; }
.cat-e .cat-section-header { background: #eef2ff; color: #3730a3; }
.cat-h .cat-section-header { background: #f0fdfa; color: #115e59; }
.cat-i .cat-section-header { background: #fff7ed; color: #9a3412; }
.cat-j .cat-section-header { background: #ecfeff; color: #155e75; }
.cat-k .cat-section-header { background: #faf5ff; color: #7e22ce; }
.cat-f .cat-section-header { background: #ecfdf5; color: #065f46; }
.cat-m .cat-section-header { background: #faf5ff; color: #7e22ce; }

.cat-a .policy-mini-card { border-left-color: #10b981; }
.cat-b .policy-mini-card { border-left-color: #f59e0b; }
.cat-c .policy-mini-card { border-left-color: #8b5cf6; }
.cat-d .policy-mini-card { border-left-color: #ec4899; }
.cat-e .policy-mini-card { border-left-color: #6366f1; }
.cat-h .policy-mini-card { border-left-color: #14b8a6; }
.cat-i .policy-mini-card { border-left-color: #f97316; }
.cat-j .policy-mini-card { border-left-color: #06b6d4; }
.cat-k .policy-mini-card { border-left-color: #a855f7; }
.cat-f .policy-mini-card { border-left-color: #10b981; }
.cat-m .policy-mini-card { border-left-color: #a855f7; }

/* ===== 统一底部CTA ===== */
.unified-footer{background:#f8f9fa;border-top:1px solid #e5e7eb;padding:20px 28px;text-align:center;flex-shrink:0;}
.unified-footer .qr-row{display:flex;justify-content:center;gap:32px;flex-wrap:wrap;margin-bottom:12px;}
.unified-footer .qr-item{display:flex;flex-direction:column;align-items:center;gap:6px;}
.unified-footer .qr-box{width:88px;height:88px;background:#f0fdf4;border-radius:8px;border:1px solid #d4d0f0;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.unified-footer .qr-box span{font-size:10px;color:#888;text-align:center;line-height:1.3;}
.unified-footer .qr-label{font-size:11px;color:#888;text-align:center;}
.unified-footer .qr-label strong{color:#059669;font-size:12px;}
.unified-footer .info{font-size:12px;color:#999;line-height:1.7;}
.unified-footer .info strong{color:#333;font-size:13px;}
.unified-footer .copyright{margin-top:10px;font-size:11px;color:#999;}

@media(max-width:950px){
  .main{flex-direction:column}
  .left-panel{width:100%;max-height:45vh}
  .analysis-grid{grid-template-columns:1fr}
  .unified-header{flex-direction:column;align-items:flex-start;padding:12px 16px;}
  .unified-footer .qr-row{gap:16px;}
}

/* 返回顶部按钮 */
#backToTop{position:fixed;bottom:30px;right:30px;z-index:999;width:44px;height:44px;border-radius:50%;border:none;background:#059669;color:#fff;font-size:20px;font-weight:700;cursor:pointer;box-shadow:0 2px 12px rgba(0,0,0,0.2);display:flex;align-items:center;justify-content:center;}
@media(max-width:768px){#backToTop{bottom:20px;right:20px;width:40px;height:40px;font-size:18px;}}

.top-notice{background:#1e40af;color:#fff;text-align:center;padding:8px 16px;font-size:13px;line-height:1.6;}
.top-notice a{color:#93c5fd;}
.top-notice a:hover{color:#fff;}
