:root {
  --primary-color: #1a9b8e;
  --secondary-color: #5ec4b8;
  --accent-color: #c4a574;
  --light-color: #f7fafb;
  --dark-color: #1a2332;
  --gray-color: #4a5568;
  --success-color: #00b894;
  --warning-color: #fdcb6e;
  --danger-color: #e17055;
  --info-color: #0984e3;
  --page-bg: #eef3f4;
  --card-bg: #ffffff;
  --border-radius-lg: 18px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.08);
  --shadow-subtle: 0 6px 18px rgba(15, 23, 42, 0.04);
  --transition: all 0.3s linear;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --site-header-h: 80px;
  --jp-enter-ease: linear;
  --jp-enter-dur: 0.52s;
  --jp-enter-dist: 14px;
  --jp-enter-stagger: 0.08s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
}

body {
  font-family: "Noto Sans SC", sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
  background: transparent;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  margin-bottom: 1rem;
}

.container {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  background-color: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  animation: jp-enter-fade var(--jp-enter-dur) var(--jp-enter-ease) both;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  gap: 1rem;
}

.logo {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  letter-spacing: 0.03em;
  font-family: "Sora", sans-serif;
}

.logo i { display: none; }
.logo .logo-mark {
  width: 36px;
  height: 36px;
  margin-right: 10px;
  flex-shrink: 0;
  display: block;
  opacity: 1;
  visibility: visible;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  justify-content: flex-end;
}

.nav-links li {
  margin-left: 0.75rem;
  display: flex;
  align-items: center;
}

.mobile-menu-btn {
  display: none;
  appearance: none;
  border: 1px solid #e0e4f0;
  background: #fff;
  color: var(--dark-color);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.15rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1201;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--gray-color);
  font-weight: 500;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 5px 0;
  position: relative;
  transition: var(--transition);
}

.nav-tab:hover,
.nav-tab.active {
  color: var(--primary-color);
}

.nav-tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.nav-tab:hover::after,
.nav-tab.active::after {
  width: 100%;
}

.nav-summary {
  font-size: 0.88rem;
  color: var(--gray-color);
}

.page-main {
  padding: 110px 0 48px;
  flex: 1 0 auto;
  animation: jp-enter calc(var(--jp-enter-dur) + 0.04s) var(--jp-enter-ease) var(--jp-enter-stagger) both;
}

.tool-shell {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.tool-header {
  text-align: center;
  margin-bottom: 22px;
}

.tool-header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--dark-color);
}

.subtitle {
  font-size: 1rem;
  color: var(--gray-color);
}

.host-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: 0.92rem;
  color: var(--dark-color);
}

.host-metrics .hm-item {
  white-space: nowrap;
}

.host-metrics .hm-label {
  color: var(--gray-color);
  margin-right: 4px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .host-metrics {
    gap: 8px 12px;
    font-size: 0.84rem;
  }
}

.process-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.85rem;
  align-items: center;
  margin-bottom: 1.35rem;
  padding: 0.85rem 1rem;
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-subtle);
}

.process-toolbar .search-box {
  flex: 1 1 220px;
  min-width: 180px;
  position: relative;
}

.process-toolbar .search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-color);
  font-size: 0.9rem;
}

.process-toolbar .search-box input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: none;
  border-radius: 999px;
  background: var(--light-color);
  box-shadow: inset 0 0 0 1px #e5e7ef;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

