/* Homepage — 服务导航页样式。只用 ui.css / hp.css 变量，前缀 hm-。 */

/* hero 状态行 */
.hm-status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; color: var(--text-2); font-size: 15px; letter-spacing: -.015em; }
.hm-live { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; flex: none; }

/* ---------- 工具行 ---------- */
.hm-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 0 4px 12px;
}
#hm-q {
  flex: 1 1 220px; min-width: 160px; max-width: 380px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: .5px solid var(--sep-strong);
  border-radius: 999px; padding: 8px 16px; outline: none;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
#hm-q:focus { border-color: var(--accent); background: var(--surface); }
#hm-q::placeholder { color: var(--text-3); }

/* ---------- 分类 chips ---------- */
.hm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px 16px; }
.hm-chip {
  font: inherit; font-size: 12.5px; padding: 4px 13px; border-radius: 999px; border: 0;
  background: var(--track); color: var(--text-2); cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.hm-chip:hover { background: var(--accent-soft); color: var(--text); }
.hm-chip[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 500; }
.hm-chip .n { opacity: .65; font-size: 11px; margin-left: 3px; }

/* ---------- 卡片网格 ---------- */
.hm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px;
  min-height: 120px;
}
#hm-grid.hm-list { grid-template-columns: 1fr; gap: 0; }

.hm-card {
  position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px;
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--panel-shadow, var(--shadow));
  padding: 14px 15px 12px; min-width: 0;
  text-decoration: none; color: var(--text);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), background-color .2s var(--ease);
}
@media (prefers-reduced-motion: no-preference) {
  .hm-card { transition: box-shadow .25s var(--ease), transform .25s var(--ease), background-color .2s var(--ease); }
  .hm-grid.dragging .hm-card { transition: none; }
}
a.hm-card:hover { text-decoration: none; }
@media (hover: hover) {
  .hm-card:hover { transform: translateY(-2px); box-shadow: var(--panel-shadow, var(--shadow)), 0 10px 24px -10px rgba(0, 0, 0, .22); }
}
.hm-card.dragging { opacity: .45; transform: scale(.98); }
.hm-card.drag-over { box-shadow: var(--panel-shadow, var(--shadow)), inset 0 0 0 2px var(--accent); }
.hm-card.just-moved { animation: hm-flash 1.1s var(--ease); }
@keyframes hm-flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

/* 列表模式：单行布局 */
#hm-list .hm-card,
#hm-grid.hm-list .hm-card {
  grid-template-rows: none;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm);
}
#hm-grid.hm-list .hm-card + .hm-card { margin-top: 6px; }
#hm-grid.hm-list .hm-sub { grid-row: auto; }

/* 图标块 */
.hm-icon {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: var(--track); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 650; letter-spacing: 0;
  overflow: hidden; user-select: none;
}
.hm-icon img { width: 26px; height: 26px; object-fit: contain; border-radius: 4px; }
#hm-grid.hm-list .hm-icon { width: 34px; height: 34px; border-radius: 9px; }
#hm-grid.hm-list .hm-icon img { width: 21px; height: 21px; }

/* 标题行 */
.hm-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hm-name { font-weight: 550; font-size: 14.5px; letter-spacing: -.015em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-star {
  border: 0; background: none; padding: 2px 3px; margin-left: auto; cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--text-3); flex: none;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.hm-star:hover { color: var(--orange-dot); transform: scale(1.12); }
.hm-star[aria-pressed="true"] { color: var(--orange-dot); }

/* 副行：分类 chip + 状态 */
.hm-sub { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.hm-cat {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-2); box-shadow: inset 0 0 0 .5px var(--sep-strong);
  color: var(--text-2); white-space: nowrap;
}
.hm-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; margin-left: auto; }
#hm-grid.hm-list .hm-state { margin-left: 0; }
.hm-state .hp-shape { font-size: 10px; }

/* 响应时间徽标 */
.hm-lat {
  font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 99px; white-space: nowrap;
  background: var(--track); color: var(--text-2);
}
.hm-lat.ok { background: rgba(52, 199, 89, .12); color: var(--green); }
.hm-lat.warn { background: rgba(255, 159, 10, .14); color: var(--orange); }
.hm-lat.bad { background: rgba(255, 59, 48, .11); color: var(--red); }

/* 排序控件（触屏/键盘兜底） */
.hm-order { display: inline-flex; gap: 2px; flex: none; }
.hm-mv {
  border: 0; background: none; cursor: pointer; color: var(--text-3);
  font-size: 11px; line-height: 1; padding: 4px 4px; border-radius: 6px;
}
.hm-mv:hover { color: var(--text); background: var(--track); }
.hm-mv:disabled { opacity: .3; cursor: default; background: none; }
@media (hover: none), (max-width: 719px) { .hm-order { display: inline-flex; } }

