/* ===== Admin Layout ===== */
.admin-app {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--navy-800);
  color: #cbd5e1;
  padding: 22px 16px;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .brand-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 22px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand-row .logo {
  width: 36px; height: 36px;
  background: var(--grad-gold);
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--navy-800); font-weight: 800; font-size: 16px;
}
.sidebar .brand-row .name { color: #fff; font-weight: 700; font-size: 15px; }
.sidebar .brand-row .sub { color: var(--gold-400); font-size: 11px; font-weight: 500; }

.nav-group { margin-bottom: 14px; }
.nav-group-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: rgba(255,255,255,.4);
  padding: 6px 10px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 13.5px; font-weight: 500;
  transition: all .15s ease;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(212,175,55,.18), rgba(212,175,55,.02));
  color: #fff;
  position: relative;
}
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px;
  width: 3px; background: var(--gold-500); border-radius: 0 4px 4px 0;
}
.nav-item .icon { width: 18px; height: 18px; }
.nav-item .count {
  margin-left: auto;
  font-size: 10px; padding: 2px 7px;
  background: rgba(212,175,55,.18); color: var(--gold-400);
  border-radius: 999px; font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-foot .avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad-gold);
  display: grid; place-items: center;
  color: var(--navy-800); font-weight: 800;
}
.sidebar-foot .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-foot .role { color: rgba(255,255,255,.5); font-size: 11px; }

/* topbar */
.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 18px;
}
.search-box {
  flex: 1; max-width: 480px;
  position: relative;
}
.search-box input {
  width: 100%; padding: 10px 14px 10px 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
}
.search-box input:focus { outline: none; border-color: var(--navy-600); background: #fff; }
.search-box .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }

.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-2);
  position: relative;
  transition: all .15s;
}
.icon-btn:hover { background: var(--navy-50); color: var(--navy-700); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--surface);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--bg);
}
.user-chip .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad-navy); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
}
.user-chip .nm { font-size: 12px; font-weight: 600; }
.user-chip .rl { font-size: 10px; color: var(--text-3); }

.content {
  padding: 28px;
  flex: 1;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -.01em;
  margin-bottom: 4px;
}
.page-head .crumb { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.page-head .crumb a:hover { color: var(--navy-700); }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.stat-card .ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.stat-card .label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-card .delta {
  margin-top: 8px;
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
}
.stat-card.navy .ico { background: rgba(30,58,138,.1); color: var(--navy-700); }
.stat-card.gold .ico { background: var(--gold-100); color: var(--gold-600); }
.stat-card.green .ico { background: var(--success-bg); color: #047857; }
.stat-card.purple .ico { background: #ede9fe; color: #6d28d9; }
.delta.up { background: var(--success-bg); color: #065f46; }
.delta.down { background: var(--danger-bg); color: #991b1b; }

.row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 18px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title h3 { font-size: 15px; font-weight: 700; }
.section-title .actions { display: flex; gap: 8px; }
.tabs {
  display: flex; gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  font-size: 12px;
}
.tabs button {
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--text-2);
  font-weight: 500;
}
.tabs button.active { background: #fff; color: var(--navy-800); font-weight: 600; box-shadow: var(--shadow-sm); }

/* table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th, .tbl td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.tbl th { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 600; }
.tbl tbody tr:hover { background: var(--navy-50); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .cell-user { display: flex; align-items: center; gap: 10px; }
.tbl .cell-user img,
.tbl .cell-user .av {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-navy); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
}

/* heatmap */
.heatmap {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.heatmap .cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--navy-50);
  position: relative;
}
.heatmap .cell[data-h="1"] { background: #d8e0f3; }
.heatmap .cell[data-h="2"] { background: #a3b3df; }
.heatmap .cell[data-h="3"] { background: #5d75c0; }
.heatmap .cell[data-h="4"] { background: var(--navy-700); }
.heatmap .cell[data-h="5"] { background: var(--gold-500); }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); margin-top: 10px; }
.heat-legend span { width: 14px; height: 14px; border-radius: 4px; }

/* ROI bars */
.roi-list { display: flex; flex-direction: column; gap: 14px; }
.roi-item .row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.roi-item .bar {
  height: 8px; background: var(--bg);
  border-radius: 999px; overflow: hidden;
}
.roi-item .bar > div {
  height: 100%; border-radius: 999px;
  background: var(--grad-navy);
}
.roi-item .bar > div.gold { background: var(--grad-gold); }

/* event card grid */
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.event-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .2s;
}
.event-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--navy-500); }
.event-card .cover {
  height: 130px;
  background-size: cover; background-position: center;
  position: relative;
}
.event-card .cover .cat {
  position: absolute; top: 12px; left: 12px;
}
.event-card .cover .mode {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 10px; padding: 4px 9px;
  border-radius: 999px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  backdrop-filter: blur(6px);
}
.event-card .body { padding: 16px; }
.event-card h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 8px; line-height: 1.35; }
.event-card .meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 11.5px; color: var(--text-2); margin-bottom: 12px;
}
.event-card .meta span { display: flex; align-items: center; gap: 4px; }
.event-card .foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-2);
}
.event-card .speakers { display: flex; }
.event-card .speakers .av {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff;
  background: var(--grad-navy);
  display: grid; place-items: center; color: #fff;
  font-size: 10px; font-weight: 700;
  margin-left: -8px;
}
.event-card .speakers .av:first-child { margin-left: 0; }