.process-toolbar .search-box input:focus {
  box-shadow: inset 0 0 0 1px var(--secondary-color), 0 0 0 3px rgba(26, 155, 142, 0.12);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  appearance: none;
  border: 1px solid #e0e4f0;
  background: #fff;
  color: var(--gray-color);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover,
.chip.active {
  color: var(--primary-color);
  border-color: var(--secondary-color);
  background: #eef0ff;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-left: auto;
}

#tab-runtime.runtime-layout,
.svc-config-runtime {
  min-height: 0;
}

.login-view {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.login-card {
  width: min(420px, 100%);
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

input[type="password"],
input[type="text"],
input[type="search"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
.param-controls input {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e5e7ef;
  color: #333;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
}

input[type="datetime-local"],
input[type="date"],
input[type="time"] {
  min-height: 46px;
  color-scheme: light;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  margin-left: 8px;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 0.9;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.4 0.6L6 5.2 10.6 0.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

input:focus,
select:focus {
  box-shadow: inset 0 0 0 1px var(--secondary-color), 0 0 0 3px rgba(26, 155, 142, 0.15);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  background: var(--primary-color);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.btn-primary { background: var(--primary-color); }
.btn-ok { background: var(--success-color); }
.btn-danger { background: #f97373; }

.btn-ghost {
  background: transparent;
  color: var(--gray-color);
  border: 1px solid #e0e4f0;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--primary-color);
  border-color: var(--secondary-color);
  box-shadow: var(--shadow-subtle);
  background: #fff;
}

.btn-ghost:disabled {
  background: transparent;
  color: #b0b6c3;
  border-color: #eceff5;
}

.btn-target {
  background: #eef0ff;
  color: var(--primary-color);
  border: 2px solid transparent;
  font-weight: 600;
}

.btn-target.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #fff;
}

.btn-cmd {
  background: var(--light-color);
  color: var(--dark-color);
  border-radius: var(--border-radius-md);
  text-align: left;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 76px;
  padding: 14px 16px;
  box-shadow: var(--shadow-subtle);
}

.btn-cmd:hover:not(:disabled) {
  box-shadow: var(--shadow-soft);
}

.btn-cmd .cmd-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-cmd .cmd-desc {
  font-size: 0.78rem;
  color: var(--gray-color);
  font-weight: 400;
  line-height: 1.35;
}

.btn-cmd.danger {
  background: #fff7f5;
  box-shadow: inset 0 0 0 1px #f5c6bb;
}

.error {
  color: var(--danger-color);
  font-size: 0.9rem;
  margin-top: 12px;
  text-align: center;
}

.group {
  margin-bottom: 1.85rem;
}

.group:last-child {
  margin-bottom: 0;
}

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
  margin-bottom: 10px;
}

.group h2 {
  font-size: 1.08rem;
  color: var(--primary-color);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group h2::before {
  content: "";
  width: 4px;
  height: 1em;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
}

.group-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-color);
  margin-left: 4px;
}

.group-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.group-col-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-color);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.group-batch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.group-band-body {
  /* 按桌面 4 列密度占位：2 张卡 = 半行宽，4 张卡 = 整行，不单独拉宽 */
  --band-gap: 1.15rem;
  --band-ref-cols: 4;
  width: min(
    100%,
    calc(
      (100% - (var(--band-ref-cols) - 1) * var(--band-gap)) / var(--band-ref-cols) * var(--band-cards, 4)
        + (var(--band-cards, 4) - 1) * var(--band-gap)
    )
  );
  max-width: 100%;
}

.group-band-toolbar {
  display: grid;
  grid-template-columns: repeat(var(--band-cols, 2), minmax(0, 1fr));
  gap: 0.55rem var(--band-gap, 1.15rem);
  margin-bottom: 0.65rem;
  align-items: end;
}

.group-band-head {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1.15rem;
  align-items: stretch;
}

.cards-band {
  grid-template-columns: repeat(var(--band-cards, 4), minmax(0, 1fr));
  gap: var(--band-gap, 1.15rem);
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-subtle);
  padding: 1.35rem 1.3rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: stretch;
  height: 100%;
  min-height: 250px;
  transition: var(--transition);
}

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

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef0ff;
  color: var(--primary-color);
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
}

.card-icon.on {
  background: rgba(0, 184, 148, 0.12);
  color: var(--success-color);
}

.card-icon.off {
  background: rgba(225, 112, 85, 0.12);
  color: var(--danger-color);
}

.card-title {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.3;
  color: var(--dark-color);
  margin-bottom: 0;
}

.svc-name {
  flex: 1 1 auto;
  min-width: 0;
}

.status-dot {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef0f6;
  color: var(--gray-color);
  flex-shrink: 0;
}

.badge.on {
  background: rgba(0, 184, 148, 0.12);
  color: var(--success-color);
}

.badge.off {
  background: rgba(225, 112, 85, 0.12);
  color: var(--danger-color);
}

.badge.warn {
  background: rgba(253, 203, 110, 0.22);
  color: #b7791f;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--gray-color);
  line-height: 1.55;
  flex: 1 1 auto;
  min-height: 2.7em;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--gray-color);
  font-family: var(--mono);
  word-break: break-all;
  line-height: 1.45;
  min-height: 1.45em;
}

.card-meta .port {
  display: inline-block;
  margin-right: 0.35rem;
}

.card-meta .port.on { color: var(--success-color); }
.card-meta .port.off { color: var(--danger-color); }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  justify-content: flex-start;
  align-items: center;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #eef0f6;
}

.card-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--primary-color);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.card-link:hover:not(:disabled) {
  color: #4553b0;
  gap: 0.4rem;
}

.card-link:disabled {
  color: #b0b6c3;
  cursor: not-allowed;
}

.card-link.danger {
  color: #e17055;
}

.card-link.danger:hover:not(:disabled) {
  color: #d63031;
}

.card-link.ok {
  color: var(--success-color);
}

.card-more {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid #eef0f5;
  /* 预留最多 3 行按钮，避免 GQ 主服/备服多两格时把同行卡片撑得参差 */
  min-height: calc(3 * 2.05rem + 2 * 0.4rem);
  align-content: start;
}

.card-more .btn {
  width: 100%;
  justify-content: center;
  margin: 0;
  padding: 0.45rem 0.25rem;
  font-size: 0.75rem;
  border-radius: 10px;
  min-height: 2.05rem;
  white-space: nowrap;
}

.card-more .btn i {
  font-size: 0.72rem;
}

@media (max-width: 520px) {
  .card-more {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .card-more {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.empty-hint {
  text-align: center;
  color: var(--gray-color);
  padding: 2.5rem 1rem;
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-subtle);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 2000;
  box-shadow: var(--shadow-soft);
  max-width: min(90vw, 420px);
  text-align: center;
}

/* 仅 .show 时显示；勿用 :not([hidden])，空 toast 会变成底部黑点 */
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.toast.ok {
  background: #0f766e;
}

.toast.err {
  background: #b91c1c;
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

#detail-dialog .detail-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.55rem 0.85rem;
  padding: 16px 18px 20px;
  font-size: 0.9rem;
}

#detail-dialog .detail-grid dt {
  color: var(--gray-color);
}

#detail-dialog .detail-grid dd {
  margin: 0;
  word-break: break-all;
  font-family: var(--mono);
  font-size: 0.82rem;
}

