:root {
  --bg: #eef0f7;
  --sidebar-bg: #0a0f1f;
  --sidebar-text: #9aa5c4;
  --sidebar-active: #1c2148;
  --accent: #d4af37;
  --accent-dark: #a9791b;
  --accent2: #7c5cff;
  --accent2-dark: #5f3fe0;
  --gradient-brand: linear-gradient(135deg, #0a0f1f 0%, #241a52 48%, #c9932c 100%);
  --gradient-gold: linear-gradient(135deg, #f9e29b 0%, #d4af37 55%, #a9791b 100%);
  --gradient-violet: linear-gradient(135deg, #8f7bff 0%, #5f3fe0 100%);
  --text: #1a1f2e;
  --muted: #6b7280;
  --card-bg: #ffffff;
  --border: #e6e8f0;
  --radius: 14px;
  --danger: #d64545;
  --success: #17a869;
  --shadow-soft: 0 1px 2px rgba(20,24,50,0.04), 0 8px 24px rgba(20,24,50,0.06);
  --shadow-lift: 0 10px 30px rgba(20,24,50,0.12);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 600; }
p { margin: 0; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--gradient-brand);
  background-attachment: fixed;
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
  position: relative;
  overflow: hidden;
}
.sidebar::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 300px; height: 300px;
  background: repeating-conic-gradient(from 0deg, rgba(212,175,55,0.16) 0deg 4deg, transparent 4deg 14deg);
  border-radius: 50%;
  pointer-events: none;
}
.brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--gradient-gold);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 6px 16px rgba(201,147,44,0.4);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand .cn { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 1.5px; }
.brand .en { font-size: 10px; color: var(--accent); letter-spacing: 2.5px; margin-top: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  cursor: pointer;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
  font-size: 14px;
  position: relative;
  z-index: 1;
  transition: background 0.15s, color 0.15s;
}
.nav-item .ic { font-size: 15px; width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(212,175,55,0.18), transparent);
  color: #fff;
  border-left-color: var(--accent);
}
.sidebar-footer { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid rgba(255,255,255,0.1); position: relative; z-index: 1; }
.sidebar-user { font-size: 13px; color: #fff; margin-bottom: 8px; }
.sidebar-user .role-tag {
  color: #1a1200; background: var(--gradient-gold);
  font-size: 10px; margin-left: 4px; padding: 1px 7px; border-radius: 100px; font-weight: 600;
}
.logout-link { font-size: 12px; color: var(--sidebar-text); cursor: pointer; }
.logout-link:hover { color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 32px 60px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 20px; }
.page-header .desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Hero banner ---------- */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 30px 34px;
  color: #fff;
  background: var(--gradient-brand);
  margin-bottom: 20px;
  box-shadow: var(--shadow-lift);
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -60%; right: -8%;
  width: 420px; height: 420px;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.10) 0deg 3deg, transparent 3deg 11deg);
  border-radius: 50%;
}
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -140px; left: 30%;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(124,92,255,0.35), transparent 70%);
  border-radius: 50%;
  filter: blur(4px);
}
.hero-banner .hb-content { position: relative; z-index: 1; max-width: 640px; }
.hero-banner .hb-eyebrow { font-size: 11px; letter-spacing: 3px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.hero-banner h1 { font-size: 24px; color: #fff; margin-bottom: 8px; }
.hero-banner p { color: rgba(255,255,255,0.72); font-size: 13.5px; line-height: 1.6; }

/* ---------- Card / Table ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.15s, transform 0.15s;
}
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-card .stat-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.stat-card .stat-icon.gold { background: var(--gradient-gold); color: #1a1200; }
.stat-card .stat-icon.violet { background: var(--gradient-violet); }
.stat-card .stat-icon.navy { background: var(--gradient-brand); }
.stat-card .stat-icon.teal { background: linear-gradient(135deg,#3fd6c6,#149e8c); }
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-card .label { color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: #faf9ff; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 12px;
  background: #eef0f4;
  color: var(--muted);
}
.badge.gold { background: linear-gradient(135deg,#fbf0cf,#f5e2a8); color: var(--accent-dark); font-weight: 600; }
.badge.violet { background: #ece6ff; color: var(--accent2-dark); font-weight: 600; }
.badge.green { background: #e1f7ee; color: var(--success); }
.badge.red { background: #fbe9e9; color: var(--danger); }

/* ---------- Form ---------- */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,175,55,0.15); }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(10,15,31,0.35); }
.btn.gold { background: var(--gradient-gold); color: #1a1200; border-color: transparent; font-weight: 600; }
.btn.gold:hover { box-shadow: 0 6px 18px rgba(201,147,44,0.4); }
.btn.danger { color: var(--danger); border-color: #f3c8c8; }
.btn.danger:hover { background: #fbe9e9; }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search-input { max-width: 240px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 13px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  background: #fff;
  transition: all 0.15s;
}
.chip.active { background: var(--gradient-brand); color: #fff; border-color: transparent; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,15,31,0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  padding: 22px 24px;
  box-shadow: 0 30px 80px rgba(10,15,31,0.4);
}
.modal.wide { max-width: 760px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--gradient-brand);
  position: relative;
  overflow: hidden;
}
.login-screen::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 900px; height: 900px;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(212,175,55,0.08) 0deg 2.5deg, transparent 2.5deg 9deg);
  border-radius: 50%;
}
.login-screen::after {
  content: '';
  position: absolute; bottom: -200px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(124,92,255,0.35), transparent 70%);
  border-radius: 50%;
}
.login-box {
  position: relative; z-index: 1;
  background: #fff; border-radius: 18px; padding: 40px 36px;
  width: 100%; max-width: 360px; box-shadow: 0 30px 80px rgba(0,0,0,0.45);
}
.login-box .brand { border: none; padding: 0; margin-bottom: 26px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.login-box .brand-mark { width: 52px; height: 52px; margin-bottom: 12px; border-radius: 14px; }
.login-box .brand-mark svg { width: 30px; height: 30px; }
.login-box .brand .cn { color: var(--sidebar-bg); font-size: 22px; }
.login-box .brand .sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.login-box .btn.primary { width: 100%; justify-content: center; margin-top: 6px; }
.error-msg { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 16px; }

/* ---------- Media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; position: relative; }
.media-item img, .media-item video { width: 100%; height: 100px; object-fit: cover; display: block; background: #000; }
.media-item .media-title { font-size: 11px; padding: 5px 7px; color: var(--muted); }
.media-item .remove-btn {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.55);
  color: #fff; border-radius: 50%; width: 20px; height: 20px; text-align: center;
  line-height: 20px; cursor: pointer; font-size: 12px;
}

/* ---------- Cover placeholders (auto-generated banners for cards without an image) ---------- */
.cover-banner { width: 100%; height: 128px; border-radius: 12px; margin-bottom: 12px; position: relative; overflow: hidden; }
.cover-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-banner .cb-icon {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: rgba(255,255,255,0.92);
}
.cover-banner .cb-rays {
  position: absolute; top: -40%; right: -20%; width: 200px; height: 200px;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.16) 0deg 4deg, transparent 4deg 13deg);
  border-radius: 50%;
}
.cover-1 { background: linear-gradient(135deg,#241a52,#c9932c); }
.cover-2 { background: linear-gradient(135deg,#5f3fe0,#8f7bff); }
.cover-3 { background: linear-gradient(135deg,#0a0f1f,#3a4a8a); }
.cover-4 { background: linear-gradient(135deg,#149e8c,#3fd6c6); }
.cover-5 { background: linear-gradient(135deg,#a9791b,#f9e29b); }
.cover-6 { background: linear-gradient(135deg,#7c2f6e,#c9682f); }

.text-muted { color: var(--muted); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Mobile ---------- */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  html, body { overflow-x: hidden; }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 150;
    background: var(--gradient-brand);
    color: #fff;
    padding: 12px 16px;
  }
  .mobile-topbar .hamburger {
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 9px;
    background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px;
  }
  .mobile-topbar .mt-brand { font-size: 15px; font-weight: 700; letter-spacing: 1px; }

  .app-shell { flex-direction: column; min-height: auto; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 210;
    box-shadow: 0 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop.open {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10,15,31,0.55);
    z-index: 200;
  }

  .main { padding: 18px 14px 48px; }

  .hero-banner { padding: 22px 20px; }
  .hero-banner h1 { font-size: 19px; }
  .hero-banner p { font-size: 13px; }

  .page-header h1 { font-size: 18px; }

  table { min-width: 640px; }

  .field-row > .field { min-width: 100%; }

  .modal, .modal.wide { max-width: 100%; padding: 18px; }

  .grid-4 .stat-card { padding: 4px 0; }
}
