/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 220px;
  --bg-dark: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --accent: #6366f1;
  --accent2: #10b981;
  --accent3: #f59e0b;
  --accent4: #ef4444;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #cbd5e1;
  --border: #e2e8f0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(0,0,0,0.18);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo h2 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-logo span {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-section {
  padding: 8px 16px 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(99,102,241,0.18);
  color: #fff;
  border-left: 3px solid var(--accent);
}

.nav-item .icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-footer .avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.8rem;
}

.sidebar-footer .user-info small {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.sidebar-footer .user-info strong {
  color: #fff;
  font-size: 0.82rem;
}

/* ===== Main Content ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 0;
  min-height: 100vh;
}

/* ===== Top Bar ===== */
.topbar {
  background: var(--bg-card);
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.topbar .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topbar .badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== Page Content ===== */
.page-content {
  padding: 28px 32px;
}

/* ===== KPI Cards ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--accent));
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--accent2); }
.trend-down { color: var(--accent4); }

/* ===== Chart Grid ===== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-card h3 span {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

.chart-wrap-lg {
  position: relative;
  height: 320px;
}

/* ===== Kanban ===== */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.kanban-col {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kanban-col-header h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.col-badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}

.task-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.task-card h5 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.task-card .task-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
}

.tag-design  { background: #ede9fe; color: #6d28d9; }
.tag-dev     { background: #dbeafe; color: #1d4ed8; }
.tag-qa      { background: #fef3c7; color: #92400e; }
.tag-pm      { background: #d1fae5; color: #065f46; }
.tag-infra   { background: #fee2e2; color: #991b1b; }

/* ===== Progress Bar ===== */
.progress-bar-wrap {
  background: #e2e8f0;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* ===== Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* ===== Team Avatar ===== */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.team-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-lg {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1rem;
}

.team-card-header .info h4 { font-size: 0.9rem; font-weight: 700; }
.team-card-header .info small { font-size: 0.72rem; color: var(--text-muted); }

/* ===== Status Pill ===== */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-done    { background: #d1fae5; color: #065f46; }
.status-wip     { background: #dbeafe; color: #1d4ed8; }
.status-todo    { background: #f1f5f9; color: #475569; }
.status-risk    { background: #fee2e2; color: #991b1b; }

/* ===== Milestone ===== */
.milestone-list { margin-top: 16px; }

.milestone-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

.milestone-item:last-child { border-bottom: none; }

.ms-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ms-done  { background: var(--accent2); }
.ms-wip   { background: var(--accent); }
.ms-todo  { background: #cbd5e1; }
.ms-risk  { background: var(--accent4); }

.ms-label { flex: 1; font-weight: 500; }
.ms-date  { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .kanban-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