#peek-body {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  min-height: 240px;
  max-height: 55vh;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b1220;
  color: #e5e7eb;
}

.log-file-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--gray-color);
}

.log-file-pick select {
  min-width: 180px;
  max-width: min(420px, 70vw);
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #e0e4f0;
  background: #fff;
  font-family: inherit;
  font-size: 0.82rem;
}

.cache-list {
  padding: 12px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 60vh;
  overflow: auto;
}

.cache-item {
  background: var(--light-color);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-subtle);
}

.cache-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.cache-item-head strong {
  font-size: 0.92rem;
}

.cache-item pre {
  margin: 0;
  max-height: 160px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  background: #fff;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0;
  flex: 1;
  min-width: 260px;
}

.status-item {
  background: var(--light-color);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-subtle);
}

.status-label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-color);
  margin-bottom: 0.2rem;
}

.status-value {
  font-weight: 600;
  font-size: 1rem;
}

.status-value.up { color: var(--success-color); }
.status-value.down { color: var(--danger-color); }

.runtime-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: stretch;
  margin-bottom: 1.15rem;
}

.target-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.runtime-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 1.15rem;
  align-items: stretch;
  height: min(68vh, 720px);
  min-height: min(68vh, 720px);
}

.runtime-commands {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.runtime-console {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.runtime-console .console-block {
  margin-top: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1220;
  border-radius: var(--border-radius-md);
  padding: 0.85rem 0.9rem 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.runtime-console .console-header {
  flex: 0 0 auto;
  color: #e2e8f0;
}

.cmd-group {
  margin-bottom: 1.1rem;
}

.cmd-group h2 {
  font-size: 0.98rem;
  margin-bottom: 0.55rem;
  color: var(--primary-color);
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #fff 70%, rgba(255, 255, 255, 0));
  padding: 0.15rem 0 0.45rem;
  z-index: 1;
}

.cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.55rem;
}

.param-row {
  margin: 0.5rem 0 0.85rem;
  padding: 0.9rem;
  background: #fff7f5;
  border-radius: var(--border-radius-md);
  box-shadow: inset 0 0 0 1px #f5c6bb;
}

.param-row.raw-cmd-row {
  background: #f5f7ff;
  box-shadow: inset 0 0 0 1px #d5dbf8;
}

.param-row label {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.45rem;
  font-weight: 500;
}

.param-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.param-controls input {
  flex: 1;
  min-width: 140px;
}

.console-block {
  margin-top: 0.5rem;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.data-display,
#console-body {
  margin: 0;
  background: #020617;
  border-radius: var(--border-radius-sm);
  padding: 15px;
  overflow-y: auto;
  min-height: 240px;
  max-height: 420px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e5e7eb;
}

.runtime-console #console-body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 980px) {
  .runtime-split {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .runtime-commands {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .runtime-console {
    height: auto;
    max-height: none;
  }

  .runtime-console .console-block {
    height: auto;
    max-height: none;
  }

  .runtime-console #console-body {
    min-height: 280px;
    max-height: 50vh;
  }
}

dialog {
  border: none;
  border-radius: var(--border-radius-lg);
  background: var(--card-bg);
  color: var(--dark-color);
  width: min(920px, 96vw);
  max-height: 85vh;
  padding: 0;
  box-shadow: var(--shadow-soft);
  /* 居中；避免被全局 header{position:fixed} 影响 */
  position: fixed;
  inset: 0;
  margin: auto;
  max-width: calc(100vw - 24px);
}

#svc-config-dialog.wide {
  width: min(1120px, 98vw);
  max-height: 92vh;
}

#svc-config-dialog.wide .log-panel {
  max-height: 92vh;
}

/* 融合预警 / 融合历史：桌面左右栏，手机竖排可滚动 */
#svc-config-dialog.fused {
  width: min(1120px, 96vw);
  height: min(860px, 92vh);
  max-height: min(860px, 92vh);
}

#svc-config-dialog.fused .svc-config-panel {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#svc-config-pane-fields[hidden],
#svc-config-pane-runtime[hidden],
.svc-config-runtime[hidden],
.svc-config-fields[hidden] {
  display: none !important;
}

dialog:not([open]) {
  display: none;
}

dialog::backdrop {
  background: rgba(45, 52, 54, 0.45);
}

/* 账号等表单弹窗：窄宽度 + 内边距，避免贴边/布局塌陷 */
dialog.modal-dialog {
  width: min(440px, 96vw);
  max-width: calc(100vw - 24px);
  overflow: auto;
}

.modal-dialog .modal-body {
  padding: 22px 24px 20px;
  margin: 0;
  box-sizing: border-box;
}

.modal-dialog .tool-header {
  text-align: left;
  margin-bottom: 1.15rem;
}

.modal-dialog .tool-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--dark-color);
}

.modal-dialog .form-group {
  margin-bottom: 1rem;
}

.modal-dialog .form-group label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--dark-color);
}

.modal-dialog .form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--gray-color);
  line-height: 1.4;
}

