/* ---------- 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafaff;
  --text: #1f2233;
  --text-2: #6b7085;
  --text-3: #9aa0b4;
  --line: rgba(28, 30, 50, 0.08);
  --brand: #6c5ce7;
  --brand-dark: #5b48d6;
  --brand-soft: rgba(108, 92, 231, 0.1);
  --teal: #0e9b8c;
  --teal-soft: rgba(18, 184, 166, 0.12);
  --amber: #c9822a;
  --amber-soft: rgba(240, 161, 58, 0.15);
  --blue-soft: rgba(45, 108, 223, 0.11);
  --blue: #2c5fb3;
  --slate-soft: rgba(90, 103, 128, 0.13);
  --slate: #4a5468;
  --rose: #b03a6a;
  --rose-soft: rgba(196, 62, 118, 0.11);
  --danger: #c0392b;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(28, 30, 50, 0.04), 0 8px 24px rgba(28, 30, 50, 0.06);
  --shadow-hover: 0 2px 4px rgba(28, 30, 50, 0.04), 0 16px 32px rgba(28, 30, 50, 0.09);
}

html,
body {
  margin: 0;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* 顶部柔和光晕，只做点缀，不铺满 */
.glow {
  position: fixed;
  inset: 0 0 auto 0;
  height: 440px;
  pointer-events: none;
  background:
    radial-gradient(720px 300px at 16% -12%, rgba(108, 92, 231, 0.16), transparent 62%),
    radial-gradient(600px 260px at 84% -8%, rgba(255, 143, 190, 0.14), transparent 60%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 22px 20px 56px;
}

.shell.narrow {
  max-width: 760px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 40px;
}

.shell.narrow .topbar {
  margin-bottom: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #9b7bff);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.28);
}

.clock {
  font-size: 12.5px;
  color: var(--text-2);
  text-align: right;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.chip:hover {
  color: var(--text);
  border-color: rgba(108, 92, 231, 0.35);
  background: var(--surface);
}

.chip:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.chip-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- 首页 ---------- */
.hero {
  margin-bottom: 26px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 14px;
}

/* auto-fit 会折叠空轨道，只剩一张卡的组会被拉成通栏。
   按双列时的单列宽算，跟上面对齐；窄屏是单列，不用限 */
@media (min-width: 700px) {
  .grid > .tool-card:only-child {
    max-width: calc((100% - 14px) / 2);
  }
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.tool-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 2px;
}

.tint-purple {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.tint-teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.tint-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tool-card h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
}

.tool-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  flex: 1;
}

.tag {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.tag.ok {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: rgba(18, 184, 166, 0.28);
}

.tag.warn {
  color: #8a5a00;
  background: rgba(201, 130, 42, 0.1);
  border-color: rgba(201, 130, 42, 0.3);
}

.tag.down {
  color: #a4341f;
  background: rgba(192, 57, 43, 0.07);
  border-color: rgba(192, 57, 43, 0.22);
}

/* 有告警时整张卡跟着染色。只靠右下角一个小胶囊，扫一眼根本注意不到。
   健康探测（服务未启动）也走这一套，不用另做一份样式 */
.tool-card.alert-warn {
  border-color: rgba(201, 130, 42, 0.35);
  background: rgba(201, 130, 42, 0.035);
}

.tool-card.alert-down {
  border-color: rgba(192, 57, 43, 0.38);
  background: rgba(192, 57, 43, 0.04);
}

/* ---------- 服务未启动页 ---------- */
.offline-card {
  width: 100%;
  max-width: 430px;
  text-align: center;
}

.offline-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: rgba(192, 57, 43, 0.08);
}

.offline-card h1 {
  margin: 0 0 6px;
  font-size: 19px;
}

.offline-card .sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}

.offline-detail {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  display: grid;
  gap: 8px;
}

.offline-detail span {
  display: inline-block;
  min-width: 62px;
  color: var(--text-3);
}

.offline-detail code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.offline-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.9;
}

