:root {
  --bg: #0c1017;
  --bg-elevated: #111827;
  --panel: #151c2c;
  --panel-border: #243044;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #22d3ee;
  --accent-hover: #67e8f9;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --ok: #34d399;
  --border: #2a3a52;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== 后台框架 ========== */
.admin-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(34, 211, 238, 0.06), transparent 55%),
    radial-gradient(800px 400px at 0% 100%, rgba(99, 102, 241, 0.05), transparent 50%),
    var(--bg);
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0f1624 0%, #0d121c 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0 1rem;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.2);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem 1.1rem;
  margin: 0 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.25), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(34, 211, 238, 0.25);
  display: grid;
  place-items: center;
  color: #e0f7fa;
  flex-shrink: 0;
}

.sidebar-logo svg { display: block; }

.sidebar-brand-name {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  color: var(--text);
  line-height: 1.25;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.65rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-ico {
  width: 1.15rem;
  text-align: center;
  opacity: 0.75;
  font-size: 0.88rem;
}

.sidebar-txt { flex: 1; }

.sidebar-link:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}

.sidebar-link.is-active {
  color: #f0fdff;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.18), rgba(34, 211, 238, 0.06));
  border: 1px solid rgba(34, 211, 238, 0.22);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.06) inset;
}

.sidebar-link.is-active .sidebar-ico {
  opacity: 1;
  color: var(--accent);
}

.sidebar-spacer { flex: 1; min-height: 1rem; }

.sidebar-logout {
  padding: 0.85rem 1rem 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.sidebar-logout-btn {
  width: 100%;
  padding: 0.52rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.6);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.sidebar-logout-btn:hover {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.45);
  background: var(--danger-soft);
}

.admin-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-header {
  flex-shrink: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 26, 0.85);
  backdrop-filter: blur(10px);
}

.content-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.75rem;
  max-width: 1200px;
}

.content-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.content-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(34, 211, 238, 0.06);
}

.content-main {
  flex: 1;
  padding: 1.35rem 1.75rem 2rem;
  max-width: 1200px;
  width: 100%;
}

@media (max-width: 768px) {
  .admin-shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.85rem;
    box-shadow: none;
  }

  .sidebar-brand {
    width: 100%;
    margin: 0 0 0.5rem;
    padding: 0 0 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
    padding: 0;
  }

  .sidebar-link.is-active {
    border: 1px solid rgba(34, 211, 238, 0.35);
  }

  .sidebar-spacer { display: none; }

  .sidebar-logout {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.65rem 0 0;
    border-top: 1px solid var(--border);
  }

  .content-header-inner { padding: 1rem 1rem; }

  .content-main { padding: 1rem 1rem 1.5rem; }
}

/* ========== 面板 / 表格 / 表单 ========== */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-soft);
}

.panel h2,
.panel .panel-heading {
  margin-top: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: -0.01em;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel > .row-between {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(42, 58, 82, 0.5);
}

.panel > .row-between h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #cbd5e1;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  border-radius: var(--radius-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(11, 18, 32, 0.55);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.55rem;
  text-align: left;
}

.table tbody td {
  border-bottom: 1px solid rgba(42, 58, 82, 0.65);
  padding: 0.65rem 0.55rem;
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: rgba(34, 211, 238, 0.03);
}

.table code {
  font-size: 0.85em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(11, 18, 32, 0.75);
  border: 1px solid var(--border);
}

.actions { white-space: nowrap; }
.actions form.inline { display: inline; }