.modal-dialog .modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}

/* 弹窗 / 面板内不得使用站点顶栏的 fixed header 样式 */
dialog header,
dialog .log-header,
.mysql-panel-head,
.mysql-panel > header {
  position: static;
  width: auto;
  top: auto;
  z-index: auto;
  background: transparent;
  box-shadow: none;
}

.log-panel {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  min-height: 0;
}

.log-header,
.log-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  flex: 0 0 auto;
}

.log-header {
  border-bottom: 1px solid #eef0f6;
}

.log-footer {
  border-top: 1px solid #eef0f6;
  flex-wrap: wrap;
}

.log-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--success-color);
  margin-left: 8px;
}

.log-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.2);
  animation: log-pulse 1.4s ease-in-out infinite;
}

@keyframes log-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

#log-body {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
  height: min(55vh, 560px);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b1220;
  color: #e5e7eb;
}

@media (max-width: 1024px) {
  .mobile-menu-btn { display: inline-flex; }
  header nav {
    padding: 12px 0;
  }
  .nav-links {
    position: fixed;
    top: 68px;
    left: -100%;
    width: min(360px, 100%);
    height: calc(100dvh - 68px);
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 12px 16px 28px;
    overflow-y: auto;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.12);
    z-index: 1100;
    transition: left 0.28s ease;
  }
  .nav-links.active { left: 0; }
  .nav-links li {
    margin: 0;
    width: 100%;
  }
  .nav-links .nav-tab,
  .nav-links .btn,
  .nav-links .nav-summary {
    width: 100%;
    justify-content: flex-start;
  }
  .nav-tab {
    padding: 10px 4px;
    font-size: 1rem;
  }
  .page-main { padding-top: 96px; }
  .container { padding: 0 16px; }
  .cards,
  .routes-grid,
  #users-list.routes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .group-band-body {
    --band-ref-cols: 2;
    width: 100%;
  }
  .cards-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .card {
    min-height: 0;
  }

  .batch-actions {
    margin-left: 0;
    width: 100%;
  }

  .logo {
    font-size: 1.25rem;
  }

  .logo i {
    font-size: 1.5rem;
  }

  .tool-header h1 {
    font-size: 1.5rem;
  }

  .cards,
  .routes-grid,
  #users-list.routes-grid {
    grid-template-columns: 1fr;
  }

  .cards-band {
    grid-template-columns: 1fr;
  }

  .group-band-body {
    width: 100%;
  }

  .group-band-toolbar {
    grid-template-columns: 1fr;
  }

  .card-more {
    min-height: 0;
  }

  .container { padding: 0 14px; }
  .process-toolbar { padding: 0.75rem 0.8rem; }
  dialog { width: min(920px, 100vw); max-width: 100vw; border-radius: 16px 16px 0 0; margin: auto auto 0; max-height: 92dvh; }
  .log-panel { max-height: 92dvh; }
}

.routes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.ip-settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

@media (max-width: 1100px) {
  .ip-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ip-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* —— 通用服务/账号卡片 —— */
.svc-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-subtle);
  padding: 1.15rem 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.svc-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}

.svc-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid #eef0f5;
}

.svc-actions .btn {
  width: 100%;
  justify-content: center;
  margin: 0;
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 0.48rem 0.35rem;
  border-radius: 10px;
  min-height: 2.15rem;
}

.svc-actions .btn i {
  font-size: 0.78rem;
}

@media (max-width: 420px) {
  .svc-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* —— 账号卡片排版 —— */
#users-list.routes-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.1rem;
}

.acc-card.is-disabled {
  opacity: 0.78;
}

.acc-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.acc-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef0ff;
  color: var(--primary-color);
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.acc-head-main {
  min-width: 0;
  flex: 1;
}

.acc-title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.acc-name {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--dark-color);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-badges {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem;
  flex: 0 0 auto;
}

.chip-xs {
  padding: 0.08rem 0.42rem;
  font-size: 0.68rem;
  line-height: 1.35;
  border-radius: 999px;
}

.acc-sub {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.chip-role {
  background: #eef0ff;
  border-color: #d9def7;
  color: var(--primary-color);
  font-weight: 600;
}

.chip-ok {
  background: rgba(0, 184, 148, 0.1);
  border-color: rgba(0, 184, 148, 0.25);
  color: #0f766e;
}

.chip-warn {
  background: #fde8e4;
  border-color: #f5c6bc;
  color: #c0392b;
}

.chip-amber {
  background: #fff3cd;
  border-color: #f5e0a0;
  color: #92400e;
}

.acc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
  margin: 0;
  padding: 0.7rem 0.8rem;
  background: #f7f8fc;
  border-radius: 12px;
}

.acc-meta > div {
  min-width: 0;
}

.acc-meta dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #94a3b8;
  margin: 0 0 0.15rem;
}

.acc-meta dd {
  margin: 0;
  font-size: 0.84rem;
  color: var(--dark-color);
  word-break: break-word;
  line-height: 1.35;
}

.acc-meta-soft {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.74rem;
  color: #94a3b8;
  font-weight: 400;
}

.acc-meta-detail {
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
}

