/* ============================================
   PMO DASHBOARD — ValueStrategy Consulting
   Marketing Project Management System
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2231;
  --bg-card-hover: #252a3a;
  --bg-input: #252a3a;
  --border-color: #2d3348;
  --border-light: #363d54;

  --text-primary: #e8eaf0;
  --text-secondary: #9ba3b5;
  --text-muted: #6b7280;
  --text-accent: #818cf8;

  --accent-primary: #6366f1;
  --accent-primary-hover: #818cf8;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

  --status-completed: #22c55e;
  --status-completed-bg: rgba(34, 197, 94, 0.12);
  --status-in-progress: #f59e0b;
  --status-in-progress-bg: rgba(245, 158, 11, 0.12);
  --status-pending: #64748b;
  --status-pending-bg: rgba(100, 116, 139, 0.12);
  --status-blocked: #ef4444;
  --status-blocked-bg: rgba(239, 68, 68, 0.12);
  --status-review: #3b82f6;
  --status-review-bg: rgba(59, 130, 246, 0.12);

  --priority-critical: #ef4444;
  --priority-high: #f59e0b;
  --priority-medium: #3b82f6;
  --priority-low: #64748b;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --transition: all 0.2s ease;
  --sidebar-width: 260px;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--text-accent); text-decoration: none; }
a:hover { color: var(--accent-primary-hover); }

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
}

.logo-text h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-text span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary-hover);
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
}

.user-details .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-details .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb .separator { opacity: 0.4; }

.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-bar {
  position: relative;
}

.search-bar input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px 8px 36px;
  color: var(--text-primary);
  font-size: 13px;
  width: 260px;
  outline: none;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.icon-btn.has-notification::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--status-blocked);
  border-radius: 50%;
}

/* --- Page Content --- */
.page-content {
  padding: 24px 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

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

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-card.kpi-completed::before { background: var(--status-completed); }
.kpi-card.kpi-progress::before { background: var(--status-in-progress); }
.kpi-card.kpi-pending::before { background: var(--status-pending); }
.kpi-card.kpi-blocked::before { background: var(--status-blocked); }
.kpi-card.kpi-accent::before { background: var(--accent-gradient); }

.kpi-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-icon.green { background: var(--status-completed-bg); color: var(--status-completed); }
.kpi-icon.yellow { background: var(--status-in-progress-bg); color: var(--status-in-progress); }
.kpi-icon.blue { background: var(--status-review-bg); color: var(--status-review); }
.kpi-icon.red { background: var(--status-blocked-bg); color: var(--status-blocked); }
.kpi-icon.purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.kpi-trend.up { color: var(--status-completed); }
.kpi-trend.down { color: var(--status-blocked); }
.kpi-trend.neutral { color: var(--text-muted); }

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.kpi-progress-bar {
  margin-top: 12px;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}

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

.kpi-progress-bar .fill.green { background: var(--status-completed); }
.kpi-progress-bar .fill.yellow { background: var(--status-in-progress); }
.kpi-progress-bar .fill.blue { background: var(--status-review); }
.kpi-progress-bar .fill.purple { background: var(--accent-secondary); }

/* --- Cards & Sections --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

.card-body.no-padding {
  padding: 0;
}

/* --- Grid Layouts --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}

/* --- Phase/Project Cards --- */
.phase-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phase-item {
  display: grid;
  grid-template-columns: 40px 1fr 120px 100px 140px 80px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
}

.phase-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color);
  border-radius: var(--radius-sm);
}

.phase-item .phase-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.phase-item .phase-info h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.phase-item .phase-info p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.phase-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phase-progress .bar {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

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

.phase-progress .pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 35px;
  text-align: right;
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.badge-in-progress {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress);
}

.badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}

.badge-blocked {
  background: var(--status-blocked-bg);
  color: var(--status-blocked);
}

