:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2a3a52;
  --text: #e8eef5;
  --muted: #8b9cb3;
  --gold: #d4a853;
  --green: #4caf50;
  --red: #f44336;
  --blue: #42a5f5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #121a24;
}
.topbar h1 { margin: 0; font-size: 18px; color: var(--gold); }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 16px;
}
.center { max-width: 400px; margin: 40px auto; }
input, select {
  width: 100%;
  padding: 10px;
  margin: 6px 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1218;
  color: var(--text);
}
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #243044;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.btn.primary { background: linear-gradient(135deg, #c9a227, #8b6914); border: none; color: #111; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.small { padding: 4px 8px; font-size: 12px; margin: 2px; }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: 12px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px; }
.stat {
  flex: 1;
  min-width: 120px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.stat b { display: block; font-size: 22px; color: var(--gold); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
.status-running { color: var(--green); }
.status-queued { color: var(--blue); }
.status-error { color: var(--red); }
.status-idle { color: var(--muted); }
.log-box {
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  height: 320px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.row.between { display: flex; justify-content: space-between; align-items: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 12px; }
#userbar { display: flex; gap: 8px; align-items: center; }
.badge.ok {
  display: inline-block;
  font-size: 11px;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}
.badge.warn {
  display: inline-block;
  font-size: 11px;
  color: #ffb74d;
  border: 1px solid #ffb74d;
  border-radius: 4px;
  padding: 1px 6px;
}
.full-width { grid-column: 1 / -1; margin: 0; }
.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 4px;
}
.actions-cell { white-space: nowrap; }
.admin-section h2 { margin-top: 0; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.settings-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}
.settings-grid input { margin: 0; }
.input-inline {
  width: 56px;
  padding: 4px 6px;
  margin: 0 4px 0 0;
  display: inline-block;
}
.inline-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.admin-table { font-size: 12px; min-width: 640px; }
.admin-table th { white-space: nowrap; background: #121a24; position: sticky; top: 0; }
.admin-table code { font-size: 11px; color: var(--gold); }
.row-disabled { opacity: 0.55; }
.admin-log { height: 280px; margin-top: 8px; }
.status-error { color: var(--red); font-size: 13px; margin-top: 8px; }
.link { color: var(--blue); text-decoration: none; }
.link:hover { text-decoration: underline; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.modal-box {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  width: min(420px, 92vw);
  z-index: 1;
}
.modal-wide { width: min(560px, 92vw); }
.modal-box h3 { margin: 0 0 8px; color: var(--gold); }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
textarea {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1218;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  resize: vertical;
}

/* ===== 花妖风 hy-theme ===== */
.hy-theme {
  --hy-bg1: #1a0f2e;
  --hy-bg2: #2d1b4e;
  --hy-gold: #e8c547;
  --hy-gold2: #c9a227;
  --hy-pink: #ff8fab;
  --hy-card: rgba(35, 22, 58, 0.92);
  --hy-border: rgba(232, 197, 71, 0.25);
  background: linear-gradient(145deg, var(--hy-bg1) 0%, #12081f 40%, var(--hy-bg2) 100%);
  min-height: 100vh;
}
.hy-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hy-border);
  background: rgba(18, 10, 32, 0.85);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}
.hy-brand { font-size: 18px; font-weight: 700; color: var(--hy-gold); flex: 1; min-width: 140px; }
.hy-conn { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.hy-conn-item { display: flex; align-items: center; gap: 4px; }
.conn-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #666;
}
.conn-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.conn-dot.warn { background: #ffb74d; }
.conn-dot.bad { background: var(--red); }
.hy-userbar { display: flex; align-items: center; gap: 8px; }
.hy-who { font-size: 13px; color: var(--hy-gold); }
.hy-login { max-width: 380px; margin: 48px auto; }
.hy-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 768px) {
  .hy-layout { grid-template-columns: 1fr; }
}
.hy-sidebar { height: fit-content; position: sticky; top: 12px; }
.hy-sidebar h3 { margin: 0 0 8px; color: var(--hy-gold); font-size: 15px; }
.hy-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.hy-stat {
  text-align: center;
  padding: 8px 4px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  border: 1px solid var(--hy-border);
}
.hy-stat b { display: block; color: var(--hy-gold); font-size: 14px; }
.hy-stat span { font-size: 10px; color: var(--muted); }
.hy-main-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.hy-main-head h2 { margin: 0; color: var(--hy-gold); font-size: 18px; }
.hy-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hy-card {
  background: var(--hy-card);
  border: 1px solid var(--hy-border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.hy-card-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hy-card-title { font-weight: 600; font-size: 15px; }
.hy-card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hy-card-status { font-size: 12px; font-weight: 600; }
.hy-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; }
.hy-card-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--hy-border);
  border-bottom: 1px solid var(--hy-border);
  margin-bottom: 10px;
}
.hy-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hy-empty { text-align: center; padding: 32px; grid-column: 1 / -1; }
.hy-log-card h3 { margin: 0 0 8px; color: var(--hy-gold); font-size: 14px; }
.hy-btn-primary {
  background: linear-gradient(135deg, var(--hy-gold), var(--hy-gold2));
  border: none;
  color: #1a0f2e;
  font-weight: 700;
}
.hy-btn-stop {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}
.hy-btn-ghost { background: transparent; border-color: var(--hy-border); }
.btn.full { width: 100%; margin-top: 4px; }
.center-text { text-align: center; }
.hy-switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin: 8px 0;
}
.hy-switch {
  position: relative;
  width: 44px; height: 24px;
  display: inline-block;
}
.hy-switch input { opacity: 0; width: 0; height: 0; }
.hy-switch span {
  position: absolute;
  inset: 0;
  background: #3a2a55;
  border-radius: 24px;
  cursor: pointer;
  transition: 0.2s;
}
.hy-switch span::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.hy-switch input:checked + span { background: linear-gradient(135deg, var(--hy-gold2), var(--hy-gold)); }
.hy-switch input:checked + span::before { transform: translateX(20px); }
.hy-field { font-size: 12px; color: var(--muted); display: block; margin: 8px 0; }
.hy-field.inline { display: flex; align-items: center; gap: 6px; margin: 0; }
.hy-modal { border-color: var(--hy-border); }
.badge.ok { color: var(--green); border-color: var(--green); }
.badge.warn { color: #ffb74d; border-color: #ffb74d; }
.badge.bad { color: var(--red); border-color: var(--red); }
.hy-toast-host {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.hy-toast {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--hy-card);
  border: 1px solid var(--hy-border);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  transform: translateX(20px);
  transition: 0.3s;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.hy-toast.show { opacity: 1; transform: translateX(0); }
.hy-toast-ok { border-color: var(--green); }
.hy-toast-warn { border-color: #ffb74d; }
.hy-toast-bad { border-color: var(--red); }
.coords-editor {
  width: 100%;
  min-height: 200px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