.acc-pwd {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.acc-pwd-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

.acc-pwd-val {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  user-select: all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-perm-btn {
  flex: 0 0 auto;
  border-radius: 999px !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.78rem !important;
  white-space: nowrap;
}

.acc-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.acc-perm {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5e7ef;
  font-size: 0.72rem;
  color: #475569;
  max-width: 100%;
}

.acc-perm-more {
  background: #eef0ff;
  border-color: #d9def7;
  color: var(--primary-color);
  font-weight: 600;
}

.acc-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid #eef0f5;
}

.acc-actions .btn {
  width: 100%;
  justify-content: center;
  margin: 0;
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 0.48rem 0.35rem;
  border-radius: 10px;
  min-height: 2.15rem;
}

.acc-actions .btn i {
  font-size: 0.78rem;
}

/* 最后一行复制+删除占满剩余两列对齐 */
.acc-actions .btn[data-copy-user] {
  grid-column: 1;
}

.acc-actions .btn[data-del] {
  grid-column: 2;
}

@media (max-width: 420px) {
  .acc-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .acc-actions .btn[data-copy-user],
  .acc-actions .btn[data-del] {
    grid-column: auto;
  }
}

.acc-detail-block {
  margin-top: 0.85rem;
}

.acc-detail-title {
  font-size: 0.8rem;
  margin: 0 0 0.4rem;
  color: #64748b;
  font-weight: 600;
}

@media (max-width: 520px) {
  .acc-meta {
    grid-template-columns: 1fr;
  }
}

.route-card .route-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent, #2563eb);
  margin-left: 0.35rem;
}

.route-card.is-off {
  opacity: 0.72;
}

.route-url {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.78rem;
  word-break: break-all;
  margin: 0.5rem 0 0.25rem;
  color: #334155;
}

.route-sources-line {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 0.75rem;
}

.route-form {
  display: grid;
  gap: 0.75rem;
  padding: 0.5rem 1rem 1rem;
}

.route-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.route-form label[hidden],
#route-mag-wrap[hidden] {
  display: none !important;
}

.route-form .route-enabled {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}

.route-form input,
.route-form select {
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}

.route-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.src-chip {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #f8fafc;
}

.detail-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.85rem;
}

.svc-config-body {
  padding: 0.55rem 1rem 0.35rem;
  display: grid;
  gap: 0.55rem;
  max-height: 55vh;
  overflow: auto;
}

.svc-config-section-head {
  flex: 0 0 auto;
  padding: 0.65rem 1rem 0.15rem;
}

.svc-config-section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--primary-color);
  font-weight: 700;
}

.svc-config-fields {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 0 auto;
  overflow: hidden;
  border-bottom: 1px solid #eef0f6;
}

.svc-config-tabs {
  display: none !important;
}

.svc-config-runtime {
  padding: 0 0 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  flex: 1 1 auto;
}

.svc-config-runtime .runtime-toolbar {
  margin: 0.55rem 1rem 0.65rem;
  flex: 0 0 auto;
}

.svc-config-runtime .runtime-split {
  margin: 0 1rem 0.5rem;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}

/* 融合：顶栏状态卡 + 命令/结果；桌面双栏，手机单列 */
#svc-config-dialog.fused .svc-config-fields {
  display: none !important;
}

#svc-config-dialog.fused .svc-config-runtime {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#svc-config-dialog.fused .svc-config-runtime .runtime-toolbar {
  display: block;
  flex: 0 0 auto;
}

#svc-config-dialog.fused .svc-config-runtime .status-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  min-width: 0;
  margin: 0;
  max-width: 420px;
}

#svc-config-dialog.fused .svc-config-runtime .runtime-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.85fr);
  gap: 1rem;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

#svc-config-dialog.fused .runtime-commands {
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0.25rem;
  overscroll-behavior: contain;
}

#svc-config-dialog.fused .runtime-console {
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
}

#svc-config-dialog.fused .runtime-console .console-block {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}

#svc-config-dialog.fused .runtime-console #console-body {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: none;
}

#svc-config-dialog.fused .cmd-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

@media (max-width: 900px) {
  #svc-config-dialog.fused {
    width: min(96vw, 720px);
    height: auto;
    max-height: 94vh;
  }

  #svc-config-dialog.fused .svc-config-panel {
    height: auto;
    max-height: 94vh;
    overflow: auto;
  }

  #svc-config-dialog.fused .svc-config-runtime {
    overflow: visible;
  }

  #svc-config-dialog.fused .svc-config-runtime .runtime-split {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  #svc-config-dialog.fused .runtime-commands {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  #svc-config-dialog.fused .runtime-console .console-block {
    min-height: 180px;
    max-height: 36vh;
  }

  #svc-config-dialog.fused .runtime-console #console-body {
    min-height: 140px;
    max-height: 32vh;
  }

  #svc-config-dialog.fused .cmd-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 560px) {
  #svc-config-dialog.fused {
    width: calc(100vw - 16px);
  }

  #svc-config-dialog.fused .svc-config-runtime .status-bar {
    grid-template-columns: 1fr;
    max-width: none;
  }

  #svc-config-dialog.fused .cmd-grid {
    grid-template-columns: 1fr;
  }
}