/* form */
.form-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; max-width: 880px; }
.form-card .section { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px dashed var(--border); }
.form-card .section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.form-card .section h4 { font-size: 14px; margin-bottom: 4px; }
.form-card .section p.hint { font-size: 12px; color: var(--text-3); margin-bottom: 14px; }
.radio-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.radio-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
}
.radio-card:hover { border-color: var(--navy-500); }
.radio-card.active { border-color: var(--navy-700); background: var(--navy-50); }
.radio-card .t { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.radio-card .d { font-size: 11.5px; color: var(--text-2); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  background: #fff;
  transition: all .15s;
}
.chip:hover { border-color: var(--navy-500); }
.chip.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

.kpi-mini { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; }
.kpi-mini > div { padding: 12px 16px; border-right: 1px solid var(--border-2); }
.kpi-mini > div:last-child { border-right: 0; }
.kpi-mini .l { font-size: 11px; color: var(--text-2); }
.kpi-mini .v { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* category pill */
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700;
  background: rgba(255,255,255,.92); color: var(--navy-800);
  text-transform: uppercase; letter-spacing: .04em;
  backdrop-filter: blur(4px);
}
.cat-tech { background: #dbeafe; color: #1e40af; }
.cat-soft { background: #fce7f3; color: #9d174d; }
.cat-product { background: var(--gold-100); color: var(--gold-600); }
.cat-sales { background: #d1fae5; color: #065f46; }
.cat-webinar { background: #ede9fe; color: #6d28d9; }

/* leaderboard ranks */
.rank-bubble {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
  background: var(--bg); color: var(--text-2);
}
.rank-bubble.r1 { background: var(--grad-gold); color: var(--navy-800); }
.rank-bubble.r2 { background: linear-gradient(135deg, #e5e7eb, #f8fafc); color: var(--navy-800); }
.rank-bubble.r3 { background: linear-gradient(135deg, #f0a877, #fde0c4); color: #7c2d12; }

/* level pill */
.lvl-pill {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  letter-spacing: .04em;
}
.lvl-rookie { background: #f1f5f9; color: #475569; }
.lvl-pro { background: #dbeafe; color: #1e40af; }
.lvl-elite { background: var(--gold-100); color: var(--gold-600); }
.lvl-master { background: var(--grad-navy); color: var(--gold-400); }

/* progress ring (xp etc) */
.ring {
  --val: 70;
  --size: 80px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: conic-gradient(var(--gold-500) calc(var(--val) * 1%), var(--bg) 0);
  display: grid; place-items: center;
  position: relative;
}
.ring::before {
  content: ''; position: absolute; inset: 6px;
  background: #fff; border-radius: 50%;
}
.ring .inner { position: relative; font-weight: 700; font-size: 13px; text-align: center; }
.ring .inner .pct { color: var(--navy-800); font-size: 18px; }

/* callout */
.callout {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: #fff; border-radius: var(--radius);
  padding: 22px;
  position: relative; overflow: hidden;
}
.callout::after {
  content: ''; position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, var(--gold-500), transparent 70%);
  opacity: .35;
}
.callout h3 { color: #fff; font-size: 18px; margin-bottom: 6px; }
.callout p { color: rgba(255,255,255,.75); font-size: 12.5px; margin-bottom: 14px; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,15,42,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius);
  width: 100%; max-width: 520px;
  padding: 24px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .row-2, .row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin-app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 16px; }
}
