/* ===== 管理端样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-0: #04091a;
  --bg-1: #0a1730;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --gold: #f5c451;
  --red: #fb7185;
  --green: #34d399;
  --text: #d7e6fa;
  --dim: #8aa7c9;
  --line: rgba(34, 211, 238, .3);
}

html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(37, 99, 235, .3), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  color: var(--text);
  overflow: hidden;
}

.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 75% 20%, rgba(165,243,255,.8), transparent),
    radial-gradient(1px 1px at 55% 80%, rgba(255,255,255,.5), transparent);
  background-size: 520px 520px, 640px 640px, 480px 480px;
  animation: drift 100s linear infinite;
  opacity: .6;
}
@keyframes drift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: -520px 520px, 640px -640px, -480px 480px; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.btn.primary {
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  color: #04101f; font-weight: 700;
  box-shadow: 0 0 16px rgba(34, 211, 238, .35);
}
.btn.primary:hover { box-shadow: 0 0 26px rgba(34, 211, 238, .6); transform: translateY(-1px); }
.btn.ghost { border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .07); }
.btn.ghost:hover { background: rgba(34, 211, 238, .18); }
.btn.ghost.warn { border-color: rgba(251, 113, 133, .5); background: rgba(251, 113, 133, .08); color: #fda4af; }
.btn.ghost.warn:hover { background: rgba(251, 113, 133, .2); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 登录 ---------- */
.login-wrap {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 380px;
  padding: 38px 34px 28px;
  background: rgba(8, 22, 46, .9);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 0 60px rgba(34, 211, 238, .18), inset 0 0 40px rgba(34, 211, 238, .05);
  animation: cardIn .5s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.login-logo {
  font-size: 26px; font-weight: 700; text-align: center; letter-spacing: 4px;
  background: linear-gradient(180deg, #fff, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(56, 189, 248, .5);
}
.login-sub { text-align: center; color: var(--dim); font-size: 12px; margin: 8px 0 26px; letter-spacing: 1px; }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.login-tip { text-align: center; color: var(--dim); font-size: 12px; margin-top: 14px; }
.back-link { display: block; text-align: center; color: var(--cyan); font-size: 13px; margin-top: 16px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--dim); letter-spacing: 1px; }
.field input, .field textarea, .field select {
  background: rgba(4, 12, 28, .8);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: 4px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field input:focus, .field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, .3);
}
.field textarea { resize: vertical; line-height: 1.7; }
.field select, .data-table select {
  background: rgba(4, 12, 28, .8);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: 4px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field select:focus, .data-table select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, .3);
}
.field select option, .data-table select option {
  background: #061226;
  color: var(--text);
}
/* 坐标自动带出：只读态 */
.field input[readonly], .data-table input[readonly] {
  background: rgba(10, 22, 44, .55);
  color: var(--cyan);
  border-style: dashed;
  cursor: default;
}
.data-table select {
  padding: 7px 8px;
  font-size: 13px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.form-msg { font-size: 13px; margin-top: 10px; min-height: 18px; color: var(--green); }
.form-msg.err { color: var(--red); }
.hint { font-size: 13px; color: var(--dim); line-height: 1.8; margin-bottom: 12px; }

/* ---------- 布局 ---------- */
.admin-wrap {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column;
}
.admin-top {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(34, 211, 238, .2);
  background: rgba(6, 16, 34, .75);
  flex-wrap: wrap; gap: 10px;
}
.a-title {
  font-size: 18px; font-weight: 700; letter-spacing: 3px;
  color: #fff; text-shadow: 0 0 16px rgba(56, 189, 248, .6);
}
.a-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs {
  flex: 0 0 auto;
  display: flex; gap: 6px;
  padding: 10px 22px 0;
  border-bottom: 1px solid rgba(34, 211, 238, .15);
  background: rgba(6, 16, 34, .5);
  overflow-x: auto;
}
.tab {
  padding: 9px 20px;
  font-size: 14px;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
  font-family: inherit;
}
.tab:hover { color: var(--text); background: rgba(34, 211, 238, .08); }
.tab.active {
  color: var(--cyan);
  background: rgba(34, 211, 238, .12);
  border-color: rgba(34, 211, 238, .3);
  box-shadow: inset 0 2px 0 var(--cyan);
  font-weight: 700;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 24px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: rgba(8, 22, 46, .82);
  border: 1px solid rgba(59, 130, 246, .3);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: inset 0 0 24px rgba(59, 130, 246, .06);
}
.card h3 {
  font-size: 15px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 4px solid var(--cyan);
}

/* ---------- KPI 编辑 ---------- */
.kpi-editor { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.kpi-item {
  border: 1px dashed rgba(34, 211, 238, .3);
  border-radius: 6px;
  padding: 14px;
  background: rgba(4, 12, 28, .5);
}
.kpi-item .form-grid { grid-template-columns: 1fr 1fr; }
.kpi-item .field { margin-bottom: 10px; }
.kpi-item .field.full { grid-column: 1 / -1; }

/* ---------- 列表编辑 ---------- */
.list-editor { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: grid;
  grid-template-columns: 1fr 140px 44px;
  gap: 10px;
  align-items: center;
}
.list-row input {
  background: rgba(4, 12, 28, .8);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: 4px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 100%;
}
.list-row input:focus { border-color: var(--cyan); box-shadow: 0 0 10px rgba(34, 211, 238, .3); }
.list-row .del {
  background: rgba(251, 113, 133, .1);
  border: 1px solid rgba(251, 113, 133, .45);
  color: #fda4af;
  border-radius: 4px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
}
.list-row .del:hover { background: rgba(251, 113, 133, .28); }
.list-add {
  margin-top: 6px;
  align-self: flex-start;
  background: rgba(34, 211, 238, .1);
  border: 1px dashed rgba(34, 211, 238, .5);
  color: var(--cyan);
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.list-add:hover { background: rgba(34, 211, 238, .22); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(59, 130, 246, .18);
  text-align: left;
}
.data-table th { color: var(--cyan); font-size: 13px; letter-spacing: 1px; }
.data-table input {
  background: rgba(4, 12, 28, .8);
  border: 1px solid rgba(59, 130, 246, .3);
  border-radius: 4px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 100%;
}
.data-table input:focus { border-color: var(--cyan); }

/* ---------- 底部保存条 ---------- */
.save-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px solid rgba(34, 211, 238, .25);
  background: rgba(6, 16, 34, .9);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .4);
}
.save-hint { font-size: 13px; color: var(--gold); }
.save-hint.clean { color: var(--green); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 22px; left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: rgba(6, 18, 38, .96);
  border: 1px solid var(--cyan);
  color: var(--text);
  padding: 11px 26px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 0 24px rgba(34, 211, 238, .4);
  opacity: 0;
  transition: all .35s ease;
  z-index: 99;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red); box-shadow: 0 0 24px rgba(251, 113, 133, .4); }

@media (max-width: 760px) {
  body { overflow: auto; }
  .admin-wrap { height: auto; min-height: 100%; }
  .admin-top { padding: 12px 14px; }
  .a-title { font-size: 15px; letter-spacing: 1px; }
  .a-actions { width: 100%; }
  .a-actions .btn { flex: 1; padding: 9px 8px; font-size: 13px; }
  .content { padding: 14px; overflow: visible; }
  .tabs { padding: 10px 14px 0; position: sticky; top: 0; z-index: 5; }
  .tab { padding: 9px 13px; font-size: 13px; }
  .list-row { grid-template-columns: 1fr 90px 40px; gap: 6px; }
  .kpi-editor { grid-template-columns: 1fr; }
  .kpi-item .form-grid { grid-template-columns: 1fr 1fr; }
  .save-bar { position: sticky; bottom: 0; flex-direction: column; gap: 10px; padding: 12px 14px; z-index: 6; }
  .save-bar .btn-row { width: 100%; }
  .save-bar .btn { flex: 1; }
  .data-table { min-width: 980px; }
  .login-card { width: min(360px, calc(100vw - 32px)); padding: 30px 22px 24px; }
}