.svc-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(9rem, 13rem);
  gap: 0.45rem 1rem;
  align-items: center;
  padding: 0.8rem 0.95rem;
  background: #f7fafb;
  border-radius: var(--border-radius-md);
  box-shadow: inset 0 0 0 1px #e6ecee;
}

.svc-config-meta {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.svc-config-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark-color);
}

.svc-config-row .hint {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.35;
}

/* 兼容密钥弹窗等未包 .svc-config-meta 的旧结构 */
.svc-config-row > .hint {
  grid-column: 1 / -1;
}

.svc-config-row input[type="number"],
.svc-config-row input[type="text"],
.svc-config-row input[type="password"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #dbe3e6;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  box-sizing: border-box;
}

.svc-config-row input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(26, 155, 142, 0.12);
}

.svc-config-footer {
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: space-between;
  align-items: center;
}

.svc-config-footer-opts,
.svc-config-footer-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
}

.svc-config-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #475569;
  margin-right: 0;
}

.svc-config-check input:disabled + span,
.svc-config-check:has(input:disabled) {
  opacity: 0.55;
}

@media (max-width: 720px) {
  .svc-config-row {
    grid-template-columns: 1fr;
  }
}

/* —— 顶栏用户菜单 —— */
.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.55rem 0.25rem 0.25rem;
  border: 1px solid #e8eaf0;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.user-menu-btn:hover { border-color: #cfd5ee; box-shadow: var(--shadow-subtle); }
.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a9b8e, #5ec4b8);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.7rem; color: #64748b; }
.user-caret { font-size: 0.65rem; color: #94a3b8; margin: 0 0.2rem; }
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 11rem;
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 0.35rem;
  z-index: 1200;
}
.user-drop-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  background: transparent;
  border-radius: 8px;
  text-decoration: none;
  color: var(--dark-color);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
}
.user-drop-item:hover { background: #eef3f4; color: var(--primary-color); }

/* —— 登录风险提示 —— */
.risk-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.risk-card { max-width: 28rem; }
.risk-card .risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #fff3cd;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.profile-edit-shell {
  box-shadow: none;
  border: 1px solid #e8eaf0;
  border-radius: 16px;
  background: #fff;
  padding: 1.25rem 1.35rem 1.35rem;
}

.profile-edit-shell .tool-header {
  text-align: left;
  margin-bottom: 1rem;
}

.profile-edit-shell .form-group {
  margin-bottom: 1rem;
}

/* —— 个人中心布局 —— */
.profile-hero {
  background: linear-gradient(135deg, #eef0ff 0%, #f7fafb 55%, #fff 100%);
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-subtle);
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.profile-hero-avatar {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1a9b8e;
  color: #fff;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  box-shadow: 0 8px 18px rgba(26, 155, 142, 0.28);
}

.profile-hero-text {
  min-width: 0;
}

.profile-hero-text h1 {
  margin: 0 0 0.2rem;
  font-size: 1.65rem;
  line-height: 1.25;
}

.profile-hero-text .subtitle {
  margin: 0;
  font-size: 0.92rem;
}

.profile-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.9fr);
  gap: 1.1rem;
  align-items: start;
}

.profile-main-col,
.profile-side-col {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

.profile-panel {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 16px;
  padding: 1.2rem 1.3rem 1.25rem;
  box-shadow: var(--shadow-subtle);
}

.profile-panel-head {
  margin-bottom: 1rem;
}

.profile-panel-head h2 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.profile-panel-head h2 i {
  color: var(--primary-color);
  font-size: 0.95rem;
}

.profile-panel-head p {
  margin: 0;
  color: var(--gray-color);
  font-size: 0.86rem;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.profile-form-grid .profile-span-2 {
  grid-column: 1 / -1;
}

.profile-form-grid textarea,
.profile-panel textarea {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e5e7ef;
  color: #333;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 84px;
  box-sizing: border-box;
}

.profile-form-grid textarea:focus,
.profile-panel textarea:focus {
  box-shadow: inset 0 0 0 1px var(--secondary-color), 0 0 0 3px rgba(26, 155, 142, 0.15);
}

.profile-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.profile-ok {
  margin-top: 0.65rem;
  color: var(--success-color);
  font-size: 0.88rem;
}

.profile-side-body {
  font-size: 0.9rem;
}

.profile-side-body .acc-meta {
  background: #f7f8fc;
}

@media (max-width: 960px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .profile-form-grid {
    grid-template-columns: 1fr;
  }
  .profile-form-grid .profile-span-2 {
    grid-column: auto;
  }
  .profile-hero-main {
    align-items: flex-start;
  }
}

/* —— CEA 防滥用设置 —— */
.cea-abuse-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cea-abuse-head {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-subtle);
  padding: 1.15rem 1.25rem;
}

.cea-abuse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.cea-abuse-section {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-subtle);
  padding: 1.1rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.cea-abuse-section h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark-color);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cea-abuse-section h3 i {
  color: var(--primary-color, #4a6cf7);
  font-size: 0.88rem;
  opacity: 0.9;
}

.cea-abuse-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.75rem;
}

.cea-abuse-fields .cea-abuse-span-2 {
  grid-column: 1 / -1;
}

.cea-abuse-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.3rem;
}

.cea-abuse-field input[type="number"] {
  width: 100%;
  padding: 0.48rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
}