.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  font: inherit;
  border-radius: 4px;
  transition: background 0.12s ease;
}
.link-btn:hover { background: var(--accent-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }

.primary,
.btn-primary {
  background: linear-gradient(180deg, #22d3ee 0%, #0ea5d3 100%);
  color: #021016;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.48rem 1rem;
  font-weight: 650;
  cursor: pointer;
  font-size: 0.92rem;
  box-shadow: 0 2px 12px rgba(34, 211, 238, 0.25);
  transition: filter 0.15s ease, transform 0.1s ease;
}
.primary:hover,
.btn-primary:hover {
  filter: brightness(1.06);
}
.primary:active,
.btn-primary:active {
  transform: translateY(1px);
}

.primary.link { display: inline-block; }

.btn-block { width: 100%; }

.stack label { display: block; margin-bottom: 0.8rem; font-size: 0.88rem; color: #c4d0e0; }

.stack input,
.stack select,
.stack textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.52rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stack input::placeholder,
.stack textarea::placeholder {
  color: #5c6d84;
}

.stack input:hover,
.stack select:hover,
.stack textarea:hover {
  border-color: rgba(34, 211, 238, 0.25);
}

.stack input:focus,
.stack select:focus,
.stack textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.stack.narrow { max-width: 640px; }

.inline-check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.9rem; }
.inline-check input { width: auto; }

.actions-row { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.1rem; flex-wrap: wrap; }

/* ========== 提示 ========== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  font-size: 0.92rem;
}

.alert.ok {
  background: rgba(52, 211, 153, 0.1);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.35);
  border-left: 3px solid var(--ok);
  padding-left: calc(1rem - 3px);
}

.alert.err {
  background: rgba(251, 113, 133, 0.1);
  color: #fecaca;
  border-color: rgba(251, 113, 133, 0.35);
  border-left: 3px solid var(--danger);
  padding-left: calc(1rem - 3px);
}

.alert-banner.err { margin-bottom: 1.25rem; }

/* ========== 概览统计 ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1rem;
}

.stat {
  position: relative;
  background: linear-gradient(145deg, rgba(11, 18, 32, 0.9), rgba(21, 28, 44, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  opacity: 0.85;
}

.stat .n {
  display: block;
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: #f1f5f9;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .stat .n {
    background: linear-gradient(180deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.stat .l { color: var(--muted); font-size: 0.88rem; margin-top: 0.25rem; }

.hint { color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.hint code { color: #7dd3fc; font-size: 0.88em; }

.tiny { font-size: 0.85em; }

.tiny.err,
span[title].tiny {
  color: #fbbf24;
  cursor: help;
}

.tag-type {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(34, 211, 238, 0.08);
  color: #bae6fd;
}

.tag-ok {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.tool-group-ids-form {
  max-width: 560px;
}

.panel-nested {
  padding: 1rem 1.2rem;
  background: rgba(11, 18, 32, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.gid-result-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.gid-chat-id {
  display: inline-block;
  padding: 0.45rem 0.65rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(3, 7, 18, 0.65);
  color: #e0f2fe;
  user-select: all;
}

.webhook-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

.webhook-actions-row form.inline {
  display: inline;
}

.dialog-webhook-info {
  max-width: min(680px, 96vw);
  width: 100%;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.dialog-webhook-info::backdrop {
  background: rgba(2, 6, 16, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-webhook-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.dialog-webhook-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #cbd5e1;
}

.dialog-webhook-close {
  margin: 0;
  padding: 0.15rem 0.45rem;
  font-size: 1.35rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.dialog-webhook-close:hover {
  color: var(--text);
  background: rgba(34, 211, 238, 0.1);
}

.dialog-webhook-body {
  padding: 0.75rem 1rem 1rem;
}

.webhook-info-pre {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(70vh, 520px);
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(3, 7, 18, 0.65);
  color: #cbd5e1;
}

.button-pairs-panel {
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.45);
}

.button-pairs-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.button-pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.button-pair-row input {
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.button-pair-row input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.kbd-row {
  padding-bottom: 0.65rem;
}
.kbd-row + .kbd-row {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(42, 58, 82, 0.55);
}
.kbd-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}
.kbd-cols-wrap {
  font-size: 0.82rem;
  color: var(--muted);
}
.kbd-cols-wrap select {
  margin-left: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}
.kbd-slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.kbd-slot-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.28rem;
}
.kbd-slot-inputs {
  display: grid;
  grid-template-columns: 5rem 1fr 1.15fr;
  gap: 0.45rem;
  align-items: center;
}
.kbd-slot-inputs .fld-kbd-icon {
  font-size: 0.95rem;
}
.kbd-slot-inputs input {
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.kbd-slot-inputs input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
@media (max-width: 720px) {
  .kbd-slot-inputs {
    grid-template-columns: 1fr;
  }
}

.field-block { margin-bottom: 0.5rem; }

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  margin: 0;
  position: relative;
}

.login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 900px 500px at 50% -20%, rgba(34, 211, 238, 0.14), transparent 55%),
    radial-gradient(ellipse 700px 450px at 100% 80%, rgba(129, 140, 248, 0.12), transparent 50%),
    radial-gradient(ellipse 500px 400px at 0% 60%, rgba(14, 165, 233, 0.08), transparent 45%),
    var(--bg);
}

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem 2rem 1.75rem;
  border-radius: 16px;
  background: rgba(21, 28, 44, 0.72);
  border: 1px solid rgba(42, 58, 82, 0.85);
  box-shadow: var(--shadow), 0 0 0 1px rgba(34, 211, 238, 0.06) inset;
  backdrop-filter: blur(14px);
}

.login-brand {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.35), rgba(99, 102, 241, 0.22));
  border: 1px solid rgba(34, 211, 238, 0.35);
  display: grid;
  place-items: center;
  color: #e0f7fa;
  flex-shrink: 0;
}

.login-logo svg { display: block; }

.login-brand-text { min-width: 0; }

.login-title {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.login-tagline {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.login-form { margin-top: 0.25rem; }

.field { margin-bottom: 1.1rem; }

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #a8b8cc;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.field-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.85);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input::placeholder { color: #5c6d84; }

.field-input:hover {
  border-color: rgba(34, 211, 238, 0.3);
}

.field-input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-foot {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.55;
}

@media (max-width: 480px) {
  .login-card { padding: 1.5rem 1.35rem; }
  .login-title { font-size: 1.25rem; }
}

.muted { color: var(--muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.content-main--wide {
  max-width: none;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  background:
    radial-gradient(ellipse min(720px, 90vw) 420px at 92% -5%, rgba(34, 211, 238, 0.05), transparent 58%),
    radial-gradient(ellipse 400px 280px at 0% 40%, rgba(99, 102, 241, 0.04), transparent 55%);
}

.content-header--wide .content-header-inner {
  max-width: none;
  border-bottom-color: rgba(42, 58, 82, 0.55);
  background: linear-gradient(180deg, rgba(12, 16, 26, 0.92), rgba(13, 17, 26, 0.82));
}

/* ========== 模板编辑：主表单 + 窄栏手机示意预览 ========== */
.template-studio-panel.panel {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.12);
  box-shadow:
    var(--shadow-soft),
    0 0 0 1px rgba(34, 211, 238, 0.04) inset;
}

.template-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 0;
  align-items: start;
}

