@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --p: #5b3df5;
  --p-dark: #4330d4;
  --p-soft: #ede9fe;
  --p-glow: rgba(91, 61, 245, 0.18);
  --accent: #10b981;
  --accent-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --bg: #f1f5fb;
  --bg-2: #e8eef8;
  --surface: #ffffff;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --sidebar: #151233;
  --sidebar-2: #1f1a4d;
  --sidebar-text: rgba(255, 255, 255, 0.72);
  --sidebar-active: rgba(255, 255, 255, 0.12);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.12);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --ease: 180ms ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

a { color: var(--p); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--p-dark); }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(91, 61, 245, 0.35), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(78, 156, 255, 0.18), transparent 38%);
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #7b5cff, #4e9cff);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(91, 61, 245, 0.35);
  flex-shrink: 0;
}

.brand-mark svg { width: 20px; height: 20px; }

.brand b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand span {
  display: block;
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
  font-weight: 500;
}

nav {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

nav::-webkit-scrollbar { width: 4px; }
nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }

.nav-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--ease), color var(--ease), transform var(--ease);
  border: 1px solid transparent;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  opacity: 0.85;
  flex-shrink: 0;
}

.nav-item .nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 3px 0 0 #7b5cff;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 14px 12px 0;
  font-size: 12px;
  color: var(--sidebar-text);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
  margin-right: 8px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }
  50% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.08); }
}

/* ── Main shell ── */
main {
  min-width: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(91, 61, 245, 0.06), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(78, 156, 255, 0.05), transparent 28%),
    var(--bg);
}

.topbar {
  min-height: 78px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

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

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.top-actions select,
.top-actions input {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink-2);
}

.ghost, .primary {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease), border-color var(--ease);
}

.ghost {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.ghost:hover {
  background: var(--line-soft);
  border-color: #cbd5e1;
}

.primary {
  background: linear-gradient(135deg, var(--p), #4e9cff);
  color: #fff;
  box-shadow: 0 6px 16px var(--p-glow);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(91, 61, 245, 0.28);
}

.primary:active, .ghost:active { transform: translateY(0); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--p-soft), #dbeafe);
  color: var(--p-dark);
  font-weight: 800;
  font-size: 14px;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}

.content {
  padding: 24px 28px 40px;
}

/* ── Cards & KPIs ── */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #047857;
  margin-bottom: 16px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #bbf7d0;
}

.sync-pill {
  font-size: 11px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #047857;
  font-weight: 700;
  border: 1px solid #bbf7d0;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), transform var(--ease), border-color var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

.kpi {
  position: relative;
  overflow: hidden;
  padding-top: 20px;
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--p), #4e9cff);
}

.kpi:nth-child(2)::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi:nth-child(3)::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi:nth-child(4)::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.kpi:nth-child(5)::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.kpi:nth-child(6)::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }

.kpi .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.kpi .value {
  font-size: 30px;
  font-weight: 800;
  margin: 10px 0 6px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi .hint {
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.45;
}

.grid2 {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.section-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.trend {
  height: 240px;
  display: flex;
  align-items: end;
  gap: 8px;
  padding-top: 12px;
}

.bar {
  flex: 1;
  background: linear-gradient(180deg, #8b7bff, #5b3df5);
  border-radius: 8px 8px 4px 4px;
  min-width: 10px;
  opacity: 0.88;
  transition: opacity var(--ease), transform var(--ease);
}

.bar:hover {
  opacity: 1;
  transform: translateY(-3px);
}

.legend {
  font-size: 12px;
  color: var(--muted);
}

.alert {
  padding: 14px 4px;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 42px 88px 1fr;
  align-items: center;
  gap: 10px;
  transition: background var(--ease);
}

.alert:hover { background: #fafbfe; }
.alert:last-child { border-bottom: 0; }

.level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 26px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--line-soft);
  color: var(--muted);
}

.level.high { background: var(--danger-soft); color: var(--danger); }
.level.mid { background: var(--warn-soft); color: #b45309; }

.alert b { font-size: 13px; font-weight: 700; color: var(--ink); }
.alert span { font-size: 13px; color: var(--muted); }

/* ── Tables ── */
.card-table { padding: 0; overflow: hidden; }

.card-table table { margin: 0; }

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

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: none;
  background: #f8fafc;
}

tbody tr { transition: background var(--ease); }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }

td { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--p-soft);
  color: var(--p-dark);
  border: 1px solid #ddd6fe;
}

.pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

