:root {
  --bg: #eef1f8;
  --bg-2: #f7f9fc;
  --panel: #ffffff;
  --sidebar-1: #0f172a;
  --sidebar-2: #1b2540;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-soft: #eef0ff;
  --green: #22c55e;
  --green-soft: #e8f8ee;
  --red: #ef4444;
  --red-soft: #fdecec;
  --amber: #f59e0b;
  --amber-soft: #fef4e6;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #7c8aa3;
  --border: #e8ecf4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, "PingFang SC", sans-serif;
  background:
    radial-gradient(1100px 380px at 100% -5%, #e6ebff 0%, rgba(230,235,255,0) 45%),
    radial-gradient(900px 380px at -5% 100%, #eef0ff 0%, rgba(238,240,255,0) 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 15% 10%, #312e81 0%, #0b1226 55%, #050816 100%);
  position: relative; overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5;
}
.login-wrap::before { width: 380px; height: 380px; background: #6366f1; top: -80px; right: -60px; }
.login-wrap::after { width: 320px; height: 320px; background: #8b5cf6; bottom: -100px; left: -60px; }
.login-card {
  position: relative; z-index: 1; width: 380px; background: rgba(255,255,255,.98);
  border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 18px;
  box-shadow: 0 8px 20px rgba(99,102,241,.45);
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: .3px; }
.login-card p { color: var(--muted); margin: 0 0 26px; font-size: 13px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; background: linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
  color: #cbd5e1; padding: 20px 14px; display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.brand .name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .4px; }
.brand .sub { color: #64748b; font-size: 11px; }
.nav-group-label { color: #64748b; font-size: 11px; padding: 12px 12px 6px; letter-spacing: 1px; }
.nav-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; color: #c3cfe3;
  display: flex; align-items: center; gap: 10px; margin-bottom: 3px; transition: .18s;
  font-size: 13.5px; position: relative;
}
.nav-item .ico { width: 18px; display: inline-flex; justify-content: center; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.9), rgba(139,92,246,.9));
  color: #fff; box-shadow: 0 8px 18px rgba(99,102,241,.35);
}
.sidebar .who {
  margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05);
  font-size: 12px; color: #94a3b8;
}
.sidebar .who .u { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #e2e8f0; }
.sidebar .who .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--grad);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}

.main { flex: 1; margin-left: 236px; padding: 22px 28px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.topbar h2 { margin: 0; font-size: 21px; letter-spacing: .3px; }
.topbar .right { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.chip { padding: 5px 12px; border-radius: 20px; background: #fff; box-shadow: var(--shadow-sm); }

/* ---------------- 卡片 ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: .2s;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 26px; font-weight: 800; margin-top: 10px; letter-spacing: -.5px; }
.card .value.green { color: var(--green); }
.card .value.red { color: var(--red); }
.card .value.amber { color: var(--amber); }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 8px; }
.card .ico-box {
  position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: var(--primary-soft);
}

/* ---------------- 面板 ---------------- */
.panel {
  background: var(--panel); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-top: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head .desc { color: var(--muted); font-size: 12px; margin-top: 3px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------------- 表单 ---------------- */
input, select, textarea {
  font: inherit; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none; transition: .18s; width: 100%;
}
input::placeholder, textarea::placeholder { color: #a9b4c7; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.14); }
textarea { resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }

/* ---------------- 按钮 ---------------- */
button {
  font: inherit; font-weight: 600; padding: 10px 18px; border: none; border-radius: var(--radius-sm);
  cursor: pointer; background: var(--grad); color: #fff; transition: .18s;
  box-shadow: 0 6px 16px rgba(99,102,241,.28);
}
button:hover { filter: brightness(1.06); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.ghost { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
button.ghost:hover { background: #e3e6ff; }
button.danger { background: var(--red); box-shadow: 0 6px 16px rgba(239,68,68,.25); }
button.success { background: var(--green); box-shadow: 0 6px 16px rgba(34,197,94,.25); }
button.plain {
  background: #fff; color: var(--text-2); box-shadow: var(--shadow-sm); border: 1.5px solid var(--border);
}
button.plain:hover { border-color: var(--primary); color: var(--primary); }
button.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; box-shadow: none; }
button.icon-btn { padding: 8px 10px; background: #fff; color: var(--text-2); box-shadow: var(--shadow-sm); border: 1.5px solid var(--border); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; position: sticky; top: 0; font-size: 12px; }
tbody tr { transition: .12s; }
tbody tr:hover td { background: #f6f8ff; }
tbody tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge.green { background: var(--green-soft); color: #15803d; }
.badge.red { background: var(--red-soft); color: #b91c1c; }
.badge.amber { background: var(--amber-soft); color: #b45309; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.purple { background: var(--primary-soft); color: var(--primary); }

.pager { display: flex; gap: 10px; align-items: center; margin-top: 16px; color: var(--muted); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.copy { cursor: pointer; color: var(--primary); font-size: 12px; margin-left: 6px; user-select: none; }
.copy:hover { text-decoration: underline; }

/* ---------------- 看板 hero ---------------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 26px 30px; color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  box-shadow: 0 18px 40px rgba(99, 102, 241, .35);
  display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 22px;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.14); }
.hero::before { width: 220px; height: 220px; right: -40px; top: -80px; }
.hero::after { width: 140px; height: 140px; right: 120px; bottom: -90px; background: rgba(255,255,255,.09); }
.hero .k { font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 8px; }
.hero .issue { font-size: 30px; font-weight: 800; letter-spacing: 1.5px; margin: 8px 0 10px; }
.hero .meta { font-size: 12.5px; opacity: .9; }
.hero .meta b { font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.live { background: rgba(34,197,94,.22); color: #d1fae5; }
.pill.lock { background: rgba(245,158,11,.24); color: #fef3c7; }
.pill.done { background: rgba(255,255,255,.2); color: #fff; }
.hero-right { text-align: right; position: relative; z-index: 1; }
.hero-right .cd { font-size: 42px; font-weight: 800; letter-spacing: 2px; font-variant-numeric: tabular-nums; line-height: 1; }
.hero-right .cd-label { font-size: 12px; opacity: .85; margin-top: 8px; }
.hero-right .last { font-size: 12.5px; opacity: .9; margin-top: 12px; }

.section-title { margin: 26px 0 14px; font-size: 14px; color: var(--text-2); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 14px; border-radius: 3px; background: var(--grad); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .48); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; transition: opacity .18s; padding: 20px;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: 460px; max-width: 100%; max-height: 88vh; overflow: auto; background: #fff;
  border-radius: 18px; box-shadow: var(--shadow-lg); transform: scale(.94) translateY(10px);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.2); padding: 26px;
}
.modal-mask.show .modal { transform: scale(1) translateY(0); }
.modal.wide { width: 640px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .modal-desc { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.modal .modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal .modal-actions button { min-width: 88px; }
.modal .view-row { display: flex; flex-direction: column; gap: 4px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.modal .view-row .k { color: var(--muted); font-size: 12px; }
.modal .view-row .v { font-size: 13px; word-break: break-all; }

/* ---------------- toast ---------------- */
.toast-wrap { position: fixed; top: 22px; right: 22px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; color: var(--text); padding: 13px 18px; border-radius: 12px;
  box-shadow: var(--shadow); border-left: 4px solid var(--primary); font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 10px; transform: translateX(120%); transition: .3s cubic-bezier(.2,.9,.3,1.2);
  min-width: 200px;
}
.toast.show { transform: translateX(0); }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

@media (max-width: 980px) {
  .sidebar { width: 70px; padding: 16px 8px; }
  .brand .name, .brand .sub, .nav-item span, .sidebar .who .txt, .nav-group-label { display: none; }
  .nav-item { justify-content: center; }
  .main { margin-left: 70px; padding: 18px; }
  .settings-grid, .grid-2 { grid-template-columns: 1fr; }
  .modal, .modal.wide { width: 100%; }
}