.cea-abuse-field input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color, #4a6cf7);
  box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.12);
}

.cea-abuse-foot {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-subtle);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.cea-abuse-read-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1100px) {
  .cea-abuse-grid,
  .cea-abuse-read-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .cea-abuse-grid,
  .cea-abuse-read-grid {
    grid-template-columns: 1fr;
  }
  .cea-abuse-fields {
    grid-template-columns: 1fr;
  }
  .cea-abuse-fields .cea-abuse-span-2 {
    grid-column: auto;
  }
  .cea-abuse-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .cea-abuse-foot .btn {
    width: 100%;
  }
}

/* MySQL 数据库页 — 对齐 API 文档：左侧 sticky 导航 + 右侧通栏 panel */
#tab-mysql.mysql-layout {
  margin: 0;
  width: 100%;
  min-width: 0;
}

.mysql-docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  min-width: 0;
  width: 100%;
}

.mysql-sidebar {
  position: sticky;
  top: calc(var(--site-header-h, 80px) + 12px);
  height: calc(100vh - var(--site-header-h, 80px) - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 4px 18px 8px 0;
  border-right: 1px solid #e4e7f2;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  min-width: 0;
}

.mysql-side-tools {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.mysql-side-tools input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d8dcec;
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
  background: #fff;
  box-shadow: none;
}

.mysql-side-actions {
  display: flex;
  gap: 0.4rem;
}

.mysql-side-actions .btn {
  flex: 1;
}

.mysql-side-group {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #dde1ef;
}

.mysql-side-group:first-of-type {
  margin-top: 0.35rem;
  padding-top: 0;
  border-top: none;
}

.mysql-side-group-title {
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 0 0 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mysql-side-status {
  padding: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-color);
}

.mysql-sources {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
}

.mysql-side-path {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 9px 10px 9px 9px;
  margin: 0;
  color: var(--gray-color);
  font-size: 0.92rem;
  line-height: 1.35;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

.mysql-side-path:hover {
  color: var(--primary-color);
  background: transparent;
  border-left-color: rgba(159, 168, 255, 0.8);
}

.mysql-side-path.active {
  color: var(--primary-color);
  font-weight: 600;
  border-left-color: var(--primary-color);
  background: linear-gradient(90deg, rgba(26, 155, 142, 0.08), transparent);
}

.mysql-side-path code {
  display: inline-block;
  width: fit-content;
  font-size: 0.88rem;
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  margin: 0;
  font-weight: 600;
  font-family: var(--mono);
}

.mysql-side-path .path-label {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
}

.mysql-side-path.active .path-label {
  color: #7c88c9;
}

.mysql-main {
  min-width: 0;
  width: 100%;
}

.mysql-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid #d8dcec;
  background: #fff;
  color: var(--primary-color);
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font: inherit;
  cursor: pointer;
}

.mysql-panel {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 28px 26px;
  border-top: 3px solid var(--primary-color);
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.mysql-panel > h1 {
  font-size: 1.75rem;
  margin: 0 0 16px;
  color: var(--dark-color);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: Sora, "Noto Sans SC", sans-serif;
}

.mysql-lead {
  color: var(--gray-color);
  margin: 0 0 14px;
  font-size: 0.98rem;
  line-height: 1.65;
}

.mysql-lead[hidden] {
  display: none;
}

.mysql-metrics-slot {
  margin: 0 0 14px;
}

.mysql-metrics-slot:empty {
  display: none;
  margin: 0;
}

.mysql-metrics-slot .host-metrics {
  justify-content: flex-start;
  margin-top: 0;
  width: 100%;
  box-sizing: border-box;
}

.mysql-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.mysql-tabs[hidden] {
  display: none;
}

.mysql-tab {
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--gray-color);
  background: transparent;
  font: inherit;
  font-weight: 500;
  font-size: 0.92rem;
  opacity: 1;
}

.mysql-tab:hover {
  color: var(--primary-color);
  background: transparent;
}

.mysql-tab.active {
  border-bottom-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
  background: transparent;
}

.mysql-detail-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 200px;
}

.mysql-info-box {
  background: var(--light-color);
  border-left: 4px solid var(--secondary-color);
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  padding: 16px 18px;
  color: var(--gray-color);
  margin: 0;
}

.mysql-info-box p {
  margin: 0.35rem 0;
}

.mysql-detail-body .subtitle {
  color: var(--gray-color);
}

.mysql-detail-body .cache-item {
  background: var(--light-color);
  border: 1px solid #eef0f6;
  border-radius: var(--border-radius-md);
  padding: 0.85rem 1rem;
}

.mysql-detail-body .cache-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.mysql-detail-body .cache-item-head strong {
  color: var(--dark-color);
  font-size: 0.98rem;
}

.mysql-detail-body pre {
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.55;
  background: #111827;
  color: #f9fafb;
  border-radius: var(--border-radius-sm);
  border-left: 4px solid var(--secondary-color);
  padding: 12px 14px;
  overflow-x: auto;
}

.mysql-edit-textarea {
  width: 100%;
  min-height: 320px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
  resize: vertical;
}

@media (max-width: 1024px) {
  .mysql-docs {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
  }

  .mysql-panel {
    padding: 22px 18px;
  }
}

