:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #17203a;
  --muted: #7c869b;
  --line: #eef1f7;
  --accent: #2f6bff;
  --accent-dark: #1f54d8;
  --accent-soft: rgba(47, 107, 255, 0.09);
  --success: #18a569;
  --danger: #e2464c;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(23, 44, 86, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

/* ---------- 登录 ---------- */
.login-body {
  min-height: 100vh;
  background: #0d1730;
  background-image: radial-gradient(circle at 18% 18%, rgba(47, 107, 255, 0.38), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(43, 139, 245, 0.26), transparent 46%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 24px;
  padding: 40px 36px 32px;
  box-shadow: 0 30px 80px rgba(4, 12, 30, 0.42);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2f6bff, #2b8bf5);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(47, 107, 255, 0.32);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.brand p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: #4d576c;
  margin: 18px 0 8px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e3e8f2;
  border-radius: 12px;
  font-size: 14px;
  color: var(--ink);
  background: #fbfcfe;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

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

.login-tip {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: #a3adbf;
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #101c34 0%, #0e1729 100%);
  color: #fff;
  padding: 26px 18px 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 24px;
}

.side-brand .brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
}

.side-brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.side-brand span {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, color 0.18s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(47, 107, 255, 0.95), rgba(43, 139, 245, 0.9));
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 84, 216, 0.35);
}

.nav-ico {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.logout {
  margin-top: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.18s;
}

.logout:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 60px;
  max-width: 1180px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(24, 165, 105, 0.14);
}

/* ---------- 卡片 ---------- */
.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.card-header p {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.card-divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

/* ---------- 开关 ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #dfe4ee;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 2px 6px rgba(23, 44, 86, 0.2);
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, #2f6bff, #2b8bf5);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.switch-text {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- 上传 ---------- */
.upload-area {
  position: relative;
  margin-top: 18px;
  min-height: 250px;
  border: 1.5px dashed #d7deeb;
  border-radius: 14px;
  background: #fafbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.upload-area:hover {
  border-color: #b9c6de;
  background: #f7f9fe;
}

.preview {
  display: none;
  max-width: 100%;
  max-height: 460px;
  object-fit: contain;
}

.preview.show {
  display: block;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 40px 20px;
  text-align: center;
}

.upload-placeholder strong {
  color: #4d576c;
  font-size: 14px;
  font-weight: 500;
}

.upload-placeholder span {
  font-size: 12px;
  color: #a3adbf;
}

.upload-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.upload-mask {
  position: absolute;
  inset: 0;
  background: rgba(13, 23, 48, 0.55);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  backdrop-filter: blur(2px);
}

.upload-mask.show {
  display: flex;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s;
  line-height: 1.2;
}

.btn.primary {
  background: linear-gradient(135deg, #2f6bff, #2b8bf5);
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 107, 255, 0.26);
}

.btn.primary:hover {
  box-shadow: 0 12px 26px rgba(47, 107, 255, 0.34);
  transform: translateY(-1px);
}

.btn.ghost {
  background: #fff;
  border-color: #e3e8f2;
  color: #4d576c;
}

.btn.ghost:hover {
  border-color: #c9d3e6;
  color: var(--ink);
}

.btn.danger {
  background: #fff;
  border-color: #f3d4d6;
  color: var(--danger);
}

.btn.small {
  padding: 7px 14px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn.block {
  width: 100%;
  padding: 12px;
  margin-top: 26px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 表单 ---------- */
.form-row {
  margin-bottom: 16px;
}

.form-row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row label {
  display: block;
  font-size: 12.5px;
  color: #5b6579;
  margin-bottom: 7px;
}

.form-hint {
  font-size: 12px;
  color: #a3adbf;
  margin-top: 6px;
}

textarea.form-input {
  resize: vertical;
  min-height: 92px;
  line-height: 1.7;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c869b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px;
  padding-right: 34px;
}

.input-with-btn {
  display: flex;
  gap: 10px;
}

.input-with-btn .form-input {
  flex: 1;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4d576c;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.hidden {
  display: none !important;
}

/* ---------- 表格 ---------- */
.table-wrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 12px 16px;
  background: #f8fafd;
  color: #7c869b;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  color: #3d4759;
}

.empty-row td {
  text-align: center;
  color: #a3adbf;
  padding: 34px 16px;
}

.keyword {
  font-weight: 600;
  color: var(--ink);
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
}

.badge.blue {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.gray {
  background: #f1f4f9;
  color: #7c869b;
}

.badge.green {
  background: rgba(24, 165, 105, 0.1);
  color: var(--success);
}

.badge.red {
  background: rgba(226, 70, 76, 0.08);
  color: var(--danger);
}

.cell-desc {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #7c869b;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 12.5px;
}

.link-btn.danger {
  color: var(--danger);
}

/* ---------- 提示块 ---------- */
.tips {
  margin-top: 18px;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 12.5px;
  color: #6b7488;
  line-height: 1.9;
}

.tips strong {
  color: #3d4759;
}

.tips ol {
  margin: 6px 0 0;
  padding-left: 18px;
}

.url-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.url-box code {
  flex: 1;
  display: block;
  padding: 10px 14px;
  background: #f5f8fe;
  border: 1px solid #e6ecf7;
  border-radius: 10px;
  font-size: 12.5px;
  color: #1f54d8;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.modal.show {
  display: block;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(13, 23, 48, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 620px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  margin: 40px auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(4, 12, 30, 0.32);
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px 24px 4px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px 22px;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: #9aa4b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.icon-btn:hover {
  background: #f1f4f9;
  color: var(--ink);
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  top: 26px;
  left: 50%;
  transform: translate(-50%, -16px);
  background: #17203a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s;
  z-index: 100;
  box-shadow: 0 14px 36px rgba(4, 12, 30, 0.28);
  max-width: 80vw;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: #b52a30;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 16px;
  }

  .side-brand {
    padding-bottom: 14px;
  }

  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
  }

  .nav-item {
    white-space: nowrap;
    width: auto;
  }

  .logout {
    margin-top: 14px;
  }

  .main {
    padding: 20px 16px 50px;
  }

  .form-row.two {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
  }
}
