*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── THEMES ─────────────────────────────────────────────────────────────────── */
:root, [data-theme="light"] {
  --bg: #e0e5ec;
  --s1: #b8bec7;
  --s2: #ffffff;
  --text: #31344b;
  --text2: #6b7080;
  --text3: #a0a5b8;
  --accent: #6c63ff;
  --accent2: #f857a6;
  --accent3: #43e97b;
  --accent4: #fa8231;
  --neo: 6px 6px 14px var(--s1), -6px -6px 14px var(--s2);
  --neo-sm: 3px 3px 8px var(--s1), -3px -3px 8px var(--s2);
  --neo-in: inset 4px 4px 8px var(--s1), inset -4px -4px 8px var(--s2);
  --neo-in-sm: inset 2px 2px 5px var(--s1), inset -2px -2px 5px var(--s2);
  --card-bg: var(--bg);
  --radius: 16px; --radius-sm: 10px; --radius-xs: 6px;
}
[data-theme="dark"] {
  --bg: #1e2235;
  --s1: #161929;
  --s2: #262b41;
  --text: #d4d8f0;
  --text2: #8890b0;
  --text3: #555d80;
  --accent: #7c72ff;
  --accent2: #f857a6;
  --accent3: #43e97b;
  --accent4: #fa8231;
  --neo: 6px 6px 14px var(--s1), -6px -6px 14px var(--s2);
  --neo-sm: 3px 3px 8px var(--s1), -3px -3px 8px var(--s2);
  --neo-in: inset 4px 4px 8px var(--s1), inset -4px -4px 8px var(--s2);
  --neo-in-sm: inset 2px 2px 5px var(--s1), inset -2px -2px 5px var(--s2);
  --card-bg: var(--bg);
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); transition: background .3s, color .3s; }

/* ── LAYOUT ──────────────────────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg);
  box-shadow: 4px 0 20px rgba(0,0,0,.06);
  display: flex; flex-direction: column; padding: 24px 16px;
  transition: width .3s, transform .3s; z-index: 100; overflow: hidden;
}
.sidebar.collapsed { width: 72px; }

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 24px; margin-bottom: 8px;
}
.logo-mark {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  width: 28px; height: 28px; flex-shrink: 0;
}
.logo-dot {
  border-radius: 3px;
  background: var(--accent);
}
.logo-dot:nth-child(2) { background: var(--accent2); }
.logo-dot:nth-child(3) { background: var(--accent3); }
.logo-dot:nth-child(4) { background: var(--accent4); }
.logo-text {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 18px; color: var(--text); white-space: nowrap;
  transition: opacity .3s;
}
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text3);
  padding: 12px 12px 6px; white-space: nowrap;
  transition: opacity .3s;
}
.sidebar.collapsed .nav-label { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text2);
  font-size: 14px; font-weight: 500;
  transition: all .2s; position: relative; white-space: nowrap;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform .2s; }
.nav-item:hover { color: var(--accent); background: var(--bg); box-shadow: var(--neo-sm); }
.nav-item:hover svg { transform: scale(1.1); }
.nav-item.active {
  color: var(--accent);
  box-shadow: var(--neo-in-sm);
}
.sidebar.collapsed .nav-item span:not(.badge) { opacity: 0; width: 0; overflow: hidden; }
.badge {
  margin-left: auto; background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px; flex-shrink: 0;
}
.badge.new { background: var(--accent2); }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; border-radius: var(--radius-sm);
  box-shadow: var(--neo-sm); margin-top: 16px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--text3); }
.sidebar.collapsed .user-info { display: none; }

.theme-toggle {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--bg); box-shadow: var(--neo-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text2); flex-shrink: 0; transition: all .2s;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; }
[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
.sidebar.collapsed .theme-toggle { display: none; }

/* ── MAIN ────────────────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── HEADER ──────────────────────────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.page-title h1 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.page-title p { font-size: 13px; color: var(--text2); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--neo-in); border-radius: var(--radius-sm);
  padding: 9px 14px; width: 220px; transition: box-shadow .2s;
}
.search-box:focus-within { box-shadow: var(--neo-in), 0 0 0 2px rgba(108,99,255,.2); }
.search-box input { background: none; border: none; outline: none; color: var(--text); font-size: 13px; width: 100%; }
.search-box input::placeholder { color: var(--text3); }
.search-box svg { color: var(--text3); flex-shrink: 0; }

.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  background: var(--accent2); border-radius: 50%; border: 2px solid var(--bg);
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────────── */
.neo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  background: var(--bg); box-shadow: var(--neo-sm);
  color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.neo-btn:hover { box-shadow: var(--neo); color: var(--accent); }
