:root {
  --sidebar-w: 260px;
  --header-h: 68px;
  --rl: 16px;
  --rxl: 22px;
  --rxxl: 28px;
  
  --sh-card: 0 10px 30px rgba(15, 23, 42, 0.04);
  --sh-sidebar: 10px 0 40px rgba(15, 23, 42, 0.1);
  --sh-teal: 0 6px 20px rgba(13, 148, 136, 0.2);
  
  --grad-sidebar: linear-gradient(180deg, #08111f 0%, #0f172a 60%, #08111f 100%);
  --grad-hero: linear-gradient(135deg, #08111f 0%, #101b31 55%, #092a2b 100%);
}

/* GLOBAL RESET & OVERFLOW */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden;
  height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  background: var(--off);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR OVERLAY */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 28, 0.4);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--grad-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  box-shadow: var(--sh-sidebar);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 16px;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.sb-logo img {
  height: 34px;
  width: auto;
}
.sb-logo-text {
  display: flex;
  flex-direction: column;
}
.sb-logo-name {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.sb-logo-name span { color: var(--teal-l); }
.sb-logo-tag {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1px;
}

.sb-user-card {
  margin: 0 16px 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.sb-user-flex {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-user-av {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--teal-l));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2);
}
.sb-user-info {
  flex: 1;
  min-width: 0;
}
.sb-user-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-badge {
  font-size: 10px;
  color: var(--teal-l);
  font-weight: 600;
  margin-top: 1px;
}

.sb-nav {
  flex: 1;
  padding: 0 12px;
}
.sb-nav-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 12px;
  margin: 20px 0 8px;
}
.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.sb-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.sb-nav-item.active {
  background: rgba(20, 184, 166, 0.1);
  color: #fff;
  font-weight: 600;
  border-color: rgba(20, 184, 166, 0.15);
}
.sb-nav-item i {
  font-size: 17px;
  width: 18px;
  text-align: center;
}
.sb-nav-item .sb-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.sb-bottom {
  padding: 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sb-bottom a,
.sb-bottom button {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
  transition: all 0.2s;
  padding: 6px 10px;
  border-radius: 10px;
}
.sb-bottom a:hover,
.sb-bottom button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.sb-logout-form { margin: 0; }
.sb-bottom button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* MAIN CONTENT */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* Prevent flex overflow */
  padding-top: var(--header-h); /* Space for fixed topbar */
}

/* TOPBAR */
.topbar {
  height: var(--header-h);
  background: rgba(248, 250, 252, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 800;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}
.tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tb-mob-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
}
.tb-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
}
.tb-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}
.tb-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tb-notif {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text3);
  position: relative;
}
.notif-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border: 2px solid var(--white);
  border-radius: 50%;
}
.btn-new-test {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--teal);
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--sh-teal);
  transition: all 0.2s;
}
.btn-new-test:hover { background: var(--teal-l); transform: translateY(-1px); color: #fff; }

/* PAGE BODY */
.page-body {
  padding: 22px 28px 40px;
  flex: 1;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

/* WELCOME HERO */
.welcome-hero {
  background: var(--grad-hero);
  border-radius: var(--rxl);
  padding: 28px 32px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.12);
}
.wh-content { position: relative; z-index: 1; }
.wh-kicker { font-size: 10px; font-weight: 800; color: var(--teal-l); letter-spacing: 0.12em; margin-bottom: 8px; }
.wh-title { font-size: clamp(20px, 2.5vw, 28px); font-weight: 800; color: #fff; letter-spacing: -0.01em; margin-bottom: 8px; }
.wh-desc { font-size: 14px; color: rgba(255, 255, 255, 0.45); line-height: 1.5; margin-bottom: 18px; max-width: 480px; }
.wh-desc em { font-family: "Instrument Serif", serif; font-style: italic; color: #fff; }
.wh-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wh-chip { display: flex; align-items: center; gap: 5px; padding: 5px 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 100px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.6); }
.wh-chip i { color: var(--teal-l); }

.wh-stats { position: relative; z-index: 1; }
.wh-score-card { background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 20px; padding: 18px 24px; text-align: center; }
.whs-label { font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.25); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.whs-val { font-size: 32px; font-weight: 800; color: var(--teal-l); line-height: 1; margin-bottom: 4px; }
.whs-sub { font-size: 11px; color: rgba(255, 255, 255, 0.35); font-weight: 500; }

/* STAT CARDS */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 18px;
  box-shadow: var(--sh-card);
  transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--teal-soft); }
.stat-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.si-teal { background: var(--teal-bg); color: var(--teal); }
.si-amber { background: #fef3c7; color: var(--amber); }
.si-blue { background: #eff6ff; color: #3b82f6; }
.si-purple { background: #f5f3ff; color: #8b5cf6; }

.stat-val { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; line-height: 1; margin-bottom: 2px; }
.stat-lbl { font-size: 12px; color: var(--text3); font-weight: 500; }
.stat-change { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--off); font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.sc-up { color: var(--teal); }
.sc-neutral { color: var(--text3); }

/* SECTIONS GRID */
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.sec {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--rxl);
  box-shadow: var(--sh-card);
  overflow: hidden;
  margin-bottom: 22px;
}
.sec-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.sec-head-left { display: flex; align-items: center; gap: 10px; }
.sec-hicon { width: 34px; height: 34px; border-radius: 10px; background: var(--teal-bg); color: var(--teal); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.sec-htitle { font-size: 15px; font-weight: 800; color: var(--text); }
.sec-hsub { font-size: 11px; color: var(--text3); }
.sec-haction { font-size: 12px; font-weight: 700; color: var(--teal); text-decoration: none; }
.sec-body { padding: 18px 20px; }

/* SKILL LIST */
.skill-list { display: flex; flex-direction: column; gap: 12px; }
.progress-coming-note { margin-bottom: 14px; padding: 10px 12px; border-radius: 9px; background: var(--off); color: var(--text3); font-size: 11px; line-height: 1.5; }
.skill-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--off); border-radius: 12px; }
.skill-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--off); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.skill-name { font-size: 13px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.skill-sub { margin-top: 3px; font-size: 10px; color: var(--text3); line-height: 1.45; }
.skill-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 10px; color: var(--text3); }
.skill-meta strong { color: var(--text2); }
.skill-status-badge { font-size: 9px; font-weight: 800; padding: 3px 8px; border-radius: 6px; }

