/* ============================================
   Creator Success Command Center — Design System
   ============================================ */

:root {
  /* Surfaces */
  --bg-0: #07080c;
  --bg-1: #0b0d14;
  --bg-2: #11141d;
  --bg-3: #161a26;
  --surface: rgba(22, 26, 38, 0.6);
  --surface-strong: rgba(28, 33, 48, 0.85);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Text */
  --text-0: #f4f6fb;
  --text-1: #c9cfdd;
  --text-2: #8a93a8;
  --text-3: #5a6478;

  /* Brand */
  --brand: #7c5cff;
  --brand-2: #5b8cff;
  --brand-glow: rgba(124, 92, 255, 0.45);

  /* RAG */
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.16);

  /* Accents */
  --cyan: #22d3ee;
  --pink: #ec4899;
  --lime: #a3e635;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow: 0 10px 30px rgba(0,0,0,0.35), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.05) inset;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  background: var(--bg-0);
  color: var(--text-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* Ambient background — subtle aurora */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(124,92,255,0.18), transparent 60%),
    radial-gradient(800px 500px at 95% 10%, rgba(34,211,238,0.10), transparent 60%),
    radial-gradient(700px 600px at 50% 110%, rgba(236,72,153,0.08), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ============== Layout shell ============== */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11,13,20,0.9), rgba(11,13,20,0.7));
  backdrop-filter: blur(20px);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 22px 8px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  box-shadow: 0 6px 22px var(--brand-glow);
  font-weight: 800;
  color: white;
  font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.nav-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-3);
  padding: 14px 10px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text-1);
  font-size: 13.5px;
  text-decoration: none;
  font-weight: 500;
  transition: all .15s ease;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-0); }
.nav-item.active {
  background: linear-gradient(180deg, rgba(124,92,255,0.18), rgba(124,92,255,0.08));
  color: var(--text-0);
  box-shadow: inset 0 0 0 1px rgba(124,92,255,0.25);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 3px; background: linear-gradient(180deg, var(--brand), var(--brand-2));
  border-radius: 0 3px 3px 0;
}
.nav-item i { width: 16px; font-size: 14px; color: var(--text-2); }
.nav-item.active i { color: var(--brand); }
.nav-badge {
  margin-left: auto;
  background: var(--red-soft);
  color: var(--red);
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}

.sidebar-footer {
  position: absolute; bottom: 14px; left: 14px; right: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #f472b6, #7c5cff);
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-3); }

/* Main */
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: rgba(7,8,12,0.7);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.search {
  flex: 1; max-width: 460px;
  position: relative;
}
.search input {
  width: 100%; padding: 9px 12px 9px 36px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-0);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all .15s;
}
.search input:focus { border-color: rgba(124,92,255,0.5); background: rgba(255,255,255,0.06); }
.search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 13px;
}
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-3);
  background: rgba(255,255,255,0.05);
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border);
  font-family: inherit;
}

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-1);
  cursor: pointer;
  position: relative;
  transition: all .15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-0); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--bg-0);
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-0);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn:hover { background: rgba(255,255,255,0.08); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 6px 18px var(--brand-glow);
}
.btn-primary:hover { filter: brightness(1.08); }

/* Content */
.content { padding: 24px 28px 60px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px; flex-wrap: wrap;
}
.page-header h1 {
  margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.025em;
}
.page-header p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }

/* ============== Glass panels ============== */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  position: relative;
}
.glass-pad { padding: 18px; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 13.5px; font-weight: 600; }
.panel-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ============== KPI grid ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
  transition: all .2s ease;
  cursor: pointer;
}
.kpi:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.kpi::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(400px 120px at 100% 0%, rgba(124,92,255,0.10), transparent 60%);
  pointer-events: none;
}
.kpi-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.kpi-label i { font-size: 11px; }
.kpi-value {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 8px;
  font-feature-settings: 'tnum';
}
.kpi-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-2);
}
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 11.5px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--text-2); }

.kpi-spark { height: 36px; margin-top: 10px; }

/* ============== Grids ============== */
.grid {
  display: grid; gap: 16px;
}
.grid-12 { grid-template-columns: repeat(12, 1fr); }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* ============== RAG ============== */
.rag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.rag .dot { width: 7px; height: 7px; border-radius: 50%; }
.rag.green { background: var(--green-soft); color: #4ade80; }
.rag.green .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.rag.amber { background: var(--amber-soft); color: #fbbf24; }
.rag.amber .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.rag.red { background: var(--red-soft); color: #f87171; }
.rag.red .dot { background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.8s infinite; }

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ============== Heatmap ============== */
.heatmap {
  display: grid;
  grid-template-columns: 110px repeat(14, 1fr);
  gap: 4px;
  font-size: 11px;
}
.heatmap .h-label { color: var(--text-2); padding: 2px 6px 2px 0; align-self: center; font-size: 11px; }
.heatmap .h-col-label { color: var(--text-3); font-size: 10px; text-align: center; }
.heatmap .cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: transform .12s;
  position: relative;
}
.heatmap .cell:hover { transform: scale(1.18); z-index: 2; outline: 1px solid var(--border-strong); }
.cell.g0 { background: rgba(34,197,94,0.12); }
.cell.g1 { background: rgba(34,197,94,0.28); }
.cell.g2 { background: rgba(34,197,94,0.55); }
.cell.a1 { background: rgba(245,158,11,0.35); }
.cell.a2 { background: rgba(245,158,11,0.65); }
.cell.r1 { background: rgba(239,68,68,0.45); }
.cell.r2 { background: rgba(239,68,68,0.8); box-shadow: 0 0 12px rgba(239,68,68,0.4); }

/* ============== Tables ============== */
.table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
}
.table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background .12s; cursor: pointer; }
.table tbody tr:hover { background: rgba(255,255,255,0.025); }
.table tbody tr:last-child td { border-bottom: none; }

