/* ============ 平台运营控制台 · 样式 ============ */
:root {
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #e8efff 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #f0e9ff 0%, transparent 55%);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --border: rgba(20, 40, 90, 0.10);
  --text: #16213a;
  --text-dim: #51607e;
  --text-mute: #8a97b3;
  --primary: #3b6cff;
  --primary-2: #6a4bff;
  --ok: #15a06b;
  --warn: #e08a00;
  --danger: #e23d54;
  --shadow: 0 18px 50px rgba(30, 50, 110, 0.12);
  --radius: 18px;
}
[data-theme="dark"] {
  --bg: #0b1020;
  --bg-grad: radial-gradient(1200px 600px at 12% -10%, #16224a 0%, transparent 60%), radial-gradient(900px 520px at 100% 0%, #2a1a4a 0%, transparent 55%);
  --panel: rgba(22, 30, 56, 0.72);
  --panel-solid: #141c34;
  --border: rgba(255, 255, 255, 0.10);
  --text: #eaf0ff;
  --text-dim: #b6c2dd;
  --text-mute: #7e8bab;
  --primary: #5b86ff;
  --primary-2: #9a78ff;
  --ok: #34d399;
  --warn: #f5b14c;
  --danger: #ff6b81;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
#app { min-height: 100vh; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 38px 34px;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo .dot { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 22px rgba(80, 90, 255, .35); }
.login-logo h1 { font-size: 19px; margin: 0; letter-spacing: .3px; }
.login-sub { color: var(--text-mute); font-size: 13px; margin: 2px 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-solid); color: var(--text); font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(91, 134, 255, .18); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid transparent; border-radius: 12px; padding: 11px 16px; font-size: 14px; font-weight: 600;
  transition: transform .15s cubic-bezier(.16,1,.3,1), box-shadow .2s, background .2s;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; width: 100%; padding: 13px; box-shadow: 0 12px 28px rgba(80, 90, 255, .30); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(80, 90, 255, .40); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: rgba(226, 61, 84, .12); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: rgba(226, 61, 84, .20); }

/* ---------- 主框架 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 28px;
  border-bottom: 1px solid var(--border); background: var(--panel); backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand .dot { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 20px rgba(80, 90, 255, .30); }
.topbar .brand h2 { font-size: 17px; margin: 0; }
.topbar .brand .who { font-size: 12px; color: var(--text-mute); }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

.container { max-width: 1180px; margin: 0 auto; padding: 26px 28px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-head h3 { margin: 0 0 4px; font-size: 20px; }
.page-head .sub { color: var(--text-mute); font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 240px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .n { font-size: 24px; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { color: var(--text-mute); font-size: 12px; margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.ctable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.ctable thead th {
  text-align: left; padding: 14px 16px; font-weight: 600; color: var(--text-dim);
  background: rgba(125, 145, 200, .08); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 65px;
}
table.ctable tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.ctable tbody tr:hover { background: rgba(91, 134, 255, .06); }
table.ctable tbody tr:last-child td { border-bottom: none; }
.pwd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .5px; }
.pwd .hide { filter: blur(5px); user-select: none; }
.eye { cursor: pointer; color: var(--text-mute); margin-left: 6px; border: none; background: none; font-size: 14px; }
.eye:hover { color: var(--primary); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.active { background: rgba(21, 160, 107, .14); color: var(--ok); }
.tag.expired { background: rgba(226, 61, 84, .14); color: var(--danger); }
.tag.disabled { background: rgba(138, 151, 179, .16); color: var(--text-mute); }
.row-actions { display: flex; gap: 6px; }
.muted { color: var(--text-mute); }
.empty { padding: 50px; text-align: center; color: var(--text-mute); }

/* ---------- 主题切换 ---------- */
.theme-toggle { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel-solid); color: var(--text-dim); cursor: pointer; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; transition: color .2s, border-color .2s; }
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(8, 12, 28, .55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-mask[hidden] { display: none; }
.modal { width: 100%; max-width: 480px; background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 24px 22px; animation: pop .22s cubic-bezier(.16,1,.3,1); }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h4 { margin: 0 0 18px; font-size: 17px; }
.modal .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal .field { margin-bottom: 0; }
.modal .full { grid-column: 1 / -1; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.err { color: var(--danger); font-size: 12.5px; margin-top: 6px; min-height: 16px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px); background: #16213a; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 80; box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #15a06b; }
.toast.err { background: #e23d54; }

@media (max-width: 720px) {
  .topbar, .container { padding-left: 16px; padding-right: 16px; }
  .modal .grid { grid-template-columns: 1fr; }
  table.ctable thead th:nth-child(4), table.ctable tbody td:nth-child(4),
  table.ctable thead th:nth-child(5), table.ctable tbody td:nth-child(5) { display: none; }
}