/* 详情小字（卡片第三行：地址） */
.hm-sub-line { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
#hm-grid.hm-list .hm-sub-line { display: none; }

/* ---------- 空态 / 加载 ---------- */
.hm-empty { padding: 40px 18px; text-align: center; color: var(--text-3); font-size: 14px; }
.hm-skel { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

/* ---------- 对话框 ---------- */
.hm-scrim {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 18, 32, .3);
  display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}
.hm-scrim.on { opacity: 1; pointer-events: auto; }
.hm-dialog {
  width: min(430px, 100%); max-height: 82vh; overflow: auto;
  background: var(--surface, #fff);
  background-image: linear-gradient(var(--surface, rgba(255,255,255,.92)), var(--surface, rgba(255,255,255,.92)));
  border-radius: 22px;
  box-shadow: var(--panel-shadow, var(--shadow)), 0 30px 70px -20px rgba(10, 15, 40, .4);
  transform: translateY(-8px) scale(.98); transition: transform .3s var(--lg-ease, var(--ease));
  padding: 18px 20px 16px;
}
.hm-scrim.on .hm-dialog { transform: none; }
.hm-dialog h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.hm-dialog .hm-dlg-sub { margin: 0 0 12px; font-size: 12.5px; color: var(--text-3); }
.hm-field { display: grid; gap: 5px; margin: 12px 0; }
.hm-field label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.hm-field input, .hm-field select {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: .5px solid var(--sep-strong);
  border-radius: 11px; padding: 9px 13px; outline: none; width: 100%;
  transition: border-color .2s var(--ease);
}
.hm-field input:focus, .hm-field select:focus { border-color: var(--accent); }
.hm-field .hm-err { color: var(--red); font-size: 12.5px; min-height: 16px; margin: 2px 0 0; }
.hm-dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---------- HPSheet 补充样式（sheet.js 依赖的类，hp 系 css 未包含） ---------- */
.hp-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15, 18, 32, .22); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.hp-scrim.on { opacity: 1; pointer-events: auto; }
.hp-sheet {
  position: fixed; z-index: 41; background: var(--surface); color: var(--text);
  box-shadow: var(--panel-shadow, var(--shadow)), 0 24px 70px -18px rgba(10, 15, 40, .35);
  display: flex; flex-direction: column; overflow: hidden;
  top: 12px; right: 12px; bottom: auto; left: auto;
  width: min(430px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  border-radius: 22px;
  transform: translateX(calc(100% + 24px));
  transition: transform .45s var(--ease);
}
.hp-sheet.on { transform: none; }
.hp-sheet-grip { display: none; }
.hp-sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; border-bottom: .5px solid var(--sep); }
.hp-sheet-t { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-sheet-x { border: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--track); color: var(--text-2); cursor: pointer; font-size: 14px; flex: none; }
.hp-sheet-x:hover { background: var(--sep-strong); }
.hp-sheet-b { overflow: auto; padding: 14px 18px 20px; }
@media (max-width: 719px) {
  .hp-sheet.hp-bottom {
    top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-height: 82vh;
    border-radius: 22px 22px 0 0; transform: translateY(105%);
    transition: transform .4s var(--ease);
  }
  .hp-sheet.hp-bottom.on { transform: none; }
  .hp-sheet-grip { display: flex; justify-content: center; padding: 9px 0 3px; cursor: grab; }
  .hp-grip { width: 40px; height: 4.5px; border-radius: 3px; background: var(--sep-strong); }
}

/* ---------- sheet 内 endpoint 行 ---------- */
.hm-ep {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 12px; background: var(--surface-2); cursor: pointer; border: 0; font: inherit; color: inherit;
  width: 100%; text-align: left;
}
.hm-ep + .hm-ep { margin-top: 8px; }
.hm-ep:hover { background: var(--accent-soft); }
.hm-ep .hm-tag { font-size: 10.5px; font-weight: 650; padding: 2px 7px; border-radius: 99px; background: var(--track); color: var(--text-2); flex: none; }
.hm-ep .hp-shape { flex: none; }
.hm-ep .u { flex: 1; min-width: 0; font-size: 12.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-ep[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
.hm-ep[aria-pressed="true"] .hp-shape { color: var(--accent); }

.hm-kvlist { display: grid; gap: 6px; margin: 0 0 14px; }
.hm-kvlist .kv { padding: 7px 0; font-size: 13px; }

/* ---------- Toast ---------- */
.hm-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  z-index: 90; background: var(--surface); color: var(--text);
  box-shadow: var(--panel-shadow, var(--shadow)), 0 12px 34px -10px rgba(10, 15, 40, .4);
  border-radius: 999px; padding: 9px 18px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease);
  max-width: min(86vw, 480px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-toast.on { opacity: 1; transform: translate(-50%, 0); }
.hm-toast.err { box-shadow: var(--panel-shadow, var(--shadow)), inset 0 0 0 1.5px var(--red-dot); }

/* ---------- 响应式 ---------- */
.hm-detail{border:0;border-radius:8px;background:var(--track);color:var(--text-2);font:12px var(--font);padding:5px 10px;cursor:pointer;margin-left:auto}
.hm-field textarea{font:13px var(--mono);color:var(--text);background:var(--surface-2);border:.5px solid var(--sep-strong);border-radius:11px;padding:9px 13px;width:100%;resize:vertical}
#hm-grid.hm-list .hm-card{grid-template-columns:minmax(0,1fr) auto auto}
@media(max-width:719px){#hm-grid.hm-list .hm-card{grid-template-columns:minmax(0,1fr) auto}.hm-card .hm-order{display:flex}.hm-card .hm-sub{gap:5px}.hm-card .hm-state{margin-left:0}.hm-card .hm-order button{min-height:28px}}

@media (max-width: 719px) {
  .hm-toolbar { margin: 0 0 10px; }
  #hm-q { order: -1; flex: 1 1 100%; max-width: none; }
  .hm-toolbar .seg { margin-left: 0; }
  .hm-toolbar #hm-add { margin-left: auto; }
  .hm-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hm-card { padding: 12px 12px 10px; gap: 6px; }
  .hm-icon { width: 38px; height: 38px; border-radius: 10px; }
  .hm-name { font-size: 13.5px; }
  .hm-sub-line { display: none; }
  .hm-card .hm-order { display: none; }
  .hm-chips { overflow-x: auto; flex-wrap: nowrap; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
  .hm-chips::-webkit-scrollbar { display: none; }
  .hm-chip { flex: none; }
  #hm-grid.hm-list .hm-card { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
}
@media (max-width: 400px) {
  .hm-grid { grid-template-columns: 1fr; }
  .hm-card .hm-order { display: inline-flex; }
}