.offline-hint code {
  font-family: "SFMono-Regular", Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11.5px;
  color: var(--text-2);
  display: inline-block;
  margin-top: 4px;
}

.actions.center {
  justify-content: center;
}

/* ---------- 404 ---------- */
/* 跟服务未启动页共用卡片骨架，但那是故障（红），这里只是地址不对，用中性色 */
.notfound-code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 3px;
  line-height: 1;
  color: var(--text-3);
  margin-bottom: 12px;
}

.offline-hint a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  margin: 0 5px;
}

.offline-hint a:hover {
  color: var(--text);
  border-color: var(--text-3);
}

.foot {
  margin-top: 44px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------- 通用面板 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 650;
}

.panel .hint {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-2);
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}

textarea,
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

textarea {
  resize: vertical;
  min-height: 108px;
  line-height: 1.6;
}

textarea:focus,
input[type="password"]:focus {
  border-color: rgba(108, 92, 231, 0.55);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  transition: background 0.15s, transform 0.15s;
}

.btn:hover {
  background: var(--brand-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.ghost {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.btn.ghost:hover {
  background: rgba(108, 92, 231, 0.18);
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.msg {
  font-size: 13px;
  color: var(--danger);
  min-height: 20px;
  margin-top: 10px;
}

/* ---------- 二维码页 ---------- */
.qr-result {
  margin-top: 20px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qr-result img {
  width: 232px;
  height: 232px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px;
}

/* ---------- 登录页 ---------- */
.center-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 366px;
  text-align: center;
}

.login-card .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  margin: 0 auto 16px;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 19px;
}

.login-card .sub {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--text-2);
}

.login-card input {
  text-align: center;
  letter-spacing: normal;
  font-size: 17px;
  padding: 12px;
}

.login-card .btn {
  width: 100%;
  margin-top: 14px;
}

.login-card .back-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-3);
  text-decoration: none;
}

.login-card .back-link:hover {
  color: var(--text-2);
}

/* ---------- Agent 聊天 ---------- */
body.chat {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.chat-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 16px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

#chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 2px 8px;
  scrollbar-width: thin;
}

.bubble {
  max-width: 88%;
  padding: 11px 15px;
  margin-bottom: 10px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.user {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.assistant {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bubble.error {
  background: rgba(192, 57, 43, 0.07);
  border: 1px solid rgba(192, 57, 43, 0.18);
  color: #9c3226;
}

.bubble a {
  color: var(--brand-dark);
  font-weight: 600;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 12px;
  margin: 0 0 8px 2px;
}

.tool-card-result {
  max-width: 88%;
  margin-bottom: 10px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--text-2);
}

.tool-card-result img {
  width: 168px;
  height: 168px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  display: block;
}

.tool-card-result .file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: none;
}

.tool-card-result .file-link:hover {
  text-decoration: underline;
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 5px 0;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.35;
  animation: blink 1.2s infinite;
}

.typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.composer {
  flex: none;
  padding: 8px 0 max(14px, env(safe-area-inset-bottom));
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

#input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 9px;
  max-height: 132px;
  min-height: 34px;
}

#input::placeholder {
  color: var(--text-3);
}