/* ROADMAP MINI */
.road-mini { display: flex; flex-direction: column; }
.rm-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--off); }
.rm-item:last-child { border: none; }
.rm-dot { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.rm-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.rm-sub { font-size: 11px; color: var(--text3); line-height: 1.4; }

/* COMPARISON BANNER */
.comp-banner { background: var(--white); border: 1px solid var(--teal-soft); border-radius: var(--rl); padding: 16px 22px; margin-bottom: 22px; display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 15px rgba(13, 148, 136, 0.05); }
.comp-icon { font-size: 24px; }
.comp-title { font-size: 14px; font-weight: 800; color: var(--text); }
.comp-sub { font-size: 12px; color: var(--text3); }
.comp-btn { margin-left: auto; padding: 8px 16px; background: var(--white); border: 1.2px solid var(--teal); color: var(--teal); border-radius: 10px; font-weight: 700; font-size: 12.5px; cursor: pointer; }

/* TODAY CARD */
.today-card { background: var(--grad-hero); border-radius: var(--rl); padding: 22px; color: #fff; margin-bottom: 18px; border: 1px solid rgba(255, 255, 255, 0.06); }
.tc-lbl { font-size: 10px; font-weight: 800; color: var(--teal-l); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.tc-title { font-size: 15px; font-weight: 800; margin-bottom: 6px; line-height: 1.3; }
.tc-desc { font-size: 12.5px; color: rgba(255, 255, 255, 0.55); line-height: 1.5; }
.tc-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 8px 16px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); color: #fff; border-radius: 10px; font-size: 12.5px; font-weight: 700; text-decoration: none; }
.tc-btn:disabled { cursor: not-allowed; opacity: .65; }

/* CHART WRAP */
.chart-wrap { height: 240px; position: relative; }

/* HISTORY TABLE & LIST */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th { padding: 0 16px 10px; text-align: left; font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1.2px solid var(--off); }
.history-table td { padding: 12px 16px; border-bottom: 1px solid var(--off); font-size: 13px; }
.ht-career { font-weight: 700; color: var(--text); }
.ht-code { background: var(--teal-bg); color: var(--teal); padding: 3px 8px; border-radius: 100px; font-size: 10px; font-weight: 800; }
.ht-score { font-weight: 800; color: var(--teal); }

/* PREMIUM CARD */
.prem-locked { background: var(--dark); border-radius: var(--rl); padding: 22px; color: #fff; }
.pl-tag { font-size: 9px; font-weight: 800; color: var(--amber); letter-spacing: 0.08em; }
.pl-title { font-size: 15px; font-weight: 800; margin: 6px 0; }
.pl-sub { font-size: 12px; color: rgba(255, 255, 255, 0.35); margin-bottom: 14px; }
.pl-feats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.pl-feat { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255, 255, 255, 0.6); }
.pl-btn { width: 100%; padding: 10px; background: var(--teal); border: none; border-radius: 10px; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.pl-btn:disabled { cursor: not-allowed; opacity: .55; }

/* RESPONSIVE & COMPACT */
@media (max-width: 1200px) {
  .grid2 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.active { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { left: 0; height: 60px; padding: 0 16px; }
  .tb-mob-toggle { display: flex; }
  .page-body { padding: 16px 16px 32px; }
}

@media (max-width: 768px) {
  .welcome-hero { flex-direction: column; align-items: flex-start; gap: 24px; padding: 22px; border-radius: 20px; }
  .wh-stats, .wh-score-card { width: 100%; }
  .wh-title { font-size: 22px; }
  .wh-desc { font-size: 13px; }
}

/* Table to Mobile Card View */
@media (max-width: 640px) {
  .history-table thead { display: none; }
  .history-table tr { display: flex; flex-direction: column; padding: 12px; border-bottom: 1.5px solid var(--off); gap: 6px; }
  .history-table td { border: none; padding: 0; display: flex; justify-content: space-between; align-items: center; }
  .history-table td::before { content: attr(data-label); font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; }
  .ht-career { font-size: 14px; }
  .history-table td:last-child { margin-top: 8px; }
}

@media (max-width: 430px) {
  .page-body { padding: 12px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-val { font-size: 20px; }
  .stat-lbl { font-size: 11px; }
  .sidebar { width: 84vw; }
  .wh-title { font-size: 20px; }
  .btn-new-test span { display: none; }
  .btn-new-test { padding: 10px; width: 40px; height: 40px; justify-content: center; }
  .skill-item { flex-wrap: wrap; }
  .skill-status-badge { margin-left: 44px; }
}

/* ANIMATIONS */
.fi { opacity: 0; transform: translateY(15px); transition: all 0.5s cubic-bezier(0.2, 1, 0.3, 1); }
.fi.vis { opacity: 1; transform: translateY(0); }
.d1 { transition-delay: 0.05s; }
.d2 { transition-delay: 0.1s; }
.d3 { transition-delay: 0.15s; }