.pill.ok {
  background: var(--accent-soft);
  color: #047857;
  border-color: #bbf7d0;
}

.score { font-weight: 800; color: var(--warn); }
.score.good { color: #047857; }

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input,
.toolbar select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink-2);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.toolbar input:focus,
.toolbar select:focus,
.form-grid input:focus,
.form-grid select:focus,
.login-form input:focus {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(91, 61, 245, 0.12);
}

.toolbar input { min-width: 260px; flex: 1; max-width: 360px; }

.link-actions a {
  color: var(--p);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 0;
}

.link-actions a:hover { text-decoration: underline; }

.quick-links {
  display: grid;
  gap: 8px;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}

.quick-link:hover {
  background: var(--p-soft);
  border-color: #ddd6fe;
  color: var(--p-dark);
  transform: translateX(2px);
}

.quick-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.stat-inline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
}

.stat-inline b {
  font-size: 28px;
  font-weight: 800;
  color: var(--p);
  font-variant-numeric: tabular-nums;
}

.stat-inline span { font-size: 13px; color: var(--muted); }

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}

.empty h3 { margin: 0 0 8px; color: var(--ink); font-size: 18px; }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}

.hidden { display: none !important; }

.modal-card {
  width: min(560px, 100%);
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: modalIn 220ms ease-out;
}

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

.modal-card h2 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.close {
  position: absolute;
  right: 16px;
  top: 14px;
  border: 0;
  background: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--ease), color var(--ease);
}

.close:hover { background: #e2e8f0; color: var(--ink); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}

.form-grid input,
.form-grid select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}

.login-hero {
  position: relative;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, #151233 0%, #2d2480 52%, #4330d4 100%);
  color: #fff;
  overflow: hidden;
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(78,156,255,.25), transparent 45%);
  pointer-events: none;
}

.login-hero > * { position: relative; z-index: 1; }

.login-hero h2 {
  margin: 32px 0 12px;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 420px;
}

.login-hero p {
  margin: 0;
  color: rgba(255,255,255,.78);
  line-height: 1.7;
  max-width: 420px;
  font-size: 14px;
}

.login-features {
  display: grid;
  gap: 12px;
  margin-top: 36px;
}

.login-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
}

.login-feature b { display: block; font-size: 14px; margin-bottom: 2px; }
.login-feature span { font-size: 12px; color: rgba(255,255,255,.72); line-height: 1.5; }

.login-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.14);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.login-feature-icon svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 40px 32px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  margin: 22px 0 8px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-form { display: grid; gap: 16px; }

.login-form label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}

.login-form input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fff;
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  font-size: 14px;
}

.login-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--line-soft);
}

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--p);
  font-weight: 600;
}

.brand-login-panel { padding: 0; border: 0; margin: 0; }
.brand-login-panel .brand-mark { width: 40px; height: 40px; border-radius: 12px; }

.login-panel .brand b { color: var(--ink); }
.login-panel .brand span { color: var(--muted); }

@media (max-width: 1300px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    min-height: unset;
  }
  .sidebar-foot { position: relative; bottom: auto; left: auto; margin-top: 16px; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { min-height: 280px; padding: 32px 24px; }
  .login-hero h2 { font-size: 26px; }
  .grid3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* 首页轮播：16:9 上传与预览 */
.hb-thumb-16x9{
  width:96px;aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#eee;
  box-shadow:0 2px 8px rgba(40,28,90,.08)
}
.hb-thumb-16x9 img{width:100%;height:100%;object-fit:cover;display:block}
.hb-upload-block{grid-column:1/-1;display:grid;gap:10px}
.hb-upload-label{font-size:13px;color:var(--ink-2);font-weight:600}
.hb-preview-16x9{
  width:100%;aspect-ratio:16/9;border-radius:14px;overflow:hidden;
  background:#f1f5f9;border:1px dashed #cbd5e1;
  display:grid;place-items:center;position:relative
}
.hb-preview-16x9.has-img{border-style:solid;border-color:#e2e8f0}
.hb-preview-16x9 img{width:100%;height:100%;object-fit:cover;display:block}
.hb-preview-empty{font-size:13px;color:var(--muted);padding:16px;text-align:center}
.hb-upload-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.hb-file-btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 14px;border-radius:10px;border:1px solid var(--line);
  background:#fff;font-size:13px;font-weight:700;cursor:pointer;color:var(--ink)
}
.hb-file-btn:hover{background:#f8fafc}
.hb-upload-status{font-size:12px;color:var(--muted)}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