@media (max-width: 900px) {
  .mysql-docs {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .mysql-sidebar {
    position: static;
    display: none;
    height: auto;
    max-height: none;
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid #e4e7f2;
    padding-bottom: 12px;
    margin-bottom: 8px;
  }

  .mysql-sidebar.open {
    display: block;
  }

  .mysql-mobile-toggle {
    display: inline-flex;
  }

  .mysql-panel {
    padding: 18px 14px;
  }

  .mysql-panel > h1 {
    font-size: 1.28rem;
  }
}


/* Jian Project dynamic atmosphere */
.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 50% 42%, #f4faf9 0%, #e8f0f1 55%, #dde7e9 100%);
}
.atmosphere .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  will-change: transform, opacity;
}
.atmosphere .orb-a {
  width: min(58vw, 480px);
  height: min(58vw, 480px);
  left: -8%;
  top: -12%;
  background: rgba(26, 155, 142, 0.28);
  animation: jp-orb-a 18s ease-in-out infinite;
}
.atmosphere .orb-b {
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  right: -10%;
  bottom: -8%;
  background: rgba(196, 165, 116, 0.26);
  animation: jp-orb-b 22s ease-in-out infinite;
}
.atmosphere .orb-c {
  width: min(36vw, 300px);
  height: min(36vw, 300px);
  left: 42%;
  top: 58%;
  background: rgba(94, 196, 184, 0.18);
  animation: jp-orb-c 16s ease-in-out infinite;
}
.atmosphere .ripple-field {
  position: absolute;
  left: 58%;
  top: 40%;
  width: 0;
  height: 0;
}
.atmosphere .ripple {
  position: absolute;
  left: 0;
  top: 0;
  width: min(78vw, 620px);
  height: min(78vw, 620px);
  margin-left: calc(min(78vw, 620px) / -2);
  margin-top: calc(min(78vw, 620px) / -2);
  border: 1.5px solid rgba(26, 155, 142, 0.35);
  border-radius: 50%;
  opacity: 0;
  animation: jp-ripple 6.5s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}
.atmosphere .ripple:nth-child(2) {
  border-color: rgba(26, 155, 142, 0.28);
  animation-delay: 2.1s;
}
.atmosphere .ripple:nth-child(3) {
  border-color: rgba(196, 165, 116, 0.32);
  animation-delay: 4.2s;
}
.atmosphere .wave-canvas {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 8%;
  height: 140px;
  opacity: 0.5;
}
.atmosphere .wave-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}
.atmosphere .wave-canvas path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.atmosphere .wave-a {
  stroke: rgba(26, 155, 142, 0.55);
  stroke-width: 1.8;
  animation: jp-wave 12s linear infinite;
}
.atmosphere .wave-b {
  stroke: rgba(196, 165, 116, 0.45);
  stroke-width: 1.4;
  animation: jp-wave 18s linear infinite reverse;
}
.atmosphere .wave-c {
  stroke: rgba(26, 155, 142, 0.28);
  stroke-width: 1.2;
  animation: jp-wave 9s linear infinite;
}
.atmosphere .grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: jp-grain 8s steps(6) infinite;
}
@keyframes jp-orb-a {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
  40% { transform: translate(12%, 18%) scale(1.12); opacity: 1; }
  70% { transform: translate(4%, 28%) scale(0.94); opacity: 0.75; }
}
@keyframes jp-orb-b {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.65; }
  35% { transform: translate(-16%, -12%) scale(1.1); opacity: 0.95; }
  65% { transform: translate(-6%, -22%) scale(0.92); opacity: 0.7; }
}
@keyframes jp-orb-c {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-30%, -70%) scale(1.2); opacity: 0.85; }
}
@keyframes jp-ripple {
  0% { transform: scale(0.18); opacity: 0.55; }
  70% { opacity: 0.18; }
  100% { transform: scale(1); opacity: 0; }
}
@keyframes jp-wave {
  from { transform: translateX(0); }
  to { transform: translateX(-8.33%); }
}
@keyframes jp-grain {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1%, 1%); }
  50% { transform: translate(1%, -1%); }
  75% { transform: translate(-1%, -1%); }
}
@media (max-width: 760px) {
  .atmosphere .ripple-field { left: 50%; top: 28%; }
  .atmosphere .wave-canvas { bottom: 4%; height: 100px; opacity: 0.38; }
}
@media (prefers-reduced-motion: reduce) {
  .atmosphere .orb,
  .atmosphere .ripple,
  .atmosphere .wave-a,
  .atmosphere .wave-b,
  .atmosphere .wave-c,
  .atmosphere .grain {
    animation: none !important;
  }
  .atmosphere .orb { opacity: 0.55; }
  .atmosphere .ripple { opacity: 0.15; transform: scale(0.7); }
  header,
  .page-main,
  .login-view,
  .jp-enter {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

@keyframes jp-enter {
  from {
    opacity: 0;
    transform: translate3d(0, var(--jp-enter-dist), 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
@keyframes jp-enter-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.login-view {
  animation: jp-enter-fade var(--jp-enter-dur) var(--jp-enter-ease) both;
}

main, .page-main, footer { position: relative; z-index: 1; }
header { z-index: 1000; }
.login-view, .tool-shell, .card, .panel-card { position: relative; z-index: 1; }