.badge-review {
  background: var(--status-review-bg);
  color: var(--status-review);
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Priority badges */
.badge-critical { background: rgba(239,68,68,0.12); color: #ef4444; }
.badge-high { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-medium { background: rgba(59,130,246,0.12); color: #3b82f6; }
.badge-low { background: rgba(100,116,139,0.12); color: #64748b; }

/* --- Owner Tag --- */
.owner-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.owner-tag .avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
}

.avatar-jose { background: #6366f1; }
.avatar-gonzalo { background: #22c55e; }
.avatar-claude { background: #8b5cf6; }
.avatar-david { background: #f59e0b; }
.avatar-magdalena { background: #ec4899; }

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding: 12px 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
}

.timeline-item.completed::before {
  background: var(--status-completed);
  border-color: var(--status-completed);
}

.timeline-item.active::before {
  background: var(--status-in-progress);
  border-color: var(--status-in-progress);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.timeline-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.timeline-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Task List --- */
.task-list {
  display: flex;
  flex-direction: column;
}

.task-item {
  display: grid;
  grid-template-columns: 32px 1fr 120px 100px 100px 60px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  transition: var(--transition);
}

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

.task-item:hover {
  background: var(--bg-card-hover);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  background: transparent;
  color: transparent;
  font-size: 12px;
}

.task-checkbox:hover {
  border-color: var(--accent-primary);
}

.task-checkbox.checked {
  background: var(--status-completed);
  border-color: var(--status-completed);
  color: white;
}

.task-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.task-title.completed-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}

.task-item:hover .task-actions {
  opacity: 1;
}

.task-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.task-action-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.task-action-btn.delete:hover {
  color: var(--status-blocked);
}

/* --- Tab System --- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  padding: 0 4px;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  position: relative;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent-primary-hover);
  border-bottom-color: var(--accent-primary);
}

.tab .tab-count {
  margin-left: 6px;
  font-size: 11px;
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 8px;
  color: var(--text-muted);
}

.tab.active .tab-count {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary-hover);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- Gantt Chart (Simplified) --- */
.gantt-container {
  overflow-x: auto;
  padding-bottom: 12px;
}

.gantt-chart {
  display: flex;
  flex-direction: column;
  min-width: 900px;
}

.gantt-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.gantt-label-col {
  width: 200px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gantt-timeline-col {
  flex: 1;
  display: flex;
}

.gantt-week {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 0;
  border-left: 1px solid var(--border-color);
  position: relative;
}

.gantt-week.current {
  color: var(--accent-primary-hover);
  font-weight: 600;
}

.gantt-week.current::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  bottom: -500px;
  width: 2px;
  background: rgba(99, 102, 241, 0.2);
  transform: translateX(-50%);
  z-index: 1;
}

.gantt-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(45, 51, 72, 0.3);
}

.gantt-row-label {
  width: 200px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  padding-right: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-bars {
  flex: 1;
  display: flex;
  position: relative;
  height: 28px;
}

.gantt-bar {
  position: absolute;
  height: 22px;
  top: 3px;
  border-radius: 4px;
  font-size: 10px;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.2s;
}

.gantt-bar:hover {
  opacity: 0.85;
  box-shadow: var(--shadow-md);
}

.gantt-bar.completed { background: var(--status-completed); }
.gantt-bar.in-progress { background: var(--status-in-progress); }
.gantt-bar.pending { background: var(--status-pending); }
.gantt-bar.blocked { background: var(--status-blocked); }
.gantt-bar.review { background: var(--status-review); }

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* --- Filters Bar --- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.filter-chip.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-primary-hover);
}

/* --- Select & Input --- */
.form-select, .form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-select option {
  background: var(--bg-secondary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

/* --- Progress Ring --- */
.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.progress-ring .ring-bg {
  stroke: var(--border-color);
}

.progress-ring .ring-fill {
  transition: stroke-dashoffset 1s ease;
}

.progress-ring .ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.progress-ring .ring-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.progress-ring .ring-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Activity Feed --- */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.activity-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Calendar Mini --- */
.calendar-mini {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day-header {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
  text-transform: uppercase;
}

.calendar-day {
  text-align: center;
  padding: 6px 4px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.calendar-day:hover {
  background: var(--bg-card-hover);
}

.calendar-day.today {
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
}

.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-secondary);
}

.calendar-day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

/* --- Stat Pill --- */
.stat-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
}

.stat-pill .stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stat-pill .stat-value {
  font-weight: 700;
  color: var(--text-primary);
}

.stat-pill .stat-label {
  color: var(--text-muted);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h4 {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto;
}

/* --- Tooltip --- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* --- View Containers --- */
.view-container {
  display: none;
}

.view-container.active {
  display: block;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .grid-1-2 { grid-template-columns: 1fr; }

  .phase-item {
    grid-template-columns: 32px 1fr 100px 80px;
  }

  .phase-item .phase-dates,
  .phase-item .phase-actions {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-content {
    padding: 16px;
  }

  .top-bar {
    padding: 12px 16px;
  }

  .search-bar input {
    width: 180px;
  }

  .task-item {
    grid-template-columns: 32px 1fr 80px;
  }

  .task-item .task-owner,
  .task-item .task-priority,
  .task-item .task-actions {
    display: none;
  }

  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .search-bar {
    display: none;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-in {
  animation: fadeIn 0.3s ease forwards;
}

.card, .kpi-card {
  animation: fadeIn 0.4s ease forwards;
}

/* --- Detail Panel (for project drill-down) --- */
.detail-panel {
  display: none;
}

.detail-panel.active {
  display: block;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-back {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.detail-back:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.detail-title h2 {
  font-size: 20px;
  font-weight: 700;
}

.detail-title .detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

/* --- Subtask styles --- */
.subtask-group {
  margin-left: 20px;
  border-left: 2px solid var(--border-color);
  padding-left: 12px;
}

.subtask-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
}

.subtask-toggle:hover {
  color: var(--text-secondary);
}

/* --- Notification Toast --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  animation: slideInRight 0.3s ease;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--status-completed); }
.toast.error { border-left: 3px solid var(--status-blocked); }
.toast.info { border-left: 3px solid var(--status-review); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Drag handle --- */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
}

.task-item:hover .drag-handle {
  opacity: 1;
}

/* --- Inline edit --- */
.inline-edit {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
  padding: 2px 4px;
  border-radius: 4px;
  outline: none;
  width: 100%;
}

.inline-edit:focus {
  background: var(--bg-input);
  border-color: var(--accent-primary);
}

/* --- Chart placeholder --- */
.chart-area {
  width: 100%;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-bar-label {
  width: 100px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar {
  height: 24px;
  border-radius: 4px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: white;
  font-weight: 500;
  min-width: 30px;
}