.template-studio--text {
  grid-template-columns: 1fr;
}

.template-studio-form-head {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(42, 58, 82, 0.55);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.07), transparent 55%);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-top: 0.25rem;
}

.template-studio-form {
  padding: 1.5rem 1.75rem 1.75rem;
  border-right: 1px solid var(--panel-border);
}

.template-studio--text .template-studio-form {
  border-right: 0;
}

.template-studio-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #f1f5f9;
}

.template-studio-lead {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 52ch;
}

.template-studio-form .stack label {
  font-size: 0.88rem;
}

.template-studio-preview {
  padding: 1.25rem 1rem 1.5rem;
  position: sticky;
  top: 0.75rem;
  align-self: start;
  background:
    radial-gradient(ellipse 220px 120px at 50% 0%, rgba(99, 102, 241, 0.12), transparent 65%),
    linear-gradient(180deg, #0d121c 0%, #0a1018 100%);
}

.template-studio--text .template-studio-preview {
  display: none;
}

.preview-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.preview-dock-title {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
}

.preview-dock-sub {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  line-height: 1.4;
}

.preview-device {
  width: 100%;
  max-width: 276px;
}

.preview-device-shell {
  border-radius: 22px;
  padding: 5px;
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 40%, #020617 100%);
  border: 1px solid rgba(51, 65, 85, 0.85);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(34, 211, 238, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.preview-device-bar {
  display: flex;
  justify-content: center;
  padding: 0.4rem 0 0.5rem;
}

.preview-device-bar span {
  width: 56px;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(51, 65, 85, 0.6);
}

.preview-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(42, 58, 82, 0.8);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(11, 18, 32, 0.98) 100%);
  overflow: hidden;
}

.preview-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(42, 58, 82, 0.55);
  background: rgba(8, 12, 20, 0.65);
}

