/* =========================================================================
 *  广安市医保可视化监管平台 —— 政务大屏样式
 *  深蓝政务主题（默认，适合投大屏）；body.light 切换为浅色办公主题。
 * ========================================================================= */
:root {
  --bg0: #061634;
  --bg1: #0b2a5b;
  --bg2: #103a78;
  --panel: rgba(13, 42, 92, 0.55);
  --panel-solid: #0e2c5e;
  --panel-head: rgba(22, 70, 140, 0.65);
  --border: rgba(86, 156, 255, 0.28);
  --border-strong: rgba(86, 156, 255, 0.55);
  --text: #e8f1ff;
  --text-dim: #9fb8da;
  --text-mute: #6f8bb5;
  --accent: #3d8bff;
  --accent2: #19d2ff;
  --gold: #ffce6a;
  --danger: #ff4d4f;
  --ok: #2bd07a;
  --c-hospital: #3d8bff;
  --c-clinic: #2bd07a;
  --c-pharmacy: #ffae3b;
  --c-jb: #b388ff;
  --c-development: #08b6b1;
  --c-red: #ff4d4f;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --radius: 10px;
}
body.light {
  --bg0: #eef3fb; --bg1: #f5f8fd; --bg2: #ffffff;
  --panel: #ffffff; --panel-solid: #ffffff; --panel-head: #eaf1fc;
  --border: #d6e2f3; --border-strong: #b9cdec;
  --text: #1a2740; --text-dim: #51678c; --text-mute: #8497b5;
  --shadow: 0 4px 16px rgba(40, 70, 120, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Source Han Sans CN", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg2), var(--bg1) 45%, var(--bg0));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent2); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(86, 156, 255, 0.35); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 顶部党政横幅 ---------------- */
.app-header {
  position: relative; height: 76px; display: flex; align-items: center;
  background: linear-gradient(90deg, rgba(8,28,64,0.96), rgba(16,58,120,0.9), rgba(8,28,64,0.96));
  border-bottom: 2px solid var(--border-strong);
  box-shadow: var(--shadow); padding: 0 22px; z-index: 30;
}
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent2), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 280px; }
.brand .emblem {
  width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #d4af37 60%, #a8801f);
  display: flex; align-items: center; justify-content: center; color: #5b3e00; font-weight: 900;
  box-shadow: 0 0 14px rgba(255,206,106,0.5); font-size: 20px;
}
.brand .region { font-size: 13px; color: var(--gold); letter-spacing: 2px; }
.brand .sub { font-size: 12px; color: var(--text-mute); }
.app-title {
  flex: 1; text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 3px;
  background: linear-gradient(180deg, #ffffff, #bfe0ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 12px rgba(60,140,255,0.25); white-space: nowrap;
}
.header-right { min-width: 280px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.clock { text-align: right; line-height: 1.3; }
.clock .time { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent2); }
.clock .date { font-size: 12px; color: var(--text-dim); }
.role-chip {
  padding: 4px 12px; border-radius: 14px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border-strong); background: rgba(61,139,255,0.18); color: #cfe4ff;
}
.role-chip.admin { background: rgba(255,77,79,0.18); border-color: rgba(255,77,79,0.5); color: #ffd0d0; }
.role-chip.viewer { background: rgba(43,208,122,0.16); border-color: rgba(43,208,122,0.45); color: #c7f4dd; }

.btn {
  cursor: pointer; border: 1px solid var(--border-strong); background: rgba(61,139,255,0.14);
  color: var(--text); padding: 7px 14px; border-radius: 8px; font-size: 13px; transition: .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: rgba(61,139,255,0.3); }
.btn.primary { background: linear-gradient(180deg, #3d8bff, #1f63d6); border-color: #3d8bff; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(255,77,79,0.2); border-color: rgba(255,77,79,0.5); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- 导航 ---------------- */
.nav-tabs {
  display: flex; gap: 4px; padding: 8px 18px 0; background: rgba(6,18,42,0.6);
  border-bottom: 1px solid var(--border); position: relative; z-index: 20; flex-wrap: wrap;
}
.nav-tabs .tab {
  background: transparent; font-family: inherit;
  cursor: pointer; padding: 9px 20px; font-size: 14.5px; color: var(--text-dim); border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: none; transition: .15s; display: flex; align-items: center; gap: 7px;
}
.nav-tabs .tab:hover { color: var(--text); background: rgba(61,139,255,0.1); }
.nav-tabs .tab.active {
  color: #fff; background: linear-gradient(180deg, rgba(61,139,255,0.32), rgba(61,139,255,0.06));
  border-color: var(--border-strong); font-weight: 700;
}
.nav-tabs .tab .ti { font-size: 16px; }

/* ---------------- 内容区 ---------------- */
.view { display: none; padding: 16px 18px; }
.view.active { display: block; }
.module-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.module-title .bar { width: 5px; height: 20px; background: linear-gradient(var(--accent2), var(--accent)); border-radius: 3px; }
.module-title small { color: var(--text-mute); font-weight: 400; font-size: 13px; }

/* 面板 */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(4px); overflow: hidden;
}
.panel > .ph {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px; background: var(--panel-head); border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; letter-spacing: 1px;
}
.panel > .ph .deco { color: var(--accent2); }
.panel > .pb { padding: 12px 14px; }

/* ---------------- 驾驶舱网格 ---------------- */
.cockpit { display: grid; grid-template-columns: 340px 1fr 340px; gap: 14px; align-items: stretch; }
.cockpit .col { display: flex; flex-direction: column; gap: 14px; }
.cockpit .center { gap: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi {
  background: linear-gradient(160deg, rgba(61,139,255,0.16), rgba(61,139,255,0.03));
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 10px; text-align: center; position: relative;
}
.kpi .num { font-size: 26px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .num.blue { color: var(--accent2); }
.kpi .lbl { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.kpi .unit { font-size: 12px; color: var(--text-mute); margin-left: 2px; }

.chart { width: 100%; height: 230px; }
.chart.sm { height: 180px; }
.chart.lg { height: 300px; }
#cockpitMap { height: 470px; border-radius: 8px; overflow: hidden; }

/* 排行条 */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.rank-list .idx { width: 20px; height: 20px; border-radius: 4px; background: rgba(61,139,255,0.25); color: #cfe4ff; font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.rank-list .idx.top { background: linear-gradient(180deg,#ffce6a,#e0a93a); color: #5b3e00; }
.rank-list .nm { flex: 0 0 64px; color: var(--text-dim); }
.rank-list .track { flex: 1; height: 8px; background: rgba(255,255,255,0.06); border-radius: 5px; overflow: hidden; }
.rank-list .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 5px; }
.rank-list .val { flex: 0 0 46px; text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }

/* 预警卡 */
.alert-strip { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow: auto; }
.alert-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 7px; background: rgba(255,77,79,0.1); border-left: 3px solid var(--danger); font-size: 12.5px; }
.alert-item.warn { background: rgba(255,174,59,0.1); border-left-color: var(--c-pharmacy); }
.alert-item .nm { flex: 1; color: var(--text); }
.alert-item .tag { color: var(--danger); font-weight: 700; }
.scroll-bar { white-space: nowrap; overflow: hidden; }
.scroll-bar .track { display: inline-block; animation: marquee 36s linear infinite; }
.scroll-bar .track span { margin: 0 38px; color: var(--gold); font-size: 13px; }
@keyframes marquee { 0% { transform: translateX(60%);} 100% { transform: translateX(-100%);} }

/* ---------------- 地图模块 ---------------- */
.map-layout { display: grid; grid-template-columns: 230px 1fr 320px; gap: 12px; height: calc(100vh - 220px); min-height: 520px; }
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
#mainMap, #heatMap, #adminMap { width: 100%; height: 100%; }
.map-toolbar { position: absolute; top: 10px; left: 10px; z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; max-width: 70%; }
.map-legend { position: absolute; bottom: 12px; left: 12px; z-index: 5; background: rgba(6,18,42,0.82); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.map-legend .row { display: flex; align-items: center; gap: 6px; margin: 3px 0; color: var(--text-dim); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px rgba(0,0,0,.4); }
.dot.hospital { background: var(--c-hospital); }
.dot.clinic { background: var(--c-clinic); }
.dot.pharmacy { background: var(--c-pharmacy); }
.dot.jb { background: var(--c-jb); }
.dot.development { background: var(--c-development); }
.dot.red { background: var(--c-red); }

.filter-card { display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.filter-group .gtitle { font-size: 12px; color: var(--text-mute); margin-bottom: 6px; letter-spacing: 1px; }
.chk-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chk {
  font-size: 12.5px; padding: 5px 10px; border-radius: 14px; border: 1px solid var(--border); cursor: pointer;
  color: var(--text-dim); user-select: none; transition: .12s; display: inline-flex; align-items: center; gap: 5px;
}
.chk:hover { color: var(--text); }
.chk.on { background: rgba(61,139,255,0.25); color: #fff; border-color: var(--border-strong); font-weight: 600; }
.field { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); font-size: 13px; }
.field::placeholder { color: var(--text-mute); }
select.field option { color: #14233d; }

.inst-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; padding-right: 4px; }
.inst-card { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); cursor: pointer; transition: .12s; }
.inst-card:hover { border-color: var(--border-strong); background: rgba(61,139,255,0.1); }
.inst-card .top { display: flex; align-items: center; gap: 7px; }
.inst-card .nm { font-weight: 700; font-size: 13.5px; flex: 1; }
.inst-card .addr { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.inst-card .meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; font-size: 11.5px; color: var(--text-mute); }
.type-badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; color: #fff; }
.type-badge.hospital { background: var(--c-hospital); }
.type-badge.clinic { background: var(--c-clinic); }
.type-badge.pharmacy { background: var(--c-pharmacy); }
.type-badge.jb { background: var(--c-jb); }
.status-badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.status-badge.正常 { color: var(--ok); border: 1px solid rgba(43,208,122,.4); }
.status-badge.暂停 { color: var(--c-pharmacy); border: 1px solid rgba(255,174,59,.4); }
.status-badge.管控 { color: var(--danger); border: 1px solid rgba(255,77,79,.5); background: rgba(255,77,79,.1); }
.tag-mini { font-size: 11px; color: var(--accent2); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; }

/* Institution marker dot */
.map-marker { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 6px rgba(0,0,0,.5); cursor: pointer; }
.info-win { min-width: 220px; font-size: 13px; }
.info-win h4 { margin: 0 0 6px; font-size: 14.5px; }
.info-win .r { color: var(--text-dim); margin: 2px 0; }

/* ---------------- 统计/网格 ---------------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.locked { position: relative; }
.locked .lock-mask {
  position: absolute; inset: 0; background: rgba(6,18,42,0.78); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; border-radius: var(--radius); z-index: 4; text-align: center;
}
.locked .lock-mask .ic { font-size: 30px; }

/* ---------------- 便民服务 ---------------- */
.service-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.svc-cards { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.svc-card { padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: linear-gradient(160deg, rgba(61,139,255,0.12), rgba(61,139,255,0.02)); }
.svc-card h4 { margin: 0 0 6px; font-size: 15px; }
.svc-card p { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }
.svc-card .big { font-size: 20px; color: var(--gold); font-weight: 800; }
.guide-list { list-style: none; margin: 0; padding: 0; }
.guide-list li { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; display: flex; gap: 8px; }
.guide-list li .num { color: var(--accent2); font-weight: 700; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; border-radius: 8px; border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data thead th { background: var(--panel-head); position: sticky; top: 0; color: var(--text); font-weight: 700; }
table.data tbody tr:hover { background: rgba(61,139,255,0.08); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--text-dim); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }

/* 可搜索下拉（combobox） */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 300px; overflow: auto;
  background: var(--panel-solid); border: 1px solid var(--border-strong); border-top: none;
  border-radius: 0 0 8px 8px; box-shadow: var(--shadow); display: none;
}
.combo-list.show { display: block; }
.combo-item { padding: 7px 11px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.combo-item:hover, .combo-item.active { background: rgba(61, 139, 255, 0.2); }
.combo-item .d { color: var(--text-mute); font-size: 11.5px; margin-top: 2px; }
.combo-empty { padding: 12px; color: var(--text-mute); font-size: 12.5px; text-align: center; }

/* ---------------- 弹窗 ---------------- */
.modal-mask { position: fixed; inset: 0; background: rgba(2,8,20,0.7); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-mask.show { display: flex; }
.modal { width: 560px; max-width: 94vw; max-height: 90vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); }
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; }
.modal .mb { padding: 16px 18px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.close-x { cursor: pointer; color: var(--text-mute); }

/* ---------------- toast ---------------- */
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 18px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); animation: fadein .2s; }
.toast.ok { background: #1f7a4d; color: #fff; }
.toast.err { background: #a02525; color: #fff; }
.toast.info { background: #1f63d6; color: #fff; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px);} }

/* 地图未配置提示 */
.map-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(6,18,42,0.85); text-align: center; padding: 20px; z-index: 6; }
.map-hint .ic { font-size: 40px; }
.map-hint code { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; color: var(--gold); }

.muted { color: var(--text-mute); }
.empty { text-align: center; color: var(--text-mute); padding: 24px; font-size: 13px; }

/* 汇报全屏模式：隐藏导航，仅留驾驶舱 */
body.report-mode .nav-tabs, body.report-mode .app-header .header-right .btn:not(.exit-report) { }
body.report-mode { overflow: hidden; }

/* 自适应缩放容器（大屏） */
@media (max-width: 1500px) {
  .cockpit { grid-template-columns: 300px 1fr 300px; }
  .map-layout { grid-template-columns: 210px 1fr 290px; }
}
@media (max-width: 1200px) {
  .cockpit { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  #mainMap, #heatMap { height: 460px; }
  .app-title { font-size: 20px; letter-spacing: 1px; }
  .service-grid, .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ---------------- 便民查询与移动端 ---------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button, input, select { font-family: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent2); outline-offset: 3px; }
.btn.primary { color: #fff; }
.nav-toggle, .filter-toggle, .map-display-toggle { display: none; }
.panel, .col, .map-wrap, .cockpit > *, .map-layout > *, .grid2 > *, .grid3 > *, .service-grid > * { min-width: 0; }
.brand, .header-right { min-width: 0; flex-shrink: 0; }
.brand { width: 190px; }
.header-right { gap: 8px; }
.app-title { min-width: 0; padding: 0 16px; font-size: clamp(18px, 1.6vw, 28px); letter-spacing: 1px; white-space: normal; }
.map-search-panel { background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.map-search-row { display: flex; gap: 10px; align-items: stretch; }
.map-search-box { display: flex; align-items: center; flex: 1; min-width: 0; gap: 10px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 14px; background: rgba(61,139,255,.06); }
.map-search-box:focus-within { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(25,210,255,.12); }
.search-icon { font-size: 30px; line-height: 1; color: var(--accent2); }
.map-search-box input { width: 100%; min-width: 0; height: 46px; border: 0; background: transparent; color: var(--text); font-size: 16px; outline: 0; }
.map-search-box input::placeholder { color: var(--text-dim); }
.map-search-row > .btn { flex-shrink: 0; min-height: 46px; justify-content: center; }
.map-search-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.map-search-actions > .btn { min-height: 36px; }
.quick-pharmacy { border-color: rgba(255,174,59,.55); color: var(--gold); }
.quick-pharmacy[aria-pressed="true"], .quick-pharmacy.active { background: #ffae3b; color: #3e2900; border-color: #ffae3b; font-weight: 700; }
.map-sort-label { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12px; }
.map-sort-label .field { width: auto; min-height: 36px; }
.map-location-status { color: var(--text-dim); font-size: 12px; margin-left: auto; line-height: 1.5; }
.main-map-layout { height: calc(100dvh - 330px); min-height: 520px; grid-template-columns: 210px minmax(0, 1fr) 350px; }
.results-panel { display: flex; flex-direction: column; min-height: 0; }
.results-panel > .ph { flex-shrink: 0; }
.results-panel > .inst-list { min-height: 0; }
.heat-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.inst-card { display: flex; gap: 12px; align-items: stretch; }
.chk { background: transparent; }
.load-more { width: 100%; justify-content: center; margin-top: 8px; }
.navigate-link { white-space: nowrap; }
.inst-body { flex: 1; min-width: 0; }
.inst-card .top { flex-wrap: wrap; gap: 5px; align-items: flex-start; }
.inst-card .nm { min-width: 0; overflow-wrap: anywhere; line-height: 1.55; }
.inst-card .addr { line-height: 1.6; overflow-wrap: anywhere; }
.inst-card .meta { flex-wrap: wrap; gap: 5px 8px; line-height: 1.5; }
.inst-card .inst-open { display: block; padding: 0; color: var(--text); background: transparent; border: 0; text-align: left; font-size: 14px; font-weight: 700; line-height: 1.6; cursor: pointer; overflow-wrap: anywhere; }
.inst-side { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 70px; gap: 8px; padding-left: 10px; border-left: 1px solid var(--border); }
.inst-side .distance { color: var(--gold); font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inst-side .btn { width: 100%; justify-content: center; min-height: 36px; }
.inst-side small { color: var(--text-mute); font-size: 11px; text-align: center; }
.development-badge, .tag-mini.development, .special-area { color: #5ce5dc; border-color: rgba(8,182,177,.5); }
.inst-card.development { border-left: 3px solid var(--c-development); }
#mapListMore { align-self: center; margin: 6px 0; min-height: 40px; }
#pickCombo { width: 360px; max-width: 100%; }
.senior-tip { color: var(--gold); }

/* 详情独立于地图，手机与电脑均可阅读及导航。 */
.institution-detail { width: 560px; max-width: calc(100vw - 32px); max-height: min(86dvh, 760px); padding: 0; color: var(--text); background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 24px 90px rgba(0,0,0,.4); overflow: auto; }
.institution-detail::backdrop { background: rgba(2,8,20,.65); backdrop-filter: blur(3px); }
.detail-dialog-top { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 14px 8px 20px; background: var(--panel-solid); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.detail-dialog-top .btn { min-width: 44px; min-height: 44px; justify-content: center; font-size: 18px; }
#institutionDetailContent { padding: 22px; overflow-wrap: anywhere; }
#institutionDetailContent h2, #institutionDetailContent h3, #institutionDetailContent h4 { margin: 0 0 10px; line-height: 1.55; color: var(--text); }
#institutionDetailContent h2 { font-size: 20px; }
.detail-heading, .detail-header { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; margin-bottom: 18px; }
.detail-heading > :first-child, .detail-header > :first-child { min-width: 0; flex: 1; }
.detail-heading > .btn, .detail-header > .btn { flex: 0 0 auto; min-height: 44px; }
.detail-fields { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px; line-height: 1.7; font-size: 14px; }
.detail-fields dt { color: var(--text-mute); }
.detail-fields dd { margin: 0; }
.detail-fields .detail-row { grid-column: 1 / -1; }
.detail-row { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.7; }
.detail-row > :first-child { color: var(--text-dim); flex: 0 0 72px; }
.detail-row > :last-child { min-width: 0; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.detail-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.detail-actions .btn { min-height: 44px; }
.detail-heading .detail-actions { margin-top: 0; flex: 0 0 auto; }
.detail-note { color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.leaflet-container { font-family: inherit; background: var(--bg1); }
.leaflet-container .leaflet-popup-content-wrapper, .leaflet-container .leaflet-popup-tip { color: var(--text); background: var(--panel-solid); }
.leaflet-popup-content { max-width: min(300px, calc(100vw - 70px)); margin: 14px 18px; line-height: 1.6; overflow-wrap: anywhere; }
.leaflet-popup-content .info-win { min-width: 0; }
.leaflet-container a.leaflet-popup-close-button { width: 32px; height: 32px; color: var(--text-dim); font-size: 22px; }
.leaflet-control-zoom a { background: var(--panel-solid); color: var(--text); border-color: var(--border); }
.leaflet-control-zoom a:hover { background: var(--panel-head); color: var(--text); }
.leaflet-control-zoom a.leaflet-disabled { background: var(--panel-solid); color: var(--text-mute); }
.leaflet-bar { border-color: var(--border-strong); box-shadow: var(--shadow); }
.map-wrap { isolation: isolate; }
.map-toolbar, .map-legend { z-index: 850; }
.map-legend { bottom: 30px; }
.map-hint { z-index: 900; }
body.light .role-chip { color: #d9e9ff; }
body.light .nav-tabs .tab.active, body.light .chk.on { color: #1553a6; }
body.light .nav-tabs { background: #e7eef9; }
body.light .map-legend { background: rgba(255,255,255,.94); }
body.light .quick-pharmacy { color: #925400; }
body.light .quick-pharmacy[aria-pressed="true"] { color: #3e2900; }
body.light .inst-side .distance, body.light .senior-tip { color: #a76500; }
body.light .development-badge, body.light .tag-mini.development, body.light .special-area { color: #087c75; }
body.light a { color: #1665bf; }
body.light a.btn.primary { color: #fff; }

@media (max-width: 1300px) {
  .app-header { padding: 0 16px; }
  .brand { width: 142px; }
  .clock { display: none; }
  .header-right { gap: 6px; }
  .main-map-layout { grid-template-columns: 190px minmax(0,1fr) 310px; }
  .nav-tabs { padding-left: 12px; padding-right: 12px; }
  .nav-tabs .tab { padding-left: 14px; padding-right: 14px; }
}
@media (min-width: 761px) and (max-width: 1200px) {
  .main-map-layout { grid-template-columns: 210px minmax(0,1fr); height: auto; }
  .main-map-layout > .map-wrap { min-height: 460px; }
  .main-map-layout .results-panel { grid-column: 1 / -1; max-height: 440px; }
  .heat-layout { height: auto; min-height: 0; grid-template-columns: minmax(0,1fr) 300px; }
  .heat-layout > .map-wrap { min-height: 460px; }
}
@media (max-width: 760px) {
  body { background-attachment: fixed; padding-bottom: env(safe-area-inset-bottom); }
  .app-header { min-height: 96px; height: auto; padding: calc(12px + env(safe-area-inset-top)) 14px 10px; flex-wrap: wrap; gap: 10px 8px; }
  .brand { display: none; }
  .app-title { flex: 1 1 100%; width: 100%; font-size: 17px; line-height: 1.55; padding: 0; text-align: left; letter-spacing: 0; }
  .header-right { width: 100%; justify-content: flex-end; gap: 7px; }
  .header-right .role-chip { margin-right: auto; max-width: calc(100% - 180px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 9px; font-size: 11px; }
  .header-right .btn { min-height: 44px; min-width: 44px; justify-content: center; padding: 7px 10px; font-size: 13px; }
  #reportBtn { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-tabs { display: none; padding: 10px 12px; gap: 8px; grid-template-columns: repeat(2, minmax(0,1fr)); border-bottom: 1px solid var(--border-strong); }
  .nav-tabs.open { display: grid; }
  .nav-tabs .tab { min-height: 48px; justify-content: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 14px; }
  .nav-tabs .tab.active { border-color: var(--accent); }
  .view { padding: 16px 12px 24px; }
  .module-title { font-size: 17px; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
  .module-title small { flex: 1 1 100%; padding-left: 12px; font-size: 12px; line-height: 1.5; }
  .btn, .btn.sm, .chk { min-height: 44px; }
  .btn { font-size: 14px; }
  .btn.sm { font-size: 13px; padding: 8px 10px; }
  .chk { align-items: center; padding: 9px 12px; }
  .field { min-height: 44px; font-size: 16px; }
  .panel > .ph { padding: 10px 12px; letter-spacing: 0; flex-wrap: wrap; line-height: 1.6; }
  .panel > .pb { padding: 12px; }
  .map-search-panel { padding: 10px; margin-bottom: 12px; }
  .map-search-row { flex-wrap: wrap; gap: 10px; }
  .map-search-box { flex-basis: 100%; padding: 0 10px; gap: 7px; }
  .map-search-box input { height: 48px; font-size: 15px; }
  .map-search-row > .btn { width: 100%; min-height: 44px; }
  .map-search-actions { gap: 8px; }
  .map-search-actions > .btn { min-height: 44px; flex: 1; justify-content: center; padding: 8px 10px; }
  .filter-toggle { display: inline-flex; }
  .filter-toggle[aria-expanded="true"] { background: rgba(61,139,255,.28); border-color: var(--accent); }
  .map-sort-label { flex: 1 1 148px; justify-content: flex-end; }
  .map-sort-label > span { display: none; }
  .map-sort-label .field { width: 100%; min-height: 44px; font-size: 14px; }
  .map-display-toggle { display: flex; width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; padding: 3px; background: rgba(0,0,0,.08); }
  .map-display-toggle .btn { width: 50%; justify-content: center; border: 0; min-height: 44px; background: transparent; font-size: 14px; }
  .map-display-toggle .btn.active, .map-display-toggle .btn[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 700; }
  .map-location-status { margin: 1px 0 0; flex: 1 1 200px; font-size: 12px; }
  #btnClearLocate { flex: 0 0 auto; }
  .main-map-layout { display: flex; flex-direction: column; gap: 12px; min-height: 0; height: auto; }
  .main-map-layout > .filter-card { display: none; }
  .main-map-layout.filters-open > .filter-card { display: flex; }
  .main-map-layout > .results-panel { display: none; }
  .main-map-layout.list-mode > .results-panel { display: flex; }
  .main-map-layout.list-mode > .map-wrap { display: none; }
  .main-map-layout > .map-wrap { height: clamp(360px, 58dvh, 600px); }
  #mainMap { height: 100%; }
  .main-map-layout .results-panel > .inst-list { max-height: none; overflow: visible; }
  #mapFilters { gap: 16px !important; }
  .filter-group .gtitle { font-size: 13px; }
  .map-legend { left: 8px; bottom: 30px; padding: 6px 8px; font-size: 11px; max-width: calc(100% - 72px); }
  .map-legend .row { margin: 2px 0; }
  .map-toolbar { max-width: calc(100% - 20px); gap: 5px; }
  .map-toolbar .btn { padding: 8px; font-size: 12px; }
  .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }
  .leaflet-container a.leaflet-popup-close-button { width: 40px; height: 40px; }
  .leaflet-control-attribution { max-width: 100%; font-size: 9px; }
  .inst-list { gap: 10px; }
  .inst-card { padding: 12px 10px; gap: 10px; }
  .inst-card .inst-open, .inst-card .nm { font-size: 15px; }
  .inst-card .inst-open { min-height: 44px; }
  .inst-card .addr { font-size: 13px; }
  .inst-card .meta { font-size: 12px; }
  .type-badge, .status-badge, .tag-mini { font-size: 11px; line-height: 1.7; }
  .inst-side { flex-basis: 72px; padding-left: 9px; }
  .inst-side .btn { min-height: 44px; padding-left: 8px; padding-right: 8px; }
  .heat-layout { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .heat-layout > .map-wrap { height: 460px; flex: 0 0 460px; }
  #heatMap { height: 100%; }
  .cockpit, .service-grid, .grid2, .grid3 { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .cockpit .col { gap: 12px; }
  #cockpitMap { height: 360px; }
  .kpi-grid { gap: 7px; }
  .kpi { padding: 12px 5px; }
  .kpi .num { font-size: 23px; }
  .kpi .lbl { font-size: 11px; line-height: 1.5; }
  .chart { height: 260px; }
  .chart.sm { height: 210px; }
  .toolbar { align-items: stretch; }
  .toolbar > .field, .toolbar > select.field, .toolbar > input.field { min-width: 0; max-width: 100% !important; flex: 1 1 140px; }
  .toolbar > .combo { flex: 1 1 100%; }
  .toolbar > .grow { display: none; }
  .toolbar > .btn { justify-content: center; }
  #svcLocate { flex: 1 1 100%; }
  #svcType { width: 100% !important; }
  #svcNearby { max-height: 440px !important; }
  .svc-cards { gap: 8px; }
  .svc-card { padding: 12px; }
  .svc-card h4 { font-size: 14px; }
  .guide-list li { font-size: 14px; line-height: 1.7; }
  .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
  table.data th, table.data td { padding: 12px 10px; }
  .pager { flex-wrap: wrap; justify-content: center; }
  #pickCombo { width: 100%; max-width: 100%; }
  .combo-list { max-height: 260px; }
  .combo-item { min-height: 48px; padding: 10px; }
  .modal { max-width: calc(100vw - 24px); max-height: 88dvh; }
  .modal .mh, .modal .mb, .modal .mf { padding: 14px; }
  .form-grid { grid-template-columns: minmax(0,1fr); }
  .form-grid label { font-size: 13px; }
  .close-x { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; margin: -10px -6px -10px 0; }
  .institution-detail { width: calc(100% - 20px); max-width: none; max-height: 90dvh; border-radius: 12px; }
  #institutionDetailContent { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .detail-dialog-top { padding-left: 16px; }
  .detail-heading, .detail-header { gap: 10px; }
  #institutionDetailContent h2 { font-size: 18px; }
  .detail-fields { grid-template-columns: 68px minmax(0,1fr); gap: 10px; }
  .detail-actions .btn { flex: 1; justify-content: center; }
  #toast { width: calc(100vw - 28px); max-width: 460px; top: calc(12px + env(safe-area-inset-top)); pointer-events: none; }
  .toast { padding: 12px 14px; line-height: 1.6; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