.creator-cell { display: flex; align-items: center; gap: 10px; }
.creator-name { font-weight: 600; font-size: 13px; }
.creator-meta { color: var(--text-3); font-size: 11px; margin-top: 2px; }

/* Progress bar */
.progress {
  height: 6px; border-radius: 4px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  position: relative;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 4px;
}
.progress.green > span { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress.amber > span { background: linear-gradient(90deg, #d97706, #f59e0b); }
.progress.red > span { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* Chips & filters */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-1);
  cursor: pointer;
  font-weight: 500;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { background: rgba(255,255,255,0.06); }
.chip.active {
  background: rgba(124,92,255,0.18);
  border-color: rgba(124,92,255,0.35);
  color: white;
}
.chip .count { color: var(--text-3); font-size: 11px; font-weight: 600; }

/* Tag */
.tag {
  display: inline-block;
  padding: 2px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600;
  background: rgba(255,255,255,0.05); color: var(--text-1);
  border: 1px solid var(--border);
}
.tag.brand { background: rgba(124,92,255,0.16); color: #b9a8ff; border-color: rgba(124,92,255,0.3); }
.tag.cyan { background: rgba(34,211,238,0.14); color: #67e8f9; border-color: rgba(34,211,238,0.3); }
.tag.pink { background: rgba(236,72,153,0.14); color: #f9a8d4; border-color: rgba(236,72,153,0.3); }
.tag.lime { background: rgba(163,230,53,0.14); color: #d9f99d; border-color: rgba(163,230,53,0.3); }
.tag.amber { background: var(--amber-soft); color: #fbbf24; border-color: rgba(245,158,11,0.3); }

/* AI panel */
.ai-panel {
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(124,92,255,0.18), transparent 60%),
    linear-gradient(180deg, rgba(28,33,48,0.85), rgba(22,26,38,0.6));
  border: 1px solid rgba(124,92,255,0.25);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.ai-panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,92,255,0.6), transparent);
}
.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,92,255,0.25), rgba(91,140,255,0.2));
  border: 1px solid rgba(124,92,255,0.35);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #c7b8ff;
}

/* Timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before {
  content: ''; position: absolute; left: -19px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--brand);
}
.timeline-item.green::before { border-color: var(--green); }
.timeline-item.amber::before { border-color: var(--amber); }
.timeline-item.red::before { border-color: var(--red); }
.timeline-time { font-size: 11px; color: var(--text-3); }
.timeline-title { font-size: 13px; font-weight: 500; margin: 2px 0; }
.timeline-body { font-size: 12px; color: var(--text-2); }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 400px;
}
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--border);
}
.kanban-col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-1); }
.kanban-col-count {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  background: rgba(255,255,255,0.05); padding: 2px 7px; border-radius: 999px;
}
.kanban-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .15s;
}
.kanban-card:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kanban-card-meta { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* SLA */
.sla {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px;
}
.sla.ok { background: var(--green-soft); color: #4ade80; }
.sla.warn { background: var(--amber-soft); color: #fbbf24; }
.sla.late { background: var(--red-soft); color: #f87171; }

/* Notifications panel */
.notif-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 380px; max-width: 100%;
  background: rgba(11,13,20,0.96);
  backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 100;
  display: flex; flex-direction: column;
}
.notif-panel.open { transform: translateX(0); box-shadow: -20px 0 60px rgba(0,0,0,0.5); }
.notif-head {
  padding: 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-list { flex: 1; overflow-y: auto; padding: 8px; }
.notif-item {
  padding: 12px;
  border-radius: 10px;
  display: flex; gap: 12px;
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 4px;
}
.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 13px;
}
.notif-icon.red { background: var(--red-soft); color: var(--red); }
.notif-icon.amber { background: var(--amber-soft); color: var(--amber); }
.notif-icon.brand { background: rgba(124,92,255,0.18); color: #b9a8ff; }
.notif-icon.green { background: var(--green-soft); color: var(--green); }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-body { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.notif-time { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }

/* Backdrop */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

/* Workload bars */
.workload-row {
  display: grid; grid-template-columns: 90px 1fr 50px;
  gap: 12px; align-items: center;
  padding: 8px 0;
}
.workload-row .label { font-size: 12px; color: var(--text-1); font-weight: 500; }
.workload-row .val { font-size: 12px; color: var(--text-2); text-align: right; font-feature-settings: 'tnum'; }

/* Misc */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.empty { color: var(--text-3); font-size: 12px; padding: 20px; text-align: center; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .4s ease both; }
.fade-up:nth-child(1) { animation-delay: 0.02s; }
.fade-up:nth-child(2) { animation-delay: 0.06s; }
.fade-up:nth-child(3) { animation-delay: 0.10s; }
.fade-up:nth-child(4) { animation-delay: 0.14s; }
.fade-up:nth-child(5) { animation-delay: 0.18s; }
.fade-up:nth-child(6) { animation-delay: 0.22s; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* Responsive */
@media (max-width: 1100px) {
  .app { grid-template-columns: 72px 1fr; }
  .sidebar { padding: 18px 8px; }
  .brand-name, .brand-sub, .nav-item span:not(.nav-badge), .nav-group-label, .user-name, .user-role { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item.active::before { display: none; }
  .sidebar-footer { justify-content: center; }
  .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 12; }
}
@media (max-width: 720px) {
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .search { display: none; }
  .kanban { grid-template-columns: repeat(6, 280px); }
}