.preview-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #22d3ee;
  opacity: 0.9;
}

.preview-hint {
  font-size: 0.68rem;
}

.preview-frame {
  min-height: 120px;
  max-height: 220px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(180px 100px at 50% 30%, rgba(34, 211, 238, 0.05), transparent 70%),
    #030712;
  position: relative;
}

.preview-img {
  max-width: 100%;
  max-height: 188px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.preview-empty {
  text-align: center;
  padding: 1rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.preview-empty-ico {
  font-size: 1.35rem;
  opacity: 0.4;
  line-height: 1;
}

.preview-caption-wrap {
  padding: 0.55rem 0.65rem 0.45rem;
  border-top: 1px solid rgba(42, 58, 82, 0.45);
}

.preview-caption-label {
  font-size: 0.62rem;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.preview-caption {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 3.6rem;
  line-height: 1.45;
  overflow-y: auto;
}

.preview-actions {
  padding: 0.45rem 0.6rem 0.55rem;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: stretch;
  justify-content: flex-start;
  border-top: 1px solid rgba(42, 58, 82, 0.4);
  background: rgba(3, 7, 18, 0.55);
}

.preview-kbd-line {
  width: 100%;
}
.preview-kbd-line--double {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.32rem;
}
.preview-kbd-line .preview-pill {
  justify-content: center;
  min-width: 0;
}
.preview-pill--wide {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #bae6fd;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.16), rgba(34, 211, 238, 0.05));
  border: 1px solid rgba(34, 211, 238, 0.22);
}

.image-source-block {
  margin-bottom: 0.75rem;
}

.field-label-inline {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a8b8cc;
  margin-bottom: 0.45rem;
}

.upload-zone {
  margin-bottom: 0.25rem;
}

.upload-zone-label {
  display: block;
  cursor: pointer;
  border: 1px dashed rgba(34, 211, 238, 0.35);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  text-align: center;
  background: rgba(34, 211, 238, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-zone-label:hover {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.08);
}

.upload-zone-main {
  display: block;
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.upload-zone-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.upload-status {
  margin-top: 0.4rem;
  min-height: 1.25rem;
}

.template-studio-form .stack.template-form {
  max-width: none;
}

/* ========== 定时计划：Cron 下拉 + 测试按钮 ========== */
.schedule-form-panel .cron-builder {
  margin: 0.75rem 0 1rem;
  padding: 1rem 1.05rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42, 58, 82, 0.75);
  background: linear-gradient(165deg, rgba(11, 18, 32, 0.55), rgba(8, 12, 20, 0.35));
}

.cron-builder-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.cron-builder-hint {
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.cron-builder-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem 0.6rem;
}

.cron-builder-grid--five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cron-field {
  margin: 0;
}

.cron-field-name {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.28rem;
}

.cron-field select {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.42rem 0.4rem;
  border-radius: var(--radius-sm);
}

.schedule-form-actions {
  flex-wrap: wrap;
  align-items: center;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(42, 58, 82, 0.95);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.48rem 1rem;
  font-weight: 650;
  cursor: pointer;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: rgba(34, 211, 238, 0.42);
  color: var(--accent-hover);
}

@media (max-width: 960px) {
  .cron-builder-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .cron-builder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .template-studio {
    grid-template-columns: 1fr;
  }

  .template-studio-form-head {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .template-studio-form {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .template-studio-preview {
    position: static;
    padding: 1.25rem 1rem 1.75rem;
  }

  .preview-device {
    max-width: 300px;
  }
}
