:root {
  --bg: #0f141b;
  --panel: #161d26;
  --panel-2: #1d2632;
  --line: #273140;
  --text: #e8eef6;
  --muted: #93a1b5;
  --accent: #3aa0ff;
  --accent-2: #21d4a6;
  --danger: #ff5d6c;
  --warn: #ffb02e;
  --radius: 12px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, #1b2a3d 0%, var(--bg) 55%);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
input, select, button { font-family: inherit; font-size: 14px; }
input, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
button:hover { background: #263140; }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, #2c8dff, #1e6fd4); border-color: #2f8bf0; }
button.primary:hover { background: linear-gradient(180deg, #3d9cff, #2a7ce0); }
button.ghost { background: transparent; }
button.danger { border-color: #5c2a31; color: #ff9aa2; }
button.danger:hover { background: #2a1a1e; }

/* 登录 */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(400px, 92vw);
  background: linear-gradient(180deg, #18212c, #131a23);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.brand-dot {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #3aa0ff, #21d4a6);
  box-shadow: 0 0 24px rgba(58, 160, 255, .45);
}
.brand h1 { font-size: 19px; letter-spacing: .3px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.brand.compact { padding: 4px 4px 14px; }
.alert {
  background: #2a1a1e; border: 1px solid #5c2a31; color: #ffb3b9;
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.hint { color: var(--muted); font-size: 12px; text-align: center; margin: 2px 0 0; }

/* 布局 */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex: none;
  background: rgba(16, 22, 30, .82);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  backdrop-filter: blur(8px);
}
.sidebar nav { display: flex; flex-direction: column; padding: 8px; gap: 4px; flex: 1; }
.sidebar nav button {
  text-align: left; background: transparent; border: 0;
  padding: 10px 12px; border-radius: 9px; color: var(--muted);
}
.sidebar nav button:hover { background: #1a2330; color: var(--text); }
.sidebar nav button.active { background: #1e2c3e; color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: 12px;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px 12px;
}
.topbar h2 { font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.toast { opacity: 0; transition: opacity .2s; font-size: 13px; }
.toast.show { opacity: 1; }
.toast.ok { color: var(--accent-2); }
.toast.err { color: var(--danger); }
.view { padding: 8px 26px 40px; display: flex; flex-direction: column; gap: 18px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* 卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card {
  background: linear-gradient(180deg, var(--panel), #121a23);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.card.accent { border-color: #24506f; box-shadow: inset 0 0 0 1px rgba(58, 160, 255, .12); }
.card-label { color: var(--muted); font-size: 12px; }
.card-value { font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.card-sub { color: var(--muted); font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.panel h3 { font-size: 15px; color: #dfe9f5; }
.panel.danger-zone { border-color: #3a2a2e; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.form-grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.guide { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.9; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar input { min-width: 220px; }
.code-output { display: flex; flex-wrap: wrap; gap: 8px; }
.code-output code {
  background: #0d141b; border: 1px dashed #2c6f93; color: #9fe0ff;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; letter-spacing: .6px;
}

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: #141b24;
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid #1f2833; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #1a2430; }
td.mono, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
td.pre { max-width: 360px; white-space: normal; word-break: break-all; color: var(--muted); font-size: 12px; }
td.empty { text-align: center; color: var(--muted); padding: 30px; }
td.actions { white-space: nowrap; }
td.actions button { padding: 5px 9px; font-size: 12px; margin-right: 4px; }
.muted { color: var(--muted); }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; border: 1px solid var(--line); color: var(--muted);
  background: #151d26;
}
.pill.active, .pill.activated, .pill.approved, .pill.live { color: #7bf0c8; border-color: #1f5c4a; background: #10261f; }
.pill.pending, .pill.paused, .pill.starting { color: #ffd189; border-color: #5c4a1f; background: #241f10; }
.pill.expired, .pill.disabled, .pill.rejected, .pill.blocked, .pill.revoked { color: #ff9aa2; border-color: #5c2a31; background: #241316; }

@media (max-width: 960px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .sidebar-footer { display: none; }
  .brand.compact { display: none; }
}