@media (max-width: 520px) {
  .topbar {
    margin-bottom: 28px;
  }
  .hero h1 {
    font-size: 22px;
  }
  .clock {
    font-size: 11.5px;
  }
  .bubble,
  .tool-card-result {
    max-width: 92%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 首页：搜索与分组 ---------- */
.tint-rose {
  background: rgba(214, 81, 122, 0.12);
  color: #c04a72;
}

.tint-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.tint-slate {
  background: var(--slate-soft);
  color: var(--slate);
}

/* 分组标题右侧挂一个出口：首页只摆常用的几个，完整目录在 /toolbox/ */
.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.group-more {
  font-size: 12.5px;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}

.group-more:hover {
  text-decoration: underline;
}

/* 常用工具用小卡：宽屏一行四个，只留图标和名字，描述放目录页 */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 700px) {
  .mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tool-card.mini {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
}

.tool-card.mini:hover {
  transform: translateY(-2px);
}

.tool-card.mini h2 {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-icon-mini {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  margin: 20px 0 22px auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.searchbar:focus-within {
  border-color: rgba(108, 92, 231, 0.45);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
  color: var(--brand-dark);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
}

.searchbar input::placeholder {
  color: var(--text-3);
}

.searchbar kbd {
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-3);
  background: var(--surface-2);
}

.searchbar:focus-within kbd {
  opacity: 0;
}

.group + .group {
  margin-top: 26px;
}

.group-title {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* 搜索时把不匹配的整组一起收起来，避免只剩一个孤零零的标题 */
.group[hidden] {
  display: none;
}

.empty-hint {
  padding: 26px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- 状态页 ---------- */
.st-verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.st-verdict-time {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* 正常时用中性底色。天天都正常的东西一旦做得鲜艳，三天后就看不见了。 */
.st-verdict[data-level="warn"] {
  background: rgba(240, 161, 58, 0.08);
  border-color: rgba(201, 130, 42, 0.3);
}

.st-verdict[data-level="down"] {
  background: rgba(192, 57, 43, 0.07);
  border-color: rgba(192, 57, 43, 0.3);
}

.st-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
}

.st-dot[data-level="up"],
.st-verdict[data-level="ok"] .st-dot {
  background: #17a673;
}

.st-dot[data-level="warn"],
.st-verdict[data-level="warn"] .st-dot {
  background: #d98324;
}

.st-dot[data-level="down"],
.st-verdict[data-level="down"] .st-dot {
  background: var(--danger);
}

.st-verdict[data-level="loading"] .st-dot {
  background: var(--text-3);
}

.st-flags {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.st-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #a4341f;
}

.st-flag[data-level="warn"] {
  color: #9a6414;
}

.st-section {
  margin-top: 26px;
}

.st-h {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.st-groups {
  display: grid;
  /* 单列网格默认按 min-content 撑轨道，行里的服务名一长，卡片就会顶出视口；
     minmax(0,1fr) 让它老老实实跟着容器宽度走 */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.st-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 16px;
}

.st-group-name {
  padding: 10px 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.st-svc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.st-group-name + .st-svc {
  border-top: 1px solid var(--line);
}

.st-svc-main {
  min-width: 0;
  flex: 1;
}

.st-svc-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.st-svc-name a {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: inherit;
  text-decoration: none;
}

.st-svc-name a:hover {
  color: var(--brand-dark);
}

.st-ext {
  font-size: 11px;
  color: var(--text-3);
}

.st-svc-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  /* 窄屏下一行长不下的（容器名 + 端口映射 + 耗时），宁可省略也别折行，
     折了会把右边的状态和按钮挤到中间行去 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-svc-state {
  flex: none;
  font-size: 12px;
  color: var(--text-2);
}

.st-svc:has(.st-dot[data-level="down"]) .st-svc-state {
  color: var(--danger);
}

.st-svc:has(.st-dot[data-level="warn"]) .st-svc-state {
  color: #9a6414;
}

.st-svc-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.st-svc-mem {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.st-svc:has(.st-dot[data-level="off"]) .st-svc-state {
  color: var(--text-3);
}

.st-power {
  flex: none;
  padding: 5px 14px;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  color: #fff;
  background: var(--danger);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: filter 0.15s ease;
}

/* 启动是恢复动作，用主色；停止用红色，跟顶栏那些白底 chip 区分开 */
.st-power[data-act="start"] {
  background: var(--brand);
}

.st-power:hover:not(:disabled) {
  filter: brightness(1.08);
}

.st-power:disabled {
  opacity: 0.6;
  cursor: default;
}

/* 行尾的展开箭头：启停按钮和影响说明都收在它下面 */
.st-expand {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: -4px;
  padding: 0;
  color: var(--text-3);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.st-expand:hover,
.st-expand[aria-expanded="true"] {
  color: var(--text);
}

.st-expand svg {
  transition: transform 0.15s ease;
}

.st-expand[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* 不能启停的行没有箭头，用等宽占位保持右侧列对齐 */
.st-expand-slot {
  flex: none;
  width: 26px;
  margin-right: -4px;
}

.st-more {
  display: flex;
  justify-content: flex-end;
  padding: 2px 0 12px 18px;
}

.st-more[hidden] {
  display: none;
}

/* 390 宽下一行要塞下「名字 + 口令标注 + 状态 + 内存 + 箭头」，
   默认间距会把名字挤换行，窄屏收紧一档 */
@media (max-width: 560px) {
  .st-svc {
    gap: 8px;
  }
  .st-svc-name {
    font-size: 13px;
  }
}

.st-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.st-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 13px 15px;
}

.st-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.st-metric-name {
  font-size: 12.5px;
  color: var(--text-2);
}

.st-metric-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 读不到数值时用红字标出来，别让人以为真的一点没占用 */
.st-metric-value[data-level="down"] {
  color: var(--danger);
}

.st-metric-sub {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.st-bar {
  margin-top: 9px;
  height: 5px;
  border-radius: 999px;
  background: rgba(28, 30, 50, 0.07);
  overflow: hidden;
}

.st-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #17a673;
  transition: width 0.3s ease;
}

.st-bar[data-level="warn"] .st-bar-fill {
  background: #d98324;
}

.st-bar[data-level="down"] .st-bar-fill {
  background: var(--danger);
}

.st-rows {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 16px;
}

.st-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.st-row:first-child {
  border-top: 0;
}

.st-row-label {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-row-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  /* 备份文件名可能很长，留出省略号，别把右边的份数挤掉 */
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-row-value[data-level="warn"] {
  color: #9a6414;
}

.st-row-value[data-level="down"] {
  color: var(--danger);
}

.st-row-extra {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* .tool-card 自己写了 display:flex，比 UA 的 [hidden]{display:none} 优先级高，
   不加 !important 的话搜索过滤时卡片藏不住。 */
[hidden] {
  display: none !important;
}

@media (max-width: 560px) {
  .searchbar {
    width: 100%;
    margin: 16px 0 18px;
    padding: 10px 14px;
    gap: 9px;
    /* 全宽时胶囊两端的弧度太抢眼，和上下 16px 圆角的卡片不协调 */
    border-radius: 14px;
  }

  /* iOS 上输入框小于 16px 会在聚焦时把整页放大，这里按 16 兜底，
     顺带让触控区域够高 */
  .searchbar input {
    font-size: 16px;
  }

  /* 手机没有物理键盘，/ 快捷键的提示没有意义 */
  .searchbar kbd {
    display: none;
  }

  .st-verdict {
    flex-wrap: wrap;
  }

  .st-verdict-time {
    width: 100%;
    margin-left: 18px;
  }

  .st-row {
    flex-wrap: wrap;
  }

  .st-row-extra {
    width: 100%;
  }
}

/* 空框时 placeholder 不该被字距拉开，8px 只在输入后用来显示圆点间距 */
.login-card input:not(:placeholder-shown) {
  letter-spacing: 8px;
}


/* ---------- 今日要闻 ---------- */
.news {
  margin-top: 24px;
}

.news-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.news-head .group-title {
  margin: 0;
}

.news-meta {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
}

.news-body {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.news-lead {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.news-lead.no-summary {
  padding-bottom: 0;
}

.news-lead-title {
  display: block;
  margin: 8px 0 7px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  text-decoration: none;
}

.news-lead-title:hover {
  color: var(--brand);
}

.news-lead-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.news-item-title {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  text-decoration: none;
}

.news-item-title:hover {
  color: var(--brand);
}

/* 标题现在取新闻原文，长的能到四十多字，不限制的话一条就能把列表撑开两行；
   两行足够放下，超出的用省略号收掉，全文还在 DOM 里，选中复制不受影响 */
.news-lead-title,
.news-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}

.news-cat {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.news-cat.cat-tech {
  background: rgba(108, 92, 231, 0.1);
  color: var(--brand-dark);
}

.news-cat.cat-fin {
  background: var(--teal-soft);
  color: var(--teal);
}

.news-cat.cat-industry {
  background: var(--amber-soft);
  color: var(--amber);
}

.news-cat.cat-policy {
  background: var(--blue-soft);
  color: var(--blue);
}

.news-cat.cat-intl {
  background: var(--slate-soft);
  color: var(--slate);
}

.news-cat.cat-sport {
  background: var(--rose-soft);
  color: var(--rose);
}

.news-empty {
  font-size: 13px;
  color: var(--text-3);
}

.more-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.more-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ---------- 同花顺热榜 ---------- */
.up { color: var(--danger); }
.down { color: var(--teal); }
.flat { color: var(--text-2); }

.shell.wide { max-width: 1120px; }

/* 页头 */
.hot-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.hot-head h1 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.hot-head p { margin: 0; font-size: 13px; color: var(--text-2); }
.hot-phase {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; background: var(--slate-soft); color: var(--slate);
}
.hot-phase.live { background: rgba(192, 57, 43, 0.1); color: var(--danger); }
.hot-phase.live::before {
  content: ""; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%;
  background: var(--danger); animation: hotPulse 1.8s ease-in-out infinite;
}
@keyframes hotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.hot-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.hot-clock { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hot-clock-note { font-size: 11px; color: var(--text-3); }

.hot-warn { margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--amber-soft); color: #8a5a12; font-size: 12px; }

/* 日期条 */
.hot-day-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.hot-day-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.hot-day-pick select {
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-family: inherit;
  font-size: 12.5px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.hot-day-pick select:focus { outline: none; border-color: var(--brand); }
.hot-day-pick select:disabled { color: var(--text-3); cursor: default; }
.hot-day-sum { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hot-day-sum .hot-day-avg { font-weight: 650; }
.hot-day-sum .hot-day-filter { font-weight: 650; color: var(--brand); }

/* 题材集中：一眼看出今天资金在炒哪几个方向，点一下只剩这类票 */
.hot-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.hot-tags-label { margin-right: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.hot-tag {
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2);
  font-family: inherit; font-size: 11.5px; line-height: 1.55; white-space: nowrap; cursor: pointer;
}
.hot-tag:hover { border-color: var(--brand); color: var(--brand); }
.hot-tag.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.hot-tag.more { border-style: dashed; color: var(--text-3); }
.hot-search {
  width: 180px; margin-left: auto; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 12px;
}
.hot-search:focus { outline: none; border-color: var(--brand); }

/* 榜单表格 */
.hot-table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* 八列的下限宽度：窗口比这窄就交给外框横向滚动，别把列压到裁字 */
.hot-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hot-table thead th {
  position: sticky; top: 0; z-index: 1; padding: 9px 10px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; color: var(--text-3);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
/* 可排序的列：点一次倒序，再点回正序，方向靠箭头表示 */
.hot-table thead th[data-sort] { cursor: pointer; user-select: none; }
.hot-table thead th[data-sort]:hover { color: var(--text-2); }
.hot-table thead th.sorted { color: var(--text); }
.hot-table thead th.sorted::after { content: " ↑"; font-size: 10px; }
.hot-table thead th.sorted[data-dir="desc"]::after { content: " ↓"; }
.hot-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
/* 单元格的默认色是 .hot-table td 给的，特异性压过 .up/.down，涨跌色得在这里补一遍 */
.hot-table td.up { color: var(--danger); }
.hot-table td.down { color: var(--teal); }
.hot-table td.flat { color: var(--text-2); }
.hot-table tbody tr:last-child td { border-bottom: 0; }
.hot-row:hover { background: var(--surface-2); }
.c-rank { width: 44px; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  padding: 0 5px; border-radius: 7px; font-size: 11.5px; color: var(--text-3);
}
.rank-badge.top { background: var(--brand); color: #fff; font-weight: 600; }
.name-text { color: var(--text); font-weight: 500; text-decoration: none; }
.name-text:hover { color: var(--brand); text-decoration: underline; }
.name-sub { margin-top: 1px; }
.code-text { font-size: 11px; color: var(--text-3); }
.c-price { color: var(--text-2); }
.c-pct { font-size: 13.5px; font-weight: 650; }
.c-turnover { min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
/* 高换手用琥珀色：红色在这张表里已经是「涨」，再用红色会看成涨幅 */
.c-turnover.hot-turn { color: var(--amber); font-weight: 600; }
.c-heat { min-width: 64px; text-align: right; color: var(--text-3); }
.c-move { width: 64px; }
.c-tags { max-width: 280px; }
.tag-chip {
  display: inline-block; margin-right: 4px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 10.5px; color: var(--text-3);
}
.tag-chip.ghost { background: transparent; border-style: dashed; }

.hot-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--text-3); }
.hot-slide-tip { margin: 0 0 10px; font-size: 11.5px; color: var(--text-3); }

.hot-foot { margin-top: 26px; font-size: 11px; line-height: 1.8; color: var(--text-3); }
.hot-foot p { margin: 0; }

/* 首页轻带：只给全榜概况，个股在 /hot */
.hot-strip { margin-top: 18px; }
.hot-strip-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.hot-strip-head .group-title { margin: 0; }
.hot-strip-meta { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.hot-strip-more { margin-left: 12px; font-size: 12px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.hot-strip-more:hover { text-decoration: underline; }
.hot-strip-body {
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.hs-row { display: flex; align-items: center; gap: 22px; }
.hs-barwrap { display: flex; flex-direction: column; gap: 7px; flex: 1 1 220px; min-width: 150px; }
.hs-bar {
  display: flex; height: 10px; overflow: hidden;
  border-radius: 999px; background: var(--surface-2);
}
.hs-bar i { display: block; height: 100%; }
.hs-bar .bar-up { background: var(--danger); }
.hs-bar .bar-flat { background: var(--line); }
.hs-bar .bar-down { background: var(--teal); }
.hs-barcap { display: flex; gap: 10px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.hs-stats { display: flex; align-items: center; gap: 20px; flex: 0 1 auto; min-width: 0; }
.hs-stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hs-label { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.hs-value {
  font-size: 15px; font-weight: 600; line-height: 1.25;
  color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hs-value.up { color: var(--danger); }
.hs-value.down { color: var(--teal); }
.hs-tagline {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3);
}
.hs-tagline a { color: var(--text-2); text-decoration: none; }
.hs-tagline a:hover { color: var(--brand); text-decoration: underline; }

@media (max-width: 680px) {
  .hot-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hot-head-side { flex-direction: row; align-items: center; gap: 6px; }
  .hot-head h1 { font-size: 21px; }
  .hot-day-bar { gap: 8px 10px; }
  .hot-day-pick select { padding: 5px 8px; font-size: 12px; }
  .hot-day-sum { font-size: 11.5px; }
  .hot-search { flex: 1 1 100%; width: auto; margin-left: 0; }
  .hot-table td, .hot-table thead th { padding: 7px 8px; }
  .hot-table thead th { letter-spacing: 0; }
  /* 窄屏不砍列：表格自带下限宽度，剩下的列横向滑出来看 */
  .c-tags { max-width: 170px; }
  .hs-row { flex-direction: column; align-items: stretch; gap: 12px; }
  /* 纵向布局下 flex-basis 会变成高度，必须复位，否则分布条那段会撑出两百多像素空白 */
  .hs-barwrap { flex: 0 0 auto; }
  .hs-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
}

@media (max-width: 560px) {
  .rank-badge { min-width: 20px; height: 20px; }
  .hot-table { font-size: 12px; }
}