.neo-btn:active { box-shadow: var(--neo-in-sm); }
.neo-btn.icon-only { padding: 8px; }
.neo-btn.small { padding: 5px 12px; font-size: 12px; }
.neo-btn.icon-only.small { padding: 5px 8px; font-size: 14px; }

/* ── CONTENT ─────────────────────────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 0 28px 28px; display: flex; flex-direction: column; gap: 22px; }
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: var(--s1); border-radius: 2px; }

/* ── STAT CARDS ──────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

.stat-card {
  background: var(--bg); border-radius: var(--radius);
  box-shadow: var(--neo); padding: 22px;
  display: flex; gap: 14px; align-items: flex-start;
  position: relative; overflow: hidden; transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
#stat-revenue::before { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
#stat-users::before { background: linear-gradient(90deg, var(--accent3), #00b09b); }
#stat-orders::before { background: linear-gradient(90deg, var(--accent4), #f7971e); }
#stat-growth::before { background: linear-gradient(90deg, #a18cd1, #fbc2eb); }

.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--neo-sm);
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.revenue { color: var(--accent); }
.stat-icon.users { color: var(--accent3); }
.stat-icon.orders { color: var(--accent4); }
.stat-icon.growth { color: #a18cd1; }

.stat-info { flex: 1; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); margin-bottom: 6px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.positive { color: var(--accent3); }
.stat-change.negative { color: #ef4444; }

.stat-sparkline { position: absolute; bottom: 0; right: 0; width: 80px; height: 40px; opacity: .4; }

/* ── NEO CARD ────────────────────────────────────────────────────────────────── */
.neo-card {
  background: var(--bg); border-radius: var(--radius);
  box-shadow: var(--neo); padding: 22px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text3); }

/* ── MIDDLE ROW ──────────────────────────────────────────────────────────────── */
.mid-row { display: grid; grid-template-columns: 1fr 260px; gap: 18px; }
.chart-card canvas { width: 100%; display: block; }
.chart-tabs { display: flex; gap: 4px; }
.chart-tab {
  padding: 5px 12px; border: none; border-radius: 8px; font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit; color: var(--text2);
  background: var(--bg); box-shadow: var(--neo-sm); transition: all .2s;
}
.chart-tab.active, .chart-tab:hover { color: var(--accent); box-shadow: var(--neo-in-sm); }

.side-col { display: flex; flex-direction: column; gap: 18px; }
.donut-card { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-card canvas { margin: 0 auto; }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.legend-dot-label { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-val { font-weight: 600; font-family: 'Space Grotesk', sans-serif; }

/* ── BOTTOM ROW ──────────────────────────────────────────────────────────────── */
.bot-row { display: grid; grid-template-columns: 1fr 240px 240px; gap: 18px; }

/* Activity */
.activity-list { display: flex; flex-direction: column; gap: 12px; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; }
.activity-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; box-shadow: var(--neo-sm);
}
.activity-body { flex: 1; }
.activity-msg { font-size: 13px; color: var(--text); line-height: 1.4; }
.activity-msg span { font-weight: 600; color: var(--accent); }
.activity-time { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Goals */
.goals-list { display: flex; flex-direction: column; gap: 16px; }
.goal-item { display: flex; flex-direction: column; gap: 6px; }
.goal-header { display: flex; justify-content: space-between; font-size: 12px; }
.goal-name { font-weight: 500; color: var(--text2); }
.goal-pct { font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.goal-track { height: 8px; background: var(--bg); box-shadow: var(--neo-in-sm); border-radius: 4px; overflow: hidden; }
.goal-fill { height: 100%; border-radius: 4px; transition: width 1.2s cubic-bezier(.4,0,.2,1); }

/* Calendar */
.calendar { display: flex; flex-direction: column; gap: 6px; }
.cal-days-header { display: grid; grid-template-columns: repeat(7,1fr); text-align: center; font-size: 10px; font-weight: 600; color: var(--text3); margin-bottom: 4px; }
.cal-days { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 11px; border-radius: 8px; cursor: pointer; transition: all .15s;
  color: var(--text2);
}
.cal-day:hover { background: var(--bg); box-shadow: var(--neo-sm); color: var(--accent); }
.cal-day.today {
  background: var(--accent); color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(108,99,255,.4);
}
.cal-day.has-event::after {
  content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent2);
}
.cal-day { position: relative; }
.cal-day.other-month { opacity: .3; }
